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/examples/js/quagga.min.js

3 lines
109 KiB
JavaScript

10 years ago
!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 Wo
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.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]