<commit_before>/* globals Pikaday */

import Ember from 'ember';
import moment from 'moment';

export default Ember.Component.extend({
  tagName: 'input',
  attributeBindings: ['readonly', 'disabled', 'placeholder', 'type', 'name', 'size', 'required'],
  type: 'text',

  firstRender: true,

  setupPikaday: Ember.on('didRender', function() {
    if (this.get('firstRender')) {
      var that = this;
      var firstDay = this.get('firstDay');

      var options = {
        field: this.$()[0],
        onOpen: Ember.run.bind(this, this.onPikadayOpen),
        onClose: Ember.run.bind(this, this.onPikadayClose),
        onSelect: Ember.run.bind(this, this.onPikadaySelect),
        onDraw: Ember.run.bind(this, this.onPikadayRedraw),
        firstDay: (typeof firstDay !== 'undefined') ? parseInt(firstDay, 10) : 1,
        format: this.get('format') || 'DD.MM.YYYY',
        yearRange: that.determineYearRange(),
        minDate: this.get('minDate') || null,
        maxDate: this.get('maxDate') || null,
        theme: this.get('theme') || null
      };

      if (this.get('i18n')) {
        options.i18n = this.get('i18n');
      }

      var pikaday = new Pikaday(options);

      this.set('pikaday', pikaday);
      this.setPikadayDate();

      this.addObserver('value', function() {
        that.setPikadayDate();
      });

      this.addObserver('minDate', function() {
        this.setMinDate();
      });

      this.addObserver('maxDate', function() {
        this.setMaxDate();<commit_msg>Wire up position and reposition options<commit_after>/* globals Pikaday */

import Ember from 'ember';
import moment from 'moment';

const { isPresent } = Ember;

export default Ember.Component.extend({
  tagName: 'input',
  attributeBindings: ['readonly', 'disabled', 'placeholder', 'type', 'name', 'size', 'required'],
  type: 'text',

  firstRender: true,

  setupPikaday: Ember.on('didRender', function() {
    if (this.get('firstRender')) {
      var that = this;
      var firstDay = this.get('firstDay');

      var options = {
        field: this.$()[0],
        onOpen: Ember.run.bind(this, this.onPikadayOpen),
        onClose: Ember.run.bind(this, this.onPikadayClose),
        onSelect: Ember.run.bind(this, this.onPikadaySelect),
        onDraw: Ember.run.bind(this, this.onPikadayRedraw),
        firstDay: (typeof firstDay !== 'undefined') ? parseInt(firstDay, 10) : 1,
        format: this.get('format') || 'DD.MM.YYYY',
        yearRange: that.determineYearRange(),
        minDate: this.get('minDate') || null,
        maxDate: this.get('maxDate') || null,
        theme: this.get('theme') || null
      };
      if (isPresent(this.get('position'))) {
        options['position'] = this.get('position');
      }
      if (isPresent(this.get('reposition'))) {
        options['reposition'] = this.get('reposition');
      }

      if (this.get('i18n')) {
        options.i18n = this.get('i18n');
      }

      var pikaday = new Pikaday(options);

      this.set('pikaday', pikaday);
      this.setPikadayDate();

      this.addObserver('value', function() {
        that.setPikadayDate();
      });

      this.addObserver('minDate', function() {
        this.setMinDate();
      });

      this.addObserver('maxDate', function() {
        this.setMaxDate();
{'fraction_non_alphanumeric': 0.16890243902439026, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 2.8920521945432975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6253762', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1054, 'n_words': 207}