<commit_before><link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../paper-input/paper-input.html">
<script src="../bacon/dist/Bacon.js"></script>

<dom-module id="search-box">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <iron-ajax
      id="req"
      url="{{url}}"
      handle-as="json"
      on-request="handleRequest"
      on-response="handleResponse"
      last-response="{{lastResponse}}"></iron-ajax>
    <paper-input id="input" label="{{label}}"></paper-input>
  </template>
</dom-module>

<script>
  (function () {
    Polymer({
      is: 'search-box',
      properties: {
        url: {
          type: String,
          value: '/'
        },
        label: {
          type: String,
          value: ''
        },
        debounce: {
          type: Number,
          value: 300
        },
        minQueryLength: {
          type: Number,
          value: 3
        },
        lastResponse: {
          type: Array,
          notify: true,
          value: function () {return [];}
        }
      },
      _request: function (query) {
        this.$.req.params = {q: query};
        return Bacon.fromEvent(this.$.req.generateRequest().xhr, 'load');
      },
      ready: function () {
        var input = this.$.input
        var query = Bacon.fromEvent(input, 'keyup')
          .debounce(this.debounce).map(function () { return input.value;})
          .filter(function (value) {
            return value.length >= this.minQueryLength;
          }.bind(this))
          .skipDuplicates().toProperty('');
        var request = query.changes().flatMapLatest(this._request.bind(this));
        query.changes().awaiting(request).onValue(function (x) {
          if(x) this.fire('waiting')
        }.bind(this));
      },
      handleRequest: function (e) {
        this.fire('request');
      },
      handleResponse: function (e) {
        this.fire('response', e.detail)
      }
    });
  })()
</script>
<commit_msg>Using Bacon.min.js instead of Bacon.js<commit_after><link rel="import" href="../polymer/polymer.html">
<script src="../bacon/dist/Bacon.min.js"></script>
<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../paper-input/paper-input.html">

<dom-module id="search-box">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <iron-ajax
      id="req"
      url="{{url}}"
      handle-as="json"
      on-request="handleRequest"
      on-response="handleResponse"
      last-response="{{lastResponse}}"></iron-ajax>
    <paper-input id="input" label="{{label}}"></paper-input>
  </template>
</dom-module>

<script>
  (function () {
    Polymer({
      is: 'search-box',
      properties: {
        url: {
          type: String,
          value: '/'
        },
        label: {
          type: String,
          value: ''
        },
        debounce: {
          type: Number,
          value: 300
        },
        minQueryLength: {
          type: Number,
          value: 3
        },
        lastResponse: {
          type: Array,
          notify: true,
          value: function () {return [];}
        }
      },
      _request: function (query) {
        this.$.req.params = {q: query};
        return Bacon.fromEvent(this.$.req.generateRequest().xhr, 'load');
      },
      ready: function () {
        var input = this.$.input
        var query = Bacon.fromEvent(input, 'keyup')
          .debounce(this.debounce).map(function () { return input.value;})
          .filter(function (value) {
            return value.length >= this.minQueryLength;
          }.bind(this))
          .skipDuplicates().toProperty('');
        var request = query.changes().flatMapLatest(this._request.bind(this));
        query.changes().awaiting(request).onValue(function (x) {
          if(x) this.fire('waiting')
        }.bind(this));
      },
      handleRequest: function (e) {
        this.fire('request');
      },
      handleResponse: function (e) {
        this.fire('response', e.detail)
      }
    });
  })()
</script>

{'fraction_non_alphanumeric': 0.17395506160908433, 'fraction_numerical': 0.0019328340178787146, 'mean_word_length': 1.9093464511595222, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 39, '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': '7009072', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1248, 'n_words': 222}