<commit_before>(function (root, factory) {
  if(typeof define === 'function' && define.amd) {
    define(['video.js'], function(videojs){
      return (root.WistiaTech = factory(videojs));
    });
  } else if(typeof module === 'object' && module.exports) {
    module.exports = (root.WistiaTech = factory(require('video.js')));
  } else {
    root.WistiaTech = factory(root.videojs);
  }
}(this, function(videojs) {
  'use strict';

  var WistiaState = {
    UNSTARTED: -1,
    ENDED: 0,
    PLAYING: 1,
    PAUSED: 2,
    BUFFERING: 3
  };

  var Tech = videojs.getComponent('Tech');

  var WistiaTech = videojs.extend(Tech, {
    constructor: function(options, ready) {
      Tech.call(this, options, ready);
      this.setSrc(this.options_.source.src, true);
    },

    dispose: function() {
      this.wistiaVideo.remove();
      this.el_.parentNode.removeChild(this.el_);
    },

    createEl: function() {
      var protocol = (document.location.protocol === 'file:') ? 'http:' : document.location.protocol;
      this.wistia = {};
      this.wistiaInfo = {};
      this.baseUrl = protocol + '//fast.wistia.com/embed/iframe/';
      this.videoOptions = WistiaTech.parseUrl(this.options_.source.src);
      this.videoId = this.videoOptions.videoId;

      var divWrapper = videojs.createEl('div', {
        id: this.videoId,
        className: this.videoOptions.classString,
        width: this.options_.width || "100%",
        height: this.options_ .height || "100%"
      });

      this.wistiaScriptElement = videojs.createEl('script', {
        src: protocol + "//fast.wistia.com/assets/external/E-v1.js"
      });

      divWrapper.insertBefore(this.wistiaScriptElement, divWrapper.firstChild);

      this.initPlayer();

      return divWrapper;
    },

    initPlayer: function() {
      var self = this;
      var wistiaVideoID = WistiaTech.parseUrl(this.options_.source.src).videoId;

      self.wistiaInfo = {
        state: WistiaState.UNSTARTED,
        volume: 1,
        muted: false,
        muteVolume: 1,
        time: 0,
        duration: 0,
        buffered: 0,
        url: self.baseUrl + self.videoId,
        error: null
      };

      this.wistiaScriptElement.onload = function() {
        self.wistiaVideo = Wistia.api(self.videoId);
        window._wq = window._wq || [];

        var videos = {};
        videos[self.videoId] = function(video) {
          self.wistiaVideo = video;
          self.onLoad();
        };

        window._wq.push(videos);
      };
    },

    ended: function() {
      return (this.wistiaInfo.state === WistiaState.ENDED)
    },

    onLoad: function() {
      this.wistiaInfo = {
        state: WistiaState.UNSTARTED,
        volume: 1,
        muted: false,
        muteVolume: 1,
        time: 0,
        duration: this.wistiaVideo.duration(),
        buffered: 0,
        url: this.baseUrl + this.videoId,
        error: null
      };

      var self = this;

      this.wistiaVideo.hasData(function() {
        self.onReady();
      });

      this.wistiaVideo.bind('pause', function() {
        self.onPause();
      });

      this.wistiaVideo.bind('play', function() {
        self.onPlay();
      });

      this.wistiaVideo.bind('seek', function(currentTime, lastTime) {
        self.onSeek({seconds: currentTime});
      });

      this.wistiaVideo.bind('secondchange', function(s) {
        self.wistiaInfo.time = s;
        self.player_.trigger('timeupdate');

        if( self.wistiaVideo.percentWatched() >= 1) {
          self.onFinish();
        }
      });

      this.wistiaVideo.bind('volumechange', function(v) {
        self.setVolume(v);
      });

      this.wistiaVideo.bind('end', function(t) {
        self.onFinish();
      });

      this.wistiaVideo.bind('duration', function() {
        self.duration();
      });

    },

    onReady: function(){
      this.isReady_ = true;
      this.triggerReady();
      this.trigger('loadedmetadata');
      if (this.startMuted) {
        this.setMuted(true);
        this.startMuted = false;
      }
    },

    duration: function() {
      var d = this.wistiaVideo ? this.wistiaVideo.duration() : 0;
      return d;
    },

    onLoadProgress: function(data) {
      var durationUpdate = !this.wistiaInfo.duration;
      this.wistiaInfo.duration = data.duration;
      this.wistiaInfo.buffered = data.percent;
      this.trigger('progress');
      if (durationUpdate) this.trigger('durationchange');
    },

    onPlayProgress: function(data) {
      this.wistiaInfo.time = data.seconds;
      this.wistiaVideo.time(this.wistiaInfo.time);
      this.trigger('timeupdate');
    },

    onPlay: function() {
      this.wistiaInfo.state = WistiaState.PLAYING;<commit_msg>style fix<commit_after>(function (root, factory) {
  if(typeof define === 'function' && define.amd) {
    define(['video.js'], function(videojs){
      return (root.WistiaTech = factory(videojs));
    });
  } else if(typeof module === 'object' && module.exports) {
    module.exports = (root.WistiaTech = factory(require('video.js')));
  } else {
    root.WistiaTech = factory(root.videojs);
  }
}(this, function(videojs) {
  'use strict';

  var WistiaState = {
    UNSTARTED: -1,
    ENDED: 0,
    PLAYING: 1,
    PAUSED: 2,
    BUFFERING: 3
  };

  var Tech = videojs.getComponent('Tech');

  var WistiaTech = videojs.extend(Tech, {
    constructor: function(options, ready) {
      Tech.call(this, options, ready);
      this.setSrc(this.options_.source.src, true);
    },

    dispose: function() {
      this.wistiaVideo.remove();
      this.el_.parentNode.removeChild(this.el_);
    },

    createEl: function() {
      var protocol = (document.location.protocol === 'file:') ? 'http:' : document.location.protocol;
      this.wistia = {};
      this.wistiaInfo = {};
      this.baseUrl = protocol + '//fast.wistia.com/embed/iframe/';
      this.videoOptions = WistiaTech.parseUrl(this.options_.source.src);
      this.videoId = this.videoOptions.videoId;

      var divWrapper = videojs.createEl('div', {
        id: this.videoId,
        className: this.videoOptions.classString,
        width: this.options_.width || "100%",
        height: this.options_ .height || "100%"
      });

      this.wistiaScriptElement = videojs.createEl('script', {
        src: protocol + "//fast.wistia.com/assets/external/E-v1.js"
      });

      divWrapper.insertBefore(this.wistiaScriptElement, divWrapper.firstChild);

      this.initPlayer();

      return divWrapper;
    },

    initPlayer: function() {
      var self = this;
      var wistiaVideoID = WistiaTech.parseUrl(this.options_.source.src).videoId;

      self.wistiaInfo = {
        state: WistiaState.UNSTARTED,
        volume: 1,
        muted: false,
        muteVolume: 1,
        time: 0,
        duration: 0,
        buffered: 0,
        url: self.baseUrl + self.videoId,
        error: null
      };

      this.wistiaScriptElement.onload = function() {
        self.wistiaVideo = Wistia.api(self.videoId);
        window._wq = window._wq || [];

        var videos = {};
        videos[self.videoId] = function(video) {
          self.wistiaVideo = video;
          self.onLoad();
        };

        window._wq.push(videos);
      };
    },

    ended: function() {
      return (this.wistiaInfo.state === WistiaState.ENDED);
    },

    onLoad: function() {
      this.wistiaInfo = {
        state: WistiaState.UNSTARTED,
        volume: 1,
        muted: false,
        muteVolume: 1,
        time: 0,
        duration: this.wistiaVideo.duration(),
        buffered: 0,
        url: this.baseUrl + this.videoId,
        error: null
      };

      var self = this;

      this.wistiaVideo.hasData(function() {
        self.onReady();
      });

      this.wistiaVideo.bind('pause', function() {
        self.onPause();
      });

      this.wistiaVideo.bind('play', function() {
        self.onPlay();
      });

      this.wistiaVideo.bind('seek', function(currentTime, lastTime) {
        self.onSeek({seconds: currentTime});
      });

      this.wistiaVideo.bind('secondchange', function(s) {
        self.wistiaInfo.time = s;
        self.player_.trigger('timeupdate');

        if( self.wistiaVideo.percentWatched() >= 1) {
          self.onFinish();
        }
      });

      this.wistiaVideo.bind('volumechange', function(v) {
        self.setVolume(v);
      });

      this.wistiaVideo.bind('end', function(t) {
        self.onFinish();
      });

    },

    onReady: function(){
      this.isReady_ = true;
      this.triggerReady();
      this.trigger('loadedmetadata');
      if (this.startMuted) {
        this.setMuted(true);
        this.startMuted = false;
      }
    },

    onLoadProgress: function(data) {
      var durationUpdate = !this.wistiaInfo.duration;
      this.wistiaInfo.duration = data.duration;
      this.wistiaInfo.buffered = data.percent;
      this.trigger('progress');
      if (durationUpdate) this.trigger('durationchange');
    },

    onPlayProgress: function(data) {
      this.wistiaInfo.time = data.seconds;
      this.wistiaVideo.time(this.wistiaInfo.time);
      this.trigger('timeupdate');
    },

    onPlay: function() {
      this.wistiaInfo.state = WistiaState.PLAYING;
{'fraction_non_alphanumeric': 0.14621154473312317, 'fraction_numerical': 0.00489183606913795, 'mean_word_length': 2.3177064551027766, 'pattern_counts': {'":': 0, '<': 3, '<?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': '452073', 'n_tokens_mistral': 3065, 'n_tokens_neox': 2936, 'n_words': 476}