<commit_before><polymer-element name="ceci-card" extends="ceci-card-base">
  <template>
    <style>
      :host #garbageLeft {
        background-image: url('/designer/images/garbage-icon-closed.png');
        background-color: transparent;
        background-size: contain;
        background-repeat: no-repeat;
        width: 100px;
        height: 100px;
        position: absolute;
        right: -200px;
        top: 50px;
        border-radius: 20px;
        border: dotted 3px rgba(0,0,0,.3)
      }

      :host #garbageLeft.open {
        background-image: url('/designer/images/garbage-icon-open.png');
        background-color: #dddddd;
      }
    </style>
    <div id="garbageLeft" hidden="true"></div>
    <shadow></shadow>
  </template>
  <script>
    require(['designer/editable', 'analytics'], function(Editable, analytics) {
      Polymer('ceci-card', {
        ready: function() {
          this.super();

          var that = this;

          function createSortable() {
            var draggedOff = false;

            $(that).sortable({
              distance : 10,
              handle: '.handle',
              start: function() {
                that.$.garbageLeft.hidden = false;
                that.$.garbageLeft.classList.remove('open');
                draggedOff = false;
              },
              beforeStop: function(ev, ui) {
                that.$.garbageLeft.hidden = true;
                if (draggedOff) {
                  ui.item[0].parentNode.removeChild(ui.item[0]);
                  Editable.removeAttributes();
                  analytics.event("Removed Component", { label : ui.item[0].localName});
                }
              },
              sort : function(ev, ui) {
                var offset = ui.position.left;
                if(offset > 150 || offset < -150) {
                  that.$.garbageLeft.classList.add('open');
                  draggedOff = true;
                } else {
                  that.$.garbageLeft.classList.remove('open');
                  draggedOff = false;
                }
              },
              stop: function(ev, ui) {
                if (!draggedOff) {
                  that.async(function() {
                    document.dispatchEvent(new CustomEvent('CeciElementsSorted', {bubbles: true, detail: ui.item[0]}));
                  });
                }
              }
            });
          }

          var interval = setInterval(function() {
            if (window.$ && $('<div>').sortable) {
              clearInterval(interval);
              createSortable();
            }
          }, 100);
        }
      });
    });
  </script>
</polymer-element><commit_msg>fix #1220 Ensure ceci card exists is ready and don't wait for require if we don't need to<commit_after><polymer-element name="ceci-card" extends="ceci-card-base">
  <template>
    <style>
      :host #garbageLeft {
        background-image: url('/designer/images/garbage-icon-closed.png');
        background-color: transparent;
        background-size: contain;
        background-repeat: no-repeat;
        width: 100px;
        height: 100px;
        position: absolute;
        right: -200px;
        top: 50px;
        border-radius: 20px;
        border: dotted 3px rgba(0,0,0,.3)
      }

      :host #garbageLeft.open {
        background-image: url('/designer/images/garbage-icon-open.png');
        background-color: #dddddd;
      }
    </style>
    <div id="garbageLeft" hidden="true"></div>
    <shadow></shadow>
  </template>
  <script>
    Polymer('ceci-card', {
      ready: function() {
        this.super();

        var that = this;

        require(['designer/editable', 'analytics'], function(Editable, analytics) {
          function createSortable() {
            var draggedOff = false;

            $(that).sortable({
              distance : 10,
              handle: '.handle',
              start: function() {
                that.$.garbageLeft.hidden = false;
                that.$.garbageLeft.classList.remove('open');
                draggedOff = false;
              },
              beforeStop: function(ev, ui) {
                that.$.garbageLeft.hidden = true;
                if (draggedOff) {
                  ui.item[0].parentNode.removeChild(ui.item[0]);
                  Editable.removeAttributes();
                  analytics.event("Removed Component", { label : ui.item[0].localName});
                }
              },
              sort : function(ev, ui) {
                var offset = ui.position.left;
                if(offset > 150 || offset < -150) {
                  that.$.garbageLeft.classList.add('open');
                  draggedOff = true;
                } else {
                  that.$.garbageLeft.classList.remove('open');
                  draggedOff = false;
                }
              },
              stop: function(ev, ui) {
                if (!draggedOff) {
                  that.async(function() {
                    document.dispatchEvent(new CustomEvent('CeciElementsSorted', {bubbles: true, detail: ui.item[0]}));
                  });
                }
              }
            });
          }

          var interval = setInterval(function() {
            if (window.$ && $('<div>').sortable) {
              clearInterval(interval);
              createSortable();
            }
          }, 100);
        });
      }
    });
  </script>
</polymer-element>
{'fraction_non_alphanumeric': 0.13393515106853354, 'fraction_numerical': 0.012896094325718496, 'mean_word_length': 1.4432943294329432, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3515350', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1449, 'n_words': 266}