@loaders.gl/video 3.0.13 → 3.0.14
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/dist.es5.min.js +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/gif-builder.js +186 -75
- package/dist/es5/gif-builder.js.map +1 -1
- package/dist/es5/index.js +2 -2
- package/dist/es5/lib/gifshot/gifshot-loader.js +71 -12
- package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -1
- package/dist/es5/lib/parsers/parse-video.js +30 -5
- package/dist/es5/lib/parsers/parse-video.js.map +1 -1
- package/dist/es5/lib/utils/globals.js +14 -9
- package/dist/es5/lib/utils/globals.js.map +1 -1
- package/dist/es5/video-loader.js +6 -6
- package/dist/es5/video-loader.js.map +1 -1
- package/dist/esm/video-loader.js +1 -1
- package/package.json +4 -4
package/dist/dist.es5.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";(function(t){var i=r(2),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,i)}).call(this,r(1))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"VideoLoader",{enumerable:!0,get:function(){return n.VideoLoader}}),Object.defineProperty(t,"GIFBuilder",{enumerable:!0,get:function(){return o.default}});var i,n=r(3),o=(i=r(5))&&i.__esModule?i:{default:i}},function(e,t,r){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t._typecheckVideoLoader=t.VideoLoader=void 0;var n={name:"Video",id:"video",module:"video",version:"3.0.13",extensions:["mp4"],mimeTypes:["video/mp4"],parse:((i=r(4))&&i.__esModule?i:{default:i}).default,options:{video:{}}};t.VideoLoader=n;var o=n;t._typecheckVideoLoader=o},function(e,t,r){"use strict";function i(e,t,r,i,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,c,"next",e)}function c(e){i(a,n,o,s,c,"throw",e)}s(void 0)}))}}function o(){return(o=n(regeneratorRuntime.mark((function e(t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Blob([t]),(i=document.createElement("video")).src=URL.createObjectURL(r),e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return o.apply(this,arguments)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,n=r(6),o=(i=r(7))&&i.__esModule?i:{default:i};function a(e,t,r,i,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(i,n)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var o=e.apply(t,r);function s(e){a(o,i,n,s,c,"next",e)}function c(e){a(o,i,n,s,c,"throw",e)}s(void 0)}))}}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var l={source:"images",width:200,height:200,crossOrigin:"Anonymous",progressCallback:function(e){},completeCallback:function(){},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:[]},f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t),this.source=t.source,delete t.source,this.files=[],this.gifshot=o.default}var t,r,i,a,f,m,h;return t=e,r=[{key:"initialize",value:(h=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)})},{key:"add",value:(m=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initialize();case 2:this.files.push(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"build",value:(f=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initialize();case 2:this._cleanOptions(this.options),e.t0=this.source,e.next="images"===e.t0?6:"video"===e.t0?8:"webcam"===e.t0?10:12;break;case 6:return this.options.images=this.files,e.abrupt("break",13);case 8:return this.options.video=this.files,e.abrupt("break",13);case 10:return(0,n.assert)(0===this.files.length),e.abrupt("break",13);case 12:throw new Error("GIFBuilder: invalid source");case 13:return e.next=15,this._createGIF();case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"_createGIF",value:(a=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.gifshot.createGIF(t.options,(function(t){t.error?r(t.errorMsg):e(t.image)}))})));case 1:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"_cleanOptions",value:function(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}}],i=[{key:"properties",get:function(){return{id:"gif",name:"GIF",extensions:["gif"],mimeTypes:["image/gif"],builder:e,options:l}}}],r&&u(t.prototype,r),i&&u(t,i),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error(t)}},function(e,t,r){"use strict";var i;!function(r,n,o,a){var s,c,d={URL:r.URL||r.webkitURL||r.mozURL||r.msURL,getUserMedia:(c=o.getUserMedia||o.webkitGetUserMedia||o.mozGetUserMedia||o.msGetUserMedia,c?c.bind(o):c),requestAnimFrame:r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||r.oRequestAnimationFrame||r.msRequestAnimationFrame,requestTimeout:function(e,t){if(e=e||d.noop,t=t||0,!d.requestAnimFrame)return setTimeout(e,t);var r=(new Date).getTime(),i=new Object,n=d.requestAnimFrame;return i.value=n((function o(){(new Date).getTime()-r>=t?e.call():i.value=n(o)})),i},Blob:r.Blob||r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder,btoa:(s=r.btoa||function(e){for(var t="",r=0,i=e.length,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,c=void 0,d=void 0,u=void 0,l=void 0;r<i;)c=(o=e.charCodeAt(r++))>>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,u=(15&a)<<2|(s=e.charCodeAt(r++))>>6,l=63&s,isNaN(a)?u=l=64:isNaN(s)&&(l=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(u)+n.charAt(l);return t},s?s.bind(r):d.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return d.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=n.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return r.Worker},blob:function(){return d.Blob},Uint8Array:function(){return r.Uint8Array},Uint32Array:function(){return r.Uint32Array},videoCodecs:function(){var e=n.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 r=void 0,i=void 0;if(d.isArray(e))for(r=-1,i=e.length;++r<i&&!1!==t(r,e[r]););else if(d.isObject(e))for(r in e)if(e.hasOwnProperty(r)&&!1===t(r,e[r]))break},normalizeOptions:function(e,t){if(d.isObject(e)&&d.isObject(t)&&Object.keys){var r={};return d.each(e,(function(t,i){r[t]=e[t]})),d.each(t,(function(i,n){var o=t[i];d.isObject(o)&&e[i]?r[i]=d.normalizeOptions(e[i],o):r[i]=o})),r}},setCSSAttr:function(e,t,r){d.isElement(e)&&(d.isString(t)&&d.isString(r)?e.style[t]=r:d.isObject(t)&&d.each(t,(function(t,r){e.style[t]=r})))},removeElement:function(e){d.isElement(e)&&e.parentNode&&e.parentNode.removeChild(e)},createWebWorker:function(e){if(!d.isString(e))return{};try{var t=new d.Blob([e],{type:"text/javascript"}),r=d.URL.createObjectURL(t);return{objectUrl:r,worker:new Worker(r)}}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(!n.body||!1===e.resizeFont)return e.fontSize;var t=e.text,r=e.gifWidth,i=parseInt(e.fontSize,10),o=parseInt(e.minFontSize,10),a=n.createElement("div"),s=n.createElement("span");for(a.setAttribute("width",r),a.appendChild(s),s.innerHTML=t,s.style.fontSize=i+"px",s.style.textIndent="-9999px",s.style.visibility="hidden",n.body.appendChild(s);s.offsetWidth>r&&i>=o;)s.style.fontSize=--i+"px";return n.body.removeChild(s),i+"px"},webWorkerError:!1},u=Object.freeze({default:d}),l={validate:function(e){e=d.isObject(e)?e:{};var t={};return d.each(l.validators,(function(r,i){var n=i.errorCode;if(!e[n]&&!i.condition)return(t=i).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==l.validate(e).error;return t},validators:[{condition:d.isFunction(d.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:d.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:d.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:d.isFunction(d.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:d.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:d.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:d.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:l}),m=function(){},h={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"},g=Object.freeze({default:h});function p(){return l.isValid()}function v(){var e,t,r,i,n,o=256,a=499,s=491,c=487,d=503,u=3*d,l=o-1,f=4,m=100,h=16,g=1<<h,p=10,v=10,b=g>>v,y=g<<p-v,w=o>>3,x=6,k=1<<x,O=w*k,C=30,S=10,F=1<<S,E=8,W=1<<E,j=S+E,M=1<<j,R=[],A=[],U=[],T=[];function P(e,a,s){var c,d;for(t=e,r=a,i=s,n=new Array(o),c=0;c<o;c++)n[c]=new Array(4),(d=n[c])[0]=d[1]=d[2]=(c<<f+8)/o|0,U[c]=g/o|0,A[c]=0}function I(){for(var e=[],t=new Array(o),r=0;r<o;r++)t[n[r][3]]=r;for(var i=0,a=0;a<o;a++){var s=t[a];e[i++]=n[s][0],e[i++]=n[s][1],e[i++]=n[s][2]}return e}function V(){var e,t,r,i,a,s,c,d;for(c=0,d=0,e=0;e<o;e++){for(r=e,i=(a=n[e])[1],t=e+1;t<o;t++)(s=n[t])[1]<i&&(r=t,i=s[1]);if(s=n[r],e!=r&&(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),i!=c){for(R[c]=d+e>>1,t=c+1;t<i;t++)R[t]=e;c=i,d=e}}for(R[c]=d+l>>1,t=c+1;t<256;t++)R[t]=l}function z(){var n,o,l,h,g,p,v,b,y,w,k,S,E,j;for(r<u&&(i=1),e=30+(i-1)/3,S=t,E=0,j=r,w=(k=r/(3*i))/m|0,b=F,(v=(p=O)>>x)<=1&&(v=0),n=0;n<v;n++)T[n]=b*((v*v-n*n)*W/(v*v));for(y=r<u?3:r%a!=0?3*a:r%s!=0?3*s:r%c!=0?3*c:3*d,n=0;n<k;)if(G(b,o=D(l=(255&S[E+0])<<f,h=(255&S[E+1])<<f,g=(255&S[E+2])<<f),l,h,g),0!==v&&_(v,o,l,h,g),(E+=y)>=j&&(E-=r),0===w&&(w=1),++n%w==0)for(b-=b/e,(v=(p-=p/C)>>x)<=1&&(v=0),o=0;o<v;o++)T[o]=b*((v*v-o*o)*W/(v*v))}function L(e,t,r){var i,a,s,c,d,u,l;for(d=1e3,l=-1,a=(i=R[t])-1;i<o||a>=0;)i<o&&((s=(u=n[i])[1]-t)>=d?i=o:(i++,s<0&&(s=-s),(c=u[0]-e)<0&&(c=-c),(s+=c)<d&&((c=u[2]-r)<0&&(c=-c),(s+=c)<d&&(d=s,l=u[3])))),a>=0&&((s=t-(u=n[a])[1])>=d?a=-1:(a--,s<0&&(s=-s),(c=u[0]-e)<0&&(c=-c),(s+=c)<d&&((c=u[2]-r)<0&&(c=-c),(s+=c)<d&&(d=s,l=u[3]))));return l}function H(){return z(),B(),V(),I()}function B(){var e;for(e=0;e<o;e++)n[e][0]>>=f,n[e][1]>>=f,n[e][2]>>=f,n[e][3]=e}function _(e,t,r,i,a){var s,c,d,u,l,f,m;for((d=t-e)<-1&&(d=-1),(u=t+e)>o&&(u=o),s=t+1,c=t-1,f=1;s<u||c>d;){if(l=T[f++],s<u){m=n[s++];try{m[0]-=l*(m[0]-r)/M|0,m[1]-=l*(m[1]-i)/M|0,m[2]-=l*(m[2]-a)/M|0}catch(e){}}if(c>d){m=n[c--];try{m[0]-=l*(m[0]-r)/M|0,m[1]-=l*(m[1]-i)/M|0,m[2]-=l*(m[2]-a)/M|0}catch(e){}}}}function G(e,t,r,i,o){var a=n[t],s=e/F;a[0]-=s*(a[0]-r)|0,a[1]-=s*(a[1]-i)|0,a[2]-=s*(a[2]-o)|0}function D(e,t,r){var i,a,s,c,d,u,l,m,g,w;for(g=m=~(1<<31),l=u=-1,i=0;i<o;i++)(a=(w=n[i])[0]-e)<0&&(a=-a),(s=w[1]-t)<0&&(s=-s),a+=s,(s=w[2]-r)<0&&(s=-s),(a+=s)<m&&(m=a,u=i),(c=a-(A[i]>>h-f))<g&&(g=c,l=i),d=U[i]>>v,U[i]-=d,A[i]+=d<<p;return U[u]+=b,A[u]-=y,l}P.apply(this,arguments);var N={};return N.map=L,N.process=H,N}function b(){try{this.onmessage=function(t){var r,i=t.data||{};i.gifshot&&(r=e.run(i),postMessage(r))}}catch(e){}var e={dataToRGB:function(e,t,r){for(var i=t*r*4,n=0,o=[];n<i;)o.push(e[n++]),o.push(e[n++]),o.push(e[n++]),n++;return o},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],r=0;r<e.length;r+=3){var i=e[r],n=e[r+1],o=e[r+2];t.push(i<<16|n<<8|o)}return t},processFrameWithQuantizer:function(e,t,r,i){for(var n=this.dataToRGB(e,t,r),o=new v(n,n.length,i),a=o.process(),s=new Uint32Array(this.componentizedPaletteToArray(a)),c=t*r,d=new Uint8Array(c),u=0,l=0;l<c;l++){var f=n[u++],m=n[u++],h=n[u++];d[l]=o.map(f,m,h)}return{pixels:d,palette:s}},run:function(e){var t=e=e||{},r=t.height,i=(t.palette,t.sampleInterval),n=t.width,o=e.data;return this.processFrameWithQuantizer(o,n,r,i)}};return e}function y(e,t,r,i){var n=0,o=void 0===(i=void 0===i?{}:i).loop?null:i.loop,a=void 0===i.palette?null:i.palette;if(t<=0||r<=0||t>65535||r>65535)throw"Width/Height invalid.";e[n++]=71,e[n++]=73,e[n++]=70,e[n++]=56,e[n++]=57,e[n++]=97;if(e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=0|(null!==a?128:0),e[n++]=0,e[n++]=0,null!==o){if(o<0||o>65535)throw"Loop count invalid.";e[n++]=33,e[n++]=255,e[n++]=11,e[n++]=78,e[n++]=69,e[n++]=84,e[n++]=83,e[n++]=67,e[n++]=65,e[n++]=80,e[n++]=69,e[n++]=50,e[n++]=46,e[n++]=48,e[n++]=3,e[n++]=1,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=0}var s=!1;this.addFrame=function(t,r,i,o,c,d){if(!0===s&&(--n,s=!1),d=void 0===d?{}:d,t<0||r<0||t>65535||r>65535)throw"x/y invalid.";if(i<=0||o<=0||i>65535||o>65535)throw"Width/Height invalid.";if(c.length<i*o)throw"Not enough pixels for the frame size.";var u=!0,l=d.palette;if(null==l&&(u=!1,l=a),null==l)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}(l),m=0;f>>=1;)++m;f=1<<m;var h=void 0===d.delay?0:d.delay,g=void 0===d.disposal?0:d.disposal;if(g<0||g>3)throw"Disposal out of range.";var p=!1,v=0;if(void 0!==d.transparent&&null!==d.transparent&&(p=!0,(v=d.transparent)<0||v>=f))throw"Transparent color index.";if((0!==g||p||0!==h)&&(e[n++]=33,e[n++]=249,e[n++]=4,e[n++]=g<<2|(!0===p?1:0),e[n++]=255&h,e[n++]=h>>8&255,e[n++]=v,e[n++]=0),e[n++]=44,e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=!0===u?128|m-1:0,!0===u)for(var b=0,y=l.length;b<y;++b){var w=l[b];e[n++]=w>>16&255,e[n++]=w>>8&255,e[n++]=255&w}n=function(e,t,r,i){e[t++]=r;var n=t++,o=1<<r,a=o-1,s=o+1,c=s+1,d=r+1,u=0,l=0;function f(r){for(;u>=r;)e[t++]=255&l,l>>=8,u-=8,t===n+256&&(e[n]=255,n=t++)}function m(e){l|=e<<u,u+=d,f(8)}var h=i[0]&a,g={};m(o);for(var p=1,v=i.length;p<v;++p){var b=i[p]&a,y=h<<8|b,w=g[y];if(void 0===w){for(l|=h<<u,u+=d;u>=8;)e[t++]=255&l,l>>=8,u-=8,t===n+256&&(e[n]=255,n=t++);4096===c?(m(o),c=s+1,d=r+1,g={}):(c>=1<<d&&++d,g[y]=c++),h=b}else h=w}m(h),m(s),f(1),n+1===t?e[n]=0:(e[n]=t-n-1,e[t++]=0);return t}(e,n,m<2?2:m,c)},this.end=function(){return!1===s&&(e[n++]=59,s=!0),n}}var w=function(){},x=function(e){this.canvas=null,this.ctx=null,this.repeat=0,this.frames=[],this.numRenderedFrames=0,this.onRenderCompleteCallback=w,this.onRenderProgressCallback=w,this.workers=[],this.availableWorkers=[],this.generatingGIF=!1,this.options=e,this.initializeWebWorkers(e)};function k(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}x.prototype={workerMethods:b(),initializeWebWorkers:function(e){var t,r=v.toString()+"("+b.toString()+"());",i=void 0,o=void 0,a=void 0,s=-1,c="";for(t=e.numWorkers;++s<t;)i=d.createWebWorker(r),d.isObject(i)?(o=i.objectUrl,a=i.worker,this.workers.push({worker:a,objectUrl:o}),this.availableWorkers.push(a)):(c=i,d.webWorkerError=!!i);this.workerError=c,this.canvas=n.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,r="",i=-1;++i<t;)r+=this.byteMap[e[i]];return r},onFrameFinished:function(e){var t=this,r=t.frames,i=!!(t.options.images||[]).length,n=r.every((function(e){return!e.beingProcessed&&e.done}));t.numRenderedFrames++,i&&e(t.numRenderedFrames/r.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/r.length),n?t.generatingGIF||t.generateGIF(r,t.onRenderCompleteCallback):d.requestTimeout((function(){t.processNextFrame()}),1)},processFrame:function(e){var t=this,r=(this.options,this.options),i=r.progressCallback,n=r.sampleInterval,o=this.frames,a=void 0,s=void 0,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.data;delete a.data,a.pixels=Array.prototype.slice.call(r.pixels),a.palette=Array.prototype.slice.call(r.palette),a.done=!0,a.beingProcessed=!1,t.freeWorker(s),t.onFrameFinished(i)};(a=o[e]).beingProcessed||a.done?this.onFrameFinished():(a.sampleInterval=n,a.beingProcessed=!0,a.gifshot=!0,(s=this.getWorker())?(s.onmessage=c,s.postMessage(a)):c({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 r=this.frames[t];if(!r.done&&!r.beingProcessed){e=t;break}}e>=0&&this.processFrame(e)},generateGIF:function(e,t){var r=[],i={loop:this.repeat},n=this.options,o=n.interval,a=n.frameDuration,s=!!n.images.length,c=n.gifHeight,u=n.gifWidth,l=new y(r,u,c,i),f=this.onRenderProgressCallback,m=s?100*o:0,h=void 0;this.generatingGIF=!0,d.each(e,(function(t,r){var i=r.palette;f(.75+.25*r.position*1/e.length);for(var n=0;n<a;n++)l.addFrame(0,0,u,c,r.pixels,{palette:i,delay:m})})),l.end(),f(1),this.frames=[],this.generatingGIF=!1,d.isFunction(t)&&(h=this.bufferToString(r),t("data:image/gif;base64,"+d.btoa(h)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t){t=d.isObject(t)?t:{};var r=this.ctx,i=this.options,n=i.gifWidth,o=i.gifHeight,a=d.getFontSize(t),s=t,c=s.filter,u=s.fontColor,l=s.fontFamily,f=s.fontWeight,m=(s.gifHeight,s.gifWidth,s.text),h=s.textAlign,g=s.textBaseline,p=t.textXCoordinate?t.textXCoordinate:"left"===h?1:"right"===h?n:n/2,v=t.textYCoordinate?t.textYCoordinate:"top"===g?1:"center"===g?o/2:o,b=f+" "+a+" "+l,y=void 0;try{r.filter=c,r.drawImage(e,0,0,n,o),m&&(r.font=b,r.fillStyle=u,r.textAlign=h,r.textBaseline=g,r.fillText(m,p,v)),y=r.getImageData(0,0,n,o),this.addFrameImageData(y)}catch(e){return""+e}},addFrameImageData:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.frames,r=e.data;this.frames.push({data:r,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(r){t.destroyWorkers(),d.requestTimeout((function(){e(r)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;d.each(e,(function(e,t){var r=t.worker,i=t.objectUrl;r.terminate(),d.URL.revokeObjectURL(i)}))}}};var O=function(){},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];t=d.isFunction(t)?t:O;var r=n.createElement("canvas"),i=void 0,o=e.images,a=!!o.length,s=e.cameraStream,c=e.crop,u=e.filter,l=e.fontColor,f=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,g=(e.numWorkers,e.progressCallback),p=e.saveRenderingContexts,v=e.savedRenderingContexts,b=e.text,y=e.textAlign,w=e.textBaseline,k=e.videoElement,C=e.videoHeight,S=e.videoWidth,F=e.webcamVideoElement,E=Number(e.gifWidth),W=Number(e.gifHeight),j=Number(e.interval),M=(Number(e.sampleInterval),a?0:1e3*j),R=[],A=v.length?v.length:e.numFrames,U=A,T=new x(e),P=d.getFontSize(e),I=e.textXCoordinate?e.textXCoordinate:"left"===y?1:"right"===y?E:E/2,V=e.textYCoordinate?e.textYCoordinate:"top"===w?1:"center"===w?W/2:W,z=m+" "+P+" "+f,L=c?Math.floor(c.scaledWidth/2):0,H=c?S-c.scaledWidth:0,B=c?Math.floor(c.scaledHeight/2):0,_=c?C-c.scaledHeight:0,G=function e(){var r=U-1;function n(){var n;p&&R.push(i.getImageData(0,0,E,W)),b&&(i.font=z,i.fillStyle=l,i.textAlign=y,i.textBaseline=w,i.fillText(b,I,V)),n=i.getImageData(0,0,E,W),T.addFrameImageData(n),g((A-(U=r))/A),r>0&&d.requestTimeout(e,M),U||T.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:k,webcamVideoElement:F,savedRenderingContexts:R,keepCameraOn:h})}))}v.length?(i.putImageData(v[A-U],0,0),n()):function e(){try{H>S&&(H=S),_>C&&(_=C),L<0&&(L=0),B<0&&(B=0),i.filter=u,i.drawImage(k,L,B,H,_,0,0,E,W),n()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;d.requestTimeout(e,100)}}()};A=void 0!==A?A:10,j=void 0!==j?j:.1,r.width=E,r.height=W,i=r.getContext("2d"),function e(){v.length||0!==k.currentTime?G():d.requestTimeout(e,100)}()},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.videoWidth,r=e.videoHeight,i=e.gifWidth,n=e.gifHeight,o={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(o.width=Math.round(t*(n/r))-i,o.scaledWidth=Math.round(o.width*(r/n))):(o.height=Math.round(r*(i/t))-n,o.scaledHeight=Math.round(o.height*(t/i))),o},F={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var r=t.cameraStream,i=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",F.findVideoSize),i({videoElement:n,cameraStream:r,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,d.requestTimeout((function(){F.findVideoSize(t)}),400)):i({videoElement:n,cameraStream:r,videoWidth:F.defaultVideoDimensions.width,videoHeight:F.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){d.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=d.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,r=e.cameraStream,i=e.completedCallback,n=e.streamedCallback,o=e.videoElement;if(d.isFunction(n)&&n(),t){if(d.isString(t))o.src=t,o.innerHTML='<source src="'+t+'" type="video/'+d.getExtension(t)+'" />';else if(t instanceof Blob){try{o.src=d.URL.createObjectURL(t)}catch(e){}o.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(d.URL)try{o.srcObject=r,o.src=d.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),d.requestTimeout((function e(){e.count=e.count||0,!0===F.loadedData?(F.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),F.loadedData=!1):(e.count+=1)>10?F.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()}),0)},startStreaming:function(e){var t=d.isFunction(e.error)?e.error:d.noop,r=d.isFunction(e.streamed)?e.streamed:d.noop,i=d.isFunction(e.completed)?e.completed:d.noop,o=e.crossOrigin,a=e.existingVideo,s=e.lastCameraStream,c=e.options,u=e.webcamVideoElement,l=d.isElement(a)?a:u||n.createElement("video");o&&(l.crossOrigin=c.crossOrigin),l.autoplay=!0,l.loop=!0,l.muted=!0,l.addEventListener("loadeddata",(function(e){F.loadedData=!0,c.offset&&(l.currentTime=c.offset)})),a?F.stream({videoElement:l,existingVideo:a,completedCallback:i}):s?F.stream({videoElement:l,cameraStream:s,streamedCallback:r,completedCallback:i}):d.getUserMedia({video:!0},(function(e){F.stream({videoElement:l,cameraStream:e,streamedCallback:r,completedCallback:i})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.timeout?t.timeout:0,i=t.callback,n=t.webcamVideoElement,o=void 0;r>0&&(o=d.requestTimeout((function(){F.onStreamingTimeout(i)}),1e4)),F.startStreaming({error:function(){i({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(o)},completed:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.cameraStream,i=t.videoElement,n=t.videoHeight,o=t.videoWidth;e({cameraStream:r,videoElement:i,videoHeight:n,videoWidth:o})},lastCameraStream:t.lastCameraStream,webcamVideoElement:n,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=d.isObject(e)?e:{},r=t.keepCameraOn,i=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],s=!!a.length,c=a[0];!r&&s&&d.isFunction(c.stop)&&c.stop(),d.isElement(i)&&!n&&(i.pause(),d.isFunction(d.URL.revokeObjectURL)&&!d.webWorkerError&&i.src&&d.URL.revokeObjectURL(i.src),d.removeElement(i))}};function E(e){e=d.isObject(e)?e:{},F.stopVideoStreaming(e)}function W(e,t){var r=e.options||{},i=r.images,o=r.video,a=Number(r.gifWidth),s=Number(r.gifHeight),c=(Number(r.numFrames),e.cameraStream),u=e.videoElement,l=e.videoWidth,f=e.videoHeight,m=S({videoWidth:l,videoHeight:f,gifHeight:s,gifWidth:a}),h=t;r.crop=m,r.videoElement=u,r.videoWidth=l,r.videoHeight=f,r.cameraStream=c,d.isElement(u)&&(u.width=a+m.width,u.height=s+m.height,r.webcamVideoElement||(d.setCSSAttr(u,{position:"fixed",opacity:"0"}),n.body.appendChild(u)),u.play(),C(r,(function(e){i&&i.length||o&&o.length||E(e),h(e)})))}function j(e,t){if(t=d.isFunction(e)?e:t,e=d.isObject(e)?e:{},d.isFunction(t)){var r=d.normalizeOptions(h,e)||{},i=e.cameraStream,o=r.images,a=o?o.length:0,s=r.video,c=r.webcamVideoElement;r=d.normalizeOptions(r,{gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),a?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.images,i=e.options,o=e.imagesLength,a={getUserMedia:!0,"window.URL":!0},s=l.validate(a),c=[],u=0,f=void 0,m=void 0;if(s.error)return t(s);function h(){d.each(c,(function(e,t){t&&(t.text?m.addFrame(t.img,i,t.text):m.addFrame(t,i))})),k(m,t)}m=new x(i),d.each(r,(function(e,r){var a=r;d.isElement(a)?(i.crossOrigin&&(a.crossOrigin=i.crossOrigin),c[e]=a,(u+=1)===o&&h()):d.isString(a)&&(f=new Image,i.crossOrigin&&(f.crossOrigin=i.crossOrigin),function(i){r.text&&(i.text=r.text),i.onerror=function(e){var r=void 0;if(0===--o)return(r={}).error="None of the requested images was capable of being retrieved",t(r)},i.onload=function(t){r.text?c[e]={img:i,text:i.text}:c[e]=i,(u+=1)===o&&h(),d.removeElement(i)},i.src=a}(f),d.setCSSAttr(f,{position:"fixed",opacity:"0"}),n.body.appendChild(f))}))}({images:o,imagesLength:a,callback:t,options:r}):s?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.existingVideo,i=e.options,n={getUserMedia:!0,"window.URL":!0},o=l.validate(n),a=void 0,s=void 0;if(o.error)return t(o);if(d.isElement(r)&&r.src){if(s=r.src,a=d.getExtension(s),!d.isSupported.videoCodecs[a])return t(l.messages.videoCodecs)}else d.isArray(r)&&d.each(r,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),d.isSupported.videoCodecs[a])return r=t,!1}));F.startStreaming({completed:function(e){e.options=i||{},W(e,t)},existingVideo:r,crossOrigin:i.crossOrigin,options:i})}({existingVideo:s,callback:t,options:r}):function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.lastCameraStream,i=e.options,n=e.webcamVideoElement;if(!p())return t(l.validate());i.savedRenderingContexts.length?C(i,(function(e){t(e)})):F.startVideoStreaming((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.options=i||{},W(e,t)}),{lastCameraStream:r,callback:t,webcamVideoElement:n,crossOrigin:i.crossOrigin})}({lastCameraStream:i,callback:t,webcamVideoElement:c,options:r})}}var M={utils:u,error:f,defaultOptions:g,createGIF:j,takeSnapShot:function(e,t){if(t=d.isFunction(e)?e:t,e=d.isObject(e)?e:{},d.isFunction(t)){var r=d.normalizeOptions(h,e);j(d.normalizeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),t)}},stopVideoStreaming:E,isSupported:function(){return l.isValid()},isWebCamGIFSupported:p,isExistingVideoGIFSupported:function(e){var t=!1;if(d.isArray(e)&&e.length){if(d.each(e,(function(e,r){d.isSupported.videoCodecs[r]&&(t=!0)})),!t)return!1}else if(d.isString(e)&&e.length&&!d.isSupported.videoCodecs[e])return!1;return l.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return l.isValid({getUserMedia:!0})},VERSION:"0.4.5"};void 0===(i=function(){return M}.apply(t,[]))||(e.exports=i)}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})}]);
|
|
1
|
+
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";(function(t){var i=r(2),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,i)}).call(this,r(1))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"VideoLoader",{enumerable:!0,get:function(){return n.VideoLoader}}),Object.defineProperty(t,"GIFBuilder",{enumerable:!0,get:function(){return o.default}});var i,n=r(3),o=(i=r(5))&&i.__esModule?i:{default:i}},function(e,t,r){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t._typecheckVideoLoader=t.VideoLoader=void 0;var n={name:"Video",id:"video",module:"video",version:"3.0.14",extensions:["mp4"],mimeTypes:["video/mp4"],parse:((i=r(4))&&i.__esModule?i:{default:i}).default,options:{video:{}}};t.VideoLoader=n;var o=n;t._typecheckVideoLoader=o},function(e,t,r){"use strict";function i(e,t,r,i,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,c,"next",e)}function c(e){i(a,n,o,s,c,"throw",e)}s(void 0)}))}}function o(){return(o=n(regeneratorRuntime.mark((function e(t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Blob([t]),(i=document.createElement("video")).src=URL.createObjectURL(r),e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return o.apply(this,arguments)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,n=r(6),o=(i=r(7))&&i.__esModule?i:{default:i};function a(e,t,r,i,n,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(i,n)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var o=e.apply(t,r);function s(e){a(o,i,n,s,c,"next",e)}function c(e){a(o,i,n,s,c,"throw",e)}s(void 0)}))}}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var l={source:"images",width:200,height:200,crossOrigin:"Anonymous",progressCallback:function(e){},completeCallback:function(){},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:[]},f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t),this.source=t.source,delete t.source,this.files=[],this.gifshot=o.default}var t,r,i,a,f,m,h;return t=e,r=[{key:"initialize",value:(h=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)})},{key:"add",value:(m=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initialize();case 2:this.files.push(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"build",value:(f=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initialize();case 2:this._cleanOptions(this.options),e.t0=this.source,e.next="images"===e.t0?6:"video"===e.t0?8:"webcam"===e.t0?10:12;break;case 6:return this.options.images=this.files,e.abrupt("break",13);case 8:return this.options.video=this.files,e.abrupt("break",13);case 10:return(0,n.assert)(0===this.files.length),e.abrupt("break",13);case 12:throw new Error("GIFBuilder: invalid source");case 13:return e.next=15,this._createGIF();case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"_createGIF",value:(a=s(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.gifshot.createGIF(t.options,(function(t){t.error?r(t.errorMsg):e(t.image)}))})));case 1:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"_cleanOptions",value:function(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}}],i=[{key:"properties",get:function(){return{id:"gif",name:"GIF",extensions:["gif"],mimeTypes:["image/gif"],builder:e,options:l}}}],r&&u(t.prototype,r),i&&u(t,i),e}();t.default=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error(t)}},function(e,t,r){"use strict";var i;!function(r,n,o,a){var s,c,d={URL:r.URL||r.webkitURL||r.mozURL||r.msURL,getUserMedia:(c=o.getUserMedia||o.webkitGetUserMedia||o.mozGetUserMedia||o.msGetUserMedia,c?c.bind(o):c),requestAnimFrame:r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||r.oRequestAnimationFrame||r.msRequestAnimationFrame,requestTimeout:function(e,t){if(e=e||d.noop,t=t||0,!d.requestAnimFrame)return setTimeout(e,t);var r=(new Date).getTime(),i=new Object,n=d.requestAnimFrame;return i.value=n((function o(){(new Date).getTime()-r>=t?e.call():i.value=n(o)})),i},Blob:r.Blob||r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder,btoa:(s=r.btoa||function(e){for(var t="",r=0,i=e.length,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,c=void 0,d=void 0,u=void 0,l=void 0;r<i;)c=(o=e.charCodeAt(r++))>>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,u=(15&a)<<2|(s=e.charCodeAt(r++))>>6,l=63&s,isNaN(a)?u=l=64:isNaN(s)&&(l=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(u)+n.charAt(l);return t},s?s.bind(r):d.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return d.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=n.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return r.Worker},blob:function(){return d.Blob},Uint8Array:function(){return r.Uint8Array},Uint32Array:function(){return r.Uint32Array},videoCodecs:function(){var e=n.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 r=void 0,i=void 0;if(d.isArray(e))for(r=-1,i=e.length;++r<i&&!1!==t(r,e[r]););else if(d.isObject(e))for(r in e)if(e.hasOwnProperty(r)&&!1===t(r,e[r]))break},normalizeOptions:function(e,t){if(d.isObject(e)&&d.isObject(t)&&Object.keys){var r={};return d.each(e,(function(t,i){r[t]=e[t]})),d.each(t,(function(i,n){var o=t[i];d.isObject(o)&&e[i]?r[i]=d.normalizeOptions(e[i],o):r[i]=o})),r}},setCSSAttr:function(e,t,r){d.isElement(e)&&(d.isString(t)&&d.isString(r)?e.style[t]=r:d.isObject(t)&&d.each(t,(function(t,r){e.style[t]=r})))},removeElement:function(e){d.isElement(e)&&e.parentNode&&e.parentNode.removeChild(e)},createWebWorker:function(e){if(!d.isString(e))return{};try{var t=new d.Blob([e],{type:"text/javascript"}),r=d.URL.createObjectURL(t);return{objectUrl:r,worker:new Worker(r)}}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(!n.body||!1===e.resizeFont)return e.fontSize;var t=e.text,r=e.gifWidth,i=parseInt(e.fontSize,10),o=parseInt(e.minFontSize,10),a=n.createElement("div"),s=n.createElement("span");for(a.setAttribute("width",r),a.appendChild(s),s.innerHTML=t,s.style.fontSize=i+"px",s.style.textIndent="-9999px",s.style.visibility="hidden",n.body.appendChild(s);s.offsetWidth>r&&i>=o;)s.style.fontSize=--i+"px";return n.body.removeChild(s),i+"px"},webWorkerError:!1},u=Object.freeze({default:d}),l={validate:function(e){e=d.isObject(e)?e:{};var t={};return d.each(l.validators,(function(r,i){var n=i.errorCode;if(!e[n]&&!i.condition)return(t=i).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==l.validate(e).error;return t},validators:[{condition:d.isFunction(d.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:d.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:d.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:d.isFunction(d.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:d.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:d.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:d.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:l}),m=function(){},h={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"},g=Object.freeze({default:h});function p(){return l.isValid()}function v(){var e,t,r,i,n,o=256,a=499,s=491,c=487,d=503,u=3*d,l=o-1,f=4,m=100,h=16,g=1<<h,p=10,v=10,b=g>>v,y=g<<p-v,w=o>>3,x=6,k=1<<x,O=w*k,C=30,S=10,F=1<<S,E=8,W=1<<E,j=S+E,M=1<<j,R=[],A=[],U=[],T=[];function P(e,a,s){var c,d;for(t=e,r=a,i=s,n=new Array(o),c=0;c<o;c++)n[c]=new Array(4),(d=n[c])[0]=d[1]=d[2]=(c<<f+8)/o|0,U[c]=g/o|0,A[c]=0}function I(){for(var e=[],t=new Array(o),r=0;r<o;r++)t[n[r][3]]=r;for(var i=0,a=0;a<o;a++){var s=t[a];e[i++]=n[s][0],e[i++]=n[s][1],e[i++]=n[s][2]}return e}function V(){var e,t,r,i,a,s,c,d;for(c=0,d=0,e=0;e<o;e++){for(r=e,i=(a=n[e])[1],t=e+1;t<o;t++)(s=n[t])[1]<i&&(r=t,i=s[1]);if(s=n[r],e!=r&&(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),i!=c){for(R[c]=d+e>>1,t=c+1;t<i;t++)R[t]=e;c=i,d=e}}for(R[c]=d+l>>1,t=c+1;t<256;t++)R[t]=l}function z(){var n,o,l,h,g,p,v,b,y,w,k,S,E,j;for(r<u&&(i=1),e=30+(i-1)/3,S=t,E=0,j=r,w=(k=r/(3*i))/m|0,b=F,(v=(p=O)>>x)<=1&&(v=0),n=0;n<v;n++)T[n]=b*((v*v-n*n)*W/(v*v));for(y=r<u?3:r%a!=0?3*a:r%s!=0?3*s:r%c!=0?3*c:3*d,n=0;n<k;)if(G(b,o=D(l=(255&S[E+0])<<f,h=(255&S[E+1])<<f,g=(255&S[E+2])<<f),l,h,g),0!==v&&_(v,o,l,h,g),(E+=y)>=j&&(E-=r),0===w&&(w=1),++n%w==0)for(b-=b/e,(v=(p-=p/C)>>x)<=1&&(v=0),o=0;o<v;o++)T[o]=b*((v*v-o*o)*W/(v*v))}function L(e,t,r){var i,a,s,c,d,u,l;for(d=1e3,l=-1,a=(i=R[t])-1;i<o||a>=0;)i<o&&((s=(u=n[i])[1]-t)>=d?i=o:(i++,s<0&&(s=-s),(c=u[0]-e)<0&&(c=-c),(s+=c)<d&&((c=u[2]-r)<0&&(c=-c),(s+=c)<d&&(d=s,l=u[3])))),a>=0&&((s=t-(u=n[a])[1])>=d?a=-1:(a--,s<0&&(s=-s),(c=u[0]-e)<0&&(c=-c),(s+=c)<d&&((c=u[2]-r)<0&&(c=-c),(s+=c)<d&&(d=s,l=u[3]))));return l}function H(){return z(),B(),V(),I()}function B(){var e;for(e=0;e<o;e++)n[e][0]>>=f,n[e][1]>>=f,n[e][2]>>=f,n[e][3]=e}function _(e,t,r,i,a){var s,c,d,u,l,f,m;for((d=t-e)<-1&&(d=-1),(u=t+e)>o&&(u=o),s=t+1,c=t-1,f=1;s<u||c>d;){if(l=T[f++],s<u){m=n[s++];try{m[0]-=l*(m[0]-r)/M|0,m[1]-=l*(m[1]-i)/M|0,m[2]-=l*(m[2]-a)/M|0}catch(e){}}if(c>d){m=n[c--];try{m[0]-=l*(m[0]-r)/M|0,m[1]-=l*(m[1]-i)/M|0,m[2]-=l*(m[2]-a)/M|0}catch(e){}}}}function G(e,t,r,i,o){var a=n[t],s=e/F;a[0]-=s*(a[0]-r)|0,a[1]-=s*(a[1]-i)|0,a[2]-=s*(a[2]-o)|0}function D(e,t,r){var i,a,s,c,d,u,l,m,g,w;for(g=m=~(1<<31),l=u=-1,i=0;i<o;i++)(a=(w=n[i])[0]-e)<0&&(a=-a),(s=w[1]-t)<0&&(s=-s),a+=s,(s=w[2]-r)<0&&(s=-s),(a+=s)<m&&(m=a,u=i),(c=a-(A[i]>>h-f))<g&&(g=c,l=i),d=U[i]>>v,U[i]-=d,A[i]+=d<<p;return U[u]+=b,A[u]-=y,l}P.apply(this,arguments);var N={};return N.map=L,N.process=H,N}function b(){try{this.onmessage=function(t){var r,i=t.data||{};i.gifshot&&(r=e.run(i),postMessage(r))}}catch(e){}var e={dataToRGB:function(e,t,r){for(var i=t*r*4,n=0,o=[];n<i;)o.push(e[n++]),o.push(e[n++]),o.push(e[n++]),n++;return o},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],r=0;r<e.length;r+=3){var i=e[r],n=e[r+1],o=e[r+2];t.push(i<<16|n<<8|o)}return t},processFrameWithQuantizer:function(e,t,r,i){for(var n=this.dataToRGB(e,t,r),o=new v(n,n.length,i),a=o.process(),s=new Uint32Array(this.componentizedPaletteToArray(a)),c=t*r,d=new Uint8Array(c),u=0,l=0;l<c;l++){var f=n[u++],m=n[u++],h=n[u++];d[l]=o.map(f,m,h)}return{pixels:d,palette:s}},run:function(e){var t=e=e||{},r=t.height,i=(t.palette,t.sampleInterval),n=t.width,o=e.data;return this.processFrameWithQuantizer(o,n,r,i)}};return e}function y(e,t,r,i){var n=0,o=void 0===(i=void 0===i?{}:i).loop?null:i.loop,a=void 0===i.palette?null:i.palette;if(t<=0||r<=0||t>65535||r>65535)throw"Width/Height invalid.";e[n++]=71,e[n++]=73,e[n++]=70,e[n++]=56,e[n++]=57,e[n++]=97;if(e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=0|(null!==a?128:0),e[n++]=0,e[n++]=0,null!==o){if(o<0||o>65535)throw"Loop count invalid.";e[n++]=33,e[n++]=255,e[n++]=11,e[n++]=78,e[n++]=69,e[n++]=84,e[n++]=83,e[n++]=67,e[n++]=65,e[n++]=80,e[n++]=69,e[n++]=50,e[n++]=46,e[n++]=48,e[n++]=3,e[n++]=1,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=0}var s=!1;this.addFrame=function(t,r,i,o,c,d){if(!0===s&&(--n,s=!1),d=void 0===d?{}:d,t<0||r<0||t>65535||r>65535)throw"x/y invalid.";if(i<=0||o<=0||i>65535||o>65535)throw"Width/Height invalid.";if(c.length<i*o)throw"Not enough pixels for the frame size.";var u=!0,l=d.palette;if(null==l&&(u=!1,l=a),null==l)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}(l),m=0;f>>=1;)++m;f=1<<m;var h=void 0===d.delay?0:d.delay,g=void 0===d.disposal?0:d.disposal;if(g<0||g>3)throw"Disposal out of range.";var p=!1,v=0;if(void 0!==d.transparent&&null!==d.transparent&&(p=!0,(v=d.transparent)<0||v>=f))throw"Transparent color index.";if((0!==g||p||0!==h)&&(e[n++]=33,e[n++]=249,e[n++]=4,e[n++]=g<<2|(!0===p?1:0),e[n++]=255&h,e[n++]=h>>8&255,e[n++]=v,e[n++]=0),e[n++]=44,e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=!0===u?128|m-1:0,!0===u)for(var b=0,y=l.length;b<y;++b){var w=l[b];e[n++]=w>>16&255,e[n++]=w>>8&255,e[n++]=255&w}n=function(e,t,r,i){e[t++]=r;var n=t++,o=1<<r,a=o-1,s=o+1,c=s+1,d=r+1,u=0,l=0;function f(r){for(;u>=r;)e[t++]=255&l,l>>=8,u-=8,t===n+256&&(e[n]=255,n=t++)}function m(e){l|=e<<u,u+=d,f(8)}var h=i[0]&a,g={};m(o);for(var p=1,v=i.length;p<v;++p){var b=i[p]&a,y=h<<8|b,w=g[y];if(void 0===w){for(l|=h<<u,u+=d;u>=8;)e[t++]=255&l,l>>=8,u-=8,t===n+256&&(e[n]=255,n=t++);4096===c?(m(o),c=s+1,d=r+1,g={}):(c>=1<<d&&++d,g[y]=c++),h=b}else h=w}m(h),m(s),f(1),n+1===t?e[n]=0:(e[n]=t-n-1,e[t++]=0);return t}(e,n,m<2?2:m,c)},this.end=function(){return!1===s&&(e[n++]=59,s=!0),n}}var w=function(){},x=function(e){this.canvas=null,this.ctx=null,this.repeat=0,this.frames=[],this.numRenderedFrames=0,this.onRenderCompleteCallback=w,this.onRenderProgressCallback=w,this.workers=[],this.availableWorkers=[],this.generatingGIF=!1,this.options=e,this.initializeWebWorkers(e)};function k(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}x.prototype={workerMethods:b(),initializeWebWorkers:function(e){var t,r=v.toString()+"("+b.toString()+"());",i=void 0,o=void 0,a=void 0,s=-1,c="";for(t=e.numWorkers;++s<t;)i=d.createWebWorker(r),d.isObject(i)?(o=i.objectUrl,a=i.worker,this.workers.push({worker:a,objectUrl:o}),this.availableWorkers.push(a)):(c=i,d.webWorkerError=!!i);this.workerError=c,this.canvas=n.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,r="",i=-1;++i<t;)r+=this.byteMap[e[i]];return r},onFrameFinished:function(e){var t=this,r=t.frames,i=!!(t.options.images||[]).length,n=r.every((function(e){return!e.beingProcessed&&e.done}));t.numRenderedFrames++,i&&e(t.numRenderedFrames/r.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/r.length),n?t.generatingGIF||t.generateGIF(r,t.onRenderCompleteCallback):d.requestTimeout((function(){t.processNextFrame()}),1)},processFrame:function(e){var t=this,r=(this.options,this.options),i=r.progressCallback,n=r.sampleInterval,o=this.frames,a=void 0,s=void 0,c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.data;delete a.data,a.pixels=Array.prototype.slice.call(r.pixels),a.palette=Array.prototype.slice.call(r.palette),a.done=!0,a.beingProcessed=!1,t.freeWorker(s),t.onFrameFinished(i)};(a=o[e]).beingProcessed||a.done?this.onFrameFinished():(a.sampleInterval=n,a.beingProcessed=!0,a.gifshot=!0,(s=this.getWorker())?(s.onmessage=c,s.postMessage(a)):c({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 r=this.frames[t];if(!r.done&&!r.beingProcessed){e=t;break}}e>=0&&this.processFrame(e)},generateGIF:function(e,t){var r=[],i={loop:this.repeat},n=this.options,o=n.interval,a=n.frameDuration,s=!!n.images.length,c=n.gifHeight,u=n.gifWidth,l=new y(r,u,c,i),f=this.onRenderProgressCallback,m=s?100*o:0,h=void 0;this.generatingGIF=!0,d.each(e,(function(t,r){var i=r.palette;f(.75+.25*r.position*1/e.length);for(var n=0;n<a;n++)l.addFrame(0,0,u,c,r.pixels,{palette:i,delay:m})})),l.end(),f(1),this.frames=[],this.generatingGIF=!1,d.isFunction(t)&&(h=this.bufferToString(r),t("data:image/gif;base64,"+d.btoa(h)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t){t=d.isObject(t)?t:{};var r=this.ctx,i=this.options,n=i.gifWidth,o=i.gifHeight,a=d.getFontSize(t),s=t,c=s.filter,u=s.fontColor,l=s.fontFamily,f=s.fontWeight,m=(s.gifHeight,s.gifWidth,s.text),h=s.textAlign,g=s.textBaseline,p=t.textXCoordinate?t.textXCoordinate:"left"===h?1:"right"===h?n:n/2,v=t.textYCoordinate?t.textYCoordinate:"top"===g?1:"center"===g?o/2:o,b=f+" "+a+" "+l,y=void 0;try{r.filter=c,r.drawImage(e,0,0,n,o),m&&(r.font=b,r.fillStyle=u,r.textAlign=h,r.textBaseline=g,r.fillText(m,p,v)),y=r.getImageData(0,0,n,o),this.addFrameImageData(y)}catch(e){return""+e}},addFrameImageData:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.frames,r=e.data;this.frames.push({data:r,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(r){t.destroyWorkers(),d.requestTimeout((function(){e(r)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;d.each(e,(function(e,t){var r=t.worker,i=t.objectUrl;r.terminate(),d.URL.revokeObjectURL(i)}))}}};var O=function(){},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];t=d.isFunction(t)?t:O;var r=n.createElement("canvas"),i=void 0,o=e.images,a=!!o.length,s=e.cameraStream,c=e.crop,u=e.filter,l=e.fontColor,f=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,g=(e.numWorkers,e.progressCallback),p=e.saveRenderingContexts,v=e.savedRenderingContexts,b=e.text,y=e.textAlign,w=e.textBaseline,k=e.videoElement,C=e.videoHeight,S=e.videoWidth,F=e.webcamVideoElement,E=Number(e.gifWidth),W=Number(e.gifHeight),j=Number(e.interval),M=(Number(e.sampleInterval),a?0:1e3*j),R=[],A=v.length?v.length:e.numFrames,U=A,T=new x(e),P=d.getFontSize(e),I=e.textXCoordinate?e.textXCoordinate:"left"===y?1:"right"===y?E:E/2,V=e.textYCoordinate?e.textYCoordinate:"top"===w?1:"center"===w?W/2:W,z=m+" "+P+" "+f,L=c?Math.floor(c.scaledWidth/2):0,H=c?S-c.scaledWidth:0,B=c?Math.floor(c.scaledHeight/2):0,_=c?C-c.scaledHeight:0,G=function e(){var r=U-1;function n(){var n;p&&R.push(i.getImageData(0,0,E,W)),b&&(i.font=z,i.fillStyle=l,i.textAlign=y,i.textBaseline=w,i.fillText(b,I,V)),n=i.getImageData(0,0,E,W),T.addFrameImageData(n),g((A-(U=r))/A),r>0&&d.requestTimeout(e,M),U||T.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:k,webcamVideoElement:F,savedRenderingContexts:R,keepCameraOn:h})}))}v.length?(i.putImageData(v[A-U],0,0),n()):function e(){try{H>S&&(H=S),_>C&&(_=C),L<0&&(L=0),B<0&&(B=0),i.filter=u,i.drawImage(k,L,B,H,_,0,0,E,W),n()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;d.requestTimeout(e,100)}}()};A=void 0!==A?A:10,j=void 0!==j?j:.1,r.width=E,r.height=W,i=r.getContext("2d"),function e(){v.length||0!==k.currentTime?G():d.requestTimeout(e,100)}()},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.videoWidth,r=e.videoHeight,i=e.gifWidth,n=e.gifHeight,o={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(o.width=Math.round(t*(n/r))-i,o.scaledWidth=Math.round(o.width*(r/n))):(o.height=Math.round(r*(i/t))-n,o.scaledHeight=Math.round(o.height*(t/i))),o},F={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var r=t.cameraStream,i=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",F.findVideoSize),i({videoElement:n,cameraStream:r,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,d.requestTimeout((function(){F.findVideoSize(t)}),400)):i({videoElement:n,cameraStream:r,videoWidth:F.defaultVideoDimensions.width,videoHeight:F.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){d.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=d.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,r=e.cameraStream,i=e.completedCallback,n=e.streamedCallback,o=e.videoElement;if(d.isFunction(n)&&n(),t){if(d.isString(t))o.src=t,o.innerHTML='<source src="'+t+'" type="video/'+d.getExtension(t)+'" />';else if(t instanceof Blob){try{o.src=d.URL.createObjectURL(t)}catch(e){}o.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(d.URL)try{o.srcObject=r,o.src=d.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),d.requestTimeout((function e(){e.count=e.count||0,!0===F.loadedData?(F.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),F.loadedData=!1):(e.count+=1)>10?F.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()}),0)},startStreaming:function(e){var t=d.isFunction(e.error)?e.error:d.noop,r=d.isFunction(e.streamed)?e.streamed:d.noop,i=d.isFunction(e.completed)?e.completed:d.noop,o=e.crossOrigin,a=e.existingVideo,s=e.lastCameraStream,c=e.options,u=e.webcamVideoElement,l=d.isElement(a)?a:u||n.createElement("video");o&&(l.crossOrigin=c.crossOrigin),l.autoplay=!0,l.loop=!0,l.muted=!0,l.addEventListener("loadeddata",(function(e){F.loadedData=!0,c.offset&&(l.currentTime=c.offset)})),a?F.stream({videoElement:l,existingVideo:a,completedCallback:i}):s?F.stream({videoElement:l,cameraStream:s,streamedCallback:r,completedCallback:i}):d.getUserMedia({video:!0},(function(e){F.stream({videoElement:l,cameraStream:e,streamedCallback:r,completedCallback:i})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.timeout?t.timeout:0,i=t.callback,n=t.webcamVideoElement,o=void 0;r>0&&(o=d.requestTimeout((function(){F.onStreamingTimeout(i)}),1e4)),F.startStreaming({error:function(){i({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(o)},completed:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.cameraStream,i=t.videoElement,n=t.videoHeight,o=t.videoWidth;e({cameraStream:r,videoElement:i,videoHeight:n,videoWidth:o})},lastCameraStream:t.lastCameraStream,webcamVideoElement:n,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=d.isObject(e)?e:{},r=t.keepCameraOn,i=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],s=!!a.length,c=a[0];!r&&s&&d.isFunction(c.stop)&&c.stop(),d.isElement(i)&&!n&&(i.pause(),d.isFunction(d.URL.revokeObjectURL)&&!d.webWorkerError&&i.src&&d.URL.revokeObjectURL(i.src),d.removeElement(i))}};function E(e){e=d.isObject(e)?e:{},F.stopVideoStreaming(e)}function W(e,t){var r=e.options||{},i=r.images,o=r.video,a=Number(r.gifWidth),s=Number(r.gifHeight),c=(Number(r.numFrames),e.cameraStream),u=e.videoElement,l=e.videoWidth,f=e.videoHeight,m=S({videoWidth:l,videoHeight:f,gifHeight:s,gifWidth:a}),h=t;r.crop=m,r.videoElement=u,r.videoWidth=l,r.videoHeight=f,r.cameraStream=c,d.isElement(u)&&(u.width=a+m.width,u.height=s+m.height,r.webcamVideoElement||(d.setCSSAttr(u,{position:"fixed",opacity:"0"}),n.body.appendChild(u)),u.play(),C(r,(function(e){i&&i.length||o&&o.length||E(e),h(e)})))}function j(e,t){if(t=d.isFunction(e)?e:t,e=d.isObject(e)?e:{},d.isFunction(t)){var r=d.normalizeOptions(h,e)||{},i=e.cameraStream,o=r.images,a=o?o.length:0,s=r.video,c=r.webcamVideoElement;r=d.normalizeOptions(r,{gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),a?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.images,i=e.options,o=e.imagesLength,a={getUserMedia:!0,"window.URL":!0},s=l.validate(a),c=[],u=0,f=void 0,m=void 0;if(s.error)return t(s);function h(){d.each(c,(function(e,t){t&&(t.text?m.addFrame(t.img,i,t.text):m.addFrame(t,i))})),k(m,t)}m=new x(i),d.each(r,(function(e,r){var a=r;d.isElement(a)?(i.crossOrigin&&(a.crossOrigin=i.crossOrigin),c[e]=a,(u+=1)===o&&h()):d.isString(a)&&(f=new Image,i.crossOrigin&&(f.crossOrigin=i.crossOrigin),function(i){r.text&&(i.text=r.text),i.onerror=function(e){var r=void 0;if(0===--o)return(r={}).error="None of the requested images was capable of being retrieved",t(r)},i.onload=function(t){r.text?c[e]={img:i,text:i.text}:c[e]=i,(u+=1)===o&&h(),d.removeElement(i)},i.src=a}(f),d.setCSSAttr(f,{position:"fixed",opacity:"0"}),n.body.appendChild(f))}))}({images:o,imagesLength:a,callback:t,options:r}):s?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.existingVideo,i=e.options,n={getUserMedia:!0,"window.URL":!0},o=l.validate(n),a=void 0,s=void 0;if(o.error)return t(o);if(d.isElement(r)&&r.src){if(s=r.src,a=d.getExtension(s),!d.isSupported.videoCodecs[a])return t(l.messages.videoCodecs)}else d.isArray(r)&&d.each(r,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),d.isSupported.videoCodecs[a])return r=t,!1}));F.startStreaming({completed:function(e){e.options=i||{},W(e,t)},existingVideo:r,crossOrigin:i.crossOrigin,options:i})}({existingVideo:s,callback:t,options:r}):function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.callback,r=e.lastCameraStream,i=e.options,n=e.webcamVideoElement;if(!p())return t(l.validate());i.savedRenderingContexts.length?C(i,(function(e){t(e)})):F.startVideoStreaming((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.options=i||{},W(e,t)}),{lastCameraStream:r,callback:t,webcamVideoElement:n,crossOrigin:i.crossOrigin})}({lastCameraStream:i,callback:t,webcamVideoElement:c,options:r})}}var M={utils:u,error:f,defaultOptions:g,createGIF:j,takeSnapShot:function(e,t){if(t=d.isFunction(e)?e:t,e=d.isObject(e)?e:{},d.isFunction(t)){var r=d.normalizeOptions(h,e);j(d.normalizeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),t)}},stopVideoStreaming:E,isSupported:function(){return l.isValid()},isWebCamGIFSupported:p,isExistingVideoGIFSupported:function(e){var t=!1;if(d.isArray(e)&&e.length){if(d.each(e,(function(e,r){d.isSupported.videoCodecs[r]&&(t=!0)})),!t)return!1}else if(d.isString(e)&&e.length&&!d.isSupported.videoCodecs[e])return!1;return l.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return l.isValid({getUserMedia:!0})},VERSION:"0.4.5"};void 0===(i=function(){return M}.apply(t,[]))||(e.exports=i)}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})}]);
|
|
2
2
|
//# sourceMappingURL=dist.es5.min.js.map
|
package/dist/dist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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 n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.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 n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));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,n,o,a){"use strict";var s,d,c={URL:i.URL||i.webkitURL||i.mozURL||i.msURL,getUserMedia:(d=o.getUserMedia||o.webkitGetUserMedia||o.mozGetUserMedia||o.msGetUserMedia,d?d.bind(o):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,n=c.requestAnimFrame;return r.value=n((function o(){(new Date).getTime()-i>=t?e.call():r.value=n(o)})),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,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,d=void 0,c=void 0,l=void 0,u=void 0;i<r;)d=(o=e.charCodeAt(i++))>>2,c=(3&o)<<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+n.charAt(d)+n.charAt(c)+n.charAt(l)+n.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=n.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=n.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,n){var o=t[r];c.isObject(o)&&e[r]?i[r]=c.normalizeOptions(e[r],o):i[r]=o})),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(!n.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,r=parseInt(e.fontSize,10),o=parseInt(e.minFontSize,10),a=n.createElement("div"),s=n.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",n.body.appendChild(s);s.offsetWidth>i&&r>=o;)s.style.fontSize=--r+"px";return n.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 n=r.errorCode;if(!e[n]&&!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(){},h={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"},g=Object.freeze({default:h});function p(){return u.isValid()}function v(){var e,t,i,r,n,o=256,a=499,s=491,d=487,c=503,l=3*c,u=o-1,f=4,m=100,h=16,g=1<<h,p=10,v=10,b=g>>v,w=g<<p-v,y=o>>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=[],U=[],T=[],j=[];function I(e,a,s){var d,c;for(t=e,i=a,r=s,n=new Array(o),d=0;d<o;d++)n[d]=new Array(4),(c=n[d])[0]=c[1]=c[2]=(d<<f+8)/o|0,T[d]=g/o|0,U[d]=0}function z(){for(var e=[],t=new Array(o),i=0;i<o;i++)t[n[i][3]]=i;for(var r=0,a=0;a<o;a++){var s=t[a];e[r++]=n[s][0],e[r++]=n[s][1],e[r++]=n[s][2]}return e}function V(){var e,t,i,r,a,s,d,c;for(d=0,c=0,e=0;e<o;e++){for(i=e,r=(a=n[e])[1],t=e+1;t<o;t++)(s=n[t])[1]<r&&(i=t,r=s[1]);if(s=n[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 n,o,u,h,g,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),n=0;n<v;n++)j[n]=b*((v*v-n*n)*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,n=0;n<C;)if(D(b,o=N(u=(255&F[W+0])<<f,h=(255&F[W+1])<<f,g=(255&F[W+2])<<f),u,h,g),0!==v&&G(v,o,u,h,g),(W+=w)>=A&&(W-=i),0===y&&(y=1),++n%y==0)for(b-=b/e,(v=(p-=p/k)>>x)<=1&&(v=0),o=0;o<v;o++)j[o]=b*((v*v-o*o)*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<o||a>=0;)r<o&&((s=(l=n[r])[1]-t)>=c?r=o:(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=n[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<o;e++)n[e][0]>>=f,n[e][1]>>=f,n[e][2]>>=f,n[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)>o&&(l=o),s=t+1,d=t-1,f=1;s<l||d>c;){if(u=j[f++],s<l){m=n[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=n[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,o){var a=n[t],s=e/O;a[0]-=s*(a[0]-i)|0,a[1]-=s*(a[1]-r)|0,a[2]-=s*(a[2]-o)|0}function N(e,t,i){var r,a,s,d,c,l,u,m,g,y;for(g=m=~(1<<31),u=l=-1,r=0;r<o;r++)(a=(y=n[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-(U[r]>>h-f))<g&&(g=d,u=r),c=T[r]>>v,T[r]-=c,U[r]+=c<<p;return T[l]+=b,U[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,n=0,o=[];n<r;)o.push(e[n++]),o.push(e[n++]),o.push(e[n++]),n++;return o},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],i=0;i<e.length;i+=3){var r=e[i],n=e[i+1],o=e[i+2];t.push(r<<16|n<<8|o)}return t},processFrameWithQuantizer:function(e,t,i,r){for(var n=this.dataToRGB(e,t,i),o=new v(n,n.length,r),a=o.process(),s=new Uint32Array(this.componentizedPaletteToArray(a)),d=t*i,c=new Uint8Array(d),l=0,u=0;u<d;u++){var f=n[l++],m=n[l++],h=n[l++];c[u]=o.map(f,m,h)}return{pixels:c,palette:s}},run:function(e){var t=e=e||{},i=t.height,r=(t.palette,t.sampleInterval),n=t.width,o=e.data;return this.processFrameWithQuantizer(o,n,i,r)}};return e}function w(e,t,i,r){var n=0,o=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[n++]=71,e[n++]=73,e[n++]=70,e[n++]=56,e[n++]=57,e[n++]=97;if(e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=0|(null!==a?128:0),e[n++]=0,e[n++]=0,null!==o){if(o<0||o>65535)throw"Loop count invalid.";e[n++]=33,e[n++]=255,e[n++]=11,e[n++]=78,e[n++]=69,e[n++]=84,e[n++]=83,e[n++]=67,e[n++]=65,e[n++]=80,e[n++]=69,e[n++]=50,e[n++]=46,e[n++]=48,e[n++]=3,e[n++]=1,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=0}var s=!1;this.addFrame=function(t,i,r,o,d,c){if(!0===s&&(--n,s=!1),c=void 0===c?{}:c,t<0||i<0||t>65535||i>65535)throw"x/y invalid.";if(r<=0||o<=0||r>65535||o>65535)throw"Width/Height invalid.";if(d.length<r*o)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 h=void 0===c.delay?0:c.delay,g=void 0===c.disposal?0:c.disposal;if(g<0||g>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!==g||p||0!==h)&&(e[n++]=33,e[n++]=249,e[n++]=4,e[n++]=g<<2|(!0===p?1:0),e[n++]=255&h,e[n++]=h>>8&255,e[n++]=v,e[n++]=0),e[n++]=44,e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=!0===l?128|m-1:0,!0===l)for(var b=0,w=u.length;b<w;++b){var y=u[b];e[n++]=y>>16&255,e[n++]=y>>8&255,e[n++]=255&y}n=function(e,t,i,r){e[t++]=i;var n=t++,o=1<<i,a=o-1,s=o+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===n+256&&(e[n]=255,n=t++)}function m(e){u|=e<<l,l+=c,f(8)}var h=r[0]&a,g={};m(o);for(var p=1,v=r.length;p<v;++p){var b=r[p]&a,w=h<<8|b,y=g[w];if(void 0===y){for(u|=h<<l,l+=c;l>=8;)e[t++]=255&u,u>>=8,l-=8,t===n+256&&(e[n]=255,n=t++);4096===d?(m(o),d=s+1,c=i+1,g={}):(d>=1<<c&&++c,g[w]=d++),h=b}else h=y}m(h),m(s),f(1),n+1===t?e[n]=0:(e[n]=t-n-1,e[t++]=0);return t}(e,n,m<2?2:m,d)},this.end=function(){return!1===s&&(e[n++]=59,s=!0),n}}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,o=void 0,a=void 0,s=-1,d="";for(t=e.numWorkers;++s<t;)r=c.createWebWorker(i),c.isObject(r)?(o=r.objectUrl,a=r.worker,this.workers.push({worker:a,objectUrl:o}),this.availableWorkers.push(a)):(d=r,c.webWorkerError=!!r);this.workerError=d,this.canvas=n.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,n=i.every((function(e){return!e.beingProcessed&&e.done}));t.numRenderedFrames++,r&&e(t.numRenderedFrames/i.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/i.length),n?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,n=i.sampleInterval,o=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=o[e]).beingProcessed||a.done?this.onFrameFinished():(a.sampleInterval=n,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},n=this.options,o=n.interval,a=n.frameDuration,s=!!n.images.length,d=n.gifHeight,l=n.gifWidth,u=new w(i,l,d,r),f=this.onRenderProgressCallback,m=s?100*o:0,h=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 n=0;n<a;n++)u.addFrame(0,0,l,d,i.pixels,{palette:r,delay:m})})),u.end(),f(1),this.frames=[],this.generatingGIF=!1,c.isFunction(t)&&(h=this.bufferToString(i),t("data:image/gif;base64,"+c.btoa(h)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t){t=c.isObject(t)?t:{};var i=this.ctx,r=this.options,n=r.gifWidth,o=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),h=s.textAlign,g=s.textBaseline,p=t.textXCoordinate?t.textXCoordinate:"left"===h?1:"right"===h?n:n/2,v=t.textYCoordinate?t.textYCoordinate:"top"===g?1:"center"===g?o/2:o,b=f+" "+a+" "+u,w=void 0;try{i.filter=d,i.drawImage(e,0,0,n,o),m&&(i.font=b,i.fillStyle=l,i.textAlign=h,i.textBaseline=g,i.fillText(m,p,v)),w=i.getImageData(0,0,n,o),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=n.createElement("canvas"),r=void 0,o=e.images,a=!!o.length,s=e.cameraStream,d=e.crop,l=e.filter,u=e.fontColor,f=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,g=(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=[],U=v.length?v.length:e.numFrames,T=U,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=T-1;function n(){var n;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)),n=r.getImageData(0,0,W,E),j.addFrameImageData(n),g((U-(T=i))/U),i>0&&c.requestTimeout(e,M),T||j.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:C,webcamVideoElement:O,savedRenderingContexts:R,keepCameraOn:h})}))}v.length?(r.putImageData(v[U-T],0,0),n()):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),n()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;c.requestTimeout(e,100)}}()};U=void 0!==U?U: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,n=e.gifHeight,o={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>i?(o.width=Math.round(t*(n/i))-r,o.scaledWidth=Math.round(o.width*(i/n))):(o.height=Math.round(i*(r/t))-n,o.scaledHeight=Math.round(o.height*(t/r))),o},O={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var i=t.cameraStream,r=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",O.findVideoSize),r({videoElement:n,cameraStream:i,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,c.requestTimeout((function(){O.findVideoSize(t)}),400)):r({videoElement:n,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,n=e.streamedCallback,o=e.videoElement;if(c.isFunction(n)&&n(),t){if(c.isString(t))o.src=t,o.innerHTML='<source src="'+t+'" type="video/'+c.getExtension(t)+'" />';else if(t instanceof Blob){try{o.src=c.URL.createObjectURL(t)}catch(e){}o.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(o.mozSrcObject)o.mozSrcObject=i;else if(c.URL)try{o.srcObject=i,o.src=c.URL.createObjectURL(i)}catch(e){o.srcObject=i}o.play(),c.requestTimeout((function e(){e.count=e.count||0,!0===O.loadedData?(O.findVideoSize({videoElement:o,cameraStream:i,completedCallback:r}),O.loadedData=!1):(e.count+=1)>10?O.findVideoSize({videoElement:o,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,o=e.crossOrigin,a=e.existingVideo,s=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=c.isElement(a)?a:l||n.createElement("video");o&&(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,n=t.webcamVideoElement,o=void 0;i>0&&(o=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(o)},completed:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.cameraStream,r=t.videoElement,n=t.videoHeight,o=t.videoWidth;e({cameraStream:i,videoElement:r,videoHeight:n,videoWidth:o})},lastCameraStream:t.lastCameraStream,webcamVideoElement:n,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=c.isObject(e)?e:{},i=t.keepCameraOn,r=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],s=!!a.length,d=a[0];!i&&s&&c.isFunction(d.stop)&&d.stop(),c.isElement(r)&&!n&&(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,o=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}),h=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"}),n.body.appendChild(l)),l.play(),k(i,(function(e){r&&r.length||o&&o.length||W(e),h(e)})))}function A(e,t){if(t=c.isFunction(e)?e:t,e=c.isObject(e)?e:{},c.isFunction(t)){var i=c.normalizeOptions(h,e)||{},r=e.cameraStream,o=i.images,a=o?o.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,o=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 h(){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)===o&&h()):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===--o)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)===o&&h(),c.removeElement(r)},r.src=a}(f),c.setCSSAttr(f,{position:"fixed",opacity:"0"}),n.body.appendChild(f))}))}({images:o,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,n={getUserMedia:!0,"window.URL":!0},o=u.validate(n),a=void 0,s=void 0;if(o.error)return t(o);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,n=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:n,crossOrigin:r.crossOrigin})}({lastCameraStream:r,callback:t,webcamVideoElement:d,options:i})}}var M={utils:l,error:f,defaultOptions:g,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(h,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){(function(t){const r=i(3),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,r)}).call(this,i(2))},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},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.0.13",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 n=i(0),o=i.n(n);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=o.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}}}])}));
|
|
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 n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.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 n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));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,n,o,a){"use strict";var s,d,c={URL:i.URL||i.webkitURL||i.mozURL||i.msURL,getUserMedia:(d=o.getUserMedia||o.webkitGetUserMedia||o.mozGetUserMedia||o.msGetUserMedia,d?d.bind(o):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,n=c.requestAnimFrame;return r.value=n((function o(){(new Date).getTime()-i>=t?e.call():r.value=n(o)})),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,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,d=void 0,c=void 0,l=void 0,u=void 0;i<r;)d=(o=e.charCodeAt(i++))>>2,c=(3&o)<<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+n.charAt(d)+n.charAt(c)+n.charAt(l)+n.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=n.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=n.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,n){var o=t[r];c.isObject(o)&&e[r]?i[r]=c.normalizeOptions(e[r],o):i[r]=o})),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(!n.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,r=parseInt(e.fontSize,10),o=parseInt(e.minFontSize,10),a=n.createElement("div"),s=n.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",n.body.appendChild(s);s.offsetWidth>i&&r>=o;)s.style.fontSize=--r+"px";return n.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 n=r.errorCode;if(!e[n]&&!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(){},h={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"},g=Object.freeze({default:h});function p(){return u.isValid()}function v(){var e,t,i,r,n,o=256,a=499,s=491,d=487,c=503,l=3*c,u=o-1,f=4,m=100,h=16,g=1<<h,p=10,v=10,b=g>>v,w=g<<p-v,y=o>>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=[],U=[],T=[],j=[];function I(e,a,s){var d,c;for(t=e,i=a,r=s,n=new Array(o),d=0;d<o;d++)n[d]=new Array(4),(c=n[d])[0]=c[1]=c[2]=(d<<f+8)/o|0,T[d]=g/o|0,U[d]=0}function z(){for(var e=[],t=new Array(o),i=0;i<o;i++)t[n[i][3]]=i;for(var r=0,a=0;a<o;a++){var s=t[a];e[r++]=n[s][0],e[r++]=n[s][1],e[r++]=n[s][2]}return e}function V(){var e,t,i,r,a,s,d,c;for(d=0,c=0,e=0;e<o;e++){for(i=e,r=(a=n[e])[1],t=e+1;t<o;t++)(s=n[t])[1]<r&&(i=t,r=s[1]);if(s=n[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 n,o,u,h,g,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),n=0;n<v;n++)j[n]=b*((v*v-n*n)*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,n=0;n<C;)if(D(b,o=N(u=(255&F[W+0])<<f,h=(255&F[W+1])<<f,g=(255&F[W+2])<<f),u,h,g),0!==v&&G(v,o,u,h,g),(W+=w)>=A&&(W-=i),0===y&&(y=1),++n%y==0)for(b-=b/e,(v=(p-=p/k)>>x)<=1&&(v=0),o=0;o<v;o++)j[o]=b*((v*v-o*o)*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<o||a>=0;)r<o&&((s=(l=n[r])[1]-t)>=c?r=o:(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=n[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<o;e++)n[e][0]>>=f,n[e][1]>>=f,n[e][2]>>=f,n[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)>o&&(l=o),s=t+1,d=t-1,f=1;s<l||d>c;){if(u=j[f++],s<l){m=n[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=n[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,o){var a=n[t],s=e/O;a[0]-=s*(a[0]-i)|0,a[1]-=s*(a[1]-r)|0,a[2]-=s*(a[2]-o)|0}function N(e,t,i){var r,a,s,d,c,l,u,m,g,y;for(g=m=~(1<<31),u=l=-1,r=0;r<o;r++)(a=(y=n[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-(U[r]>>h-f))<g&&(g=d,u=r),c=T[r]>>v,T[r]-=c,U[r]+=c<<p;return T[l]+=b,U[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,n=0,o=[];n<r;)o.push(e[n++]),o.push(e[n++]),o.push(e[n++]),n++;return o},componentizedPaletteToArray:function(e){e=e||[];for(var t=[],i=0;i<e.length;i+=3){var r=e[i],n=e[i+1],o=e[i+2];t.push(r<<16|n<<8|o)}return t},processFrameWithQuantizer:function(e,t,i,r){for(var n=this.dataToRGB(e,t,i),o=new v(n,n.length,r),a=o.process(),s=new Uint32Array(this.componentizedPaletteToArray(a)),d=t*i,c=new Uint8Array(d),l=0,u=0;u<d;u++){var f=n[l++],m=n[l++],h=n[l++];c[u]=o.map(f,m,h)}return{pixels:c,palette:s}},run:function(e){var t=e=e||{},i=t.height,r=(t.palette,t.sampleInterval),n=t.width,o=e.data;return this.processFrameWithQuantizer(o,n,i,r)}};return e}function w(e,t,i,r){var n=0,o=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[n++]=71,e[n++]=73,e[n++]=70,e[n++]=56,e[n++]=57,e[n++]=97;if(e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=0|(null!==a?128:0),e[n++]=0,e[n++]=0,null!==o){if(o<0||o>65535)throw"Loop count invalid.";e[n++]=33,e[n++]=255,e[n++]=11,e[n++]=78,e[n++]=69,e[n++]=84,e[n++]=83,e[n++]=67,e[n++]=65,e[n++]=80,e[n++]=69,e[n++]=50,e[n++]=46,e[n++]=48,e[n++]=3,e[n++]=1,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=0}var s=!1;this.addFrame=function(t,i,r,o,d,c){if(!0===s&&(--n,s=!1),c=void 0===c?{}:c,t<0||i<0||t>65535||i>65535)throw"x/y invalid.";if(r<=0||o<=0||r>65535||o>65535)throw"Width/Height invalid.";if(d.length<r*o)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 h=void 0===c.delay?0:c.delay,g=void 0===c.disposal?0:c.disposal;if(g<0||g>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!==g||p||0!==h)&&(e[n++]=33,e[n++]=249,e[n++]=4,e[n++]=g<<2|(!0===p?1:0),e[n++]=255&h,e[n++]=h>>8&255,e[n++]=v,e[n++]=0),e[n++]=44,e[n++]=255&t,e[n++]=t>>8&255,e[n++]=255&i,e[n++]=i>>8&255,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=255&o,e[n++]=o>>8&255,e[n++]=!0===l?128|m-1:0,!0===l)for(var b=0,w=u.length;b<w;++b){var y=u[b];e[n++]=y>>16&255,e[n++]=y>>8&255,e[n++]=255&y}n=function(e,t,i,r){e[t++]=i;var n=t++,o=1<<i,a=o-1,s=o+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===n+256&&(e[n]=255,n=t++)}function m(e){u|=e<<l,l+=c,f(8)}var h=r[0]&a,g={};m(o);for(var p=1,v=r.length;p<v;++p){var b=r[p]&a,w=h<<8|b,y=g[w];if(void 0===y){for(u|=h<<l,l+=c;l>=8;)e[t++]=255&u,u>>=8,l-=8,t===n+256&&(e[n]=255,n=t++);4096===d?(m(o),d=s+1,c=i+1,g={}):(d>=1<<c&&++c,g[w]=d++),h=b}else h=y}m(h),m(s),f(1),n+1===t?e[n]=0:(e[n]=t-n-1,e[t++]=0);return t}(e,n,m<2?2:m,d)},this.end=function(){return!1===s&&(e[n++]=59,s=!0),n}}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,o=void 0,a=void 0,s=-1,d="";for(t=e.numWorkers;++s<t;)r=c.createWebWorker(i),c.isObject(r)?(o=r.objectUrl,a=r.worker,this.workers.push({worker:a,objectUrl:o}),this.availableWorkers.push(a)):(d=r,c.webWorkerError=!!r);this.workerError=d,this.canvas=n.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,n=i.every((function(e){return!e.beingProcessed&&e.done}));t.numRenderedFrames++,r&&e(t.numRenderedFrames/i.length),t.onRenderProgressCallback(.75*t.numRenderedFrames/i.length),n?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,n=i.sampleInterval,o=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=o[e]).beingProcessed||a.done?this.onFrameFinished():(a.sampleInterval=n,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},n=this.options,o=n.interval,a=n.frameDuration,s=!!n.images.length,d=n.gifHeight,l=n.gifWidth,u=new w(i,l,d,r),f=this.onRenderProgressCallback,m=s?100*o:0,h=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 n=0;n<a;n++)u.addFrame(0,0,l,d,i.pixels,{palette:r,delay:m})})),u.end(),f(1),this.frames=[],this.generatingGIF=!1,c.isFunction(t)&&(h=this.bufferToString(i),t("data:image/gif;base64,"+c.btoa(h)))},setRepeat:function(e){this.repeat=e},addFrame:function(e,t){t=c.isObject(t)?t:{};var i=this.ctx,r=this.options,n=r.gifWidth,o=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),h=s.textAlign,g=s.textBaseline,p=t.textXCoordinate?t.textXCoordinate:"left"===h?1:"right"===h?n:n/2,v=t.textYCoordinate?t.textYCoordinate:"top"===g?1:"center"===g?o/2:o,b=f+" "+a+" "+u,w=void 0;try{i.filter=d,i.drawImage(e,0,0,n,o),m&&(i.font=b,i.fillStyle=l,i.textAlign=h,i.textBaseline=g,i.fillText(m,p,v)),w=i.getImageData(0,0,n,o),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=n.createElement("canvas"),r=void 0,o=e.images,a=!!o.length,s=e.cameraStream,d=e.crop,l=e.filter,u=e.fontColor,f=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,g=(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=[],U=v.length?v.length:e.numFrames,T=U,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=T-1;function n(){var n;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)),n=r.getImageData(0,0,W,E),j.addFrameImageData(n),g((U-(T=i))/U),i>0&&c.requestTimeout(e,M),T||j.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:s,videoElement:C,webcamVideoElement:O,savedRenderingContexts:R,keepCameraOn:h})}))}v.length?(r.putImageData(v[U-T],0,0),n()):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),n()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;c.requestTimeout(e,100)}}()};U=void 0!==U?U: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,n=e.gifHeight,o={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>i?(o.width=Math.round(t*(n/i))-r,o.scaledWidth=Math.round(o.width*(i/n))):(o.height=Math.round(i*(r/t))-n,o.scaledHeight=Math.round(o.height*(t/r))),o},O={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var i=t.cameraStream,r=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",O.findVideoSize),r({videoElement:n,cameraStream:i,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,c.requestTimeout((function(){O.findVideoSize(t)}),400)):r({videoElement:n,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,n=e.streamedCallback,o=e.videoElement;if(c.isFunction(n)&&n(),t){if(c.isString(t))o.src=t,o.innerHTML='<source src="'+t+'" type="video/'+c.getExtension(t)+'" />';else if(t instanceof Blob){try{o.src=c.URL.createObjectURL(t)}catch(e){}o.innerHTML='<source src="'+t+'" type="'+t.type+'" />'}}else if(o.mozSrcObject)o.mozSrcObject=i;else if(c.URL)try{o.srcObject=i,o.src=c.URL.createObjectURL(i)}catch(e){o.srcObject=i}o.play(),c.requestTimeout((function e(){e.count=e.count||0,!0===O.loadedData?(O.findVideoSize({videoElement:o,cameraStream:i,completedCallback:r}),O.loadedData=!1):(e.count+=1)>10?O.findVideoSize({videoElement:o,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,o=e.crossOrigin,a=e.existingVideo,s=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=c.isElement(a)?a:l||n.createElement("video");o&&(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,n=t.webcamVideoElement,o=void 0;i>0&&(o=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(o)},completed:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.cameraStream,r=t.videoElement,n=t.videoHeight,o=t.videoWidth;e({cameraStream:i,videoElement:r,videoHeight:n,videoWidth:o})},lastCameraStream:t.lastCameraStream,webcamVideoElement:n,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=c.isObject(e)?e:{},i=t.keepCameraOn,r=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],s=!!a.length,d=a[0];!i&&s&&c.isFunction(d.stop)&&d.stop(),c.isElement(r)&&!n&&(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,o=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}),h=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"}),n.body.appendChild(l)),l.play(),k(i,(function(e){r&&r.length||o&&o.length||W(e),h(e)})))}function A(e,t){if(t=c.isFunction(e)?e:t,e=c.isObject(e)?e:{},c.isFunction(t)){var i=c.normalizeOptions(h,e)||{},r=e.cameraStream,o=i.images,a=o?o.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,o=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 h(){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)===o&&h()):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===--o)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)===o&&h(),c.removeElement(r)},r.src=a}(f),c.setCSSAttr(f,{position:"fixed",opacity:"0"}),n.body.appendChild(f))}))}({images:o,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,n={getUserMedia:!0,"window.URL":!0},o=u.validate(n),a=void 0,s=void 0;if(o.error)return t(o);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,n=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:n,crossOrigin:r.crossOrigin})}({lastCameraStream:r,callback:t,webcamVideoElement:d,options:i})}}var M={utils:l,error:f,defaultOptions:g,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(h,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){(function(t){const r=i(3),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,r)}).call(this,i(2))},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},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.0.14",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 n=i(0),o=i.n(n);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=o.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
2
|
//# sourceMappingURL=dist.min.js.map
|
package/dist/es5/bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var moduleExports = require('./index');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var _global = typeof window === 'undefined' ? global : window;
|
|
6
6
|
|
|
7
7
|
_global.loaders = _global.loaders || {};
|
|
8
8
|
module.exports = Object.assign(_global.loaders, moduleExports);
|
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACA,IAAMC,OAAO,GAAG,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,MAAhC,GAAyCD,MAAzD;;AACAD,OAAO,CAACG,OAAR,GAAkBH,OAAO,CAACG,OAAR,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcP,OAAO,CAACG,OAAtB,EAA+BL,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nconst _global = typeof window === 'undefined' ? global : window;\n_global.loaders = _global.loaders || {};\nmodule.exports = Object.assign(_global.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/es5/gif-builder.js
CHANGED
|
@@ -7,17 +7,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
10
20
|
var _assert = require("./lib/utils/assert");
|
|
11
21
|
|
|
12
22
|
var _gifshot = _interopRequireDefault(require("./libs/gifshot"));
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
+
|
|
28
|
+
var GIF_BUILDER_OPTIONS = {
|
|
15
29
|
source: 'images',
|
|
16
30
|
width: 200,
|
|
17
31
|
height: 200,
|
|
18
32
|
crossOrigin: 'Anonymous',
|
|
19
|
-
progressCallback: captureProgress
|
|
20
|
-
completeCallback: ()
|
|
33
|
+
progressCallback: function progressCallback(captureProgress) {},
|
|
34
|
+
completeCallback: function completeCallback() {},
|
|
21
35
|
numWorkers: 2,
|
|
22
36
|
sampleInterval: 10,
|
|
23
37
|
interval: 0.1,
|
|
@@ -49,86 +63,183 @@ const GIF_BUILDER_OPTIONS = {
|
|
|
49
63
|
savedRenderingContexts: []
|
|
50
64
|
};
|
|
51
65
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
name: 'GIF',
|
|
57
|
-
extensions: ['gif'],
|
|
58
|
-
mimeTypes: ['image/gif'],
|
|
59
|
-
builder: GIFBuilder,
|
|
60
|
-
options: GIF_BUILDER_OPTIONS
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
constructor(options) {
|
|
65
|
-
this.options = { ...options
|
|
66
|
-
};
|
|
66
|
+
var GIFBuilder = function () {
|
|
67
|
+
function GIFBuilder(options) {
|
|
68
|
+
(0, _classCallCheck2.default)(this, GIFBuilder);
|
|
69
|
+
this.options = _objectSpread({}, options);
|
|
67
70
|
this.source = options.source;
|
|
68
71
|
delete options.source;
|
|
69
72
|
this.files = [];
|
|
70
73
|
this.gifshot = _gifshot.default;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
(0, _createClass2.default)(GIFBuilder, [{
|
|
77
|
+
key: "initialize",
|
|
78
|
+
value: function () {
|
|
79
|
+
var _initialize = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(options) {
|
|
80
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
81
|
+
while (1) {
|
|
82
|
+
switch (_context.prev = _context.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
function initialize(_x) {
|
|
92
|
+
return _initialize.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return initialize;
|
|
96
|
+
}()
|
|
97
|
+
}, {
|
|
98
|
+
key: "add",
|
|
99
|
+
value: function () {
|
|
100
|
+
var _add = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(file) {
|
|
101
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
102
|
+
while (1) {
|
|
103
|
+
switch (_context2.prev = _context2.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
_context2.next = 2;
|
|
106
|
+
return this.initialize();
|
|
107
|
+
|
|
108
|
+
case 2:
|
|
109
|
+
this.files.push(file);
|
|
110
|
+
|
|
111
|
+
case 3:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context2.stop();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, _callee2, this);
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
function add(_x2) {
|
|
120
|
+
return _add.apply(this, arguments);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return add;
|
|
124
|
+
}()
|
|
125
|
+
}, {
|
|
126
|
+
key: "build",
|
|
127
|
+
value: function () {
|
|
128
|
+
var _build = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3() {
|
|
129
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
130
|
+
while (1) {
|
|
131
|
+
switch (_context3.prev = _context3.next) {
|
|
132
|
+
case 0:
|
|
133
|
+
_context3.next = 2;
|
|
134
|
+
return this.initialize();
|
|
135
|
+
|
|
136
|
+
case 2:
|
|
137
|
+
this._cleanOptions(this.options);
|
|
138
|
+
|
|
139
|
+
_context3.t0 = this.source;
|
|
140
|
+
_context3.next = _context3.t0 === 'images' ? 6 : _context3.t0 === 'video' ? 8 : _context3.t0 === 'webcam' ? 10 : 12;
|
|
141
|
+
break;
|
|
142
|
+
|
|
143
|
+
case 6:
|
|
144
|
+
this.options.images = this.files;
|
|
145
|
+
return _context3.abrupt("break", 13);
|
|
146
|
+
|
|
147
|
+
case 8:
|
|
148
|
+
this.options.video = this.files;
|
|
149
|
+
return _context3.abrupt("break", 13);
|
|
150
|
+
|
|
151
|
+
case 10:
|
|
152
|
+
(0, _assert.assert)(this.files.length === 0);
|
|
153
|
+
return _context3.abrupt("break", 13);
|
|
154
|
+
|
|
155
|
+
case 12:
|
|
156
|
+
throw new Error('GIFBuilder: invalid source');
|
|
157
|
+
|
|
158
|
+
case 13:
|
|
159
|
+
_context3.next = 15;
|
|
160
|
+
return this._createGIF();
|
|
161
|
+
|
|
162
|
+
case 15:
|
|
163
|
+
return _context3.abrupt("return", _context3.sent);
|
|
164
|
+
|
|
165
|
+
case 16:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context3.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee3, this);
|
|
171
|
+
}));
|
|
172
|
+
|
|
173
|
+
function build() {
|
|
174
|
+
return _build.apply(this, arguments);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return build;
|
|
178
|
+
}()
|
|
179
|
+
}, {
|
|
180
|
+
key: "_createGIF",
|
|
181
|
+
value: function () {
|
|
182
|
+
var _createGIF2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4() {
|
|
183
|
+
var _this = this;
|
|
184
|
+
|
|
185
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
186
|
+
while (1) {
|
|
187
|
+
switch (_context4.prev = _context4.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
190
|
+
_this.gifshot.createGIF(_this.options, function (result) {
|
|
191
|
+
if (result.error) {
|
|
192
|
+
reject(result.errorMsg);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
resolve(result.image);
|
|
197
|
+
});
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
case 1:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context4.stop();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, _callee4);
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
function _createGIF() {
|
|
209
|
+
return _createGIF2.apply(this, arguments);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return _createGIF;
|
|
213
|
+
}()
|
|
214
|
+
}, {
|
|
215
|
+
key: "_cleanOptions",
|
|
216
|
+
value: function _cleanOptions(options) {
|
|
217
|
+
if (options.video || options.images || options.gifWidth || options.gifHeight) {
|
|
218
|
+
console.warn('GIFBuilder: ignoring options');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
delete options.video;
|
|
222
|
+
delete options.images;
|
|
223
|
+
options.gifWidth = options.width;
|
|
224
|
+
options.gifHeight = options.height;
|
|
225
|
+
delete options.width;
|
|
226
|
+
delete options.height;
|
|
100
227
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
resolve(result.image);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_cleanOptions(options) {
|
|
119
|
-
if (options.video || options.images || options.gifWidth || options.gifHeight) {
|
|
120
|
-
console.warn('GIFBuilder: ignoring options');
|
|
228
|
+
}], [{
|
|
229
|
+
key: "properties",
|
|
230
|
+
get: function get() {
|
|
231
|
+
return {
|
|
232
|
+
id: 'gif',
|
|
233
|
+
name: 'GIF',
|
|
234
|
+
extensions: ['gif'],
|
|
235
|
+
mimeTypes: ['image/gif'],
|
|
236
|
+
builder: GIFBuilder,
|
|
237
|
+
options: GIF_BUILDER_OPTIONS
|
|
238
|
+
};
|
|
121
239
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
options.gifWidth = options.width;
|
|
126
|
-
options.gifHeight = options.height;
|
|
127
|
-
delete options.width;
|
|
128
|
-
delete options.height;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
}
|
|
240
|
+
}]);
|
|
241
|
+
return GIFBuilder;
|
|
242
|
+
}();
|
|
132
243
|
|
|
133
244
|
exports.default = GIFBuilder;
|
|
134
245
|
//# sourceMappingURL=gif-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/gif-builder.js"],"names":["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","gifshot","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;;AACA;;AAGA,MAAMA,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,EAAE,MAjCgB;AAkC1BC,EAAAA,WAAW,EAAE,MAlCa;AAmC1BC,EAAAA,UAAU,EAAE,KAnCc;AAoC1BC,EAAAA,UAAU,EAAE,YApCc;AAqC1BC,EAAAA,SAAS,EAAE,SArCe;AAsC1BC,EAAAA,SAAS,EAAE,QAtCe;AAuC1BC,EAAAA,YAAY,EAAE,QAvCY;AAwC1BC,EAAAA,eAAe,EAAE,IAxCS;AAyC1BC,EAAAA,eAAe,EAAE,IAzCS;AA8C1BC,EAAAA,kBAAkB,EAAE,IA9CM;AA+C1BC,EAAAA,YAAY,EAAE,KA/CY;AAgD1BC,EAAAA,YAAY,EAAE,IAhDY;AAmD1BC,EAAAA,qBAAqB,EAAE,KAnDG;AAoD1BC,EAAAA,sBAAsB,EAAE;AApDE,CAA5B;;AAuDe,MAAMC,UAAN,CAAiB;AACT,aAAVC,UAAU,GAAG;AACtB,WAAO;AACLC,MAAAA,EAAE,EAAE,KADC;AAELC,MAAAA,IAAI,EAAE,KAFD;AAGLC,MAAAA,UAAU,EAAE,CAAC,KAAD,CAHP;AAILC,MAAAA,SAAS,EAAE,CAAC,WAAD,CAJN;AAKLC,MAAAA,OAAO,EAAEN,UALJ;AAMLO,MAAAA,OAAO,EAAE5C;AANJ,KAAP;AAQD;;AAED6C,EAAAA,WAAW,CAACD,OAAD,EAAU;AACnB,SAAKA,OAAL,GAAe,EAAC,GAAGA;AAAJ,KAAf;AACA,SAAK3C,MAAL,GAAc2C,OAAO,CAAC3C,MAAtB;AACA,WAAO2C,OAAO,CAAC3C,MAAf;AAGA,SAAK6C,KAAL,GAAa,EAAb;AAGA,SAAKC,OAAL,GAAeA,gBAAf;AACD;;AAEe,QAAVC,UAAU,CAACJ,OAAD,EAAU,CAGzB;;AAEQ,QAAHK,GAAG,CAACC,IAAD,EAAO;AACd,UAAM,KAAKF,UAAL,EAAN;AACA,SAAKF,KAAL,CAAWK,IAAX,CAAgBD,IAAhB;AACD;;AAEU,QAALE,KAAK,GAAG;AACZ,UAAM,KAAKJ,UAAL,EAAN;;AACA,SAAKK,aAAL,CAAmB,KAAKT,OAAxB;;AAEA,YAAQ,KAAK3C,MAAb;AACE,WAAK,QAAL;AACE,aAAK2C,OAAL,CAAaU,MAAb,GAAsB,KAAKR,KAA3B;AACA;;AACF,WAAK,OAAL;AACE,aAAKF,OAAL,CAAaW,KAAb,GAAqB,KAAKT,KAA1B;AACA;;AACF,WAAK,QAAL;AACE,4BAAO,KAAKA,KAAL,CAAWU,MAAX,KAAsB,CAA7B;AACA;;AACF;AACE,cAAM,IAAIC,KAAJ,CAAU,4BAAV,CAAN;AAXJ;;AAcA,WAAO,MAAM,KAAKC,UAAL,EAAb;AACD;;AAIe,QAAVA,UAAU,GAAG;AACjB,WAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,WAAKd,OAAL,CAAae,SAAb,CAAuB,KAAKlB,OAA5B,EAAsCmB,MAAD,IAAY;AAU/C,YAAIA,MAAM,CAACC,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,CAACT,OAAD,EAAU;AACrB,QAAIA,OAAO,CAACW,KAAR,IAAiBX,OAAO,CAACU,MAAzB,IAAmCV,OAAO,CAACuB,QAA3C,IAAuDvB,OAAO,CAACwB,SAAnE,EAA8E;AAC5EC,MAAAA,OAAO,CAACC,IAAR,CAAa,8BAAb;AACD;;AAGD,WAAO1B,OAAO,CAACW,KAAf;AACA,WAAOX,OAAO,CAACU,MAAf;AAGAV,IAAAA,OAAO,CAACuB,QAAR,GAAmBvB,OAAO,CAAC1C,KAA3B;AACA0C,IAAAA,OAAO,CAACwB,SAAR,GAAoBxB,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":["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","options","files","gifshot","file","initialize","push","_cleanOptions","images","video","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn","id","name","extensions","mimeTypes","builder"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AACA;;;;;;AAGA,IAAMA,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,EAAE,0BAACC,eAAD,EAAqB,CAAE,CARf;AAS1BC,EAAAA,gBAAgB,EAAE,4BAAM,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,EAAE,MAjCgB;AAkC1BC,EAAAA,WAAW,EAAE,MAlCa;AAmC1BC,EAAAA,UAAU,EAAE,KAnCc;AAoC1BC,EAAAA,UAAU,EAAE,YApCc;AAqC1BC,EAAAA,SAAS,EAAE,SArCe;AAsC1BC,EAAAA,SAAS,EAAE,QAtCe;AAuC1BC,EAAAA,YAAY,EAAE,QAvCY;AAwC1BC,EAAAA,eAAe,EAAE,IAxCS;AAyC1BC,EAAAA,eAAe,EAAE,IAzCS;AA8C1BC,EAAAA,kBAAkB,EAAE,IA9CM;AA+C1BC,EAAAA,YAAY,EAAE,KA/CY;AAgD1BC,EAAAA,YAAY,EAAE,IAhDY;AAmD1BC,EAAAA,qBAAqB,EAAE,KAnDG;AAoD1BC,EAAAA,sBAAsB,EAAE;AApDE,CAA5B;;IAuDqBC,U;AAYnB,sBAAYC,OAAZ,EAAqB;AAAA;AACnB,SAAKA,OAAL,qBAAmBA,OAAnB;AACA,SAAKrC,MAAL,GAAcqC,OAAO,CAACrC,MAAtB;AACA,WAAOqC,OAAO,CAACrC,MAAf;AAGA,SAAKsC,KAAL,GAAa,EAAb;AAGA,SAAKC,OAAL,GAAeA,gBAAf;AACD;;;;;kFAED,iBAAiBF,OAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;2EAKA,kBAAUG,IAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACQ,KAAKC,UAAL,EADR;;AAAA;AAEE,qBAAKH,KAAL,CAAWI,IAAX,CAAgBF,IAAhB;;AAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;6EAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACQ,KAAKC,UAAL,EADR;;AAAA;AAEE,qBAAKE,aAAL,CAAmB,KAAKN,OAAxB;;AAFF,+BAIU,KAAKrC,MAJf;AAAA,kDAKS,QALT,wBAQS,OART,wBAWS,QAXT;AAAA;;AAAA;AAMM,qBAAKqC,OAAL,CAAaO,MAAb,GAAsB,KAAKN,KAA3B;AANN;;AAAA;AASM,qBAAKD,OAAL,CAAaQ,KAAb,GAAqB,KAAKP,KAA1B;AATN;;AAAA;AAYM,oCAAO,KAAKA,KAAL,CAAWQ,MAAX,KAAsB,CAA7B;AAZN;;AAAA;AAAA,sBAeY,IAAIC,KAAJ,CAAU,4BAAV,CAfZ;;AAAA;AAAA;AAAA,uBAkBe,KAAKC,UAAL,EAlBf;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;kFAuBA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,kDACS,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AACtC,kBAAA,KAAI,CAACZ,OAAL,CAAaa,SAAb,CAAuB,KAAI,CAACf,OAA5B,EAAqC,UAACgB,MAAD,EAAY;AAU/C,wBAAIA,MAAM,CAACC,KAAX,EAAkB;AAChBH,sBAAAA,MAAM,CAACE,MAAM,CAACE,QAAR,CAAN;AACA;AACD;;AAGDL,oBAAAA,OAAO,CAACG,MAAM,CAACG,KAAR,CAAP;AAMD,mBAtBD;AAuBD,iBAxBM,CADT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WA6BA,uBAAcnB,OAAd,EAAuB;AACrB,UAAIA,OAAO,CAACQ,KAAR,IAAiBR,OAAO,CAACO,MAAzB,IAAmCP,OAAO,CAACoB,QAA3C,IAAuDpB,OAAO,CAACqB,SAAnE,EAA8E;AAC5EC,QAAAA,OAAO,CAACC,IAAR,CAAa,8BAAb;AACD;;AAGD,aAAOvB,OAAO,CAACQ,KAAf;AACA,aAAOR,OAAO,CAACO,MAAf;AAGAP,MAAAA,OAAO,CAACoB,QAAR,GAAmBpB,OAAO,CAACpC,KAA3B;AACAoC,MAAAA,OAAO,CAACqB,SAAR,GAAoBrB,OAAO,CAACnC,MAA5B;AACA,aAAOmC,OAAO,CAACpC,KAAf;AACA,aAAOoC,OAAO,CAACnC,MAAf;AACD;;;SAnGD,eAAwB;AACtB,aAAO;AACL2D,QAAAA,EAAE,EAAE,KADC;AAELC,QAAAA,IAAI,EAAE,KAFD;AAGLC,QAAAA,UAAU,EAAE,CAAC,KAAD,CAHP;AAILC,QAAAA,SAAS,EAAE,CAAC,WAAD,CAJN;AAKLC,QAAAA,OAAO,EAAE7B,UALJ;AAMLC,QAAAA,OAAO,EAAEtC;AANJ,OAAP;AAQD","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"}
|
package/dist/es5/index.js
CHANGED
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports, "VideoLoader", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () {
|
|
10
|
+
get: function get() {
|
|
11
11
|
return _videoLoader.VideoLoader;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "GIFBuilder", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () {
|
|
16
|
+
get: function get() {
|
|
17
17
|
return _gifBuilder.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1,28 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.loadGifshotModule = loadGifshotModule;
|
|
7
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
8
14
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
var loadGifshotPromise;
|
|
17
|
+
|
|
18
|
+
function loadGifshotModule() {
|
|
19
|
+
return _loadGifshotModule.apply(this, arguments);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function _loadGifshotModule() {
|
|
23
|
+
_loadGifshotModule = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
24
|
+
var options,
|
|
25
|
+
modules,
|
|
26
|
+
_args = arguments;
|
|
27
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
28
|
+
while (1) {
|
|
29
|
+
switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
32
|
+
modules = options.modules || {};
|
|
11
33
|
|
|
12
|
-
|
|
13
|
-
|
|
34
|
+
if (!modules.gifshot) {
|
|
35
|
+
_context.next = 4;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
14
38
|
|
|
15
|
-
|
|
16
|
-
return modules.gifshot;
|
|
17
|
-
}
|
|
39
|
+
return _context.abrupt("return", modules.gifshot);
|
|
18
40
|
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
case 4:
|
|
42
|
+
loadGifshotPromise = loadGifshotPromise || loadGifshot(options);
|
|
43
|
+
_context.next = 7;
|
|
44
|
+
return loadGifshotPromise;
|
|
45
|
+
|
|
46
|
+
case 7:
|
|
47
|
+
return _context.abrupt("return", _context.sent);
|
|
48
|
+
|
|
49
|
+
case 8:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
return _loadGifshotModule.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function loadGifshot(_x) {
|
|
60
|
+
return _loadGifshot.apply(this, arguments);
|
|
21
61
|
}
|
|
22
62
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
63
|
+
function _loadGifshot() {
|
|
64
|
+
_loadGifshot = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(options) {
|
|
65
|
+
var gifshot;
|
|
66
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context2.prev = _context2.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
options.libraryPath = options.libraryPath || 'libs/';
|
|
71
|
+
_context2.next = 3;
|
|
72
|
+
return (0, _workerUtils.loadLibrary)('gifshot.js', 'gifshot', options);
|
|
73
|
+
|
|
74
|
+
case 3:
|
|
75
|
+
gifshot = _context2.sent;
|
|
76
|
+
return _context2.abrupt("return", gifshot || globalThis.gifshot);
|
|
77
|
+
|
|
78
|
+
case 5:
|
|
79
|
+
case "end":
|
|
80
|
+
return _context2.stop();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, _callee2);
|
|
84
|
+
}));
|
|
85
|
+
return _loadGifshot.apply(this, arguments);
|
|
27
86
|
}
|
|
28
87
|
//# sourceMappingURL=gifshot-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/gifshot/gifshot-loader.js"],"names":["loadGifshotPromise","loadGifshotModule","options","modules","gifshot","loadGifshot","libraryPath","globalThis"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/gifshot/gifshot-loader.js"],"names":["loadGifshotPromise","loadGifshotModule","options","modules","gifshot","loadGifshot","libraryPath","globalThis"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA,IAAIA,kBAAJ;;SAEsBC,iB;;;;;iFAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAiCC,YAAAA,OAAjC,2DAA2C,EAA3C;AACCC,YAAAA,OADD,GACWD,OAAO,CAACC,OAAR,IAAmB,EAD9B;;AAAA,iBAEDA,OAAO,CAACC,OAFP;AAAA;AAAA;AAAA;;AAAA,6CAGID,OAAO,CAACC,OAHZ;;AAAA;AAKLJ,YAAAA,kBAAkB,GAAGA,kBAAkB,IAAIK,WAAW,CAACH,OAAD,CAAtD;AALK;AAAA,mBAMQF,kBANR;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SASQK,W;;;;;2EAAf,kBAA2BH,OAA3B;AAAA;AAAA;AAAA;AAAA;AAAA;AACEA,YAAAA,OAAO,CAACI,WAAR,GAAsBJ,OAAO,CAACI,WAAR,IAAuB,OAA7C;AADF;AAAA,mBAEwB,8BAAY,YAAZ,EAA0B,SAA1B,EAAqCJ,OAArC,CAFxB;;AAAA;AAEQE,YAAAA,OAFR;AAAA,8CAMSA,OAAO,IAAIG,UAAU,CAACH,OAN/B;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import {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,14 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = parseVideo;
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
function parseVideo(_x) {
|
|
15
|
+
return _parseVideo.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _parseVideo() {
|
|
19
|
+
_parseVideo = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
20
|
+
var blob, video;
|
|
21
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) {
|
|
23
|
+
switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
blob = new Blob([arrayBuffer]);
|
|
26
|
+
video = document.createElement('video');
|
|
27
|
+
video.src = URL.createObjectURL(blob);
|
|
28
|
+
return _context.abrupt("return", video);
|
|
29
|
+
|
|
30
|
+
case 4:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, _callee);
|
|
36
|
+
}));
|
|
37
|
+
return _parseVideo.apply(this, arguments);
|
|
13
38
|
}
|
|
14
39
|
//# sourceMappingURL=parse-video.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parsers/parse-video.ts"],"names":["parseVideo","arrayBuffer","blob","Blob","video","document","createElement","src","URL","createObjectURL"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/parsers/parse-video.ts"],"names":["parseVideo","arrayBuffer","blob","Blob","video","document","createElement","src","URL","createObjectURL"],"mappings":";;;;;;;;;;;;;SAC8BA,U;;;;;0EAAf,iBAA0BC,WAA1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAIPC,YAAAA,IAJO,GAIA,IAAIC,IAAJ,CAAS,CAACF,WAAD,CAAT,CAJA;AAKPG,YAAAA,KALO,GAKCC,QAAQ,CAACC,aAAT,CAAuB,OAAvB,CALD;AAMbF,YAAAA,KAAK,CAACG,GAAN,GAAYC,GAAG,CAACC,eAAJ,CAAoBP,IAApB,CAAZ;AANa,6CAONE,KAPM;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["// 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"],"file":"parse-video.js"}
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.nodeVersion = exports.isWorker = exports.isBrowser = exports.document = exports.global = exports.window = exports.self = void 0;
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var globals = {
|
|
8
13
|
self: typeof self !== 'undefined' && self,
|
|
9
14
|
window: typeof window !== 'undefined' && window,
|
|
10
15
|
global: typeof global !== 'undefined' && global,
|
|
11
16
|
document: typeof document !== 'undefined' && document
|
|
12
17
|
};
|
|
13
|
-
|
|
18
|
+
var self_ = globals.self || globals.window || globals.global;
|
|
14
19
|
exports.self = self_;
|
|
15
|
-
|
|
20
|
+
var window_ = globals.window || globals.self || globals.global;
|
|
16
21
|
exports.window = window_;
|
|
17
|
-
|
|
22
|
+
var global_ = globals.global || globals.self || globals.window;
|
|
18
23
|
exports.global = global_;
|
|
19
|
-
|
|
24
|
+
var document_ = globals.document || {};
|
|
20
25
|
exports.document = document_;
|
|
21
|
-
|
|
26
|
+
var isBrowser = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) !== 'object' || String(process) !== '[object process]' || process.browser;
|
|
22
27
|
exports.isBrowser = isBrowser;
|
|
23
|
-
|
|
28
|
+
var isWorker = typeof importScripts === 'function';
|
|
24
29
|
exports.isWorker = isWorker;
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
var matches = typeof process !== 'undefined' && process.version && process.version.match(/v([0-9]*)/);
|
|
31
|
+
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
27
32
|
exports.nodeVersion = nodeVersion;
|
|
28
33
|
//# sourceMappingURL=globals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/utils/globals.js"],"names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","process","String","browser","isWorker","importScripts","matches","version","match","nodeVersion","parseFloat"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/globals.js"],"names":["globals","self","window","global","document","self_","window_","global_","document_","isBrowser","process","String","browser","isWorker","importScripts","matches","version","match","nodeVersion","parseFloat"],"mappings":";;;;;;;;;;;AAwBA,IAAMA,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAE,OAAOA,IAAP,KAAgB,WAAhB,IAA+BA,IADvB;AAEdC,EAAAA,MAAM,EAAE,OAAOA,MAAP,KAAkB,WAAlB,IAAiCA,MAF3B;AAGdC,EAAAA,MAAM,EAAE,OAAOA,MAAP,KAAkB,WAAlB,IAAiCA,MAH3B;AAIdC,EAAAA,QAAQ,EAAE,OAAOA,QAAP,KAAoB,WAApB,IAAmCA;AAJ/B,CAAhB;AAOA,IAAMC,KAAK,GAAGL,OAAO,CAACC,IAAR,IAAgBD,OAAO,CAACE,MAAxB,IAAkCF,OAAO,CAACG,MAAxD;;AACA,IAAMG,OAAO,GAAGN,OAAO,CAACE,MAAR,IAAkBF,OAAO,CAACC,IAA1B,IAAkCD,OAAO,CAACG,MAA1D;;AACA,IAAMI,OAAO,GAAGP,OAAO,CAACG,MAAR,IAAkBH,OAAO,CAACC,IAA1B,IAAkCD,OAAO,CAACE,MAA1D;;AACA,IAAMM,SAAS,GAAGR,OAAO,CAACI,QAAR,IAAoB,EAAtC;;AAIO,IAAMK,SAAS,GAEpB,QAAOC,OAAP,uDAAOA,OAAP,OAAmB,QAAnB,IAA+BC,MAAM,CAACD,OAAD,CAAN,KAAoB,kBAAnD,IAAyEA,OAAO,CAACE,OAF5E;;AAIA,IAAMC,QAAQ,GAAG,OAAOC,aAAP,KAAyB,UAA1C;;AAGP,IAAMC,OAAO,GACX,OAAOL,OAAP,KAAmB,WAAnB,IAAkCA,OAAO,CAACM,OAA1C,IAAqDN,OAAO,CAACM,OAAR,CAAgBC,KAAhB,CAAsB,WAAtB,CADvD;AAEO,IAAMC,WAAW,GAAIH,OAAO,IAAII,UAAU,CAACJ,OAAO,CAAC,CAAD,CAAR,CAAtB,IAAuC,CAA3D","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\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 deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// 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 FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// Purpose: include this in your module to avoids adding dependencies on\n// micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global,\n document: typeof document !== 'undefined' && document\n};\n\nconst self_ = globals.self || globals.window || globals.global;\nconst window_ = globals.window || globals.self || globals.global;\nconst global_ = globals.global || globals.self || globals.window;\nconst document_ = globals.document || {};\n\nexport {self_ as self, window_ as window, global_ as global, document_ as document};\n\nexport const isBrowser =\n // @ts-ignore\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n\nexport const isWorker = typeof importScripts === 'function';\n\n// Extract node major version\nconst matches =\n typeof process !== 'undefined' && process.version && process.version.match(/v([0-9]*)/);\nexport const nodeVersion = (matches && parseFloat(matches[1])) || 0;\n"],"file":"globals.js"}
|
package/dist/es5/video-loader.js
CHANGED
|
@@ -9,13 +9,13 @@ exports._typecheckVideoLoader = exports.VideoLoader = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _parseVideo = _interopRequireDefault(require("./lib/parsers/parse-video"));
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
13
|
+
var EXTENSIONS = ['mp4'];
|
|
14
|
+
var MIME_TYPES = ['video/mp4'];
|
|
15
|
+
var DEFAULT_LOADER_OPTIONS = {
|
|
16
16
|
video: {}
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
var VideoLoader = {
|
|
19
19
|
name: 'Video',
|
|
20
20
|
id: 'video',
|
|
21
21
|
module: 'video',
|
|
@@ -26,6 +26,6 @@ const VideoLoader = {
|
|
|
26
26
|
options: DEFAULT_LOADER_OPTIONS
|
|
27
27
|
};
|
|
28
28
|
exports.VideoLoader = VideoLoader;
|
|
29
|
-
|
|
29
|
+
var _typecheckVideoLoader = VideoLoader;
|
|
30
30
|
exports._typecheckVideoLoader = _typecheckVideoLoader;
|
|
31
31
|
//# sourceMappingURL=video-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/video-loader.ts"],"names":["VERSION","EXTENSIONS","MIME_TYPES","DEFAULT_LOADER_OPTIONS","video","VideoLoader","name","id","module","version","extensions","mimeTypes","parse","parseVideo","options","_typecheckVideoLoader"],"mappings":";;;;;;;;;AACA;;AAIA,
|
|
1
|
+
{"version":3,"sources":["../../src/video-loader.ts"],"names":["VERSION","EXTENSIONS","MIME_TYPES","DEFAULT_LOADER_OPTIONS","video","VideoLoader","name","id","module","version","extensions","mimeTypes","parse","parseVideo","options","_typecheckVideoLoader"],"mappings":";;;;;;;;;AACA;;AAIA,IAAMA,OAAO,GAAG,oBAAuB,WAAvB,cAAmD,QAAnE;AAEA,IAAMC,UAAU,GAAG,CAAC,KAAD,CAAnB;AACA,IAAMC,UAAU,GAAG,CAAC,WAAD,CAAnB;AAQA,IAAMC,sBAA0C,GAAG;AACjDC,EAAAA,KAAK,EAAE;AAD0C,CAAnD;AAIO,IAAMC,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,EAAE,EAAE,OAFqB;AAGzBC,EAAAA,MAAM,EAAE,OAHiB;AAIzBC,EAAAA,OAAO,EAAET,OAJgB;AAKzBU,EAAAA,UAAU,EAAET,UALa;AAMzBU,EAAAA,SAAS,EAAET,UANc;AAQzBU,EAAAA,KAAK,EAAEC,mBARkB;AAWzBC,EAAAA,OAAO,EAAEX;AAXgB,CAApB;;AAcA,IAAMY,qBAAuC,GAAGV,WAAhD","sourcesContent":["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"],"file":"video-loader.js"}
|
package/dist/esm/video-loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import parseVideo from './lib/parsers/parse-video';
|
|
2
|
-
const VERSION = typeof "3.0.
|
|
2
|
+
const VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : '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.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "Framework-independent loaders and writers for video (MP4, WEBM, ...)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"build-worker": "webpack --entry ./src/image-worker.js --output ./dist/image-worker.js --config ../../scripts/webpack/worker.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "3.0.
|
|
37
|
-
"@loaders.gl/worker-utils": "3.0.
|
|
36
|
+
"@loaders.gl/loader-utils": "3.0.14",
|
|
37
|
+
"@loaders.gl/worker-utils": "3.0.14",
|
|
38
38
|
"gifshot": "^0.4.5"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "dc931768fc34de549ef6baeb94e2ee5aa8163baf"
|
|
41
41
|
}
|