<commit_before>(function () {

  var Clock = function (opts) {
    opts = opts || {};
    this.tickListener = null;
    this.requestAnimationFrame = opts.requestAnimationFrame || window.requestAnimationFrame.bind(window);
    this.cancelAnimationFrame = opts.cancelAnimationFrame || window.cancelAnimationFrame.bind(window);
    this.requestId = null;
    this.startTime = null;
    this.isRunning = false;
    this.isComplete = false;
  };

  Clock.create = function (opts) {
    return new Clock(opts);
  };

  Clock.prototype.onTick = function (fn) {
    this.tickListener = fn;
  };

  Clock.prototype._tick = function (time) {
    if (this.isRunning) {
      var absoluteTime = Date.now();
      this.requestId = this.requestAnimationFrame(this._tick.bind(this));
      if (this.tickListener)
        this.tickListener(absoluteTime);
    }
  };

  Clock.prototype.start = function () {
    if (!this.isRunning) {
      this.isRunning = true;
      this.isComplete = false;
      this.startTime = Date.now();
      this.requestId = this.requestAnimationFrame(this._tick.bind(this));
    }
    return this;
  };

  Clock.prototype.stop = function () {
    if (this.isRunning) {
      this.isRunning = false;
      this.cancelAnimationFrame(this.requestId);
    }
    return this;
  };

  var Animator = function (opts) {
    opts = opts || {};
    this.clock = opts.clock || Clock.create();
    if (this.clock)
      this.clock.onTick(this.frame.bind(this));

    this.frameListener = null;
    this.active = [];
  };

  Animator.create = function (opts) {
    return new Animator(opts);
  };

  Animator.prototype.onFrame = function (fn) {
    this.frameListener = fn;
    return this;
  };

  Animator.prototype.frame = function (time) {
    this.active.forEach(function (animation) { animation.frame(time); });
    if (this.frameListener) this.frameListener(time);
    return this;
  };

  Animator.prototype.animate = function (opts) {
    opts = opts || {};
    var self = this;
    var animation = Animation.create(opts);
    animation.on('start', function () { self._addToActive(animation); })
      .on('stop', function () { self._removeFromActive(animation); })
      .on('complete', function () { self._removeFromActive(animation); });
    return animation;
  };

  Animator.prototype._addToActive = function (animation) {
    if (this.active.indexOf(animation) === -1) {
      this.active.push(animation);
      if (this.clock && !this.clock.isRunning)
        this.clock.start();
    }
    return this;
  };

  Animator.prototype._removeFromActive = function (animation) {
    var index = this.active.indexOf(animation);
    if (index !== -1) {
      this.active.splice(index, 1);
      if (this.active.length < 1 && this.clock && this.clock.isRunning)
        this.clock.stop();
    }
    return this;
  };

  /*
   * TERMS OF USE - EASING EQUATIONS
   *
   * Open source under the BSD License.
   *
   * Copyright © 2001 <NAME>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modification,<commit_msg>Use convenience 'on's.<commit_after>(function () {

  var Clock = function (opts) {
    opts = opts || {};
    this.tickListener = null;
    this.requestAnimationFrame = opts.requestAnimationFrame || window.requestAnimationFrame.bind(window);
    this.cancelAnimationFrame = opts.cancelAnimationFrame || window.cancelAnimationFrame.bind(window);
    this.requestId = null;
    this.startTime = null;
    this.isRunning = false;
    this.isComplete = false;
  };

  Clock.create = function (opts) {
    return new Clock(opts);
  };

  Clock.prototype.onTick = function (fn) {
    this.tickListener = fn;
  };

  Clock.prototype._tick = function (time) {
    if (this.isRunning) {
      var absoluteTime = Date.now();
      this.requestId = this.requestAnimationFrame(this._tick.bind(this));
      if (this.tickListener)
        this.tickListener(absoluteTime);
    }
  };

  Clock.prototype.start = function () {
    if (!this.isRunning) {
      this.isRunning = true;
      this.isComplete = false;
      this.startTime = Date.now();
      this.requestId = this.requestAnimationFrame(this._tick.bind(this));
    }
    return this;
  };

  Clock.prototype.stop = function () {
    if (this.isRunning) {
      this.isRunning = false;
      this.cancelAnimationFrame(this.requestId);
    }
    return this;
  };

  var Animator = function (opts) {
    opts = opts || {};
    this.clock = opts.clock || Clock.create();
    if (this.clock)
      this.clock.onTick(this.frame.bind(this));

    this.frameListener = null;
    this.active = [];
  };

  Animator.create = function (opts) {
    return new Animator(opts);
  };

  Animator.prototype.onFrame = function (fn) {
    this.frameListener = fn;
    return this;
  };

  Animator.prototype.frame = function (time) {
    this.active.forEach(function (animation) { animation.frame(time); });
    if (this.frameListener) this.frameListener(time);
    return this;
  };

  Animator.prototype.animate = function (opts) {
    opts = opts || {};
    var self = this;
    var animation = Animation.create(opts);
    animation.onStart(function () { self._addToActive(animation); })
      .onStop(function () { self._removeFromActive(animation); })
      .onComplete(function () { self._removeFromActive(animation); });
    return animation;
  };

  Animator.prototype._addToActive = function (animation) {
    if (this.active.indexOf(animation) === -1) {
      this.active.push(animation);
      if (this.clock && !this.clock.isRunning)
        this.clock.start();
    }
    return this;
  };

  Animator.prototype._removeFromActive = function (animation) {
    var index = this.active.indexOf(animation);
    if (index !== -1) {
      this.active.splice(index, 1);
      if (this.active.length < 1 && this.clock && this.clock.isRunning)
        this.clock.stop();
    }
    return this;
  };

  /*
   * TERMS OF USE - EASING EQUATIONS
   *
   * Open source under the BSD License.
   *
   * Copyright © 2001 <NAME>
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modification,
{'fraction_non_alphanumeric': 0.13869444896630312, 'fraction_numerical': 0.00260459059091649, 'mean_word_length': 2.896005072923272, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '4954867', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1853, 'n_words': 384}