You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
quaggaJS/dist/quagga.min.js

3 lines
109 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(e.toString()):"object"==typeof exports?exports.Quagga=e(e.toString()):t.Quagga=e(e.toString())}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="/",e(0)}([function(t,e,n){t.exports=n(1)},function(e,n,r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function a(t){s(t),O=L["default"].create(tt.decoder,A)}function i(){if("undefined"!=typeof document)for(var t=[{node:document.querySelector("div[data-controls]"),prop:tt.controls},{node:K.dom.overlay,prop:tt.visual.show}],e=0;e<t.length;e++)t[e].node&&(t[e].prop===!0?t[e].node.style.display="block":t[e].node.style.display="none")}function u(t){var e;if("VideoStream"===tt.inputStream.type)e=document.createElement("video"),b=Q.createVideoStream(e);else if("ImageStream"===tt.inputStream.type)b=Q.createImageStream();else if("LiveStream"===tt.inputStream.type){var n=document.querySelector("#interactive.viewport");n&&(e=n.querySelector("video"),e||(e=document.createElement("video"),n.appendChild(e))),b=Q.createLiveStream(e),F["default"].request(e,tt.inputStream.constraints,function(e){return e?t(e):void b.trigger("canrecord")})}b.setAttribute("preload","auto"),b.setAttribute("autoplay",!0),b.setInputStream(tt.inputStream),b.addEventListener("canrecord",c.bind(void 0,t))}function c(t){I["default"].checkImageConstraints(b,tt.locator),f(),R=Z.create(b,K.dom.image),i(),tt.numOfWorkers>0?y(function(){console.log("Workers created"),l(t)}):(a(),l(t))}function l(t){b.play(),t()}function f(){if("undefined"!=typeof document){var t=document.querySelector("#interactive.viewport");if(K.dom.image=document.querySelector("canvas.imgBuffer"),K.dom.image||(K.dom.image=document.createElement("canvas"),K.dom.image.className="imgBuffer",t&&"ImageStream"===tt.inputStream.type&&t.appendChild(K.dom.image)),K.ctx.image=K.dom.image.getContext("2d"),K.dom.image.width=b.getCanvasSize().x,K.dom.image.height=b.getCanvasSize().y,K.dom.overlay=document.querySelector("canvas.drawingBuffer"),!K.dom.overlay){K.dom.overlay=document.createElement("canvas"),K.dom.overlay.className="drawingBuffer",t&&t.appendChild(K.dom.overlay);var e=document.createElement("br");e.setAttribute("clear","all"),t&&t.appendChild(e)}K.ctx.overlay=K.dom.overlay.getContext("2d"),K.dom.overlay.width=b.getCanvasSize().x,K.dom.overlay.height=b.getCanvasSize().y}}function s(t){A=t?t:new P["default"]({x:b.getWidth(),y:b.getHeight()}),console.log(A.size),C=[Y.vec2.clone([0,0]),Y.vec2.clone([0,A.size.y]),Y.vec2.clone([A.size.x,A.size.y]),Y.vec2.clone([A.size.x,0])],I["default"].init(A,tt.locator)}function d(){return tt.locate?I["default"].locate():[[Y.vec2.clone(C[0]),Y.vec2.clone(C[1]),Y.vec2.clone(C[2]),Y.vec2.clone(C[3])]]}function h(t){function e(t){for(var e=t.length;e--;)t[e][0]+=a,t[e][1]+=i}function n(t){t[0].x+=a,t[0].y+=i,t[1].x+=a,t[1].y+=i}var r,o=b.getTopRight(),a=o.x,i=o.y;if(t&&(0!==a||0!==i)&&(t.line&&2===t.line.length&&n(t.line),t.boxes&&t.boxes.length>0))for(r=0;r<t.boxes.length;r++)e(t.boxes[r])}function p(t,e){J&&(h(t),e&&t&&t.codeResult&&T&&T.addResult(e,b.getCanvasSize(),t.codeResult)),U["default"].publish("processed",t),t&&t.codeResult&&U["default"].publish("detected",t)}function v(){var t,e;e=d(),e?(t=O.decodeFromBoundingBoxes(e),t=t||{},t.boxes=e,p(t,A.data)):p()}function g(){var t;if(J){if($.length>0){if(t=$.filter(function(t){return!t.busy})[0],!t)return;R.attachData(t.imageData)}else R.attachData(A.data);R.grab()&&(t?(t.busy=!0,t.worker.postMessage({cmd:"process",imageData:t.imageData},[t.imageData.buffer])):v())}else v()}function m(){E=!1,function t(){E||(g(),J&&"LiveStream"===tt.inputStream.type&&window.requestAnimFrame(t))}()}function y(t){function e(e){$.push(e),$.length>=tt.numOfWorkers&&t()}var n;for($=[],n=0;n<tt.numOfWorkers;n++)_(e)}function _(t){var e,n={worker:void 0,imageData:new Uint8Array(b.getWidth()*b.getHeight()),busy:!0};e=M(),n.worker=new Worker(e),n.worker.onmessage=function(r){return"initialized"===r.data.event?(URL.revokeObjectURL(e),n.busy=!1,n.imageData=new Uint8Array(r.data.imageData),console.log("Worker initialized"),t(n)):void("processed"===r.data.event?(n.imageData=new Uint8Array(r.data.imageData),n.busy=!1,p(r.data.result,n.imageData)):"error"===r.data.event&&console.log("Worker error: "+r.data.message))},n.worker.postMessage({cmd:"init",size:{x:b.getWidth(),y:b.getHeight()},imageData:n.imageData,config:tt},[n.imageData.buffer])}function x(t){function e(t){self.postMessage({event:"processed",imageData:o.data,result:t},[o.data.buffer])}function n(){self.postMessage({event:"initialized",imageData:o.data},[o.data.buffer])}if(t){var r=t();if(!r)return void self.postMessage({event:"error",message:"Quagga could not be created"})}var o;self.onmessage=function(t){if("init"===t.data.cmd){var a=t.data.config;a.numOfWorkers=0,o=new r.ImageWrapper({x:t.data.size.x,y:t.data.size.y},new Uint8Array(t.data.imageData)),r.init(a,n,o),r.onProcessed(e)}else"process"===t.data.cmd?(o.data=new Uint8Array(t.data.imageData),r.start()):"setReaders"===t.data.cmd&&r.setReaders(t.data.readers)}}function M(){var e,n;return"undefined"!=typeof t&&(n=t),e=new Blob(["("+x.toString()+")("+n+");"],{type:"text/javascript"}),window.URL.createObjectURL(e)}function w(t){O?O.setReaders(t):J&&$.length>0&&$.forEach(function(e){e.worker.postMessage({cmd:"setReaders",readers:t})})}Object.defineProperty(n,"__esModule",{value:!0});var b,R,E,A,C,O,T,D=r(2),S=(o(D),r(3)),P=o(S),z=r(18),I=o(z),N=r(23),L=o(N),j=r(68),k=o(j),q=r(69),U=o(q),W=r(70),F=o(W),B=r(22),G=o(B),Y=r(7),V=r(71),H=o(V),X=r(35),Q=r(72),Z=r(74),K={ctx:{image:null,overlay:null},dom:{image:null,overlay:null}},$=[],J=!0,tt={};n["default"]={init:function(t,e,n){return tt=X({},k["default"],t),n?(J=!1,a(n),e()):void u(e)},start:function(){m()},stop:function(){E=!0,$.forEach(function(t){t.worker.terminate(),console.log("Worker terminated!")}),$.length=0,"LiveStream"===tt.inputStream.type&&(F["default"].release(),b.clearEventHandlers())},pause:function(){E=!0},onDetected:function(t){U["default"].subscribe("detected",t)},offDetected:function(t){U["default"].unsubscribe("detected",t)},onProcessed:function(t){U["default"].subscribe("processed",t)},offProcessed:function(t){U["default"].unsubscribe("processed",t)},setReaders:function(t){w(t)},registerResultCollector:function(t){t&&"function"==typeof t.addResult&&(T=t)},canvas:K,decodeSingle:function(t,e){t=X({inputStream:{type:"ImageStream",sequence:!1,size:800,src:t.src},numOfWorkers:1,locator:{halfSample:!1}},t),this.init(t,function(){U["default"].once("processed",function(t){E=!0,e.call(null,t)},!0),m()})},ImageWrapper:P["default"],ImageDebug:G["default"],ResultCollector:H["default"]},e.exports=n["default"]},function(t,e){"use strict";"undefined"!=typeof window&&(window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL),Math.imul=Math.imul||function(t,e){var n=t>>>16&65535,r=65535&t,o=e>>>16&65535,a=65535&e;return r*a+(n*a+r*o<<16>>>0)|0}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,n,r){e?this.data=e:n?(this.data=new n(t.x*t.y),n===Array&&r&&f["default"].init(this.data,0)):(this.data=new Uint8Array(t.x*t.y),Uint8Array===Array&&r&&f["default"].init(this.data,0)),this.size=t}Object.defineProperty(e,"__esModule",{value:!0});var a=n(4),i=r(a),u=n(5),c=r(u),l=n(17),f=r(l),s=n(7);o.prototype.inImageWithBorder=function(t,e){return t.x>=e&&t.y>=e&&t.x<this.size.x-e&&t.y<this.size.y-e},o.sample=function(t,e,n){var r=Math.floor(e),o=Math.floor(n),a=t.size.x,i=o*t.size.x+r,u=t.data[i+0],c=t.data[i+1],l=t.data[i+a],f=t.data[i+a+1],s=u-c;e-=r,n-=o;var d=Math.floor(e*(n*(s-l+f)-s)+n*(l-u)+u);return d},o.clearArray=function(t){for(var e=t.length;e--;)t[e]=0},o.prototype.subImage=function(t,e){return new i["default"](t,e,this)},o.prototype.subImageAsCopy=function(t,e){var n,r,o=t.size.y,a=t.size.x;for(n=0;a>n;n++)for(r=0;o>r;r++)t.data[r*a+n]=this.data[(e.y+r)*this.size.x+e.x+n]},o.prototype.copyTo=function(t){for(var e=this.data.length,n=this.data,r=t.data;e--;)r[e]=n[e]},o.prototype.get=function(t,e){return this.data[e*this.size.x+t]},o.prototype.getSafe=function(t,e){var n;if(!this.indexMapping){for(this.indexMapping={x:[],y:[]},n=0;n<this.size.x;n++)this.indexMapping.x[n]=n,this.indexMapping.x[n+this.size.x]=n;for(n=0;n<this.size.y;n++)this.indexMapping.y[n]=n,this.indexMapping.y[n+this.size.y]=n}return this.data[this.indexMapping.y[e+this.size.y]*this.size.x+this.indexMapping.x[t+this.size.x]]},o.prototype.set=function(t,e,n){return this.data[e*this.size.x+t]=n,this},o.prototype.zeroBorder=function(){var t,e=this.size.x,n=this.size.y,r=this.data;for(t=0;e>t;t++)r[t]=r[(n-1)*e+t]=0;for(t=1;n-1>t;t++)r[t*e]=r[t*e+(e-1)]=0},o.prototype.invert=function(){for(var t=this.data,e=t.length;e--;)t[e]=t[e]?0:1},o.prototype.convolve=function(t){var e,n,r,o,a=t.length/2|0,i=0;for(n=0;n<this.size.y;n++)for(e=0;e<this.size.x;e++){for(i=0,o=-a;a>=o;o++)for(r=-a;a>=r;r++)i+=t[o+a][r+a]*this.getSafe(e+r,n+o);this.data[n*this.size.x+e]=i}},o.prototype.moments=function(t){var e,n,r,o,a,i,u,c,l,f,d,h,p=this.data,v=this.size.y,g=this.size.x,m=[],y=[],_=Math.PI,x=_/4;if(0>=t)return y;for(a=0;t>a;a++)m[a]={m00:0,m01:0,m10:0,m11:0,m02:0,m20:0,theta:0,rad:0};for(n=0;v>n;n++)for(o=n*n,e=0;g>e;e++)r=p[n*g+e],r>0&&(i=m[r-1],i.m00+=1,i.m01+=n,i.m10+=e,i.m11+=e*n,i.m02+=o,i.m20+=e*e);for(a=0;t>a;a++)i=m[a],isNaN(i.m00)||0===i.m00||(f=i.m10/i.m00,d=i.m01/i.m00,u=i.m11/i.m00-f*d,c=i.m02/i.m00-d*d,l=i.m20/i.m00-f*f,h=(c-l)/(2*u),h=.5*Math.atan(h)+(u>=0?x:-x)+_,i.theta=(180*h/_+90)%180-90,i.theta<0&&(i.theta+=180),i.rad=h>_?h-_:h,i.vec=s.vec2.clone([Math.cos(h),Math.sin(h)]),y.push(i));return y},o.prototype.show=function(t,e){var n,r,o,a,i,u,c;for(e||(e=1),n=t.getContext("2d"),t.width=this.size.x,t.height=this.size.y,r=n.getImageData(0,0,t.width,t.height),o=r.data,a=0,c=0;c<this.size.y;c++)for(u=0;u<this.size.x;u++)i=c*this.size.x+u,a=this.get(u,c)*e,o[4*i+0]=a,o[4*i+1]=a,o[4*i+2]=a,o[4*i+3]=255;n.putImageData(r,0,0)},o.prototype.overlay=function(t,e,n){(!e||0>e||e>360)&&(e=360);for(var r=[0,1,1],o=[0,0,0],a=[255,255,255],i=[0,0,0],u=[],l=t.getContext("2d"),f=l.getImageData(n.x,n.y,this.size.x,this.size.y),s=f.data,d=this.data.length;d--;)r[0]=this.data[d]*e,u=r[0]<=0?a:r[0]>=360?i:c["default"].hsv2rgb(r,o),s[4*d+0]=u[0],s[4*d+1]=u[1],s[4*d+2]=u[2],s[4*d+3]=255;l.putImageData(f,n.x,n.y)},e["default"]=o,t.exports=e["default"]},function(t,e){"use strict";function n(t,e,n){n||(n={data:null,size:e}),this.data=n.data,this.originalSize=n.size,this.I=n,this.from=t,this.size=e}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype.show=function(t,e){var n,r,o,a,i,u,c;for(e||(e=1),n=t.getContext("2d"),t.width=this.size.x,t.height=this.size.y,r=n.getImageData(0,0,t.width,t.height),o=r.data,a=0,i=0;i<this.size.y;i++)for(u=0;u<this.size.x;u++)c=i*this.size.x+u,a=this.get(u,i)*e,o[4*c+0]=a,o[4*c+1]=a,o[4*c+2]=a,o[4*c+3]=255;r.data=o,n.putImageData(r,0,0)},n.prototype.get=function(t,e){return this.data[(this.from.y+e)*this.originalSize.x+this.from.x+t]},n.prototype.updateData=function(t){this.originalSize=t.size,this.data=t.data},n.prototype.updateFrom=function(t){return this.from=t,this},e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(6),a=r(o),i=n(17),u=r(i),c=n(7),l={};l.imageRef=function(t,e){var n={x:t,y:e,toVec2:function(){return c.vec2.clone([this.x,this.y])},toVec3:function(){return c.vec3.clone([this.x,this.y,1])},round:function(){return this.x=this.x>0?Math.floor(this.x+.5):Math.floor(this.x-.5),this.y=this.y>0?Math.floor(this.y+.5):Math.floor(this.y-.5),this}};return n},l.computeIntegralImage2=function(t,e){var n,r,o=t.data,a=t.size.x,i=t.size.y,u=e.data,c=0,l=0,f=0,s=0,d=0;for(f=a,c=0,r=1;i>r;r++)c+=o[l],u[f]+=c,l+=a,f+=a;for(l=0,f=1,c=0,n=1;a>n;n++)c+=o[l],u[f]+=c,l++,f++;for(r=1;i>r;r++)for(l=r*a+1,f=(r-1)*a+1,s=r*a,d=(r-1)*a,n=1;a>n;n++)u[l]+=o[l]+u[f]+u[s]-u[d],l++,f++,s++,d++},l.computeIntegralImage=function(t,e){for(var n=t.data,r=t.size.x,o=t.size.y,a=e.data,i=0,u=0;r>u;u++)i+=n[u],a[u]=i;for(var c=1;o>c;c++){i=0;for(var l=0;r>l;l++)i+=n[c*r+l],a[c*r+l]=i+a[(c-1)*r+l]}},l.thresholdImage=function(t,e,n){n||(n=t);for(var r=t.data,o=r.length,a=n.data;o--;)a[o]=r[o]<e?1:0},l.computeHistogram=function(t,e){e||(e=8);for(var n=t.data,r=n.length,o=8-e,a=1<<e,i=new Int32Array(a);r--;)i[n[r]>>o]++;return i},l.sharpenLine=function(t){var e,n,r=t.length,o=t[0],a=t[1];for(e=1;r-1>e;e++)n=t[e+1],t[e-1]=2*a-o-n&255,o=a,a=n;return t},l.determineOtsuThreshold=function(t,e){function n(t,e){var n,r=0;for(n=t;e>=n;n++)r+=a[n];return r}function r(t,e){var n,r=0;for(n=t;e>=n;n++)r+=n*a[n];return r}function o(){var o,i,c,f,s,d,h,p=[0],v=(1<<e)-1;for(a=l.computeHistogram(t,e),f=1;v>f;f++)o=n(0,f),i=n(f+1,v),c=o*i,0===c&&(c=1),s=r(0,f)*i,d=r(f+1,v)*o,h=s-d,p[f]=h*h/c;return u["default"].maxIndex(p)}e||(e=8);var a,i,c=8-e;return i=o(),i<<c},l.otsuThreshold=function(t,e){var n=l.determineOtsuThreshold(t);return l.thresholdImage(t,n,e),n},l.computeBinaryImage=function(t,e,n){l.computeIntegralImage(t,e),n||(n=t);var r,o,a,i,u,c,f,s=t.data,d=n.data,h=t.size.x,p=t.size.y,v=e.data,g=0,m=3,y=(2*m+1)*(2*m+1);for(r=0;m>=r;r++)for(o=0;h>o;o++)d[r*h+o]=0,d[(p-1-r)*h+o]=0;for(r=m;p-m>r;r++)for(o=0;m>=o;o++)d[r*h+o]=0,d[r*h+(h-1-o)]=0;for(r=m+1;p-m-1>r;r++)for(o=m+1;h-m>o;o++)a=v[(r-m-1)*h+(o-m-1)],i=v[(r-m-1)*h+(o+m)],u=v[(r+m)*h+(o-m-1)],c=v[(r+m)*h+(o+m)],g=c-u-i+a,f=g/y,d[r*h+o]=s[r*h+o]>f+5?0:1},l.cluster=function(t,e,n){function r(t){var e=!1;for(i=0;i<l.length;i++)u=l[i],u.fits(t)&&(u.add(t),e=!0);return e}var o,i,u,c,l=[];for(n||(n="rad"),o=0;o<t.length;o++)c=a["default"].createPoint(t[o],o,n),r(c)||l.push(a["default"].create(c,e));return l},l.Tracer={trace:function f(t,e){function f(n,r){function o(t,e){return t.x>e.x-l&&t.x<e.x+l&&t.y>e.y-f&&t.y<e.y+f?!0:!1}var a,i,u,c,l=1,f=Math.abs(e[1]/10),s=!1;for(a=t[n],c=r?{x:a.x+e[0],y:a.y+e[1]}:{x:a.x-e[0],y:a.y-e[1]},u=r?n+1:n-1,i=t[u];i&&(s=o(i,c))!==!0&&Math.abs(i.y-a.y)<e[1];)u=r?u+1:u-1,i=t[u];return s?u:null}var n,r=10,o=[],a=[],i=0,u=0;for(n=0;r>n;n++){for(i=Math.floor(Math.random()*t.length),o=[],u=i,o.push(t[u]);null!==(u=f(u,!0));)o.push(t[u]);if(i>0)for(u=i;null!==(u=f(u,!1));)o.push(t[u]);o.length>a.length&&(a=o)}return a}},l.DILATE=1,l.ERODE=2,l.dilate=function(t,e){var n,r,o,a,i,u,c,l=t.data,f=e.data,s=t.size.y,d=t.size.x;for(n=1;s-1>n;n++)for(r=1;d-1>r;r++)a=n-1,i=n+1,u=r-1,c=r+1,o=l[a*d+u]+l[a*d+c]+l[n*d+r]+l[i*d+u]+l[i*d+c],f[n*d+r]=o>0?1:0},l.erode=function(t,e){var n,r,o,a,i,u,c,l=t.data,f=e.data,s=t.size.y,d=t.size.x;for(n=1;s-1>n;n++)for(r=1;d-1>r;r++)a=n-1,i=n+1,u=r-1,c=r+1,o=l[a*d+u]+l[a*d+c]+l[n*d+r]+l[i*d+u]+l[i*d+c],f[n*d+r]=5===o?1:0},l.subtract=function(t,e,n){n||(n=t);for(var r=t.data.length,o=t.data,a=e.data,i=n.data;r--;)i[r]=o[r]-a[r]},l.bitwiseOr=function(t,e,n){n||(n=t);for(var r=t.data.length,o=t.data,a=e.data,i=n.data;r--;)i[r]=o[r]||a[r]},l.countNonZero=function(t){for(var e=t.data.length,n=t.data,r=0;e--;)r+=n[e];return r},l.topGeneric=function(t,e,n){var r,o,a,i,u=0,c=0,l=[];for(r=0;e>r;r++)l[r]={score:0,item:null};for(r=0;r<t.length;r++)if(o=n.apply(this,[t[r]]),o>c)for(a=l[u],a.score=o,a.item=t[r],c=Number.MAX_VALUE,i=0;e>i;i++)l[i].score<c&&(c=l[i].score,u=i);return l},l.grayArrayFromImage=function(t,e,n,r){n.drawImage(t,e,0,t.width,t.height);var o=n.getImageData(e,0,t.width,t.height).data;l.computeGray(o,r)},l.grayArrayFromContext=function(t,e,n,r){var o=t.getImageData(n.x,n.y,e.x,e.y).data;l.computeGray(o,r)},l.grayAndHalfSampleFromCanvasData=function(t,e,n){for(var r,o=0,a=e.x,i=Math.floor(t.length/4),u=e.x/2,c=0,l=e.x;i>a;){for(r=0;u>r;r++)n[c]=Math.floor((.299*t[4*o+0]+.587*t[4*o+1]+.114*t[4*o+2]+(.299*t[4*(o+1)+0]+.587*t[4*(o+1)+1]+.114*t[4*(o+1)+2])+(.299*t[4*a+0]+.587*t[4*a+1]+.114*t[4*a+2])+(.299*t[4*(a+1)+0]+.587*t[4*(a+1)+1]+.114*t[4*(a+1)+2]))/4),c++,o+=2,a+=2;o+=l,a+=l}},l.computeGray=function(t,e,n){var r,o=t.length/4|0,a=n&&n.singleChannel===!0;if(a)for(r=0;o>r;r++)e[r]=t[4*r+0];else for(r=0;o>r;r++)e[r]=Math.floor(.299*t[4*r+0]+.587*t[4*r+1]+.114*t[4*r+2])},l.loadImageArray=function(t,e,n){n||(n=document.createElement("canvas"));var r=new Image;r.callback=e,r.onload=function(){n.width=this.width,n.height=this.height;var t=n.getContext("2d");t.drawImage(this,0,0);var e=new Uint8Array(this.width*this.height);t.drawImage(this,0,0);var r=t.getImageData(0,0,this.width,this.height).data;l.computeGray(r,e),this.callback(e,{x:this.width,y:this.height},this)},r.src=t},l.halfSample=function(t,e){for(var n=t.data,r=t.size.x,o=e.data,a=0,i=r,u=n.length,c=r/2,l=0;u>i;){for(var f=0;c>f;f++)o[l]=Math.floor((n[a]+n[a+1]+n[i]+n[i+1])/4),l++,a+=2,i+=2;a+=r,i+=r}},l.hsv2rgb=function(t,e){var n=t[0],r=t[1],o=t[2],a=o*r,i=a*(1-Math.abs(n/60%2-1)),u=o-a,c=0,l=0,f=0;return e=e||[0,0,0],60>n?(c=a,l=i):120>n?(c=i,l=a):180>n?(l=a,f=i):240>n?(l=i,f=a):300>n?(c=i,f=a):360>n&&(c=a,f=i),e[0]=255*(c+u)|0,e[1]=255*(l+u)|0,e[2]=255*(f+u)|0,e},l._computeDivisors=function(t){var e,n=[],r=[];for(e=1;e<Math.sqrt(t)+1;e++)t%e===0&&(r.push(e),e!==t/e&&n.unshift(Math.floor(t/e)));return r.concat(n)},l._computeIntersection=function(t,e){for(var n=0,r=0,o=[];n<t.length&&r<e.length;)t[n]===e[r]?(o.push(t[n]),n++,r++):t[n]>e[r]?r++:n++;return o},l.calculatePatchSize=function(t,e){function n(t){for(var e=0,n=t[Math.floor(t.length/2)];e<t.length-1&&t[e]<d;)e++;return e>0&&(n=Math.abs(t[e]-d)>Math.abs(t[e-1]-d)?t[e-1]:t[e]),d/n<c[f+1]/c[f]&&d/n>c[f-1]/c[f]?{x:n,y:n}:null}var r,o=this._computeDivisors(e.x),a=this._computeDivisors(e.y),i=Math.max(e.x,e.y),u=this._computeIntersection(o,a),c=[8,10,15,20,32,60,80],l={"x-small":5,small:4,medium:3,large:2,"x-large":1},f=l[t]||l.medium,s=c[f],d=Math.floor(i/s);return r=n(u),r||(r=n(this._computeDivisors(i)),r||(r=n(this._computeDivisors(d*s)))),r},l._parseCSSDimensionValues=function(t){var e={value:parseFloat(t),unit:(t.indexOf("%")===t.length-1,"%")};return e},l._dimensionsConverters={top:function(t,e){return"%"===t.unit?Math.floor(e.height*(t.value/100)):void 0},right:function(t,e){return"%"===t.unit?Math.floor(e.width-e.width*(t.value/100)):void 0},bottom:function(t,e){return"%"===t.unit?Math.floor(e.height-e.height*(t.value/100)):void 0},left:function(t,e){return"%"===t.unit?Math.floor(e.width*(t.value/100)):void 0}},l.computeImageArea=function(t,e,n){var r={width:t,height:e},o=Object.keys(n).reduce(function(t,e){var o=n[e],a=l._parseCSSDimensionValues(o),i=l._dimensionsConverters[e](a,r);return t[e]=i,t},{});return{sx:o.left,sy:o.top,sw:o.right-o.left,sh:o.bottom-o.top}},e["default"]=l,t.exports=e["default"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(7);e["default"]={create:function(t,e){function n(){o(t),a()}function o(t){c[t.id]=t,i.push(t)}function a(){var t,e=0;for(t=0;t<i.length;t++)e+=i[t].rad;u.rad=e/i.length,u.vec=r.vec2.clone([Math.cos(u.rad),Math.sin(u.rad)])}var i=[],u={rad:0,vec:r.vec2.clone([0,0])},c={};return n(),{add:function(t){c[t.id]||(o(t),a())},fits:function(t){var n=Math.abs(r.vec2.dot(t.point.vec,u.vec));return n>e?!0:!1},getPoints:function(){return i},getCenter:function(){return u}}},createPoint:function(t,e,n){return{rad:t[n],point:t,id:e}}},t.exports=e["default"]},function(t,e,n){e.glMatrix=n(8),e.mat2=n(9),e.mat2d=n(10),e.mat3=n(11),e.mat4=n(12),e.quat=n(13),e.vec2=n(16),e.vec3=n(14),e.vec4=n(15)},function(t,e){var n={};n.EPSILON=1e-6,n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random,n.setMatrixArrayType=function(t){GLMAT_ARRAY_TYPE=t};var r=Math.PI/180;n.toRadian=function(t){return t*r},t.exports=n},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},o.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},o.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},o.invert=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=n*a-o*r;return i?(i=1/i,t[0]=a*i,t[1]=-r*i,t[2]=-o*i,t[3]=n*i,t):null},o.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},o.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},o.multiply=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=n[0],c=n[1],l=n[2],f=n[3];return t[0]=r*u+a*c,t[1]=o*u+i*c,t[2]=r*l+a*f,t[3]=o*l+i*f,t},o.mul=o.multiply,o.rotate=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=Math.sin(n),c=Math.cos(n);return t[0]=r*c+a*u,t[1]=o*c+i*u,t[2]=r*-u+a*c,t[3]=o*-u+i*c,t},o.scale=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=n[0],c=n[1];return t[0]=r*u,t[1]=o*u,t[2]=a*c,t[3]=i*c,t},o.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},o.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},o.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},o.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},t.exports=o},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},o.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},o.invert=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=n*a-r*o;return c?(c=1/c,t[0]=a*c,t[1]=-r*c,t[2]=-o*c,t[3]=n*c,t[4]=(o*u-a*i)*c,t[5]=(r*i-n*u)*c,t):null},o.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},o.multiply=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=n[0],f=n[1],s=n[2],d=n[3],h=n[4],p=n[5];return t[0]=r*l+a*f,t[1]=o*l+i*f,t[2]=r*s+a*d,t[3]=o*s+i*d,t[4]=r*h+a*p+u,t[5]=o*h+i*p+c,t},o.mul=o.multiply,o.rotate=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=Math.sin(n),f=Math.cos(n);return t[0]=r*f+a*l,t[1]=o*f+i*l,t[2]=r*-l+a*f,t[3]=o*-l+i*f,t[4]=u,t[5]=c,t},o.scale=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=n[0],f=n[1];return t[0]=r*l,t[1]=o*l,t[2]=a*f,t[3]=i*f,t[4]=u,t[5]=c,t},o.translate=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=n[0],f=n[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=r*l+a*f+u,t[5]=o*l+i*f+c,t},o.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},o.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},o.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},o.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},t.exports=o},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},o.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},o.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},o.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},o.invert=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],l=e[7],f=e[8],s=f*i-u*l,d=-f*a+u*c,h=l*a-i*c,p=n*s+r*d+o*h;return p?(p=1/p,t[0]=s*p,t[1]=(-f*r+o*l)*p,t[2]=(u*r-o*i)*p,t[3]=d*p,t[4]=(f*n-o*c)*p,t[5]=(-u*n+o*a)*p,t[6]=h*p,t[7]=(-l*n+r*c)*p,t[8]=(i*n-r*a)*p,t):null},o.adjoint=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],l=e[7],f=e[8];return t[0]=i*f-u*l,t[1]=o*l-r*f,t[2]=r*u-o*i,t[3]=u*c-a*f,t[4]=n*f-o*c,t[5]=o*a-n*u,t[6]=a*l-i*c,t[7]=r*c-n*l,t[8]=n*i-r*a,t},o.determinant=function(t){var e=t[0],n=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],c=t[7],l=t[8];return e*(l*a-i*c)+n*(-l*o+i*u)+r*(c*o-a*u)},o.multiply=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=e[6],f=e[7],s=e[8],d=n[0],h=n[1],p=n[2],v=n[3],g=n[4],m=n[5],y=n[6],_=n[7],x=n[8];return t[0]=d*r+h*i+p*l,t[1]=d*o+h*u+p*f,t[2]=d*a+h*c+p*s,t[3]=v*r+g*i+m*l,t[4]=v*o+g*u+m*f,t[5]=v*a+g*c+m*s,t[6]=y*r+_*i+x*l,t[7]=y*o+_*u+x*f,t[8]=y*a+_*c+x*s,t},o.mul=o.multiply,o.translate=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=e[6],f=e[7],s=e[8],d=n[0],h=n[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=c,t[6]=d*r+h*i+l,t[7]=d*o+h*u+f,t[8]=d*a+h*c+s,t},o.rotate=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=e[6],f=e[7],s=e[8],d=Math.sin(n),h=Math.cos(n);return t[0]=h*r+d*i,t[1]=h*o+d*u,t[2]=h*a+d*c,t[3]=h*i-d*r,t[4]=h*u-d*o,t[5]=h*c-d*a,t[6]=l,t[7]=f,t[8]=s,t},o.scale=function(t,e,n){var r=n[0],o=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},o.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},o.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},o.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},o.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},o.fromQuat=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=n+n,u=r+r,c=o+o,l=n*i,f=r*i,s=r*u,d=o*i,h=o*u,p=o*c,v=a*i,g=a*u,m=a*c;return t[0]=1-s-p,t[3]=f-m,t[6]=d+g,t[1]=f+m,t[4]=1-l-p,t[7]=h-v,t[2]=d-g,t[5]=h+v,t[8]=1-l-s,t},o.normalFromMat4=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],l=e[7],f=e[8],s=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],m=e[15],y=n*u-r*i,_=n*c-o*i,x=n*l-a*i,M=r*c-o*u,w=r*l-a*u,b=o*l-a*c,R=f*v-s*p,E=f*g-d*p,A=f*m-h*p,C=s*g-d*v,O=s*m-h*v,T=d*m-h*g,D=y*T-_*O+x*C+M*A-w*E+b*R;return D?(D=1/D,t[0]=(u*T-c*O+l*C)*D,t[1]=(c*A-i*T-l*E)*D,t[2]=(i*O-u*A+l*R)*D,t[3]=(o*O-r*T-a*C)*D,t[4]=(n*T-o*A+a*E)*D,t[5]=(r*A-n*O-a*R)*D,t[6]=(v*b-g*w+m*M)*D,t[7]=(g*x-p*b-m*_)*D,t[8]=(p*w-v*x+m*y)*D,t):null},o.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},t.exports=o},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},o.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],o=e[3],a=e[6],i=e[7],u=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},o.invert=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],l=e[7],f=e[8],s=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],m=e[15],y=n*u-r*i,_=n*c-o*i,x=n*l-a*i,M=r*c-o*u,w=r*l-a*u,b=o*l-a*c,R=f*v-s*p,E=f*g-d*p,A=f*m-h*p,C=s*g-d*v,O=s*m-h*v,T=d*m-h*g,D=y*T-_*O+x*C+M*A-w*E+b*R;return D?(D=1/D,t[0]=(u*T-c*O+l*C)*D,t[1]=(o*O-r*T-a*C)*D,t[2]=(v*b-g*w+m*M)*D,t[3]=(d*w-s*b-h*M)*D,t[4]=(c*A-i*T-l*E)*D,t[5]=(n*T-o*A+a*E)*D,t[6]=(g*x-p*b-m*_)*D,t[7]=(f*b-d*x+h*_)*D,t[8]=(i*O-u*A+l*R)*D,t[9]=(r*A-n*O-a*R)*D,t[10]=(p*w-v*x+m*y)*D,t[11]=(s*x-f*w-h*y)*D,t[12]=(u*E-i*C-c*R)*D,t[13]=(n*C-r*E+o*R)*D,t[14]=(v*_-p*M-g*y)*D,t[15]=(f*M-s*_+d*y)*D,t):null},o.adjoint=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],l=e[7],f=e[8],s=e[9],d=e[10],h=e[11],p=e[12],v=e[13],g=e[14],m=e[15];return t[0]=u*(d*m-h*g)-s*(c*m-l*g)+v*(c*h-l*d),t[1]=-(r*(d*m-h*g)-s*(o*m-a*g)+v*(o*h-a*d)),t[2]=r*(c*m-l*g)-u*(o*m-a*g)+v*(o*l-a*c),t[3]=-(r*(c*h-l*d)-u*(o*h-a*d)+s*(o*l-a*c)),t[4]=-(i*(d*m-h*g)-f*(c*m-l*g)+p*(c*h-l*d)),t[5]=n*(d*m-h*g)-f*(o*m-a*g)+p*(o*h-a*d),t[6]=-(n*(c*m-l*g)-i*(o*m-a*g)+p*(o*l-a*c)),t[7]=n*(c*h-l*d)-i*(o*h-a*d)+f*(o*l-a*c),t[8]=i*(s*m-h*v)-f*(u*m-l*v)+p*(u*h-l*s),t[9]=-(n*(s*m-h*v)-f*(r*m-a*v)+p*(r*h-a*s)),t[10]=n*(u*m-l*v)-i*(r*m-a*v)+p*(r*l-a*u),t[11]=-(n*(u*h-l*s)-i*(r*h-a*s)+f*(r*l-a*u)),t[12]=-(i*(s*g-d*v)-f*(u*g-c*v)+p*(u*d-c*s)),t[13]=n*(s*g-d*v)-f*(r*g-o*v)+p*(r*d-o*s),t[14]=-(n*(u*g-c*v)-i*(r*g-o*v)+p*(r*c-o*u)),t[15]=n*(u*d-c*s)-i*(r*d-o*s)+f*(r*c-o*u),t},o.determinant=function(t){var e=t[0],n=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],c=t[7],l=t[8],f=t[9],s=t[10],d=t[11],h=t[12],p=t[13],v=t[14],g=t[15],m=e*i-n*a,y=e*u-r*a,_=e*c-o*a,x=n*u-r*i,M=n*c-o*i,w=r*c-o*u,b=l*p-f*h,R=l*v-s*h,E=l*g-d*h,A=f*v-s*p,C=f*g-d*p,O=s*g-d*v;return m*O-y*C+_*A+x*E-M*R+w*b},o.multiply=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=e[6],f=e[7],s=e[8],d=e[9],h=e[10],p=e[11],v=e[12],g=e[13],m=e[14],y=e[15],_=n[0],x=n[1],M=n[2],w=n[3];return t[0]=_*r+x*u+M*s+w*v,t[1]=_*o+x*c+M*d+w*g,t[2]=_*a+x*l+M*h+w*m,t[3]=_*i+x*f+M*p+w*y,_=n[4],x=n[5],M=n[6],w=n[7],t[4]=_*r+x*u+M*s+w*v,t[5]=_*o+x*c+M*d+w*g,t[6]=_*a+x*l+M*h+w*m,t[7]=_*i+x*f+M*p+w*y,_=n[8],x=n[9],M=n[10],w=n[11],t[8]=_*r+x*u+M*s+w*v,t[9]=_*o+x*c+M*d+w*g,t[10]=_*a+x*l+M*h+w*m,t[11]=_*i+x*f+M*p+w*y,_=n[12],x=n[13],M=n[14],w=n[15],t[12]=_*r+x*u+M*s+w*v,t[13]=_*o+x*c+M*d+w*g,t[14]=_*a+x*l+M*h+w*m,t[15]=_*i+x*f+M*p+w*y,t},o.mul=o.multiply,o.translate=function(t,e,n){var r,o,a,i,u,c,l,f,s,d,h,p,v=n[0],g=n[1],m=n[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*m+e[12],t[13]=e[1]*v+e[5]*g+e[9]*m+e[13],t[14]=e[2]*v+e[6]*g+e[10]*m+e[14],t[15]=e[3]*v+e[7]*g+e[11]*m+e[15]):(r=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],l=e[6],f=e[7],s=e[8],d=e[9],h=e[10],p=e[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=c,t[6]=l,t[7]=f,t[8]=s,t[9]=d,t[10]=h,t[11]=p,t[12]=r*v+u*g+s*m+e[12],t[13]=o*v+c*g+d*m+e[13],t[14]=a*v+l*g+h*m+e[14],t[15]=i*v+f*g+p*m+e[15]),t},o.scale=function(t,e,n){var r=n[0],o=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,
t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},o.rotate=function(t,e,n,o){var a,i,u,c,l,f,s,d,h,p,v,g,m,y,_,x,M,w,b,R,E,A,C,O,T=o[0],D=o[1],S=o[2],P=Math.sqrt(T*T+D*D+S*S);return Math.abs(P)<r.EPSILON?null:(P=1/P,T*=P,D*=P,S*=P,a=Math.sin(n),i=Math.cos(n),u=1-i,c=e[0],l=e[1],f=e[2],s=e[3],d=e[4],h=e[5],p=e[6],v=e[7],g=e[8],m=e[9],y=e[10],_=e[11],x=T*T*u+i,M=D*T*u+S*a,w=S*T*u-D*a,b=T*D*u-S*a,R=D*D*u+i,E=S*D*u+T*a,A=T*S*u+D*a,C=D*S*u-T*a,O=S*S*u+i,t[0]=c*x+d*M+g*w,t[1]=l*x+h*M+m*w,t[2]=f*x+p*M+y*w,t[3]=s*x+v*M+_*w,t[4]=c*b+d*R+g*E,t[5]=l*b+h*R+m*E,t[6]=f*b+p*R+y*E,t[7]=s*b+v*R+_*E,t[8]=c*A+d*C+g*O,t[9]=l*A+h*C+m*O,t[10]=f*A+p*C+y*O,t[11]=s*A+v*C+_*O,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},o.rotateX=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),a=e[4],i=e[5],u=e[6],c=e[7],l=e[8],f=e[9],s=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*o+l*r,t[5]=i*o+f*r,t[6]=u*o+s*r,t[7]=c*o+d*r,t[8]=l*o-a*r,t[9]=f*o-i*r,t[10]=s*o-u*r,t[11]=d*o-c*r,t},o.rotateY=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),a=e[0],i=e[1],u=e[2],c=e[3],l=e[8],f=e[9],s=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*o-l*r,t[1]=i*o-f*r,t[2]=u*o-s*r,t[3]=c*o-d*r,t[8]=a*r+l*o,t[9]=i*r+f*o,t[10]=u*r+s*o,t[11]=c*r+d*o,t},o.rotateZ=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),a=e[0],i=e[1],u=e[2],c=e[3],l=e[4],f=e[5],s=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*o+l*r,t[1]=i*o+f*r,t[2]=u*o+s*r,t[3]=c*o+d*r,t[4]=l*o-a*r,t[5]=f*o-i*r,t[6]=s*o-u*r,t[7]=d*o-c*r,t},o.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},o.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.fromRotation=function(t,e,n){var o,a,i,u=n[0],c=n[1],l=n[2],f=Math.sqrt(u*u+c*c+l*l);return Math.abs(f)<r.EPSILON?null:(f=1/f,u*=f,c*=f,l*=f,o=Math.sin(e),a=Math.cos(e),i=1-a,t[0]=u*u*i+a,t[1]=c*u*i+l*o,t[2]=l*u*i-c*o,t[3]=0,t[4]=u*c*i-l*o,t[5]=c*c*i+a,t[6]=l*c*i+u*o,t[7]=0,t[8]=u*l*i+c*o,t[9]=c*l*i-u*o,t[10]=l*l*i+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},o.fromXRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.fromYRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.fromZRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.fromRotationTranslation=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=r+r,c=o+o,l=a+a,f=r*u,s=r*c,d=r*l,h=o*c,p=o*l,v=a*l,g=i*u,m=i*c,y=i*l;return t[0]=1-(h+v),t[1]=s+y,t[2]=d-m,t[3]=0,t[4]=s-y,t[5]=1-(f+v),t[6]=p+g,t[7]=0,t[8]=d+m,t[9]=p-g,t[10]=1-(f+h),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},o.fromRotationTranslationScale=function(t,e,n,r){var o=e[0],a=e[1],i=e[2],u=e[3],c=o+o,l=a+a,f=i+i,s=o*c,d=o*l,h=o*f,p=a*l,v=a*f,g=i*f,m=u*c,y=u*l,_=u*f,x=r[0],M=r[1],w=r[2];return t[0]=(1-(p+g))*x,t[1]=(d+_)*x,t[2]=(h-y)*x,t[3]=0,t[4]=(d-_)*M,t[5]=(1-(s+g))*M,t[6]=(v+m)*M,t[7]=0,t[8]=(h+y)*w,t[9]=(v-m)*w,t[10]=(1-(s+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},o.fromRotationTranslationScaleOrigin=function(t,e,n,r,o){var a=e[0],i=e[1],u=e[2],c=e[3],l=a+a,f=i+i,s=u+u,d=a*l,h=a*f,p=a*s,v=i*f,g=i*s,m=u*s,y=c*l,_=c*f,x=c*s,M=r[0],w=r[1],b=r[2],R=o[0],E=o[1],A=o[2];return t[0]=(1-(v+m))*M,t[1]=(h+x)*M,t[2]=(p-_)*M,t[3]=0,t[4]=(h-x)*w,t[5]=(1-(d+m))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+_)*b,t[9]=(g-y)*b,t[10]=(1-(d+v))*b,t[11]=0,t[12]=n[0]+R-(t[0]*R+t[4]*E+t[8]*A),t[13]=n[1]+E-(t[1]*R+t[5]*E+t[9]*A),t[14]=n[2]+A-(t[2]*R+t[6]*E+t[10]*A),t[15]=1,t},o.fromQuat=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=n+n,u=r+r,c=o+o,l=n*i,f=r*i,s=r*u,d=o*i,h=o*u,p=o*c,v=a*i,g=a*u,m=a*c;return t[0]=1-s-p,t[1]=f+m,t[2]=d-g,t[3]=0,t[4]=f-m,t[5]=1-l-p,t[6]=h+v,t[7]=0,t[8]=d+g,t[9]=h-v,t[10]=1-l-s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},o.frustum=function(t,e,n,r,o,a,i){var u=1/(n-e),c=1/(o-r),l=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*c,t[6]=0,t[7]=0,t[8]=(n+e)*u,t[9]=(o+r)*c,t[10]=(i+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*l,t[15]=0,t},o.perspective=function(t,e,n,r,o){var a=1/Math.tan(e/2),i=1/(r-o);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+r)*i,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*r*i,t[15]=0,t},o.perspectiveFromFieldOfView=function(t,e,n,r){var o=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),i=Math.tan(e.leftDegrees*Math.PI/180),u=Math.tan(e.rightDegrees*Math.PI/180),c=2/(i+u),l=2/(o+a);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((i-u)*c*.5),t[9]=(o-a)*l*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},o.ortho=function(t,e,n,r,o,a,i){var u=1/(e-n),c=1/(r-o),l=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*u,t[13]=(o+r)*c,t[14]=(i+a)*l,t[15]=1,t},o.lookAt=function(t,e,n,a){var i,u,c,l,f,s,d,h,p,v,g=e[0],m=e[1],y=e[2],_=a[0],x=a[1],M=a[2],w=n[0],b=n[1],R=n[2];return Math.abs(g-w)<r.EPSILON&&Math.abs(m-b)<r.EPSILON&&Math.abs(y-R)<r.EPSILON?o.identity(t):(d=g-w,h=m-b,p=y-R,v=1/Math.sqrt(d*d+h*h+p*p),d*=v,h*=v,p*=v,i=x*p-M*h,u=M*d-_*p,c=_*h-x*d,v=Math.sqrt(i*i+u*u+c*c),v?(v=1/v,i*=v,u*=v,c*=v):(i=0,u=0,c=0),l=h*c-p*u,f=p*i-d*c,s=d*u-h*i,v=Math.sqrt(l*l+f*f+s*s),v?(v=1/v,l*=v,f*=v,s*=v):(l=0,f=0,s=0),t[0]=i,t[1]=l,t[2]=d,t[3]=0,t[4]=u,t[5]=f,t[6]=h,t[7]=0,t[8]=c,t[9]=s,t[10]=p,t[11]=0,t[12]=-(i*g+u*m+c*y),t[13]=-(l*g+f*m+s*y),t[14]=-(d*g+h*m+p*y),t[15]=1,t)},o.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},o.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},t.exports=o},function(t,e,n){var r=n(8),o=n(11),a=n(14),i=n(15),u={};u.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},u.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,o,i){var c=a.dot(o,i);return-.999999>c?(a.cross(t,e,o),a.length(t)<1e-6&&a.cross(t,n,o),a.normalize(t,t),u.setAxisAngle(r,t,Math.PI),r):c>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,o,i),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+c,u.normalize(r,r))}}(),u.setAxes=function(){var t=o.create();return function(e,n,r,o){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=o[0],t[4]=o[1],t[7]=o[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],u.normalize(e,u.fromMat3(e,t))}}(),u.clone=i.clone,u.fromValues=i.fromValues,u.copy=i.copy,u.set=i.set,u.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},u.setAxisAngle=function(t,e,n){n=.5*n;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t},u.add=i.add,u.multiply=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3],u=n[0],c=n[1],l=n[2],f=n[3];return t[0]=r*f+i*u+o*l-a*c,t[1]=o*f+i*c+a*u-r*l,t[2]=a*f+i*l+r*c-o*u,t[3]=i*f-r*u-o*c-a*l,t},u.mul=u.multiply,u.scale=i.scale,u.rotateX=function(t,e,n){n*=.5;var r=e[0],o=e[1],a=e[2],i=e[3],u=Math.sin(n),c=Math.cos(n);return t[0]=r*c+i*u,t[1]=o*c+a*u,t[2]=a*c-o*u,t[3]=i*c-r*u,t},u.rotateY=function(t,e,n){n*=.5;var r=e[0],o=e[1],a=e[2],i=e[3],u=Math.sin(n),c=Math.cos(n);return t[0]=r*c-a*u,t[1]=o*c+i*u,t[2]=a*c+r*u,t[3]=i*c-o*u,t},u.rotateZ=function(t,e,n){n*=.5;var r=e[0],o=e[1],a=e[2],i=e[3],u=Math.sin(n),c=Math.cos(n);return t[0]=r*c+o*u,t[1]=o*c-r*u,t[2]=a*c+i*u,t[3]=i*c-a*u,t},u.calculateW=function(t,e){var n=e[0],r=e[1],o=e[2];return t[0]=n,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-o*o)),t},u.dot=i.dot,u.lerp=i.lerp,u.slerp=function(t,e,n,r){var o,a,i,u,c,l=e[0],f=e[1],s=e[2],d=e[3],h=n[0],p=n[1],v=n[2],g=n[3];return a=l*h+f*p+s*v+d*g,0>a&&(a=-a,h=-h,p=-p,v=-v,g=-g),1-a>1e-6?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,c=Math.sin(r*o)/i):(u=1-r,c=r),t[0]=u*l+c*h,t[1]=u*f+c*p,t[2]=u*s+c*v,t[3]=u*d+c*g,t},u.sqlerp=function(){var t=u.create(),e=u.create();return function(n,r,o,a,i,c){return u.slerp(t,r,i,c),u.slerp(e,o,a,c),u.slerp(n,t,e,2*c*(1-c)),n}}(),u.invert=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=n*n+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-n*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t},u.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},u.length=i.length,u.len=u.length,u.squaredLength=i.squaredLength,u.sqrLen=u.squaredLength,u.normalize=i.normalize,u.fromMat3=function(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;n=Math.sqrt(e[3*o+o]-e[3*a+a]-e[3*i+i]+1),t[o]=.5*n,n=.5/n,t[3]=(e[3*a+i]-e[3*i+a])*n,t[a]=(e[3*a+o]+e[3*o+a])*n,t[i]=(e[3*i+o]+e[3*o+i])*n}return t},u.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t.exports=u},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},o.clone=function(t){var e=new r.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},o.fromValues=function(t,e,n){var o=new r.ARRAY_TYPE(3);return o[0]=t,o[1]=e,o[2]=n,o},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},o.set=function(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t},o.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},o.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},o.sub=o.subtract,o.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t},o.mul=o.multiply,o.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t},o.div=o.divide,o.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},o.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},o.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},o.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},o.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return Math.sqrt(n*n+r*r+o*o)},o.dist=o.distance,o.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return n*n+r*r+o*o},o.sqrDist=o.squaredDistance,o.length=function(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)},o.len=o.length,o.squaredLength=function(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r},o.sqrLen=o.squaredLength,o.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},o.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},o.normalize=function(t,e){var n=e[0],r=e[1],o=e[2],a=n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},o.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},o.cross=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=n[0],u=n[1],c=n[2];return t[0]=o*c-a*u,t[1]=a*i-r*c,t[2]=r*u-o*i,t},o.lerp=function(t,e,n,r){var o=e[0],a=e[1],i=e[2];return t[0]=o+r*(n[0]-o),t[1]=a+r*(n[1]-a),t[2]=i+r*(n[2]-i),t},o.hermite=function(t,e,n,r,o,a){var i=a*a,u=i*(2*a-3)+1,c=i*(a-2)+a,l=i*(a-1),f=i*(3-2*a);return t[0]=e[0]*u+n[0]*c+r[0]*l+o[0]*f,t[1]=e[1]*u+n[1]*c+r[1]*l+o[1]*f,t[2]=e[2]*u+n[2]*c+r[2]*l+o[2]*f,t},o.bezier=function(t,e,n,r,o,a){var i=1-a,u=i*i,c=a*a,l=u*i,f=3*a*u,s=3*c*i,d=c*a;return t[0]=e[0]*l+n[0]*f+r[0]*s+o[0]*d,t[1]=e[1]*l+n[1]*f+r[1]*s+o[1]*d,t[2]=e[2]*l+n[2]*f+r[2]*s+o[2]*d,t},o.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,o=2*r.RANDOM()-1,a=Math.sqrt(1-o*o)*e;return t[0]=Math.cos(n)*a,t[1]=Math.sin(n)*a,t[2]=o*e,t},o.transformMat4=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=n[3]*r+n[7]*o+n[11]*a+n[15];return i=i||1,t[0]=(n[0]*r+n[4]*o+n[8]*a+n[12])/i,t[1]=(n[1]*r+n[5]*o+n[9]*a+n[13])/i,t[2]=(n[2]*r+n[6]*o+n[10]*a+n[14])/i,t},o.transformMat3=function(t,e,n){var r=e[0],o=e[1],a=e[2];return t[0]=r*n[0]+o*n[3]+a*n[6],t[1]=r*n[1]+o*n[4]+a*n[7],t[2]=r*n[2]+o*n[5]+a*n[8],t},o.transformQuat=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=n[0],u=n[1],c=n[2],l=n[3],f=l*r+u*a-c*o,s=l*o+c*r-i*a,d=l*a+i*o-u*r,h=-i*r-u*o-c*a;return t[0]=f*l+h*-i+s*-c-d*-u,t[1]=s*l+h*-u+d*-i-f*-c,t[2]=d*l+h*-c+f*-u-s*-i,t},o.rotateX=function(t,e,n,r){var o=[],a=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},o.rotateY=function(t,e,n,r){var o=[],a=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},o.rotateZ=function(t,e,n,r){var o=[],a=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t},o.forEach=function(){var t=o.create();return function(e,n,r,o,a,i){var u,c;for(n||(n=3),r||(r=0),c=o?Math.min(o*n+r,e.length):e.length,u=r;c>u;u+=n)t[0]=e[u],t[1]=e[u+1],t[2]=e[u+2],a(t,t,i),e[u]=t[0],e[u+1]=t[1],e[u+2]=t[2];return e}}(),o.angle=function(t,e){var n=o.fromValues(t[0],t[1],t[2]),r=o.fromValues(e[0],e[1],e[2]);o.normalize(n,n),o.normalize(r,r);var a=o.dot(n,r);return a>1?0:Math.acos(a)},o.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},t.exports=o},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},o.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},o.fromValues=function(t,e,n,o){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=o,a},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},o.set=function(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t},o.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},o.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t},o.sub=o.subtract,o.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},o.mul=o.multiply,o.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t},o.div=o.divide,o.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},o.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},o.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},o.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},o.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+o*o+a*a)},o.dist=o.distance,o.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+o*o+a*a},o.sqrDist=o.squaredDistance,o.length=function(t){var e=t[0],n=t[1],r=t[2],o=t[3];return Math.sqrt(e*e+n*n+r*r+o*o)},o.len=o.length,o.squaredLength=function(t){var e=t[0],n=t[1],r=t[2],o=t[3];return e*e+n*n+r*r+o*o},o.sqrLen=o.squaredLength,o.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},o.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},o.normalize=function(t,e){var n=e[0],r=e[1],o=e[2],a=e[3],i=n*n+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i),t[0]=n*i,t[1]=r*i,t[2]=o*i,t[3]=a*i),t},o.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},o.lerp=function(t,e,n,r){var o=e[0],a=e[1],i=e[2],u=e[3];return t[0]=o+r*(n[0]-o),t[1]=a+r*(n[1]-a),t[2]=i+r*(n[2]-i),t[3]=u+r*(n[3]-u),t},o.random=function(t,e){return e=e||1,t[0]=r.RANDOM(),t[1]=r.RANDOM(),t[2]=r.RANDOM(),t[3]=r.RANDOM(),o.normalize(t,t),o.scale(t,t,e),t},o.transformMat4=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=e[3];return t[0]=n[0]*r+n[4]*o+n[8]*a+n[12]*i,t[1]=n[1]*r+n[5]*o+n[9]*a+n[13]*i,t[2]=n[2]*r+n[6]*o+n[10]*a+n[14]*i,t[3]=n[3]*r+n[7]*o+n[11]*a+n[15]*i,t},o.transformQuat=function(t,e,n){var r=e[0],o=e[1],a=e[2],i=n[0],u=n[1],c=n[2],l=n[3],f=l*r+u*a-c*o,s=l*o+c*r-i*a,d=l*a+i*o-u*r,h=-i*r-u*o-c*a;return t[0]=f*l+h*-i+s*-c-d*-u,t[1]=s*l+h*-u+d*-i-f*-c,t[2]=d*l+h*-c+f*-u-s*-i,t[3]=e[3],t},o.forEach=function(){var t=o.create();return function(e,n,r,o,a,i){var u,c;for(n||(n=4),r||(r=0),c=o?Math.min(o*n+r,e.length):e.length,u=r;c>u;u+=n)t[0]=e[u],t[1]=e[u+1],t[2]=e[u+2],t[3]=e[u+3],a(t,t,i),e[u]=t[0],e[u+1]=t[1],e[u+2]=t[2],e[u+3]=t[3];return e}}(),o.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t.exports=o},function(t,e,n){var r=n(8),o={};o.create=function(){var t=new r.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},o.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},o.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},o.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},o.set=function(t,e,n){return t[0]=e,t[1]=n,t},o.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},o.subtract=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t},o.sub=o.subtract,o.multiply=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t},o.mul=o.multiply,o.divide=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t},o.div=o.divide,o.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},o.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},o.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},o.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},o.distance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)},o.dist=o.distance,o.squaredDistance=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r},o.sqrDist=o.squaredDistance,o.length=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},o.len=o.length,o.squaredLength=function(t){var e=t[0],n=t[1];return e*e+n*n},o.sqrLen=o.squaredLength,o.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},o.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},o.normalize=function(t,e){var n=e[0],r=e[1],o=n*n+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o),t},o.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},o.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},o.lerp=function(t,e,n,r){var o=e[0],a=e[1];return t[0]=o+r*(n[0]-o),t[1]=a+r*(n[1]-a),t},o.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},o.transformMat2=function(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o,t[1]=n[1]*r+n[3]*o,t},o.transformMat2d=function(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o+n[4],t[1]=n[1]*r+n[3]*o+n[5],t},o.transformMat3=function(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[3]*o+n[6],t[1]=n[1]*r+n[4]*o+n[7],t},o.transformMat4=function(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[4]*o+n[12],t[1]=n[1]*r+n[5]*o+n[13],t},o.forEach=function(){var t=o.create();return function(e,n,r,o,a,i){var u,c;for(n||(n=2),r||(r=0),c=o?Math.min(o*n+r,e.length):e.length,u=r;c>u;u+=n)t[0]=e[u],t[1]=e[u+1],a(t,t,i),e[u]=t[0],e[u+1]=t[1];return e}}(),o.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},t.exports=o},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={init:function(t,e){for(var n=t.length;n--;)t[n]=e},shuffle:function(t){var e,n,r=t.length-1;for(r;r>=0;r--)e=Math.floor(Math.random()*r),n=t[r],t[r]=t[e],t[e]=n;return t},toPointList:function(t){var e,n,r=[],o=[];for(e=0;e<t.length;e++){for(r=[],n=0;n<t[e].length;n++)r[n]=t[e][n];o[e]="["+r.join(",")+"]"}return"["+o.join(",\r\n")+"]"},threshold:function(t,e,n){var r,o=[];for(r=0;r<t.length;r++)n.apply(t,[t[r]])>=e&&o.push(t[r]);return o},maxIndex:function(t){var e,n=0;for(e=0;e<t.length;e++)t[e]>t[n]&&(n=e);return n},max:function n(t){var e,n=0;for(e=0;e<t.length;e++)t[e]>n&&(n=t[e]);return n},sum:function r(t){for(var e=t.length,r=0;e--;)r+=t[e];return r}},t.exports=e["default"]},function(t,e,n){(function(r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function a(){var t;m=g.halfSample?new T["default"]({x:A.size.x/2|0,y:A.size.y/2|0}):A,E=S["default"].calculatePatchSize(g.patchSize,m.size),Y.x=m.size.x/E.x|0,Y.y=m.size.y/E.y|0,R=new T["default"](m.size,void 0,Uint8Array,!1),x=new T["default"](E,void 0,Array,!0),t=new ArrayBuffer(65536),_=new T["default"](E,new Uint8Array(t,0,E.x*E.y)),y=new T["default"](E,new Uint8Array(t,E.x*E.y*3,E.x*E.y),void 0,!0),C=(0,j["default"])("undefined"!=typeof window?window:"undefined"!=typeof self?self:r,{size:E.x},t),b=new T["default"]({x:m.size.x/_.size.x|0,y:m.size.y/_.size.y|0},void 0,Array,!0),M=new T["default"](b.size,void 0,void 0,!0),w=new T["default"](b.size,void 0,Int32Array,!0)}function i(){g.useWorker||"undefined"==typeof document||(G.dom.binary=document.createElement("canvas"),G.dom.binary.className="binaryBuffer",g.showCanvas===!0&&document.querySelector("#debug").appendChild(G.dom.binary),G.ctx.binary=G.dom.binary.getContext("2d"),G.dom.binary.width=R.size.x,G.dom.binary.height=R.size.y)}function u(t){var e,n,r,o,a,i,u,c=R.size.x,l=R.size.y,f=-R.size.x,s=-R.size.y;for(e=0,n=0;n<t.length;n++)o=t[n],e+=o.rad,g.showPatches&&W["default"].drawRect(o.pos,_.size,G.ctx.binary,{color:"red"});for(e/=t.length,e=(180*e/Math.PI+90)%180-90,0>e&&(e+=180),e=(180-e)*Math.PI/180,a=H.clone([Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e)]),n=0;n<t.length;n++){for(o=t[n],r=0;4>r;r++)V.transformMat2(o.box[r],o.box[r],a);g.boxFromPatches.showTransformed&&W["default"].drawPath(o.box,{x:0,y:1},G.ctx.binary,{color:"#99ff00",lineWidth:2})}for(n=0;n<t.length;n++)for(o=t[n],r=0;4>r;r++)o.box[r][0]<c&&(c=o.box[r][0]),o.box[r][0]>f&&(f=o.box[r][0]),o.box[r][1]<l&&(l=o.box[r][1]),o.box[r][1]>s&&(s=o.box[r][1]);for(i=[[c,l],[f,l],[f,s],[c,s]],g.boxFromPatches.showTransformedBox&&W["default"].drawPath(i,{x:0,y:1},G.ctx.binary,{color:"#ff0000",lineWidth:2}),u=g.halfSample?2:1,a=H.invert(a,a),r=0;4>r;r++)V.transformMat2(i[r],i[r],a);for(g.boxFromPatches.showBB&&W["default"].drawPath(i,{x:0,y:1},G.ctx.binary,{color:"#ff0000",lineWidth:2}),r=0;4>r;r++)V.scale(i[r],i[r],u);return i}function c(){S["default"].otsuThreshold(m,R),R.zeroBorder(),g.showCanvas&&R.show(G.dom.binary,255)}function l(){var t,e,n,r,o,a,i,u,c=[];for(t=0;t<Y.x;t++)for(e=0;e<Y.y;e++)n=_.size.x*t,r=_.size.y*e,h(n,r),y.zeroBorder(),q["default"].init(x.data,0),a=z["default"].create(y,x),i=a.rasterize(0),g.showLabels&&x.overlay(G.dom.binary,Math.floor(360/i.count),{x:n,y:r}),o=x.moments(i.count),c=c.concat(p(o,[t,e],n,r));if(g.showFoundPatches)for(t=0;t<c.length;t++)u=c[t],W["default"].drawRect(u.pos,_.size,G.ctx.binary,{color:"#99ff00",lineWidth:2});return c}function f(t){var e,n,r=[],o=[];for(e=0;t>e;e++)r.push(0);for(n=w.data.length;n--;)w.data[n]>0&&r[w.data[n]-1]++;return r=r.map(function(t,e){return{val:t,label:e+1}}),r.sort(function(t,e){return e.val-t.val}),o=r.filter(function(t){return t.val>=5})}function s(t,e){var n,r,o,a,i,c=[],l=[],f=[0,1,1],s=[0,0,0];for(n=0;n<t.length;n++){for(o=w.data.length,c.length=0;o--;)w.data[o]===t[n].label&&(a=b.data[o],c.push(a));if(i=u(c),i&&(l.push(i),g.showRemainingPatchLabels))for(r=0;r<c.length;r++)a=c[r],f[0]=t[n].label/(e+1)*360,S["default"].hsv2rgb(f,s),W["default"].drawRect(a.pos,_.size,G.ctx.binary,{color:"rgb("+s.join(",")+")",lineWidth:2})}return l}function d(t){var e=S["default"].cluster(t,.9),n=S["default"].topGeneric(e,1,function(t){return t.getPoints().length}),r=[],o=[];if(1===n.length){r=n[0].item.getPoints();for(var a=0;a<r.length;a++)o.push(r[a].point)}return o}function h(t,e){R.subImageAsCopy(_,S["default"].imageRef(t,e)),C.skeletonize(),g.showSkeleton&&y.overlay(G.dom.binary,360,S["default"].imageRef(t,e))}function p(t,e,n,r){var o,a,i,u,c=[],l=[],f=Math.ceil(E.x/3);if(t.length>=2){for(o=0;o<t.length;o++)t[o].m00>f&&c.push(t[o]);if(c.length>=2){for(i=d(c),a=0,o=0;o<i.length;o++)a+=i[o].rad;i.length>1&&i.length>=c.length/4*3&&i.length>t.length/4&&(a/=i.length,u={index:e[1]*Y.x+e[0],pos:{x:n,y:r},box:[V.clone([n,r]),V.clone([n+_.size.x,r]),V.clone([n+_.size.x,r+_.size.y]),V.clone([n,r+_.size.y])],moments:i,rad:a,vec:V.clone([Math.cos(a),Math.sin(a)])},l.push(u))}}return l}function v(t){function e(){var t;for(t=0;t<w.data.length;t++)if(0===w.data[t]&&1===M.data[t])return t;return w.length}function n(t){var e,r,o,u,c,l,f={x:t%w.size.x,y:t/w.size.x|0};if(t<w.data.length)for(o=b.data[t],w.data[t]=a,c=0;c<N["default"].searchDirections.length;c++)r=f.y+N["default"].searchDirections[c][0],e=f.x+N["default"].searchDirections[c][1],u=r*w.size.x+e,0!==M.data[u]?0===w.data[u]&&(l=Math.abs(V.dot(b.data[u].vec,o.vec)),l>i&&n(u)):w.data[u]=Number.MAX_VALUE}var r,o,a=0,i=.95,u=0,c=[0,1,1],l=[0,0,0];for(q["default"].init(M.data,0),q["default"].init(w.data,0),q["default"].init(b.data,null),r=0;r<t.length;r++)o=t[r],b.data[o.index]=o,M.data[o.index]=1;for(M.zeroBorder();(u=e())<w.data.length;)a++,n(u);if(g.showPatchLabels)for(r=0;r<w.data.length;r++)w.data[r]>0&&w.data[r]<=a&&(o=b.data[r],c[0]=w.data[r]/(a+1)*360,S["default"].hsv2rgb(c,l),W["default"].drawRect(o.pos,_.size,G.ctx.binary,{color:"rgb("+l.join(",")+")",lineWidth:2}));return a}Object.defineProperty(e,"__esModule",{value:!0});var g,m,y,_,x,M,w,b,R,E,A,C,O=n(3),T=o(O),D=n(5),S=o(D),P=n(19),z=o(P),I=n(20),N=o(I),L=n(21),j=o(L),k=n(17),q=o(k),U=n(22),W=o(U),F=n(7),B=o(F),G={ctx:{binary:null},dom:{binary:null}},Y={x:0,y:0},V=B["default"].vec2,H=B["default"].mat2;e["default"]={init:function(t,e){g=e,A=t,a(),i()},locate:function(){var t,e,n;if(g.halfSample&&S["default"].halfSample(A,m),c(),t=l(),t.length<Y.x*Y.y*.05)return null;var r=v(t);return 1>r?null:(e=f(r),0===e.length?null:n=s(e,r))},checkImageConstraints:function(t,e){var n,r,o,a=t.getWidth(),i=t.getHeight(),u=e.halfSample?.5:1;if(t.getConfig().area&&(o=S["default"].computeImageArea(a,i,t.getConfig().area),t.setTopRight({x:o.sx,y:o.sy}),t.setCanvasSize({x:a,y:i}),a=o.sw,i=o.sh),r={x:Math.floor(a*u),y:Math.floor(i*u)},n=S["default"].calculatePatchSize(e.patchSize,r),console.log("Patch-Size: "+JSON.stringify(n)),t.setWidth(Math.floor(Math.floor(r.x/n.x)*(1/u)*n.x)),t.setHeight(Math.floor(Math.floor(r.y/n.y)*(1/u)*n.y)),t.getWidth()%n.x===0&&t.getHeight()%n.y===0)return!0;throw new Error("Image dimensions do not comply with the current settings: Width ("+a+" )and height ("+i+") must a multiple of "+n.x)}},t.exports=e["default"]}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(20),a=r(o),i={createContour2D:function(){return{dir:null,index:null,firstVertex:null,insideContours:null,nextpeer:null,prevpeer:null}},CONTOUR_DIR:{CW_DIR:0,CCW_DIR:1,UNKNOWN_DIR:2},DIR:{OUTSIDE_EDGE:-32767,INSIDE_EDGE:-32766},create:function(t,e){var n=t.data,r=e.data,o=t.size.x,u=t.size.y,c=a["default"].create(t,e);return{rasterize:function(t){var e,a,l,f,s,d,h,p,v,g,m,y,_=[],x=0;for(y=0;400>y;y++)_[y]=0;for(_[0]=n[0],v=null,d=1;u-1>d;d++)for(f=0,a=_[0],s=1;o-1>s;s++)if(m=d*o+s,0===r[m])if(e=n[m],e!==a){if(0===f)l=x+1,_[l]=e,a=e,h=c.contourTracing(d,s,l,e,i.DIR.OUTSIDE_EDGE),null!==h&&(x++,f=l,p=i.createContour2D(),p.dir=i.CONTOUR_DIR.CW_DIR,p.index=f,p.firstVertex=h,p.nextpeer=v,p.insideContours=null,null!==v&&(v.prevpeer=p),v=p);else if(h=c.contourTracing(d,s,i.DIR.INSIDE_EDGE,e,f),null!==h){for(p=i.createContour2D(),p.firstVertex=h,p.insideContours=null,0===t?p.dir=i.CONTOUR_DIR.CCW_DIR:p.dir=i.CONTOUR_DIR.CW_DIR,p.index=t,g=v;null!==g&&g.index!==f;)g=g.nextpeer;null!==g&&(p.nextpeer=g.insideContours,null!==g.insideContours&&(g.insideContours.prevpeer=p),g.insideContours=p)}}else r[m]=f;else r[m]===i.DIR.OUTSIDE_EDGE||r[m]===i.DIR.INSIDE_EDGE?(f=0,a=r[m]===i.DIR.INSIDE_EDGE?n[m]:_[0]):(f=r[m],a=_[f]);for(g=v;null!==g;)g.index=t,g=g.nextpeer;return{cc:v,count:x}},debug:{drawContour:function(t,e){var n,r,o,a=t.getContext("2d"),u=e;for(a.strokeStyle="red",a.fillStyle="red",a.lineWidth=1,n=null!==u?u.insideContours:null;null!==u;){switch(null!==n?(r=n,n=n.nextpeer):(r=u,u=u.nextpeer,n=null!==u?u.insideContours:null),r.dir){case i.CONTOUR_DIR.CW_DIR:a.strokeStyle="red";break;case i.CONTOUR_DIR.CCW_DIR:a.strokeStyle="blue";break;case i.CONTOUR_DIR.UNKNOWN_DIR:a.strokeStyle="green"}o=r.firstVertex,a.beginPath(),a.moveTo(o.x,o.y);do o=o.next,a.lineTo(o.x,o.y);while(o!==r.firstVertex);a.stroke()}}}}}};e["default"]=i,t.exports=e["default"]},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={searchDirections:[[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-1,0],[-1,1]],create:function(t,e){function n(t,e,n,r){var o,f,s;for(o=0;7>o;o++){if(f=t.cy+c[t.dir][0],s=t.cx+c[t.dir][1],a=f*l+s,i[a]===e&&(0===u[a]||u[a]===n))return u[a]=n,t.cy=f,t.cx=s,!0;0===u[a]&&(u[a]=r),t.dir=(t.dir+1)%8}return!1}function r(t,e,n){return{dir:n,x:t,y:e,next:null,prev:null}}function o(t,e,o,a,i){var u,c,l,f=null,s={cx:e,cy:t,dir:0};if(n(s,a,o,i)){f=r(e,t,s.dir),u=f,l=s.dir,c=r(s.cx,s.cy,0),c.prev=u,u.next=c,c.next=null,u=c;do s.dir=(s.dir+6)%8,n(s,a,o,i),l!==s.dir?(u.dir=s.dir,c=r(s.cx,s.cy,0),c.prev=u,u.next=c,c.next=null,u=c):(u.dir=l,u.x=s.cx,u.y=s.cy),l=s.dir;while(s.cx!==e||s.cy!==t);f.prev=u.prev,u.prev.next=f}return f}var a,i=t.data,u=e.data,c=this.searchDirections,l=t.size.x;return{trace:function(t,e,r,o){return n(t,e,r,o)},contourTracing:function(t,e,n,r,a){return o(t,e,n,r,a)}}}};e["default"]=n,t.exports=e["default"]},function(module, exports) {"use strict";Object.defineProperty(exports, "__esModule", {value: true});function Skeletonizer(stdlib, foreign, buffer) {"use asm";var images=new stdlib.Uint8Array(buffer),size=foreign.size|0,imul=stdlib.Math.imul;function erode(inImagePtr, outImagePtr) {inImagePtr=inImagePtr|0;outImagePtr=outImagePtr|0;var v=0,u=0,sum=0,yStart1=0,yStart2=0,xStart1=0,xStart2=0,offset=0;for (v=1; (v|0)<(size - 1|0); v=v+1|0) {offset=offset+size|0;for (u=1; (u|0)<(size - 1|0); u=u+1|0) {yStart1=offset - size|0;yStart2=offset+size|0;xStart1=u - 1|0;xStart2=u+1|0;sum=(images[inImagePtr+yStart1+xStart1|0]|0)+(images[inImagePtr+yStart1+xStart2|0]|0)+(images[inImagePtr+offset+u|0]|0)+(images[inImagePtr+yStart2+xStart1|0]|0)+(images[inImagePtr+yStart2+xStart2|0]|0)|0;if ((sum|0) == (5|0)) {images[outImagePtr+offset+u|0]=1;} else {images[outImagePtr+offset+u|0]=0;}}}return;}function subtract(aImagePtr, bImagePtr, outImagePtr) {aImagePtr=aImagePtr|0;bImagePtr=bImagePtr|0;outImagePtr=outImagePtr|0;var length=0;length=imul(size, size)|0;while ((length|0)>0) {length=length - 1|0;images[outImagePtr+length|0]=(images[aImagePtr+length|0]|0) - (images[bImagePtr+length|0]|0)|0;}}function bitwiseOr(aImagePtr, bImagePtr, outImagePtr) {aImagePtr=aImagePtr|0;bImagePtr=bImagePtr|0;outImagePtr=outImagePtr|0;var length=0;length=imul(size, size)|0;while ((length|0)>0) {length=length - 1|0;images[outImagePtr+length|0]=images[aImagePtr+length|0]|0|(images[bImagePtr+length|0]|0)|0;}}function countNonZero(imagePtr) {imagePtr=imagePtr|0;var sum=0,length=0;length=imul(size, size)|0;while ((length|0)>0) {length=length - 1|0;sum=(sum|0)+(images[imagePtr+length|0]|0)|0;}return sum|0;}function init(imagePtr, value) {imagePtr=imagePtr|0;value=value|0;var length=0;length=imul(size, size)|0;while ((length|0)>0) {length=length - 1|0;images[imagePtr+length|0]=value;}}function dilate(inImagePtr, outImagePtr) {inImagePtr=inImagePtr|0;outImagePtr=outImagePtr|0;var v=0,u=0,sum=0,yStart1=0,yStart2=0,xStart1=0,xStart2=0,offset=0;for (v=1; (v|0)<(size - 1|0); v=v+1|0) {offset=offset+size|0;for (u=1; (u|0)<(size - 1|0); u=u+1|0) {yStart1=offset - size|0;yStart2=offset+size|0;xStart1=u - 1|0;xStart2=u+1|0;sum=(images[inImagePtr+yStart1+xStart1|0]|0)+(images[inImagePtr+yStart1+xStart2|0]|0)+(images[inImagePtr+offset+u|0]|0)+(images[inImagePtr+yStart2+xStart1|0]|0)+(images[inImagePtr+yStart2+xStart2|0]|0)|0;if ((sum|0)>(0|0)) {images[outImagePtr+offset+u|0]=1;} else {images[outImagePtr+offset+u|0]=0;}}}return;}function memcpy(srcImagePtr, dstImagePtr) {srcImagePtr=srcImagePtr|0;dstImagePtr=dstImagePtr|0;var length=0;length=imul(size, size)|0;while ((length|0)>0) {length=length - 1|0;images[dstImagePtr+length|0]=images[srcImagePtr+length|0]|0;}}function zeroBorder(imagePtr) {imagePtr=imagePtr|0;var x=0,y=0;for (x=0; (x|0)<(size - 1|0); x=x+1|0) {images[imagePtr+x|0]=0;images[imagePtr+y|0]=0;y=y+size - 1|0;images[imagePtr+y|0]=0;y=y+1|0;}for (x=0; (x|0)<(size|0); x=x+1|0) {images[imagePtr+y|0]=0;y=y+1|0;}}function skeletonize() {var subImagePtr=0,erodedImagePtr=0,tempImagePtr=0,skelImagePtr=0,sum=0,done=0;erodedImagePtr=imul(size, size)|0;tempImagePtr=erodedImagePtr+erodedImagePtr|0;skelImagePtr=tempImagePtr+erodedImagePtr|0;init(skelImagePtr, 0);zeroBorder(subImagePtr);do {erode(subImagePtr, erodedImagePtr);dilate(erodedImagePtr, tempImagePtr);subtract(subImagePtr, tempImagePtr, tempImagePtr);bitwiseOr(skelImagePtr, tempImagePtr, skelImagePtr);memcpy(erodedImagePtr, subImagePtr);sum=countNonZero(subImagePtr)|0;done=(sum|0) == 0|0;} while (!done);}return {skeletonize: skeletonize};}exports["default"]=Skeletonizer;module.exports=exports["default"]; },function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={drawRect:function(t,e,n,r){n.strokeStyle=r.color,n.fillStyle=r.color,n.lineWidth=1,n.beginPath(),n.strokeRect(t.x,t.y,e.x,e.y)},drawPath:function(t,e,n,r){n.strokeStyle=r.color,n.fillStyle=r.color,n.lineWidth=r.lineWidth,n.beginPath(),n.moveTo(t[0][e.x],t[0][e.y]);for(var o=1;o<t.length;o++)n.lineTo(t[o][e.x],t[o][e.y]);n.closePath(),n.stroke()},drawImage:function(t,e,n){var r,o=n.getImageData(0,0,e.x,e.y),a=o.data,i=t.length,u=a.length;if(u/i!==4)return!1;for(;i--;)r=t[i],a[--u]=255,a[--u]=r,a[--u]=r,a[--u]=r;return n.putImageData(o,0,0),!0}},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(24),a=r(o),i=n(22),u=r(i),c=n(25),l=r(c),f=n(27),s=r(f),d=n(28),h=r(d),p=n(29),v=r(p),g=n(30),m=r(g),y=n(31),_=r(y),x=n(32),M=r(x),w=n(33),b=r(w),R=n(34),E=r(R),A={code_128_reader:l["default"],ean_reader:s["default"],ean_8_reader:M["default"],code_39_reader:h["default"],code_39_vin_reader:v["default"],codabar_reader:m["default"],upc_reader:_["default"],upc_e_reader:b["default"],i2of5_reader:E["default"]};e["default"]={create:function(t,e){function n(){if("undefined"!=typeof document){var t=document.querySelector("#debug.detection");h.dom.frequency=document.querySelector("canvas.frequency"),h.dom.frequency||(h.dom.frequency=document.createElement("canvas"),h.dom.frequency.className="frequency",t&&t.appendChild(h.dom.frequency)),h.ctx.frequency=h.dom.frequency.getContext("2d"),h.dom.pattern=document.querySelector("canvas.patternBuffer"),h.dom.pattern||(h.dom.pattern=document.createElement("canvas"),h.dom.pattern.className="patternBuffer",t&&t.appendChild(h.dom.pattern)),h.ctx.pattern=h.dom.pattern.getContext("2d"),h.dom.overlay=document.querySelector("canvas.drawingBuffer"),h.dom.overlay&&(h.ctx.overlay=h.dom.overlay.getContext("2d"))}}function r(){t.readers.forEach(function(t){var e,n={};"object"==typeof t?(e=t.format,n=t.config):"string"==typeof t&&(e=t),console.log("Before registering reader: ",e),p.push(new A[e](n))}),console.log("Registered Readers: "+p.map(function(t){return JSON.stringify({format:t.FORMAT,config:t.config})}).join(", "))}function o(){if("undefined"!=typeof document){var e,n=[{node:h.dom.frequency,prop:t.showFrequency},{node:h.dom.pattern,prop:t.showPattern}];for(e=0;e<n.length;e++)n[e].prop===!0?n[e].node.style.display="block":n[e].node.style.display="none"}}function i(t,n,r){function o(e){var r={y:e*Math.sin(n),x:e*Math.cos(n)};t[0].y-=r.y,t[0].x-=r.x,t[1].y+=r.y,t[1].x+=r.x}for(o(r);r>1&&(!e.inImageWithBorder(t[0],0)||!e.inImageWithBorder(t[1],0));)r-=Math.ceil(r/2),o(-r);return t}function c(t){return[{x:(t[1][0]-t[0][0])/2+t[0][0],y:(t[1][1]-t[0][1])/2+t[0][1]},{x:(t[3][0]-t[2][0])/2+t[2][0],y:(t[3][1]-t[2][1])/2+t[2][1]}]}function l(n){var r,o=null,i=a["default"].getBarcodeLine(e,n[0],n[1]);for(t.showFrequency&&(u["default"].drawPath(n,{x:"x",y:"y"},h.ctx.overlay,{color:"red",lineWidth:3}),a["default"].debug.printFrequency(i.line,h.dom.frequency)),a["default"].toBinaryLine(i),t.showPattern&&a["default"].debug.printPattern(i.line,h.dom.pattern),r=0;r<p.length&&null===o;r++)o=p[r].decodePattern(i.line);return null===o?null:{codeResult:o,barcodeLine:i}}function f(t,e,n){var r,o,a,i=Math.sqrt(Math.pow(t[1][0]-t[0][0],2)+Math.pow(t[1][1]-t[0][1],2)),u=16,c=null,f=Math.sin(n),s=Math.cos(n);for(r=1;u>r&&null===c;r++)o=i/u*r*(r%2===0?-1:1),a={y:o*f,x:o*s},e[0].y+=a.x,e[0].x-=a.y,e[1].y+=a.x,e[1].x-=a.y,c=l(e);return c}function s(t){return Math.sqrt(Math.pow(Math.abs(t[1].y-t[0].y),2)+Math.pow(Math.abs(t[1].x-t[0].x),2))}function d(e){var n,r,o,a,d=h.ctx.overlay;return t.drawBoundingBox&&d&&u["default"].drawPath(e,{x:0,y:1},d,{color:"blue",lineWidth:2}),n=c(e),a=s(n),r=Math.atan2(n[1].y-n[0].y,n[1].x-n[0].x),n=i(n,r,Math.floor(.1*a)),null===n?null:(o=l(n),null===o&&(o=f(e,n,r)),null===o?null:(o&&t.drawScanline&&d&&u["default"].drawPath(n,{x:"x",y:"y"},d,{color:"red",lineWidth:3}),{codeResult:o.codeResult,line:n,angle:r,pattern:o.barcodeLine.line,threshold:o.barcodeLine.threshold}))}var h={ctx:{frequency:null,pattern:null,overlay:null},dom:{frequency:null,pattern:null,overlay:null}},p=[];return n(),r(),o(),{decodeFromBoundingBox:function(t){return d(t)},decodeFromBoundingBoxes:function(t){var e,n;for(e=0;e<t.length;e++)if(n=d(t[e]),n&&n.codeResult)return n.box=t[e],n},setReaders:function(e){t.readers=e,p.length=0,r()}}}},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),a=r(o),i=n(3),u=r(i),c={},l={DIR:{UP:1,DOWN:-1}};c.getBarcodeLine=function(t,e,n){function r(t,e){s=y[e*_+t],x+=s,M=M>s?s:M,w=s>w?s:w,m.push(s)}var o,a,i,u,c,l,f,s,d=0|e.x,h=0|e.y,p=0|n.x,v=0|n.y,g=Math.abs(v-h)>Math.abs(p-d),m=[],y=t.data,_=t.size.x,x=0,M=255,w=0;for(g&&(l=d,d=h,h=l,l=p,p=v,v=l),d>p&&(l=d,d=p,p=l,l=h,h=v,v=l),o=p-d,a=Math.abs(v-h),i=o/2|0,c=h,u=v>h?1:-1,f=d;p>f;f++)g?r(c,f):r(f,c),i-=a,0>i&&(c+=u,i+=o);return{line:m,min:M,max:w}},c.toOtsuBinaryLine=function(t){var e=t.line,n=new u["default"]({x:e.length-1,y:1},e),r=a["default"].determineOtsuThreshold(n,5);return e=a["default"].sharpenLine(e),a["default"].thresholdImage(n,r),{line:e,threshold:r}},c.toBinaryLine=function(t){var e,n,r,o,a,i,u=t.min,c=t.max,f=t.line,s=u+(c-u)/2,d=[],h=(c-u)/12,p=-h;for(r=f[0]>s?l.DIR.UP:l.DIR.DOWN,d.push({pos:0,val:f[0]}),a=0;a<f.length-2;a++)e=f[a+1]-f[a],n=f[a+2]-f[a+1],o=p>e+n&&f[a+1]<1.5*s?l.DIR.DOWN:e+n>h&&f[a+1]>.5*s?l.DIR.UP:r,r!==o&&(d.push({pos:a,val:f[a]}),r=o);for(d.push({pos:f.length,val:f[f.length-1]}),i=d[0].pos;i<d[1].pos;i++)f[i]=f[i]>s?0:1;for(a=1;a<d.length-1;a++)for(h=d[a+1].val>d[a].val?d[a].val+(d[a+1].val-d[a].val)/3*2|0:d[a+1].val+(d[a].val-d[a+1].val)/3|0,i=d[a].pos;i<d[a+1].pos;i++)f[i]=f[i]>h?0:1;return{line:f,threshold:h}},c.debug={printFrequency:function(t,e){var n,r=e.getContext("2d");for(e.width=t.length,e.height=256,r.beginPath(),r.strokeStyle="blue",n=0;n<t.length;n++)r.moveTo(n,255),r.lineTo(n,255-t[n]);r.stroke(),r.closePath()},printPattern:function(t,e){var n,r=e.getContext("2d");for(e.width=t.length,r.fillColor="black",n=0;n<t.length;n++)1===t[n]&&r.fillRect(n,0,1,100)}},e["default"]=c,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(26),i=r(a),u={CODE_SHIFT:{value:98},CODE_C:{value:99},CODE_B:{value:100},CODE_A:{value:101},START_CODE_A:{value:103},START_CODE_B:{value:104},START_CODE_C:{value:105},STOP_CODE:{value:106},MODULO:{value:11},CODE_PATTERN:{value:[[2,1,2,2,2,2],[2,2,2,1,2,2],[2,2,2,2,2,1],[1,2,1,2,2,3],[1,2,1,3,2,2],[1,3,1,2,2,2],[1,2,2,2,1,3],[1,2,2,3,1,2],[1,3,2,2,1,2],[2,2,1,2,1,3],[2,2,1,3,1,2],[2,3,1,2,1,2],[1,1,2,2,3,2],[1,2,2,1,3,2],[1,2,2,2,3,1],[1,1,3,2,2,2],[1,2,3,1,2,2],[1,2,3,2,2,1],[2,2,3,2,1,1],[2,2,1,1,3,2],[2,2,1,2,3,1],[2,1,3,2,1,2],[2,2,3,1,1,2],[3,1,2,1,3,1],[3,1,1,2,2,2],[3,2,1,1,2,2],[3,2,1,2,2,1],[3,1,2,2,1,2],[3,2,2,1,1,2],[3,2,2,2,1,1],[2,1,2,1,2,3],[2,1,2,3,2,1],[2,3,2,1,2,1],[1,1,1,3,2,3],[1,3,1,1,2,3],[1,3,1,3,2,1],[1,1,2,3,1,3],[1,3,2,1,1,3],[1,3,2,3,1,1],[2,1,1,3,1,3],[2,3,1,1,1,3],[2,3,1,3,1,1],[1,1,2,1,3,3],[1,1,2,3,3,1],[1,3,2,1,3,1],[1,1,3,1,2,3],[1,1,3,3,2,1],[1,3,3,1,2,1],[3,1,3,1,2,1],[2,1,1,3,3,1],[2,3,1,1,3,1],[2,1,3,1,1,3],[2,1,3,3,1,1],[2,1,3,1,3,1],[3,1,1,1,2,3],[3,1,1,3,2,1],[3,3,1,1,2,1],[3,1,2,1,1,3],[3,1,2,3,1,1],[3,3,2,1,1,1],[3,1,4,1,1,1],[2,2,1,4,1,1],[4,3,1,1,1,1],[1,1,1,2,2,4],[1,1,1,4,2,2],[1,2,1,1,2,4],[1,2,1,4,2,1],[1,4,1,1,2,2],[1,4,1,2,2,1],[1,1,2,2,1,4],[1,1,2,4,1,2],[1,2,2,1,1,4],[1,2,2,4,1,1],[1,4,2,1,1,2],[1,4,2,2,1,1],[2,4,1,2,1,1],[2,2,1,1,1,4],[4,1,3,1,1,1],[2,4,1,1,1,2],[1,3,4,1,1,1],[1,1,1,2,4,2],[1,2,1,1,4,2],[1,2,1,2,4,1],[1,1,4,2,1,2],[1,2,4,1,1,2],[1,2,4,2,1,1],[4,1,1,2,1,2],[4,2,1,1,1,2],[4,2,1,2,1,1],[2,1,2,1,4,1],[2,1,4,1,2,1],[4,1,2,1,2,1],[1,1,1,1,4,3],[1,1,1,3,4,1],[1,3,1,1,4,1],[1,1,4,1,1,3],[1,1,4,3,1,1],[4,1,1,1,1,3],[4,1,1,3,1,1],[1,1,3,1,4,1],[1,1,4,1,3,1],[3,1,1,1,4,1],[4,1,1,1,3,1],[2,1,1,4,1,2],[2,1,1,2,1,4],[2,1,1,2,3,2],[2,3,3,1,1,1,2]]},SINGLE_CODE_ERROR:{value:1},AVG_CODE_ERROR:{value:.5},FORMAT:{value:"code_128",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decodeCode=function(t){var e,n,r,o,a=[0,0,0,0,0,0],i=this,u=t,c=!i._row[u],l=0,f={error:Number.MAX_VALUE,code:-1,start:t,end:t};for(e=u;e<i._row.length;e++)if(i._row[e]^c)a[l]++;else{if(l===a.length-1){if(o=i._normalize(a)){for(n=0;n<i.CODE_PATTERN.length;n++)r=i._matchPattern(o,i.CODE_PATTERN[n]),r<f.error&&(f.code=n,f.error=r);return f.end=e,f}}else l++;a[l]=1,c=!c}return null},o.prototype._findStart=function(){var t,e,n,r,o,a,i=[0,0,0,0,0,0],u=this,c=u._nextSet(u._row),l=!1,f=0,s={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(t=c;t<u._row.length;t++)if(u._row[t]^l)i[f]++;else{if(f===i.length-1){for(o=0,r=0;r<i.length;r++)o+=i[r];if(a=u._normalize(i)){for(e=u.START_CODE_A;e<=u.START_CODE_C;e++)n=u._matchPattern(a,u.CODE_PATTERN[e]),n<s.error&&(s.code=e,s.error=n);if(s.error<u.AVG_CODE_ERROR)return s.start=t-o,s.end=t,s}for(r=0;4>r;r++)i[r]=i[r+2];i[4]=0,i[5]=0,f--}else f++;i[f]=1,l=!l}return null},o.prototype._decode=function(){var t,e,n=this,r=n._findStart(),o=null,a=!1,i=[],u=0,c=0,l=[],f=[],s=!1,d=!0;if(null===r)return null;switch(o={code:r.code,start:r.start,end:r.end},f.push(o),c=o.code,o.code){case n.START_CODE_A:t=n.CODE_A;break;case n.START_CODE_B:t=n.CODE_B;break;case n.START_CODE_C:t=n.CODE_C;break;default:return null}for(;!a;){if(e=s,s=!1,o=n._decodeCode(o.end),null!==o)switch(o.code!==n.STOP_CODE&&(d=!0),o.code!==n.STOP_CODE&&(l.push(o.code),u++,c+=u*o.code),f.push(o),t){case n.CODE_A:if(o.code<64)i.push(String.fromCharCode(32+o.code));else if(o.code<96)i.push(String.fromCharCode(o.code-64));else switch(o.code!==n.STOP_CODE&&(d=!1),o.code){case n.CODE_SHIFT:s=!0,t=n.CODE_B;break;case n.CODE_B:t=n.CODE_B;break;case n.CODE_C:t=n.CODE_C;break;case n.STOP_CODE:a=!0}break;case n.CODE_B:if(o.code<96)i.push(String.fromCharCode(32+o.code));else switch(o.code!==n.STOP_CODE&&(d=!1),o.code){case n.CODE_SHIFT:s=!0,t=n.CODE_A;break;case n.CODE_A:t=n.CODE_A;break;case n.CODE_C:t=n.CODE_C;break;case n.STOP_CODE:a=!0}break;case n.CODE_C:if(o.code<100)i.push(o.code<10?"0"+o.code:o.code);else switch(o.code!==n.STOP_CODE&&(d=!1),o.code){case n.CODE_A:t=n.CODE_A;break;case n.CODE_B:t=n.CODE_B;break;case n.STOP_CODE:a=!0}}else a=!0;e&&(t=t===n.CODE_A?n.CODE_B:n.CODE_A)}return null===o?null:(o.end=n._nextUnset(n._row,o.end),n._verifyTrailingWhitespace(o)?(c-=u*l[l.length-1],c%103!==l[l.length-1]?null:i.length?(d&&i.splice(i.length-1,1),{code:i.join(""),start:r.start,end:o.end,codeset:t,startInfo:r,decodedCodes:f,endInfo:o}):null):null)},i["default"].prototype._verifyTrailingWhitespace=function(t){var e,n=this;return e=t.end+(t.end-t.start)/2,e<n._row.length&&n._matchRange(t.end,e,0)?t:null},e["default"]=o,t.exports=e["default"]},function(t,e){"use strict";function n(t){return this._row=[],this.config=t||{},this}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype._nextUnset=function(t,e){var n;for(void 0===e&&(e=0),n=e;n<t.length;n++)if(!t[n])return n;return t.length},n.prototype._matchPattern=function(t,e){var n,r=0,o=0,a=this.MODULO,i=this.SINGLE_CODE_ERROR||1;for(n=0;n<t.length;n++){if(o=Math.abs(e[n]-t[n]),o>i)return Number.MAX_VALUE;r+=o}return r/a},n.prototype._nextSet=function(t,e){var n;for(e=e||0,n=e;n<t.length;n++)if(t[n])return n;return t.length},n.prototype._normalize=function(t,e){var n,r,o=this,a=0,i=0,u=[],c=0;for(e||(e=o.MODULO),n=0;n<t.length;n++)1===t[n]?i++:a+=t[n];if(r=a/(e-i),r>1)for(n=0;n<t.length;n++)c=1===t[n]?t[n]:t[n]/r,u.push(c);else for(r=(a+i)/e,n=0;n<t.length;n++)c=t[n]/r,u.push(c);return u},n.prototype._matchTrace=function(t,e){var n,r,o=[],a=this,i=a._nextSet(a._row),u=!a._row[i],c=0,l={error:Number.MAX_VALUE,code:-1,start:0};if(t){for(n=0;n<t.length;n++)o.push(0);for(n=i;n<a._row.length;n++)if(a._row[n]^u)o[c]++;else{if(c===o.length-1)return r=a._matchPattern(o,t),e>r?(l.start=n-i,l.end=n,l.counter=o,l):null;c++,o[c]=1,u=!u}}else for(o.push(0),n=i;n<a._row.length;n++)a._row[n]^u?o[c]++:(c++,o.push(0),o[c]=1,u=!u);return l.start=i,l.end=a._row.length-1,l.counter=o,l},n.prototype.decodePattern=function(t){var e,r=this;return r._row=t,e=r._decode(),null===e?(r._row.reverse(),e=r._decode(),e&&(e.direction=n.DIRECTION.REVERSE,e.start=r._row.length-e.start,e.end=r._row.length-e.end)):e.direction=n.DIRECTION.FORWARD,e&&(e.format=r.FORMAT),e},n.prototype._matchRange=function(t,e,n){var r;for(t=0>t?0:t,r=t;e>r;r++)if(this._row[r]!==n)return!1;return!0},n.prototype._fillCounters=function(t,e,n){var r,o=this,a=0,i=[];for(n="undefined"!=typeof n?n:!0,t="undefined"!=typeof t?t:o._nextUnset(o._row),e=e||o._row.length,i[a]=0,r=t;e>r;r++)o._row[r]^n?i[a]++:(a++,i[a]=1,n=!n);return i},Object.defineProperty(n.prototype,"FORMAT",{value:"unknown",writeable:!1}),n.DIRECTION={FORWARD:1,REVERSE:-1},n.Exception={StartNotFoundException:"Start-Info was not found!",CodeNotFoundException:"Code could not be found!",PatternNotFoundException:"Pattern could not be found!"},n.CONFIG_KEYS={},e["default"]=n,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){i["default"].call(this,t)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(26),i=r(a),u={CODE_L_START:{value:0},MODULO:{value:7},CODE_G_START:{value:10},START_PATTERN:{value:[1/3*7,1/3*7,1/3*7]},STOP_PATTERN:{value:[1/3*7,1/3*7,1/3*7]},MIDDLE_PATTERN:{value:[.2*7,.2*7,.2*7,.2*7,.2*7]},CODE_PATTERN:{value:[[3,2,1,1],[2,2,2,1],[2,1,2,2],[1,4,1,1],[1,1,3,2],[1,2,3,1],[1,1,1,4],[1,3,1,2],[1,2,1,3],[3,1,1,2],[1,1,2,3],[1,2,2,2],[2,2,1,2],[1,1,4,1],[2,3,1,1],[1,3,2,1],[4,1,1,1],[2,1,3,1],[3,1,2,1],[2,1,1,3]]},CODE_FREQUENCY:{value:[0,11,13,14,19,25,28,21,22,26]},SINGLE_CODE_ERROR:{value:.67},AVG_CODE_ERROR:{value:.27},FORMAT:{value:"ean_13",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decodeCode=function(t,e){var n,r,o,a,i=[0,0,0,0],u=this,c=t,l=!u._row[c],f=0,s={error:Number.MAX_VALUE,code:-1,start:t,end:t};for(e||(e=u.CODE_PATTERN.length),n=c;n<u._row.length;n++)if(u._row[n]^l)i[f]++;else{if(f===i.length-1){if(a=u._normalize(i)){for(r=0;e>r;r++)o=u._matchPattern(a,u.CODE_PATTERN[r]),o<s.error&&(s.code=r,s.error=o);return s.end=n,s.error>u.AVG_CODE_ERROR?null:s}}else f++;i[f]=1,l=!l}return null},o.prototype._findPattern=function(t,e,n,r,o){var a,i,u,c,l,f=[],s=this,d=0,h={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(e||(e=s._nextSet(s._row)),void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=s.AVG_CODE_ERROR),a=0;a<t.length;a++)f[a]=0;for(a=e;a<s._row.length;a++)if(s._row[a]^n)f[d]++;else{if(d===f.length-1){for(c=0,u=0;u<f.length;u++)c+=f[u];if(l=s._normalize(f),l&&(i=s._matchPattern(l,t),o>i))return h.error=i,h.start=a-c,h.end=a,h;if(!r)return null;for(u=0;u<f.length-2;u++)f[u]=f[u+2];f[f.length-2]=0,f[f.length-1]=0,d--}else d++;f[d]=1,n=!n}return null},o.prototype._findStart=function(){for(var t,e,n=this,r=n._nextSet(n._row);!e;){if(e=n._findPattern(n.START_PATTERN,r),!e)return null;if(t=e.start-(e.end-e.start),t>=0&&n._matchRange(t,e.start,0))return e;r=e.end,e=null}},o.prototype._verifyTrailingWhitespace=function(t){var e,n=this;return e=t.end+(t.end-t.start),e<n._row.length&&n._matchRange(t.end,e,0)?t:null},o.prototype._findEnd=function(t,e){var n=this,r=n._findPattern(n.STOP_PATTERN,t,e,!1);return null!==r?n._verifyTrailingWhitespace(r):null},o.prototype._calculateFirstDigit=function(t){var e,n=this;for(e=0;e<n.CODE_FREQUENCY.length;e++)if(t===n.CODE_FREQUENCY[e])return e;return null},o.prototype._decodePayload=function(t,e,n){var r,o,a=this,i=0;for(r=0;6>r;r++){if(t=a._decodeCode(t.end),!t)return null;t.code>=a.CODE_G_START?(t.code=t.code-a.CODE_G_START,i|=1<<5-r):i|=0<<5-r,e.push(t.code),n.push(t)}if(o=a._calculateFirstDigit(i),null===o)return null;if(e.unshift(o),t=a._findPattern(a.MIDDLE_PATTERN,t.end,!0,!1),null===t)return null;for(n.push(t),r=0;6>r;r++){if(t=a._decodeCode(t.end,a.CODE_G_START),!t)return null;n.push(t),e.push(t.code)}return t},o.prototype._decode=function(){var t,e,n=this,r=[],o=[];return(t=n._findStart())?(e={code:t.code,start:t.start,end:t.end},o.push(e),(e=n._decodePayload(e,r,o))&&(e=n._findEnd(e.end,!1))?(o.push(e),n._checksum(r)?{code:r.join(""),start:t.start,end:e.end,codeset:"",startInfo:t,decodedCodes:o}:null):null):null},o.prototype._checksum=function(t){var e,n=0;for(e=t.length-2;e>=0;e-=2)n+=t[e];for(n*=3,e=t.length-1;e>=0;e-=2)n+=t[e];return n%10===0},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(26),i=r(a),u=n(17),c=r(u),l={ALPHABETH_STRING:{value:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"},ALPHABET:{value:[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,45,46,32,42,36,47,43,37]},CHARACTER_ENCODINGS:{value:[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,148,168,162,138,42]},ASTERISK:{value:148},FORMAT:{value:"code_39",writeable:!1}};o.prototype=Object.create(i["default"].prototype,l),o.prototype.constructor=o,o.prototype._toCounters=function(t,e){var n,r=this,o=e.length,a=r._row.length,i=!r._row[t],u=0;for(c["default"].init(e,0),n=t;a>n;n++)if(r._row[n]^i)e[u]++;else{if(u++,u===o)break;e[u]=1,i=!i}return e},o.prototype._decode=function(){var t,e,n,r,o=this,a=[0,0,0,0,0,0,0,0,0],i=[],u=o._findStart();if(!u)return null;r=o._nextSet(o._row,u.end);do{if(a=o._toCounters(r,a),n=o._toPattern(a),0>n)return null;if(t=o._patternToChar(n),0>t)return null;i.push(t),e=r,r+=c["default"].sum(a),r=o._nextSet(o._row,r)}while("*"!==t);return i.pop(),i.length&&o._verifyTrailingWhitespace(e,r,a)?{code:i.join(""),start:u.start,end:r,startInfo:u,decodedCodes:i}:null},o.prototype._verifyTrailingWhitespace=function(t,e,n){var r,o=c["default"].sum(n);return r=e-t-o,3*r>=o?!0:!1},o.prototype._patternToChar=function(t){var e,n=this;for(e=0;e<n.CHARACTER_ENCODINGS.length;e++)if(n.CHARACTER_ENCODINGS[e]===t)return String.fromCharCode(n.ALPHABET[e]);return-1},o.prototype._findNextWidth=function(t,e){var n,r=Number.MAX_VALUE;for(n=0;n<t.length;n++)t[n]<r&&t[n]>e&&(r=t[n]);return r},o.prototype._toPattern=function(t){for(var e,n,r=t.length,o=0,a=r,i=0,u=this;a>3;){for(o=u._findNextWidth(t,o),a=0,e=0,n=0;r>n;n++)t[n]>o&&(e|=1<<r-1-n,a++,i+=t[n]);if(3===a){for(n=0;r>n&&a>0;n++)if(t[n]>o&&(a--,2*t[n]>=i))return-1;return e}}return-1},o.prototype._findStart=function(){var t,e,n,r=this,o=r._nextSet(r._row),a=o,i=[0,0,0,0,0,0,0,0,0],u=0,c=!1;for(t=o;t<r._row.length;t++)if(r._row[t]^c)i[u]++;else{if(u===i.length-1){if(r._toPattern(i)===r.ASTERISK&&(n=Math.floor(Math.max(0,a-(t-a)/4)),r._matchRange(n,a,0)))return{start:a,end:t};for(a+=i[0]+i[1],e=0;7>e;e++)i[e]=i[e+2];i[7]=0,i[8]=0,u--}else u++;i[u]=1,c=!c}return null},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(28),i=r(a),u={IOQ:/[IOQ]/g,AZ09:/[A-Z0-9]{17}/};o.prototype=Object.create(i["default"].prototype),o.prototype.constructor=o,o.prototype._decode=function(){var t=i["default"].prototype._decode.apply(this);if(!t)return null;var e=t.code;return e?(e=e.replace(u.IOQ,""),e.match(u.AZ09)?this._checkChecksum(e)?(t.code=e,t):null:(console.log("Failed AZ09 pattern code:",e),null)):null},o.prototype._checkChecksum=function(t){return!!t},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this),this._counters=[]}Object.defineProperty(e,"__esModule",{value:!0});var a=n(26),i=r(a),u={ALPHABETH_STRING:{value:"0123456789-$:/.+ABCD"},ALPHABET:{value:[48,49,50,51,52,53,54,55,56,57,45,36,58,47,46,43,65,66,67,68]},CHARACTER_ENCODINGS:{value:[3,6,9,96,18,66,33,36,48,72,12,24,69,81,84,21,26,41,11,14]},START_END:{value:[26,41,11,14]},MIN_ENCODED_CHARS:{value:4},MAX_ACCEPTABLE:{value:2},PADDING:{value:1.5},FORMAT:{value:"codabar",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decode=function(){var t,e,n,r,o,a=this,i=[];if(this._counters=a._fillCounters(),t=a._findStart(),!t)return null;r=t.startCounter;do{if(n=a._toPattern(r),0>n)return null;if(e=a._patternToChar(n),0>e)return null;if(i.push(e),r+=8,i.length>1&&a._isStartEnd(n))break}while(r<a._counters.length);return i.length-2<a.MIN_ENCODED_CHARS||!a._isStartEnd(n)?null:a._verifyWhitespace(t.startCounter,r-8)&&a._validateResult(i,t.startCounter)?(r=r>a._counters.length?a._counters.length:r,o=t.start+a._sumCounters(t.startCounter,r-8),{code:i.join(""),start:t.start,end:o,startInfo:t,decodedCodes:i}):null},o.prototype._verifyWhitespace=function(t,e){return(0>=t-1||this._counters[t-1]>=this._calculatePatternLength(t)/2)&&(e+8>=this._counters.length||this._counters[e+7]>=this._calculatePatternLength(e)/2)?!0:!1},o.prototype._calculatePatternLength=function(t){var e,n=0;for(e=t;t+7>e;e++)n+=this._counters[e];return n},o.prototype._thresholdResultPattern=function(t,e){var n,r,o,a,i,u=this,c={space:{narrow:{size:0,counts:0,min:0,max:Number.MAX_VALUE},wide:{size:0,counts:0,min:0,max:Number.MAX_VALUE}},bar:{narrow:{size:0,counts:0,min:0,max:Number.MAX_VALUE},wide:{size:0,counts:0,min:0,max:Number.MAX_VALUE}}},l=e;for(o=0;o<t.length;o++){for(i=u._charToPattern(t[o]),a=6;a>=0;a--)n=2===(1&a)?c.bar:c.space,r=1===(1&i)?n.wide:n.narrow,r.size+=u._counters[l+a],r.counts++,i>>=1;l+=8}return["space","bar"].forEach(function(t){var e=c[t];e.wide.min=Math.floor((e.narrow.size/e.narrow.counts+e.wide.size/e.wide.counts)/2),e.narrow.max=Math.ceil(e.wide.min),e.wide.max=Math.ceil((e.wide.size*u.MAX_ACCEPTABLE+u.PADDING)/e.wide.counts)}),c},o.prototype._charToPattern=function(t){var e,n=this,r=t.charCodeAt(0);for(e=0;e<n.ALPHABET.length;e++)if(n.ALPHABET[e]===r)return n.CHARACTER_ENCODINGS[e];return 0},o.prototype._validateResult=function(t,e){var n,r,o,a,i,u,c=this,l=c._thresholdResultPattern(t,e),f=e;for(n=0;n<t.length;n++){for(u=c._charToPattern(t[n]),r=6;r>=0;r--){if(o=0===(1&r)?l.bar:l.space,a=1===(1&u)?o.wide:o.narrow,i=c._counters[f+r],i<a.min||i>a.max)return!1;u>>=1}f+=8}return!0},o.prototype._patternToChar=function(t){var e,n=this;for(e=0;e<n.CHARACTER_ENCODINGS.length;e++)if(n.CHARACTER_ENCODINGS[e]===t)return String.fromCharCode(n.ALPHABET[e]);return-1},o.prototype._computeAlternatingThreshold=function(t,e){var n,r,o=Number.MAX_VALUE,a=0;for(n=t;e>n;n+=2)r=this._counters[n],r>a&&(a=r),o>r&&(o=r);return(o+a)/2|0},o.prototype._toPattern=function(t){var e,n,r,o,a=7,i=t+a,u=1<<a-1,c=0;if(i>this._counters.length)return-1;for(e=this._computeAlternatingThreshold(t,i),n=this._computeAlternatingThreshold(t+1,i),r=0;a>r;r++)o=0===(1&r)?e:n,this._counters[t+r]>o&&(c|=u),u>>=1;return c},o.prototype._isStartEnd=function(t){var e;for(e=0;e<this.START_END.length;e++)if(this.START_END[e]===t)return!0;return!1},o.prototype._sumCounters=function(t,e){var n,r=0;for(n=t;e>n;n++)r+=this._counters[n];return r},o.prototype._findStart=function(){var t,e,n,r=this,o=r._nextUnset(r._row);for(t=1;t<this._counters.length;t++)if(e=r._toPattern(t),-1!==e&&r._isStartEnd(e))return o+=r._sumCounters(0,t),n=o+r._sumCounters(t,t+8),{start:o,end:n,startCounter:t,endCounter:t+8}},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(27),i=r(a),u={FORMAT:{value:"upc_a",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decode=function(){var t=i["default"].prototype._decode.call(this);return t&&t.code&&13===t.code.length&&"0"===t.code.charAt(0)?(t.code=t.code.substring(1),t):null},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(27),i=r(a),u={FORMAT:{value:"ean_8",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decodePayload=function(t,e,n){var r,o=this;for(r=0;4>r;r++){if(t=o._decodeCode(t.end,o.CODE_G_START),!t)return null;e.push(t.code),n.push(t)}if(t=o._findPattern(o.MIDDLE_PATTERN,t.end,!0,!1),null===t)return null;for(n.push(t),r=0;4>r;r++){if(t=o._decodeCode(t.end,o.CODE_G_START),!t)return null;n.push(t),e.push(t.code)}return t},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){i["default"].call(this)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(27),i=r(a),u={CODE_FREQUENCY:{value:[[56,52,50,49,44,38,35,42,41,37],[7,11,13,14,19,25,28,21,22,26]]},STOP_PATTERN:{value:[1/6*7,1/6*7,1/6*7,1/6*7,1/6*7,1/6*7]},FORMAT:{value:"upc_e",writeable:!1}};o.prototype=Object.create(i["default"].prototype,u),o.prototype.constructor=o,o.prototype._decodePayload=function(t,e,n){var r,o=this,a=0;for(r=0;6>r;r++){if(t=o._decodeCode(t.end),!t)return null;t.code>=o.CODE_G_START&&(t.code=t.code-o.CODE_G_START,a|=1<<5-r),e.push(t.code),n.push(t)}return o._determineParity(a,e)?t:null},o.prototype._determineParity=function(t,e){var n,r;for(r=0;r<this.CODE_FREQUENCY.length;r++)for(n=0;n<this.CODE_FREQUENCY[r].length;n++)if(t===this.CODE_FREQUENCY[r][n])return e.unshift(r),e.push(n),!0;return!1},o.prototype._convertToUPCA=function(t){var e=[t[0]],n=t[t.length-2];return e=2>=n?e.concat(t.slice(1,3)).concat([n,0,0,0,0]).concat(t.slice(3,6)):3===n?e.concat(t.slice(1,4)).concat([0,0,0,0,0]).concat(t.slice(4,6)):4===n?e.concat(t.slice(1,5)).concat([0,0,0,0,0,t[5]]):e.concat(t.slice(1,6)).concat([0,0,0,0,n]),e.push(t[t.length-1]),e},o.prototype._checksum=function(t){return i["default"].prototype._checksum.call(this,this._convertToUPCA(t))},o.prototype._findEnd=function(t,e){return e=!0,i["default"].prototype._findEnd.call(this,t,e)},o.prototype._verifyTrailingWhitespace=function(t){var e,n=this;return e=t.end+(t.end-t.start)/2,e<n._row.length&&n._matchRange(t.end,e,0)?t:void 0},e["default"]=o,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){t=c(a(),t),u["default"].call(this,t),this.barSpaceRatio=[1,1],t.normalizeBarSpaceWidth&&(this.SINGLE_CODE_ERROR=.38,this.AVG_CODE_ERROR=.09)}function a(){var t={};return Object.keys(o.CONFIG_KEYS).forEach(function(e){t[e]=o.CONFIG_KEYS[e]["default"]}),t}Object.defineProperty(e,"__esModule",{value:!0});var i=n(26),u=r(i),c=n(35),l=1,f=3,s={MODULO:{value:10},START_PATTERN:{value:[2.5*l,2.5*l,2.5*l,2.5*l]},STOP_PATTERN:{value:[2*l,2*l,2*f]},CODE_PATTERN:{value:[[l,l,f,f,l],[f,l,l,l,f],[l,f,l,l,f],[f,f,l,l,l],[l,l,f,l,f],[f,l,f,l,l],[l,f,f,l,l],[l,l,l,f,f],[f,l,l,f,l],[l,f,l,f,l]]},SINGLE_CODE_ERROR:{value:.78,writable:!0},AVG_CODE_ERROR:{value:.38,writable:!0},MAX_CORRECTION_FACTOR:{value:5},FORMAT:{value:"i2of5"}};o.prototype=Object.create(u["default"].prototype,s),o.prototype.constructor=o,o.prototype._matchPattern=function(t,e){if(this.config.normalizeBarSpaceWidth){var n,r=[0,0],o=[0,0],a=[0,0],i=this.MAX_CORRECTION_FACTOR,c=1/i;for(n=0;n<t.length;n++)r[n%2]+=t[n],o[n%2]+=e[n];for(a[0]=o[0]/r[0],a[1]=o[1]/r[1],a[0]=Math.max(Math.min(a[0],i),c),a[1]=Math.max(Math.min(a[1],i),c),this.barSpaceRatio=a,n=0;n<t.length;n++)t[n]*=this.barSpaceRatio[n%2]}return u["default"].prototype._matchPattern.call(this,t,e)},o.prototype._findPattern=function(t,e,n,r){var o,a,i,u,c,l=[],f=this,s=0,d={error:Number.MAX_VALUE,code:-1,start:0,end:0},h=f.AVG_CODE_ERROR;for(n=n||!1,r=r||!1,e||(e=f._nextSet(f._row)),o=0;o<t.length;o++)l[o]=0;for(o=e;o<f._row.length;o++)if(f._row[o]^n)l[s]++;else{if(s===l.length-1){for(u=0,i=0;i<l.length;i++)u+=l[i];if(c=f._normalize(l),c&&(a=f._matchPattern(c,t),h>a))return d.error=a,d.start=o-u,d.end=o,d;if(!r)return null;for(i=0;i<l.length-2;i++)l[i]=l[i+2];l[l.length-2]=0,l[l.length-1]=0,s--}else s++;l[s]=1,n=!n}return null},o.prototype._findStart=function(){for(var t,e,n=this,r=n._nextSet(n._row),o=1;!e;){if(e=n._findPattern(n.START_PATTERN,r,!1,!0),!e)return null;if(o=Math.floor((e.end-e.start)/4),t=e.start-10*o,t>=0&&n._matchRange(t,e.start,0))return e;r=e.end,e=null}},o.prototype._verifyTrailingWhitespace=function(t){var e,n=this;return e=t.end+(t.end-t.start)/2,e<n._row.length&&n._matchRange(t.end,e,0)?t:null},o.prototype._findEnd=function(){var t,e,n=this;return n._row.reverse(),t=n._findPattern(n.STOP_PATTERN),n._row.reverse(),null===t?null:(e=t.start,t.start=n._row.length-t.end,t.end=n._row.length-e,null!==t?n._verifyTrailingWhitespace(t):null)},o.prototype._decodePair=function(t){var e,n,r=[],o=this;for(e=0;e<t.length;e++){if(n=o._decodeCode(t[e]),!n)return null;r.push(n)}return r},o.prototype._decodeCode=function(t){var e,n,r,o,a=this,i=0,u=a.AVG_CODE_ERROR,c={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(e=0;e<t.length;e++)i+=t[e];if(n=a._normalize(t)){for(o=0;o<a.CODE_PATTERN.length;o++)r=a._matchPattern(n,a.CODE_PATTERN[o]),r<c.error&&(c.code=o,c.error=r);if(c.error<u)return c}return null},o.prototype._decodePayload=function(t,e,n){for(var r,o,a=this,i=0,u=t.length,c=[[0,0,0,0,0],[0,0,0,0,0]];u>i;){for(r=0;5>r;r++)c[0][r]=t[i]*this.barSpaceRatio[0],c[1][r]=t[i+1]*this.barSpaceRatio[1],i+=2;if(o=a._decodePair(c),!o)return null;for(r=0;r<o.length;r++)e.push(o[r].code+""),n.push(o[r])}return o},o.prototype._verifyCounterLength=function(t){return t.length%10===0},o.prototype._decode=function(){var t,e,n,r,o=this,a=[],i=[];return(t=o._findStart())?(i.push(t),(e=o._findEnd())?(r=o._fillCounters(t.end,e.start,!1),o._verifyCounterLength(r)&&(n=o._decodePayload(r,a,i))?a.length%2!==0||a.length<6?null:(i.push(e),{code:a.join(""),start:t.start,end:e.end,startInfo:t,decodedCodes:i}):null):null):null},o.CONFIG_KEYS={normalizeBarSpaceWidth:{type:"boolean","default":!1,description:"If true, the reader tries to normalize thewidth-difference between bars and spaces"}},e["default"]=o,t.exports=e["default"]},function(t,e,n){var r=n(36),o=n(63),a=o(r);t.exports=a},function(t,e,n){function r(t,e,n,d,h){if(!c(t))return t;var p=u(e)&&(i(e)||f(e)),v=p?void 0:s(e);return o(v||e,function(o,i){if(v&&(i=o,o=e[i]),l(o))d||(d=[]),h||(h=[]),a(t,e,i,r,n,d,h);else{var u=t[i],c=n?n(u,o,i,t,e):void 0,f=void 0===c;f&&(c=o),void 0===c&&(!p||i in t)||!f&&(c===c?c===u:u!==u)||(t[i]=c)}}),t}var o=n(37),a=n(38),i=n(46),u=n(41),c=n(50),l=n(45),f=n(58),s=n(61);t.exports=r},function(t,e){function n(t,e){for(var n=-1,r=t.length;++n<r&&e(t[n],n,t)!==!1;);return t}t.exports=n},function(t,e,n){function r(t,e,n,r,s,d,h){for(var p=d.length,v=e[n];p--;)if(d[p]==v)return void(t[n]=h[p]);var g=t[n],m=s?s(g,v,n,t,e):void 0,y=void 0===m;y&&(m=v,u(v)&&(i(v)||l(v))?m=i(g)?g:u(g)?o(g):[]:c(v)||a(v)?m=a(g)?f(g):c(g)?g:{}:y=!1),d.push(v),h.push(m),y?t[n]=r(m,v,s,d,h):(m===m?m!==g:g===g)&&(t[n]=m)}var o=n(39),a=n(40),i=n(46),u=n(41),c=n(51),l=n(58),f=n(59);t.exports=r},function(t,e){function n(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}t.exports=n},function(t,e,n){function r(t){return a(t)&&o(t)&&u.call(t,"callee")&&!c.call(t,"callee")}var o=n(41),a=n(45),i=Object.prototype,u=i.hasOwnProperty,c=i.propertyIsEnumerable;t.exports=r},function(t,e,n){function r(t){return null!=t&&a(o(t))}var o=n(42),a=n(44);t.exports=r},function(t,e,n){var r=n(43),o=r("length");t.exports=o},function(t,e){function n(t){return function(e){return null==e?void 0:e[t];
}}t.exports=n},function(t,e){function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){function n(t){return!!t&&"object"==typeof t}t.exports=n},function(t,e,n){var r=n(47),o=n(44),a=n(45),i="[object Array]",u=Object.prototype,c=u.toString,l=r(Array,"isArray"),f=l||function(t){return a(t)&&o(t.length)&&c.call(t)==i};t.exports=f},function(t,e,n){function r(t,e){var n=null==t?void 0:t[e];return o(n)?n:void 0}var o=n(48);t.exports=r},function(t,e,n){function r(t){return null==t?!1:o(t)?f.test(c.call(t)):a(t)&&i.test(t)}var o=n(49),a=n(45),i=/^\[object .+?Constructor\]$/,u=Object.prototype,c=Function.prototype.toString,l=u.hasOwnProperty,f=RegExp("^"+c.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e,n){function r(t){return o(t)&&u.call(t)==a}var o=n(50),a="[object Function]",i=Object.prototype,u=i.toString;t.exports=r},function(t,e){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){function r(t){var e;if(!i(t)||f.call(t)!=u||a(t)||!l.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var n;return o(t,function(t,e){n=e}),void 0===n||l.call(t,n)}var o=n(52),a=n(40),i=n(45),u="[object Object]",c=Object.prototype,l=c.hasOwnProperty,f=c.toString;t.exports=r},function(t,e,n){function r(t,e){return o(t,e,a)}var o=n(53),a=n(56);t.exports=r},function(t,e,n){var r=n(54),o=r();t.exports=o},function(t,e,n){function r(t){return function(e,n,r){for(var a=o(e),i=r(e),u=i.length,c=t?u:-1;t?c--:++c<u;){var l=i[c];if(n(a[l],l,a)===!1)break}return e}}var o=n(55);t.exports=r},function(t,e,n){function r(t){return o(t)?t:Object(t)}var o=n(50);t.exports=r},function(t,e,n){function r(t){if(null==t)return[];c(t)||(t=Object(t));var e=t.length;e=e&&u(e)&&(a(t)||o(t))&&e||0;for(var n=t.constructor,r=-1,l="function"==typeof n&&n.prototype===t,s=Array(e),d=e>0;++r<e;)s[r]=r+"";for(var h in t)d&&i(h,e)||"constructor"==h&&(l||!f.call(t,h))||s.push(h);return s}var o=n(40),a=n(46),i=n(57),u=n(44),c=n(50),l=Object.prototype,f=l.hasOwnProperty;t.exports=r},function(t,e){function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?o:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,o=9007199254740991;t.exports=n},function(t,e,n){function r(t){return a(t)&&o(t.length)&&!!T[S.call(t)]}var o=n(44),a=n(45),i="[object Arguments]",u="[object Array]",c="[object Boolean]",l="[object Date]",f="[object Error]",s="[object Function]",d="[object Map]",h="[object Number]",p="[object Object]",v="[object RegExp]",g="[object Set]",m="[object String]",y="[object WeakMap]",_="[object ArrayBuffer]",x="[object Float32Array]",M="[object Float64Array]",w="[object Int8Array]",b="[object Int16Array]",R="[object Int32Array]",E="[object Uint8Array]",A="[object Uint8ClampedArray]",C="[object Uint16Array]",O="[object Uint32Array]",T={};T[x]=T[M]=T[w]=T[b]=T[R]=T[E]=T[A]=T[C]=T[O]=!0,T[i]=T[u]=T[_]=T[c]=T[l]=T[f]=T[s]=T[d]=T[h]=T[p]=T[v]=T[g]=T[m]=T[y]=!1;var D=Object.prototype,S=D.toString;t.exports=r},function(t,e,n){function r(t){return o(t,a(t))}var o=n(60),a=n(56);t.exports=r},function(t,e){function n(t,e,n){n||(n={});for(var r=-1,o=e.length;++r<o;){var a=e[r];n[a]=t[a]}return n}t.exports=n},function(t,e,n){var r=n(47),o=n(41),a=n(50),i=n(62),u=r(Object,"keys"),c=u?function(t){var e=null==t?void 0:t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&o(t)?i(t):a(t)?u(t):[]}:i;t.exports=c},function(t,e,n){function r(t){for(var e=c(t),n=e.length,r=n&&t.length,l=!!r&&u(r)&&(a(t)||o(t)),s=-1,d=[];++s<n;){var h=e[s];(l&&i(h,r)||f.call(t,h))&&d.push(h)}return d}var o=n(40),a=n(46),i=n(57),u=n(44),c=n(56),l=Object.prototype,f=l.hasOwnProperty;t.exports=r},function(t,e,n){function r(t){return i(function(e,n){var r=-1,i=null==e?0:n.length,u=i>2?n[i-2]:void 0,c=i>2?n[2]:void 0,l=i>1?n[i-1]:void 0;for("function"==typeof u?(u=o(u,l,5),i-=2):(u="function"==typeof l?l:void 0,i-=u?1:0),c&&a(n[0],n[1],c)&&(u=3>i?void 0:u,i=1);++r<i;){var f=n[r];f&&t(e,f,u)}return e})}var o=n(64),a=n(66),i=n(67);t.exports=r},function(t,e,n){function r(t,e,n){if("function"!=typeof t)return o;if(void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,o){return t.call(e,n,r,o)};case 4:return function(n,r,o,a){return t.call(e,n,r,o,a)};case 5:return function(n,r,o,a,i){return t.call(e,n,r,o,a,i)}}return function(){return t.apply(e,arguments)}}var o=n(65);t.exports=r},function(t,e){function n(t){return t}t.exports=n},function(t,e,n){function r(t,e,n){if(!i(n))return!1;var r=typeof e;if("number"==r?o(n)&&a(e,n.length):"string"==r&&e in n){var u=n[e];return t===t?t===u:u!==u}return!1}var o=n(41),a=n(57),i=n(50);t.exports=r},function(t,e){function n(t,e){if("function"!=typeof t)throw new TypeError(r);return e=o(void 0===e?t.length-1:+e||0,0),function(){for(var n=arguments,r=-1,a=o(n.length-e,0),i=Array(a);++r<a;)i[r]=n[e+r];switch(e){case 0:return t.call(this,i);case 1:return t.call(this,n[0],i);case 2:return t.call(this,n[0],n[1],i)}var u=Array(e+1);for(r=-1;++r<e;)u[r]=n[r];return u[e]=i,t.apply(this,u)}}var r="Expected a function",o=Math.max;t.exports=n},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={inputStream:{name:"Live",type:"LiveStream",constraints:{width:640,height:480,minAspectRatio:0,maxAspectRatio:100,facing:"environment"},area:{top:"0%",right:"0%",left:"0%",bottom:"0%"},singleChannel:!1},tracking:!1,debug:!1,controls:!1,locate:!0,numOfWorkers:4,visual:{show:!0},decoder:{drawBoundingBox:!1,showFrequency:!1,drawScanline:!1,showPattern:!1,readers:["code_128_reader"]},locator:{halfSample:!0,patchSize:"medium",showCanvas:!1,showPatches:!1,showFoundPatches:!1,showSkeleton:!1,showLabels:!1,showPatchLabels:!1,showRemainingPatchLabels:!1,boxFromPatches:{showTransformed:!1,showTransformedBox:!1,showBB:!1}}},t.exports=e["default"]},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=function(){function t(t){return o[t]||(o[t]={subscribers:[]}),o[t]}function e(){o={}}function n(t,e){t.async?setTimeout(function(){t.callback(e)},4):t.callback(e)}function r(e,n,r){var o;if("function"==typeof n)o={callback:n,async:r};else if(o=n,!o.callback)throw"Callback was not specified on options";t(e).subscribers.push(o)}var o={};return{subscribe:function(t,e,n){return r(t,e,n)},publish:function(e,r){var o=t(e),a=o.subscribers;o.subscribers=a.filter(function(t){return n(t,r),!t.once})},once:function(t,e,n){r(t,{callback:e,async:n,once:!0})},unsubscribe:function(n,r){var o;n?(o=t(n),o&&r?o.subscribers=o.subscribers.filter(function(t){return t.callback!==r}):o.subscribers=[]):e()}}}(),t.exports=e["default"]},function(t,e,n){"use strict";function r(t,e,n){"undefined"!=typeof navigator.getUserMedia?navigator.getUserMedia(t,function(t){c=t;var n=window.URL&&window.URL.createObjectURL(t)||t;e.apply(null,[n])},n):n(new TypeError("getUserMedia not available"))}function o(t,e){function n(){r>0?t.videoWidth>0&&t.videoHeight>0?(console.log(t.videoWidth+"px x "+t.videoHeight+"px"),e()):window.setTimeout(n,500):e("Unable to play video stream. Is webcam working?"),r--}var r=10;n()}function a(t,e,n){r(t,function(t){e.src=t,l&&e.removeEventListener("loadeddata",l,!1),l=o.bind(null,e,n),e.addEventListener("loadeddata",l,!1),e.play()},function(t){n(t)})}function i(t,e){var n={audio:!1,video:!0},r=f({width:640,height:480,minAspectRatio:0,maxAspectRatio:100,facing:"environment"},t);return"undefined"==typeof MediaStreamTrack||"undefined"==typeof MediaStreamTrack.getSources?(n.video={mediaSource:"camera",width:{min:r.width,max:r.width},height:{min:r.height,max:r.height},require:["width","height"]},e(n)):void MediaStreamTrack.getSources(function(t){for(var o,a=0;a<t.length;++a){var i=t[a];"video"===i.kind&&i.facing===r.facing&&(o=i.id)}return n.video={mandatory:{minWidth:r.width,minHeight:r.height,minAspectRatio:r.minAspectRatio,maxAspectRatio:r.maxAspectRatio},optional:[{sourceId:o}]},e(n)})}function u(t,e,n){i(e,function(e){a(e,t,n)})}Object.defineProperty(e,"__esModule",{value:!0});var c,l,f=n(35);e["default"]={request:function(t,e,n){u(t,e,n)},release:function(){var t=c&&c.getVideoTracks();t.length&&t[0].stop(),c=null}},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return e?e.some(function(e){return Object.keys(e).every(function(n){return e[n]===t[n]})}):!1}function a(t,e){return"function"==typeof e?e(t):!0}Object.defineProperty(e,"__esModule",{value:!0});var i=n(22),u=r(i);e["default"]={create:function(t){function e(e){return c&&e&&!o(e,t.blacklist)&&a(e,t.filter)}var n=document.createElement("canvas"),r=n.getContext("2d"),i=[],c=t.capacity||20,l=t.capture===!0;return{addResult:function(t,o,a){var f={};e(a)&&(c--,f.codeResult=a,l&&(n.width=o.x,n.height=o.y,u["default"].drawImage(t,o,r),f.frame=n.toDataURL()),i.push(f))},getResults:function(){return i}}}},t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(73),a=r(o),i={};i.createVideoStream=function(t){function e(){var e=t.videoWidth,o=t.videoHeight;n=a.size?e/o>1?a.size:Math.floor(e/o*a.size):e,r=a.size?e/o>1?Math.floor(o/e*a.size):a.size:o,l.x=n,l.y=r}var n,r,o={},a=null,i=["canrecord","ended"],u={},c={x:0,y:0},l={x:0,y:0};return o.getRealWidth=function(){return t.videoWidth},o.getRealHeight=function(){return t.videoHeight},o.getWidth=function(){return n},o.getHeight=function(){return r},o.setWidth=function(t){n=t},o.setHeight=function(t){r=t},o.setInputStream=function(e){a=e,t.src="undefined"!=typeof e.src?e.src:""},o.ended=function(){return t.ended},o.getConfig=function(){return a},o.setAttribute=function(e,n){t.setAttribute(e,n)},o.pause=function(){t.pause()},o.play=function(){t.play()},o.setCurrentTime=function(e){"LiveStream"!==a.type&&(t.currentTime=e)},o.addEventListener=function(e,n,r){-1!==i.indexOf(e)?(u[e]||(u[e]=[]),u[e].push(n)):t.addEventListener(e,n,r)},o.clearEventHandlers=function(){i.forEach(function(e){var n=u[e];n&&n.length>0&&n.forEach(function(n){t.removeEventListener(e,n)})})},o.trigger=function(t,n){var r,a=u[t];if("canrecord"===t&&e(),a&&a.length>0)for(r=0;r<a.length;r++)a[r].apply(o,n)},o.setTopRight=function(t){c.x=t.x,c.y=t.y},o.getTopRight=function(){return c},o.setCanvasSize=function(t){l.x=t.x,l.y=t.y},o.getCanvasSize=function(){return l},o.getFrame=function(){return t},o},i.createLiveStream=function(t){t.setAttribute("autoplay",!0);var e=i.createVideoStream(t);return e.ended=function(){return!1},e},i.createImageStream=function(){function t(){s=!1,a["default"].load(v,function(t){d=t,u=t[0].width,c=t[0].height,n=i.size?u/c>1?i.size:Math.floor(u/c*i.size):u,r=i.size?u/c>1?Math.floor(c/u*i.size):i.size:c,x.x=n,x.y=r,s=!0,l=0,setTimeout(function(){e("canrecord",[])},0)},p,h,i.sequence)}function e(t,e){var n,r=y[t];if(r&&r.length>0)for(n=0;n<r.length;n++)r[n].apply(o,e)}var n,r,o={},i=null,u=0,c=0,l=0,f=!0,s=!1,d=null,h=0,p=1,v=null,g=!1,m=["canrecord","ended"],y={},_={x:0,y:0},x={x:0,y:0};return o.trigger=e,o.getWidth=function(){return n},o.getHeight=function(){return r},o.setWidth=function(t){n=t},o.setHeight=function(t){r=t},o.getRealWidth=function(){return u},o.getRealHeight=function(){return c},o.setInputStream=function(e){i=e,e.sequence===!1?(v=e.src,h=1):(v=e.src,h=e.length),t()},o.ended=function(){return g},o.setAttribute=function(){},o.getConfig=function(){return i},o.pause=function(){f=!0},o.play=function(){f=!1},o.setCurrentTime=function(t){l=t},o.addEventListener=function(t,e){-1!==m.indexOf(t)&&(y[t]||(y[t]=[]),y[t].push(e))},o.setTopRight=function(t){_.x=t.x,_.y=t.y},o.getTopRight=function(){return _},o.setCanvasSize=function(t){x.x=t.x,x.y=t.y},o.getCanvasSize=function(){return x},o.getFrame=function(){var t;return s?(f||(t=d[l],h-1>l?l++:setTimeout(function(){g=!0,e("ended",[])},0)),t):null},o},e["default"]=i,t.exports=e["default"]},function(t,e){"use strict";function n(t,e){t.onload=function(){e.loaded(this)}}Object.defineProperty(e,"__esModule",{value:!0});var r={};r.load=function(t,e,r,o,a){var i,u,c,l=new Array(o),f=new Array(l.length);if(a===!1)l[0]=t;else for(i=0;i<l.length;i++)c=r+i,l[i]=t+"image-"+("00"+c).slice(-3)+".jpg";for(f.notLoaded=[],f.addImage=function(t){f.notLoaded.push(t)},f.loaded=function(t){for(var n=f.notLoaded,r=0;r<n.length;r++)if(n[r]===t){n.splice(r,1);for(var o=0;o<l.length;o++){var a=l[o].substr(l[o].lastIndexOf("/"));if(-1!==t.src.lastIndexOf(a)){f[o]=t;break}}break}0===n.length&&(console.log("Images loaded"),e.apply(null,[f]))},i=0;i<l.length;i++)u=new Image,f.addImage(u),n(u,f),u.src=l[i]},e["default"]=r,t.exports=e["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),a=r(o),i={};i.create=function(t,e){var n,r={},o=t.getConfig(),i=a["default"].imageRef(t.getRealWidth(),t.getRealHeight()),u=t.getCanvasSize(),c=a["default"].imageRef(t.getWidth(),t.getHeight()),l=t.getTopRight(),f=l.x,s=l.y,d=null,h=null;return n=e?e:document.createElement("canvas"),n.width=u.x,n.height=u.y,d=n.getContext("2d"),h=new Uint8Array(c.x*c.y),console.log("FrameGrabber",JSON.stringify({size:c,topRight:l,videoSize:i,canvasSize:u})),r.attachData=function(t){h=t},r.getData=function(){return h},r.grab=function(){var e,n=o.halfSample,r=t.getFrame();return r?(d.drawImage(r,0,0,u.x,u.y),e=d.getImageData(f,s,c.x,c.y).data,n?a["default"].grayAndHalfSampleFromCanvasData(e,c,h):a["default"].computeGray(e,h,o),!0):!1},r.getSize=function(){return c},r},e["default"]=i,t.exports=e["default"]}])});