-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathqrcode.min.js
41 lines (41 loc) · 19.8 KB
/
qrcode.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var QRCode;
(function(){function y(a){this.mode=q.MODE_8BIT_BYTE;this.data=a;this.parsedData=[];a=0;for(var c=this.data.length;a<c;a++){var b=[],d=this.data.charCodeAt(a);65536<d?(b[0]=240|(d&1835008)>>>18,b[1]=128|(d&258048)>>>12,b[2]=128|(d&4032)>>>6,b[3]=128|d&63):2048<d?(b[0]=224|(d&61440)>>>12,b[1]=128|(d&4032)>>>6,b[2]=128|d&63):128<d?(b[0]=192|(d&1984)>>>6,b[1]=128|d&63):b[0]=d;this.parsedData.push(b)}this.parsedData=Array.prototype.concat.apply([],this.parsedData);this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),
this.parsedData.unshift(187),this.parsedData.unshift(239))}function u(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function v(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var b=0;b<a.length&&0==a[b];)b++;this.num=Array(a.length-b+c);for(c=0;c<a.length-b;c++)this.num[c]=a[c+b]}function r(a,c){this.totalCount=a;this.dataCount=c}function A(){this.buffer=[];this.length=0}function B(){return"undefined"!=typeof CanvasRenderingContext2D}
function C(){var a=!1,c=navigator.userAgent;/android/i.test(c)&&(a=!0,(c=c.toString().match(/android ([0-9]\.[0-9])/i))&&c[1]&&(a=parseFloat(c[1])));return a}y.prototype={getLength:function(a){return this.parsedData.length},write:function(a){for(var c=0,b=this.parsedData.length;c<b;c++)a.put(this.parsedData[c],8)}};u.prototype={addData:function(a){a=new y(a);this.dataList.push(a);this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},
getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++){this.modules[b]=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++)this.modules[b][d]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();
this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=u.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var b=-1;7>=b;b++)if(!(-1>=a+b||this.moduleCount<=a+b))for(var d=-1;7>=d;d++)-1>=c+d||this.moduleCount<=c+d||(this.modules[a+b][c+d]=0<=b&&6>=b&&(0==d||6==d)||0<=d&&6>=d&&(0==b||6==b)||2<=b&&4>=b&&2<=d&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=
0,c=0,b=0;8>b;b++){this.makeImpl(!0,b);var d=k.getLostPoint(this);if(0==b||a>d)a=d,c=b}return c},createMovieClip:function(a,c,b){a=a.createEmptyMovieClip(c,b);this.make();for(c=0;c<this.modules.length;c++){b=1*c;for(var d=0;d<this.modules[c].length;d++){var e=1*d;this.modules[c][d]&&(a.beginFill(0,100),a.moveTo(e,b),a.lineTo(e+1,b),a.lineTo(e+1,b+1),a.lineTo(e,b+1),a.endFill())}}return a},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=
0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=k.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var b=0;b<a.length;b++){var d=a[c],e=a[b];if(null==this.modules[d][e])for(var f=-2;2>=f;f++)for(var h=-2;2>=h;h++)this.modules[d+f][e+h]=-2==f||2==f||-2==h||2==h||0==f&&0==h?!0:!1}},setupTypeNumber:function(a){for(var c=k.getBCHTypeNumber(this.typeNumber),b=0;18>b;b++){var d=!a&&1==(c>>b&1);this.modules[Math.floor(b/
3)][b%3+this.moduleCount-8-3]=d}for(b=0;18>b;b++)d=!a&&1==(c>>b&1),this.modules[b%3+this.moduleCount-8-3][Math.floor(b/3)]=d},setupTypeInfo:function(a,c){c=k.getBCHTypeInfo(this.errorCorrectLevel<<3|c);for(var b=0;15>b;b++){var d=!a&&1==(c>>b&1);6>b?this.modules[b][8]=d:8>b?this.modules[b+1][8]=d:this.modules[this.moduleCount-15+b][8]=d}for(b=0;15>b;b++)d=!a&&1==(c>>b&1),8>b?this.modules[8][this.moduleCount-b-1]=d:9>b?this.modules[8][15-b-1+1]=d:this.modules[8][15-b-1]=d;this.modules[this.moduleCount-
8][8]=!a},mapData:function(a,c){for(var b=-1,d=this.moduleCount-1,e=7,f=0,h=this.moduleCount-1;0<h;h-=2)for(6==h&&h--;;){for(var g=0;2>g;g++)if(null==this.modules[d][h-g]){var p=!1;f<a.length&&(p=1==(a[f]>>>e&1));k.getMask(c,d,h-g)&&(p=!p);this.modules[d][h-g]=p;e--; -1==e&&(f++,e=7)}d+=b;if(0>d||this.moduleCount<=d){d-=b;b=-b;break}}}};u.PAD0=236;u.PAD1=17;u.createData=function(a,c,b){c=r.getRSBlocks(a,c);for(var d=new A,e=0;e<b.length;e++){var f=b[e];d.put(f.mode,4);d.put(f.getLength(),k.getLengthInBits(f.mode,
a));f.write(d)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(d.getLengthInBits()>8*a)throw Error("code length overflow. ("+d.getLengthInBits()+">"+8*a+")");for(d.getLengthInBits()+4<=8*a&&d.put(0,4);0!=d.getLengthInBits()%8;)d.putBit(!1);for(;!(d.getLengthInBits()>=8*a);){d.put(u.PAD0,8);if(d.getLengthInBits()>=8*a)break;d.put(u.PAD1,8)}return u.createBytes(d,c)};u.createBytes=function(a,c){for(var b=0,d=0,e=0,f=Array(c.length),h=Array(c.length),g=0;g<c.length;g++){var p=c[g].dataCount,z=c[g].totalCount-
p,d=Math.max(d,p),e=Math.max(e,z);f[g]=Array(p);for(var l=0;l<f[g].length;l++)f[g][l]=255&a.buffer[l+b];b+=p;l=k.getErrorCorrectPolynomial(z);p=(new v(f[g],l.getLength()-1)).mod(l);h[g]=Array(l.getLength()-1);for(l=0;l<h[g].length;l++)z=l+p.getLength()-h[g].length,h[g][l]=0<=z?p.get(z):0}for(l=g=0;l<c.length;l++)g+=c[l].totalCount;a=Array(g);for(l=b=0;l<d;l++)for(g=0;g<c.length;g++)l<f[g].length&&(a[b++]=f[g][l]);for(l=0;l<e;l++)for(g=0;g<c.length;g++)l<h[g].length&&(a[b++]=h[g][l]);return a};for(var q=
{MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},t={L:1,M:0,Q:3,H:2},k={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,
134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=k.getBCHDigit(c)-k.getBCHDigit(k.G15);)c^=k.G15<<k.getBCHDigit(c)-k.getBCHDigit(k.G15);return(a<<10|c)^k.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=k.getBCHDigit(c)-k.getBCHDigit(k.G18);)c^=
k.G18<<k.getBCHDigit(c)-k.getBCHDigit(k.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return k.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,b){switch(a){case 0:return 0==(c+b)%2;case 1:return 0==c%2;case 2:return 0==b%3;case 3:return 0==(c+b)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(b/3))%2;case 5:return 0==c*b%2+c*b%3;case 6:return 0==(c*b%2+c*b%3)%2;case 7:return 0==(c*b%3+(c+b)%2)%2;default:throw Error("bad maskPattern:"+
a);}},getErrorCorrectPolynomial:function(a){for(var c=new v([1],0),b=0;b<a;b++)c=c.multiply(new v([1,m.gexp(b)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case q.MODE_NUMBER:return 10;case q.MODE_ALPHA_NUM:return 9;case q.MODE_8BIT_BYTE:return 8;case q.MODE_KANJI:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case q.MODE_NUMBER:return 12;case q.MODE_ALPHA_NUM:return 11;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 10;default:throw Error("mode:"+
a);}else if(41>c)switch(a){case q.MODE_NUMBER:return 14;case q.MODE_ALPHA_NUM:return 13;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 12;default:throw Error("mode:"+a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),b=0,d=0;d<c;d++)for(var e=0;e<c;e++){for(var f=0,h=a.isDark(d,e),g=-1;1>=g;g++)if(!(0>d+g||c<=d+g))for(var p=-1;1>=p;p++)0>e+p||c<=e+p||0==g&&0==p||h!=a.isDark(d+g,e+p)||f++;5<f&&(b+=3+f-5)}for(d=0;d<c-1;d++)for(e=0;e<c-1;e++)if(f=0,a.isDark(d,
e)&&f++,a.isDark(d+1,e)&&f++,a.isDark(d,e+1)&&f++,a.isDark(d+1,e+1)&&f++,0==f||4==f)b+=3;for(d=0;d<c;d++)for(e=0;e<c-6;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(b+=40);for(e=0;e<c;e++)for(d=0;d<c-6;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(b+=40);for(e=f=0;e<c;e++)for(d=0;d<c;d++)a.isDark(d,e)&&f++;return b+Math.abs(100*f/c/c-50)/5*10}},
m={glog:function(a){if(1>a)throw Error("glog("+a+")");return m.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return m.EXP_TABLE[a]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},n=0;8>n;n++)m.EXP_TABLE[n]=1<<n;for(n=8;256>n;n++)m.EXP_TABLE[n]=m.EXP_TABLE[n-4]^m.EXP_TABLE[n-5]^m.EXP_TABLE[n-6]^m.EXP_TABLE[n-8];for(n=0;255>n;n++)m.LOG_TABLE[m.EXP_TABLE[n]]=n;v.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=
Array(this.getLength()+a.getLength()-1),b=0;b<this.getLength();b++)for(var d=0;d<a.getLength();d++)c[b+d]^=m.gexp(m.glog(this.get(b))+m.glog(a.get(d)));return new v(c,0)},mod:function(a){if(0>this.getLength()-a.getLength())return this;for(var c=m.glog(this.get(0))-m.glog(a.get(0)),b=Array(this.getLength()),d=0;d<this.getLength();d++)b[d]=this.get(d);for(d=0;d<a.getLength();d++)b[d]^=m.gexp(m.glog(a.get(d))+c);return(new v(b,0)).mod(a)}};r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,
44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],
[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,
69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,
17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,
146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,
14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];r.getRSBlocks=function(a,c){var b=r.getRsBlockTable(a,c);if(void 0==b)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);a=b.length/3;c=[];for(var d=0;d<a;d++)for(var e=b[3*d+0],f=b[3*d+
1],h=b[3*d+2],g=0;g<e;g++)c.push(new r(f,h));return c};r.getRsBlockTable=function(a,c){switch(c){case t.L:return r.RS_BLOCK_TABLE[4*(a-1)+0];case t.M:return r.RS_BLOCK_TABLE[4*(a-1)+1];case t.Q:return r.RS_BLOCK_TABLE[4*(a-1)+2];case t.H:return r.RS_BLOCK_TABLE[4*(a-1)+3]}};A.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var b=0;b<c;b++)this.putBit(1==(a>>>c-b-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/
8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};var w=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,
911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],D=function(){var a=function(a,b){this._el=a;this._htOption=b};a.prototype.draw=function(a){function b(a,c){a=document.createElementNS("http://www.w3.org/2000/svg",
a);for(var b in c)c.hasOwnProperty(b)&&a.setAttribute(b,c[b]);return a}var c=this._htOption,e=this._el,f=a.getModuleCount();this.clear();var h=b("svg",{viewBox:"0 0 "+String(f)+" "+String(f),width:"100%",height:"100%",fill:c.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");e.appendChild(h);h.appendChild(b("rect",{fill:c.colorLight,width:"100%",height:"100%"}));h.appendChild(b("rect",{fill:c.colorDark,width:"1",height:"1",id:"template"}));
for(c=0;c<f;c++)for(e=0;e<f;e++)if(a.isDark(c,e)){var g=b("use",{x:String(e),y:String(c)});g.setAttributeNS("http://www.w3.org/1999/xlink","href","#template");h.appendChild(g)}};a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)};return a}(),E="svg"===document.documentElement.tagName.toLowerCase()?D:B()?function(){function a(){this._htOption.img_src&&this._htOption.use_canvas?(this._elImage.style.display="none",this._elCanvas.style.display="block"):
(this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none")}function c(a,c){var b=this;b._fFail=c;b._fSuccess=a;null===b._bSupportDataURI?(a=document.createElement("img"),c=function(){b._bSupportDataURI=!1;b._fFail&&b._fFail.call(b)},a.onabort=c,a.onerror=c,a.onload=function(){b._bSupportDataURI=!0;b._fSuccess&&b._fSuccess.call(b)},a.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="):
!0===b._bSupportDataURI&&b._fSuccess?b._fSuccess.call(b):!1===b._bSupportDataURI&&b._fFail&&b._fFail.call(b)}if(this&&this._android&&2.1>=this._android){var b=1/window.devicePixelRatio,d=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,c,e,p,k,l,m,n,q){if("nodeName"in a&&/img/i.test(a.nodeName))for(var f=arguments.length-1;1<=f;f--)arguments[f]*=b;else"undefined"==typeof n&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);d.apply(this,
arguments)}}var e=function(a,b){this._bIsPainted=!1;this._android=C();this._htOption=b;this._elCanvas=document.createElement("canvas");this._elCanvas.width=b.width;this._elCanvas.height=b.height;a.appendChild(this._elCanvas);this._el=a;this._oContext=this._elCanvas.getContext("2d");this._bIsPainted=!1;this._elImage=document.createElement("img");this._elImage.alt="Scan me!";this._elImage.style.display="none";this._el.appendChild(this._elImage);this._bSupportDataURI=null};e.prototype.draw=function(a){var b=
this._elImage,c=this._elCanvas,d=this._oContext,e=this._htOption,f=a.getModuleCount(),k=e.width/f,m=e.height/f,n=Math.round(k),q=Math.round(m);b.style.display="none";c.style.display="none";this.clear();for(b=0;b<f;b++)for(c=0;c<f;c++){var u=a.isDark(b,c),r=c*k,t=b*m;d.strokeStyle=u?e.colorDark:e.colorLight;d.lineWidth=1;d.fillStyle=u?e.colorDark:e.colorLight;d.fillRect(r,t,k,m);d.strokeRect(Math.floor(r)+.5,Math.floor(t)+.5,n,q);d.strokeRect(Math.ceil(r)-.5,Math.ceil(t)-.5,n,q)}if(this._htOption.img_src&&
B){var x=new Image;x.crossOrigin="*";var v=this._htOption.img_width,w=(this._htOption.width-v)/2,y=this;x.onload=function(){d.drawImage(x,w,w,v,v);y._htOption.use_canvas||y.makeImage()};x.src=this._htOption.img_src;if(x.complete||void 0===x.complete)x.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",x.src=this._htOption.img_src}this._bIsPainted=!0};e.prototype.makeImage=function(){this._bIsPainted&&c.call(this,a)};e.prototype.isPainted=function(){return this._bIsPainted};
e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height);this._bIsPainted=!1};e.prototype.round=function(a){return a?Math.floor(1E3*a)/1E3:a};return e}():function(){var a=function(a,b){this._el=a;this._htOption=b};a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,e=a.getModuleCount(),f=Math.floor(b.width/e),h=Math.floor(b.height/e),g=['<table style="border:0;border-collapse:collapse;">'],k=0;k<e;k++){g.push("<tr>");for(var m=0;m<e;m++)g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+
f+"px;height:"+h+"px;background-color:"+(a.isDark(k,m)?b.colorDark:b.colorLight)+';"></td>');g.push("</tr>")}g.push("</table>");c.innerHTML=g.join("");a=c.childNodes[0];c=(b.width-a.offsetWidth)/2;b=(b.height-a.offsetHeight)/2;0<c&&0<b&&(a.style.margin=b+"px "+c+"px")};a.prototype.clear=function(){this._el.innerHTML=""};return a}();QRCode=function(a,c){this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:t.H,img_src:"",use_canvas:!0};this._htOption.img_width=
this._htOption.width/4;"string"===typeof c&&(c={text:c});if(c){for(var b in c)this._htOption[b]=c[b];c.width&&!c.img_width&&(this._htOption.img_width=this._htOption.width/4)}"string"==typeof a&&(a=document.getElementById(a));this._htOption.useSVG&&(E=D);this._android=C();this._el=a;this._oQRCode=null;this._oDrawing=new E(this._el,this._htOption);this._htOption.text&&this.makeCode(this._htOption.text)};QRCode.prototype.makeCode=function(a){var c=this._htOption.correctLevel,b=1,d;d=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,
"a");d=d.length+(d.length!=a?3:0);for(var e=0,f=w.length;e<=f;e++){var h=0;switch(c){case t.L:h=w[e][0];break;case t.M:h=w[e][1];break;case t.Q:h=w[e][2];break;case t.H:h=w[e][3]}if(d<=h)break;else b++}if(b>w.length)throw Error("Too long data");this._oQRCode=new u(b,this._htOption.correctLevel);this._oQRCode.addData(a);this._oQRCode.make();this._el.title=a;this._oDrawing.draw(this._oQRCode);this._htOption.img_src&&!this._htOption.use_canvas||this.makeImage()};QRCode.prototype.makeImage=function(){"function"==
typeof this._oDrawing.makeImage&&(!this._android||3<=this._android)&&this._oDrawing.makeImage()};QRCode.prototype.clear=function(){this._oDrawing.clear()};QRCode.CorrectLevel=t;window.QRCode=QRCode})();