From 1643c76aef19283f3392ee63e5e56028c37ba3b2 Mon Sep 17 00:00:00 2001 From: "Ciro S. Costa" Date: Tue, 26 Aug 2014 10:35:36 -0300 Subject: [PATCH] bumps version and updates dist files --- bower.json | 2 +- build/qcode-decoder.js | 44 +++++++++++++++++++++++------------- build/qcode-decoder.min.js | 2 +- build/vendor/jsqrcode.min.js | 2 +- package.json | 2 +- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/bower.json b/bower.json index 5c96b3b..65f0951 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "qcode-decoder", "main": "build/main.min.js", "description": "Decodes QRCode in the browser and node", - "version": "0.0.5", + "version": "0.0.6", "homepage": "https://github.com/cirocosta/qcode-decoder", "authors": [ "Ciro S. Costa " diff --git a/build/qcode-decoder.js b/build/qcode-decoder.js index 757d28b..86ea4ff 100644 --- a/build/qcode-decoder.js +++ b/build/qcode-decoder.js @@ -3873,20 +3873,29 @@ QRCodeDecoder.prototype._captureToCanvas = function () { clearTimeout(this.tmrCapture); } - if (!this.videoDimensions && this.videoElem.videoWidth && this.videoElem.videoHeight) { + if (!this.videoDimensions && + this.videoElem.videoWidth && + this.videoElem.videoHeight) { + this.videoDimensions = { w: this.videoElem.videoWidth, h: this.videoElem.videoHeight }; - this.prepareCanvas(this.canvasElem, this.videoDimensions.w, this.videoDimensions.h); + + this.prepareCanvas(this.canvasElem, + this.videoDimensions.w, + this.videoDimensions.h); } if (this.videoDimensions) { var gCtx = this.canvasElem.getContext("2d"); - gCtx.clearRect(0, 0, this.videoElem.videoWidth, this.videoElem.videoHeight); + gCtx.clearRect(0, 0, this.videoElem.videoWidth, + this.videoElem.videoHeight); try{ - gCtx.drawImage(this.videoElem, 0, 0,this.videoDimensions.w, this.videoDimensions.h); + gCtx.drawImage(this.videoElem, 0, 0, + this.videoDimensions.w, + this.videoDimensions.h); qrcode.decode(); return; } @@ -3927,7 +3936,7 @@ QRCodeDecoder.prototype.isCanvasSupported = function () { */ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) { var scope = this; - + this.stop(); navigator.getUserMedia = navigator.getUserMedia || @@ -3949,10 +3958,11 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) { console.log('Couldn\'t get video from camera'); } }; - - /** -+ * Releases a video stream that was being captured by prepareToVideo -+ */ + +/** + * Releases a video stream that was being + * captured by prepareToVideo + */ QRCodeDecoder.prototype.stop = function() { if (this.stream) { this.stream.stop(); @@ -3968,12 +3978,13 @@ QRCodeDecoder.prototype.stop = function() { /** * Sets the sourceId for the camera to use. * - * The sourceId can be found using the getVideoSources - * function on a browser that supports it (currently - * only Chrome). - * - * @param {String} sourceId The id of the video - * source you want to use (or false to use the current default) + * The sourceId can be found using the + * getVideoSources function on a browser that + * supports it (currently only Chrome). + * + * @param {String} sourceId The id of the + * video source you want to use (or false to use + * the current default) */ QRCodeDecoder.prototype.setSourceId = function (sourceId) { if (sourceId) { @@ -3996,7 +4007,8 @@ QRCodeDecoder.prototype.setDecoderCallback = function (cb) { }; /** - * Gets a list of all available video sources on the device + * Gets a list of all available video sources on + * the device */ QRCodeDecoder.prototype.getVideoSources = function(cb) { var sources = []; diff --git a/build/qcode-decoder.min.js b/build/qcode-decoder.min.js index d3a31f6..136af9d 100644 --- a/build/qcode-decoder.min.js +++ b/build/qcode-decoder.min.js @@ -1,2 +1,2 @@ function ECB(e,t){this.count=e,this.dataCodewords=t,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function ECBlocks(e,t,r){this.ecCodewordsPerBlock=e,this.ecBlocks=r?new Array(t,r):new Array(t),this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock}),this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks}),this.__defineGetter__("NumBlocks",function(){for(var e=0,t=0;tn;n++)for(var i=this.alignmentPatternCenters[n]-2,o=0;r>o;o++)0==n&&(0==o||o==r-1)||n==r-1&&0==o||t.setRegion(this.alignmentPatternCenters[o]-2,i,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},this.getECBlocksForLevel=function(e){return this.ecBlocks[e.ordinal()]}}function buildVersions(){return new Array(new Version(1,new Array,new ECBlocks(7,new ECB(1,19)),new ECBlocks(10,new ECB(1,16)),new ECBlocks(13,new ECB(1,13)),new ECBlocks(17,new ECB(1,9))),new Version(2,new Array(6,18),new ECBlocks(10,new ECB(1,34)),new ECBlocks(16,new ECB(1,28)),new ECBlocks(22,new ECB(1,22)),new ECBlocks(28,new ECB(1,16))),new Version(3,new Array(6,22),new ECBlocks(15,new ECB(1,55)),new ECBlocks(26,new ECB(1,44)),new ECBlocks(18,new ECB(2,17)),new ECBlocks(22,new ECB(2,13))),new Version(4,new Array(6,26),new ECBlocks(20,new ECB(1,80)),new ECBlocks(18,new ECB(2,32)),new ECBlocks(26,new ECB(2,24)),new ECBlocks(16,new ECB(4,9))),new Version(5,new Array(6,30),new ECBlocks(26,new ECB(1,108)),new ECBlocks(24,new ECB(2,43)),new ECBlocks(18,new ECB(2,15),new ECB(2,16)),new ECBlocks(22,new ECB(2,11),new ECB(2,12))),new Version(6,new Array(6,34),new ECBlocks(18,new ECB(2,68)),new ECBlocks(16,new ECB(4,27)),new ECBlocks(24,new ECB(4,19)),new ECBlocks(28,new ECB(4,15))),new Version(7,new Array(6,22,38),new ECBlocks(20,new ECB(2,78)),new ECBlocks(18,new ECB(4,31)),new ECBlocks(18,new ECB(2,14),new ECB(4,15)),new ECBlocks(26,new ECB(4,13),new ECB(1,14))),new Version(8,new Array(6,24,42),new ECBlocks(24,new ECB(2,97)),new ECBlocks(22,new ECB(2,38),new ECB(2,39)),new ECBlocks(22,new ECB(4,18),new ECB(2,19)),new ECBlocks(26,new ECB(4,14),new ECB(2,15))),new Version(9,new Array(6,26,46),new ECBlocks(30,new ECB(2,116)),new ECBlocks(22,new ECB(3,36),new ECB(2,37)),new ECBlocks(20,new ECB(4,16),new ECB(4,17)),new ECBlocks(24,new ECB(4,12),new ECB(4,13))),new Version(10,new Array(6,28,50),new ECBlocks(18,new ECB(2,68),new ECB(2,69)),new ECBlocks(26,new ECB(4,43),new ECB(1,44)),new ECBlocks(24,new ECB(6,19),new ECB(2,20)),new ECBlocks(28,new ECB(6,15),new ECB(2,16))),new Version(11,new Array(6,30,54),new ECBlocks(20,new ECB(4,81)),new ECBlocks(30,new ECB(1,50),new ECB(4,51)),new ECBlocks(28,new ECB(4,22),new ECB(4,23)),new ECBlocks(24,new ECB(3,12),new ECB(8,13))),new Version(12,new Array(6,32,58),new ECBlocks(24,new ECB(2,92),new ECB(2,93)),new ECBlocks(22,new ECB(6,36),new ECB(2,37)),new ECBlocks(26,new ECB(4,20),new ECB(6,21)),new ECBlocks(28,new ECB(7,14),new ECB(4,15))),new Version(13,new Array(6,34,62),new ECBlocks(26,new ECB(4,107)),new ECBlocks(22,new ECB(8,37),new ECB(1,38)),new ECBlocks(24,new ECB(8,20),new ECB(4,21)),new ECBlocks(22,new ECB(12,11),new ECB(4,12))),new Version(14,new Array(6,26,46,66),new ECBlocks(30,new ECB(3,115),new ECB(1,116)),new ECBlocks(24,new ECB(4,40),new ECB(5,41)),new ECBlocks(20,new ECB(11,16),new ECB(5,17)),new ECBlocks(24,new ECB(11,12),new ECB(5,13))),new Version(15,new Array(6,26,48,70),new ECBlocks(22,new ECB(5,87),new ECB(1,88)),new ECBlocks(24,new ECB(5,41),new ECB(5,42)),new ECBlocks(30,new ECB(5,24),new ECB(7,25)),new ECBlocks(24,new ECB(11,12),new ECB(7,13))),new Version(16,new Array(6,26,50,74),new ECBlocks(24,new ECB(5,98),new ECB(1,99)),new ECBlocks(28,new ECB(7,45),new ECB(3,46)),new ECBlocks(24,new ECB(15,19),new ECB(2,20)),new ECBlocks(30,new ECB(3,15),new ECB(13,16))),new Version(17,new Array(6,30,54,78),new ECBlocks(28,new ECB(1,107),new ECB(5,108)),new ECBlocks(28,new ECB(10,46),new ECB(1,47)),new ECBlocks(28,new ECB(1,22),new ECB(15,23)),new ECBlocks(28,new ECB(2,14),new ECB(17,15))),new Version(18,new Array(6,30,56,82),new ECBlocks(30,new ECB(5,120),new ECB(1,121)),new ECBlocks(26,new ECB(9,43),new ECB(4,44)),new ECBlocks(28,new ECB(17,22),new ECB(1,23)),new ECBlocks(28,new ECB(2,14),new ECB(19,15))),new Version(19,new Array(6,30,58,86),new ECBlocks(28,new ECB(3,113),new ECB(4,114)),new ECBlocks(26,new ECB(3,44),new ECB(11,45)),new ECBlocks(26,new ECB(17,21),new ECB(4,22)),new ECBlocks(26,new ECB(9,13),new ECB(16,14))),new Version(20,new Array(6,34,62,90),new ECBlocks(28,new ECB(3,107),new ECB(5,108)),new ECBlocks(26,new ECB(3,41),new ECB(13,42)),new ECBlocks(30,new ECB(15,24),new ECB(5,25)),new ECBlocks(28,new ECB(15,15),new ECB(10,16))),new Version(21,new Array(6,28,50,72,94),new ECBlocks(28,new ECB(4,116),new ECB(4,117)),new ECBlocks(26,new ECB(17,42)),new ECBlocks(28,new ECB(17,22),new ECB(6,23)),new ECBlocks(30,new ECB(19,16),new ECB(6,17))),new Version(22,new Array(6,26,50,74,98),new ECBlocks(28,new ECB(2,111),new ECB(7,112)),new ECBlocks(28,new ECB(17,46)),new ECBlocks(30,new ECB(7,24),new ECB(16,25)),new ECBlocks(24,new ECB(34,13))),new Version(23,new Array(6,30,54,74,102),new ECBlocks(30,new ECB(4,121),new ECB(5,122)),new ECBlocks(28,new ECB(4,47),new ECB(14,48)),new ECBlocks(30,new ECB(11,24),new ECB(14,25)),new ECBlocks(30,new ECB(16,15),new ECB(14,16))),new Version(24,new Array(6,28,54,80,106),new ECBlocks(30,new ECB(6,117),new ECB(4,118)),new ECBlocks(28,new ECB(6,45),new ECB(14,46)),new ECBlocks(30,new ECB(11,24),new ECB(16,25)),new ECBlocks(30,new ECB(30,16),new ECB(2,17))),new Version(25,new Array(6,32,58,84,110),new ECBlocks(26,new ECB(8,106),new ECB(4,107)),new ECBlocks(28,new ECB(8,47),new ECB(13,48)),new ECBlocks(30,new ECB(7,24),new ECB(22,25)),new ECBlocks(30,new ECB(22,15),new ECB(13,16))),new Version(26,new Array(6,30,58,86,114),new ECBlocks(28,new ECB(10,114),new ECB(2,115)),new ECBlocks(28,new ECB(19,46),new ECB(4,47)),new ECBlocks(28,new ECB(28,22),new ECB(6,23)),new ECBlocks(30,new ECB(33,16),new ECB(4,17))),new Version(27,new Array(6,34,62,90,118),new ECBlocks(30,new ECB(8,122),new ECB(4,123)),new ECBlocks(28,new ECB(22,45),new ECB(3,46)),new ECBlocks(30,new ECB(8,23),new ECB(26,24)),new ECBlocks(30,new ECB(12,15),new ECB(28,16))),new Version(28,new Array(6,26,50,74,98,122),new ECBlocks(30,new ECB(3,117),new ECB(10,118)),new ECBlocks(28,new ECB(3,45),new ECB(23,46)),new ECBlocks(30,new ECB(4,24),new ECB(31,25)),new ECBlocks(30,new ECB(11,15),new ECB(31,16))),new Version(29,new Array(6,30,54,78,102,126),new ECBlocks(30,new ECB(7,116),new ECB(7,117)),new ECBlocks(28,new ECB(21,45),new ECB(7,46)),new ECBlocks(30,new ECB(1,23),new ECB(37,24)),new ECBlocks(30,new ECB(19,15),new ECB(26,16))),new Version(30,new Array(6,26,52,78,104,130),new ECBlocks(30,new ECB(5,115),new ECB(10,116)),new ECBlocks(28,new ECB(19,47),new ECB(10,48)),new ECBlocks(30,new ECB(15,24),new ECB(25,25)),new ECBlocks(30,new ECB(23,15),new ECB(25,16))),new Version(31,new Array(6,30,56,82,108,134),new ECBlocks(30,new ECB(13,115),new ECB(3,116)),new ECBlocks(28,new ECB(2,46),new ECB(29,47)),new ECBlocks(30,new ECB(42,24),new ECB(1,25)),new ECBlocks(30,new ECB(23,15),new ECB(28,16))),new Version(32,new Array(6,34,60,86,112,138),new ECBlocks(30,new ECB(17,115)),new ECBlocks(28,new ECB(10,46),new ECB(23,47)),new ECBlocks(30,new ECB(10,24),new ECB(35,25)),new ECBlocks(30,new ECB(19,15),new ECB(35,16))),new Version(33,new Array(6,30,58,86,114,142),new ECBlocks(30,new ECB(17,115),new ECB(1,116)),new ECBlocks(28,new ECB(14,46),new ECB(21,47)),new ECBlocks(30,new ECB(29,24),new ECB(19,25)),new ECBlocks(30,new ECB(11,15),new ECB(46,16))),new Version(34,new Array(6,34,62,90,118,146),new ECBlocks(30,new ECB(13,115),new ECB(6,116)),new ECBlocks(28,new ECB(14,46),new ECB(23,47)),new ECBlocks(30,new ECB(44,24),new ECB(7,25)),new ECBlocks(30,new ECB(59,16),new ECB(1,17))),new Version(35,new Array(6,30,54,78,102,126,150),new ECBlocks(30,new ECB(12,121),new ECB(7,122)),new ECBlocks(28,new ECB(12,47),new ECB(26,48)),new ECBlocks(30,new ECB(39,24),new ECB(14,25)),new ECBlocks(30,new ECB(22,15),new ECB(41,16))),new Version(36,new Array(6,24,50,76,102,128,154),new ECBlocks(30,new ECB(6,121),new ECB(14,122)),new ECBlocks(28,new ECB(6,47),new ECB(34,48)),new ECBlocks(30,new ECB(46,24),new ECB(10,25)),new ECBlocks(30,new ECB(2,15),new ECB(64,16))),new Version(37,new Array(6,28,54,80,106,132,158),new ECBlocks(30,new ECB(17,122),new ECB(4,123)),new ECBlocks(28,new ECB(29,46),new ECB(14,47)),new ECBlocks(30,new ECB(49,24),new ECB(10,25)),new ECBlocks(30,new ECB(24,15),new ECB(46,16))),new Version(38,new Array(6,32,58,84,110,136,162),new ECBlocks(30,new ECB(4,122),new ECB(18,123)),new ECBlocks(28,new ECB(13,46),new ECB(32,47)),new ECBlocks(30,new ECB(48,24),new ECB(14,25)),new ECBlocks(30,new ECB(42,15),new ECB(32,16))),new Version(39,new Array(6,26,54,82,110,138,166),new ECBlocks(30,new ECB(20,117),new ECB(4,118)),new ECBlocks(28,new ECB(40,47),new ECB(7,48)),new ECBlocks(30,new ECB(43,24),new ECB(22,25)),new ECBlocks(30,new ECB(10,15),new ECB(67,16))),new Version(40,new Array(6,30,58,86,114,142,170),new ECBlocks(30,new ECB(19,118),new ECB(6,119)),new ECBlocks(28,new ECB(18,47),new ECB(31,48)),new ECBlocks(30,new ECB(34,24),new ECB(34,25)),new ECBlocks(30,new ECB(20,15),new ECB(61,16))))}function PerspectiveTransform(e,t,r,n,i,o,s,a,h){this.a11=e,this.a12=n,this.a13=s,this.a21=t,this.a22=i,this.a23=a,this.a31=r,this.a32=o,this.a33=h,this.transformPoints1=function(e){for(var t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,h=this.a31,c=this.a32,d=this.a33,l=0;t>l;l+=2){var w=e[l],f=e[l+1],u=i*w+a*f+d;e[l]=(r*w+o*f+h)/u,e[l+1]=(n*w+s*f+c)/u}},this.transformPoints2=function(e,t){for(var r=e.length,n=0;r>n;n++){var i=e[n],o=t[n],s=this.a13*i+this.a23*o+this.a33;e[n]=(this.a11*i+this.a21*o+this.a31)/s,t[n]=(this.a12*i+this.a22*o+this.a32)/s}},this.buildAdjoint=function(){return new PerspectiveTransform(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(e){return new PerspectiveTransform(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}function DetectorResult(e,t){this.bits=e,this.points=t}function Detector(e){this.image=e,this.resultPointCallback=null,this.sizeOfBlackWhiteBlackRun=function(e,t,r,n){var i=Math.abs(n-t)>Math.abs(r-e);if(i){var o=e;e=t,t=o,o=r,r=n,n=o}for(var s=Math.abs(r-e),a=Math.abs(n-t),h=-s>>1,c=n>t?1:-1,d=r>e?1:-1,l=0,w=e,f=t;w!=r;w+=d){var u=i?f:w,C=i?w:f;if(1==l?this.image[u+C*qrcode.width]&&l++:this.image[u+C*qrcode.width]||l++,3==l){var E=w-e,B=f-t;return Math.sqrt(E*E+B*B)}if(h+=a,h>0){if(f==n)break;f+=c,h-=s}}var v=r-e,m=n-t;return Math.sqrt(v*v+m*m)},this.sizeOfBlackWhiteBlackRunBothWays=function(e,t,r,n){var i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,s=e-(r-e);0>s?(o=e/(e-s),s=0):s>=qrcode.width&&(o=(qrcode.width-1-e)/(s-e),s=qrcode.width-1);var a=Math.floor(t-(n-t)*o);return o=1,0>a?(o=t/(t-a),a=0):a>=qrcode.height&&(o=(qrcode.height-1-t)/(a-t),a=qrcode.height-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1},this.calculateModuleSizeOneWay=function(e,t){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y)),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},this.calculateModuleSize=function(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2},this.distance=function(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)},this.computeDimension=function(e,t,r,n){var i=Math.round(this.distance(e,t)/n),o=Math.round(this.distance(e,r)/n),s=(i+o>>1)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw"Error"}return s},this.findAlignmentInRegion=function(e,t,r,n){var i=Math.floor(n*e),o=Math.max(0,t-i),s=Math.min(qrcode.width-1,t+i);if(3*e>s-o)throw"Error";var a=Math.max(0,r-i),h=Math.min(qrcode.height-1,r+i),c=new AlignmentPatternFinder(this.image,o,a,s-o,h-a,e,this.resultPointCallback);return c.find()},this.createTransform=function(e,t,r,n,i){var o,s,a,h,c=i-3.5;null!=n?(o=n.X,s=n.Y,a=h=c-3):(o=t.X-e.X+r.X,s=t.Y-e.Y+r.Y,a=h=c);var d=PerspectiveTransform.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,a,h,3.5,c,e.X,e.Y,t.X,t.Y,o,s,r.X,r.Y);return d},this.sampleGrid=function(e,t,r){var n=GridSampler;return n.sampleGrid3(e,r,t)},this.processFinderPatternInfo=function(e){var t=e.TopLeft,r=e.TopRight,n=e.BottomLeft,i=this.calculateModuleSize(t,r,n);if(1>i)throw"Error";var o=this.computeDimension(t,r,n,i),s=Version.getProvisionalVersionForDimension(o),a=s.DimensionForVersion-7,h=null;if(s.AlignmentPatternCenters.length>0)for(var c=r.X-t.X+n.X,d=r.Y-t.Y+n.Y,l=1-3/a,w=Math.floor(t.X+l*(c-t.X)),f=Math.floor(t.Y+l*(d-t.Y)),u=4;16>=u;u<<=1){h=this.findAlignmentInRegion(i,w,f,u);break}var C,E=this.createTransform(t,r,n,h,o),B=this.sampleGrid(this.image,E,o);return C=null==h?new Array(n,t,r):new Array(n,t,r,h),new DetectorResult(B,C)},this.detect=function(){var e=(new FinderPatternFinder).findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}function FormatInformation(e){this.errorCorrectionLevel=ErrorCorrectionLevel.forBits(e>>3&3),this.dataMask=7&e,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|dataMask},this.Equals=function(e){var t=e;return this.errorCorrectionLevel==t.errorCorrectionLevel&&this.dataMask==t.dataMask}}function ErrorCorrectionLevel(e,t,r){this.ordinal_Renamed_Field=e,this.bits=t,this.name=r,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function BitMatrix(e,t){if(t||(t=e),1>e||1>t)throw"Both dimensions must be greater than 0";this.width=e,this.height=t;var r=e>>5;0!=(31&e)&&r++,this.rowSize=r,this.bits=new Array(r*t);for(var n=0;n>5);return 0!=(1&URShift(this.bits[r],31&e))},this.set_Renamed=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]|=1<<(31&e)},this.flip=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]^=1<<(31&e)},this.clear=function(){for(var e=this.bits.length,t=0;e>t;t++)this.bits[t]=0},this.setRegion=function(e,t,r,n){if(0>t||0>e)throw"Left and top must be nonnegative";if(1>n||1>r)throw"Height and width must be at least 1";var i=e+r,o=t+n;if(o>this.height||i>this.width)throw"The region must fit inside the matrix";for(var s=t;o>s;s++)for(var a=s*this.rowSize,h=e;i>h;h++)this.bits[a+(h>>5)]|=1<<(31&h)}}function DataBlock(e,t){this.numDataCodewords=e,this.codewords=t,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function BitMatrixParser(e){var t=e.Dimension;if(21>t||1!=(3&t))throw"Error BitMatrixParser";this.bitMatrix=e,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(e,t,r){return this.bitMatrix.get_Renamed(e,t)?r<<1|1:r<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var e=0,t=0;6>t;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var r=5;r>=0;r--)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var n=this.bitMatrix.Dimension;e=0;for(var i=n-8,t=n-1;t>=i;t--)e=this.copyBit(t,8,e);for(var r=n-7;n>r;r++)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;throw"Error readFormatInformation"},this.readVersion=function(){if(null!=this.parsedVersion)return this.parsedVersion;var e=this.bitMatrix.Dimension,t=e-17>>2;if(6>=t)return Version.getVersionForNumber(t);for(var r=0,n=e-11,i=5;i>=0;i--)for(var o=e-9;o>=n;o--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;r=0;for(var o=5;o>=0;o--)for(var i=e-9;i>=n;i--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),r=DataMask.forReference(e.DataMask),n=this.bitMatrix.Dimension;r.unmaskBitMatrix(this.bitMatrix,n);for(var i=t.buildFunctionPattern(),o=!0,s=new Array(t.TotalCodewords),a=0,h=0,c=0,d=n-1;d>0;d-=2){6==d&&d--;for(var l=0;n>l;l++)for(var w=o?n-1-l:l,f=0;2>f;f++)i.get_Renamed(d-f,w)||(c++,h<<=1,this.bitMatrix.get_Renamed(d-f,w)&&(h|=1),8==c&&(s[a++]=h,c=0,h=0));o^=!0}if(a!=t.TotalCodewords)throw"Error readCodewords";return s}}function DataMask000(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(e+t&1)}}function DataMask001(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e){return 0==(1&e)}}function DataMask010(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return t%3==0}}function DataMask011(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return(e+t)%3==0}}function DataMask100(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(URShift(e,1)+t/3&1)}}function DataMask101(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return(1&r)+r%3==0}}function DataMask110(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return 0==((1&r)+r%3&1)}}function DataMask111(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==((e+t&1)+e*t%3&1)}}function ReedSolomonDecoder(e){this.field=e,this.decode=function(e,t){for(var r=new GF256Poly(this.field,e),n=new Array(t),i=0;ii;i++){var a=r.evaluateAt(this.field.exp(o?i+1:i));n[n.length-1-i]=a,0!=a&&(s=!1)}if(!s)for(var h=new GF256Poly(this.field,n),c=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),h,t),d=c[0],l=c[1],w=this.findErrorLocations(d),f=this.findErrorMagnitudes(l,w,o),i=0;iu)throw"ReedSolomonException Bad error location";e[u]=GF256.addOrSubtract(e[u],f[i])}},this.runEuclideanAlgorithm=function(e,t,r){if(e.Degree=Math.floor(r/2);){var d=i,l=s,w=h;if(i=o,s=a,h=c,i.Zero)throw"r_{i-1} was zero";o=d;for(var f=this.field.Zero,u=i.getCoefficient(i.Degree),C=this.field.inverse(u);o.Degree>=i.Degree&&!o.Zero;){var E=o.Degree-i.Degree,B=this.field.multiply(o.getCoefficient(o.Degree),C);f=f.addOrSubtract(this.field.buildMonomial(E,B)),o=o.addOrSubtract(i.multiplyByMonomial(E,B))}a=f.multiply1(s).addOrSubtract(l),c=f.multiply1(h).addOrSubtract(w)}var v=c.getCoefficient(0);if(0==v)throw"ReedSolomonException sigmaTilde(0) was zero";var m=this.field.inverse(v),g=c.multiply2(m),k=o.multiply2(m);return new Array(g,k)},this.findErrorLocations=function(e){var t=e.Degree;if(1==t)return new Array(e.getCoefficient(1));for(var r=new Array(t),n=0,i=1;256>i&&t>n;i++)0==e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!=t)throw"Error locator degree does not match number of roots";return r},this.findErrorMagnitudes=function(e,t,r){for(var n=t.length,i=new Array(n),o=0;n>o;o++){for(var s=this.field.inverse(t[o]),a=1,h=0;n>h;h++)o!=h&&(a=this.field.multiply(a,GF256.addOrSubtract(1,this.field.multiply(t[h],s))));i[o]=this.field.multiply(e.evaluateAt(s),this.field.inverse(a)),r&&(i[o]=this.field.multiply(i[o],s))}return i}}function GF256Poly(e,t){if(null==t||0==t.length)throw"System.ArgumentException";this.field=e;var r=t.length;if(r>1&&0==t[0]){for(var n=1;r>n&&0==t[n];)n++;if(n==r)this.coefficients=e.Zero.coefficients;else{this.coefficients=new Array(r-n);for(var i=0;in;n++)r=GF256.addOrSubtract(r,this.coefficients[n]);return r}for(var i=this.coefficients[0],n=1;t>n;n++)i=GF256.addOrSubtract(this.field.multiply(e,i),this.coefficients[n]);return i},this.addOrSubtract=function(t){if(this.field!=t.field)throw"GF256Polys do not have same GF256 field";if(this.Zero)return t;if(t.Zero)return this;var r=this.coefficients,n=t.coefficients;if(r.length>n.length){var i=r;r=n,n=i}for(var o=new Array(n.length),s=n.length-r.length,a=0;s>a;a++)o[a]=n[a];for(var h=s;hs;s++)for(var a=t[s],h=0;i>h;h++)o[s+h]=GF256.addOrSubtract(o[s+h],this.field.multiply(a,n[h]));return new GF256Poly(this.field,o)},this.multiply2=function(e){if(0==e)return this.field.Zero;if(1==e)return this;for(var t=this.coefficients.length,r=new Array(t),n=0;t>n;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new GF256Poly(this.field,r)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return this.field.Zero;for(var r=this.coefficients.length,n=new Array(r+e),i=0;ii;i++)n[i]=this.field.multiply(this.coefficients[i],t);return new GF256Poly(this.field,n)},this.divide=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(e.Zero)throw"Divide by 0";for(var t=this.field.Zero,r=this,n=e.getCoefficient(e.Degree),i=this.field.inverse(n);r.Degree>=e.Degree&&!r.Zero;){var o=r.Degree-e.Degree,s=this.field.multiply(r.getCoefficient(r.Degree),i),a=e.multiplyByMonomial(o,s),h=this.field.buildMonomial(o,s);t=t.addOrSubtract(h),r=r.addOrSubtract(a)}return new Array(t,r)}}function GF256(e){this.expTable=new Array(256),this.logTable=new Array(256);for(var t=1,r=0;256>r;r++)this.expTable[r]=t,t<<=1,t>=256&&(t^=e);for(var r=0;255>r;r++)this.logTable[this.expTable[r]]=r;var n=new Array(1);n[0]=0,this.zero=new GF256Poly(this,new Array(n));var i=new Array(1);i[0]=1,this.one=new GF256Poly(this,new Array(i)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return zero;for(var r=new Array(e+1),n=0;n=0?e>>t:(e>>t)+(2<<~t)}function FinderPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function FinderPatternInfo(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function FinderPatternFinder(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(e){for(var t=0,r=0;5>r;r++){var n=e[r];if(0==n)return!1;t+=n}if(7>t)return!1;var i=Math.floor((t<=0&&i[t+a*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[t+a*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.crossCheckHorizontal=function(e,t,r,n){for(var i=this.image,o=qrcode.width,s=this.CrossCheckStateCount,a=e;a>=0&&i[a+t*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[a+t*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[a+t*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[a+t*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[a+t*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[a+t*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2]+e[3]+e[4],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),e[2],n);if(!isNaN(o)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(o),e[2],n),!isNaN(i))){for(var s=n/7,a=!1,h=this.possibleCenters.length,c=0;h>c;c++){var d=this.possibleCenters[c];if(d.aboutEquals(s,o,i)){d.incrementCount(),a=!0;break}}if(!a){var l=new FinderPattern(i,o,s);this.possibleCenters.push(l),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(l)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){for(var t=0,r=0,n=0;e>n;n++){var i=this.possibleCenters[n].EstimatedModuleSize;t+=i,r+=i*i}var o=t/e;this.possibleCenters.sort(function(e,t){var r=Math.abs(t.EstimatedModuleSize-o),n=Math.abs(e.EstimatedModuleSize-o);return n>r?-1:r==n?0:1});for(var s=Math.sqrt(r/e-o*o),a=Math.max(.2*o,s),n=0;n3;n++){var h=this.possibleCenters[n];Math.abs(h.EstimatedModuleSize-o)>a&&(this.possibleCenters.remove(n),n--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(e,t){return e.count>t.count?-1:e.count=e)return 0;for(var t=null,r=0;e>r;r++){var n=this.possibleCenters[r];if(n.Count>=CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.X-n.X)-Math.abs(t.Y-n.Y))/2);t=n}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,r=this.possibleCenters.length,n=0;r>n;n++){var i=this.possibleCenters[n];i.Count>=CENTER_QUORUM&&(e++,t+=i.EstimatedModuleSize)}if(3>e)return!1;for(var o=t/r,s=0,n=0;r>n;n++)i=this.possibleCenters[n],s+=Math.abs(i.EstimatedModuleSize-o);return.05*t>=s},this.findFinderPattern=function(e){var t=!1;this.image=e;var r=qrcode.height,n=qrcode.width,i=Math.floor(3*r/(4*MAX_MODULES));(MIN_SKIP>i||t)&&(i=MIN_SKIP);for(var o=!1,s=new Array(5),a=i-1;r>a&&!o;a+=i){s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0;for(var h=0,c=0;n>c;c++)if(e[c+a*qrcode.width])1==(1&h)&&h++,s[h]++;else if(0==(1&h))if(4==h)if(this.foundPatternCross(s)){var d=this.handlePossibleCenter(s,a,c);if(d)if(i=2,this.hasSkipped)o=this.haveMultiplyConfirmedCenters();else{var l=this.findRowSkip();l>s[2]&&(a+=l-s[2]-i,c=n-1)}else{do c++;while(n>c&&!e[c+a*qrcode.width]);c--}h=0,s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0}else s[0]=s[2],s[1]=s[3],s[2]=s[4],s[3]=1,s[4]=0,h=3;else s[++h]++;else s[h]++;if(this.foundPatternCross(s)){var d=this.handlePossibleCenter(s,a,n);d&&(i=s[0],this.hasSkipped&&(o=haveMultiplyConfirmedCenters())) -}}var w=this.selectBestPatterns();return qrcode.orderBestPatterns(w),new FinderPatternInfo(w)}}function AlignmentPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,r,n,i,o,s){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=s,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var a=e;a>=0&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a++;if(a==o||s[1]>r)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[2]<=r;)s[2]++,a++;if(s[2]>r)return 0/0;var h=s[0]+s[1]+s[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var s=(e[0]+e[1]+e[2])/3,a=this.possibleCenters.length,h=0;a>h;h++){var c=this.possibleCenters[h];if(c.aboutEquals(s,o,i))return new AlignmentPattern(i,o,s)}var d=new AlignmentPattern(i,o,s);this.possibleCenters.push(d),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(d)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,s=r+(i>>1),a=new Array(0,0,0),h=0;i>h;h++){var c=s+(0==(1&h)?h+1>>1:-(h+1>>1));a[0]=0,a[1]=0,a[2]=0;for(var d=t;o>d&&!e[d+qrcode.width*c];)d++;for(var l=0;o>d;){if(e[d+c*qrcode.width])if(1==l)a[l]++;else if(2==l){if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,d);if(null!=w)return w}a[0]=a[2],a[1]=1,a[2]=0,l=1}else a[++l]++;else 1==l&&l++,a[l]++;d++}if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,o);if(null!=w)return w}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=s+a+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),s=r%45;n+=i[o],n+=i[s],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,s=(o<<8)+i,a=0;a=40956>=s+33088?s+33088:s+49472,n+=String.fromCharCode(a),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var s=this.getFigureString(dataLength),a=new Array(s.length),h=0;hs||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var s=Math.floor(t[o]),a=Math.floor(t[o+1]);if(-1>s||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new BitMatrix(t),i=new Array(t<<1),o=0;t>o;o++){for(var s=i.length,a=o+.5,h=0;s>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=a;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;s>h;h+=2){var c=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,d=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[c]=d?255:0,qrcode.imagedata.data[c+1]=d?255:0,qrcode.imagedata.data[c+2]=0,qrcode.imagedata.data[c+3]=255,d&&n.set_Renamed(h>>1,o)}}catch(l){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B){var v=PerspectiveTransform.quadrilateralToQuadrilateral(r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B);return GridSampler.sampleGrid3(e,t,v)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=buildVersions(),Version.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return Version.VERSIONS[e-1]},Version.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(e){for(var t=4294967295,r=0,n=0;no&&(r=n+7,t=o)}return 3>=t?this.getVersionForNumber(r):null},PerspectiveTransform.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C){var E=this.quadrilateralToSquare(e,t,r,n,i,o,s,a),B=this.squareToQuadrilateral(h,c,d,l,w,f,u,C);return B.times(E)},PerspectiveTransform.squareToQuadrilateral=function(e,t,r,n,i,o,s,a){return dy2=a-o,dy3=t-n+o-a,0==dy2&&0==dy3?new PerspectiveTransform(r-e,i-r,e,n-t,o-n,t,0,0,1):(dx1=r-i,dx2=s-i,dx3=e-r+i-s,dy1=n-o,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new PerspectiveTransform(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,a-t+a23*a,t,a13,a23,1))},PerspectiveTransform.quadrilateralToSquare=function(e,t,r,n,i,o,s,a){return this.squareToQuadrilateral(e,t,r,n,i,o,s,a).buildAdjoint()};var FORMAT_INFO_MASK_QR=21522,FORMAT_INFO_DECODE_LOOKUP=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),BITS_SET_IN_HALF_BYTE=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);FormatInformation.numBitsDiffering=function(e,t){return e^=t,BITS_SET_IN_HALF_BYTE[15&e]+BITS_SET_IN_HALF_BYTE[15&URShift(e,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,28)]},FormatInformation.decodeFormatInformation=function(e){var t=FormatInformation.doDecodeFormatInformation(e);return null!=t?t:FormatInformation.doDecodeFormatInformation(e^FORMAT_INFO_MASK_QR)},FormatInformation.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;ns&&(r=i[1],t=s)}return 3>=t?new FormatInformation(r):null},ErrorCorrectionLevel.forBits=function(e){if(0>e||e>=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[e]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);DataBlock.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),s=0;s=0;){var C=a[u].codewords.length;if(C==f)break;u--}u++;for(var E=f-n.ECCodewordsPerBlock,B=0,s=0;E>s;s++)for(var c=0;h>c;c++)a[c].codewords[s]=e[B++];for(var c=u;h>c;c++)a[c].codewords[E]=e[B++];for(var v=a[0].codewords.length,s=E;v>s;s++)for(var c=0;h>c;c++){var m=u>c?s:s+1;a[c].codewords[m]=e[B++]}return a},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new DataMask000,new DataMask001,new DataMask010,new DataMask011,new DataMask100,new DataMask101,new DataMask110,new DataMask111),GF256.QR_CODE_FIELD=new GF256(285),GF256.DATA_MATRIX_FIELD=new GF256(301),GF256.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new ReedSolomonDecoder(GF256.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(s){throw s}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new BitMatrixParser(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=DataBlock.getDataBlocks(i,r,n),s=0,a=0;aa;a++)h[c++]=w[a]}var u=new QRCodeDataBlockReader(h,r.VersionNumber,n.Bits);return u},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e){if(0==arguments.length){var t=qrcode.canvasElement,r=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=r.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(r),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var n=new Image;n.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),r=n.height,i=n.width;if(n.width*n.height>qrcode.maxImgSize){var o=n.width/n.height;r=Math.sqrt(qrcode.maxImgSize/o),i=o*r}e.width=i,e.height=r,t.drawImage(n,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=t.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",void(null!=qrcode.callback&&qrcode.callback(qrcode.result))}try{qrcode.result=qrcode.process(t)}catch(s){console.log(s),qrcode.result="error decoding QR Code"}null!=qrcode.callback&&qrcode.callback(qrcode.result)},n.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){console.log(r),t=e}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=(new Date).getTime(),r=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var n=0;n=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var s=0;t>s;s++)i[o][s]=new Array(0,0)}for(var a=0;t>a;a++)for(var h=0;t>h;h++){i[h][a][0]=255;for(var c=0;n>c;c++)for(var d=0;r>d;d++){var l=e[r*h+d+(n*a+c)*qrcode.width];li[h][a][1]&&(i[h][a][1]=l)}}for(var w=new Array(t),f=0;t>f;f++)w[f]=new Array(t);for(var a=0;t>a;a++)for(var h=0;t>h;h++)w[h][a]=Math.floor((i[h][a][0]+i[h][a][1])/2);return w},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),s=0;r>s;s++)for(var a=0;r>a;a++)for(var h=0;i>h;h++)for(var c=0;n>c;c++)o[n*a+c+(i*s+h)*qrcode.width]=e[n*a+c+(i*s+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var MIN_SKIP=3,MAX_MODULES=57,INTEGER_MATH_SHIFT=8,CENTER_QUORUM=2;qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,s=t(e[0],e[1]),a=t(e[1],e[2]),h=t(e[0],e[2]);if(a>=s&&a>=h?(i=e[0],n=e[1],o=e[2]):h>=a&&h>=s?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var c=n;n=o,o=c}e[0]=n,e[1]=i,e[2]=o},QRCodeDecoder.prototype.prepareCanvas=function(e,t,r){return t&&r&&(e.style.width=t+"px",e.style.height=r+"px",e.width=t,e.height=r),qrcode.setCanvasElement(e),this.canvasElem=e,e},QRCodeDecoder.prototype._captureToCanvas=function(){var e=this;if(this.tmrCapture&&clearTimeout(this.tmrCapture),!this.videoDimensions&&this.videoElem.videoWidth&&this.videoElem.videoHeight&&(this.videoDimensions={w:this.videoElem.videoWidth,h:this.videoElem.videoHeight},this.prepareCanvas(this.canvasElem,this.videoDimensions.w,this.videoDimensions.h)),this.videoDimensions){var t=this.canvasElem.getContext("2d");t.clearRect(0,0,this.videoElem.videoWidth,this.videoElem.videoHeight);try{return t.drawImage(this.videoElem,0,0,this.videoDimensions.w,this.videoDimensions.h),void qrcode.decode()}catch(r){console.log(r)}}this.tmrCapture=setTimeout(function(){e._captureToCanvas.apply(e,null)},500)},QRCodeDecoder.prototype.hasGetUserMedia=function(){return!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},QRCodeDecoder.prototype.isCanvasSupported=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},QRCodeDecoder.prototype.prepareVideo=function(e,t){var r=this;this.stop(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia?navigator.getUserMedia(this.videoConstraints,function(t){e.src=window.URL.createObjectURL(t),r.videoElem=e,r.stream=t,r.videoDimensions=!1,setTimeout(function(){r._captureToCanvas.apply(r,null)},500)},t):console.log("Couldn't get video from camera")},QRCodeDecoder.prototype.stop=function(){this.stream&&(this.stream.stop(),delete this.stream),this.tmrCapture&&(clearTimeout(this.tmrCapture),delete this.tmrCapture)},QRCodeDecoder.prototype.setSourceId=function(e){this.videoConstraints.video=e?{optional:[{sourceId:e}]}:!0},QRCodeDecoder.prototype.setDecoderCallback=function(e){qrcode.callback=e},QRCodeDecoder.prototype.getVideoSources=function(e){var t=[];MediaStreamTrack&&MediaStreamTrack.getSources?MediaStreamTrack.getSources(function(r){r.forEach(function(e){"video"===e.kind&&t.push(e)}),e(t)}):(console.log("Your browser doesn't support MediaStreamTrack.getSources"),e(t))},QRCodeDecoder.prototype.decodeFromSrc=function(e){qrcode.decode(e)}; \ No newline at end of file +}}var w=this.selectBestPatterns();return qrcode.orderBestPatterns(w),new FinderPatternInfo(w)}}function AlignmentPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,r,n,i,o,s){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=s,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var a=e;a>=0&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a++;if(a==o||s[1]>r)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[2]<=r;)s[2]++,a++;if(s[2]>r)return 0/0;var h=s[0]+s[1]+s[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var s=(e[0]+e[1]+e[2])/3,a=this.possibleCenters.length,h=0;a>h;h++){var c=this.possibleCenters[h];if(c.aboutEquals(s,o,i))return new AlignmentPattern(i,o,s)}var d=new AlignmentPattern(i,o,s);this.possibleCenters.push(d),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(d)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,s=r+(i>>1),a=new Array(0,0,0),h=0;i>h;h++){var c=s+(0==(1&h)?h+1>>1:-(h+1>>1));a[0]=0,a[1]=0,a[2]=0;for(var d=t;o>d&&!e[d+qrcode.width*c];)d++;for(var l=0;o>d;){if(e[d+c*qrcode.width])if(1==l)a[l]++;else if(2==l){if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,d);if(null!=w)return w}a[0]=a[2],a[1]=1,a[2]=0,l=1}else a[++l]++;else 1==l&&l++,a[l]++;d++}if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,o);if(null!=w)return w}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=s+a+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),s=r%45;n+=i[o],n+=i[s],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,s=(o<<8)+i,a=0;a=40956>=s+33088?s+33088:s+49472,n+=String.fromCharCode(a),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var s=this.getFigureString(dataLength),a=new Array(s.length),h=0;hs||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var s=Math.floor(t[o]),a=Math.floor(t[o+1]);if(-1>s||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new BitMatrix(t),i=new Array(t<<1),o=0;t>o;o++){for(var s=i.length,a=o+.5,h=0;s>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=a;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;s>h;h+=2){var c=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,d=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[c]=d?255:0,qrcode.imagedata.data[c+1]=d?255:0,qrcode.imagedata.data[c+2]=0,qrcode.imagedata.data[c+3]=255,d&&n.set_Renamed(h>>1,o)}}catch(l){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B){var v=PerspectiveTransform.quadrilateralToQuadrilateral(r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B);return GridSampler.sampleGrid3(e,t,v)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=buildVersions(),Version.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return Version.VERSIONS[e-1]},Version.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(e){for(var t=4294967295,r=0,n=0;no&&(r=n+7,t=o)}return 3>=t?this.getVersionForNumber(r):null},PerspectiveTransform.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C){var E=this.quadrilateralToSquare(e,t,r,n,i,o,s,a),B=this.squareToQuadrilateral(h,c,d,l,w,f,u,C);return B.times(E)},PerspectiveTransform.squareToQuadrilateral=function(e,t,r,n,i,o,s,a){return dy2=a-o,dy3=t-n+o-a,0==dy2&&0==dy3?new PerspectiveTransform(r-e,i-r,e,n-t,o-n,t,0,0,1):(dx1=r-i,dx2=s-i,dx3=e-r+i-s,dy1=n-o,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new PerspectiveTransform(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,a-t+a23*a,t,a13,a23,1))},PerspectiveTransform.quadrilateralToSquare=function(e,t,r,n,i,o,s,a){return this.squareToQuadrilateral(e,t,r,n,i,o,s,a).buildAdjoint()};var FORMAT_INFO_MASK_QR=21522,FORMAT_INFO_DECODE_LOOKUP=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),BITS_SET_IN_HALF_BYTE=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);FormatInformation.numBitsDiffering=function(e,t){return e^=t,BITS_SET_IN_HALF_BYTE[15&e]+BITS_SET_IN_HALF_BYTE[15&URShift(e,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,28)]},FormatInformation.decodeFormatInformation=function(e){var t=FormatInformation.doDecodeFormatInformation(e);return null!=t?t:FormatInformation.doDecodeFormatInformation(e^FORMAT_INFO_MASK_QR)},FormatInformation.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;ns&&(r=i[1],t=s)}return 3>=t?new FormatInformation(r):null},ErrorCorrectionLevel.forBits=function(e){if(0>e||e>=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[e]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);DataBlock.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),s=0;s=0;){var C=a[u].codewords.length;if(C==f)break;u--}u++;for(var E=f-n.ECCodewordsPerBlock,B=0,s=0;E>s;s++)for(var c=0;h>c;c++)a[c].codewords[s]=e[B++];for(var c=u;h>c;c++)a[c].codewords[E]=e[B++];for(var v=a[0].codewords.length,s=E;v>s;s++)for(var c=0;h>c;c++){var m=u>c?s:s+1;a[c].codewords[m]=e[B++]}return a},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new DataMask000,new DataMask001,new DataMask010,new DataMask011,new DataMask100,new DataMask101,new DataMask110,new DataMask111),GF256.QR_CODE_FIELD=new GF256(285),GF256.DATA_MATRIX_FIELD=new GF256(301),GF256.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new ReedSolomonDecoder(GF256.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(s){throw s}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new BitMatrixParser(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=DataBlock.getDataBlocks(i,r,n),s=0,a=0;aa;a++)h[c++]=w[a]}var u=new QRCodeDataBlockReader(h,r.VersionNumber,n.Bits);return u},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e){if(0==arguments.length){var t=qrcode.canvasElement,r=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=r.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(r),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var n=new Image;n.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),r=n.height,i=n.width;if(n.width*n.height>qrcode.maxImgSize){var o=n.width/n.height;r=Math.sqrt(qrcode.maxImgSize/o),i=o*r}e.width=i,e.height=r,t.drawImage(n,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=t.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",null!=qrcode.callback&&qrcode.callback(qrcode.result),void 0}try{qrcode.result=qrcode.process(t)}catch(s){console.log(s),qrcode.result="error decoding QR Code"}null!=qrcode.callback&&qrcode.callback(qrcode.result)},n.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){console.log(r),t=e}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=(new Date).getTime(),r=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var n=0;n=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var s=0;t>s;s++)i[o][s]=new Array(0,0)}for(var a=0;t>a;a++)for(var h=0;t>h;h++){i[h][a][0]=255;for(var c=0;n>c;c++)for(var d=0;r>d;d++){var l=e[r*h+d+(n*a+c)*qrcode.width];li[h][a][1]&&(i[h][a][1]=l)}}for(var w=new Array(t),f=0;t>f;f++)w[f]=new Array(t);for(var a=0;t>a;a++)for(var h=0;t>h;h++)w[h][a]=Math.floor((i[h][a][0]+i[h][a][1])/2);return w},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),s=0;r>s;s++)for(var a=0;r>a;a++)for(var h=0;i>h;h++)for(var c=0;n>c;c++)o[n*a+c+(i*s+h)*qrcode.width]=e[n*a+c+(i*s+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var MIN_SKIP=3,MAX_MODULES=57,INTEGER_MATH_SHIFT=8,CENTER_QUORUM=2;qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,s=t(e[0],e[1]),a=t(e[1],e[2]),h=t(e[0],e[2]);if(a>=s&&a>=h?(i=e[0],n=e[1],o=e[2]):h>=a&&h>=s?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var c=n;n=o,o=c}e[0]=n,e[1]=i,e[2]=o},QRCodeDecoder.prototype.prepareCanvas=function(e,t,r){return t&&r&&(e.style.width=t+"px",e.style.height=r+"px",e.width=t,e.height=r),qrcode.setCanvasElement(e),this.canvasElem=e,e},QRCodeDecoder.prototype._captureToCanvas=function(){var e=this;if(this.tmrCapture&&clearTimeout(this.tmrCapture),!this.videoDimensions&&this.videoElem.videoWidth&&this.videoElem.videoHeight&&(this.videoDimensions={w:this.videoElem.videoWidth,h:this.videoElem.videoHeight},this.prepareCanvas(this.canvasElem,this.videoDimensions.w,this.videoDimensions.h)),this.videoDimensions){var t=this.canvasElem.getContext("2d");t.clearRect(0,0,this.videoElem.videoWidth,this.videoElem.videoHeight);try{return t.drawImage(this.videoElem,0,0,this.videoDimensions.w,this.videoDimensions.h),qrcode.decode(),void 0}catch(r){console.log(r)}}this.tmrCapture=setTimeout(function(){e._captureToCanvas.apply(e,null)},500)},QRCodeDecoder.prototype.hasGetUserMedia=function(){return!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},QRCodeDecoder.prototype.isCanvasSupported=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},QRCodeDecoder.prototype.prepareVideo=function(e,t){var r=this;this.stop(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia?navigator.getUserMedia(this.videoConstraints,function(t){e.src=window.URL.createObjectURL(t),r.videoElem=e,r.stream=t,r.videoDimensions=!1,setTimeout(function(){r._captureToCanvas.apply(r,null)},500)},t):console.log("Couldn't get video from camera")},QRCodeDecoder.prototype.stop=function(){this.stream&&(this.stream.stop(),delete this.stream),this.tmrCapture&&(clearTimeout(this.tmrCapture),delete this.tmrCapture)},QRCodeDecoder.prototype.setSourceId=function(e){this.videoConstraints.video=e?{optional:[{sourceId:e}]}:!0},QRCodeDecoder.prototype.setDecoderCallback=function(e){qrcode.callback=e},QRCodeDecoder.prototype.getVideoSources=function(e){var t=[];MediaStreamTrack&&MediaStreamTrack.getSources?MediaStreamTrack.getSources(function(r){r.forEach(function(e){"video"===e.kind&&t.push(e)}),e(t)}):(console.log("Your browser doesn't support MediaStreamTrack.getSources"),e(t))},QRCodeDecoder.prototype.decodeFromSrc=function(e){qrcode.decode(e)}; \ No newline at end of file diff --git a/build/vendor/jsqrcode.min.js b/build/vendor/jsqrcode.min.js index 21eeb5b..e300ff0 100644 --- a/build/vendor/jsqrcode.min.js +++ b/build/vendor/jsqrcode.min.js @@ -22,4 +22,4 @@ * limitations under the License. */ function ECB(e,t){this.count=e,this.dataCodewords=t,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function ECBlocks(e,t,r){this.ecCodewordsPerBlock=e,this.ecBlocks=r?new Array(t,r):new Array(t),this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock}),this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks}),this.__defineGetter__("NumBlocks",function(){for(var e=0,t=0;tn;n++)for(var i=this.alignmentPatternCenters[n]-2,o=0;r>o;o++)0==n&&(0==o||o==r-1)||n==r-1&&0==o||t.setRegion(this.alignmentPatternCenters[o]-2,i,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},this.getECBlocksForLevel=function(e){return this.ecBlocks[e.ordinal()]}}function buildVersions(){return new Array(new Version(1,new Array,new ECBlocks(7,new ECB(1,19)),new ECBlocks(10,new ECB(1,16)),new ECBlocks(13,new ECB(1,13)),new ECBlocks(17,new ECB(1,9))),new Version(2,new Array(6,18),new ECBlocks(10,new ECB(1,34)),new ECBlocks(16,new ECB(1,28)),new ECBlocks(22,new ECB(1,22)),new ECBlocks(28,new ECB(1,16))),new Version(3,new Array(6,22),new ECBlocks(15,new ECB(1,55)),new ECBlocks(26,new ECB(1,44)),new ECBlocks(18,new ECB(2,17)),new ECBlocks(22,new ECB(2,13))),new Version(4,new Array(6,26),new ECBlocks(20,new ECB(1,80)),new ECBlocks(18,new ECB(2,32)),new ECBlocks(26,new ECB(2,24)),new ECBlocks(16,new ECB(4,9))),new Version(5,new Array(6,30),new ECBlocks(26,new ECB(1,108)),new ECBlocks(24,new ECB(2,43)),new ECBlocks(18,new ECB(2,15),new ECB(2,16)),new ECBlocks(22,new ECB(2,11),new ECB(2,12))),new Version(6,new Array(6,34),new ECBlocks(18,new ECB(2,68)),new ECBlocks(16,new ECB(4,27)),new ECBlocks(24,new ECB(4,19)),new ECBlocks(28,new ECB(4,15))),new Version(7,new Array(6,22,38),new ECBlocks(20,new ECB(2,78)),new ECBlocks(18,new ECB(4,31)),new ECBlocks(18,new ECB(2,14),new ECB(4,15)),new ECBlocks(26,new ECB(4,13),new ECB(1,14))),new Version(8,new Array(6,24,42),new ECBlocks(24,new ECB(2,97)),new ECBlocks(22,new ECB(2,38),new ECB(2,39)),new ECBlocks(22,new ECB(4,18),new ECB(2,19)),new ECBlocks(26,new ECB(4,14),new ECB(2,15))),new Version(9,new Array(6,26,46),new ECBlocks(30,new ECB(2,116)),new ECBlocks(22,new ECB(3,36),new ECB(2,37)),new ECBlocks(20,new ECB(4,16),new ECB(4,17)),new ECBlocks(24,new ECB(4,12),new ECB(4,13))),new Version(10,new Array(6,28,50),new ECBlocks(18,new ECB(2,68),new ECB(2,69)),new ECBlocks(26,new ECB(4,43),new ECB(1,44)),new ECBlocks(24,new ECB(6,19),new ECB(2,20)),new ECBlocks(28,new ECB(6,15),new ECB(2,16))),new Version(11,new Array(6,30,54),new ECBlocks(20,new ECB(4,81)),new ECBlocks(30,new ECB(1,50),new ECB(4,51)),new ECBlocks(28,new ECB(4,22),new ECB(4,23)),new ECBlocks(24,new ECB(3,12),new ECB(8,13))),new Version(12,new Array(6,32,58),new ECBlocks(24,new ECB(2,92),new ECB(2,93)),new ECBlocks(22,new ECB(6,36),new ECB(2,37)),new ECBlocks(26,new ECB(4,20),new ECB(6,21)),new ECBlocks(28,new ECB(7,14),new ECB(4,15))),new Version(13,new Array(6,34,62),new ECBlocks(26,new ECB(4,107)),new ECBlocks(22,new ECB(8,37),new ECB(1,38)),new ECBlocks(24,new ECB(8,20),new ECB(4,21)),new ECBlocks(22,new ECB(12,11),new ECB(4,12))),new Version(14,new Array(6,26,46,66),new ECBlocks(30,new ECB(3,115),new ECB(1,116)),new ECBlocks(24,new ECB(4,40),new ECB(5,41)),new ECBlocks(20,new ECB(11,16),new ECB(5,17)),new ECBlocks(24,new ECB(11,12),new ECB(5,13))),new Version(15,new Array(6,26,48,70),new ECBlocks(22,new ECB(5,87),new ECB(1,88)),new ECBlocks(24,new ECB(5,41),new ECB(5,42)),new ECBlocks(30,new ECB(5,24),new ECB(7,25)),new ECBlocks(24,new ECB(11,12),new ECB(7,13))),new Version(16,new Array(6,26,50,74),new ECBlocks(24,new ECB(5,98),new ECB(1,99)),new ECBlocks(28,new ECB(7,45),new ECB(3,46)),new ECBlocks(24,new ECB(15,19),new ECB(2,20)),new ECBlocks(30,new ECB(3,15),new ECB(13,16))),new Version(17,new Array(6,30,54,78),new ECBlocks(28,new ECB(1,107),new ECB(5,108)),new ECBlocks(28,new ECB(10,46),new ECB(1,47)),new ECBlocks(28,new ECB(1,22),new ECB(15,23)),new ECBlocks(28,new ECB(2,14),new ECB(17,15))),new Version(18,new Array(6,30,56,82),new ECBlocks(30,new ECB(5,120),new ECB(1,121)),new ECBlocks(26,new ECB(9,43),new ECB(4,44)),new ECBlocks(28,new ECB(17,22),new ECB(1,23)),new ECBlocks(28,new ECB(2,14),new ECB(19,15))),new Version(19,new Array(6,30,58,86),new ECBlocks(28,new ECB(3,113),new ECB(4,114)),new ECBlocks(26,new ECB(3,44),new ECB(11,45)),new ECBlocks(26,new ECB(17,21),new ECB(4,22)),new ECBlocks(26,new ECB(9,13),new ECB(16,14))),new Version(20,new Array(6,34,62,90),new ECBlocks(28,new ECB(3,107),new ECB(5,108)),new ECBlocks(26,new ECB(3,41),new ECB(13,42)),new ECBlocks(30,new ECB(15,24),new ECB(5,25)),new ECBlocks(28,new ECB(15,15),new ECB(10,16))),new Version(21,new Array(6,28,50,72,94),new ECBlocks(28,new ECB(4,116),new ECB(4,117)),new ECBlocks(26,new ECB(17,42)),new ECBlocks(28,new ECB(17,22),new ECB(6,23)),new ECBlocks(30,new ECB(19,16),new ECB(6,17))),new Version(22,new Array(6,26,50,74,98),new ECBlocks(28,new ECB(2,111),new ECB(7,112)),new ECBlocks(28,new ECB(17,46)),new ECBlocks(30,new ECB(7,24),new ECB(16,25)),new ECBlocks(24,new ECB(34,13))),new Version(23,new Array(6,30,54,74,102),new ECBlocks(30,new ECB(4,121),new ECB(5,122)),new ECBlocks(28,new ECB(4,47),new ECB(14,48)),new ECBlocks(30,new ECB(11,24),new ECB(14,25)),new ECBlocks(30,new ECB(16,15),new ECB(14,16))),new Version(24,new Array(6,28,54,80,106),new ECBlocks(30,new ECB(6,117),new ECB(4,118)),new ECBlocks(28,new ECB(6,45),new ECB(14,46)),new ECBlocks(30,new ECB(11,24),new ECB(16,25)),new ECBlocks(30,new ECB(30,16),new ECB(2,17))),new Version(25,new Array(6,32,58,84,110),new ECBlocks(26,new ECB(8,106),new ECB(4,107)),new ECBlocks(28,new ECB(8,47),new ECB(13,48)),new ECBlocks(30,new ECB(7,24),new ECB(22,25)),new ECBlocks(30,new ECB(22,15),new ECB(13,16))),new Version(26,new Array(6,30,58,86,114),new ECBlocks(28,new ECB(10,114),new ECB(2,115)),new ECBlocks(28,new ECB(19,46),new ECB(4,47)),new ECBlocks(28,new ECB(28,22),new ECB(6,23)),new ECBlocks(30,new ECB(33,16),new ECB(4,17))),new Version(27,new Array(6,34,62,90,118),new ECBlocks(30,new ECB(8,122),new ECB(4,123)),new ECBlocks(28,new ECB(22,45),new ECB(3,46)),new ECBlocks(30,new ECB(8,23),new ECB(26,24)),new ECBlocks(30,new ECB(12,15),new ECB(28,16))),new Version(28,new Array(6,26,50,74,98,122),new ECBlocks(30,new ECB(3,117),new ECB(10,118)),new ECBlocks(28,new ECB(3,45),new ECB(23,46)),new ECBlocks(30,new ECB(4,24),new ECB(31,25)),new ECBlocks(30,new ECB(11,15),new ECB(31,16))),new Version(29,new Array(6,30,54,78,102,126),new ECBlocks(30,new ECB(7,116),new ECB(7,117)),new ECBlocks(28,new ECB(21,45),new ECB(7,46)),new ECBlocks(30,new ECB(1,23),new ECB(37,24)),new ECBlocks(30,new ECB(19,15),new ECB(26,16))),new Version(30,new Array(6,26,52,78,104,130),new ECBlocks(30,new ECB(5,115),new ECB(10,116)),new ECBlocks(28,new ECB(19,47),new ECB(10,48)),new ECBlocks(30,new ECB(15,24),new ECB(25,25)),new ECBlocks(30,new ECB(23,15),new ECB(25,16))),new Version(31,new Array(6,30,56,82,108,134),new ECBlocks(30,new ECB(13,115),new ECB(3,116)),new ECBlocks(28,new ECB(2,46),new ECB(29,47)),new ECBlocks(30,new ECB(42,24),new ECB(1,25)),new ECBlocks(30,new ECB(23,15),new ECB(28,16))),new Version(32,new Array(6,34,60,86,112,138),new ECBlocks(30,new ECB(17,115)),new ECBlocks(28,new ECB(10,46),new ECB(23,47)),new ECBlocks(30,new ECB(10,24),new ECB(35,25)),new ECBlocks(30,new ECB(19,15),new ECB(35,16))),new Version(33,new Array(6,30,58,86,114,142),new ECBlocks(30,new ECB(17,115),new ECB(1,116)),new ECBlocks(28,new ECB(14,46),new ECB(21,47)),new ECBlocks(30,new ECB(29,24),new ECB(19,25)),new ECBlocks(30,new ECB(11,15),new ECB(46,16))),new Version(34,new Array(6,34,62,90,118,146),new ECBlocks(30,new ECB(13,115),new ECB(6,116)),new ECBlocks(28,new ECB(14,46),new ECB(23,47)),new ECBlocks(30,new ECB(44,24),new ECB(7,25)),new ECBlocks(30,new ECB(59,16),new ECB(1,17))),new Version(35,new Array(6,30,54,78,102,126,150),new ECBlocks(30,new ECB(12,121),new ECB(7,122)),new ECBlocks(28,new ECB(12,47),new ECB(26,48)),new ECBlocks(30,new ECB(39,24),new ECB(14,25)),new ECBlocks(30,new ECB(22,15),new ECB(41,16))),new Version(36,new Array(6,24,50,76,102,128,154),new ECBlocks(30,new ECB(6,121),new ECB(14,122)),new ECBlocks(28,new ECB(6,47),new ECB(34,48)),new ECBlocks(30,new ECB(46,24),new ECB(10,25)),new ECBlocks(30,new ECB(2,15),new ECB(64,16))),new Version(37,new Array(6,28,54,80,106,132,158),new ECBlocks(30,new ECB(17,122),new ECB(4,123)),new ECBlocks(28,new ECB(29,46),new ECB(14,47)),new ECBlocks(30,new ECB(49,24),new ECB(10,25)),new ECBlocks(30,new ECB(24,15),new ECB(46,16))),new Version(38,new Array(6,32,58,84,110,136,162),new ECBlocks(30,new ECB(4,122),new ECB(18,123)),new ECBlocks(28,new ECB(13,46),new ECB(32,47)),new ECBlocks(30,new ECB(48,24),new ECB(14,25)),new ECBlocks(30,new ECB(42,15),new ECB(32,16))),new Version(39,new Array(6,26,54,82,110,138,166),new ECBlocks(30,new ECB(20,117),new ECB(4,118)),new ECBlocks(28,new ECB(40,47),new ECB(7,48)),new ECBlocks(30,new ECB(43,24),new ECB(22,25)),new ECBlocks(30,new ECB(10,15),new ECB(67,16))),new Version(40,new Array(6,30,58,86,114,142,170),new ECBlocks(30,new ECB(19,118),new ECB(6,119)),new ECBlocks(28,new ECB(18,47),new ECB(31,48)),new ECBlocks(30,new ECB(34,24),new ECB(34,25)),new ECBlocks(30,new ECB(20,15),new ECB(61,16))))}function PerspectiveTransform(e,t,r,n,i,o,s,a,h){this.a11=e,this.a12=n,this.a13=s,this.a21=t,this.a22=i,this.a23=a,this.a31=r,this.a32=o,this.a33=h,this.transformPoints1=function(e){for(var t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,h=this.a31,c=this.a32,l=this.a33,w=0;t>w;w+=2){var f=e[w],d=e[w+1],u=i*f+a*d+l;e[w]=(r*f+o*d+h)/u,e[w+1]=(n*f+s*d+c)/u}},this.transformPoints2=function(e,t){for(var r=e.length,n=0;r>n;n++){var i=e[n],o=t[n],s=this.a13*i+this.a23*o+this.a33;e[n]=(this.a11*i+this.a21*o+this.a31)/s,t[n]=(this.a12*i+this.a22*o+this.a32)/s}},this.buildAdjoint=function(){return new PerspectiveTransform(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(e){return new PerspectiveTransform(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}function DetectorResult(e,t){this.bits=e,this.points=t}function Detector(e){this.image=e,this.resultPointCallback=null,this.sizeOfBlackWhiteBlackRun=function(e,t,r,n){var i=Math.abs(n-t)>Math.abs(r-e);if(i){var o=e;e=t,t=o,o=r,r=n,n=o}for(var s=Math.abs(r-e),a=Math.abs(n-t),h=-s>>1,c=n>t?1:-1,l=r>e?1:-1,w=0,f=e,d=t;f!=r;f+=l){var u=i?d:f,C=i?f:d;if(1==w?this.image[u+C*qrcode.width]&&w++:this.image[u+C*qrcode.width]||w++,3==w){var E=f-e,B=d-t;return Math.sqrt(E*E+B*B)}if(h+=a,h>0){if(d==n)break;d+=c,h-=s}}var g=r-e,k=n-t;return Math.sqrt(g*g+k*k)},this.sizeOfBlackWhiteBlackRunBothWays=function(e,t,r,n){var i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,s=e-(r-e);0>s?(o=e/(e-s),s=0):s>=qrcode.width&&(o=(qrcode.width-1-e)/(s-e),s=qrcode.width-1);var a=Math.floor(t-(n-t)*o);return o=1,0>a?(o=t/(t-a),a=0):a>=qrcode.height&&(o=(qrcode.height-1-t)/(a-t),a=qrcode.height-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1},this.calculateModuleSizeOneWay=function(e,t){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y)),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},this.calculateModuleSize=function(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2},this.distance=function(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)},this.computeDimension=function(e,t,r,n){var i=Math.round(this.distance(e,t)/n),o=Math.round(this.distance(e,r)/n),s=(i+o>>1)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw"Error"}return s},this.findAlignmentInRegion=function(e,t,r,n){var i=Math.floor(n*e),o=Math.max(0,t-i),s=Math.min(qrcode.width-1,t+i);if(3*e>s-o)throw"Error";var a=Math.max(0,r-i),h=Math.min(qrcode.height-1,r+i),c=new AlignmentPatternFinder(this.image,o,a,s-o,h-a,e,this.resultPointCallback);return c.find()},this.createTransform=function(e,t,r,n,i){var o,s,a,h,c=i-3.5;null!=n?(o=n.X,s=n.Y,a=h=c-3):(o=t.X-e.X+r.X,s=t.Y-e.Y+r.Y,a=h=c);var l=PerspectiveTransform.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,a,h,3.5,c,e.X,e.Y,t.X,t.Y,o,s,r.X,r.Y);return l},this.sampleGrid=function(e,t,r){var n=GridSampler;return n.sampleGrid3(e,r,t)},this.processFinderPatternInfo=function(e){var t=e.TopLeft,r=e.TopRight,n=e.BottomLeft,i=this.calculateModuleSize(t,r,n);if(1>i)throw"Error";var o=this.computeDimension(t,r,n,i),s=Version.getProvisionalVersionForDimension(o),a=s.DimensionForVersion-7,h=null;if(s.AlignmentPatternCenters.length>0)for(var c=r.X-t.X+n.X,l=r.Y-t.Y+n.Y,w=1-3/a,f=Math.floor(t.X+w*(c-t.X)),d=Math.floor(t.Y+w*(l-t.Y)),u=4;16>=u;u<<=1){h=this.findAlignmentInRegion(i,f,d,u);break}var C,E=this.createTransform(t,r,n,h,o),B=this.sampleGrid(this.image,E,o);return C=null==h?new Array(n,t,r):new Array(n,t,r,h),new DetectorResult(B,C)},this.detect=function(){var e=(new FinderPatternFinder).findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}function FormatInformation(e){this.errorCorrectionLevel=ErrorCorrectionLevel.forBits(e>>3&3),this.dataMask=7&e,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|dataMask},this.Equals=function(e){var t=e;return this.errorCorrectionLevel==t.errorCorrectionLevel&&this.dataMask==t.dataMask}}function ErrorCorrectionLevel(e,t,r){this.ordinal_Renamed_Field=e,this.bits=t,this.name=r,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function BitMatrix(e,t){if(t||(t=e),1>e||1>t)throw"Both dimensions must be greater than 0";this.width=e,this.height=t;var r=e>>5;0!=(31&e)&&r++,this.rowSize=r,this.bits=new Array(r*t);for(var n=0;n>5);return 0!=(1&URShift(this.bits[r],31&e))},this.set_Renamed=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]|=1<<(31&e)},this.flip=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]^=1<<(31&e)},this.clear=function(){for(var e=this.bits.length,t=0;e>t;t++)this.bits[t]=0},this.setRegion=function(e,t,r,n){if(0>t||0>e)throw"Left and top must be nonnegative";if(1>n||1>r)throw"Height and width must be at least 1";var i=e+r,o=t+n;if(o>this.height||i>this.width)throw"The region must fit inside the matrix";for(var s=t;o>s;s++)for(var a=s*this.rowSize,h=e;i>h;h++)this.bits[a+(h>>5)]|=1<<(31&h)}}function DataBlock(e,t){this.numDataCodewords=e,this.codewords=t,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function BitMatrixParser(e){var t=e.Dimension;if(21>t||1!=(3&t))throw"Error BitMatrixParser";this.bitMatrix=e,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(e,t,r){return this.bitMatrix.get_Renamed(e,t)?r<<1|1:r<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var e=0,t=0;6>t;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var r=5;r>=0;r--)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var n=this.bitMatrix.Dimension;e=0;for(var i=n-8,t=n-1;t>=i;t--)e=this.copyBit(t,8,e);for(var r=n-7;n>r;r++)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;throw"Error readFormatInformation"},this.readVersion=function(){if(null!=this.parsedVersion)return this.parsedVersion;var e=this.bitMatrix.Dimension,t=e-17>>2;if(6>=t)return Version.getVersionForNumber(t);for(var r=0,n=e-11,i=5;i>=0;i--)for(var o=e-9;o>=n;o--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;r=0;for(var o=5;o>=0;o--)for(var i=e-9;i>=n;i--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),r=DataMask.forReference(e.DataMask),n=this.bitMatrix.Dimension;r.unmaskBitMatrix(this.bitMatrix,n);for(var i=t.buildFunctionPattern(),o=!0,s=new Array(t.TotalCodewords),a=0,h=0,c=0,l=n-1;l>0;l-=2){6==l&&l--;for(var w=0;n>w;w++)for(var f=o?n-1-w:w,d=0;2>d;d++)i.get_Renamed(l-d,f)||(c++,h<<=1,this.bitMatrix.get_Renamed(l-d,f)&&(h|=1),8==c&&(s[a++]=h,c=0,h=0));o^=!0}if(a!=t.TotalCodewords)throw"Error readCodewords";return s}}function DataMask000(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(e+t&1)}}function DataMask001(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e){return 0==(1&e)}}function DataMask010(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return t%3==0}}function DataMask011(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return(e+t)%3==0}}function DataMask100(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(URShift(e,1)+t/3&1)}}function DataMask101(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return(1&r)+r%3==0}}function DataMask110(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return 0==((1&r)+r%3&1)}}function DataMask111(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==((e+t&1)+e*t%3&1)}}function ReedSolomonDecoder(e){this.field=e,this.decode=function(e,t){for(var r=new GF256Poly(this.field,e),n=new Array(t),i=0;ii;i++){var a=r.evaluateAt(this.field.exp(o?i+1:i));n[n.length-1-i]=a,0!=a&&(s=!1)}if(!s)for(var h=new GF256Poly(this.field,n),c=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),h,t),l=c[0],w=c[1],f=this.findErrorLocations(l),d=this.findErrorMagnitudes(w,f,o),i=0;iu)throw"ReedSolomonException Bad error location";e[u]=GF256.addOrSubtract(e[u],d[i])}},this.runEuclideanAlgorithm=function(e,t,r){if(e.Degree=Math.floor(r/2);){var l=i,w=s,f=h;if(i=o,s=a,h=c,i.Zero)throw"r_{i-1} was zero";o=l;for(var d=this.field.Zero,u=i.getCoefficient(i.Degree),C=this.field.inverse(u);o.Degree>=i.Degree&&!o.Zero;){var E=o.Degree-i.Degree,B=this.field.multiply(o.getCoefficient(o.Degree),C);d=d.addOrSubtract(this.field.buildMonomial(E,B)),o=o.addOrSubtract(i.multiplyByMonomial(E,B))}a=d.multiply1(s).addOrSubtract(w),c=d.multiply1(h).addOrSubtract(f)}var g=c.getCoefficient(0);if(0==g)throw"ReedSolomonException sigmaTilde(0) was zero";var k=this.field.inverse(g),m=c.multiply2(k),v=o.multiply2(k);return new Array(m,v)},this.findErrorLocations=function(e){var t=e.Degree;if(1==t)return new Array(e.getCoefficient(1));for(var r=new Array(t),n=0,i=1;256>i&&t>n;i++)0==e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!=t)throw"Error locator degree does not match number of roots";return r},this.findErrorMagnitudes=function(e,t,r){for(var n=t.length,i=new Array(n),o=0;n>o;o++){for(var s=this.field.inverse(t[o]),a=1,h=0;n>h;h++)o!=h&&(a=this.field.multiply(a,GF256.addOrSubtract(1,this.field.multiply(t[h],s))));i[o]=this.field.multiply(e.evaluateAt(s),this.field.inverse(a)),r&&(i[o]=this.field.multiply(i[o],s))}return i}}function GF256Poly(e,t){if(null==t||0==t.length)throw"System.ArgumentException";this.field=e;var r=t.length;if(r>1&&0==t[0]){for(var n=1;r>n&&0==t[n];)n++;if(n==r)this.coefficients=e.Zero.coefficients;else{this.coefficients=new Array(r-n);for(var i=0;in;n++)r=GF256.addOrSubtract(r,this.coefficients[n]);return r}for(var i=this.coefficients[0],n=1;t>n;n++)i=GF256.addOrSubtract(this.field.multiply(e,i),this.coefficients[n]);return i},this.addOrSubtract=function(t){if(this.field!=t.field)throw"GF256Polys do not have same GF256 field";if(this.Zero)return t;if(t.Zero)return this;var r=this.coefficients,n=t.coefficients;if(r.length>n.length){var i=r;r=n,n=i}for(var o=new Array(n.length),s=n.length-r.length,a=0;s>a;a++)o[a]=n[a];for(var h=s;hs;s++)for(var a=t[s],h=0;i>h;h++)o[s+h]=GF256.addOrSubtract(o[s+h],this.field.multiply(a,n[h]));return new GF256Poly(this.field,o)},this.multiply2=function(e){if(0==e)return this.field.Zero;if(1==e)return this;for(var t=this.coefficients.length,r=new Array(t),n=0;t>n;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new GF256Poly(this.field,r)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return this.field.Zero;for(var r=this.coefficients.length,n=new Array(r+e),i=0;ii;i++)n[i]=this.field.multiply(this.coefficients[i],t);return new GF256Poly(this.field,n)},this.divide=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(e.Zero)throw"Divide by 0";for(var t=this.field.Zero,r=this,n=e.getCoefficient(e.Degree),i=this.field.inverse(n);r.Degree>=e.Degree&&!r.Zero;){var o=r.Degree-e.Degree,s=this.field.multiply(r.getCoefficient(r.Degree),i),a=e.multiplyByMonomial(o,s),h=this.field.buildMonomial(o,s);t=t.addOrSubtract(h),r=r.addOrSubtract(a)}return new Array(t,r)}}function GF256(e){this.expTable=new Array(256),this.logTable=new Array(256);for(var t=1,r=0;256>r;r++)this.expTable[r]=t,t<<=1,t>=256&&(t^=e);for(var r=0;255>r;r++)this.logTable[this.expTable[r]]=r;var n=new Array(1);n[0]=0,this.zero=new GF256Poly(this,new Array(n));var i=new Array(1);i[0]=1,this.one=new GF256Poly(this,new Array(i)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return zero;for(var r=new Array(e+1),n=0;n=0?e>>t:(e>>t)+(2<<~t)}function FinderPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function FinderPatternInfo(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function FinderPatternFinder(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(e){for(var t=0,r=0;5>r;r++){var n=e[r];if(0==n)return!1;t+=n}if(7>t)return!1;var i=Math.floor((t<=0&&i[t+a*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[t+a*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.crossCheckHorizontal=function(e,t,r,n){for(var i=this.image,o=qrcode.width,s=this.CrossCheckStateCount,a=e;a>=0&&i[a+t*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[a+t*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[a+t*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[a+t*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[a+t*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[a+t*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2]+e[3]+e[4],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),e[2],n);if(!isNaN(o)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(o),e[2],n),!isNaN(i))){for(var s=n/7,a=!1,h=this.possibleCenters.length,c=0;h>c;c++){var l=this.possibleCenters[c];if(l.aboutEquals(s,o,i)){l.incrementCount(),a=!0;break}}if(!a){var w=new FinderPattern(i,o,s);this.possibleCenters.push(w),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(w)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){for(var t=0,r=0,n=0;e>n;n++){var i=this.possibleCenters[n].EstimatedModuleSize;t+=i,r+=i*i}var o=t/e;this.possibleCenters.sort(function(e,t){var r=Math.abs(t.EstimatedModuleSize-o),n=Math.abs(e.EstimatedModuleSize-o);return n>r?-1:r==n?0:1});for(var s=Math.sqrt(r/e-o*o),a=Math.max(.2*o,s),n=0;n3;n++){var h=this.possibleCenters[n];Math.abs(h.EstimatedModuleSize-o)>a&&(this.possibleCenters.remove(n),n--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(e,t){return e.count>t.count?-1:e.count=e)return 0;for(var t=null,r=0;e>r;r++){var n=this.possibleCenters[r];if(n.Count>=CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.X-n.X)-Math.abs(t.Y-n.Y))/2);t=n}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,r=this.possibleCenters.length,n=0;r>n;n++){var i=this.possibleCenters[n];i.Count>=CENTER_QUORUM&&(e++,t+=i.EstimatedModuleSize)}if(3>e)return!1;for(var o=t/r,s=0,n=0;r>n;n++)i=this.possibleCenters[n],s+=Math.abs(i.EstimatedModuleSize-o);return.05*t>=s},this.findFinderPattern=function(e){var t=!1;this.image=e;var r=qrcode.height,n=qrcode.width,i=Math.floor(3*r/(4*MAX_MODULES));(MIN_SKIP>i||t)&&(i=MIN_SKIP);for(var o=!1,s=new Array(5),a=i-1;r>a&&!o;a+=i){s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0;for(var h=0,c=0;n>c;c++)if(e[c+a*qrcode.width])1==(1&h)&&h++,s[h]++;else if(0==(1&h))if(4==h)if(this.foundPatternCross(s)){var l=this.handlePossibleCenter(s,a,c);if(l)if(i=2,this.hasSkipped)o=this.haveMultiplyConfirmedCenters();else{var w=this.findRowSkip();w>s[2]&&(a+=w-s[2]-i,c=n-1)}else{do c++;while(n>c&&!e[c+a*qrcode.width]);c--}h=0,s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0}else s[0]=s[2],s[1]=s[3],s[2]=s[4],s[3]=1,s[4]=0,h=3;else s[++h]++;else s[h]++;if(this.foundPatternCross(s)){var l=this.handlePossibleCenter(s,a,n);l&&(i=s[0],this.hasSkipped&&(o=haveMultiplyConfirmedCenters())) -}}var f=this.selectBestPatterns();return qrcode.orderBestPatterns(f),new FinderPatternInfo(f)}}function AlignmentPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,r,n,i,o,s){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=s,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var a=e;a>=0&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a++;if(a==o||s[1]>r)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[2]<=r;)s[2]++,a++;if(s[2]>r)return 0/0;var h=s[0]+s[1]+s[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var s=(e[0]+e[1]+e[2])/3,a=this.possibleCenters.length,h=0;a>h;h++){var c=this.possibleCenters[h];if(c.aboutEquals(s,o,i))return new AlignmentPattern(i,o,s)}var l=new AlignmentPattern(i,o,s);this.possibleCenters.push(l),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(l)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,s=r+(i>>1),a=new Array(0,0,0),h=0;i>h;h++){var c=s+(0==(1&h)?h+1>>1:-(h+1>>1));a[0]=0,a[1]=0,a[2]=0;for(var l=t;o>l&&!e[l+qrcode.width*c];)l++;for(var w=0;o>l;){if(e[l+c*qrcode.width])if(1==w)a[w]++;else if(2==w){if(this.foundPatternCross(a)){var f=this.handlePossibleCenter(a,c,l);if(null!=f)return f}a[0]=a[2],a[1]=1,a[2]=0,w=1}else a[++w]++;else 1==w&&w++,a[w]++;l++}if(this.foundPatternCross(a)){var f=this.handlePossibleCenter(a,c,o);if(null!=f)return f}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=s+a+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),s=r%45;n+=i[o],n+=i[s],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,s=(o<<8)+i,a=0;a=40956>=s+33088?s+33088:s+49472,n+=String.fromCharCode(a),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var s=this.getFigureString(dataLength),a=new Array(s.length),h=0;hs||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var s=Math.floor(t[o]),a=Math.floor(t[o+1]);if(-1>s||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new BitMatrix(t),i=new Array(t<<1),o=0;t>o;o++){for(var s=i.length,a=o+.5,h=0;s>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=a;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;s>h;h+=2){var c=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,l=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[c]=l?255:0,qrcode.imagedata.data[c+1]=l?255:0,qrcode.imagedata.data[c+2]=0,qrcode.imagedata.data[c+3]=255,l&&n.set_Renamed(h>>1,o)}}catch(w){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,i,o,s,a,h,c,l,w,f,d,u,C,E,B){var g=PerspectiveTransform.quadrilateralToQuadrilateral(r,n,i,o,s,a,h,c,l,w,f,d,u,C,E,B);return GridSampler.sampleGrid3(e,t,g)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=buildVersions(),Version.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return Version.VERSIONS[e-1]},Version.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(e){for(var t=4294967295,r=0,n=0;no&&(r=n+7,t=o)}return 3>=t?this.getVersionForNumber(r):null},PerspectiveTransform.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,s,a,h,c,l,w,f,d,u,C){var E=this.quadrilateralToSquare(e,t,r,n,i,o,s,a),B=this.squareToQuadrilateral(h,c,l,w,f,d,u,C);return B.times(E)},PerspectiveTransform.squareToQuadrilateral=function(e,t,r,n,i,o,s,a){return dy2=a-o,dy3=t-n+o-a,0==dy2&&0==dy3?new PerspectiveTransform(r-e,i-r,e,n-t,o-n,t,0,0,1):(dx1=r-i,dx2=s-i,dx3=e-r+i-s,dy1=n-o,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new PerspectiveTransform(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,a-t+a23*a,t,a13,a23,1))},PerspectiveTransform.quadrilateralToSquare=function(e,t,r,n,i,o,s,a){return this.squareToQuadrilateral(e,t,r,n,i,o,s,a).buildAdjoint()};var FORMAT_INFO_MASK_QR=21522,FORMAT_INFO_DECODE_LOOKUP=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),BITS_SET_IN_HALF_BYTE=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);FormatInformation.numBitsDiffering=function(e,t){return e^=t,BITS_SET_IN_HALF_BYTE[15&e]+BITS_SET_IN_HALF_BYTE[15&URShift(e,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,28)]},FormatInformation.decodeFormatInformation=function(e){var t=FormatInformation.doDecodeFormatInformation(e);return null!=t?t:FormatInformation.doDecodeFormatInformation(e^FORMAT_INFO_MASK_QR)},FormatInformation.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;ns&&(r=i[1],t=s)}return 3>=t?new FormatInformation(r):null},ErrorCorrectionLevel.forBits=function(e){if(0>e||e>=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[e]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);DataBlock.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),s=0;s=0;){var C=a[u].codewords.length;if(C==d)break;u--}u++;for(var E=d-n.ECCodewordsPerBlock,B=0,s=0;E>s;s++)for(var c=0;h>c;c++)a[c].codewords[s]=e[B++];for(var c=u;h>c;c++)a[c].codewords[E]=e[B++];for(var g=a[0].codewords.length,s=E;g>s;s++)for(var c=0;h>c;c++){var k=u>c?s:s+1;a[c].codewords[k]=e[B++]}return a},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new DataMask000,new DataMask001,new DataMask010,new DataMask011,new DataMask100,new DataMask101,new DataMask110,new DataMask111),GF256.QR_CODE_FIELD=new GF256(285),GF256.DATA_MATRIX_FIELD=new GF256(301),GF256.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new ReedSolomonDecoder(GF256.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(s){throw s}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new BitMatrixParser(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=DataBlock.getDataBlocks(i,r,n),s=0,a=0;aa;a++)h[c++]=f[a]}var u=new QRCodeDataBlockReader(h,r.VersionNumber,n.Bits);return u},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e){if(0==arguments.length){var t=qrcode.canvasElement,r=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=r.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(r),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var n=new Image;n.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),r=n.height,i=n.width;if(n.width*n.height>qrcode.maxImgSize){var o=n.width/n.height;r=Math.sqrt(qrcode.maxImgSize/o),i=o*r}e.width=i,e.height=r,t.drawImage(n,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=t.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",void(null!=qrcode.callback&&qrcode.callback(qrcode.result))}try{qrcode.result=qrcode.process(t)}catch(s){console.log(s),qrcode.result="error decoding QR Code"}null!=qrcode.callback&&qrcode.callback(qrcode.result)},n.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){console.log(r),t=e}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=(new Date).getTime(),r=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var n=0;n=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var s=0;t>s;s++)i[o][s]=new Array(0,0)}for(var a=0;t>a;a++)for(var h=0;t>h;h++){i[h][a][0]=255;for(var c=0;n>c;c++)for(var l=0;r>l;l++){var w=e[r*h+l+(n*a+c)*qrcode.width];wi[h][a][1]&&(i[h][a][1]=w)}}for(var f=new Array(t),d=0;t>d;d++)f[d]=new Array(t);for(var a=0;t>a;a++)for(var h=0;t>h;h++)f[h][a]=Math.floor((i[h][a][0]+i[h][a][1])/2);return f},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),s=0;r>s;s++)for(var a=0;r>a;a++)for(var h=0;i>h;h++)for(var c=0;n>c;c++)o[n*a+c+(i*s+h)*qrcode.width]=e[n*a+c+(i*s+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var MIN_SKIP=3,MAX_MODULES=57,INTEGER_MATH_SHIFT=8,CENTER_QUORUM=2;qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,s=t(e[0],e[1]),a=t(e[1],e[2]),h=t(e[0],e[2]);if(a>=s&&a>=h?(i=e[0],n=e[1],o=e[2]):h>=a&&h>=s?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var c=n;n=o,o=c}e[0]=n,e[1]=i,e[2]=o}; \ No newline at end of file +}}var f=this.selectBestPatterns();return qrcode.orderBestPatterns(f),new FinderPatternInfo(f)}}function AlignmentPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,r,n,i,o,s){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=s,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var a=e;a>=0&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a++;if(a==o||s[1]>r)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[2]<=r;)s[2]++,a++;if(s[2]>r)return 0/0;var h=s[0]+s[1]+s[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var s=(e[0]+e[1]+e[2])/3,a=this.possibleCenters.length,h=0;a>h;h++){var c=this.possibleCenters[h];if(c.aboutEquals(s,o,i))return new AlignmentPattern(i,o,s)}var l=new AlignmentPattern(i,o,s);this.possibleCenters.push(l),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(l)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,s=r+(i>>1),a=new Array(0,0,0),h=0;i>h;h++){var c=s+(0==(1&h)?h+1>>1:-(h+1>>1));a[0]=0,a[1]=0,a[2]=0;for(var l=t;o>l&&!e[l+qrcode.width*c];)l++;for(var w=0;o>l;){if(e[l+c*qrcode.width])if(1==w)a[w]++;else if(2==w){if(this.foundPatternCross(a)){var f=this.handlePossibleCenter(a,c,l);if(null!=f)return f}a[0]=a[2],a[1]=1,a[2]=0,w=1}else a[++w]++;else 1==w&&w++,a[w]++;l++}if(this.foundPatternCross(a)){var f=this.handlePossibleCenter(a,c,o);if(null!=f)return f}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=s+a+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),s=r%45;n+=i[o],n+=i[s],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,s=(o<<8)+i,a=0;a=40956>=s+33088?s+33088:s+49472,n+=String.fromCharCode(a),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var s=this.getFigureString(dataLength),a=new Array(s.length),h=0;hs||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var s=Math.floor(t[o]),a=Math.floor(t[o+1]);if(-1>s||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new BitMatrix(t),i=new Array(t<<1),o=0;t>o;o++){for(var s=i.length,a=o+.5,h=0;s>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=a;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;s>h;h+=2){var c=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,l=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[c]=l?255:0,qrcode.imagedata.data[c+1]=l?255:0,qrcode.imagedata.data[c+2]=0,qrcode.imagedata.data[c+3]=255,l&&n.set_Renamed(h>>1,o)}}catch(w){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,i,o,s,a,h,c,l,w,f,d,u,C,E,B){var g=PerspectiveTransform.quadrilateralToQuadrilateral(r,n,i,o,s,a,h,c,l,w,f,d,u,C,E,B);return GridSampler.sampleGrid3(e,t,g)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=buildVersions(),Version.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return Version.VERSIONS[e-1]},Version.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(e){for(var t=4294967295,r=0,n=0;no&&(r=n+7,t=o)}return 3>=t?this.getVersionForNumber(r):null},PerspectiveTransform.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,s,a,h,c,l,w,f,d,u,C){var E=this.quadrilateralToSquare(e,t,r,n,i,o,s,a),B=this.squareToQuadrilateral(h,c,l,w,f,d,u,C);return B.times(E)},PerspectiveTransform.squareToQuadrilateral=function(e,t,r,n,i,o,s,a){return dy2=a-o,dy3=t-n+o-a,0==dy2&&0==dy3?new PerspectiveTransform(r-e,i-r,e,n-t,o-n,t,0,0,1):(dx1=r-i,dx2=s-i,dx3=e-r+i-s,dy1=n-o,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new PerspectiveTransform(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,a-t+a23*a,t,a13,a23,1))},PerspectiveTransform.quadrilateralToSquare=function(e,t,r,n,i,o,s,a){return this.squareToQuadrilateral(e,t,r,n,i,o,s,a).buildAdjoint()};var FORMAT_INFO_MASK_QR=21522,FORMAT_INFO_DECODE_LOOKUP=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),BITS_SET_IN_HALF_BYTE=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);FormatInformation.numBitsDiffering=function(e,t){return e^=t,BITS_SET_IN_HALF_BYTE[15&e]+BITS_SET_IN_HALF_BYTE[15&URShift(e,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,28)]},FormatInformation.decodeFormatInformation=function(e){var t=FormatInformation.doDecodeFormatInformation(e);return null!=t?t:FormatInformation.doDecodeFormatInformation(e^FORMAT_INFO_MASK_QR)},FormatInformation.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;ns&&(r=i[1],t=s)}return 3>=t?new FormatInformation(r):null},ErrorCorrectionLevel.forBits=function(e){if(0>e||e>=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[e]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);DataBlock.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),s=0;s=0;){var C=a[u].codewords.length;if(C==d)break;u--}u++;for(var E=d-n.ECCodewordsPerBlock,B=0,s=0;E>s;s++)for(var c=0;h>c;c++)a[c].codewords[s]=e[B++];for(var c=u;h>c;c++)a[c].codewords[E]=e[B++];for(var g=a[0].codewords.length,s=E;g>s;s++)for(var c=0;h>c;c++){var k=u>c?s:s+1;a[c].codewords[k]=e[B++]}return a},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new DataMask000,new DataMask001,new DataMask010,new DataMask011,new DataMask100,new DataMask101,new DataMask110,new DataMask111),GF256.QR_CODE_FIELD=new GF256(285),GF256.DATA_MATRIX_FIELD=new GF256(301),GF256.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new ReedSolomonDecoder(GF256.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(s){throw s}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new BitMatrixParser(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=DataBlock.getDataBlocks(i,r,n),s=0,a=0;aa;a++)h[c++]=f[a]}var u=new QRCodeDataBlockReader(h,r.VersionNumber,n.Bits);return u},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e){if(0==arguments.length){var t=qrcode.canvasElement,r=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=r.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(r),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var n=new Image;n.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),r=n.height,i=n.width;if(n.width*n.height>qrcode.maxImgSize){var o=n.width/n.height;r=Math.sqrt(qrcode.maxImgSize/o),i=o*r}e.width=i,e.height=r,t.drawImage(n,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=t.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",null!=qrcode.callback&&qrcode.callback(qrcode.result),void 0}try{qrcode.result=qrcode.process(t)}catch(s){console.log(s),qrcode.result="error decoding QR Code"}null!=qrcode.callback&&qrcode.callback(qrcode.result)},n.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){console.log(r),t=e}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=(new Date).getTime(),r=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var n=0;n=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var s=0;t>s;s++)i[o][s]=new Array(0,0)}for(var a=0;t>a;a++)for(var h=0;t>h;h++){i[h][a][0]=255;for(var c=0;n>c;c++)for(var l=0;r>l;l++){var w=e[r*h+l+(n*a+c)*qrcode.width];wi[h][a][1]&&(i[h][a][1]=w)}}for(var f=new Array(t),d=0;t>d;d++)f[d]=new Array(t);for(var a=0;t>a;a++)for(var h=0;t>h;h++)f[h][a]=Math.floor((i[h][a][0]+i[h][a][1])/2);return f},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),s=0;r>s;s++)for(var a=0;r>a;a++)for(var h=0;i>h;h++)for(var c=0;n>c;c++)o[n*a+c+(i*s+h)*qrcode.width]=e[n*a+c+(i*s+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var MIN_SKIP=3,MAX_MODULES=57,INTEGER_MATH_SHIFT=8,CENTER_QUORUM=2;qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,s=t(e[0],e[1]),a=t(e[1],e[2]),h=t(e[0],e[2]);if(a>=s&&a>=h?(i=e[0],n=e[1],o=e[2]):h>=a&&h>=s?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var c=n;n=o,o=c}e[0]=n,e[1]=i,e[2]=o}; \ No newline at end of file diff --git a/package.json b/package.json index 1e37c7c..ce8a788 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qcode-decoder", - "version": "0.0.5", + "version": "0.0.6", "description": "Decodes QRCode in the Browser and Node", "main": "index.js", "directories": {