@loaders.gl/video 3.1.0-alpha.3 → 4.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gif-builder.js.map +1 -1
- package/dist/lib/gifshot/gifshot-loader.js.map +1 -1
- package/dist/lib/utils/assert.js.map +1 -1
- package/dist/video-loader.js +1 -1
- package/package.json +5 -6
- package/src/gif-builder.js +1 -0
- package/src/lib/gifshot/gifshot-loader.ts +22 -0
- package/src/lib/utils/assert.ts +5 -0
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
package/dist/gif-builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/gif-builder.js"],"names":["assert","gifshot","GIF_BUILDER_OPTIONS","source","width","height","crossOrigin","progressCallback","captureProgress","completeCallback","numWorkers","sampleInterval","interval","offset","numFrames","frameDuration","filter","waterMark","waterMarkHeight","waterMarkWidth","waterMarkXCoordinate","waterMarkYCoordinate","text","showFrameText","fontWeight","fontSize","minFontSize","resizeFont","fontFamily","fontColor","textAlign","textBaseline","textXCoordinate","textYCoordinate","webcamVideoElement","keepCameraOn","cameraStream","saveRenderingContexts","savedRenderingContexts","GIFBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","files","initialize","add","file","push","build","_cleanOptions","images","video","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn"],"mappings":"AACA,SAAQA,MAAR,QAAqB,oBAArB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AAGA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,MAAM,EAAE,QADkB;AAE1BC,EAAAA,KAAK,EAAE,GAFmB;AAG1BC,EAAAA,MAAM,EAAE,GAHkB;AAK1BC,EAAAA,WAAW,EAAE,WALa;AAQ1BC,EAAAA,gBAAgB,EAAGC,eAAD,IAAqB,CAAE,CARf;AAS1BC,EAAAA,gBAAgB,EAA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ACC,KAAX,EAAkB;AAChBH,UAAAA,MAAM,CAACE,MAAM,CAACE,QAAR,CAAN;AACA;AACD;;AAGDL,QAAAA,OAAO,CAACG,MAAM,CAACG,KAAR,CAAP;AAMD,OAtBD;AAuBD,KAxBM,CAAP;AAyBD;;AAGDb,EAAAA,aAAa,CAACR,OAAD,EAAU;AACrB,QAAIA,OAAO,CAACU,KAAR,IAAiBV,OAAO,CAACS,MAAzB,IAAmCT,OAAO,CAACsB,QAA3C,IAAuDtB,OAAO,CAACuB,SAAnE,EAA8E;AAC5EC,MAAAA,OAAO,CAACC,IAAR,CAAa,8BAAb;AACD;;AAGD,WAAOzB,OAAO,CAACU,KAAf;AACA,WAAOV,OAAO,CAACS,MAAf;AAGAT,IAAAA,OAAO,CAACsB,QAAR,GAAmBtB,OAAO,CAAC1C,KAA3B;AACA0C,IAAAA,OAAO,CAACuB,SAAR,GAAoBvB,OAAO,CAACzC,MAA5B;AACA,WAAOyC,OAAO,CAAC1C,KAAf;AACA,WAAO0C,OAAO,CAACzC,MAAf;AACD;;AApG6B","sourcesContent":["// A GIFBuilder based on the gifshot module\nimport {assert} from './lib/utils/assert';\nimport gifshot from './libs/gifshot'; // TODO - load dynamically to avoid bloating\n\n// These are gifshot module options\nconst GIF_BUILDER_OPTIONS = {\n source: 'images',\n width: 200, // Desired width of the image\n height: 200, // Desired height of the image\n\n crossOrigin: 'Anonymous', // Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.\n\n // CALLBACKS\n progressCallback: (captureProgress) => {}, // Callback that provides the current progress of the current image\n completeCallback: () => {}, // Callback function that is called when the current image is completed\n\n // QUALITY SETTINGS\n numWorkers: 2, // how many web workers to use to process the animated GIF frames. Default is 2.\n sampleInterval: 10, // pixels to skip when creating the palette. Default is 10. Less is better, but slower.\n interval: 0.1, // The amount of time (in seconds) to wait between each frame capture\n offset: null, // The amount of time (in seconds) to start capturing the GIF (only for HTML5 videos)\n numFrames: 10, // The number of frames to use to create the animated GIF. Note: Each frame is captured every 100 milliseconds of a video and every ms for existing images\n frameDuration: 1, // The amount of time (10 = 1s) to stay on each frame\n\n // CSS FILTER OPTIONS\n filter: '', // CSS filter that will be applied to the image (eg. blur(5px))\n\n // WATERMARK OPTIONS\n waterMark: null, // If an image is given here, it will be stamped on top of the GIF frames\n waterMarkHeight: null, // Height of the waterMark\n waterMarkWidth: null, // Height of the waterMark\n waterMarkXCoordinate: 1, // The X (horizontal) Coordinate of the watermark image\n waterMarkYCoordinate: 1, // The Y (vertical) Coordinate of the watermark image\n\n // TEXT OPTIONS\n text: '', // The text that covers the animated GIF\n showFrameText: true, // If frame-specific text is supplied with the image array, you can force to not be displayed\n fontWeight: 'normal', // The font weight of the text that covers the animated GIF\n fontSize: '16px', // The font size of the text that covers the animated GIF\n minFontSize: '10px', // The minimum font size of the text that covers the animated GIF\n resizeFont: false, // Whether or not the animated GIF text will be resized to fit within the GIF container\n fontFamily: 'sans-serif', // The font family of the text that covers the animated GIF\n fontColor: '#ffffff', // The font color of the text that covers the animated GIF\n textAlign: 'center', // The horizontal text alignment of the text that covers the animated GIF\n textBaseline: 'bottom', // The vertical text alignment of the text that covers the animated GIF\n textXCoordinate: null, // The X (horizontal) Coordinate of the text that covers the animated GIF\n textYCoordinate: null, // The Y (vertical) Coordinate of the text that covers the animated GIF\n\n // ADVANCED OPTIONS\n\n // WEBCAM CAPTURE OPTIONS\n webcamVideoElement: null, // You can pass an existing video element to use for the webcam GIF creation process,\n keepCameraOn: false, // Whether or not you would like the user's camera to stay on after the GIF is created\n cameraStream: null, // Expects a cameraStream Media object\n\n // CANVAS OPTIMIZATION OPTIONS\n saveRenderingContexts: false, // Whether or not you would like to save all of the canvas image binary data\n savedRenderingContexts: [] // Array of canvas image data\n};\n\nexport default class GIFBuilder {\n static get properties() {\n return {\n id: 'gif',\n name: 'GIF',\n extensions: ['gif'],\n mimeTypes: ['image/gif'],\n builder: GIFBuilder,\n options: GIF_BUILDER_OPTIONS\n };\n }\n\n constructor(options) {\n this.options = {...options};\n this.source = options.source;\n delete options.source;\n\n // Allow files to be added\n this.files = [];\n\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n this.gifshot = gifshot;\n }\n\n async initialize(options) {\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n // this.gifshot = await loadGifshotModule(options);\n }\n\n async add(file) {\n await this.initialize();\n this.files.push(file);\n }\n\n async build() {\n await this.initialize();\n this._cleanOptions(this.options);\n\n switch (this.source) {\n case 'images':\n this.options.images = this.files;\n break;\n case 'video':\n this.options.video = this.files;\n break;\n case 'webcam':\n assert(this.files.length === 0);\n break;\n default:\n throw new Error('GIFBuilder: invalid source');\n }\n\n return await this._createGIF();\n }\n\n // PRIVATE\n\n async _createGIF() {\n return new Promise((resolve, reject) => {\n this.gifshot.createGIF(this.options, (result) => {\n // callback object properties\n // --------------------------\n // image - Base 64 image\n // cameraStream - The webRTC MediaStream object\n // error - Boolean that determines if an error occurred\n // errorCode - Helpful error label\n // errorMsg - Helpful error message\n // savedRenderingContexts - An array of canvas image data (will only be set if the saveRenderingContexts option was used)\n\n if (result.error) {\n reject(result.errorMsg);\n return;\n }\n\n // image - Base 64 image\n resolve(result.image);\n\n // var image = obj.image,\n // animatedImage = document.createElement('img');\n // animatedImage.src = image;\n // document.body.appendChild(animatedImage);\n });\n });\n }\n\n // Remove some gifshot options\n _cleanOptions(options) {\n if (options.video || options.images || options.gifWidth || options.gifHeight) {\n console.warn('GIFBuilder: ignoring options'); // eslint-disable-line\n }\n\n // We control these through options.source instead\n delete options.video;\n delete options.images;\n\n // Use width/height props (to standardize across builders)\n options.gifWidth = options.width;\n options.gifHeight = options.height;\n delete options.width;\n delete options.height;\n }\n}\n"],"file":"gif-builder.js"}
|
|
1
|
+
{"version":3,"sources":["../src/gif-builder.js"],"names":["assert","gifshot","GIF_BUILDER_OPTIONS","source","width","height","crossOrigin","progressCallback","captureProgress","completeCallback","numWorkers","sampleInterval","interval","offset","numFrames","frameDuration","filter","waterMark","waterMarkHeight","waterMarkWidth","waterMarkXCoordinate","waterMarkYCoordinate","text","showFrameText","fontWeight","fontSize","minFontSize","resizeFont","fontFamily","fontColor","textAlign","textBaseline","textXCoordinate","textYCoordinate","webcamVideoElement","keepCameraOn","cameraStream","saveRenderingContexts","savedRenderingContexts","GIFBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","files","initialize","add","file","push","build","_cleanOptions","images","video","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn"],"mappings":"AAEA,SAAQA,MAAR,QAAqB,oBAArB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AAGA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,MAAM,EAAE,QADkB;AAE1BC,EAAAA,KAAK,EAAE,GAFmB;AAG1BC,EAAAA,MAAM,EAAE,GAHkB;AAK1BC,EAAAA,WAAW,EAAE,WALa;AAQ1BC,EAAAA,gBAAgB,EAAGC,eAAD,IAAqB,CAAE,CARf;AAS1BC,EAAAA,gBAAgB,EAAE,MAAM,CAAE,CATA;AAY1BC,EAAAA,UAAU,EAAE,CAZc;AAa1BC,EAAAA,cAAc,EAAE,EAbU;AAc1BC,EAAAA,QAAQ,EAAE,GAdgB;AAe1BC,EAAAA,MAAM,EAAE,IAfkB;AAgB1BC,EAAAA,SAAS,EAAE,EAhBe;AAiB1BC,EAAAA,aAAa,EAAE,CAjBW;AAoB1BC,EAAAA,MAAM,EAAE,EApBkB;AAuB1BC,EAAAA,SAAS,EAAE,IAvBe;AAwB1BC,EAAAA,eAAe,EAAE,IAxBS;AAyB1BC,EAAAA,cAAc,EAAE,IAzBU;AA0B1BC,EAAAA,oBAAoB,EAAE,CA1BI;AA2B1BC,EAAAA,oBAAoB,EAAE,CA3BI;AA8B1BC,EAAAA,IAAI,EAAE,EA9BoB;AA+B1BC,EAAAA,aAAa,EAAE,IA/BW;AAgC1BC,EAAAA,UAAU,EAAE,QAhCc;AAiC1BC,EAAAA,QAAQ,EAA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yC,OAAO,CAAC1C,KAAf;AACA,WAAO0C,OAAO,CAACzC,MAAf;AACD;;AApG6B","sourcesContent":["// A GIFBuilder based on the gifshot module\n// @ts-nocheck\nimport {assert} from './lib/utils/assert';\nimport gifshot from './libs/gifshot'; // TODO - load dynamically to avoid bloating\n\n// These are gifshot module options\nconst GIF_BUILDER_OPTIONS = {\n source: 'images',\n width: 200, // Desired width of the image\n height: 200, // Desired height of the image\n\n crossOrigin: 'Anonymous', // Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.\n\n // CALLBACKS\n progressCallback: (captureProgress) => {}, // Callback that provides the current progress of the current image\n completeCallback: () => {}, // Callback function that is called when the current image is completed\n\n // QUALITY SETTINGS\n numWorkers: 2, // how many web workers to use to process the animated GIF frames. Default is 2.\n sampleInterval: 10, // pixels to skip when creating the palette. Default is 10. Less is better, but slower.\n interval: 0.1, // The amount of time (in seconds) to wait between each frame capture\n offset: null, // The amount of time (in seconds) to start capturing the GIF (only for HTML5 videos)\n numFrames: 10, // The number of frames to use to create the animated GIF. Note: Each frame is captured every 100 milliseconds of a video and every ms for existing images\n frameDuration: 1, // The amount of time (10 = 1s) to stay on each frame\n\n // CSS FILTER OPTIONS\n filter: '', // CSS filter that will be applied to the image (eg. blur(5px))\n\n // WATERMARK OPTIONS\n waterMark: null, // If an image is given here, it will be stamped on top of the GIF frames\n waterMarkHeight: null, // Height of the waterMark\n waterMarkWidth: null, // Height of the waterMark\n waterMarkXCoordinate: 1, // The X (horizontal) Coordinate of the watermark image\n waterMarkYCoordinate: 1, // The Y (vertical) Coordinate of the watermark image\n\n // TEXT OPTIONS\n text: '', // The text that covers the animated GIF\n showFrameText: true, // If frame-specific text is supplied with the image array, you can force to not be displayed\n fontWeight: 'normal', // The font weight of the text that covers the animated GIF\n fontSize: '16px', // The font size of the text that covers the animated GIF\n minFontSize: '10px', // The minimum font size of the text that covers the animated GIF\n resizeFont: false, // Whether or not the animated GIF text will be resized to fit within the GIF container\n fontFamily: 'sans-serif', // The font family of the text that covers the animated GIF\n fontColor: '#ffffff', // The font color of the text that covers the animated GIF\n textAlign: 'center', // The horizontal text alignment of the text that covers the animated GIF\n textBaseline: 'bottom', // The vertical text alignment of the text that covers the animated GIF\n textXCoordinate: null, // The X (horizontal) Coordinate of the text that covers the animated GIF\n textYCoordinate: null, // The Y (vertical) Coordinate of the text that covers the animated GIF\n\n // ADVANCED OPTIONS\n\n // WEBCAM CAPTURE OPTIONS\n webcamVideoElement: null, // You can pass an existing video element to use for the webcam GIF creation process,\n keepCameraOn: false, // Whether or not you would like the user's camera to stay on after the GIF is created\n cameraStream: null, // Expects a cameraStream Media object\n\n // CANVAS OPTIMIZATION OPTIONS\n saveRenderingContexts: false, // Whether or not you would like to save all of the canvas image binary data\n savedRenderingContexts: [] // Array of canvas image data\n};\n\nexport default class GIFBuilder {\n static get properties() {\n return {\n id: 'gif',\n name: 'GIF',\n extensions: ['gif'],\n mimeTypes: ['image/gif'],\n builder: GIFBuilder,\n options: GIF_BUILDER_OPTIONS\n };\n }\n\n constructor(options) {\n this.options = {...options};\n this.source = options.source;\n delete options.source;\n\n // Allow files to be added\n this.files = [];\n\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n this.gifshot = gifshot;\n }\n\n async initialize(options) {\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n // this.gifshot = await loadGifshotModule(options);\n }\n\n async add(file) {\n await this.initialize();\n this.files.push(file);\n }\n\n async build() {\n await this.initialize();\n this._cleanOptions(this.options);\n\n switch (this.source) {\n case 'images':\n this.options.images = this.files;\n break;\n case 'video':\n this.options.video = this.files;\n break;\n case 'webcam':\n assert(this.files.length === 0);\n break;\n default:\n throw new Error('GIFBuilder: invalid source');\n }\n\n return await this._createGIF();\n }\n\n // PRIVATE\n\n async _createGIF() {\n return new Promise((resolve, reject) => {\n this.gifshot.createGIF(this.options, (result) => {\n // callback object properties\n // --------------------------\n // image - Base 64 image\n // cameraStream - The webRTC MediaStream object\n // error - Boolean that determines if an error occurred\n // errorCode - Helpful error label\n // errorMsg - Helpful error message\n // savedRenderingContexts - An array of canvas image data (will only be set if the saveRenderingContexts option was used)\n\n if (result.error) {\n reject(result.errorMsg);\n return;\n }\n\n // image - Base 64 image\n resolve(result.image);\n\n // var image = obj.image,\n // animatedImage = document.createElement('img');\n // animatedImage.src = image;\n // document.body.appendChild(animatedImage);\n });\n });\n }\n\n // Remove some gifshot options\n _cleanOptions(options) {\n if (options.video || options.images || options.gifWidth || options.gifHeight) {\n console.warn('GIFBuilder: ignoring options'); // eslint-disable-line\n }\n\n // We control these through options.source instead\n delete options.video;\n delete options.images;\n\n // Use width/height props (to standardize across builders)\n options.gifWidth = options.width;\n options.gifHeight = options.height;\n delete options.width;\n delete options.height;\n }\n}\n"],"file":"gif-builder.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/gifshot/gifshot-loader.
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/gifshot/gifshot-loader.ts"],"names":["loadLibrary","loadGifshotPromise","loadGifshotModule","options","modules","gifshot","loadGifshot","libraryPath","globalThis"],"mappings":"AACA,SAAQA,WAAR,QAA0B,0BAA1B;AAEA,IAAIC,kBAAJ;AAEA,OAAO,eAAeC,iBAAf,CAAiCC,OAAO,GAAG,EAA3C,EAA+C;AACpD,QAAMC,OAAO,GAAGD,OAAO,CAACC,OAAR,IAAmB,EAAnC;;AACA,MAAIA,OAAO,CAACC,OAAZ,EAAqB;AACnB,WAAOD,OAAO,CAACC,OAAf;AACD;;AACDJ,EAAAA,kBAAkB,GAAGA,kBAAkB,IAAIK,WAAW,CAACH,OAAD,CAAtD;AACA,SAAO,MAAMF,kBAAb;AACD;;AAED,eAAeK,WAAf,CAA2BH,OAA3B,EAAoC;AAClCA,EAAAA,OAAO,CAACI,WAAR,GAAsBJ,OAAO,CAACI,WAAR,IAAuB,OAA7C;AACA,QAAMF,OAAO,GAAG,MAAML,WAAW,CAAC,YAAD,EAAe,SAAf,EAA0BG,OAA1B,CAAjC;AAIA,SAAOE,OAAO,IAAIG,UAAU,CAACH,OAA7B;AACD","sourcesContent":["// @ts-nocheck\nimport {loadLibrary} from '@loaders.gl/worker-utils';\n\nlet loadGifshotPromise;\n\nexport async function loadGifshotModule(options = {}) {\n const modules = options.modules || {};\n if (modules.gifshot) {\n return modules.gifshot;\n }\n loadGifshotPromise = loadGifshotPromise || loadGifshot(options);\n return await loadGifshotPromise;\n}\n\nasync function loadGifshot(options) {\n options.libraryPath = options.libraryPath || 'libs/';\n const gifshot = await loadLibrary('gifshot.js', 'gifshot', options);\n\n // Depends on how import happened...\n // @ts-ignore TS2339: Property does not exist on type\n return gifshot || globalThis.gifshot;\n}\n"],"file":"gifshot-loader.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/assert.
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/assert.ts"],"names":["assert","condition","message","Error"],"mappings":"AAAA,OAAO,SAASA,MAAT,CAAgBC,SAAhB,EAAoCC,OAApC,EAA2D;AAChE,MAAI,CAACD,SAAL,EAAgB;AACd,UAAM,IAAIE,KAAJ,CAAUD,OAAV,CAAN;AACD;AACF","sourcesContent":["export function assert(condition: unknown, message: string): void {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"file":"assert.js"}
|
package/dist/video-loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseVideo from './lib/parsers/parse-video';
|
|
2
|
-
const VERSION = typeof "
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.4" !== 'undefined' ? "4.0.0-alpha.4" : 'latest';
|
|
3
3
|
const EXTENSIONS = ['mp4'];
|
|
4
4
|
const MIME_TYPES = ['video/mp4'];
|
|
5
5
|
const DEFAULT_LOADER_OPTIONS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/video",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.4",
|
|
4
4
|
"description": "Framework-independent loaders and writers for video (MP4, WEBM, ...)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,13 +29,12 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"pre-build": "npm run build-bundle",
|
|
32
|
-
"build-bundle": "
|
|
33
|
-
"build-worker": "webpack --entry ./src/image-worker.js --output ./dist/image-worker.js --config ../../scripts/webpack/worker.js"
|
|
32
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
|
|
34
33
|
},
|
|
35
34
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "
|
|
37
|
-
"@loaders.gl/worker-utils": "
|
|
35
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.4",
|
|
36
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.4",
|
|
38
37
|
"gifshot": "^0.4.5"
|
|
39
38
|
},
|
|
40
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "53026061b3c8871f7e96d3a5826125cc6613bddc"
|
|
41
40
|
}
|
package/src/gif-builder.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {loadLibrary} from '@loaders.gl/worker-utils';
|
|
3
|
+
|
|
4
|
+
let loadGifshotPromise;
|
|
5
|
+
|
|
6
|
+
export async function loadGifshotModule(options = {}) {
|
|
7
|
+
const modules = options.modules || {};
|
|
8
|
+
if (modules.gifshot) {
|
|
9
|
+
return modules.gifshot;
|
|
10
|
+
}
|
|
11
|
+
loadGifshotPromise = loadGifshotPromise || loadGifshot(options);
|
|
12
|
+
return await loadGifshotPromise;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function loadGifshot(options) {
|
|
16
|
+
options.libraryPath = options.libraryPath || 'libs/';
|
|
17
|
+
const gifshot = await loadLibrary('gifshot.js', 'gifshot', options);
|
|
18
|
+
|
|
19
|
+
// Depends on how import happened...
|
|
20
|
+
// @ts-ignore TS2339: Property does not exist on type
|
|
21
|
+
return gifshot || globalThis.gifshot;
|
|
22
|
+
}
|
package/dist/dist.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var r in i)("object"==typeof exports?exports:e)[r]=i[r]}}(window,(function(){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(r,o,function(t){return e[t]}.bind(null,o));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e,t,i){var r;!function(i,o,n,a){"use strict";var s,d,c={URL:i.URL||i.webkitURL||i.mozURL||i.msURL,getUserMedia:(d=n.getUserMedia||n.webkitGetUserMedia||n.mozGetUserMedia||n.msGetUserMedia,d?d.bind(n):d),requestAnimFrame:i.requestAnimationFrame||i.webkitRequestAnimationFrame||i.mozRequestAnimationFrame||i.oRequestAnimationFrame||i.msRequestAnimationFrame,requestTimeout:function(e,t){if(e=e||c.noop,t=t||0,!c.requestAnimFrame)return setTimeout(e,t);var i=(new Date).getTime(),r=new Object,o=c.requestAnimFrame;return r.value=o((function n(){(new Date).getTime()-i>=t?e.call():r.value=o(n)})),r},Blob:i.Blob||i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder,btoa:(s=i.btoa||function(e){for(var t="",i=0,r=e.length,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=void 0,a=void 0,s=void 0,d=void 0,c=void 0,l=void 0,u=void 0;i<r;)d=(n=e.charCodeAt(i++))>>2,c=(3&n)<<4|(a=e.charCodeAt(i++))>>4,l=(15&a)<<2|(s=e.charCodeAt(i++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+o.charAt(d)+o.charAt(c)+o.charAt(l)+o.charAt(u);return t},s?s.bind(i):c.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return c.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=o.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return i.Worker},blob:function(){return c.Blob},Uint8Array:function(){return i.Uint8Array},Uint32Array:function(){return i.Uint32Array},videoCodecs:function(){var e=o.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var i=void 0,r=void 0;if(c.isArray(e))for(i=-1,r=e.length;++i<r&&!1!==t(i,e[i]););else if(c.isObject(e))for(i in e)if(e.hasOwnProperty(i)&&!1===t(i,e[i]))break},normalizeOptions:function(e,t){if(c.isObject(e)&&c.isObject(t)&&Object.keys){var i={};return c.each(e,(function(t,r){i[t]=e[t]})),c.each(t,(function(r,o){var n=t[r];c.isObject(n)&&e[r]?i[r]=c.normalizeOptions(e[r],n):i[r]=n})),i}},setCSSAttr:function(e,t,i){c.isElement(e)&&(c.isString(t)&&c.isString(i)?e.style[t]=i:c.isObject(t)&&c.each(t,(function(t,i){e.style[t]=i})))},removeElement:function(e){c.isElement(e)&&e.parentNode&&e.parentNode.removeChild(e)},createWebWorker:function(e){if(!c.isString(e))return{};try{var t=new c.Blob([e],{type:"text/javascript"}),i=c.URL.createObjectURL(t);return{objectUrl:i,worker:new Worker(i)}}catch(e){return""+e}},getExtension:function(e){return e.substr(e.lastIndexOf(".")+1,e.length)},getFontSize:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!o.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,r=parseInt(e.fontSize,10),n=parseInt(e.minFontSize,10),a=o.createElement("div"),s=o.createElement("span");for(a.setAttribute("width",i),a.appendChild(s),s.innerHTML=t,s.style.fontSize=r+"px",s.style.textIndent="-9999px",s.style.visibility="hidden",o.body.appendChild(s);s.offsetWidth>i&&r>=n;)s.style.fontSize=--r+"px";return o.body.removeChild(s),r+"px"},webWorkerError:!1},l=Object.freeze({default:c}),u={validate:function(e){e=c.isObject(e)?e:{};var t={};return c.each(u.validators,(function(i,r){var o=r.errorCode;if(!e[o]&&!r.condition)return(t=r).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==u.validate(e).error;return t},validators:[{condition:c.isFunction(c.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:c.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:c.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:c.isFunction(c.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:c.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:c.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:c.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},f=Object.freeze({default:u}),m=function(){},g={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:m,completeCallback:m,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},h=Object.freeze({default:g});function p(){return u.isValid()}function v(){var e,t,i,r,o,n=256,a=499,s=491,d=487,c=503,l=3*c,u=n-1,f=4,m=100,g=16,h=1<<g,p=10,v=10,b=h>>v,w=h<<p-v,y=n>>3,x=6,C=1<<x,S=y*C,k=30,F=10,O=1<<F,W=8,E=1<<W,A=F+W,M=1<<A,R=[],T=[],U=[],j=[];function I(e,a,s){var d,c;for(t=e,i=a,r=s,o=new Array(n),d=0;d<n;d++)o[d]=new Array(4),(c=o[d])[0]=c[1]=c[2]=(d<<f+8)/n|0,U[d]=h/n|0,T[d]=0}function z(){for(var e=[],t=new Array(n),i=0;i<n;i++)t[o[i][3]]=i;for(var r=0,a=0;a<n;a++){var s=t[a];e[r++]=o[s][0],e[r++]=o[s][1],e[r++]=o[s][2]}return e}function V(){var e,t,i,r,a,s,d,c;for(d=0,c=0,e=0;e<n;e++){for(i=e,r=(a=o[e])[1],t=e+1;t<n;t++)(s=o[t])[1]<r&&(i=t,r=s[1]);if(s=o[i],e!=i&&(t=s[0],s[0]=a[0],a[0]=t,t=s[1],s[1]=a[1],a[1]=t,t=s[2],s[2]=a[2],a[2]=t,t=s[3],s[3]=a[3],a[3]=t),r!=d){for(R[d]=c+e>>1,t=d+1;t<r;t++)R[t]=e;d=r,c=e}}for(R[d]=c+u>>1,t=d+1;t<256;t++)R[t]=u}function H(){var o,n,u,g,h,p,v,b,w,y,C,F,W,A;for(i<l&&(r=1),e=30+(r-1)/3,F=t,W=0,A=i,y=(C=i/(3*r))/m|0,b=O,(v=(p=S)>>x)<=1&&(v=0),o=0;o<v;o++)j[o]=b*((v*v-o*o)*E/(v*v));for(w=i<l?3:i%a!=0?3*a:i%s!=0?3*s:i%d!=0?3*d:3*c,o=0;o<C;)if(D(b,n=N(u=(255&F[W+0])<<f,g=(255&F[W+1])<<f,h=(255&F[W+2])<<f),u,g,h),0!==v&&G(v,n,u,g,h),(W+=w)>=A&&(W-=i),0===y&&(y=1),++o%y==0)for(b-=b/e,(v=(p-=p/k)>>x)<=1&&(v=0),n=0;n<v;n++)j[n]=b*((v*v-n*n)*E/(v*v))}function L(e,t,i){var r,a,s,d,c,l,u;for(c=1e3,u=-1,a=(r=R[t])-1;r<n||a>=0;)r<n&&((s=(l=o[r])[1]-t)>=c?r=n:(r++,s<0&&(s=-s),(d=l[0]-e)<0&&(d=-d),(s+=d)<c&&((d=l[2]-i)<0&&(d=-d),(s+=d)<c&&(c=s,u=l[3])))),a>=0&&((s=t-(l=o[a])[1])>=c?a=-1:(a--,s<0&&(s=-s),(d=l[0]-e)<0&&(d=-d),(s+=d)<c&&((d=l[2]-i)<0&&(d=-d),(s+=d)<c&&(c=s,u=l[3]))));return u}function P(){return H(),B(),V(),z()}function B(){var e;for(e=0;e<n;e++)o[e][0]>>=f,o[e][1]>>=f,o[e][2]>>=f,o[e][3]=e}function G(e,t,i,r,a){var s,d,c,l,u,f,m;for((c=t-e)<-1&&(c=-1),(l=t+e)>n&&(l=n),s=t+1,d=t-1,f=1;s<l||d>c;){if(u=j[f++],s<l){m=o[s++];try{m[0]-=u*(m[0]-i)/M|0,m[1]-=u*(m[1]-r)/M|0,m[2]-=u*(m[2]-a)/M|0}catch(e){}}if(d>c){m=o[d--];try{m[0]-=u*(m[0]-i)/M|0,m[1]-=u*(m[1]-r)/M|0,m[2]-=u*(m[2]-a)/M|0}catch(e){}}}}function D(e,t,i,r,n){var a=o[t],s=e/O;a[0]-=s*(a[0]-i)|0,a[1]-=s*(a[1]-r)|0,a[2]-=s*(a[2]-n)|0}function N(e,t,i){var r,a,s,d,c,l,u,m,h,y;for(h=m=~(1<<31),u=l=-1,r=0;r<n;r++)(a=(y=o[r])[0]-e)<0&&(a=-a),(s=y[1]-t)<0&&(s=-s),a+=s,(s=y[2]-i)<0&&(s=-s),(a+=s)<m&&(m=a,l=r),(d=a-(T[r]>>g-f))<h&&(h=d,u=r),c=U[r]>>v,U[r]-=c,T[r]+=c<<p;return U[l]+=b,T[l]-=w,u}I.apply(this,arguments);var q={};return q.map=L,q.process=P,q}function b(){try{this.onmessage=function(t){var i,r=t.data||{};r.gifshot&&(i=e.run(r),postMessage(i))}}catch(e){}var e={dataToRGB:function(e,t,i){for(var r=t*i*4,o=0,n=[];o<r;)n.push(e[o++]),n.push(e[o++]),n.push(e[o++]),o++;return n},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],i=0;i<e.length;i+=3){var r=e[i],o=e[i+1],n=e[i+2];t.push(r<<16|o<<8|n)}return t},processFrameWithQuantizer:function(e,t,i,r){for(var o=this.dataToRGB(e,t,i),n=new v(o,o.length,r),a=n.process(),s=new Uint32Array(this.componentizedPaletteToArray(a)),d=t*i,c=new Uint8Array(d),l=0,u=0;u<d;u++){var f=o[l++],m=o[l++],g=o[l++];c[u]=n.map(f,m,g)}return{pixels:c,palette:s}},run:function(e){var t=e=e||{},i=t.height,r=(t.palette,t.sampleInterval),o=t.width,n=e.data;return this.processFrameWithQuantizer(n,o,i,r)}};return e}function w(e,t,i,r){var o=0,n=void 0===(r=void 0===r?{}:r).loop?null:r.loop,a=void 0===r.palette?null:r.palette;if(t<=0||i<=0||t>65535||i>65535)throw"Width/Height invalid.";e[o++]=71,e[o++]=73,e[o++]=70,e[o++]=56,e[o++]=57,e[o++]=97;if(e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=0|(null!==a?128:0),e[o++]=0,e[o++]=0,null!==n){if(n<0||n>65535)throw"Loop count invalid.";e[o++]=33,e[o++]=255,e[o++]=11,e[o++]=78,e[o++]=69,e[o++]=84,e[o++]=83,e[o++]=67,e[o++]=65,e[o++]=80,e[o++]=69,e[o++]=50,e[o++]=46,e[o++]=48,e[o++]=3,e[o++]=1,e[o++]=255&n,e[o++]=n>>8&255,e[o++]=0}var s=!1;this.addFrame=function(t,i,r,n,d,c){if(!0===s&&(--o,s=!1),c=void 0===c?{}:c,t<0||i<0||t>65535||i>65535)throw"x/y invalid.";if(r<=0||n<=0||r>65535||n>65535)throw"Width/Height invalid.";if(d.length<r*n)throw"Not enough pixels for the frame size.";var l=!0,u=c.palette;if(null==u&&(l=!1,u=a),null==u)throw"Must supply either a local or global palette.";for(var f=function(e){var t=e.length;if(t<2||t>256||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}(u),m=0;f>>=1;)++m;f=1<<m;var g=void 0===c.delay?0:c.delay,h=void 0===c.disposal?0:c.disposal;if(h<0||h>3)throw"Disposal out of range.";var p=!1,v=0;if(void 0!==c.transparent&&null!==c.transparent&&(p=!0,(v=c.transparent)<0||v>=f))throw"Transparent color index.";if((0!==h||p||0!==g)&&(e[o++]=33,e[o++]=249,e[o++]=4,e[o++]=h<<2|(!0===p?1:0),e[o++]=255&g,e[o++]=g>>8&255,e[o++]=v,e[o++]=0),e[o++]=44,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=255&n,e[o++]=n>>8&255,e[o++]=!0===l?128|m-1:0,!0===l)for(var b=0,w=u.length;b<w;++b){var y=u[b];e[o++]=y>>16&255,e[o++]=y>>8&255,e[o++]=255&y}o=function(e,t,i,r){e[t++]=i;var o=t++,n=1<<i,a=n-1,s=n+1,d=s+1,c=i+1,l=0,u=0;function f(i){for(;l>=i;)e[t++]=255&u,u>>=8,l-=8,t===o+256&&(e[o]=255,o=t++)}function m(e){u|=e<<l,l+=c,f(8)}var g=r[0]&a,h={};m(n);for(var p=1,v=r.length;p<v;++p){var b=r[p]&a,w=g<<8|b,y=h[w];if(void 0===y){for(u|=g<<l,l+=c;l>=8;)e[t++]=255&u,u>>=8,l-=8,t===o+256&&(e[o]=255,o=t++);4096===d?(m(n),d=s+1,c=i+1,h={}):(d>=1<<c&&++c,h[w]=d++),g=b}else g=y}m(g),m(s),f(1),o+1===t?e[o]=0:(e[o]=t-o-1,e[t++]=0);return t}(e,o,m<2?2:m,d)},this.end=function(){return!1===s&&(e[o++]=59,s=!0),o}}var y=function(){},x=function(e){this.canvas=null,this.ctx=null,this.repeat=0,this.frames=[],this.numRenderedFrames=0,this.onRenderCompleteCallback=y,this.onRenderProgressCallback=y,this.workers=[],this.availableWorkers=[],this.generatingGIF=!1,this.options=e,this.initializeWebWorkers(e)};function C(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}x.prototype={workerMethods:b(),initializeWebWorkers:function(e){var t,i=v.toString()+"("+b.toString()+"());",r=void 0,n=void 0,a=void 0,s=-1,d="";for(t=e.numWorkers;++s<t;)r=c.createWebWorker(i),c.isObject(r)?(n=r.objectUrl,a=r.worker,this.workers.push({worker:a,objectUrl:n}),this.availableWorkers.push(a)):(d=r,c.webWorkerError=!!r);this.workerError=d,this.canvas=o.createElement("canvas"),this.canvas.width=e.gifWidth,this.canvas.height=e.gifHeight,this.ctx=this.canvas.getContext("2d"),this.frames=[]},getWorker:function(){return this.availableWorkers.pop()},freeWorker:function(e){this.availableWorkers.push(e)},byteMap:function(){for(var e=[],t=0;t<256;t++)e[t]=String.fromCharCode(t);return e}(),bufferToString:function(e){for(var t=e.length,i="",r=-1;++r<t;)i+=this.byteMap[e[r]];return i},onFrameFinished:function(e){var t=this,i=t.frames,r=!!(t.options.images||[]).length,o=i.every((function(e){return!e.beingProcessed&&e.done}));t.numRenderedFrames++,r&&e(t.numRenderedFrames/i.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/i.length),o?t.generatingGIF||t.generateGIF(i,t.onRenderCompleteCallback):c.requestTimeout((function(){t.processNextFrame()}),1)},processFrame:function(e){var t=this,i=(this.options,this.options),r=i.progressCallback,o=i.sampleInterval,n=this.frames,a=void 0,s=void 0,d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.data;delete a.data,a.pixels=Array.prototype.slice.call(i.pixels),a.palette=Array.prototype.slice.call(i.palette),a.done=!0,a.beingProcessed=!1,t.freeWorker(s),t.onFrameFinished(r)};(a=n[e]).beingProcessed||a.done?this.onFrameFinished():(a.sampleInterval=o,a.beingProcessed=!0,a.gifshot=!0,(s=this.getWorker())?(s.onmessage=d,s.postMessage(a)):d({data:t.workerMethods.run(a)}))},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t<this.options.numWorkers&&t<this.frames.length;t++)this.processFrame(t)},processNextFrame:function(){for(var e=-1,t=0;t<this.frames.length;t++){var i=this.frames[t];if(!i.done&&!i.beingProcessed){e=t;break}}e>=0&&this.processFrame(e)},generateGIF:function(e,t){var i=[],r={loop:this.repeat},o=this.options,n=o.interval,a=o.frameDuration,s=!!o.images.length,d=o.gifHeight,l=o.gifWidth,u=new w(i,l,d,r),f=this.onRenderProgressCallback,m=s?100*n:0,g=void 0;this.generatingGIF=!0,c.each(e,(function(t,i){var r=i.palette;f(.75+.25*i.position*1/e.length);for(var o=0;o<a;o++)u.addFrame(0,0,l,d,i.pixels,{palette:r,delay:m})})),u.end(),f(1),this.frames=[],this.generatingGIF=!1,c.isFunction(t)&&(g=this.bufferToString(i),t("data:image/gif;base64,"+c.btoa(g)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t){t=c.isObject(t)?t:{};var i=this.ctx,r=this.options,o=r.gifWidth,n=r.gifHeight,a=c.getFontSize(t),s=t,d=s.filter,l=s.fontColor,u=s.fontFamily,f=s.fontWeight,m=(s.gifHeight,s.gifWidth,s.text),g=s.textAlign,h=s.textBaseline,p=t.textXCoordinate?t.textXCoordinate:"left"===g?1:"right"===g?o:o/2,v=t.textYCoordinate?t.textYCoordinate:"top"===h?1:"center"===h?n/2:n,b=f+" "+a+" "+u,w=void 0;try{i.filter=d,i.drawImage(e,0,0,o,n),m&&(i.font=b,i.fillStyle=l,i.textAlign=g,i.textBaseline=h,i.fillText(m,p,v)),w=i.getImageData(0,0,o,n),this.addFrameImageData(w)}catch(e){return""+e}},addFrameImageData:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.frames,i=e.data;this.frames.push({data:i,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(e){var t=this;t.startRendering((function(i){t.destroyWorkers(),c.requestTimeout((function(){e(i)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;c.each(e,(function(e,t){var i=t.worker,r=t.objectUrl;i.terminate(),c.URL.revokeObjectURL(r)}))}}};var S=function(){},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];t=c.isFunction(t)?t:S;var i=o.createElement("canvas"),r=void 0,n=e.images,a=!!n.length,s=e.cameraStream,d=e.crop,l=e.filter,u=e.fontColor,f=e.fontFamily,m=e.fontWeight,g=e.keepCameraOn,h=(e.numWorkers,e.progressCallback),p=e.saveRenderingContexts,v=e.savedRenderingContexts,b=e.text,w=e.textAlign,y=e.textBaseline,C=e.videoElement,k=e.videoHeight,F=e.videoWidth,O=e.webcamVideoElement,W=Number(e.gifWidth),E=Number(e.gifHeight),A=Number(e.interval),M=(Number(e.sampleInterval),a?0:1e3*A),R=[],T=v.length?v.length:e.numFrames,U=T,j=new x(e),I=c.getFontSize(e),z=e.textXCoordinate?e.textXCoordinate:"left"===w?1:"right"===w?W:W/2,V=e.textYCoordinate?e.textYCoordinate:"top"===y?1:"center"===y?E/2:E,H=m+" "+I+" "+f,L=d?Math.floor(d.scaledWidth/2):0,P=d?F-d.scaledWidth:0,B=d?Math.floor(d.scaledHeight/2):0,G=d?k-d.scaledHeight:0,D=function e(){var i=U-1;function o(){var o;p&&R.push(r.getImageData(0,0,W,E)),b&&(r.font=H,r.fillStyle=u,r.textAlign=w,r.textBaseline=y,r.fillText(b,z,V)),o=r.getImageData(0,0,W,E),j.addFrameImageData(o),h((T-(U=i))/T),i>0&&c.requestTimeout(e,M),U||j.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:C,webcamVideoElement:O,savedRenderingContexts:R,keepCameraOn:g})}))}v.length?(r.putImageData(v[T-U],0,0),o()):function e(){try{P>F&&(P=F),G>k&&(G=k),L<0&&(L=0),B<0&&(B=0),r.filter=l,r.drawImage(C,L,B,P,G,0,0,W,E),o()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;c.requestTimeout(e,100)}}()};T=void 0!==T?T:10,A=void 0!==A?A:.1,i.width=W,i.height=E,r=i.getContext("2d"),function e(){v.length||0!==C.currentTime?D():c.requestTimeout(e,100)}()},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.videoWidth,i=e.videoHeight,r=e.gifWidth,o=e.gifHeight,n={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>i?(n.width=Math.round(t*(o/i))-r,n.scaledWidth=Math.round(n.width*(i/o))):(n.height=Math.round(i*(r/t))-o,n.scaledHeight=Math.round(n.height*(t/r))),n},O={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var i=t.cameraStream,r=t.completedCallback,o=t.videoElement;o&&(o.videoWidth>0&&o.videoHeight>0?(o.removeEventListener("loadeddata",O.findVideoSize),r({videoElement:o,cameraStream:i,videoWidth:o.videoWidth,videoHeight:o.videoHeight})):e.attempts<10?(e.attempts+=1,c.requestTimeout((function(){O.findVideoSize(t)}),400)):r({videoElement:o,cameraStream:i,videoWidth:O.defaultVideoDimensions.width,videoHeight:O.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){c.isFunction(e)&&e({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - Timed out while trying to start streaming",image:null,cameraStream:{}})},stream:function(e){var t=c.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,i=e.cameraStream,r=e.completedCallback,o=e.streamedCallback,n=e.videoElement;if(c.isFunction(o)&&o(),t){if(c.isString(t))n.src=t,n.innerHTML='<source src="'+t+'" type="video/'+c.getExtension(t)+'" />';else if(t instanceof Blob){try{n.src=c.URL.createObjectURL(t)}catch(e){}n.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(n.mozSrcObject)n.mozSrcObject=i;else if(c.URL)try{n.srcObject=i,n.src=c.URL.createObjectURL(i)}catch(e){n.srcObject=i}n.play(),c.requestTimeout((function e(){e.count=e.count||0,!0===O.loadedData?(O.findVideoSize({videoElement:n,cameraStream:i,completedCallback:r}),O.loadedData=!1):(e.count+=1)>10?O.findVideoSize({videoElement:n,cameraStream:i,completedCallback:r}):e()}),0)},startStreaming:function(e){var t=c.isFunction(e.error)?e.error:c.noop,i=c.isFunction(e.streamed)?e.streamed:c.noop,r=c.isFunction(e.completed)?e.completed:c.noop,n=e.crossOrigin,a=e.existingVideo,s=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=c.isElement(a)?a:l||o.createElement("video");n&&(u.crossOrigin=d.crossOrigin),u.autoplay=!0,u.loop=!0,u.muted=!0,u.addEventListener("loadeddata",(function(e){O.loadedData=!0,d.offset&&(u.currentTime=d.offset)})),a?O.stream({videoElement:u,existingVideo:a,completedCallback:r}):s?O.stream({videoElement:u,cameraStream:s,streamedCallback:i,completedCallback:r}):c.getUserMedia({video:!0},(function(e){O.stream({videoElement:u,cameraStream:e,streamedCallback:i,completedCallback:r})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=void 0!==t.timeout?t.timeout:0,r=t.callback,o=t.webcamVideoElement,n=void 0;i>0&&(n=c.requestTimeout((function(){O.onStreamingTimeout(r)}),1e4)),O.startStreaming({error:function(){r({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(n)},completed:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.cameraStream,r=t.videoElement,o=t.videoHeight,n=t.videoWidth;e({cameraStream:i,videoElement:r,videoHeight:o,videoWidth:n})},lastCameraStream:t.lastCameraStream,webcamVideoElement:o,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=c.isObject(e)?e:{},i=t.keepCameraOn,r=t.videoElement,o=t.webcamVideoElement,n=e.cameraStream||{},a=n.getTracks&&n.getTracks()||[],s=!!a.length,d=a[0];!i&&s&&c.isFunction(d.stop)&&d.stop(),c.isElement(r)&&!o&&(r.pause(),c.isFunction(c.URL.revokeObjectURL)&&!c.webWorkerError&&r.src&&c.URL.revokeObjectURL(r.src),c.removeElement(r))}};function W(e){e=c.isObject(e)?e:{},O.stopVideoStreaming(e)}function E(e,t){var i=e.options||{},r=i.images,n=i.video,a=Number(i.gifWidth),s=Number(i.gifHeight),d=(Number(i.numFrames),e.cameraStream),l=e.videoElement,u=e.videoWidth,f=e.videoHeight,m=F({videoWidth:u,videoHeight:f,gifHeight:s,gifWidth:a}),g=t;i.crop=m,i.videoElement=l,i.videoWidth=u,i.videoHeight=f,i.cameraStream=d,c.isElement(l)&&(l.width=a+m.width,l.height=s+m.height,i.webcamVideoElement||(c.setCSSAttr(l,{position:"fixed",opacity:"0"}),o.body.appendChild(l)),l.play(),k(i,(function(e){r&&r.length||n&&n.length||W(e),g(e)})))}function A(e,t){if(t=c.isFunction(e)?e:t,e=c.isObject(e)?e:{},c.isFunction(t)){var i=c.normalizeOptions(g,e)||{},r=e.cameraStream,n=i.images,a=n?n.length:0,s=i.video,d=i.webcamVideoElement;i=c.normalizeOptions(i,{gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),a?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,i=e.images,r=e.options,n=e.imagesLength,a={getUserMedia:!0,"window.URL":!0},s=u.validate(a),d=[],l=0,f=void 0,m=void 0;if(s.error)return t(s);function g(){c.each(d,(function(e,t){t&&(t.text?m.addFrame(t.img,r,t.text):m.addFrame(t,r))})),C(m,t)}m=new x(r),c.each(i,(function(e,i){var a=i;c.isElement(a)?(r.crossOrigin&&(a.crossOrigin=r.crossOrigin),d[e]=a,(l+=1)===n&&g()):c.isString(a)&&(f=new Image,r.crossOrigin&&(f.crossOrigin=r.crossOrigin),function(r){i.text&&(r.text=i.text),r.onerror=function(e){var i=void 0;if(0===--n)return(i={}).error="None of the requested images was capable of being retrieved",t(i)},r.onload=function(t){i.text?d[e]={img:r,text:r.text}:d[e]=r,(l+=1)===n&&g(),c.removeElement(r)},r.src=a}(f),c.setCSSAttr(f,{position:"fixed",opacity:"0"}),o.body.appendChild(f))}))}({images:n,imagesLength:a,callback:t,options:i}):s?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,i=e.existingVideo,r=e.options,o={getUserMedia:!0,"window.URL":!0},n=u.validate(o),a=void 0,s=void 0;if(n.error)return t(n);if(c.isElement(i)&&i.src){if(s=i.src,a=c.getExtension(s),!c.isSupported.videoCodecs[a])return t(u.messages.videoCodecs)}else c.isArray(i)&&c.each(i,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),c.isSupported.videoCodecs[a])return i=t,!1}));O.startStreaming({completed:function(e){e.options=r||{},E(e,t)},existingVideo:i,crossOrigin:r.crossOrigin,options:r})}({existingVideo:s,callback:t,options:i}):function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,i=e.lastCameraStream,r=e.options,o=e.webcamVideoElement;if(!p())return t(u.validate());r.savedRenderingContexts.length?k(r,(function(e){t(e)})):O.startVideoStreaming((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.options=r||{},E(e,t)}),{lastCameraStream:i,callback:t,webcamVideoElement:o,crossOrigin:r.crossOrigin})}({lastCameraStream:r,callback:t,webcamVideoElement:d,options:i})}}var M={utils:l,error:f,defaultOptions:h,createGIF:A,takeSnapShot:function(e,t){if(t=c.isFunction(e)?e:t,e=c.isObject(e)?e:{},c.isFunction(t)){var i=c.normalizeOptions(g,e);A(c.normalizeOptions(i,{interval:.1,numFrames:1,gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),t)}},stopVideoStreaming:W,isSupported:function(){return u.isValid()},isWebCamGIFSupported:p,isExistingVideoGIFSupported:function(e){var t=!1;if(c.isArray(e)&&e.length){if(c.each(e,(function(e,i){c.isSupported.videoCodecs[i]&&(t=!0)})),!t)return!1}else if(c.isString(e)&&e.length&&!c.isSupported.videoCodecs[e])return!1;return u.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return u.isValid({getUserMedia:!0})},VERSION:"0.4.5"};void 0===(r=function(){return M}.apply(t,[]))||(e.exports=r)}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})},function(e,t,i){const r=i(2);globalThis.loaders=globalThis.loaders||{},e.exports=Object.assign(globalThis.loaders,r)},function(e,t,i){"use strict";i.r(t),i.d(t,"VideoLoader",(function(){return r})),i.d(t,"GIFBuilder",(function(){return s}));const r={name:"Video",id:"video",module:"video",version:"3.1.0-alpha.3",extensions:["mp4"],mimeTypes:["video/mp4"],parse:async function(e){const t=new Blob([e]),i=document.createElement("video");return i.src=URL.createObjectURL(t),i},options:{video:{}}};var o=i(0),n=i.n(o);const a={source:"images",width:200,height:200,crossOrigin:"Anonymous",progressCallback:e=>{},completeCallback:()=>{},numWorkers:2,sampleInterval:10,interval:.1,offset:null,numFrames:10,frameDuration:1,filter:"",waterMark:null,waterMarkHeight:null,waterMarkWidth:null,waterMarkXCoordinate:1,waterMarkYCoordinate:1,text:"",showFrameText:!0,fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,webcamVideoElement:null,keepCameraOn:!1,cameraStream:null,saveRenderingContexts:!1,savedRenderingContexts:[]};class s{static get properties(){return{id:"gif",name:"GIF",extensions:["gif"],mimeTypes:["image/gif"],builder:s,options:a}}constructor(e){this.options={...e},this.source=e.source,delete e.source,this.files=[],this.gifshot=n.a}async initialize(e){}async add(e){await this.initialize(),this.files.push(e)}async build(){switch(await this.initialize(),this._cleanOptions(this.options),this.source){case"images":this.options.images=this.files;break;case"video":this.options.video=this.files;break;case"webcam":!function(e,t){if(!e)throw new Error(t)}(0===this.files.length);break;default:throw new Error("GIFBuilder: invalid source")}return await this._createGIF()}async _createGIF(){return new Promise((e,t)=>{this.gifshot.createGIF(this.options,i=>{i.error?t(i.errorMsg):e(i.image)})})}_cleanOptions(e){(e.video||e.images||e.gifWidth||e.gifHeight)&&console.warn("GIFBuilder: ignoring options"),delete e.video,delete e.images,e.gifWidth=e.width,e.gifHeight=e.height,delete e.width,delete e.height}}}])}));
|
|
2
|
-
//# sourceMappingURL=dist.min.js.map
|
package/dist/dist.min.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/libs/gifshot.js","webpack:///./src/bundle.ts","webpack:///./src/video-loader.ts","webpack:///./src/lib/parsers/parse-video.ts","webpack:///./src/gif-builder.js","webpack:///./src/lib/utils/assert.js"],"names":["root","factory","exports","module","define","amd","a","i","window","installedModules","__webpack_require__","moduleId","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","document","navigator","undefined","btoa","getUserMedia","utils","URL","webkitURL","mozURL","msURL","webkitGetUserMedia","mozGetUserMedia","msGetUserMedia","requestAnimFrame","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame","requestTimeout","callback","delay","noop","setTimeout","start","Date","getTime","handle","loop","Blob","BlobBuilder","WebKitBlobBuilder","MozBlobBuilder","MSBlobBuilder","input","output","length","chr1","chr2","chr3","enc1","enc2","enc3","enc4","charCodeAt","isNaN","charAt","isObject","obj","toString","isEmptyObject","keys","isArray","arr","Array","isFunction","func","isElement","elem","nodeType","isString","isSupported","canvas","el","createElement","getContext","webworkers","Worker","blob","Uint8Array","Uint32Array","videoCodecs","testEl","supportObj","canPlayType","mp4","h264","ogv","ogg","webm","e","each","collection","x","len","normalizeOptions","defaultOptions","userOptions","newObj","val","currentUserOption","setCSSAttr","attr","style","removeElement","node","parentNode","removeChild","createWebWorker","content","objectUrl","createObjectURL","getExtension","src","substr","lastIndexOf","getFontSize","options","arguments","body","resizeFont","fontSize","text","containerWidth","gifWidth","parseInt","minFontSize","div","span","setAttribute","appendChild","innerHTML","textIndent","visibility","offsetWidth","webWorkerError","utils$2","freeze","default","error","validate","skipObj","errorObj","validators","indece","currentValidator","errorCode","condition","isValid","errorMsg","messages","error$2","sampleInterval","numWorkers","filter","gifHeight","interval","numFrames","frameDuration","keepCameraOn","images","video","webcamVideoElement","cameraStream","fontWeight","fontFamily","fontColor","textAlign","textBaseline","textXCoordinate","textYCoordinate","progressCallback","completeCallback","saveRenderingContexts","savedRenderingContexts","crossOrigin","defaultOptions$2","isWebCamGIFSupported","NeuQuant","alphadec","thepicture","lengthcount","samplefac","network","netsize","prime1","prime2","prime3","prime4","minpicturebytes","maxnetpos","netbiasshift","ncycles","intbiasshift","intbias","gammashift","betashift","beta","betagamma","initrad","radiusbiasshift","radiusbias","initradius","radiusdec","alphabiasshift","initalpha","radbiasshift","radbias","alpharadbshift","alpharadbias","netindex","bias","freq","radpower","NeuQuantConstructor","thepic","sample","colorMap","map","index","k","j","inxbuild","smallpos","smallval","q","previouscol","startpos","learn","b","g","radius","rad","alpha","step","delta","samplepixels","pix","lim","altersingle","contest","alterneigh","dist","bestd","best","process","unbiasnet","lo","hi","alphaMult","biasdist","betafreq","bestpos","bestbiaspos","bestbiasd","apply","this","workerCode","onmessage","ev","response","data","gifshot","workerMethods","run","postMessage","dataToRGB","width","height","rgb","push","componentizedPaletteToArray","paletteRGB","paletteArray","imageData","rgbComponents","nq","numberPixels","indexedPixels","pixels","palette","frame","_frame","processFrameWithQuantizer","gifWriter","buf","gopts","loop_count","global_palette","ended","addFrame","y","w","h","indexed_pixels","opts","using_local_palette","num_colors","check_palette_and_num_colors","min_code_size","disposal","use_transparency","transparent_index","transparent","il","index_stream","cur_subblock","clear_code","code_mask","eoi_code","next_code","cur_code_size","cur_shift","cur","emit_bytes_to_buffer","bit_block_size","emit_code","ib_code","code_table","cur_key","cur_code","GifWriterOutputLZWCodeStream","end","noop$2","AnimatedGIF","ctx","repeat","frames","numRenderedFrames","onRenderCompleteCallback","onRenderProgressCallback","workers","availableWorkers","generatingGIF","initializeWebWorkers","getBase64GIF","animatedGifInstance","image","processFrameWorkerCode","webWorkerObj","webWorker","workerError","worker","getWorker","pop","freeWorker","byteMap","String","fromCharCode","bufferToString","buffer","numberValues","str","onFrameFinished","self","hasExistingImages","allDone","every","beingProcessed","done","generateGIF","processNextFrame","processFrame","position","AnimatedGifContext","_options","slice","startRendering","gifOptions","gifWriter$$1","iterator","framePalette","setRepeat","element","gifshotOptions","_gifshotOptions","font","drawImage","fillStyle","fillText","getImageData","addFrameImageData","imageDataArray","onRenderProgress","isRendering","gif","destroyWorkers","workerObj","terminate","revokeObjectURL","noop$3","screenShot","context","existingImages","crop","videoElement","videoHeight","videoWidth","Number","waitBetweenFrames","renderingContextsToSave","pendingFrames","ag","sourceX","Math","floor","scaledWidth","sourceWidth","sourceY","scaledHeight","sourceHeight","captureFrames","captureSingleFrame","framesLeft","finishCapture","putImageData","drawVideo","capture","currentTime","result","round","videoStream","loadedData","defaultVideoDimensions","findVideoSize","findVideoSizeMethod","attempts","completedCallback","removeEventListener","onStreamingTimeout","stream","existingVideo","streamedCallback","type","mozSrcObject","srcObject","play","checkLoadedData","count","startStreaming","errorCallback","streamed","completed","lastCameraStream","autoplay","muted","addEventListener","event","offset","startVideoStreaming","timeoutLength","timeout","originalCallback","noGetUserMediaSupportTimeout","clearTimeout","stopVideoStreaming","_obj","cameraStreamTracks","getTracks","hasCameraStreamTracks","firstCameraStreamTrack","stop","pause","createAndGetGIF","cropDimensions","opacity","createGIF","imagesLength","loadedImages","loadedImagesLength","tempImage","addLoadedImagesToGif","loadedImage","img","currentImage","Image","onerror","onload","videoType","videoSrc","existingWebcam","API","mergedOptions","codecs","hasValidCodec","currentCodec","moduleExports","require","globalThis","loaders","assign","VideoLoader","id","version","extensions","mimeTypes","parse","async","arrayBuffer","GIF_BUILDER_OPTIONS","source","captureProgress","waterMark","waterMarkHeight","waterMarkWidth","waterMarkXCoordinate","waterMarkYCoordinate","showFrameText","GIFBuilder","builder","constructor","files","file","initialize","_cleanOptions","message","Error","assert","_createGIF","Promise","resolve","reject","console","warn"],"mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb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tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","// @ts-nocheck\n/*Copyrights for code authored by Yahoo Inc. is licensed under the following terms:\nMIT License\nCopyright 2017 Yahoo Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n;(function(window, document, navigator, undefined) {\n\"use strict\";\n\n/*\n utils.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nvar utils = {\n URL: window.URL || window.webkitURL || window.mozURL || window.msURL,\n getUserMedia: function () {\n var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;\n\n return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;\n }(),\n requestAnimFrame: window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame,\n requestTimeout: function requestTimeout(callback, delay) {\n callback = callback || utils.noop;\n delay = delay || 0;\n\n if (!utils.requestAnimFrame) {\n return setTimeout(callback, delay);\n }\n\n var start = new Date().getTime();\n var handle = new Object();\n var requestAnimFrame = utils.requestAnimFrame;\n\n var loop = function loop() {\n var current = new Date().getTime();\n var delta = current - start;\n\n delta >= delay ? callback.call() : handle.value = requestAnimFrame(loop);\n };\n\n handle.value = requestAnimFrame(loop);\n\n return handle;\n },\n Blob: window.Blob || window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder,\n btoa: function () {\n var btoa = window.btoa || function (input) {\n var output = '';\n var i = 0;\n var l = input.length;\n var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var chr1 = void 0;\n var chr2 = void 0;\n var chr3 = void 0;\n var enc1 = void 0;\n var enc2 = void 0;\n var enc3 = void 0;\n var enc4 = void 0;\n\n while (i < l) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);\n }\n\n return output;\n };\n\n return btoa ? btoa.bind(window) : utils.noop;\n }(),\n isObject: function isObject(obj) {\n return obj && Object.prototype.toString.call(obj) === '[object Object]';\n },\n isEmptyObject: function isEmptyObject(obj) {\n return utils.isObject(obj) && !Object.keys(obj).length;\n },\n isArray: function isArray(arr) {\n return arr && Array.isArray(arr);\n },\n isFunction: function isFunction(func) {\n return func && typeof func === 'function';\n },\n isElement: function isElement(elem) {\n return elem && elem.nodeType === 1;\n },\n isString: function isString(value) {\n return typeof value === 'string' || Object.prototype.toString.call(value) === '[object String]';\n },\n isSupported: {\n canvas: function canvas() {\n var el = document.createElement('canvas');\n\n return el && el.getContext && el.getContext('2d');\n },\n webworkers: function webworkers() {\n return window.Worker;\n },\n blob: function blob() {\n return utils.Blob;\n },\n Uint8Array: function Uint8Array() {\n return window.Uint8Array;\n },\n Uint32Array: function Uint32Array() {\n return window.Uint32Array;\n },\n videoCodecs: function () {\n var testEl = document.createElement('video');\n var supportObj = {\n 'mp4': false,\n 'h264': false,\n 'ogv': false,\n 'ogg': false,\n 'webm': false\n };\n\n try {\n if (testEl && testEl.canPlayType) {\n // Check for MPEG-4 support\n supportObj.mp4 = testEl.canPlayType('video/mp4; codecs=\"mp4v.20.8\"') !== '';\n\n // Check for h264 support\n supportObj.h264 = (testEl.canPlayType('video/mp4; codecs=\"avc1.42E01E\"') || testEl.canPlayType('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"')) !== '';\n\n // Check for Ogv support\n supportObj.ogv = testEl.canPlayType('video/ogg; codecs=\"theora\"') !== '';\n\n // Check for Ogg support\n supportObj.ogg = testEl.canPlayType('video/ogg; codecs=\"theora\"') !== '';\n\n // Check for Webm support\n supportObj.webm = testEl.canPlayType('video/webm; codecs=\"vp8, vorbis\"') !== -1;\n }\n } catch (e) {}\n\n return supportObj;\n }()\n },\n noop: function noop() {},\n each: function each(collection, callback) {\n var x = void 0;\n var len = void 0;\n\n if (utils.isArray(collection)) {\n x = -1;\n len = collection.length;\n\n while (++x < len) {\n if (callback(x, collection[x]) === false) {\n break;\n }\n }\n } else if (utils.isObject(collection)) {\n for (x in collection) {\n if (collection.hasOwnProperty(x)) {\n if (callback(x, collection[x]) === false) {\n break;\n }\n }\n }\n }\n },\n normalizeOptions: function normalizeOptions(defaultOptions, userOptions) {\n if (!utils.isObject(defaultOptions) || !utils.isObject(userOptions) || !Object.keys) {\n return;\n }\n\n var newObj = {};\n\n utils.each(defaultOptions, function (key, val) {\n newObj[key] = defaultOptions[key];\n });\n\n utils.each(userOptions, function (key, val) {\n var currentUserOption = userOptions[key];\n\n if (!utils.isObject(currentUserOption)) {\n newObj[key] = currentUserOption;\n } else {\n if (!defaultOptions[key]) {\n newObj[key] = currentUserOption;\n } else {\n newObj[key] = utils.normalizeOptions(defaultOptions[key], currentUserOption);\n }\n }\n });\n\n return newObj;\n },\n setCSSAttr: function setCSSAttr(elem, attr, val) {\n if (!utils.isElement(elem)) {\n return;\n }\n\n if (utils.isString(attr) && utils.isString(val)) {\n elem.style[attr] = val;\n } else if (utils.isObject(attr)) {\n utils.each(attr, function (key, val) {\n elem.style[key] = val;\n });\n }\n },\n removeElement: function removeElement(node) {\n if (!utils.isElement(node)) {\n return;\n }\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n },\n createWebWorker: function createWebWorker(content) {\n if (!utils.isString(content)) {\n return {};\n }\n\n try {\n var blob = new utils.Blob([content], {\n 'type': 'text/javascript'\n });\n var objectUrl = utils.URL.createObjectURL(blob);\n var worker = new Worker(objectUrl);\n\n return {\n 'objectUrl': objectUrl,\n 'worker': worker\n };\n } catch (e) {\n return '' + e;\n }\n },\n getExtension: function getExtension(src) {\n return src.substr(src.lastIndexOf('.') + 1, src.length);\n },\n getFontSize: function getFontSize() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (!document.body || options.resizeFont === false) {\n return options.fontSize;\n }\n\n var text = options.text;\n var containerWidth = options.gifWidth;\n var fontSize = parseInt(options.fontSize, 10);\n var minFontSize = parseInt(options.minFontSize, 10);\n var div = document.createElement('div');\n var span = document.createElement('span');\n\n div.setAttribute('width', containerWidth);\n div.appendChild(span);\n\n span.innerHTML = text;\n span.style.fontSize = fontSize + 'px';\n span.style.textIndent = '-9999px';\n span.style.visibility = 'hidden';\n\n document.body.appendChild(span);\n\n while (span.offsetWidth > containerWidth && fontSize >= minFontSize) {\n span.style.fontSize = --fontSize + 'px';\n }\n\n document.body.removeChild(span);\n\n return fontSize + 'px';\n },\n webWorkerError: false\n};\n\n\n\nvar utils$2 = Object.freeze({\n\tdefault: utils\n});\n\n/*\n error.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nvar error = {\n validate: function validate(skipObj) {\n skipObj = utils.isObject(skipObj) ? skipObj : {};\n\n var errorObj = {};\n\n utils.each(error.validators, function (indece, currentValidator) {\n var errorCode = currentValidator.errorCode;\n\n if (!skipObj[errorCode] && !currentValidator.condition) {\n errorObj = currentValidator;\n errorObj.error = true;\n\n return false;\n }\n });\n\n delete errorObj.condition;\n\n return errorObj;\n },\n isValid: function isValid(skipObj) {\n var errorObj = error.validate(skipObj);\n var isValid = errorObj.error !== true ? true : false;\n\n return isValid;\n },\n validators: [{\n condition: utils.isFunction(utils.getUserMedia),\n errorCode: 'getUserMedia',\n errorMsg: 'The getUserMedia API is not supported in your browser'\n }, {\n condition: utils.isSupported.canvas(),\n errorCode: 'canvas',\n errorMsg: 'Canvas elements are not supported in your browser'\n }, {\n condition: utils.isSupported.webworkers(),\n errorCode: 'webworkers',\n errorMsg: 'The Web Workers API is not supported in your browser'\n }, {\n condition: utils.isFunction(utils.URL),\n errorCode: 'window.URL',\n errorMsg: 'The window.URL API is not supported in your browser'\n }, {\n condition: utils.isSupported.blob(),\n errorCode: 'window.Blob',\n errorMsg: 'The window.Blob File API is not supported in your browser'\n }, {\n condition: utils.isSupported.Uint8Array(),\n errorCode: 'window.Uint8Array',\n errorMsg: 'The window.Uint8Array function constructor is not supported in your browser'\n }, {\n condition: utils.isSupported.Uint32Array(),\n errorCode: 'window.Uint32Array',\n errorMsg: 'The window.Uint32Array function constructor is not supported in your browser'\n }],\n messages: {\n videoCodecs: {\n errorCode: 'videocodec',\n errorMsg: 'The video codec you are trying to use is not supported in your browser'\n }\n }\n};\n\n\n\nvar error$2 = Object.freeze({\n\tdefault: error\n});\n\n/*\n defaultOptions.js\n =================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Helpers\nvar noop = function noop() {};\n\nvar defaultOptions = {\n sampleInterval: 10,\n numWorkers: 2,\n filter: '',\n gifWidth: 200,\n gifHeight: 200,\n interval: 0.1,\n numFrames: 10,\n frameDuration: 1,\n keepCameraOn: false,\n images: [],\n video: null,\n webcamVideoElement: null,\n cameraStream: null,\n text: '',\n fontWeight: 'normal',\n fontSize: '16px',\n minFontSize: '10px',\n resizeFont: false,\n fontFamily: 'sans-serif',\n fontColor: '#ffffff',\n textAlign: 'center',\n textBaseline: 'bottom',\n textXCoordinate: null,\n textYCoordinate: null,\n progressCallback: noop,\n completeCallback: noop,\n saveRenderingContexts: false,\n savedRenderingContexts: [],\n crossOrigin: 'Anonymous'\n};\n\n\n\nvar defaultOptions$2 = Object.freeze({\n\tdefault: defaultOptions\n});\n\n/*\n isSupported.js\n ==============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction isSupported() {\n return error.isValid();\n}\n\n/*\n isWebCamGIFSupported.js\n =======================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction isWebCamGIFSupported() {\n return error.isValid();\n}\n\n/*\n isSupported.js\n ==============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction isSupported$1() {\n var options = {\n getUserMedia: true\n };\n\n return error.isValid(options);\n}\n\n/*\n isExistingVideoGIFSupported.js\n ==============================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction isExistingVideoGIFSupported(codecs) {\n var hasValidCodec = false;\n\n if (utils.isArray(codecs) && codecs.length) {\n utils.each(codecs, function (indece, currentCodec) {\n if (utils.isSupported.videoCodecs[currentCodec]) {\n hasValidCodec = true;\n }\n });\n\n if (!hasValidCodec) {\n return false;\n }\n } else if (utils.isString(codecs) && codecs.length) {\n if (!utils.isSupported.videoCodecs[codecs]) {\n return false;\n }\n }\n\n return error.isValid({\n 'getUserMedia': true\n });\n}\n\n/*\n NeuQuant.js\n ===========\n*/\n\n/*\n * NeuQuant Neural-Net Quantization Algorithm\n * ------------------------------------------\n *\n * Copyright (c) 1994 Anthony Dekker\n *\n * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See\n * \"Kohonen neural networks for optimal colour quantization\" in \"Network:\n * Computation in Neural Systems\" Vol. 5 (1994) pp 351-367. for a discussion of\n * the algorithm.\n *\n * Any party obtaining a copy of these files from the author, directly or\n * indirectly, is granted, free of charge, a full and unrestricted irrevocable,\n * world-wide, paid up, royalty-free, nonexclusive right and license to deal in\n * this software and documentation files (the \"Software\"), including without\n * limitation the rights to use, copy, modify, merge, publish, distribute,\n * sublicense, and/or sell copies of the Software, and to permit persons who\n * receive copies from any such party to do so, with the only requirement being\n * that this copyright notice remain intact.\n */\n\n/*\n * This class handles Neural-Net quantization algorithm\n * @author Kevin Weiner (original Java version - kweiner@fmsware.com)\n * @author Thibault Imbert (AS3 version - bytearray.org)\n * @version 0.1 AS3 implementation\n * @version 0.2 JS->AS3 \"translation\" by antimatter15\n * @version 0.3 JS clean up + using modern JS idioms by sole - http://soledadpenades.com\n * Also implement fix in color conversion described at http://stackoverflow.com/questions/16371712/neuquant-js-javascript-color-quantization-hidden-bug-in-js-conversion\n */\n\nfunction NeuQuant() {\n var netsize = 256; // number of colours used\n\n // four primes near 500 - assume no image has a length so large\n // that it is divisible by all four primes\n var prime1 = 499;\n var prime2 = 491;\n var prime3 = 487;\n var prime4 = 503;\n\n // minimum size for input image\n var minpicturebytes = 3 * prime4;\n\n // Network Definitions\n\n var maxnetpos = netsize - 1;\n var netbiasshift = 4; // bias for colour values\n var ncycles = 100; // no. of learning cycles\n\n // defs for freq and bias\n var intbiasshift = 16; // bias for fractions\n var intbias = 1 << intbiasshift;\n var gammashift = 10; // gamma = 1024\n var gamma = 1 << gammashift;\n var betashift = 10;\n var beta = intbias >> betashift; // beta = 1/1024\n var betagamma = intbias << gammashift - betashift;\n\n // defs for decreasing radius factor\n // For 256 colors, radius starts at 32.0 biased by 6 bits\n // and decreases by a factor of 1/30 each cycle\n var initrad = netsize >> 3;\n var radiusbiasshift = 6;\n var radiusbias = 1 << radiusbiasshift;\n var initradius = initrad * radiusbias;\n var radiusdec = 30;\n\n // defs for decreasing alpha factor\n // Alpha starts at 1.0 biased by 10 bits\n var alphabiasshift = 10;\n var initalpha = 1 << alphabiasshift;\n var alphadec;\n\n // radbias and alpharadbias used for radpower calculation\n var radbiasshift = 8;\n var radbias = 1 << radbiasshift;\n var alpharadbshift = alphabiasshift + radbiasshift;\n var alpharadbias = 1 << alpharadbshift;\n\n // Input image\n var thepicture;\n // Height * Width * 3\n var lengthcount;\n // Sampling factor 1..30\n var samplefac;\n\n // The network itself\n var network;\n var netindex = [];\n\n // for network lookup - really 256\n var bias = [];\n\n // bias and freq arrays for learning\n var freq = [];\n var radpower = [];\n\n function NeuQuantConstructor(thepic, len, sample) {\n\n var i;\n var p;\n\n thepicture = thepic;\n lengthcount = len;\n samplefac = sample;\n\n network = new Array(netsize);\n\n for (i = 0; i < netsize; i++) {\n network[i] = new Array(4);\n p = network[i];\n p[0] = p[1] = p[2] = (i << netbiasshift + 8) / netsize | 0;\n freq[i] = intbias / netsize | 0; // 1 / netsize\n bias[i] = 0;\n }\n }\n\n function colorMap() {\n var map = [];\n var index = new Array(netsize);\n for (var i = 0; i < netsize; i++) {\n index[network[i][3]] = i;\n }var k = 0;\n for (var l = 0; l < netsize; l++) {\n var j = index[l];\n map[k++] = network[j][0];\n map[k++] = network[j][1];\n map[k++] = network[j][2];\n }\n return map;\n }\n\n // Insertion sort of network and building of netindex[0..255]\n // (to do after unbias)\n function inxbuild() {\n var i;\n var j;\n var smallpos;\n var smallval;\n var p;\n var q;\n var previouscol;\n var startpos;\n\n previouscol = 0;\n startpos = 0;\n\n for (i = 0; i < netsize; i++) {\n\n p = network[i];\n smallpos = i;\n smallval = p[1]; // index on g\n // find smallest in i..netsize-1\n for (j = i + 1; j < netsize; j++) {\n\n q = network[j];\n\n if (q[1] < smallval) {\n // index on g\n smallpos = j;\n smallval = q[1]; // index on g\n }\n }\n\n q = network[smallpos];\n\n // swap p (i) and q (smallpos) entries\n if (i != smallpos) {\n j = q[0];\n q[0] = p[0];\n p[0] = j;\n j = q[1];\n q[1] = p[1];\n p[1] = j;\n j = q[2];\n q[2] = p[2];\n p[2] = j;\n j = q[3];\n q[3] = p[3];\n p[3] = j;\n }\n\n // smallval entry is now in position i\n if (smallval != previouscol) {\n\n netindex[previouscol] = startpos + i >> 1;\n\n for (j = previouscol + 1; j < smallval; j++) {\n netindex[j] = i;\n }\n\n previouscol = smallval;\n startpos = i;\n }\n }\n\n netindex[previouscol] = startpos + maxnetpos >> 1;\n for (j = previouscol + 1; j < 256; j++) {\n netindex[j] = maxnetpos; // really 256\n }\n }\n\n // Main Learning Loop\n\n function learn() {\n var i;\n var j;\n var b;\n var g;\n var r;\n var radius;\n var rad;\n var alpha;\n var step;\n var delta;\n var samplepixels;\n var p;\n var pix;\n var lim;\n\n if (lengthcount < minpicturebytes) {\n samplefac = 1;\n }\n\n alphadec = 30 + (samplefac - 1) / 3;\n p = thepicture;\n pix = 0;\n lim = lengthcount;\n samplepixels = lengthcount / (3 * samplefac);\n delta = samplepixels / ncycles | 0;\n alpha = initalpha;\n radius = initradius;\n\n rad = radius >> radiusbiasshift;\n if (rad <= 1) {\n rad = 0;\n }\n\n for (i = 0; i < rad; i++) {\n radpower[i] = alpha * ((rad * rad - i * i) * radbias / (rad * rad));\n }\n\n if (lengthcount < minpicturebytes) {\n step = 3;\n } else if (lengthcount % prime1 !== 0) {\n step = 3 * prime1;\n } else {\n\n if (lengthcount % prime2 !== 0) {\n step = 3 * prime2;\n } else {\n if (lengthcount % prime3 !== 0) {\n step = 3 * prime3;\n } else {\n step = 3 * prime4;\n }\n }\n }\n\n i = 0;\n\n while (i < samplepixels) {\n\n b = (p[pix + 0] & 0xff) << netbiasshift;\n g = (p[pix + 1] & 0xff) << netbiasshift;\n r = (p[pix + 2] & 0xff) << netbiasshift;\n j = contest(b, g, r);\n\n altersingle(alpha, j, b, g, r);\n\n if (rad !== 0) {\n // Alter neighbours\n alterneigh(rad, j, b, g, r);\n }\n\n pix += step;\n\n if (pix >= lim) {\n pix -= lengthcount;\n }\n\n i++;\n\n if (delta === 0) {\n delta = 1;\n }\n\n if (i % delta === 0) {\n alpha -= alpha / alphadec;\n radius -= radius / radiusdec;\n rad = radius >> radiusbiasshift;\n\n if (rad <= 1) {\n rad = 0;\n }\n\n for (j = 0; j < rad; j++) {\n radpower[j] = alpha * ((rad * rad - j * j) * radbias / (rad * rad));\n }\n }\n }\n }\n\n // Search for BGR values 0..255 (after net is unbiased) and return colour index\n function map(b, g, r) {\n var i;\n var j;\n var dist;\n var a;\n var bestd;\n var p;\n var best;\n\n // Biggest possible distance is 256 * 3\n bestd = 1000;\n best = -1;\n i = netindex[g]; // index on g\n j = i - 1; // start at netindex[g] and work outwards\n\n while (i < netsize || j >= 0) {\n\n if (i < netsize) {\n\n p = network[i];\n\n dist = p[1] - g; // inx key\n\n if (dist >= bestd) {\n i = netsize; // stop iter\n } else {\n\n i++;\n\n if (dist < 0) {\n dist = -dist;\n }\n\n a = p[0] - b;\n\n if (a < 0) {\n a = -a;\n }\n\n dist += a;\n\n if (dist < bestd) {\n a = p[2] - r;\n\n if (a < 0) {\n a = -a;\n }\n\n dist += a;\n\n if (dist < bestd) {\n bestd = dist;\n best = p[3];\n }\n }\n }\n }\n\n if (j >= 0) {\n\n p = network[j];\n\n dist = g - p[1]; // inx key - reverse dif\n\n if (dist >= bestd) {\n j = -1; // stop iter\n } else {\n\n j--;\n if (dist < 0) {\n dist = -dist;\n }\n a = p[0] - b;\n if (a < 0) {\n a = -a;\n }\n dist += a;\n\n if (dist < bestd) {\n a = p[2] - r;\n if (a < 0) {\n a = -a;\n }\n dist += a;\n if (dist < bestd) {\n bestd = dist;\n best = p[3];\n }\n }\n }\n }\n }\n\n return best;\n }\n\n function process() {\n learn();\n unbiasnet();\n inxbuild();\n return colorMap();\n }\n\n // Unbias network to give byte values 0..255 and record position i\n // to prepare for sort\n function unbiasnet() {\n var i;\n var j;\n\n for (i = 0; i < netsize; i++) {\n network[i][0] >>= netbiasshift;\n network[i][1] >>= netbiasshift;\n network[i][2] >>= netbiasshift;\n network[i][3] = i; // record colour no\n }\n }\n\n // Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2))\n // in radpower[|i-j|]\n function alterneigh(rad, i, b, g, r) {\n\n var j;\n var k;\n var lo;\n var hi;\n var a;\n var m;\n\n var p;\n\n lo = i - rad;\n if (lo < -1) {\n lo = -1;\n }\n\n hi = i + rad;\n\n if (hi > netsize) {\n hi = netsize;\n }\n\n j = i + 1;\n k = i - 1;\n m = 1;\n\n while (j < hi || k > lo) {\n\n a = radpower[m++];\n\n if (j < hi) {\n\n p = network[j++];\n\n try {\n\n p[0] -= a * (p[0] - b) / alpharadbias | 0;\n p[1] -= a * (p[1] - g) / alpharadbias | 0;\n p[2] -= a * (p[2] - r) / alpharadbias | 0;\n } catch (e) {}\n }\n\n if (k > lo) {\n\n p = network[k--];\n\n try {\n\n p[0] -= a * (p[0] - b) / alpharadbias | 0;\n p[1] -= a * (p[1] - g) / alpharadbias | 0;\n p[2] -= a * (p[2] - r) / alpharadbias | 0;\n } catch (e) {}\n }\n }\n }\n\n // Move neuron i towards biased (b,g,r) by factor alpha\n function altersingle(alpha, i, b, g, r) {\n\n // alter hit neuron\n var n = network[i];\n var alphaMult = alpha / initalpha;\n n[0] -= alphaMult * (n[0] - b) | 0;\n n[1] -= alphaMult * (n[1] - g) | 0;\n n[2] -= alphaMult * (n[2] - r) | 0;\n }\n\n // Search for biased BGR values\n function contest(b, g, r) {\n\n // finds closest neuron (min dist) and updates freq\n // finds best neuron (min dist-bias) and returns position\n // for frequently chosen neurons, freq[i] is high and bias[i] is negative\n // bias[i] = gamma*((1/netsize)-freq[i])\n\n var i;\n var dist;\n var a;\n var biasdist;\n var betafreq;\n var bestpos;\n var bestbiaspos;\n var bestd;\n var bestbiasd;\n var n;\n\n bestd = ~(1 << 31);\n bestbiasd = bestd;\n bestpos = -1;\n bestbiaspos = bestpos;\n\n for (i = 0; i < netsize; i++) {\n\n n = network[i];\n dist = n[0] - b;\n\n if (dist < 0) {\n dist = -dist;\n }\n\n a = n[1] - g;\n\n if (a < 0) {\n a = -a;\n }\n\n dist += a;\n\n a = n[2] - r;\n\n if (a < 0) {\n a = -a;\n }\n\n dist += a;\n\n if (dist < bestd) {\n bestd = dist;\n bestpos = i;\n }\n\n biasdist = dist - (bias[i] >> intbiasshift - netbiasshift);\n\n if (biasdist < bestbiasd) {\n bestbiasd = biasdist;\n bestbiaspos = i;\n }\n\n betafreq = freq[i] >> betashift;\n freq[i] -= betafreq;\n bias[i] += betafreq << gammashift;\n }\n\n freq[bestpos] += beta;\n bias[bestpos] -= betagamma;\n return bestbiaspos;\n }\n\n NeuQuantConstructor.apply(this, arguments);\n\n var exports = {};\n exports.map = map;\n exports.process = process;\n\n return exports;\n}\n\n/*\n processFrameWorker.js\n =====================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction workerCode() {\n var self = this;\n\n try {\n self.onmessage = function (ev) {\n var data = ev.data || {};\n var response;\n\n if (data.gifshot) {\n response = workerMethods.run(data);\n postMessage(response);\n }\n };\n } catch (e) {}\n\n var workerMethods = {\n dataToRGB: function dataToRGB(data, width, height) {\n var length = width * height * 4;\n var i = 0;\n var rgb = [];\n\n while (i < length) {\n rgb.push(data[i++]);\n rgb.push(data[i++]);\n rgb.push(data[i++]);\n i++; // for the alpha channel which we don't care about\n }\n\n return rgb;\n },\n componentizedPaletteToArray: function componentizedPaletteToArray(paletteRGB) {\n paletteRGB = paletteRGB || [];\n\n var paletteArray = [];\n\n for (var i = 0; i < paletteRGB.length; i += 3) {\n var r = paletteRGB[i];\n var g = paletteRGB[i + 1];\n var b = paletteRGB[i + 2];\n\n paletteArray.push(r << 16 | g << 8 | b);\n }\n\n return paletteArray;\n },\n // This is the \"traditional\" Animated_GIF style of going from RGBA to indexed color frames\n 'processFrameWithQuantizer': function processFrameWithQuantizer(imageData, width, height, sampleInterval) {\n var rgbComponents = this.dataToRGB(imageData, width, height);\n var nq = new NeuQuant(rgbComponents, rgbComponents.length, sampleInterval);\n var paletteRGB = nq.process();\n var paletteArray = new Uint32Array(this.componentizedPaletteToArray(paletteRGB));\n var numberPixels = width * height;\n var indexedPixels = new Uint8Array(numberPixels);\n var k = 0;\n\n for (var i = 0; i < numberPixels; i++) {\n var r = rgbComponents[k++];\n var g = rgbComponents[k++];\n var b = rgbComponents[k++];\n\n indexedPixels[i] = nq.map(r, g, b);\n }\n\n return {\n pixels: indexedPixels,\n palette: paletteArray\n };\n },\n 'run': function run(frame) {\n frame = frame || {};\n\n var _frame = frame,\n height = _frame.height,\n palette = _frame.palette,\n sampleInterval = _frame.sampleInterval,\n width = _frame.width;\n\n var imageData = frame.data;\n\n return this.processFrameWithQuantizer(imageData, width, height, sampleInterval);\n }\n };\n\n return workerMethods;\n}\n\n/*\n gifWriter.js\n ============\n*/\n\n// (c) Dean McNamee <dean@gmail.com>, 2013.\n//\n// https://github.com/deanm/omggif\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n//\n// omggif is a JavaScript implementation of a GIF 89a encoder and decoder,\n// including animation and compression. It does not rely on any specific\n// underlying system, so should run in the browser, Node, or Plask.\n\nfunction gifWriter(buf, width, height, gopts) {\n var p = 0;\n\n gopts = gopts === undefined ? {} : gopts;\n var loop_count = gopts.loop === undefined ? null : gopts.loop;\n var global_palette = gopts.palette === undefined ? null : gopts.palette;\n\n if (width <= 0 || height <= 0 || width > 65535 || height > 65535) throw \"Width/Height invalid.\";\n\n function check_palette_and_num_colors(palette) {\n var num_colors = palette.length;\n\n if (num_colors < 2 || num_colors > 256 || num_colors & num_colors - 1) throw \"Invalid code/color length, must be power of 2 and 2 .. 256.\";\n return num_colors;\n }\n\n // - Header.\n buf[p++] = 0x47;\n buf[p++] = 0x49;\n buf[p++] = 0x46; // GIF\n buf[p++] = 0x38;\n buf[p++] = 0x39;\n buf[p++] = 0x61; // 89a\n\n // Handling of Global Color Table (palette) and background index.\n var gp_num_colors_pow2 = 0;\n var background = 0;\n\n // - Logical Screen Descriptor.\n // NOTE(deanm): w/h apparently ignored by implementations, but set anyway.\n buf[p++] = width & 0xff;\n buf[p++] = width >> 8 & 0xff;\n buf[p++] = height & 0xff;\n buf[p++] = height >> 8 & 0xff;\n // NOTE: Indicates 0-bpp original color resolution (unused?).\n buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag.\n gp_num_colors_pow2; // NOTE: No sort flag (unused?).\n buf[p++] = background; // Background Color Index.\n buf[p++] = 0; // Pixel aspect ratio (unused?).\n\n if (loop_count !== null) {\n // Netscape block for looping.\n if (loop_count < 0 || loop_count > 65535) throw \"Loop count invalid.\";\n\n // Extension code, label, and length.\n buf[p++] = 0x21;\n buf[p++] = 0xff;\n buf[p++] = 0x0b;\n // NETSCAPE2.0\n buf[p++] = 0x4e;\n buf[p++] = 0x45;\n buf[p++] = 0x54;\n buf[p++] = 0x53;\n buf[p++] = 0x43;\n buf[p++] = 0x41;\n buf[p++] = 0x50;\n buf[p++] = 0x45;\n buf[p++] = 0x32;\n buf[p++] = 0x2e;\n buf[p++] = 0x30;\n // Sub-block\n buf[p++] = 0x03;\n buf[p++] = 0x01;\n buf[p++] = loop_count & 0xff;\n buf[p++] = loop_count >> 8 & 0xff;\n buf[p++] = 0x00; // Terminator.\n }\n\n var ended = false;\n\n this.addFrame = function (x, y, w, h, indexed_pixels, opts) {\n if (ended === true) {\n --p;\n ended = false;\n } // Un-end.\n\n opts = opts === undefined ? {} : opts;\n\n // TODO(deanm): Bounds check x, y. Do they need to be within the virtual\n // canvas width/height, I imagine?\n if (x < 0 || y < 0 || x > 65535 || y > 65535) throw \"x/y invalid.\";\n\n if (w <= 0 || h <= 0 || w > 65535 || h > 65535) throw \"Width/Height invalid.\";\n\n if (indexed_pixels.length < w * h) throw \"Not enough pixels for the frame size.\";\n\n var using_local_palette = true;\n var palette = opts.palette;\n if (palette === undefined || palette === null) {\n using_local_palette = false;\n palette = global_palette;\n }\n\n if (palette === undefined || palette === null) throw \"Must supply either a local or global palette.\";\n\n var num_colors = check_palette_and_num_colors(palette);\n\n // Compute the min_code_size (power of 2), destroying num_colors.\n var min_code_size = 0;\n while (num_colors >>= 1) {\n ++min_code_size;\n }num_colors = 1 << min_code_size; // Now we can easily get it back.\n\n var delay = opts.delay === undefined ? 0 : opts.delay;\n\n // From the spec:\n // 0 - No disposal specified. The decoder is\n // not required to take any action.\n // 1 - Do not dispose. The graphic is to be left\n // in place.\n // 2 - Restore to background color. The area used by the\n // graphic must be restored to the background color.\n // 3 - Restore to previous. The decoder is required to\n // restore the area overwritten by the graphic with\n // what was there prior to rendering the graphic.\n // 4-7 - To be defined.\n // NOTE(deanm): Dispose background doesn't really work, apparently most\n // browsers ignore the background palette index and clear to transparency.\n var disposal = opts.disposal === undefined ? 0 : opts.disposal;\n if (disposal < 0 || disposal > 3) // 4-7 is reserved.\n throw \"Disposal out of range.\";\n\n var use_transparency = false;\n var transparent_index = 0;\n if (opts.transparent !== undefined && opts.transparent !== null) {\n use_transparency = true;\n transparent_index = opts.transparent;\n if (transparent_index < 0 || transparent_index >= num_colors) throw \"Transparent color index.\";\n }\n\n if (disposal !== 0 || use_transparency || delay !== 0) {\n // - Graphics Control Extension\n buf[p++] = 0x21;\n buf[p++] = 0xf9; // Extension / Label.\n buf[p++] = 4; // Byte size.\n\n buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0);\n buf[p++] = delay & 0xff;\n buf[p++] = delay >> 8 & 0xff;\n buf[p++] = transparent_index; // Transparent color index.\n buf[p++] = 0; // Block Terminator.\n }\n\n // - Image Descriptor\n buf[p++] = 0x2c; // Image Seperator.\n buf[p++] = x & 0xff;\n buf[p++] = x >> 8 & 0xff; // Left.\n buf[p++] = y & 0xff;\n buf[p++] = y >> 8 & 0xff; // Top.\n buf[p++] = w & 0xff;\n buf[p++] = w >> 8 & 0xff;\n buf[p++] = h & 0xff;\n buf[p++] = h >> 8 & 0xff;\n // NOTE: No sort flag (unused?).\n // TODO(deanm): Support interlace.\n buf[p++] = using_local_palette === true ? 0x80 | min_code_size - 1 : 0;\n\n // - Local Color Table\n if (using_local_palette === true) {\n for (var i = 0, il = palette.length; i < il; ++i) {\n var rgb = palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n p = GifWriterOutputLZWCodeStream(buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels);\n };\n\n this.end = function () {\n if (ended === false) {\n buf[p++] = 0x3b; // Trailer.\n ended = true;\n }\n return p;\n };\n\n // Main compression routine, palette indexes -> LZW code stream.\n // |index_stream| must have at least one entry.\n function GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) {\n buf[p++] = min_code_size;\n var cur_subblock = p++; // Pointing at the length field.\n\n var clear_code = 1 << min_code_size;\n var code_mask = clear_code - 1;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n var cur_shift = 0;\n // We have at most 12-bit codes, so we should have to hold a max of 19\n // bits here (and then we would write out).\n var cur = 0;\n\n function emit_bytes_to_buffer(bit_block_size) {\n while (cur_shift >= bit_block_size) {\n buf[p++] = cur & 0xff;\n cur >>= 8;\n cur_shift -= 8;\n if (p === cur_subblock + 256) {\n // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n }\n\n function emit_code(c) {\n cur |= c << cur_shift;\n cur_shift += cur_code_size;\n emit_bytes_to_buffer(8);\n }\n\n // I am not an expert on the topic, and I don't want to write a thesis.\n // However, it is good to outline here the basic algorithm and the few data\n // structures and optimizations here that make this implementation fast.\n // The basic idea behind LZW is to build a table of previously seen runs\n // addressed by a short id (herein called output code). All data is\n // referenced by a code, which represents one or more values from the\n // original input stream. All input bytes can be referenced as the same\n // value as an output code. So if you didn't want any compression, you\n // could more or less just output the original bytes as codes (there are\n // some details to this, but it is the idea). In order to achieve\n // compression, values greater then the input range (codes can be up to\n // 12-bit while input only 8-bit) represent a sequence of previously seen\n // inputs. The decompressor is able to build the same mapping while\n // decoding, so there is always a shared common knowledge between the\n // encoding and decoder, which is also important for \"timing\" aspects like\n // how to handle variable bit width code encoding.\n //\n // One obvious but very important consequence of the table system is there\n // is always a unique id (at most 12-bits) to map the runs. 'A' might be\n // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship\n // can be used for an effecient lookup strategy for the code mapping. We\n // need to know if a run has been seen before, and be able to map that run\n // to the output code. Since we start with known unique ids (input bytes),\n // and then from those build more unique ids (table entries), we can\n // continue this chain (almost like a linked list) to always have small\n // integer values that represent the current byte chains in the encoder.\n // This means instead of tracking the input bytes (AAAABCD) to know our\n // current state, we can track the table entry for AAAABC (it is guaranteed\n // to exist by the nature of the algorithm) and the next character D.\n // Therefor the tuple of (table_entry, byte) is guaranteed to also be\n // unique. This allows us to create a simple lookup key for mapping input\n // sequences to codes (table indices) without having to store or search\n // any of the code sequences. So if 'AAAA' has a table entry of 12, the\n // tuple of ('AAAA', K) for any input byte K will be unique, and can be our\n // key. This leads to a integer value at most 20-bits, which can always\n // fit in an SMI value and be used as a fast sparse array / object key.\n\n // Output code for the current contents of the index buffer.\n var ib_code = index_stream[0] & code_mask; // Load first input index.\n var code_table = {}; // Key'd on our 20-bit \"tuple\".\n\n emit_code(clear_code); // Spec says first code should be a clear code.\n\n // First index already loaded, process the rest of the stream.\n for (var i = 1, il = index_stream.length; i < il; ++i) {\n var k = index_stream[i] & code_mask;\n var cur_key = ib_code << 8 | k; // (prev, k) unique tuple.\n var cur_code = code_table[cur_key]; // buffer + k.\n\n // Check if we have to create a new code table entry.\n if (cur_code === undefined) {\n // We don't have buffer + k.\n // Emit index buffer (without k).\n // This is an inline version of emit_code, because this is the core\n // writing routine of the compressor (and V8 cannot inline emit_code\n // because it is a closure here in a different context). Additionally\n // we can call emit_byte_to_buffer less often, because we can have\n // 30-bits (from our 31-bit signed SMI), and we know our codes will only\n // be 12-bits, so can safely have 18-bits there without overflow.\n // emit_code(ib_code);\n cur |= ib_code << cur_shift;\n cur_shift += cur_code_size;\n while (cur_shift >= 8) {\n buf[p++] = cur & 0xff;\n cur >>= 8;\n cur_shift -= 8;\n if (p === cur_subblock + 256) {\n // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n\n if (next_code === 4096) {\n // Table full, need a clear.\n emit_code(clear_code);\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_table = {};\n } else {\n // Table not full, insert a new entry.\n // Increase our variable bit code sizes if necessary. This is a bit\n // tricky as it is based on \"timing\" between the encoding and\n // decoder. From the encoders perspective this should happen after\n // we've already emitted the index buffer and are about to create the\n // first table entry that would overflow our current code bit size.\n if (next_code >= 1 << cur_code_size) ++cur_code_size;\n code_table[cur_key] = next_code++; // Insert into code table.\n }\n\n ib_code = k; // Index buffer to single input k.\n } else {\n ib_code = cur_code; // Index buffer to sequence in code table.\n }\n }\n\n emit_code(ib_code); // There will still be something in the index buffer.\n emit_code(eoi_code); // End Of Information.\n\n // Flush / finalize the sub-blocks stream to the buffer.\n emit_bytes_to_buffer(1);\n\n // Finish the sub-blocks, writing out any unfinished lengths and\n // terminating with a sub-block of length 0. If we have already started\n // but not yet used a sub-block it can just become the terminator.\n if (cur_subblock + 1 === p) {\n // Started but unused.\n buf[cur_subblock] = 0;\n } else {\n // Started and used, write length and additional terminator block.\n buf[cur_subblock] = p - cur_subblock - 1;\n buf[p++] = 0;\n }\n return p;\n }\n}\n\n/*\n animatedGIF.js\n ==============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\n// Helpers\nvar noop$2 = function noop() {};\n\nvar AnimatedGIF = function AnimatedGIF(options) {\n this.canvas = null;\n this.ctx = null;\n this.repeat = 0;\n this.frames = [];\n this.numRenderedFrames = 0;\n this.onRenderCompleteCallback = noop$2;\n this.onRenderProgressCallback = noop$2;\n this.workers = [];\n this.availableWorkers = [];\n this.generatingGIF = false;\n this.options = options;\n\n // Constructs and initializes the the web workers appropriately\n this.initializeWebWorkers(options);\n};\n\nAnimatedGIF.prototype = {\n 'workerMethods': workerCode(),\n 'initializeWebWorkers': function initializeWebWorkers(options) {\n var self = this;\n var processFrameWorkerCode = NeuQuant.toString() + '(' + workerCode.toString() + '());';\n var webWorkerObj = void 0;\n var objectUrl = void 0;\n var webWorker = void 0;\n var numWorkers = void 0;\n var x = -1;\n var workerError = '';\n\n numWorkers = options.numWorkers;\n\n while (++x < numWorkers) {\n webWorkerObj = utils.createWebWorker(processFrameWorkerCode);\n\n if (utils.isObject(webWorkerObj)) {\n objectUrl = webWorkerObj.objectUrl;\n webWorker = webWorkerObj.worker;\n\n self.workers.push({\n worker: webWorker,\n objectUrl: objectUrl\n });\n\n self.availableWorkers.push(webWorker);\n } else {\n workerError = webWorkerObj;\n utils.webWorkerError = !!webWorkerObj;\n }\n }\n\n this.workerError = workerError;\n this.canvas = document.createElement('canvas');\n this.canvas.width = options.gifWidth;\n this.canvas.height = options.gifHeight;\n this.ctx = this.canvas.getContext('2d');\n this.frames = [];\n },\n // Return a worker for processing a frame\n getWorker: function getWorker() {\n return this.availableWorkers.pop();\n },\n // Restores a worker to the pool\n freeWorker: function freeWorker(worker) {\n this.availableWorkers.push(worker);\n },\n byteMap: function () {\n var byteMap = [];\n\n for (var i = 0; i < 256; i++) {\n byteMap[i] = String.fromCharCode(i);\n }\n\n return byteMap;\n }(),\n bufferToString: function bufferToString(buffer) {\n var numberValues = buffer.length;\n var str = '';\n var x = -1;\n\n while (++x < numberValues) {\n str += this.byteMap[buffer[x]];\n }\n\n return str;\n },\n onFrameFinished: function onFrameFinished(progressCallback) {\n // The GIF is not written until we're done with all the frames\n // because they might not be processed in the same order\n var self = this;\n var frames = self.frames;\n var options = self.options;\n var hasExistingImages = !!(options.images || []).length;\n var allDone = frames.every(function (frame) {\n return !frame.beingProcessed && frame.done;\n });\n\n self.numRenderedFrames++;\n\n if (hasExistingImages) {\n progressCallback(self.numRenderedFrames / frames.length);\n }\n\n self.onRenderProgressCallback(self.numRenderedFrames * 0.75 / frames.length);\n\n if (allDone) {\n if (!self.generatingGIF) {\n self.generateGIF(frames, self.onRenderCompleteCallback);\n }\n } else {\n utils.requestTimeout(function () {\n self.processNextFrame();\n }, 1);\n }\n },\n processFrame: function processFrame(position) {\n var AnimatedGifContext = this;\n var options = this.options;\n var _options = this.options,\n progressCallback = _options.progressCallback,\n sampleInterval = _options.sampleInterval;\n\n var frames = this.frames;\n var frame = void 0;\n var worker = void 0;\n var done = function done() {\n var ev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var data = ev.data;\n\n // Delete original data, and free memory\n delete frame.data;\n\n frame.pixels = Array.prototype.slice.call(data.pixels);\n frame.palette = Array.prototype.slice.call(data.palette);\n frame.done = true;\n frame.beingProcessed = false;\n\n AnimatedGifContext.freeWorker(worker);\n\n AnimatedGifContext.onFrameFinished(progressCallback);\n };\n\n frame = frames[position];\n\n if (frame.beingProcessed || frame.done) {\n this.onFrameFinished();\n\n return;\n }\n\n frame.sampleInterval = sampleInterval;\n frame.beingProcessed = true;\n frame.gifshot = true;\n\n worker = this.getWorker();\n\n if (worker) {\n // Process the frame in a web worker\n worker.onmessage = done;\n worker.postMessage(frame);\n } else {\n // Process the frame in the current thread\n done({\n 'data': AnimatedGifContext.workerMethods.run(frame)\n });\n }\n },\n startRendering: function startRendering(completeCallback) {\n this.onRenderCompleteCallback = completeCallback;\n\n for (var i = 0; i < this.options.numWorkers && i < this.frames.length; i++) {\n this.processFrame(i);\n }\n },\n processNextFrame: function processNextFrame() {\n var position = -1;\n\n for (var i = 0; i < this.frames.length; i++) {\n var frame = this.frames[i];\n\n if (!frame.done && !frame.beingProcessed) {\n position = i;\n break;\n }\n }\n\n if (position >= 0) {\n this.processFrame(position);\n }\n },\n // Takes the already processed data in frames and feeds it to a new\n // GifWriter instance in order to get the binary GIF file\n generateGIF: function generateGIF(frames, callback) {\n // TODO: Weird: using a simple JS array instead of a typed array,\n // the files are WAY smaller o_o. Patches/explanations welcome!\n var buffer = []; // new Uint8Array(width * height * frames.length * 5);\n var gifOptions = {\n loop: this.repeat\n };\n var options = this.options;\n var interval = options.interval;\n\n var frameDuration = options.frameDuration;\n var existingImages = options.images;\n var hasExistingImages = !!existingImages.length;\n var height = options.gifHeight;\n var width = options.gifWidth;\n var gifWriter$$1 = new gifWriter(buffer, width, height, gifOptions);\n var onRenderProgressCallback = this.onRenderProgressCallback;\n var delay = hasExistingImages ? interval * 100 : 0;\n var bufferToString = void 0;\n var gif = void 0;\n\n this.generatingGIF = true;\n\n utils.each(frames, function (iterator, frame) {\n var framePalette = frame.palette;\n\n onRenderProgressCallback(0.75 + 0.25 * frame.position * 1.0 / frames.length);\n\n for (var i = 0; i < frameDuration; i++) {\n gifWriter$$1.addFrame(0, 0, width, height, frame.pixels, {\n palette: framePalette,\n delay: delay\n });\n }\n });\n\n gifWriter$$1.end();\n\n onRenderProgressCallback(1.0);\n\n this.frames = [];\n\n this.generatingGIF = false;\n\n if (utils.isFunction(callback)) {\n bufferToString = this.bufferToString(buffer);\n gif = 'data:image/gif;base64,' + utils.btoa(bufferToString);\n\n callback(gif);\n }\n },\n // From GIF: 0 = loop forever, null = not looping, n > 0 = loop n times and stop\n setRepeat: function setRepeat(r) {\n this.repeat = r;\n },\n addFrame: function addFrame(element, gifshotOptions) {\n gifshotOptions = utils.isObject(gifshotOptions) ? gifshotOptions : {};\n\n var self = this;\n var ctx = self.ctx;\n var options = self.options;\n var width = options.gifWidth;\n var height = options.gifHeight;\n var fontSize = utils.getFontSize(gifshotOptions);\n var _gifshotOptions = gifshotOptions,\n filter = _gifshotOptions.filter,\n fontColor = _gifshotOptions.fontColor,\n fontFamily = _gifshotOptions.fontFamily,\n fontWeight = _gifshotOptions.fontWeight,\n gifHeight = _gifshotOptions.gifHeight,\n gifWidth = _gifshotOptions.gifWidth,\n text = _gifshotOptions.text,\n textAlign = _gifshotOptions.textAlign,\n textBaseline = _gifshotOptions.textBaseline;\n\n var textXCoordinate = gifshotOptions.textXCoordinate ? gifshotOptions.textXCoordinate : textAlign === 'left' ? 1 : textAlign === 'right' ? width : width / 2;\n var textYCoordinate = gifshotOptions.textYCoordinate ? gifshotOptions.textYCoordinate : textBaseline === 'top' ? 1 : textBaseline === 'center' ? height / 2 : height;\n var font = fontWeight + ' ' + fontSize + ' ' + fontFamily;\n var imageData = void 0;\n\n try {\n ctx.filter = filter;\n\n ctx.drawImage(element, 0, 0, width, height);\n\n if (text) {\n ctx.font = font;\n ctx.fillStyle = fontColor;\n ctx.textAlign = textAlign;\n ctx.textBaseline = textBaseline;\n ctx.fillText(text, textXCoordinate, textYCoordinate);\n }\n\n imageData = ctx.getImageData(0, 0, width, height);\n\n self.addFrameImageData(imageData);\n } catch (e) {\n return '' + e;\n }\n },\n addFrameImageData: function addFrameImageData() {\n var imageData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var frames = this.frames;\n var imageDataArray = imageData.data;\n\n this.frames.push({\n 'data': imageDataArray,\n 'width': imageData.width,\n 'height': imageData.height,\n 'palette': null,\n 'dithering': null,\n 'done': false,\n 'beingProcessed': false,\n 'position': frames.length\n });\n },\n onRenderProgress: function onRenderProgress(callback) {\n this.onRenderProgressCallback = callback;\n },\n isRendering: function isRendering() {\n return this.generatingGIF;\n },\n getBase64GIF: function getBase64GIF(completeCallback) {\n var self = this;\n var onRenderComplete = function onRenderComplete(gif) {\n self.destroyWorkers();\n\n utils.requestTimeout(function () {\n completeCallback(gif);\n }, 0);\n };\n\n self.startRendering(onRenderComplete);\n },\n destroyWorkers: function destroyWorkers() {\n if (this.workerError) {\n return;\n }\n\n var workers = this.workers;\n\n // Explicitly ask web workers to die so they are explicitly GC'ed\n utils.each(workers, function (iterator, workerObj) {\n var worker = workerObj.worker;\n var objectUrl = workerObj.objectUrl;\n\n worker.terminate();\n utils.URL.revokeObjectURL(objectUrl);\n });\n }\n};\n\n/*\n getBase64GIF.js\n ===============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction getBase64GIF(animatedGifInstance, callback) {\n // This is asynchronous, rendered with WebWorkers\n animatedGifInstance.getBase64GIF(function (image) {\n callback({\n error: false,\n errorCode: '',\n errorMsg: '',\n image: image\n });\n });\n}\n\n/*\n existingImages.js\n =================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction existingImages() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var self = this;\n var callback = obj.callback,\n images = obj.images,\n options = obj.options;\n\n var imagesLength = obj.imagesLength;\n var skipObj = {\n 'getUserMedia': true,\n 'window.URL': true\n };\n var errorObj = error.validate(skipObj);\n var loadedImages = [];\n var loadedImagesLength = 0;\n var tempImage = void 0;\n var ag = void 0;\n\n if (errorObj.error) {\n return callback(errorObj);\n }\n\n // change workerPath to point to where Animated_GIF.worker.js is\n ag = new AnimatedGIF(options);\n\n utils.each(images, function (index, image) {\n var currentImage = image;\n\n // if (image.src) {\n // currentImage = currentImage.src;\n // }\n if (utils.isElement(currentImage)) {\n if (options.crossOrigin) {\n currentImage.crossOrigin = options.crossOrigin;\n }\n\n loadedImages[index] = currentImage;\n loadedImagesLength += 1;\n\n if (loadedImagesLength === imagesLength) {\n addLoadedImagesToGif();\n }\n } else if (utils.isString(currentImage)) {\n tempImage = new Image();\n\n if (options.crossOrigin) {\n tempImage.crossOrigin = options.crossOrigin;\n }\n\n (function (tempImage) {\n if (image.text) {\n tempImage.text = image.text;\n }\n\n tempImage.onerror = function (e) {\n var obj = void 0;\n\n --imagesLength; // skips over images that error out\n\n if (imagesLength === 0) {\n obj = {};\n obj.error = 'None of the requested images was capable of being retrieved';\n\n return callback(obj);\n }\n };\n\n tempImage.onload = function (e) {\n if (image.text) {\n loadedImages[index] = {\n img: tempImage,\n text: tempImage.text\n };\n } else {\n loadedImages[index] = tempImage;\n }\n\n loadedImagesLength += 1;\n\n if (loadedImagesLength === imagesLength) {\n addLoadedImagesToGif();\n }\n\n utils.removeElement(tempImage);\n };\n\n tempImage.src = currentImage;\n })(tempImage);\n\n utils.setCSSAttr(tempImage, {\n position: 'fixed',\n opacity: '0'\n });\n\n document.body.appendChild(tempImage);\n }\n });\n\n function addLoadedImagesToGif() {\n utils.each(loadedImages, function (index, loadedImage) {\n if (loadedImage) {\n if (loadedImage.text) {\n ag.addFrame(loadedImage.img, options, loadedImage.text);\n } else {\n ag.addFrame(loadedImage, options);\n }\n }\n });\n\n getBase64GIF(ag, callback);\n }\n}\n\n/*\n screenShot.js\n =============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\n// Helpers\nvar noop$3 = function noop() {};\n\nvar screenShot = {\n getGIF: function getGIF() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = arguments[1];\n\n callback = utils.isFunction(callback) ? callback : noop$3;\n\n var canvas = document.createElement('canvas');\n var context = void 0;\n var existingImages = options.images;\n var hasExistingImages = !!existingImages.length;\n var cameraStream = options.cameraStream,\n crop = options.crop,\n filter = options.filter,\n fontColor = options.fontColor,\n fontFamily = options.fontFamily,\n fontWeight = options.fontWeight,\n keepCameraOn = options.keepCameraOn,\n numWorkers = options.numWorkers,\n progressCallback = options.progressCallback,\n saveRenderingContexts = options.saveRenderingContexts,\n savedRenderingContexts = options.savedRenderingContexts,\n text = options.text,\n textAlign = options.textAlign,\n textBaseline = options.textBaseline,\n videoElement = options.videoElement,\n videoHeight = options.videoHeight,\n videoWidth = options.videoWidth,\n webcamVideoElement = options.webcamVideoElement;\n\n var gifWidth = Number(options.gifWidth);\n var gifHeight = Number(options.gifHeight);\n var interval = Number(options.interval);\n var sampleInterval = Number(options.sampleInterval);\n var waitBetweenFrames = hasExistingImages ? 0 : interval * 1000;\n var renderingContextsToSave = [];\n var numFrames = savedRenderingContexts.length ? savedRenderingContexts.length : options.numFrames;\n var pendingFrames = numFrames;\n var ag = new AnimatedGIF(options);\n var fontSize = utils.getFontSize(options);\n var textXCoordinate = options.textXCoordinate ? options.textXCoordinate : textAlign === 'left' ? 1 : textAlign === 'right' ? gifWidth : gifWidth / 2;\n var textYCoordinate = options.textYCoordinate ? options.textYCoordinate : textBaseline === 'top' ? 1 : textBaseline === 'center' ? gifHeight / 2 : gifHeight;\n var font = fontWeight + ' ' + fontSize + ' ' + fontFamily;\n var sourceX = crop ? Math.floor(crop.scaledWidth / 2) : 0;\n var sourceWidth = crop ? videoWidth - crop.scaledWidth : 0;\n var sourceY = crop ? Math.floor(crop.scaledHeight / 2) : 0;\n var sourceHeight = crop ? videoHeight - crop.scaledHeight : 0;\n var captureFrames = function captureSingleFrame() {\n var framesLeft = pendingFrames - 1;\n\n if (savedRenderingContexts.length) {\n context.putImageData(savedRenderingContexts[numFrames - pendingFrames], 0, 0);\n\n finishCapture();\n } else {\n drawVideo();\n }\n\n function drawVideo() {\n try {\n // Makes sure the canvas video heights/widths are in bounds\n if (sourceWidth > videoWidth) {\n sourceWidth = videoWidth;\n }\n\n if (sourceHeight > videoHeight) {\n sourceHeight = videoHeight;\n }\n\n if (sourceX < 0) {\n sourceX = 0;\n }\n\n if (sourceY < 0) {\n sourceY = 0;\n }\n\n context.filter = filter;\n\n context.drawImage(videoElement, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, gifWidth, gifHeight);\n\n finishCapture();\n } catch (e) {\n // There is a Firefox bug that sometimes throws NS_ERROR_NOT_AVAILABLE and\n // and IndexSizeError errors when drawing a video element to the canvas\n if (e.name === 'NS_ERROR_NOT_AVAILABLE') {\n // Wait 100ms before trying again\n utils.requestTimeout(drawVideo, 100);\n } else {\n throw e;\n }\n }\n }\n\n function finishCapture() {\n var imageData = void 0;\n\n if (saveRenderingContexts) {\n renderingContextsToSave.push(context.getImageData(0, 0, gifWidth, gifHeight));\n }\n\n // If there is text to display, make sure to display it on the canvas after the image is drawn\n if (text) {\n context.font = font;\n context.fillStyle = fontColor;\n context.textAlign = textAlign;\n context.textBaseline = textBaseline;\n context.fillText(text, textXCoordinate, textYCoordinate);\n }\n\n imageData = context.getImageData(0, 0, gifWidth, gifHeight);\n\n ag.addFrameImageData(imageData);\n\n pendingFrames = framesLeft;\n\n // Call back with an r value indicating how far along we are in capture\n progressCallback((numFrames - pendingFrames) / numFrames);\n\n if (framesLeft > 0) {\n // test\n utils.requestTimeout(captureSingleFrame, waitBetweenFrames);\n }\n\n if (!pendingFrames) {\n ag.getBase64GIF(function (image) {\n callback({\n 'error': false,\n 'errorCode': '',\n 'errorMsg': '',\n 'image': image,\n 'cameraStream': cameraStream,\n 'videoElement': videoElement,\n 'webcamVideoElement': webcamVideoElement,\n 'savedRenderingContexts': renderingContextsToSave,\n 'keepCameraOn': keepCameraOn\n });\n });\n }\n }\n };\n\n numFrames = numFrames !== undefined ? numFrames : 10;\n interval = interval !== undefined ? interval : 0.1; // In seconds\n\n canvas.width = gifWidth;\n canvas.height = gifHeight;\n context = canvas.getContext('2d');\n\n (function capture() {\n if (!savedRenderingContexts.length && videoElement.currentTime === 0) {\n utils.requestTimeout(capture, 100);\n\n return;\n }\n\n captureFrames();\n })();\n },\n getCropDimensions: function getCropDimensions() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var width = obj.videoWidth;\n var height = obj.videoHeight;\n var gifWidth = obj.gifWidth;\n var gifHeight = obj.gifHeight;\n var result = {\n width: 0,\n height: 0,\n scaledWidth: 0,\n scaledHeight: 0\n };\n\n if (width > height) {\n result.width = Math.round(width * (gifHeight / height)) - gifWidth;\n result.scaledWidth = Math.round(result.width * (height / gifHeight));\n } else {\n result.height = Math.round(height * (gifWidth / width)) - gifHeight;\n result.scaledHeight = Math.round(result.height * (width / gifWidth));\n }\n\n return result;\n }\n};\n\n/*\n videoStream.js\n ==============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nvar videoStream = {\n loadedData: false,\n defaultVideoDimensions: {\n width: 640,\n height: 480\n },\n findVideoSize: function findVideoSizeMethod(obj) {\n findVideoSizeMethod.attempts = findVideoSizeMethod.attempts || 0;\n\n var cameraStream = obj.cameraStream,\n completedCallback = obj.completedCallback,\n videoElement = obj.videoElement;\n\n\n if (!videoElement) {\n return;\n }\n\n if (videoElement.videoWidth > 0 && videoElement.videoHeight > 0) {\n videoElement.removeEventListener('loadeddata', videoStream.findVideoSize);\n\n completedCallback({\n videoElement: videoElement,\n cameraStream: cameraStream,\n videoWidth: videoElement.videoWidth,\n videoHeight: videoElement.videoHeight\n });\n } else {\n if (findVideoSizeMethod.attempts < 10) {\n findVideoSizeMethod.attempts += 1;\n\n utils.requestTimeout(function () {\n videoStream.findVideoSize(obj);\n }, 400);\n } else {\n completedCallback({\n videoElement: videoElement,\n cameraStream: cameraStream,\n videoWidth: videoStream.defaultVideoDimensions.width,\n videoHeight: videoStream.defaultVideoDimensions.height\n });\n }\n }\n },\n onStreamingTimeout: function onStreamingTimeout(callback) {\n if (utils.isFunction(callback)) {\n callback({\n error: true,\n errorCode: 'getUserMedia',\n errorMsg: 'There was an issue with the getUserMedia API - Timed out while trying to start streaming',\n image: null,\n cameraStream: {}\n });\n }\n },\n stream: function stream(obj) {\n var existingVideo = utils.isArray(obj.existingVideo) ? obj.existingVideo[0] : obj.existingVideo;\n var cameraStream = obj.cameraStream,\n completedCallback = obj.completedCallback,\n streamedCallback = obj.streamedCallback,\n videoElement = obj.videoElement;\n\n\n if (utils.isFunction(streamedCallback)) {\n streamedCallback();\n }\n\n if (existingVideo) {\n if (utils.isString(existingVideo)) {\n videoElement.src = existingVideo;\n videoElement.innerHTML = '<source src=\"' + existingVideo + '\" type=\"video/' + utils.getExtension(existingVideo) + '\" />';\n } else if (existingVideo instanceof Blob) {\n try {\n videoElement.src = utils.URL.createObjectURL(existingVideo);\n } catch (e) {}\n\n videoElement.innerHTML = '<source src=\"' + existingVideo + '\" type=\"' + existingVideo.type + '\" />';\n }\n } else if (videoElement.mozSrcObject) {\n videoElement.mozSrcObject = cameraStream;\n } else if (utils.URL) {\n try {\n videoElement.srcObject = cameraStream;\n videoElement.src = utils.URL.createObjectURL(cameraStream);\n } catch (e) {\n videoElement.srcObject = cameraStream;\n }\n }\n\n videoElement.play();\n\n utils.requestTimeout(function checkLoadedData() {\n checkLoadedData.count = checkLoadedData.count || 0;\n\n if (videoStream.loadedData === true) {\n videoStream.findVideoSize({\n videoElement: videoElement,\n cameraStream: cameraStream,\n completedCallback: completedCallback\n });\n\n videoStream.loadedData = false;\n } else {\n checkLoadedData.count += 1;\n\n if (checkLoadedData.count > 10) {\n videoStream.findVideoSize({\n videoElement: videoElement,\n cameraStream: cameraStream,\n completedCallback: completedCallback\n });\n } else {\n checkLoadedData();\n }\n }\n }, 0);\n },\n startStreaming: function startStreaming(obj) {\n var errorCallback = utils.isFunction(obj.error) ? obj.error : utils.noop;\n var streamedCallback = utils.isFunction(obj.streamed) ? obj.streamed : utils.noop;\n var completedCallback = utils.isFunction(obj.completed) ? obj.completed : utils.noop;\n var crossOrigin = obj.crossOrigin,\n existingVideo = obj.existingVideo,\n lastCameraStream = obj.lastCameraStream,\n options = obj.options,\n webcamVideoElement = obj.webcamVideoElement;\n\n var videoElement = utils.isElement(existingVideo) ? existingVideo : webcamVideoElement ? webcamVideoElement : document.createElement('video');\n var cameraStream = void 0;\n\n if (crossOrigin) {\n videoElement.crossOrigin = options.crossOrigin;\n }\n\n videoElement.autoplay = true;\n videoElement.loop = true;\n videoElement.muted = true;\n videoElement.addEventListener('loadeddata', function (event) {\n videoStream.loadedData = true;\n if (options.offset) {\n videoElement.currentTime = options.offset;\n }\n });\n\n if (existingVideo) {\n videoStream.stream({\n videoElement: videoElement,\n existingVideo: existingVideo,\n completedCallback: completedCallback\n });\n } else if (lastCameraStream) {\n videoStream.stream({\n videoElement: videoElement,\n cameraStream: lastCameraStream,\n streamedCallback: streamedCallback,\n completedCallback: completedCallback\n });\n } else {\n utils.getUserMedia({\n video: true\n }, function (stream) {\n videoStream.stream({\n videoElement: videoElement,\n cameraStream: stream,\n streamedCallback: streamedCallback,\n completedCallback: completedCallback\n });\n }, errorCallback);\n }\n },\n startVideoStreaming: function startVideoStreaming(callback) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var timeoutLength = options.timeout !== undefined ? options.timeout : 0;\n var originalCallback = options.callback;\n var webcamVideoElement = options.webcamVideoElement;\n var noGetUserMediaSupportTimeout = void 0;\n\n // Some browsers apparently have support for video streaming because of the\n // presence of the getUserMedia function, but then do not answer our\n // calls for streaming.\n // So we'll set up this timeout and if nothing happens after a while, we'll\n // conclude that there's no actual getUserMedia support.\n if (timeoutLength > 0) {\n noGetUserMediaSupportTimeout = utils.requestTimeout(function () {\n videoStream.onStreamingTimeout(originalCallback);\n }, 10000);\n }\n\n videoStream.startStreaming({\n error: function error() {\n originalCallback({\n error: true,\n errorCode: 'getUserMedia',\n errorMsg: 'There was an issue with the getUserMedia API - the user probably denied permission',\n image: null,\n cameraStream: {}\n });\n },\n streamed: function streamed() {\n // The streaming started somehow, so we can assume there is getUserMedia support\n clearTimeout(noGetUserMediaSupportTimeout);\n },\n completed: function completed() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var cameraStream = obj.cameraStream,\n videoElement = obj.videoElement,\n videoHeight = obj.videoHeight,\n videoWidth = obj.videoWidth;\n\n\n callback({\n cameraStream: cameraStream,\n videoElement: videoElement,\n videoHeight: videoHeight,\n videoWidth: videoWidth\n });\n },\n lastCameraStream: options.lastCameraStream,\n webcamVideoElement: webcamVideoElement,\n crossOrigin: options.crossOrigin,\n options: options\n });\n },\n stopVideoStreaming: function stopVideoStreaming(obj) {\n obj = utils.isObject(obj) ? obj : {};\n\n var _obj = obj,\n keepCameraOn = _obj.keepCameraOn,\n videoElement = _obj.videoElement,\n webcamVideoElement = _obj.webcamVideoElement;\n\n var cameraStream = obj.cameraStream || {};\n var cameraStreamTracks = cameraStream.getTracks ? cameraStream.getTracks() || [] : [];\n var hasCameraStreamTracks = !!cameraStreamTracks.length;\n var firstCameraStreamTrack = cameraStreamTracks[0];\n\n if (!keepCameraOn && hasCameraStreamTracks) {\n if (utils.isFunction(firstCameraStreamTrack.stop)) {\n // Stops the camera stream\n firstCameraStreamTrack.stop();\n }\n }\n\n if (utils.isElement(videoElement) && !webcamVideoElement) {\n // Pauses the video, revokes the object URL (freeing up memory), and remove the video element\n videoElement.pause();\n\n // Destroys the object url\n if (utils.isFunction(utils.URL.revokeObjectURL) && !utils.webWorkerError) {\n if (videoElement.src) {\n utils.URL.revokeObjectURL(videoElement.src);\n }\n }\n\n // Removes the video element from the DOM\n utils.removeElement(videoElement);\n }\n }\n};\n\n/*\n stopVideoStreaming.js\n =====================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction stopVideoStreaming(options) {\n options = utils.isObject(options) ? options : {};\n\n videoStream.stopVideoStreaming(options);\n}\n\n/*\n createAndGetGIF.js\n ==================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction createAndGetGIF(obj, callback) {\n var options = obj.options || {};\n\n var images = options.images,\n video = options.video;\n\n var gifWidth = Number(options.gifWidth);\n var gifHeight = Number(options.gifHeight);\n var numFrames = Number(options.numFrames);\n var cameraStream = obj.cameraStream,\n videoElement = obj.videoElement,\n videoWidth = obj.videoWidth,\n videoHeight = obj.videoHeight;\n\n var cropDimensions = screenShot.getCropDimensions({\n videoWidth: videoWidth,\n videoHeight: videoHeight,\n gifHeight: gifHeight,\n gifWidth: gifWidth\n });\n var completeCallback = callback;\n\n options.crop = cropDimensions;\n options.videoElement = videoElement;\n options.videoWidth = videoWidth;\n options.videoHeight = videoHeight;\n options.cameraStream = cameraStream;\n\n if (!utils.isElement(videoElement)) {\n return;\n }\n\n videoElement.width = gifWidth + cropDimensions.width;\n videoElement.height = gifHeight + cropDimensions.height;\n\n if (!options.webcamVideoElement) {\n utils.setCSSAttr(videoElement, {\n position: 'fixed',\n opacity: '0'\n });\n\n document.body.appendChild(videoElement);\n }\n\n // Firefox doesn't seem to obey autoplay if the element is not in the DOM when the content\n // is loaded, so we must manually trigger play after adding it, or the video will be frozen\n videoElement.play();\n\n screenShot.getGIF(options, function (obj) {\n if ((!images || !images.length) && (!video || !video.length)) {\n stopVideoStreaming(obj);\n }\n\n completeCallback(obj);\n });\n}\n\n/*\n existingVideo.js\n ================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction existingVideo() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = obj.callback,\n existingVideo = obj.existingVideo,\n options = obj.options;\n\n var skipObj = {\n getUserMedia: true,\n 'window.URL': true\n };\n var errorObj = error.validate(skipObj);\n var loadedImages = 0;\n var videoType = void 0;\n var videoSrc = void 0;\n var tempImage = void 0;\n var ag = void 0;\n\n if (errorObj.error) {\n return callback(errorObj);\n }\n\n if (utils.isElement(existingVideo) && existingVideo.src) {\n videoSrc = existingVideo.src;\n videoType = utils.getExtension(videoSrc);\n\n if (!utils.isSupported.videoCodecs[videoType]) {\n return callback(error.messages.videoCodecs);\n }\n } else if (utils.isArray(existingVideo)) {\n utils.each(existingVideo, function (iterator, videoSrc) {\n if (videoSrc instanceof Blob) {\n videoType = videoSrc.type.substr(videoSrc.type.lastIndexOf('/') + 1, videoSrc.length);\n } else {\n videoType = videoSrc.substr(videoSrc.lastIndexOf('.') + 1, videoSrc.length);\n }\n\n if (utils.isSupported.videoCodecs[videoType]) {\n existingVideo = videoSrc;\n\n return false;\n }\n });\n }\n\n videoStream.startStreaming({\n completed: function completed(obj) {\n obj.options = options || {};\n\n createAndGetGIF(obj, callback);\n },\n existingVideo: existingVideo,\n crossOrigin: options.crossOrigin,\n options: options\n });\n}\n\n/*\n existingWebcam.js\n =================\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction existingWebcam() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var callback = obj.callback,\n lastCameraStream = obj.lastCameraStream,\n options = obj.options,\n webcamVideoElement = obj.webcamVideoElement;\n\n\n if (!isWebCamGIFSupported()) {\n return callback(error.validate());\n }\n\n if (options.savedRenderingContexts.length) {\n screenShot.getGIF(options, function (obj) {\n callback(obj);\n });\n\n return;\n }\n\n videoStream.startVideoStreaming(function () {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n obj.options = options || {};\n\n createAndGetGIF(obj, callback);\n }, {\n lastCameraStream: lastCameraStream,\n callback: callback,\n webcamVideoElement: webcamVideoElement,\n crossOrigin: options.crossOrigin\n });\n}\n\n/*\n createGIF.js\n ============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nfunction createGIF(userOptions, callback) {\n callback = utils.isFunction(userOptions) ? userOptions : callback;\n userOptions = utils.isObject(userOptions) ? userOptions : {};\n\n if (!utils.isFunction(callback)) {\n return;\n }\n\n var options = utils.normalizeOptions(defaultOptions, userOptions) || {};\n var lastCameraStream = userOptions.cameraStream;\n var images = options.images;\n var imagesLength = images ? images.length : 0;\n var video = options.video;\n var webcamVideoElement = options.webcamVideoElement;\n\n options = utils.normalizeOptions(options, {\n 'gifWidth': Math.floor(options.gifWidth),\n 'gifHeight': Math.floor(options.gifHeight)\n });\n\n // If the user would like to create a GIF from an existing image(s)\n if (imagesLength) {\n existingImages({\n 'images': images,\n 'imagesLength': imagesLength,\n 'callback': callback,\n 'options': options\n });\n } else if (video) {\n // If the user would like to create a GIF from an existing HTML5 video\n existingVideo({\n 'existingVideo': video,\n callback: callback,\n options: options\n });\n } else {\n // If the user would like to create a GIF from a webcam stream\n existingWebcam({\n lastCameraStream: lastCameraStream,\n callback: callback,\n webcamVideoElement: webcamVideoElement,\n options: options\n });\n }\n}\n\n/*\n takeSnapShot.js\n ===============\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\nfunction takeSnapShot(userOptions, callback) {\n callback = utils.isFunction(userOptions) ? userOptions : callback;\n userOptions = utils.isObject(userOptions) ? userOptions : {};\n\n if (!utils.isFunction(callback)) {\n return;\n }\n\n var mergedOptions = utils.normalizeOptions(defaultOptions, userOptions);\n var options = utils.normalizeOptions(mergedOptions, {\n 'interval': .1,\n 'numFrames': 1,\n 'gifWidth': Math.floor(mergedOptions.gifWidth),\n 'gifHeight': Math.floor(mergedOptions.gifHeight)\n });\n\n createGIF(options, callback);\n}\n\n/*\n API.js\n ======\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n*/\n\n// Dependencies\nvar API = {\n 'utils': utils$2,\n 'error': error$2,\n 'defaultOptions': defaultOptions$2,\n 'createGIF': createGIF,\n 'takeSnapShot': takeSnapShot,\n 'stopVideoStreaming': stopVideoStreaming,\n 'isSupported': isSupported,\n 'isWebCamGIFSupported': isWebCamGIFSupported,\n 'isExistingVideoGIFSupported': isExistingVideoGIFSupported,\n 'isExistingImagesGIFSupported': isSupported$1,\n 'VERSION': '0.4.5'\n};\n\n/*\n index.js\n ========\n*/\n\n/* Copyright 2017 Yahoo Inc.\n * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.\n */\n\n// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, and plain browser loading\nif (typeof define === 'function' && define.amd) {\n define([], function () {\n return API;\n });\n} else if (typeof exports !== 'undefined') {\n module.exports = API;\n} else {\n window.gifshot = API;\n}\n}(typeof window !== \"undefined\" ? window : {}, typeof document !== \"undefined\" ? document : { createElement: function() {} }, typeof window !== \"undefined\" ? window.navigator : {}));\n","// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n","import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseVideo from './lib/parsers/parse-video';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst EXTENSIONS = ['mp4'];\nconst MIME_TYPES = ['video/mp4'];\n\n// Loads a platform-specific image type that can be used as input data to WebGL textures\n\nexport type VideoLoaderOptions = LoaderOptions & {\n video: {};\n};\n\nconst DEFAULT_LOADER_OPTIONS: VideoLoaderOptions = {\n video: {}\n};\n\nexport const VideoLoader = {\n name: 'Video',\n id: 'video',\n module: 'video',\n version: VERSION,\n extensions: EXTENSIONS,\n mimeTypes: MIME_TYPES,\n\n parse: parseVideo,\n\n // tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),\n options: DEFAULT_LOADER_OPTIONS\n};\n\nexport const _typecheckVideoLoader: LoaderWithParser = VideoLoader;\n","// Parse to platform defined video type (HTMLVideoElement in browser)\nexport default async function parseVideo(arrayBuffer: ArrayBuffer): Promise<HTMLVideoElement> {\n // TODO It is probably somewhat inefficent to convert a File/Blob to ArrayBuffer and back\n // and could perhaps cause problems for large videos.\n // TODO MIME type is also lost from the File or Response...\n const blob = new Blob([arrayBuffer]);\n const video = document.createElement('video');\n video.src = URL.createObjectURL(blob);\n return video;\n}\n","// A GIFBuilder based on the gifshot module\nimport {assert} from './lib/utils/assert';\nimport gifshot from './libs/gifshot'; // TODO - load dynamically to avoid bloating\n\n// These are gifshot module options\nconst GIF_BUILDER_OPTIONS = {\n source: 'images',\n width: 200, // Desired width of the image\n height: 200, // Desired height of the image\n\n crossOrigin: 'Anonymous', // Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.\n\n // CALLBACKS\n progressCallback: (captureProgress) => {}, // Callback that provides the current progress of the current image\n completeCallback: () => {}, // Callback function that is called when the current image is completed\n\n // QUALITY SETTINGS\n numWorkers: 2, // how many web workers to use to process the animated GIF frames. Default is 2.\n sampleInterval: 10, // pixels to skip when creating the palette. Default is 10. Less is better, but slower.\n interval: 0.1, // The amount of time (in seconds) to wait between each frame capture\n offset: null, // The amount of time (in seconds) to start capturing the GIF (only for HTML5 videos)\n numFrames: 10, // The number of frames to use to create the animated GIF. Note: Each frame is captured every 100 milliseconds of a video and every ms for existing images\n frameDuration: 1, // The amount of time (10 = 1s) to stay on each frame\n\n // CSS FILTER OPTIONS\n filter: '', // CSS filter that will be applied to the image (eg. blur(5px))\n\n // WATERMARK OPTIONS\n waterMark: null, // If an image is given here, it will be stamped on top of the GIF frames\n waterMarkHeight: null, // Height of the waterMark\n waterMarkWidth: null, // Height of the waterMark\n waterMarkXCoordinate: 1, // The X (horizontal) Coordinate of the watermark image\n waterMarkYCoordinate: 1, // The Y (vertical) Coordinate of the watermark image\n\n // TEXT OPTIONS\n text: '', // The text that covers the animated GIF\n showFrameText: true, // If frame-specific text is supplied with the image array, you can force to not be displayed\n fontWeight: 'normal', // The font weight of the text that covers the animated GIF\n fontSize: '16px', // The font size of the text that covers the animated GIF\n minFontSize: '10px', // The minimum font size of the text that covers the animated GIF\n resizeFont: false, // Whether or not the animated GIF text will be resized to fit within the GIF container\n fontFamily: 'sans-serif', // The font family of the text that covers the animated GIF\n fontColor: '#ffffff', // The font color of the text that covers the animated GIF\n textAlign: 'center', // The horizontal text alignment of the text that covers the animated GIF\n textBaseline: 'bottom', // The vertical text alignment of the text that covers the animated GIF\n textXCoordinate: null, // The X (horizontal) Coordinate of the text that covers the animated GIF\n textYCoordinate: null, // The Y (vertical) Coordinate of the text that covers the animated GIF\n\n // ADVANCED OPTIONS\n\n // WEBCAM CAPTURE OPTIONS\n webcamVideoElement: null, // You can pass an existing video element to use for the webcam GIF creation process,\n keepCameraOn: false, // Whether or not you would like the user's camera to stay on after the GIF is created\n cameraStream: null, // Expects a cameraStream Media object\n\n // CANVAS OPTIMIZATION OPTIONS\n saveRenderingContexts: false, // Whether or not you would like to save all of the canvas image binary data\n savedRenderingContexts: [] // Array of canvas image data\n};\n\nexport default class GIFBuilder {\n static get properties() {\n return {\n id: 'gif',\n name: 'GIF',\n extensions: ['gif'],\n mimeTypes: ['image/gif'],\n builder: GIFBuilder,\n options: GIF_BUILDER_OPTIONS\n };\n }\n\n constructor(options) {\n this.options = {...options};\n this.source = options.source;\n delete options.source;\n\n // Allow files to be added\n this.files = [];\n\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n this.gifshot = gifshot;\n }\n\n async initialize(options) {\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n // this.gifshot = await loadGifshotModule(options);\n }\n\n async add(file) {\n await this.initialize();\n this.files.push(file);\n }\n\n async build() {\n await this.initialize();\n this._cleanOptions(this.options);\n\n switch (this.source) {\n case 'images':\n this.options.images = this.files;\n break;\n case 'video':\n this.options.video = this.files;\n break;\n case 'webcam':\n assert(this.files.length === 0);\n break;\n default:\n throw new Error('GIFBuilder: invalid source');\n }\n\n return await this._createGIF();\n }\n\n // PRIVATE\n\n async _createGIF() {\n return new Promise((resolve, reject) => {\n this.gifshot.createGIF(this.options, (result) => {\n // callback object properties\n // --------------------------\n // image - Base 64 image\n // cameraStream - The webRTC MediaStream object\n // error - Boolean that determines if an error occurred\n // errorCode - Helpful error label\n // errorMsg - Helpful error message\n // savedRenderingContexts - An array of canvas image data (will only be set if the saveRenderingContexts option was used)\n\n if (result.error) {\n reject(result.errorMsg);\n return;\n }\n\n // image - Base 64 image\n resolve(result.image);\n\n // var image = obj.image,\n // animatedImage = document.createElement('img');\n // animatedImage.src = image;\n // document.body.appendChild(animatedImage);\n });\n });\n }\n\n // Remove some gifshot options\n _cleanOptions(options) {\n if (options.video || options.images || options.gifWidth || options.gifHeight) {\n console.warn('GIFBuilder: ignoring options'); // eslint-disable-line\n }\n\n // We control these through options.source instead\n delete options.video;\n delete options.images;\n\n // Use width/height props (to standardize across builders)\n options.gifWidth = options.width;\n options.gifHeight = options.height;\n delete options.width;\n delete options.height;\n }\n}\n","export function assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\n"],"sourceRoot":""}
|