uqrcodejs-00405b21.js 34 KB

1
  1. import{g as Ne}from"./@amap-aca98dec.js";var ke={exports:{}};(function(ye,Pe){(function(K,z){ye.exports=z()})(window,function(){function K(e){this.mode=R.MODE_8BIT_BYTE,this.data=e}function z(e,r){this.typeNumber=e,this.errorCorrectLevel=r,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array}K.prototype={getLength:function(e){return this.data.length},write:function(e){for(var r=0;r<this.data.length;r++)e.put(this.data.charCodeAt(r),8)}},z.prototype={addData:function(e){var r=new K(e);this.dataList.push(r),this.dataCache=null},isDark:function(e,r){if(e<0||this.moduleCount<=e||r<0||this.moduleCount<=r)throw new Error(e+","+r);return this.modules[e][r]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var r=_.getRSBlocks(e,this.errorCorrectLevel),t=new Q,o=0,i=0;i<r.length;i++)o+=r[i].dataCount;for(i=0;i<this.dataList.length;i++){var s=this.dataList[i];t.put(s.mode,4),t.put(s.getLength(),A.getLengthInBits(s.mode,e)),s.write(t)}if(t.getLengthInBits()<=8*o)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,r){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var t=0;t<this.moduleCount;t++){this.modules[t]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[t][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,r),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=z.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,r)},setupPositionProbePattern:function(e,r){for(var t=-1;t<=7;t++)if(!(e+t<=-1||this.moduleCount<=e+t))for(var o=-1;o<=7;o++)r+o<=-1||this.moduleCount<=r+o||(this.modules[e+t][r+o]=0<=t&&t<=6&&(o==0||o==6)||0<=o&&o<=6&&(t==0||t==6)||2<=t&&t<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var e=0,r=0,t=0;t<8;t++){this.makeImpl(!0,t);var o=A.getLostPoint(this);(t==0||e>o)&&(e=o,r=t)}return r},createMovieClip:function(e,r,t){var o=e.createEmptyMovieClip(r,t);this.make();for(var i=0;i<this.modules.length;i++)for(var s=1*i,c=0;c<this.modules[i].length;c++){var g=1*c;this.modules[i][c]&&(o.beginFill(0,100),o.moveTo(g,s),o.lineTo(g+1,s),o.lineTo(g+1,s+1),o.lineTo(g,s+1),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]==null&&(this.modules[e][6]=e%2==0);for(var r=8;r<this.moduleCount-8;r++)this.modules[6][r]==null&&(this.modules[6][r]=r%2==0)},setupPositionAdjustPattern:function(){for(var e=A.getPatternPosition(this.typeNumber),r=0;r<e.length;r++)for(var t=0;t<e.length;t++){var o=e[r],i=e[t];if(this.modules[o][i]==null)for(var s=-2;s<=2;s++)for(var c=-2;c<=2;c++)this.modules[o+s][i+c]=s==-2||s==2||c==-2||c==2||s==0&&c==0}},setupTypeNumber:function(e){for(var r=A.getBCHTypeNumber(this.typeNumber),t=0;t<18;t++){var o=!e&&(r>>t&1)==1;this.modules[Math.floor(t/3)][t%3+this.moduleCount-8-3]=o}for(t=0;t<18;t++)o=!e&&(r>>t&1)==1,this.modules[t%3+this.moduleCount-8-3][Math.floor(t/3)]=o},setupTypeInfo:function(e,r){for(var t=this.errorCorrectLevel<<3|r,o=A.getBCHTypeInfo(t),i=0;i<15;i++){var s=!e&&(o>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(i=0;i<15;i++)s=!e&&(o>>i&1)==1,i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,r){for(var t=-1,o=this.moduleCount-1,i=7,s=0,c=this.moduleCount-1;c>0;c-=2)for(c==6&&c--;;){for(var g=0;g<2;g++)if(this.modules[o][c-g]==null){var k=!1;s<e.length&&(k=(e[s]>>>i&1)==1),A.getMask(r,o,c-g)&&(k=!k),this.modules[o][c-g]=k,--i==-1&&(s++,i=7)}if((o+=t)<0||this.moduleCount<=o){o-=t,t=-t;break}}}},z.PAD0=236,z.PAD1=17,z.createData=function(e,r,t){for(var o=_.getRSBlocks(e,r),i=new Q,s=0;s<t.length;s++){var c=t[s];i.put(c.mode,4),i.put(c.getLength(),A.getLengthInBits(c.mode,e)),c.write(i)}var g=0;for(s=0;s<o.length;s++)g+=o[s].dataCount;if(i.getLengthInBits()>8*g)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+8*g+")");for(i.getLengthInBits()+4<=8*g&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*g||(i.put(z.PAD0,8),i.getLengthInBits()>=8*g));)i.put(z.PAD1,8);return z.createBytes(i,o)},z.createBytes=function(e,r){for(var t=0,o=0,i=0,s=new Array(r.length),c=new Array(r.length),g=0;g<r.length;g++){var k=r[g].dataCount,v=r[g].totalCount-k;o=Math.max(o,k),i=Math.max(i,v),s[g]=new Array(k);for(var d=0;d<s[g].length;d++)s[g][d]=255&e.buffer[d+t];t+=k;var C=A.getErrorCorrectPolynomial(v),f=new H(s[g],C.getLength()-1).mod(C);for(c[g]=new Array(C.getLength()-1),d=0;d<c[g].length;d++){var b=d+f.getLength()-c[g].length;c[g][d]=b>=0?f.get(b):0}}var L=0;for(d=0;d<r.length;d++)L+=r[d].totalCount;var a=new Array(L),h=0;for(d=0;d<o;d++)for(g=0;g<r.length;g++)d<s[g].length&&(a[h++]=s[g][d]);for(d=0;d<i;d++)for(g=0;g<r.length;g++)d<c[g].length&&(a[h++]=c[g][d]);return a};for(var R={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},W={L:1,M:0,Q:3,H:2},we=0,Ie=1,Be=2,Se=3,Le=4,De=5,Ee=6,Ae=7,A={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(e){for(var r=e<<10;A.getBCHDigit(r)-A.getBCHDigit(A.G15)>=0;)r^=A.G15<<A.getBCHDigit(r)-A.getBCHDigit(A.G15);return(e<<10|r)^A.G15_MASK},getBCHTypeNumber:function(e){for(var r=e<<12;A.getBCHDigit(r)-A.getBCHDigit(A.G18)>=0;)r^=A.G18<<A.getBCHDigit(r)-A.getBCHDigit(A.G18);return e<<12|r},getBCHDigit:function(e){for(var r=0;e!=0;)r++,e>>>=1;return r},getPatternPosition:function(e){return A.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,r,t){switch(e){case we:return(r+t)%2==0;case Ie:return r%2==0;case Be:return t%3==0;case Se:return(r+t)%3==0;case Le:return(Math.floor(r/2)+Math.floor(t/3))%2==0;case De:return r*t%2+r*t%3==0;case Ee:return(r*t%2+r*t%3)%2==0;case Ae:return(r*t%3+(r+t)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var r=new H([1],0),t=0;t<e;t++)r=r.multiply(new H([1,N.gexp(t)],0));return r},getLengthInBits:function(e,r){if(1<=r&&r<10)switch(e){case R.MODE_NUMBER:return 10;case R.MODE_ALPHA_NUM:return 9;case R.MODE_8BIT_BYTE:case R.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(r<27)switch(e){case R.MODE_NUMBER:return 12;case R.MODE_ALPHA_NUM:return 11;case R.MODE_8BIT_BYTE:return 16;case R.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(r<41))throw new Error("type:"+r);switch(e){case R.MODE_NUMBER:return 14;case R.MODE_ALPHA_NUM:return 13;case R.MODE_8BIT_BYTE:return 16;case R.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var r=e.getModuleCount(),t=0,o=0;o<r;o++)for(var i=0;i<r;i++){for(var s=0,c=e.isDark(o,i),g=-1;g<=1;g++)if(!(o+g<0||r<=o+g))for(var k=-1;k<=1;k++)i+k<0||r<=i+k||g==0&&k==0||c==e.isDark(o+g,i+k)&&s++;s>5&&(t+=3+s-5)}for(o=0;o<r-1;o++)for(i=0;i<r-1;i++){var v=0;e.isDark(o,i)&&v++,e.isDark(o+1,i)&&v++,e.isDark(o,i+1)&&v++,e.isDark(o+1,i+1)&&v++,v!=0&&v!=4||(t+=3)}for(o=0;o<r;o++)for(i=0;i<r-6;i++)e.isDark(o,i)&&!e.isDark(o,i+1)&&e.isDark(o,i+2)&&e.isDark(o,i+3)&&e.isDark(o,i+4)&&!e.isDark(o,i+5)&&e.isDark(o,i+6)&&(t+=40);for(i=0;i<r;i++)for(o=0;o<r-6;o++)e.isDark(o,i)&&!e.isDark(o+1,i)&&e.isDark(o+2,i)&&e.isDark(o+3,i)&&e.isDark(o+4,i)&&!e.isDark(o+5,i)&&e.isDark(o+6,i)&&(t+=40);var d=0;for(i=0;i<r;i++)for(o=0;o<r;o++)e.isDark(o,i)&&d++;return t+=10*(Math.abs(100*d/r/r-50)/5)}},N={glog:function(e){if(e<1)throw new Error("glog("+e+")");return N.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return N.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},M=0;M<8;M++)N.EXP_TABLE[M]=1<<M;for(M=8;M<256;M++)N.EXP_TABLE[M]=N.EXP_TABLE[M-4]^N.EXP_TABLE[M-5]^N.EXP_TABLE[M-6]^N.EXP_TABLE[M-8];for(M=0;M<255;M++)N.LOG_TABLE[N.EXP_TABLE[M]]=M;function H(e,r){if(e.length==null)throw new Error(e.length+"/"+r);for(var t=0;t<e.length&&e[t]==0;)t++;this.num=new Array(e.length-t+r);for(var o=0;o<e.length-t;o++)this.num[o]=e[o+t]}function _(e,r){this.totalCount=e,this.dataCount=r}function Q(){this.buffer=new Array,this.length=0}function Ce(e){return e.setFillStyle=e.setFillStyle||function(r){e.fillStyle=r},e.setFontSize=e.setFontSize||function(r){e.font=`${r}px`},e.setTextAlign=e.setTextAlign||function(r){e.textAlign=r},e.setTextBaseline=e.setTextBaseline||function(r){e.textBaseline=r},e.setGlobalAlpha=e.setGlobalAlpha||function(r){e.globalAlpha=r},e.setStrokeStyle=e.setStrokeStyle||function(r){e.strokeStyle=r},e.setShadow=e.setShadow||function(r,t,o,i){e.shadowOffsetX=r,e.shadowOffsetY=t,e.shadowBlur=o,e.shadowColor=i},e.draw=e.draw||function(r,t){t&&t()},e.clearRect=e.clearRect||function(r,t,o,i){e.draw(!1)},e}function D(e,r){var t=this.data="",o=this.size=200;this.useDynamicSize=!1,this.dynamicSize=o;var i=this.typeNumber=-1;this.errorCorrectLevel=D.errorCorrectLevel.H;var s=this.margin=0;this.areaColor="#FFFFFF",this.backgroundColor="rgba(255,255,255,0)",this.backgroundImageSrc=void 0;var c=this.backgroundImageWidth=void 0,g=this.backgroundImageHeight=void 0,k=this.backgroundImageX=void 0,v=this.backgroundImageY=void 0;this.backgroundImageAlpha=1,this.backgroundImageBorderRadius=0;var d=this.backgroundPadding=0;this.foregroundColor="#000000",this.foregroundImageSrc=void 0;var C=this.foregroundImageWidth=void 0,f=this.foregroundImageHeight=void 0,b=this.foregroundImageX=void 0,L=this.foregroundImageY=void 0,a=this.foregroundImagePadding=0;this.foregroundImageBackgroundColor="#FFFFFF";var h=this.foregroundImageBorderRadius=0,n=this.foregroundImageShadowOffsetX=0,m=this.foregroundImageShadowOffsetY=0,y=this.foregroundImageShadowBlur=0;this.foregroundImageShadowColor="#808080";var T=this.foregroundPadding=0,B=this.positionProbeBackgroundColor=void 0,E=this.positionProbeForegroundColor=void 0,w=this.separatorColor=void 0,p=this.positionAdjustBackgroundColor=void 0,S=this.positionAdjustForegroundColor=void 0,l=this.timingBackgroundColor=void 0,I=this.timingForegroundColor=void 0,P=this.typeNumberBackgroundColor=void 0,x=this.typeNumberForegroundColor=void 0,F=this.darkBlockColor=void 0;this.base=void 0,this.modules=[],this.moduleCount=0,this.drawModules=[];var O=this.canvasContext=void 0;this.loadImage,this.drawReserve=!1,this.isMaked=!1,Object.defineProperties(this,{data:{get(){if(t===""||t===void 0)throw console.error("[uQRCode]: data must be set!"),new D.Error("data must be set!");return t},set(u){t=String(u)}},size:{get:()=>o,set(u){o=Number(u)}},typeNumber:{get:()=>i,set(u){i=Number(u)}},margin:{get:()=>s,set(u){s=Number(u)}},backgroundImageWidth:{get(){return c===void 0?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*c:c},set(u){c=Number(u)}},backgroundImageHeight:{get(){return g===void 0?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*g:g},set(u){g=Number(u)}},backgroundImageX:{get(){return k===void 0?0:this.useDynamicSize?this.dynamicSize/this.size*k:k},set(u){k=Number(u)}},backgroundImageY:{get(){return v===void 0?0:this.useDynamicSize?this.dynamicSize/this.size*v:v},set(u){v=Number(u)}},backgroundPadding:{get:()=>d,set(u){d=u>1?1:u<0?0:u}},foregroundImageWidth:{get(){return C===void 0?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*C:C},set(u){C=Number(u)}},foregroundImageHeight:{get(){return f===void 0?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*f:f},set(u){f=Number(u)}},foregroundImageX:{get(){return b===void 0?this.dynamicSize/2-this.foregroundImageWidth/2:this.useDynamicSize?this.dynamicSize/this.size*b:b},set(u){b=Number(u)}},foregroundImageY:{get(){return L===void 0?this.dynamicSize/2-this.foregroundImageHeight/2:this.useDynamicSize?this.dynamicSize/this.size*L:L},set(u){L=Number(u)}},foregroundImagePadding:{get(){return this.useDynamicSize?this.dynamicSize/this.size*a:a},set(u){a=Number(u)}},foregroundImageBorderRadius:{get(){return this.useDynamicSize?this.dynamicSize/this.size*h:h},set(u){h=Number(u)}},foregroundImageShadowOffsetX:{get(){return this.useDynamicSize?this.dynamicSize/this.size*n:n},set(u){n=Number(u)}},foregroundImageShadowOffsetY:{get(){return this.useDynamicSize?this.dynamicSize/this.size*m:m},set(u){m=Number(u)}},foregroundImageShadowBlur:{get(){return this.useDynamicSize?this.dynamicSize/this.size*y:y},set(u){y=Number(u)}},foregroundPadding:{get:()=>T,set(u){T=u>1?1:u<0?0:u}},positionProbeBackgroundColor:{get(){return B||this.backgroundColor},set(u){B=u}},positionProbeForegroundColor:{get(){return E||this.foregroundColor},set(u){E=u}},separatorColor:{get(){return w||this.backgroundColor},set(u){w=u}},positionAdjustBackgroundColor:{get(){return p||this.backgroundColor},set(u){p=u}},positionAdjustForegroundColor:{get(){return S||this.foregroundColor},set(u){S=u}},timingBackgroundColor:{get(){return l||this.backgroundColor},set(u){l=u}},timingForegroundColor:{get(){return I||this.foregroundColor},set(u){I=u}},typeNumberBackgroundColor:{get(){return P||this.backgroundColor},set(u){P=u}},typeNumberForegroundColor:{get(){return x||this.foregroundColor},set(u){x=u}},darkBlockColor:{get(){return F||this.foregroundColor},set(u){F=u}},canvasContext:{get(){if(O===void 0)throw console.error("[uQRCode]: use drawCanvas, you need to set the canvasContext!"),new D.Error("use drawCanvas, you need to set the canvasContext!");return O},set(u){O=Ce(u)}}}),D.plugins.forEach(u=>u(D,this,!1)),e&&this.setOptions(e),r&&(this.canvasContext=Ce(r))}return H.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var r=new Array(this.getLength()+e.getLength()-1),t=0;t<this.getLength();t++)for(var o=0;o<e.getLength();o++)r[t+o]^=N.gexp(N.glog(this.get(t))+N.glog(e.get(o)));return new H(r,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var r=N.glog(this.get(0))-N.glog(e.get(0)),t=new Array(this.getLength()),o=0;o<this.getLength();o++)t[o]=this.get(o);for(o=0;o<e.getLength();o++)t[o]^=N.gexp(N.glog(e.get(o))+r);return new H(t,0).mod(e)}},_.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]],_.getRSBlocks=function(e,r){var t=_.getRsBlockTable(e,r);if(t==null)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+r);for(var o=t.length/3,i=new Array,s=0;s<o;s++)for(var c=t[3*s+0],g=t[3*s+1],k=t[3*s+2],v=0;v<c;v++)i.push(new _(g,k));return i},_.getRsBlockTable=function(e,r){switch(r){case W.L:return _.RS_BLOCK_TABLE[4*(e-1)+0];case W.M:return _.RS_BLOCK_TABLE[4*(e-1)+1];case W.Q:return _.RS_BLOCK_TABLE[4*(e-1)+2];case W.H:return _.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},Q.prototype={get:function(e){var r=Math.floor(e/8);return(this.buffer[r]>>>7-e%8&1)==1},put:function(e,r){for(var t=0;t<r;t++)this.putBit((e>>>r-t-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),e&&(this.buffer[r]|=128>>>this.length%8),this.length++}},z.errorCorrectLevel=W,D.errorCorrectLevel=z.errorCorrectLevel,D.Error=function(e){this.errMsg="[uQRCode]: "+e},D.plugins=[],D.use=function(e){typeof e=="function"&&D.plugins.push(e)},D.prototype.loadImage=function(e){return Promise.resolve(e)},D.prototype.setOptions=function(e){var r,t,o,i,s,c,g,k,v,d,C,f,b,L,a,h,n,m,y,T,B,E,w,p,S,l,I,P,x,F,O,u,U,$,J,q,V,Z,ee,re,oe,te,ie,ne,ae,ue,de,se,ge,le,he,ce,me,fe,pe,ve;e&&(Object.keys(e).forEach(G=>{this[G]=e[G]}),function(G={},be={},Te=!1){let X;X=Te?G:{...G};for(let j in be){var Y=be[j];Y!=null&&(Y.constructor==Object?X[j]=this.deepReplace(X[j],Y):Y.constructor!=String||Y?X[j]=Y:X[j]=X[j])}}(this,{data:e.data||e.text,size:e.size,useDynamicSize:e.useDynamicSize,typeNumber:e.typeNumber,errorCorrectLevel:e.errorCorrectLevel,margin:e.margin,areaColor:e.areaColor,backgroundColor:e.backgroundColor||((r=e.background)===null||r===void 0?void 0:r.color),backgroundImageSrc:e.backgroundImageSrc||((t=e.background)===null||t===void 0||(o=t.image)===null||o===void 0?void 0:o.src),backgroundImageWidth:e.backgroundImageWidth||((i=e.background)===null||i===void 0||(s=i.image)===null||s===void 0?void 0:s.width),backgroundImageHeight:e.backgroundImageHeight||((c=e.background)===null||c===void 0||(g=c.image)===null||g===void 0?void 0:g.height),backgroundImageX:e.backgroundImageX||((k=e.background)===null||k===void 0||(v=k.image)===null||v===void 0?void 0:v.x),backgroundImageY:e.backgroundImageY||((d=e.background)===null||d===void 0||(C=d.image)===null||C===void 0?void 0:C.y),backgroundImageAlpha:e.backgroundImageAlpha||((f=e.background)===null||f===void 0||(b=f.image)===null||b===void 0?void 0:b.alpha),backgroundImageBorderRadius:e.backgroundImageBorderRadius||((L=e.background)===null||L===void 0||(a=L.image)===null||a===void 0?void 0:a.borderRadius),backgroundPadding:e.backgroundPadding,foregroundColor:e.foregroundColor||((h=e.foreground)===null||h===void 0?void 0:h.color),foregroundImageSrc:e.foregroundImageSrc||((n=e.foreground)===null||n===void 0||(m=n.image)===null||m===void 0?void 0:m.src),foregroundImageWidth:e.foregroundImageWidth||((y=e.foreground)===null||y===void 0||(T=y.image)===null||T===void 0?void 0:T.width),foregroundImageHeight:e.foregroundImageHeight||((B=e.foreground)===null||B===void 0||(E=B.image)===null||E===void 0?void 0:E.height),foregroundImageX:e.foregroundImageX||((w=e.foreground)===null||w===void 0||(p=w.image)===null||p===void 0?void 0:p.x),foregroundImageY:e.foregroundImageY||((S=e.foreground)===null||S===void 0||(l=S.image)===null||l===void 0?void 0:l.y),foregroundImagePadding:e.foregroundImagePadding||((I=e.foreground)===null||I===void 0||(P=I.image)===null||P===void 0?void 0:P.padding),foregroundImageBackgroundColor:e.foregroundImageBackgroundColor||((x=e.foreground)===null||x===void 0||(F=x.image)===null||F===void 0?void 0:F.backgroundColor),foregroundImageBorderRadius:e.foregroundImageBorderRadius||((O=e.foreground)===null||O===void 0||(u=O.image)===null||u===void 0?void 0:u.borderRadius),foregroundImageShadowOffsetX:e.foregroundImageShadowOffsetX||((U=e.foreground)===null||U===void 0||($=U.image)===null||$===void 0?void 0:$.shadowOffsetX),foregroundImageShadowOffsetY:e.foregroundImageShadowOffsetY||((J=e.foreground)===null||J===void 0||(q=J.image)===null||q===void 0?void 0:q.shadowOffsetY),foregroundImageShadowBlur:e.foregroundImageShadowBlur||((V=e.foreground)===null||V===void 0||(Z=V.image)===null||Z===void 0?void 0:Z.shadowBlur),foregroundImageShadowColor:e.foregroundImageShadowColor||((ee=e.foreground)===null||ee===void 0||(re=ee.image)===null||re===void 0?void 0:re.shadowColor),foregroundPadding:e.foregroundPadding,positionProbeBackgroundColor:e.positionProbeBackgroundColor||((oe=e.positionProbe)===null||oe===void 0?void 0:oe.backgroundColor)||((te=e.positionDetection)===null||te===void 0?void 0:te.backgroundColor),positionProbeForegroundColor:e.positionProbeForegroundColor||((ie=e.positionProbe)===null||ie===void 0?void 0:ie.foregroundColor)||((ne=e.positionDetection)===null||ne===void 0?void 0:ne.foregroundColor),separatorColor:e.separatorColor||((ae=e.separator)===null||ae===void 0?void 0:ae.color),positionAdjustBackgroundColor:e.positionAdjustBackgroundColor||((ue=e.positionAdjust)===null||ue===void 0?void 0:ue.backgroundColor)||((de=e.alignment)===null||de===void 0?void 0:de.backgroundColor),positionAdjustForegroundColor:e.positionAdjustForegroundColor||((se=e.positionAdjust)===null||se===void 0?void 0:se.foregroundColor)||((ge=e.alignment)===null||ge===void 0?void 0:ge.foregroundColor),timingBackgroundColor:e.timingBackgroundColor||((le=e.timing)===null||le===void 0?void 0:le.backgroundColor),timingForegroundColor:e.timingForegroundColor||((he=e.timing)===null||he===void 0?void 0:he.foregroundColor),typeNumberBackgroundColor:e.typeNumberBackgroundColor||((ce=e.typeNumber)===null||ce===void 0?void 0:ce.backgroundColor)||((me=e.versionInformation)===null||me===void 0?void 0:me.backgroundColor),typeNumberForegroundColor:e.typeNumberForegroundColor||((fe=e.typeNumber)===null||fe===void 0?void 0:fe.foregroundColor)||((pe=e.versionInformation)===null||pe===void 0?void 0:pe.foregroundColor),darkBlockColor:e.darkBlockColor||((ve=e.darkBlock)===null||ve===void 0?void 0:ve.color)},!0))},D.prototype.make=function(){let{foregroundColor:e,backgroundColor:r,typeNumber:t,errorCorrectLevel:o,data:i,size:s,margin:c,useDynamicSize:g}=this;if(e===r)throw console.error("[uQRCode]: foregroundColor and backgroundColor cannot be the same!"),new D.Error("foregroundColor and backgroundColor cannot be the same!");var k=new z(t,o);k.addData(function(v){v=v.toString();for(var d,C="",f=0;f<v.length;f++)(d=v.charCodeAt(f))>=1&&d<=127?C+=v.charAt(f):d>2047?(C+=String.fromCharCode(224|d>>12&15),C+=String.fromCharCode(128|d>>6&63),C+=String.fromCharCode(128|d>>0&63)):(C+=String.fromCharCode(192|d>>6&31),C+=String.fromCharCode(128|d>>0&63));return C}(i)),k.make(),this.base=k,this.typeNumber=k.typeNumber,this.modules=k.modules,this.moduleCount=k.moduleCount,this.dynamicSize=g?Math.ceil((s-2*c)/k.moduleCount)*k.moduleCount+2*c:s,function(v){let{dynamicSize:d,margin:C,backgroundColor:f,backgroundPadding:b,foregroundColor:L,foregroundPadding:a,modules:h,moduleCount:n}=v,m=(d-2*C)/n,y=m,T=0;b>0&&(T=y*b/2,y-=2*T);let B=m,E=0;a>0&&(E=B*a/2,B-=2*E);for(var w=0;w<n;w++)for(var p=0;p<n;p++){var S=p*m+C,l=w*m+C;if(h[w][p]){var I=E,P=S+E,x=l+E,F=B,O=B;h[w][p]={type:["foreground"],color:L,isBlack:!0,isDrawn:!1,destX:S,destY:l,destWidth:m,destHeight:m,x:P,y:x,width:F,height:O,paddingTop:I,paddingRight:I,paddingBottom:I,paddingLeft:I}}else I=T,P=S+T,x=l+T,F=y,O=y,h[w][p]={type:["background"],color:f,isBlack:!1,isDrawn:!1,destX:S,destY:l,destWidth:m,destHeight:m,x:P,y:x,width:F,height:O,paddingTop:I,paddingRight:I,paddingBottom:I,paddingLeft:I}}}(this),function(v){let{modules:d,moduleCount:C,positionProbeBackgroundColor:f,positionProbeForegroundColor:b}=v,L=C-7;[[0,0,1],[1,0,1],[2,0,1],[3,0,1],[4,0,1],[5,0,1],[6,0,1],[0,1,1],[1,1,0],[2,1,0],[3,1,0],[4,1,0],[5,1,0],[6,1,1],[0,2,1],[1,2,0],[2,2,1],[3,2,1],[4,2,1],[5,2,0],[6,2,1],[0,3,1],[1,3,0],[2,3,1],[3,3,1],[4,3,1],[5,3,0],[6,3,1],[0,4,1],[1,4,0],[2,4,1],[3,4,1],[4,4,1],[5,4,0],[6,4,1],[0,5,1],[1,5,0],[2,5,0],[3,5,0],[4,5,0],[5,5,0],[6,5,1],[0,6,1],[1,6,1],[2,6,1],[3,6,1],[4,6,1],[5,6,1],[6,6,1]].forEach(a=>{var h=d[a[0]][a[1]],n=d[a[0]+L][a[1]],m=d[a[0]][a[1]+L];m.type.push("positionProbe"),n.type.push("positionProbe"),h.type.push("positionProbe"),h.color=a[2]==1?b:f,n.color=a[2]==1?b:f,m.color=a[2]==1?b:f})}(this),function(v){let{modules:d,moduleCount:C,separatorColor:f}=v;[[7,0],[7,1],[7,2],[7,3],[7,4],[7,5],[7,6],[7,7],[0,7],[1,7],[2,7],[3,7],[4,7],[5,7],[6,7]].forEach(b=>{var L=d[b[0]][b[1]],a=d[C-b[0]-1][b[1]],h=d[b[0]][C-b[1]-1];h.type.push("separator"),a.type.push("separator"),L.type.push("separator"),L.color=f,a.color=f,h.color=f})}(this),function(v){let{typeNumber:d,modules:C,moduleCount:f,foregroundColor:b,backgroundColor:L,positionAdjustForegroundColor:a,positionAdjustBackgroundColor:h,timingForegroundColor:n,timingBackgroundColor:m}=v;const y=[[],[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]][d-1];if(y){const T=[[-2,-2,1],[-1,-2,1],[0,-2,1],[1,-2,1],[2,-2,1],[-2,-1,1],[-1,-1,0],[0,-1,0],[1,-1,0],[2,-1,1],[-2,0,1],[-1,0,0],[0,0,1],[1,0,0],[2,0,1],[-2,1,1],[-1,1,0],[0,1,0],[1,1,0],[2,1,1],[-2,2,1],[-1,2,1],[0,2,1],[1,2,1],[2,2,1]],B=y.length;for(let E=0;E<B;E++)for(let w=0;w<B;w++){let{x:p,y:S}={x:y[E],y:y[w]};p<9&&S<9||p>f-9-1&&S<9||S>f-9-1&&p<9||T.forEach(l=>{var I=C[p+l[0]][S+l[1]];I.type.push("positionAdjust"),I.type.includes("timing")?l[2]==1?I.color=a==b?n:a:I.color=a==b&&h==L?m:h:I.color=l[2]==1?a:h})}}}(this),function(v){let{modules:d,moduleCount:C,timingForegroundColor:f,timingBackgroundColor:b}=v,L=C-16;for(let n=0;n<L;n++){var a=d[6][8+n],h=d[8+n][6];a.type.push("timing"),h.type.push("timing"),a.color=1&n^1?f:b,h.color=1&n^1?f:b}}(this),function(v){let{modules:d,moduleCount:C,darkBlockColor:f}=v;var b=d[C-7-1][8];b.type.push("darkBlock"),b.color=f}(this),function(v){let{typeNumber:d,modules:C,moduleCount:f,typeNumberBackgroundColor:b,typeNumberForegroundColor:L}=v;if(d<7)return C;const a=[0,0,0,0,0,0,0,"000111110010010100","001000010110111100","001001101010011001","001010010011010011","001011101111110110","001100011101100010","001101100001000111","001110011000001101","001111100100101000","010000101101111000","010001010001011101","010010101000010111","010011010100110010","010100100110100110","010101011010000011","010110100011001001","010111011111101100","011000111011000100","011001000111100001","011010111110101011","011011000010001110","011100110000011010","011101001100111111","011110110101110101","011111001001010000","100000100111010101","100001011011110000","100010100010111010","100011011110011111","100100101100001011","100101010000101110","100110101001100100","100111010101000001","101000110001101001"];let h=a[d]+a[d],n=[f-11,f-10,f-9];[[5,n[2]],[5,n[1]],[5,n[0]],[4,n[2]],[4,n[1]],[4,n[0]],[3,n[2]],[3,n[1]],[3,n[0]],[2,n[2]],[2,n[1]],[2,n[0]],[1,n[2]],[1,n[1]],[1,n[0]],[0,n[2]],[0,n[1]],[0,n[0]],[n[2],5],[n[1],5],[n[0],5],[n[2],4],[n[1],4],[n[0],4],[n[2],3],[n[1],3],[n[0],3],[n[2],2],[n[1],2],[n[0],2],[n[2],1],[n[1],1],[n[0],1],[n[2],0],[n[1],0],[n[0],0]].forEach((m,y)=>{var T=C[m[0]][m[1]];T.type.push("typeNumber"),T.color=h[y]=="1"?L:b})}(this),this.isMaked=!0,this.drawModules=[]},D.prototype.getDrawModules=function(){if(this.drawModules&&this.drawModules.length>0)return this.drawModules;let e=this.drawModules=[],{modules:r,moduleCount:t,dynamicSize:o,areaColor:i,backgroundImageSrc:s,backgroundImageX:c,backgroundImageY:g,backgroundImageWidth:k,backgroundImageHeight:v,backgroundImageAlpha:d,backgroundImageBorderRadius:C,foregroundImageSrc:f,foregroundImageX:b,foregroundImageY:L,foregroundImageWidth:a,foregroundImageHeight:h,foregroundImagePadding:n,foregroundImageBackgroundColor:m,foregroundImageBorderRadius:y,foregroundImageShadowOffsetX:T,foregroundImageShadowOffsetY:B,foregroundImageShadowBlur:E,foregroundImageShadowColor:w}=this;i&&e.push({name:"area",type:"area",color:i,x:0,y:0,width:o,height:o}),s&&e.push({name:"backgroundImage",type:"image",imageSrc:s,mappingName:"backgroundImageSrc",x:c,y:g,width:k,height:v,alpha:d,borderRadius:C});for(var p=0;p<t;p++)for(var S=0;S<t;S++){var l=r[p][S];l.isDrawn||(l.type.includes("foreground")?e.push({name:"foreground",type:"tile",color:l.color,destX:l.destX,destY:l.destY,destWidth:l.destWidth,destHeight:l.destHeight,x:l.x,y:l.y,width:l.width,height:l.height,paddingTop:l.paddingTop,paddingRight:l.paddingRight,paddingBottom:l.paddingBottom,paddingLeft:l.paddingLeft,rowIndex:p,colIndex:S}):e.push({name:"background",type:"tile",color:l.color,destX:l.destX,destY:l.destY,destWidth:l.destWidth,destHeight:l.destHeight,x:l.x,y:l.y,width:l.width,height:l.height,paddingTop:l.paddingTop,paddingRight:l.paddingRight,paddingBottom:l.paddingBottom,paddingLeft:l.paddingLeft,rowIndex:p,colIndex:S}),l.isDrawn=!0)}return f&&e.push({name:"foregroundImage",type:"image",imageSrc:f,mappingName:"foregroundImageSrc",x:b,y:L,width:a,height:h,padding:n,backgroundColor:m,borderRadius:y,shadowOffsetX:T,shadowOffsetY:B,shadowBlur:E,shadowColor:w}),e},D.prototype.isBlack=function(e,r){var t=this.moduleCount;return!(0>e||0>r||e>=t||r>=t)&&this.modules[e][r].isBlack},D.prototype.drawCanvas=function(){let{isMaked:e,canvasContext:r,useDynamicSize:t,dynamicSize:o,foregroundColor:i,foregroundPadding:s,backgroundColor:c,backgroundPadding:g,drawReserve:k,margin:v}=this;if(!e)return console.error("[uQRCode]: please execute the make method first!"),Promise.reject(new D.Error("please execute the make method first!"));let d=this.getDrawModules(),C=async(f,b)=>{try{r.clearRect(0,0,o,o),r.draw(!1);for(var L=0;L<d.length;L++){var a=d[L];switch(r.save(),a.type){case"area":r.setFillStyle(a.color),r.fillRect(a.x,a.y,a.width,a.height);break;case"tile":var h=a.x,n=a.y,m=a.width,y=a.height;r.setFillStyle(a.color),r.fillRect(h,n,m,y);break;case"image":if(a.name==="backgroundImage"){h=Math.round(a.x),n=Math.round(a.y),m=Math.round(a.width),y=Math.round(a.height),m<2*(B=Math.round(a.borderRadius))&&(B=m/2),y<2*B&&(B=y/2),r.setGlobalAlpha(a.alpha),B>0&&(r.beginPath(),r.moveTo(h+B,n),r.arcTo(h+m,n,h+m,n+y,B),r.arcTo(h+m,n+y,h,n+y,B),r.arcTo(h,n+y,h,n,B),r.arcTo(h,n,h+m,n,B),r.closePath(),r.setStrokeStyle("rgba(0,0,0,0)"),r.stroke(),r.clip());try{var T=await this.loadImage(a.imageSrc);r.drawImage(T,h,n,m,y)}catch{throw console.error(`[uQRCode]: ${a.mappingName} invalid!`),new D.Error(`${a.mappingName} invalid!`)}}else if(a.name==="foregroundImage"){h=Math.round(a.x),n=Math.round(a.y),m=Math.round(a.width),y=Math.round(a.height);var B,E=Math.round(a.padding);m<2*(B=Math.round(a.borderRadius))&&(B=m/2),y<2*B&&(B=y/2);var w=h-E,p=n-E,S=m+2*E,l=y+2*E,I=Math.round(S/m*B);S<2*I&&(I=S/2),l<2*I&&(I=l/2),r.save(),r.setShadow(a.shadowOffsetX,a.shadowOffsetY,a.shadowBlur,a.shadowColor),I>0?(r.beginPath(),r.moveTo(w+I,p),r.arcTo(w+S,p,w+S,p+l,I),r.arcTo(w+S,p+l,w,p+l,I),r.arcTo(w,p+l,w,p,I),r.arcTo(w,p,w+S,p,I),r.closePath(),r.setFillStyle(a.backgroundColor),r.fill()):(r.setFillStyle(a.backgroundColor),r.fillRect(w,p,S,l)),r.restore(),r.save(),I>0?(r.beginPath(),r.moveTo(w+I,p),r.arcTo(w+S,p,w+S,p+l,I),r.arcTo(w+S,p+l,w,p+l,I),r.arcTo(w,p+l,w,p,I),r.arcTo(w,p,w+S,p,I),r.closePath(),r.setFillStyle(E>0?a.backgroundColor:"rgba(0,0,0,0)"),r.fill()):(r.setFillStyle(E>0?a.backgroundColor:"rgba(0,0,0,0)"),r.fillRect(w,p,S,l)),r.restore(),B>0&&(r.beginPath(),r.moveTo(h+B,n),r.arcTo(h+m,n,h+m,n+y,B),r.arcTo(h+m,n+y,h,n+y,B),r.arcTo(h,n+y,h,n,B),r.arcTo(h,n,h+m,n,B),r.closePath(),r.setStrokeStyle("rgba(0,0,0,0)"),r.stroke(),r.clip());try{T=await this.loadImage(a.imageSrc),r.drawImage(T,h,n,m,y)}catch{throw console.error(`[uQRCode]: ${a.mappingName} invalid!`),new D.Error(`${a.mappingName} invalid!`)}}}k&&r.draw(!0),r.restore()}r.draw(!0),setTimeout(f,150)}catch(P){if(!(P instanceof D.Error))throw P;b(P)}};return new Promise((f,b)=>{C(f,b)})},D.prototype.draw=function(){return this.drawCanvas()},D.prototype.register=function(e){e&&e(D,this,!0)},D})})(ke);var Me=ke.exports;const Re=Ne(Me);export{Re as U};