Files
invitation-maker/js/qrcode.min.js

2 lines
19 KiB
JavaScript

var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectionLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function j(a,b){this.totalCount=a,this.dataCount=b}function k(){this.buffer=[],this.length=0}function m(){return"undefined"!=typeof CanvasRenderingContext2D}function n(){var a=!1,b=navigator.userAgent;return/android/i.test(b)&&(a=!0,aMat=b.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(a=parseFloat(aMat[1]))),a}function r(a,b){for(var c=1,e=s(a),f=0,g=l.length;g>=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){this.dataList.push(new a(b))},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=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),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectionLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(var b=8;b<this.moduleCount-8;b++)null==this.modules[6][b]&&(this.modules[6][b]=0==b%2)},setupPositionAdjustPattern:function(){for(var a=f.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var g=-2;2>=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(b>>c&1);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(b>>c&1);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectionLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(d>>e&1);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(d>>e&1);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=f.getMaskFunction(b),i=this.moduleCount-1;i>0;i-=2)for(6==i&&i--;;){for(var j=0;2>j;j++)for(var k=this.modules[d][i-j];null==k;){if(g<a.length){var l=a[g]>>>e&1;h(d,i-j)&&(l=!l),this.modules[d][i-j]=l,e--,g+=0>e&&(e=7,g++)}else this.modules[d][i-j]=!1}if(0>(d+=c)||this.moduleCount<=d){d-=c,c=-c;break}}}},b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h<d.length;h++){var i=d[h];g.put(i.mode,4),g.put(i.getLength(),f.getLengthInBits(i.mode,a)),i.write(g)}for(var l=0,h=0;h<e.length;h++)l+=e[h].dataCount;if(g.getLengthInBits()>8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;!(g.getLengthInBits()>=8*l);){if(g.put(236,8),g.getLengthInBits()>=8*l)break;g.put(17,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j<b.length;j++){var k=b[j].dataCount,l=b[j].totalCount-k;d=Math.max(d,k),e=Math.max(e,l),g[j]=new Array(k);for(var m=0;m<g[j].length;m++)g[j][m]=255&a.buffer[m+c];c+=k;var n=f.getErrorCorrectPolynomial(l),o=new i(g[j],n.getLength()-1),p=o.mod(n);h[j]=new Array(n.getLength()-1);for(var m=0;m<h[j].length;m++){var q=m+p.getLength()-h[j].length;h[j][m]=q>=0?p.get(q):0}}for(var r=0,m=0;m<b.length;m++)r+=b[m].totalCount;for(var s=new Array(r),t=0,m=0;d>m;m++)for(var j=0;j<b.length;j++)m<g[j].length&&(s[t++]=g[j][m]);for(var m=0;e>m;m++)for(var j=0;j<b.length;j++)m<h[j].length&&(s[t++]=h[j][m]);return s};for(var c={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},d={L:1,M:0,Q:3,H:2},e={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},f={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 b=a<<10;f.getBCHDigit(b)-f.getBCHDigit(f.G15)>=0;)b^=f.G15<<f.getBCHDigit(b)-f.getBCHDigit(f.G15);return(a<<10|b)^f.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;f.getBCHDigit(b)-f.getBCHDigit(f.G18)>=0;)b^=f.G18<<f.getBCHDigit(b)-f.getBCHDigit(f.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMaskFunction:function(a){switch(a){case e.PATTERN000:return function(a,b){return 0==(a+b)%2};case e.PATTERN001:return function(a,b){return 0==a%2};case e.PATTERN010:return function(a,b){return 0==b%3};case e.PATTERN011:return function(a,b){return 0==(a+b)%3};case e.PATTERN100:return function(a,b){return 0==(Math.floor(a/2)+Math.floor(b/3))%2};case e.PATTERN101:return function(a,b){return 0==a*b%2+a*b%3};case e.PATTERN110:return function(a,b){return 0==(a*b%2+a*b%3)%2};case e.PATTERN111:return function(a,b){return 0==(a*b%3+(a+b)%2)%2};default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;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)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;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)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<<h;for(var h=8;256>h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=g.gexp(g.glog(this.get(c))+g.glog(a.get(d)));return new i(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var b=g.glog(this.get(0))-g.glog(a.get(0)),c=new Array(this.getLength()),d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=g.gexp(g.glog(a.get(d))+b);return new i(c,0).mod(a)}},j.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],[1,70,34],[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,20,7,4,21,8],[4,20,7,4,21,8],[4,101,81],[4,50,22,4,51,23],[6,36,12,2,37,13],[4,50,22,4,51,23],[6,29,11,4,30,12],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16],[6,43,15,4,44,16]],j.getRSBlocks=function(a,b){var c=j.RS_BLOCK_TABLE[4*(a-1)+b];if(void 0==c)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectionLevel:"+b);for(var d=c.length/3,e=[],f=0;d>f;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push({totalCount:h,dataCount:i});return e},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(this.buffer[b]>>>7-a%8&1)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(a>>>b-c-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}},"string"==typeof a&&(a={text:a}),a=a||{},a=a||{},this.text=a.text||"",this.typeNumber=a.typeNumber||0,this.correctLevel=a.correctLevel||d.H,this.typeNumber<1&&(this.typeNumber=r(this.text,this.correctLevel)),this.makeImpl=function(a,c){for(var d=0;d<this.typeNumber;d++)for(var e=0;e<this.typeNumber;e++)this.modules[d][e]=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),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectionLevel,this.dataList)),this.mapData(this.dataCache,c)},this.addData=function(a){this.dataList.push(new qrcode.QRCodeModel(a))},this.make=function(){this.makeImpl(!1,this.getBestMaskPattern())},this.createTableTag=function(a,b){a=a||2,b="undefined"==typeof b?4*a:b;var c="";c+='<table style=" border-width: 0px; border-style: none;"',c+=' border="0"',c+=' cellpadding="0"',c+=' cellspacing="0">',c+="<tbody>";for(var d=0;d<this.getModuleCount();d++){c+="<tr>";for(var e=0;e<this.getModuleCount();e++)c+='<td style="',c+=" border-width: 0px; border-style: none;",c+=" padding: 0px; margin: 0px;",c+=" width: "+a+"px;",c+=" height: "+a+"px;",c+=" background-color: ",c+=this.isDark(d,e)?"#000000":"#ffffff",c+=";",c+='"/>';c+="</tr>"}return c+="</tbody>",c+="</table>"},this.createImgTag=function(a,b){a=a||2,b="undefined"==typeof b?4*a:b;var c=this.createDataURL(a,b);return'<img src="'+c+'" width="'+this.getModuleCount()*a+'" height="'+this.getModuleCount()*a+'" />'},this.createSvgTag=function(a,b,c){a=a||2,b="undefined"==typeof b?4*a:b;var d=this.getModuleCount()*a+2*b,e="",f="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";f+="<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",f+='<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 '+d+" "+d+'\" width=\"'+d+"\" height=\""+d+'\" preserveAspectRatio=\"xMinYMin meet\">\n',f+='<rect width=\"'+d+"\" height=\""+d+'\" fill=\"white\" cx=\"0\" cy=\"0\"/>\n';for(var g=0;g<this.getModuleCount();g++)for(var h=0;h<this.getModuleCount();h++)this.isDark(g,h)&&(e+='<rect x="'+(b+h*a)+'" y="'+(b+g*a)+'" width="'+a+'" height="'+a+'" fill=\"black\"/>\n');return f+=e,f+="</svg>\n"},this.createDataURL=function(a,b){a=a||2,b="undefined"==typeof b?4*a:b;var c=this.getModuleCount()*a+2*b,d=b,e=c-b,f=document.createElement("canvas"),g=f.getContext("2d");f.width=f.height=c;for(var h=0;h<this.getModuleCount();h++)for(var i=0;i<this.getModuleCount();i++){var j=i*a+d,k=h*a+d;g.fillStyle=this.isDark(h,i)?"#000000":"#ffffff",g.fillRect(j,k,a,a)}return f.toDataURL()},this.createASCII=function(a,b){a=a||1,b="undefined"==typeof b?2*a:b;var c=this.getModuleCount()*a+2*b,d=b,e=c-b,f="";f+="<pre style=\"font-family: monospace; line-height: 0.6em;\">\n";for(var g=0;g<this.getModuleCount();g++){for(var h=0;h<this.getModuleCount();h++)for(var i=0;a>i;i++)f+=this.isDark(g,h)?"██":" ";f+="\n"}return f+="</pre>"},this.renderTo2dContext=function(a,b){b=b||2;for(var c=0;c<this.getModuleCount();c++)for(var d=0;d<this.getModuleCount();d++){var e=d*b,f=c*b;a.fillStyle=this.isDark(c,d)?"#000000":"#ffffff",a.fillRect(e,f,b,b)}},QRCode=function(a,b){function c(){return"undefined"==typeof g._el&&(g._el=m()),g._el}function d(){return g._ht?g._ht:g._ht=h(g._htOption.text,g._htOption.width,g._htOption.height,g._htOption.colorDark,g._htOption.colorLight,g._htOption.correctLevel)}function e(){return g._canvas?g._canvas:g._canvas=i(g._htOption.width,g._htOption.height,g._htOption.colorDark,g._htOption.colorLight,g._htOption.correctLevel)}function f(){return g._table?g._table:g._table=j(g._htOption.width,g._htOption.height,g._htOption.colorDark,g._htOption.colorLight,g._htOption.correctLevel)}function h(a,b,c,d,e,f){var g=document.createElement("div"),h=document.createElement("img");return h.src=k(a,b,c,d,e,f),h.style.display="block",h.style.border="none",h.style.margin="0",h.style.padding="0",g.appendChild(h),g}function i(a,b,c,d,e){var f=document.createElement("canvas"),g=f.getContext("2d"),h=k(a,b,c,d,e),i=new Image;return i.src=h,i.onload=function(){f.width=i.width,f.height=i.height,g.drawImage(i,0,0)},f}function j(a,b,c,d,e){var f=document.createElement("table"),g=Math.floor(b/a),h=Math.floor(b/a),i=document.createElement("tbody");f.style.border="0",f.style.borderCollapse="collapse",f.style.borderSpacing="0",f.style.padding="0",f.style.margin="0",i.style.border="0",i.style.borderCollapse="collapse",i.style.borderSpacing="0",i.style.padding="0",i.style.margin="0";for(var j=new qrcode.QRCodeModel(e),l=0;l<j.getModuleCount();l++){var m=document.createElement("tr");m.style.border="0",m.style.borderCollapse="collapse",m.style.borderSpacing="0",m.style.padding="0",m.style.margin="0";for(var n=0;n<j.getModuleCount();n++){var o=document.createElement("td");o.style.border="0",o.style.borderCollapse="collapse",o.style.borderSpacing="0",o.style.padding="0",o.style.margin="0",o.style.width=g+"px",o.style.height=h+"px",o.style.backgroundColor=j.isDark(l,n)?c:d,m.appendChild(o)}i.appendChild(m)}return f.appendChild(i),f}function k(a,b,c,d,e,f){var g=new qrcode.QRCodeModel(f);return g.addData(a),g.make(),g.createDataURL(b,c)}function l(a,b,c,d,e,f){var g=new qrcode.QRCodeModel(f);g.addData(a),g.make();var h=document.createElement("canvas"),i=h.getContext("2d");h.width=b,h.height=c;for(var j=0;j<g.getModuleCount();j++)for(var k=0;k<g.getModuleCount();k++){var l=k*e,m=j*e;i.fillStyle=g.isDark(j,k)?d:f,i.fillRect(l,m,e,e)}return h}function m(){var a=document.createElement("div");return a.style.position="relative",a.style.display="inline-block",a.style.margin="0",a.style.padding="0",a.style.border="0",a}function o(a){var b="canvas";if(b="canvas",!g._android&&g._htOption.useSVG)b="svg";else if(g._android||"table"==b)b="table";else{if(g._android||"canvas"!=b)return f();b="canvas"}return"canvas"==b?e():"svg"==b?d():"table"==b?f():void 0}var g=this;g._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:qrcode.CorrectLevel.H,useSVG:!1},"string"==typeof b&&(b={text:b}),b&&(g._htOption.text=b.text||g._htOption.text,g._htOption.width=b.width||g._htOption.width,g._htOption.height=b.height||g._htOption.height,g._htOption.colorDark=b.colorDark||g._htOption.colorDark,g._htOption.colorLight=b.colorLight||g._htOption.colorLight,g._htOption.correctLevel="undefined"!=typeof b.correctLevel?b.correctLevel:g._htOption.correctLevel,g._htOption.useSVG=b.useSVG||g._htOption.useSVG),g._android=n(),g._el=c(),g._oQRCode=null,g._htOption.text&&(g._oQRCode=new qrcode.QRCodeModel(g._htOption.text,g._htOption.correctLevel),g.makeCode=g._oQRCode.make.bind(g._oQRCode),g.makeCode()),g.getCanvas=function(){return e()},g.getTable=function(){return f()},g.getSvg=function(){return d()},g.getDataURL=function(a){a=a||2;var b=g._oQRCode;return b?b.createDataURL(a):""},g.makeImage=function(){g.getCanvas()},g.drawToContext=function(a,b){var c=g._oQRCode;c&&c.renderTo2dContext(a,b)},g.clear=function(){g._oQRCode=null,g._el.innerHTML=""},g._el.appendChild(o())};QRCode.CorrectLevel=d,QRCode.QRCodeModel=b}();