<commit_before>// iiif-av-component v1.1.0 https://github.com/viewdir/iiif-av-component#readme
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifAvComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
///<reference path="../node_modules/typescript/lib/lib.es6.d.ts"/> 

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var IIIFComponents;
(function (IIIFComponents) {
    var AVComponent = (function (_super) {
        __extends(AVComponent, _super);
        function AVComponent(options) {
            var _this = _super.call(this, options) || this;
            _this.canvasInstances = [];
            _this._init();
            _this._resize();
            return _this;
        }
        AVComponent.prototype._init = function () {
            var success = _super.prototype._init.call(this);
            if (!success) {
                console.error("Component failed to initialise");
            }
            return success;
        };
        AVComponent.prototype.data = function () {
            return {
                helper: null,
                defaultCanvasHeight: 400,
                defaultCanvasWidth: 600
            };
        };
        AVComponent.prototype.set = function (data) {
            this.options.data = data;
            // reset all global properties and terminate all running processes
            this._reset();
            // render ui
            this._render();
            // resize everything
            this._resize();
        };
        AVComponent.prototype._reset = function () {
            for (var i = 0; i < this.canvasInstances.length; i++) {
                window.clearInterval(this.canvasInstances[i].highPriorityInterval);
                window.clearInterval(this.canvasInstances[i].lowPriorityInterval);
                window.clearInterval(this.canvasInstances[i].canvasClockInterval);
            }
            this.canvasInstances = [];
        };
        AVComponent.prototype._render = function () {
            this._$element.empty();
            var canvases = this._getCanvases();
            for (var i = 0; i < canvases.length; i++) {
                this._initCanvas(canvases[i]);
            }
        };
        AVComponent.prototype._getCanvases = function () {
            return this.options.data.helper.getCanvases();
        };
        AVComponent.prototype._initCanvas = function (canvas) {
            var $player = $('<div class="player"></div>');
            var $canvasContainer = $('<div class="canvasContainer"></div>');
            var $timelineContainer = $('<div class="timelineContainer"></div>');
            var $timelineItemContainer = $('<div class="timelineItemContainer"></div>');
            var $controlsContainer = $('<div class="controlsContainer"></div>');
            var $playButton = $('<button class="playButton">Play</button>');
            var $pauseButton = $('<button class="pauseButton">Pause</button>');
            var $timingControls = $('<span>Current Time: <span class="canvasTime"></span> / Duration: <span class="canvasDuration"></span></span>');
            $controlsContainer.append($playButton, $pauseButton, $timingControls);
            $player.append($canvasContainer, $timelineContainer, $timelineItemContainer, $controlsContainer);
            this._$element.append($player);
            var canvasInstance = new IIIFComponents.CanvasInstance(canvas);
            var canvasWidth = canvas.getWidth();
            var canvasHeight = canvas.getHeight();
            if (!canvasWidth) {
                canvasInstance.canvasWidth = this.options.data.defaultCanvasWidth;
            }
            else {
                canvasInstance.canvasWidth = canvasWidth;
            }
            if (!canvasHeight) {
                canvasInstance.canvasHeight = this.options.data.defaultCanvasHeight;
            }
            else {
                canvasInstance.canvasHeight = canvasHeight;
            }
            canvasInstance.$playerElement = $player;
            canvasInstance.logMessage = this._logMessage.bind(this);
            $timelineContainer.slider({
                value: 0,
                step: 0.01,
                orientation: "horizontal",
                range: "min",
                max: canvasInstance.canvasClockDuration,
                animate: false,
                create: function (evt, ui) {
                    // on create
                },
                slide: function (evt, ui) {
                    canvasInstance.setCurrentTime(ui.value);
                },
                stop: function (evt, ui) {
                    //canvasInstance.setCurrentTime(ui.value);
                }
            });
            this.canvasInstances.push(canvasInstance);
            canvasInstance.initContents();
            $playButton.on('click', function () {
                canvasInstance.playCanvas();
            });
            $pauseButton.on('click', function () {
                canvasInstance.pauseCanvas();
            });
            canvasInstance.setCurrentTime(0);
            $timingControls.find('.canvasDuration').text(IIIFComponents.AVComponentUtils.Utils.formatTime(canvasInstance.canvasClockDuration));
            this._logMessage('CREATED CANVAS: ' + canvasInstance.canvasClockDuration + ' seconds, ' + canvasInstance.canvasWidth + ' x ' + canvasInstance.canvasHeight + ' px.');
        };
        AVComponent.prototype._logMessage = function (message) {
            this.fire(AVComponent.Events.LOG, message);
        };
        AVComponent.prototype._resize = function () {
            // loop through all canvases resizing their elements
            for (var i = 0; i < this.canvasInstances.length; i++) {
                var canvasInstance = this.canvasInstances[i];
                if (canvasInstance.$playerElement) {
                    var $canvasContainer = canvasInstance.$playerElement.find('.canvasContainer');
                    var $timelineContainer = canvasInstance.$playerElement.find('.timelineContainer');
                    var containerWidth = $canvasContainer.width();
                    if (containerWidth) {
                        $timelineContainer.width(containerWidth);
                        var resizeFactorY = containerWidth / canvasInstance.canvasWidth;
                        //const newHeight: number = canvasInstance.canvasHeight * resizeFactorY; not used
                        $canvasContainer.height(canvasInstance.canvasHeight * resizeFactorY);
                    }
                }
            }
        };
        return AVComponent;
    }(_Components.BaseComponent));<commit_msg>build<commit_after>// iiif-av-component v0.0.1 https://github.com/viewdir/iiif-av-component#readme
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifAvComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
///<reference path="../node_modules/typescript/lib/lib.es6.d.ts"/> 

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var IIIFComponents;
(function (IIIFComponents) {
    var AVComponent = (function (_super) {
        __extends(AVComponent, _super);
        function AVComponent(options) {
            var _this = _super.call(this, options) || this;
            _this.canvasInstances = [];
            _this._init();
            _this._resize();
            return _this;
        }
        AVComponent.prototype._init = function () {
            var success = _super.prototype._init.call(this);
            if (!success) {
                console.error("Component failed to initialise");
            }
            return success;
        };
        AVComponent.prototype.data = function () {
            return {
                helper: null,
                defaultCanvasHeight: 400,
                defaultCanvasWidth: 600
            };
        };
        AVComponent.prototype.set = function (data) {
            this.options.data = data;
            // reset all global properties and terminate all running processes
            this._reset();
            // render ui
            this._render();
            // resize everything
            this._resize();
        };
        AVComponent.prototype._reset = function () {
            for (var i = 0; i < this.canvasInstances.length; i++) {
                window.clearInterval(this.canvasInstances[i].highPriorityInterval);
                window.clearInterval(this.canvasInstances[i].lowPriorityInterval);
                window.clearInterval(this.canvasInstances[i].canvasClockInterval);
            }
            this.canvasInstances = [];
        };
        AVComponent.prototype._render = function () {
            this._$element.empty();
            var canvases = this._getCanvases();
            for (var i = 0; i < canvases.length; i++) {
                this._initCanvas(canvases[i]);
            }
        };
        AVComponent.prototype._getCanvases = function () {
            return this.options.data.helper.getCanvases();
        };
        AVComponent.prototype._initCanvas = function (canvas) {
            var $player = $('<div class="player"></div>');
            var $canvasContainer = $('<div class="canvasContainer"></div>');
            var $timelineContainer = $('<div class="timelineContainer"></div>');
            var $timelineItemContainer = $('<div class="timelineItemContainer"></div>');
            var $controlsContainer = $('<div class="controlsContainer"></div>');
            var $playButton = $('<button class="playButton">Play</button>');
            var $pauseButton = $('<button class="pauseButton">Pause</button>');
            var $timingControls = $('<span>Current Time: <span class="canvasTime"></span> / Duration: <span class="canvasDuration"></span></span>');
            $controlsContainer.append($playButton, $pauseButton, $timingControls);
            $player.append($canvasContainer, $timelineContainer, $timelineItemContainer, $controlsContainer);
            this._$element.append($player);
            var canvasInstance = new IIIFComponents.CanvasInstance(canvas);
            // todo: make the canvas dimensions relative to the containing this.$element
            var canvasWidth = canvas.getWidth();
            var canvasHeight = canvas.getHeight();
            if (!canvasWidth) {
                canvasInstance.canvasWidth = this.options.data.defaultCanvasWidth;
            }
            else {
                canvasInstance.canvasWidth = canvasWidth;
            }
            if (!canvasHeight) {
                canvasInstance.canvasHeight = this.options.data.defaultCanvasHeight;
            }
            else {
                canvasInstance.canvasHeight = canvasHeight;
            }
            canvasInstance.$playerElement = $player;
            canvasInstance.logMessage = this._logMessage.bind(this);
            $timelineContainer.slider({
                value: 0,
                step: 0.01,
                orientation: "horizontal",
                range: "min",
                max: canvasInstance.canvasClockDuration,
                animate: false,
                create: function (evt, ui) {
                    // on create
                },
                slide: function (evt, ui) {
                    canvasInstance.setCurrentTime(ui.value);
                },
                stop: function (evt, ui) {
                    //canvasInstance.setCurrentTime(ui.value);
                }
            });
            this.canvasInstances.push(canvasInstance);
            canvasInstance.initContents();
            $playButton.on('click', function () {
                canvasInstance.playCanvas();
            });
            $pauseButton.on('click', function () {
                canvasInstance.pauseCanvas();
            });
            canvasInstance.setCurrentTime(0);
            $timingControls.find('.canvasDuration').text(IIIFComponents.AVComponentUtils.Utils.formatTime(canvasInstance.canvasClockDuration));
            this._logMessage('CREATED CANVAS: ' + canvasInstance.canvasClockDuration + ' seconds, ' + canvasInstance.canvasWidth + ' x ' + canvasInstance.canvasHeight + ' px.');
        };
        AVComponent.prototype._logMessage = function (message) {
            this.fire(AVComponent.Events.LOG, message);
        };
        AVComponent.prototype.resize = function () {
            this._resize();
        };
        AVComponent.prototype._resize = function () {
            // loop through all canvases resizing their elements
            for (var i = 0; i < this.canvasInstances.length; i++) {
                var canvasInstance = this.canvasInstances[i];
                if (canvasInstance.$playerElement) {
                    var $canvasContainer = canvasInstance.$playerElement.find('.canvasContainer');
                    var $timelineContainer = canvasInstance.$playerElement.find('.timelineContainer');
                    var containerWidth = $canvasContainer.width();
                    if (containerWidth) {
                        $timelineContainer.width(containerWidth);
                        var resizeFactorY = containerWidth / canvasInstance.canvasWidth;
                        //const newHeight: number = canvasInstance.canvasHeight * resizeFactorY; not used
                        $canvasContainer.height(canvasInstance.canvasHeight * resizeFactorY);
                    }
                }
            }
        };
        return AVComponent;
    }(_Components.BaseComponent));
{'fraction_non_alphanumeric': 0.13754035065510475, 'fraction_numerical': 0.0030381669725932023, 'mean_word_length': 2.1822759315206444, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 45, 'https://': 2, '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': '5040842', 'n_tokens_mistral': 4176, 'n_tokens_neox': 4059, 'n_words': 730}