@tplc/wot 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/components/wd-qr-code/common/types/queue.d.ts +3 -3
- package/components/wd-qr-code/js_sdk/uqrcode/uqrcode.js +1959 -13
- package/components/wd-qr-code/types.ts +6 -5
- package/components/wd-qr-code/wd-qr-code.vue +766 -866
- package/global.d.ts +1 -0
- package/package.json +1 -1
- package/types/components/wd-qr-code/types.d.ts +83 -0
- package/types/components/wd-qr-code/wd-qr-code.vue.d.ts +146 -274
- package/types/components/wd-text/wd-text.vue.d.ts +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
// ---------------------------------------------------------------------
|
|
2
2
|
// uQRCode二维码生成插件 v4.0.6
|
|
3
|
-
//
|
|
3
|
+
//
|
|
4
4
|
// uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。
|
|
5
|
-
//
|
|
5
|
+
//
|
|
6
6
|
// Copyright (c) Sansnn uQRCode All rights reserved.
|
|
7
|
-
//
|
|
7
|
+
//
|
|
8
8
|
// Licensed under the Apache License, Version 2.0.
|
|
9
9
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
//
|
|
10
|
+
//
|
|
11
11
|
// github地址:
|
|
12
12
|
// https://github.com/Sansnn/uQRCode
|
|
13
|
-
//
|
|
13
|
+
//
|
|
14
14
|
// npm地址:
|
|
15
15
|
// https://www.npmjs.com/package/uqrcodejs
|
|
16
|
-
//
|
|
16
|
+
//
|
|
17
17
|
// uni-app插件市场地址:
|
|
18
18
|
// https://ext.dcloud.net.cn/plugin?id=1287
|
|
19
|
-
//
|
|
19
|
+
//
|
|
20
20
|
// 复制使用请保留本段注释,感谢支持开源!
|
|
21
|
-
//
|
|
22
|
-
|
|
21
|
+
//
|
|
22
|
+
// ---------------------------------------------------------------------
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// ---------------------------------------------------------------------
|
|
25
25
|
// 当前文件格式为 es,将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
|
|
26
26
|
// 如需在其他环境使用,请获取环境对应的格式文件
|
|
27
27
|
// 格式说明:
|
|
@@ -29,6 +29,1952 @@
|
|
|
29
29
|
// cjs - CommonJS,适用于 Node 环境和其他打包工具(别名:commonjs)
|
|
30
30
|
// es - 将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
|
|
31
31
|
// umd - 通用模块定义,生成的包同时支持 amd、cjs 和 iife 三种格式
|
|
32
|
-
|
|
32
|
+
// ---------------------------------------------------------------------
|
|
33
33
|
|
|
34
|
-
function o(o){this.mode=r.MODE_8BIT_BYTE,this.data=o;}function e(o,e){this.typeNumber=o,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array;}o.prototype={getLength:function(o){return this.data.length},write:function(o){for(var e=0;e<this.data.length;e++)o.put(this.data.charCodeAt(e),8);}},e.prototype={addData:function(e){var r=new o(e);this.dataList.push(r),this.dataCache=null;},isDark:function(o,e){if(o<0||this.moduleCount<=o||e<0||this.moduleCount<=e)throw new Error(o+","+e);return this.modules[o][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var o=1;for(o=1;o<40;o++){for(var e=v.getRSBlocks(o,this.errorCorrectLevel),r=new p,t=0,i=0;i<e.length;i++)t+=e[i].dataCount;for(i=0;i<this.dataList.length;i++){var n=this.dataList[i];r.put(n.mode,4),r.put(n.getLength(),h.getLengthInBits(n.mode,o)),n.write(r);}if(r.getLengthInBits()<=8*t)break}this.typeNumber=o;}this.makeImpl(!1,this.getBestMaskPattern());},makeImpl:function(o,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 i=0;i<this.moduleCount;i++)this.modules[t][i]=null;}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(o,r),this.typeNumber>=7&&this.setupTypeNumber(o),null==this.dataCache&&(this.dataCache=e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,r);},setupPositionProbePattern:function(o,e){for(var r=-1;r<=7;r++)if(!(o+r<=-1||this.moduleCount<=o+r))for(var t=-1;t<=7;t++)e+t<=-1||this.moduleCount<=e+t||(this.modules[o+r][e+t]=0<=r&&r<=6&&(0==t||6==t)||0<=t&&t<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=t&&t<=4);},getBestMaskPattern:function(){for(var o=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var t=h.getLostPoint(this);(0==r||o>t)&&(o=t,e=r);}return e},createMovieClip:function(o,e,r){var t=o.createEmptyMovieClip(e,r);this.make();for(var i=0;i<this.modules.length;i++)for(var n=1*i,a=0;a<this.modules[i].length;a++){var d=1*a;this.modules[i][a]&&(t.beginFill(0,100),t.moveTo(d,n),t.lineTo(d+1,n),t.lineTo(d+1,n+1),t.lineTo(d,n+1),t.endFill());}return t},setupTimingPattern:function(){for(var o=8;o<this.moduleCount-8;o++)null==this.modules[o][6]&&(this.modules[o][6]=o%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0);},setupPositionAdjustPattern:function(){for(var o=h.getPatternPosition(this.typeNumber),e=0;e<o.length;e++)for(var r=0;r<o.length;r++){var t=o[e],i=o[r];if(null==this.modules[t][i])for(var n=-2;n<=2;n++)for(var a=-2;a<=2;a++)this.modules[t+n][i+a]=-2==n||2==n||-2==a||2==a||0==n&&0==a;}},setupTypeNumber:function(o){for(var e=h.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var t=!o&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=t;}for(r=0;r<18;r++){t=!o&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=t;}},setupTypeInfo:function(o,e){for(var r=this.errorCorrectLevel<<3|e,t=h.getBCHTypeInfo(r),i=0;i<15;i++){var n=!o&&1==(t>>i&1);i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;}for(i=0;i<15;i++){n=!o&&1==(t>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=n:i<9?this.modules[8][15-i-1+1]=n:this.modules[8][15-i-1]=n;}this.modules[this.moduleCount-8][8]=!o;},mapData:function(o,e){for(var r=-1,t=this.moduleCount-1,i=7,n=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var d=0;d<2;d++)if(null==this.modules[t][a-d]){var u=!1;n<o.length&&(u=1==(o[n]>>>i&1)),h.getMask(e,t,a-d)&&(u=!u),this.modules[t][a-d]=u,-1==--i&&(n++,i=7);}if((t+=r)<0||this.moduleCount<=t){t-=r,r=-r;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(o,r,t){for(var i=v.getRSBlocks(o,r),n=new p,a=0;a<t.length;a++){var d=t[a];n.put(d.mode,4),n.put(d.getLength(),h.getLengthInBits(d.mode,o)),d.write(n);}var u=0;for(a=0;a<i.length;a++)u+=i[a].dataCount;if(n.getLengthInBits()>8*u)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*u+")");for(n.getLengthInBits()+4<=8*u&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*u||(n.put(e.PAD0,8),n.getLengthInBits()>=8*u));)n.put(e.PAD1,8);return e.createBytes(n,i)},e.createBytes=function(o,e){for(var r=0,t=0,i=0,n=new Array(e.length),a=new Array(e.length),d=0;d<e.length;d++){var u=e[d].dataCount,s=e[d].totalCount-u;t=Math.max(t,u),i=Math.max(i,s),n[d]=new Array(u);for(var g=0;g<n[d].length;g++)n[d][g]=255&o.buffer[g+r];r+=u;var l=h.getErrorCorrectPolynomial(s),c=new f(n[d],l.getLength()-1).mod(l);a[d]=new Array(l.getLength()-1);for(g=0;g<a[d].length;g++){var m=g+c.getLength()-a[d].length;a[d][g]=m>=0?c.get(m):0;}}var v=0;for(g=0;g<e.length;g++)v+=e[g].totalCount;var p=new Array(v),C=0;for(g=0;g<t;g++)for(d=0;d<e.length;d++)g<n[d].length&&(p[C++]=n[d][g]);for(g=0;g<i;g++)for(d=0;d<e.length;d++)g<a[d].length&&(p[C++]=a[d][g]);return p};for(var r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},t={L:1,M:0,Q:3,H:2},i=0,n=1,a=2,d=3,u=4,s=5,g=6,l=7,h={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(o){for(var e=o<<10;h.getBCHDigit(e)-h.getBCHDigit(h.G15)>=0;)e^=h.G15<<h.getBCHDigit(e)-h.getBCHDigit(h.G15);return (o<<10|e)^h.G15_MASK},getBCHTypeNumber:function(o){for(var e=o<<12;h.getBCHDigit(e)-h.getBCHDigit(h.G18)>=0;)e^=h.G18<<h.getBCHDigit(e)-h.getBCHDigit(h.G18);return o<<12|e},getBCHDigit:function(o){for(var e=0;0!=o;)e++,o>>>=1;return e},getPatternPosition:function(o){return h.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,e,r){switch(o){case i:return (e+r)%2==0;case n:return e%2==0;case a:return r%3==0;case d:return (e+r)%3==0;case u:return (Math.floor(e/2)+Math.floor(r/3))%2==0;case s:return e*r%2+e*r%3==0;case g:return (e*r%2+e*r%3)%2==0;case l:return (e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var e=new f([1],0),r=0;r<o;r++)e=e.multiply(new f([1,c.gexp(r)],0));return e},getLengthInBits:function(o,e){if(1<=e&&e<10)switch(o){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:"+o)}else if(e<27)switch(o){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:"+o)}else {if(!(e<41))throw new Error("type:"+e);switch(o){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:"+o)}}},getLostPoint:function(o){for(var e=o.getModuleCount(),r=0,t=0;t<e;t++)for(var i=0;i<e;i++){for(var n=0,a=o.isDark(t,i),d=-1;d<=1;d++)if(!(t+d<0||e<=t+d))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||0==d&&0==u||a==o.isDark(t+d,i+u)&&n++;n>5&&(r+=3+n-5);}for(t=0;t<e-1;t++)for(i=0;i<e-1;i++){var s=0;o.isDark(t,i)&&s++,o.isDark(t+1,i)&&s++,o.isDark(t,i+1)&&s++,o.isDark(t+1,i+1)&&s++,0!=s&&4!=s||(r+=3);}for(t=0;t<e;t++)for(i=0;i<e-6;i++)o.isDark(t,i)&&!o.isDark(t,i+1)&&o.isDark(t,i+2)&&o.isDark(t,i+3)&&o.isDark(t,i+4)&&!o.isDark(t,i+5)&&o.isDark(t,i+6)&&(r+=40);for(i=0;i<e;i++)for(t=0;t<e-6;t++)o.isDark(t,i)&&!o.isDark(t+1,i)&&o.isDark(t+2,i)&&o.isDark(t+3,i)&&o.isDark(t+4,i)&&!o.isDark(t+5,i)&&o.isDark(t+6,i)&&(r+=40);var g=0;for(i=0;i<e;i++)for(t=0;t<e;t++)o.isDark(t,i)&&g++;return r+=10*(Math.abs(100*g/e/e-50)/5)}},c={glog:function(o){if(o<1)throw new Error("glog("+o+")");return c.LOG_TABLE[o]},gexp:function(o){for(;o<0;)o+=255;for(;o>=256;)o-=255;return c.EXP_TABLE[o]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},m=0;m<8;m++)c.EXP_TABLE[m]=1<<m;for(m=8;m<256;m++)c.EXP_TABLE[m]=c.EXP_TABLE[m-4]^c.EXP_TABLE[m-5]^c.EXP_TABLE[m-6]^c.EXP_TABLE[m-8];for(m=0;m<255;m++)c.LOG_TABLE[c.EXP_TABLE[m]]=m;function f(o,e){if(null==o.length)throw new Error(o.length+"/"+e);for(var r=0;r<o.length&&0==o[r];)r++;this.num=new Array(o.length-r+e);for(var t=0;t<o.length-r;t++)this.num[t]=o[t+r];}function v(o,e){this.totalCount=o,this.dataCount=e;}function p(){this.buffer=new Array,this.length=0;}function C(o){return o.setFillStyle=o.setFillStyle||function(e){o.fillStyle=e;},o.setFontSize=o.setFontSize||function(e){o.font=`${e}px`;},o.setTextAlign=o.setTextAlign||function(e){o.textAlign=e;},o.setTextBaseline=o.setTextBaseline||function(e){o.textBaseline=e;},o.setGlobalAlpha=o.setGlobalAlpha||function(e){o.globalAlpha=e;},o.setStrokeStyle=o.setStrokeStyle||function(e){o.strokeStyle=e;},o.setShadow=o.setShadow||function(e,r,t,i){o.shadowOffsetX=e,o.shadowOffsetY=r,o.shadowBlur=t,o.shadowColor=i;},o.draw=o.draw||function(o,e){e&&e();},o.clearRect=o.clearRect||function(e,r,t,i){o.draw(!1);},o}function b(o,e){var r=this.data="",t=this.size=200;this.useDynamicSize=!1,this.dynamicSize=t;var i=this.typeNumber=-1;this.errorCorrectLevel=b.errorCorrectLevel.H;var n=this.margin=0;this.areaColor="#FFFFFF",this.backgroundColor="rgba(255,255,255,0)",this.backgroundImageSrc=void 0;var a=this.backgroundImageWidth=void 0,d=this.backgroundImageHeight=void 0,u=this.backgroundImageX=void 0,s=this.backgroundImageY=void 0;this.backgroundImageAlpha=1,this.backgroundImageBorderRadius=0;var g=this.backgroundPadding=0;this.foregroundColor="#000000",this.foregroundImageSrc=void 0;var l=this.foregroundImageWidth=void 0,h=this.foregroundImageHeight=void 0,c=this.foregroundImageX=void 0,m=this.foregroundImageY=void 0,f=this.foregroundImagePadding=0;this.foregroundImageBackgroundColor="#FFFFFF";var v=this.foregroundImageBorderRadius=0,p=this.foregroundImageShadowOffsetX=0,k=this.foregroundImageShadowOffsetY=0,y=this.foregroundImageShadowBlur=0;this.foregroundImageShadowColor="#808080";var w=this.foregroundPadding=0,I=this.positionProbeBackgroundColor=void 0,B=this.positionProbeForegroundColor=void 0,S=this.separatorColor=void 0,P=this.positionAdjustBackgroundColor=void 0,L=this.positionAdjustForegroundColor=void 0,D=this.timingBackgroundColor=void 0,A=this.timingForegroundColor=void 0,E=this.typeNumberBackgroundColor=void 0,T=this.typeNumberForegroundColor=void 0,N=this.darkBlockColor=void 0;this.base=void 0,this.modules=[],this.moduleCount=0,this.drawModules=[];var M=this.canvasContext=void 0;this.loadImage,this.drawReserve=!1,this.isMaked=!1,Object.defineProperties(this,{data:{get(){if(""===r||void 0===r)throw console.error("[uQRCode]: data must be set!"),new b.Error("data must be set!");return r},set(o){r=String(o);}},size:{get:()=>t,set(o){t=Number(o);}},typeNumber:{get:()=>i,set(o){i=Number(o);}},margin:{get:()=>n,set(o){n=Number(o);}},backgroundImageWidth:{get(){return void 0===a?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*a:a},set(o){a=Number(o);}},backgroundImageHeight:{get(){return void 0===d?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*d:d},set(o){d=Number(o);}},backgroundImageX:{get(){return void 0===u?0:this.useDynamicSize?this.dynamicSize/this.size*u:u},set(o){u=Number(o);}},backgroundImageY:{get(){return void 0===s?0:this.useDynamicSize?this.dynamicSize/this.size*s:s},set(o){s=Number(o);}},backgroundPadding:{get:()=>g,set(o){g=o>1?1:o<0?0:o;}},foregroundImageWidth:{get(){return void 0===l?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*l:l},set(o){l=Number(o);}},foregroundImageHeight:{get(){return void 0===h?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*h:h},set(o){h=Number(o);}},foregroundImageX:{get(){return void 0===c?this.dynamicSize/2-this.foregroundImageWidth/2:this.useDynamicSize?this.dynamicSize/this.size*c:c},set(o){c=Number(o);}},foregroundImageY:{get(){return void 0===m?this.dynamicSize/2-this.foregroundImageHeight/2:this.useDynamicSize?this.dynamicSize/this.size*m:m},set(o){m=Number(o);}},foregroundImagePadding:{get(){return this.useDynamicSize?this.dynamicSize/this.size*f:f},set(o){f=Number(o);}},foregroundImageBorderRadius:{get(){return this.useDynamicSize?this.dynamicSize/this.size*v:v},set(o){v=Number(o);}},foregroundImageShadowOffsetX:{get(){return this.useDynamicSize?this.dynamicSize/this.size*p:p},set(o){p=Number(o);}},foregroundImageShadowOffsetY:{get(){return this.useDynamicSize?this.dynamicSize/this.size*k:k},set(o){k=Number(o);}},foregroundImageShadowBlur:{get(){return this.useDynamicSize?this.dynamicSize/this.size*y:y},set(o){y=Number(o);}},foregroundPadding:{get:()=>w,set(o){w=o>1?1:o<0?0:o;}},positionProbeBackgroundColor:{get(){return I||this.backgroundColor},set(o){I=o;}},positionProbeForegroundColor:{get(){return B||this.foregroundColor},set(o){B=o;}},separatorColor:{get(){return S||this.backgroundColor},set(o){S=o;}},positionAdjustBackgroundColor:{get(){return P||this.backgroundColor},set(o){P=o;}},positionAdjustForegroundColor:{get(){return L||this.foregroundColor},set(o){L=o;}},timingBackgroundColor:{get(){return D||this.backgroundColor},set(o){D=o;}},timingForegroundColor:{get(){return A||this.foregroundColor},set(o){A=o;}},typeNumberBackgroundColor:{get(){return E||this.backgroundColor},set(o){E=o;}},typeNumberForegroundColor:{get(){return T||this.foregroundColor},set(o){T=o;}},darkBlockColor:{get(){return N||this.foregroundColor},set(o){N=o;}},canvasContext:{get(){if(void 0===M)throw console.error("[uQRCode]: use drawCanvas, you need to set the canvasContext!"),new b.Error("use drawCanvas, you need to set the canvasContext!");return M},set(o){M=C(o);}}}),b.plugins.forEach((o=>o(b,this,!1))),o&&this.setOptions(o),e&&(this.canvasContext=C(e));}f.prototype={get:function(o){return this.num[o]},getLength:function(){return this.num.length},multiply:function(o){for(var e=new Array(this.getLength()+o.getLength()-1),r=0;r<this.getLength();r++)for(var t=0;t<o.getLength();t++)e[r+t]^=c.gexp(c.glog(this.get(r))+c.glog(o.get(t)));return new f(e,0)},mod:function(o){if(this.getLength()-o.getLength()<0)return this;for(var e=c.glog(this.get(0))-c.glog(o.get(0)),r=new Array(this.getLength()),t=0;t<this.getLength();t++)r[t]=this.get(t);for(t=0;t<o.getLength();t++)r[t]^=c.gexp(c.glog(o.get(t))+e);return new f(r,0).mod(o)}},v.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]],v.getRSBlocks=function(o,e){var r=v.getRsBlockTable(o,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+o+"/errorCorrectLevel:"+e);for(var t=r.length/3,i=new Array,n=0;n<t;n++)for(var a=r[3*n+0],d=r[3*n+1],u=r[3*n+2],s=0;s<a;s++)i.push(new v(d,u));return i},v.getRsBlockTable=function(o,e){switch(e){case t.L:return v.RS_BLOCK_TABLE[4*(o-1)+0];case t.M:return v.RS_BLOCK_TABLE[4*(o-1)+1];case t.Q:return v.RS_BLOCK_TABLE[4*(o-1)+2];case t.H:return v.RS_BLOCK_TABLE[4*(o-1)+3];default:return}},p.prototype={get:function(o){var e=Math.floor(o/8);return 1==(this.buffer[e]>>>7-o%8&1)},put:function(o,e){for(var r=0;r<e;r++)this.putBit(1==(o>>>e-r-1&1));},getLengthInBits:function(){return this.length},putBit:function(o){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),o&&(this.buffer[e]|=128>>>this.length%8),this.length++;}},e.errorCorrectLevel=t,b.errorCorrectLevel=e.errorCorrectLevel,b.Error=function(o){this.errMsg="[uQRCode]: "+o;},b.plugins=[],b.use=function(o){"function"==typeof o&&b.plugins.push(o);},b.prototype.loadImage=function(o){return Promise.resolve(o)},b.prototype.setOptions=function(o){var e,r,t,i,n,a,d,u,s,g,l,h,c,m,f,v,p,C,b,k,y,w,I,B,S,P,L,D,A,E,T,N,M,z,R,_,O,F,x,H,X,Y,j,W,G,K,Q,U,$,J,q,V,Z,oo,eo,ro;o&&(Object.keys(o).forEach((e=>{this[e]=o[e];})),function(o={},e={},r=!1){let t;t=r?o:{...o};for(let o in e){var i=e[o];null!=i&&(i.constructor==Object?t[o]=this.deepReplace(t[o],i):i.constructor!=String||i?t[o]=i:t[o]=t[o]);}}(this,{data:o.data||o.text,size:o.size,useDynamicSize:o.useDynamicSize,typeNumber:o.typeNumber,errorCorrectLevel:o.errorCorrectLevel,margin:o.margin,areaColor:o.areaColor,backgroundColor:o.backgroundColor||(null===(e=o.background)||void 0===e?void 0:e.color),backgroundImageSrc:o.backgroundImageSrc||(null===(r=o.background)||void 0===r||null===(t=r.image)||void 0===t?void 0:t.src),backgroundImageWidth:o.backgroundImageWidth||(null===(i=o.background)||void 0===i||null===(n=i.image)||void 0===n?void 0:n.width),backgroundImageHeight:o.backgroundImageHeight||(null===(a=o.background)||void 0===a||null===(d=a.image)||void 0===d?void 0:d.height),backgroundImageX:o.backgroundImageX||(null===(u=o.background)||void 0===u||null===(s=u.image)||void 0===s?void 0:s.x),backgroundImageY:o.backgroundImageY||(null===(g=o.background)||void 0===g||null===(l=g.image)||void 0===l?void 0:l.y),backgroundImageAlpha:o.backgroundImageAlpha||(null===(h=o.background)||void 0===h||null===(c=h.image)||void 0===c?void 0:c.alpha),backgroundImageBorderRadius:o.backgroundImageBorderRadius||(null===(m=o.background)||void 0===m||null===(f=m.image)||void 0===f?void 0:f.borderRadius),backgroundPadding:o.backgroundPadding,foregroundColor:o.foregroundColor||(null===(v=o.foreground)||void 0===v?void 0:v.color),foregroundImageSrc:o.foregroundImageSrc||(null===(p=o.foreground)||void 0===p||null===(C=p.image)||void 0===C?void 0:C.src),foregroundImageWidth:o.foregroundImageWidth||(null===(b=o.foreground)||void 0===b||null===(k=b.image)||void 0===k?void 0:k.width),foregroundImageHeight:o.foregroundImageHeight||(null===(y=o.foreground)||void 0===y||null===(w=y.image)||void 0===w?void 0:w.height),foregroundImageX:o.foregroundImageX||(null===(I=o.foreground)||void 0===I||null===(B=I.image)||void 0===B?void 0:B.x),foregroundImageY:o.foregroundImageY||(null===(S=o.foreground)||void 0===S||null===(P=S.image)||void 0===P?void 0:P.y),foregroundImagePadding:o.foregroundImagePadding||(null===(L=o.foreground)||void 0===L||null===(D=L.image)||void 0===D?void 0:D.padding),foregroundImageBackgroundColor:o.foregroundImageBackgroundColor||(null===(A=o.foreground)||void 0===A||null===(E=A.image)||void 0===E?void 0:E.backgroundColor),foregroundImageBorderRadius:o.foregroundImageBorderRadius||(null===(T=o.foreground)||void 0===T||null===(N=T.image)||void 0===N?void 0:N.borderRadius),foregroundImageShadowOffsetX:o.foregroundImageShadowOffsetX||(null===(M=o.foreground)||void 0===M||null===(z=M.image)||void 0===z?void 0:z.shadowOffsetX),foregroundImageShadowOffsetY:o.foregroundImageShadowOffsetY||(null===(R=o.foreground)||void 0===R||null===(_=R.image)||void 0===_?void 0:_.shadowOffsetY),foregroundImageShadowBlur:o.foregroundImageShadowBlur||(null===(O=o.foreground)||void 0===O||null===(F=O.image)||void 0===F?void 0:F.shadowBlur),foregroundImageShadowColor:o.foregroundImageShadowColor||(null===(x=o.foreground)||void 0===x||null===(H=x.image)||void 0===H?void 0:H.shadowColor),foregroundPadding:o.foregroundPadding,positionProbeBackgroundColor:o.positionProbeBackgroundColor||(null===(X=o.positionProbe)||void 0===X?void 0:X.backgroundColor)||(null===(Y=o.positionDetection)||void 0===Y?void 0:Y.backgroundColor),positionProbeForegroundColor:o.positionProbeForegroundColor||(null===(j=o.positionProbe)||void 0===j?void 0:j.foregroundColor)||(null===(W=o.positionDetection)||void 0===W?void 0:W.foregroundColor),separatorColor:o.separatorColor||(null===(G=o.separator)||void 0===G?void 0:G.color),positionAdjustBackgroundColor:o.positionAdjustBackgroundColor||(null===(K=o.positionAdjust)||void 0===K?void 0:K.backgroundColor)||(null===(Q=o.alignment)||void 0===Q?void 0:Q.backgroundColor),positionAdjustForegroundColor:o.positionAdjustForegroundColor||(null===(U=o.positionAdjust)||void 0===U?void 0:U.foregroundColor)||(null===($=o.alignment)||void 0===$?void 0:$.foregroundColor),timingBackgroundColor:o.timingBackgroundColor||(null===(J=o.timing)||void 0===J?void 0:J.backgroundColor),timingForegroundColor:o.timingForegroundColor||(null===(q=o.timing)||void 0===q?void 0:q.foregroundColor),typeNumberBackgroundColor:o.typeNumberBackgroundColor||(null===(V=o.typeNumber)||void 0===V?void 0:V.backgroundColor)||(null===(Z=o.versionInformation)||void 0===Z?void 0:Z.backgroundColor),typeNumberForegroundColor:o.typeNumberForegroundColor||(null===(oo=o.typeNumber)||void 0===oo?void 0:oo.foregroundColor)||(null===(eo=o.versionInformation)||void 0===eo?void 0:eo.foregroundColor),darkBlockColor:o.darkBlockColor||(null===(ro=o.darkBlock)||void 0===ro?void 0:ro.color)},!0));},b.prototype.make=function(){let{foregroundColor:o,backgroundColor:r,typeNumber:t,errorCorrectLevel:i,data:n,size:a,margin:d,useDynamicSize:u}=this;if(o===r)throw console.error("[uQRCode]: foregroundColor and backgroundColor cannot be the same!"),new b.Error("foregroundColor and backgroundColor cannot be the same!");var s=new e(t,i);s.addData(function(o){o=o.toString();for(var e,r="",t=0;t<o.length;t++)(e=o.charCodeAt(t))>=1&&e<=127?r+=o.charAt(t):e>2047?(r+=String.fromCharCode(224|e>>12&15),r+=String.fromCharCode(128|e>>6&63),r+=String.fromCharCode(128|e>>0&63)):(r+=String.fromCharCode(192|e>>6&31),r+=String.fromCharCode(128|e>>0&63));return r}(n)),s.make(),this.base=s,this.typeNumber=s.typeNumber,this.modules=s.modules,this.moduleCount=s.moduleCount,this.dynamicSize=u?Math.ceil((a-2*d)/s.moduleCount)*s.moduleCount+2*d:a,function(o){let{dynamicSize:e,margin:r,backgroundColor:t,backgroundPadding:i,foregroundColor:n,foregroundPadding:a,modules:d,moduleCount:u}=o,s=(e-2*r)/u,g=s,l=0;i>0&&(l=g*i/2,g-=2*l);let h=s,c=0;a>0&&(c=h*a/2,h-=2*c);for(var m=0;m<u;m++)for(var f=0;f<u;f++){var v=f*s+r,p=m*s+r;if(d[m][f]){var C=c,b=v+c,k=p+c,y=h,w=h;d[m][f]={type:["foreground"],color:n,isBlack:!0,isDrawn:!1,destX:v,destY:p,destWidth:s,destHeight:s,x:b,y:k,width:y,height:w,paddingTop:C,paddingRight:C,paddingBottom:C,paddingLeft:C};}else C=l,b=v+l,k=p+l,y=g,w=g,d[m][f]={type:["background"],color:t,isBlack:!1,isDrawn:!1,destX:v,destY:p,destWidth:s,destHeight:s,x:b,y:k,width:y,height:w,paddingTop:C,paddingRight:C,paddingBottom:C,paddingLeft:C};}}(this),function(o){let{modules:e,moduleCount:r,positionProbeBackgroundColor:t,positionProbeForegroundColor:i}=o,n=r-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((o=>{var r=e[o[0]][o[1]],a=e[o[0]+n][o[1]],d=e[o[0]][o[1]+n];d.type.push("positionProbe"),a.type.push("positionProbe"),r.type.push("positionProbe"),r.color=1==o[2]?i:t,a.color=1==o[2]?i:t,d.color=1==o[2]?i:t;}));}(this),function(o){let{modules:e,moduleCount:r,separatorColor:t}=o;[[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((o=>{var i=e[o[0]][o[1]],n=e[r-o[0]-1][o[1]],a=e[o[0]][r-o[1]-1];a.type.push("separator"),n.type.push("separator"),i.type.push("separator"),i.color=t,n.color=t,a.color=t;}));}(this),function(o){let{typeNumber:e,modules:r,moduleCount:t,foregroundColor:i,backgroundColor:n,positionAdjustForegroundColor:a,positionAdjustBackgroundColor:d,timingForegroundColor:u,timingBackgroundColor:s}=o;const g=[[],[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]][e-1];if(g){const o=[[-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]],e=g.length;for(let l=0;l<e;l++)for(let h=0;h<e;h++){let{x:e,y:c}={x:g[l],y:g[h]};e<9&&c<9||e>t-9-1&&c<9||c>t-9-1&&e<9||o.forEach((o=>{var t=r[e+o[0]][c+o[1]];t.type.push("positionAdjust"),t.type.includes("timing")?1==o[2]?t.color=a==i?u:a:t.color=a==i&&d==n?s:d:t.color=1==o[2]?a:d;}));}}}(this),function(o){let{modules:e,moduleCount:r,timingForegroundColor:t,timingBackgroundColor:i}=o,n=r-16;for(let o=0;o<n;o++){var a=e[6][8+o],d=e[8+o][6];a.type.push("timing"),d.type.push("timing"),a.color=1&o^1?t:i,d.color=1&o^1?t:i;}}(this),function(o){let{modules:e,moduleCount:r,darkBlockColor:t}=o;var i=e[r-7-1][8];i.type.push("darkBlock"),i.color=t;}(this),function(o){let{typeNumber:e,modules:r,moduleCount:t,typeNumberBackgroundColor:i,typeNumberForegroundColor:n}=o;if(e<7)return r;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 d=a[e]+a[e],u=[t-11,t-10,t-9];[[5,u[2]],[5,u[1]],[5,u[0]],[4,u[2]],[4,u[1]],[4,u[0]],[3,u[2]],[3,u[1]],[3,u[0]],[2,u[2]],[2,u[1]],[2,u[0]],[1,u[2]],[1,u[1]],[1,u[0]],[0,u[2]],[0,u[1]],[0,u[0]],[u[2],5],[u[1],5],[u[0],5],[u[2],4],[u[1],4],[u[0],4],[u[2],3],[u[1],3],[u[0],3],[u[2],2],[u[1],2],[u[0],2],[u[2],1],[u[1],1],[u[0],1],[u[2],0],[u[1],0],[u[0],0]].forEach(((o,e)=>{var t=r[o[0]][o[1]];t.type.push("typeNumber"),t.color="1"==d[e]?n:i;}));}(this),this.isMaked=!0,this.drawModules=[];},b.prototype.getDrawModules=function(){if(this.drawModules&&this.drawModules.length>0)return this.drawModules;let o=this.drawModules=[],{modules:e,moduleCount:r,dynamicSize:t,areaColor:i,backgroundImageSrc:n,backgroundImageX:a,backgroundImageY:d,backgroundImageWidth:u,backgroundImageHeight:s,backgroundImageAlpha:g,backgroundImageBorderRadius:l,foregroundImageSrc:h,foregroundImageX:c,foregroundImageY:m,foregroundImageWidth:f,foregroundImageHeight:v,foregroundImagePadding:p,foregroundImageBackgroundColor:C,foregroundImageBorderRadius:b,foregroundImageShadowOffsetX:k,foregroundImageShadowOffsetY:y,foregroundImageShadowBlur:w,foregroundImageShadowColor:I}=this;i&&o.push({name:"area",type:"area",color:i,x:0,y:0,width:t,height:t}),n&&o.push({name:"backgroundImage",type:"image",imageSrc:n,mappingName:"backgroundImageSrc",x:a,y:d,width:u,height:s,alpha:g,borderRadius:l});for(var B=0;B<r;B++)for(var S=0;S<r;S++){var P=e[B][S];P.isDrawn||(P.type.includes("foreground")?o.push({name:"foreground",type:"tile",color:P.color,destX:P.destX,destY:P.destY,destWidth:P.destWidth,destHeight:P.destHeight,x:P.x,y:P.y,width:P.width,height:P.height,paddingTop:P.paddingTop,paddingRight:P.paddingRight,paddingBottom:P.paddingBottom,paddingLeft:P.paddingLeft,rowIndex:B,colIndex:S}):o.push({name:"background",type:"tile",color:P.color,destX:P.destX,destY:P.destY,destWidth:P.destWidth,destHeight:P.destHeight,x:P.x,y:P.y,width:P.width,height:P.height,paddingTop:P.paddingTop,paddingRight:P.paddingRight,paddingBottom:P.paddingBottom,paddingLeft:P.paddingLeft,rowIndex:B,colIndex:S}),P.isDrawn=!0);}return h&&o.push({name:"foregroundImage",type:"image",imageSrc:h,mappingName:"foregroundImageSrc",x:c,y:m,width:f,height:v,padding:p,backgroundColor:C,borderRadius:b,shadowOffsetX:k,shadowOffsetY:y,shadowBlur:w,shadowColor:I}),o},b.prototype.isBlack=function(o,e){var r=this.moduleCount;return !(0>o||0>e||o>=r||e>=r)&&this.modules[o][e].isBlack},b.prototype.drawCanvas=function(){let{isMaked:o,canvasContext:e,useDynamicSize:r,dynamicSize:t,foregroundColor:i,foregroundPadding:n,backgroundColor:a,backgroundPadding:d,drawReserve:u,margin:s}=this;if(!o)return console.error("[uQRCode]: please execute the make method first!"),Promise.reject(new b.Error("please execute the make method first!"));let g=this.getDrawModules(),l=async(o,r)=>{try{e.clearRect(0,0,t,t),e.draw(!1);for(var i=0;i<g.length;i++){var n=g[i];switch(e.save(),n.type){case"area":e.setFillStyle(n.color),e.fillRect(n.x,n.y,n.width,n.height);break;case"tile":var a=n.x,d=n.y,s=n.width,l=n.height;e.setFillStyle(n.color),e.fillRect(a,d,s,l);break;case"image":if("backgroundImage"===n.name){a=Math.round(n.x),d=Math.round(n.y),s=Math.round(n.width),l=Math.round(n.height);s<2*(c=Math.round(n.borderRadius))&&(c=s/2),l<2*c&&(c=l/2),e.setGlobalAlpha(n.alpha),c>0&&(e.beginPath(),e.moveTo(a+c,d),e.arcTo(a+s,d,a+s,d+l,c),e.arcTo(a+s,d+l,a,d+l,c),e.arcTo(a,d+l,a,d,c),e.arcTo(a,d,a+s,d,c),e.closePath(),e.setStrokeStyle("rgba(0,0,0,0)"),e.stroke(),e.clip());try{var h=await this.loadImage(n.imageSrc);e.drawImage(h,a,d,s,l);}catch(o){throw console.error(`[uQRCode]: ${n.mappingName} invalid!`),new b.Error(`${n.mappingName} invalid!`)}}else if("foregroundImage"===n.name){a=Math.round(n.x),d=Math.round(n.y),s=Math.round(n.width),l=Math.round(n.height);var c,m=Math.round(n.padding);s<2*(c=Math.round(n.borderRadius))&&(c=s/2),l<2*c&&(c=l/2);var f=a-m,v=d-m,p=s+2*m,C=l+2*m,k=Math.round(p/s*c);p<2*k&&(k=p/2),C<2*k&&(k=C/2),e.save(),e.setShadow(n.shadowOffsetX,n.shadowOffsetY,n.shadowBlur,n.shadowColor),k>0?(e.beginPath(),e.moveTo(f+k,v),e.arcTo(f+p,v,f+p,v+C,k),e.arcTo(f+p,v+C,f,v+C,k),e.arcTo(f,v+C,f,v,k),e.arcTo(f,v,f+p,v,k),e.closePath(),e.setFillStyle(n.backgroundColor),e.fill()):(e.setFillStyle(n.backgroundColor),e.fillRect(f,v,p,C)),e.restore(),e.save(),k>0?(e.beginPath(),e.moveTo(f+k,v),e.arcTo(f+p,v,f+p,v+C,k),e.arcTo(f+p,v+C,f,v+C,k),e.arcTo(f,v+C,f,v,k),e.arcTo(f,v,f+p,v,k),e.closePath(),e.setFillStyle(m>0?n.backgroundColor:"rgba(0,0,0,0)"),e.fill()):(e.setFillStyle(m>0?n.backgroundColor:"rgba(0,0,0,0)"),e.fillRect(f,v,p,C)),e.restore(),c>0&&(e.beginPath(),e.moveTo(a+c,d),e.arcTo(a+s,d,a+s,d+l,c),e.arcTo(a+s,d+l,a,d+l,c),e.arcTo(a,d+l,a,d,c),e.arcTo(a,d,a+s,d,c),e.closePath(),e.setStrokeStyle("rgba(0,0,0,0)"),e.stroke(),e.clip());try{h=await this.loadImage(n.imageSrc);e.drawImage(h,a,d,s,l);}catch(o){throw console.error(`[uQRCode]: ${n.mappingName} invalid!`),new b.Error(`${n.mappingName} invalid!`)}}}u&&e.draw(!0),e.restore();}e.draw(!0),setTimeout(o,150);}catch(o){if(!(o instanceof b.Error))throw o;r(o);}};return new Promise(((o,e)=>{l(o,e);}))},b.prototype.draw=function(){return this.drawCanvas()},b.prototype.register=function(o){o&&o(b,this,!0);};export{b as default};
|
|
34
|
+
function o(o) {
|
|
35
|
+
;(this.mode = r.MODE_8BIT_BYTE), (this.data = o)
|
|
36
|
+
}
|
|
37
|
+
function e(o, e) {
|
|
38
|
+
;(this.typeNumber = o),
|
|
39
|
+
(this.errorCorrectLevel = e),
|
|
40
|
+
(this.modules = null),
|
|
41
|
+
(this.moduleCount = 0),
|
|
42
|
+
(this.dataCache = null),
|
|
43
|
+
(this.dataList = [])
|
|
44
|
+
}
|
|
45
|
+
;(o.prototype = {
|
|
46
|
+
getLength: function (o) {
|
|
47
|
+
return this.data.length
|
|
48
|
+
},
|
|
49
|
+
write: function (o) {
|
|
50
|
+
for (let e = 0; e < this.data.length; e++) o.put(this.data.charCodeAt(e), 8)
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
(e.prototype = {
|
|
54
|
+
addData: function (e) {
|
|
55
|
+
const r = new o(e)
|
|
56
|
+
this.dataList.push(r), (this.dataCache = null)
|
|
57
|
+
},
|
|
58
|
+
isDark: function (o, e) {
|
|
59
|
+
if (o < 0 || this.moduleCount <= o || e < 0 || this.moduleCount <= e)
|
|
60
|
+
throw new Error(o + ',' + e)
|
|
61
|
+
return this.modules[o][e]
|
|
62
|
+
},
|
|
63
|
+
getModuleCount: function () {
|
|
64
|
+
return this.moduleCount
|
|
65
|
+
},
|
|
66
|
+
make: function () {
|
|
67
|
+
if (this.typeNumber < 1) {
|
|
68
|
+
let o = 1
|
|
69
|
+
for (o = 1; o < 40; o++) {
|
|
70
|
+
for (
|
|
71
|
+
var e = v.getRSBlocks(o, this.errorCorrectLevel), r = new p(), t = 0, i = 0;
|
|
72
|
+
i < e.length;
|
|
73
|
+
i++
|
|
74
|
+
)
|
|
75
|
+
t += e[i].dataCount
|
|
76
|
+
for (i = 0; i < this.dataList.length; i++) {
|
|
77
|
+
const n = this.dataList[i]
|
|
78
|
+
r.put(n.mode, 4), r.put(n.getLength(), h.getLengthInBits(n.mode, o)), n.write(r)
|
|
79
|
+
}
|
|
80
|
+
if (r.getLengthInBits() <= 8 * t) break
|
|
81
|
+
}
|
|
82
|
+
this.typeNumber = o
|
|
83
|
+
}
|
|
84
|
+
this.makeImpl(!1, this.getBestMaskPattern())
|
|
85
|
+
},
|
|
86
|
+
makeImpl: function (o, r) {
|
|
87
|
+
;(this.moduleCount = 4 * this.typeNumber + 17), (this.modules = new Array(this.moduleCount))
|
|
88
|
+
for (let t = 0; t < this.moduleCount; t++) {
|
|
89
|
+
this.modules[t] = new Array(this.moduleCount)
|
|
90
|
+
for (let i = 0; i < this.moduleCount; i++) this.modules[t][i] = null
|
|
91
|
+
}
|
|
92
|
+
this.setupPositionProbePattern(0, 0),
|
|
93
|
+
this.setupPositionProbePattern(this.moduleCount - 7, 0),
|
|
94
|
+
this.setupPositionProbePattern(0, this.moduleCount - 7),
|
|
95
|
+
this.setupPositionAdjustPattern(),
|
|
96
|
+
this.setupTimingPattern(),
|
|
97
|
+
this.setupTypeInfo(o, r),
|
|
98
|
+
this.typeNumber >= 7 && this.setupTypeNumber(o),
|
|
99
|
+
this.dataCache == null &&
|
|
100
|
+
(this.dataCache = e.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)),
|
|
101
|
+
this.mapData(this.dataCache, r)
|
|
102
|
+
},
|
|
103
|
+
setupPositionProbePattern: function (o, e) {
|
|
104
|
+
for (let r = -1; r <= 7; r++)
|
|
105
|
+
if (!(o + r <= -1 || this.moduleCount <= o + r))
|
|
106
|
+
for (let t = -1; t <= 7; t++)
|
|
107
|
+
e + t <= -1 ||
|
|
108
|
+
this.moduleCount <= e + t ||
|
|
109
|
+
(this.modules[o + r][e + t] =
|
|
110
|
+
(r >= 0 && r <= 6 && (t == 0 || t == 6)) ||
|
|
111
|
+
(t >= 0 && t <= 6 && (r == 0 || r == 6)) ||
|
|
112
|
+
(r >= 2 && r <= 4 && t >= 2 && t <= 4))
|
|
113
|
+
},
|
|
114
|
+
getBestMaskPattern: function () {
|
|
115
|
+
for (var o = 0, e = 0, r = 0; r < 8; r++) {
|
|
116
|
+
this.makeImpl(!0, r)
|
|
117
|
+
const t = h.getLostPoint(this)
|
|
118
|
+
;(r == 0 || o > t) && ((o = t), (e = r))
|
|
119
|
+
}
|
|
120
|
+
return e
|
|
121
|
+
},
|
|
122
|
+
createMovieClip: function (o, e, r) {
|
|
123
|
+
const t = o.createEmptyMovieClip(e, r)
|
|
124
|
+
this.make()
|
|
125
|
+
for (let i = 0; i < this.modules.length; i++)
|
|
126
|
+
for (let n = 1 * i, a = 0; a < this.modules[i].length; a++) {
|
|
127
|
+
const d = 1 * a
|
|
128
|
+
this.modules[i][a] &&
|
|
129
|
+
(t.beginFill(0, 100),
|
|
130
|
+
t.moveTo(d, n),
|
|
131
|
+
t.lineTo(d + 1, n),
|
|
132
|
+
t.lineTo(d + 1, n + 1),
|
|
133
|
+
t.lineTo(d, n + 1),
|
|
134
|
+
t.endFill())
|
|
135
|
+
}
|
|
136
|
+
return t
|
|
137
|
+
},
|
|
138
|
+
setupTimingPattern: function () {
|
|
139
|
+
for (let o = 8; o < this.moduleCount - 8; o++)
|
|
140
|
+
this.modules[o][6] == null && (this.modules[o][6] = o % 2 == 0)
|
|
141
|
+
for (let e = 8; e < this.moduleCount - 8; e++)
|
|
142
|
+
this.modules[6][e] == null && (this.modules[6][e] = e % 2 == 0)
|
|
143
|
+
},
|
|
144
|
+
setupPositionAdjustPattern: function () {
|
|
145
|
+
for (let o = h.getPatternPosition(this.typeNumber), e = 0; e < o.length; e++)
|
|
146
|
+
for (let r = 0; r < o.length; r++) {
|
|
147
|
+
const t = o[e]
|
|
148
|
+
const i = o[r]
|
|
149
|
+
if (this.modules[t][i] == null)
|
|
150
|
+
for (let n = -2; n <= 2; n++)
|
|
151
|
+
for (let a = -2; a <= 2; a++)
|
|
152
|
+
this.modules[t + n][i + a] =
|
|
153
|
+
n == -2 || n == 2 || a == -2 || a == 2 || (n == 0 && a == 0)
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
setupTypeNumber: function (o) {
|
|
157
|
+
for (var e = h.getBCHTypeNumber(this.typeNumber), r = 0; r < 18; r++) {
|
|
158
|
+
var t = !o && ((e >> r) & 1) == 1
|
|
159
|
+
this.modules[Math.floor(r / 3)][(r % 3) + this.moduleCount - 8 - 3] = t
|
|
160
|
+
}
|
|
161
|
+
for (r = 0; r < 18; r++) {
|
|
162
|
+
t = !o && ((e >> r) & 1) == 1
|
|
163
|
+
this.modules[(r % 3) + this.moduleCount - 8 - 3][Math.floor(r / 3)] = t
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
setupTypeInfo: function (o, e) {
|
|
167
|
+
for (var r = (this.errorCorrectLevel << 3) | e, t = h.getBCHTypeInfo(r), i = 0; i < 15; i++) {
|
|
168
|
+
var n = !o && ((t >> i) & 1) == 1
|
|
169
|
+
i < 6
|
|
170
|
+
? (this.modules[i][8] = n)
|
|
171
|
+
: i < 8
|
|
172
|
+
? (this.modules[i + 1][8] = n)
|
|
173
|
+
: (this.modules[this.moduleCount - 15 + i][8] = n)
|
|
174
|
+
}
|
|
175
|
+
for (i = 0; i < 15; i++) {
|
|
176
|
+
n = !o && ((t >> i) & 1) == 1
|
|
177
|
+
i < 8
|
|
178
|
+
? (this.modules[8][this.moduleCount - i - 1] = n)
|
|
179
|
+
: i < 9
|
|
180
|
+
? (this.modules[8][15 - i - 1 + 1] = n)
|
|
181
|
+
: (this.modules[8][15 - i - 1] = n)
|
|
182
|
+
}
|
|
183
|
+
this.modules[this.moduleCount - 8][8] = !o
|
|
184
|
+
},
|
|
185
|
+
mapData: function (o, e) {
|
|
186
|
+
for (
|
|
187
|
+
let r = -1, t = this.moduleCount - 1, i = 7, n = 0, a = this.moduleCount - 1;
|
|
188
|
+
a > 0;
|
|
189
|
+
a -= 2
|
|
190
|
+
)
|
|
191
|
+
for (a == 6 && a--; ; ) {
|
|
192
|
+
for (let d = 0; d < 2; d++)
|
|
193
|
+
if (this.modules[t][a - d] == null) {
|
|
194
|
+
let u = !1
|
|
195
|
+
n < o.length && (u = ((o[n] >>> i) & 1) == 1),
|
|
196
|
+
h.getMask(e, t, a - d) && (u = !u),
|
|
197
|
+
(this.modules[t][a - d] = u),
|
|
198
|
+
--i == -1 && (n++, (i = 7))
|
|
199
|
+
}
|
|
200
|
+
if ((t += r) < 0 || this.moduleCount <= t) {
|
|
201
|
+
;(t -= r), (r = -r)
|
|
202
|
+
break
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
}),
|
|
207
|
+
(e.PAD0 = 236),
|
|
208
|
+
(e.PAD1 = 17),
|
|
209
|
+
(e.createData = function (o, r, t) {
|
|
210
|
+
for (var i = v.getRSBlocks(o, r), n = new p(), a = 0; a < t.length; a++) {
|
|
211
|
+
const d = t[a]
|
|
212
|
+
n.put(d.mode, 4), n.put(d.getLength(), h.getLengthInBits(d.mode, o)), d.write(n)
|
|
213
|
+
}
|
|
214
|
+
let u = 0
|
|
215
|
+
for (a = 0; a < i.length; a++) u += i[a].dataCount
|
|
216
|
+
if (n.getLengthInBits() > 8 * u)
|
|
217
|
+
throw new Error('code length overflow. (' + n.getLengthInBits() + '>' + 8 * u + ')')
|
|
218
|
+
for (n.getLengthInBits() + 4 <= 8 * u && n.put(0, 4); n.getLengthInBits() % 8 != 0; )
|
|
219
|
+
n.putBit(!1)
|
|
220
|
+
for (; !(n.getLengthInBits() >= 8 * u || (n.put(e.PAD0, 8), n.getLengthInBits() >= 8 * u)); )
|
|
221
|
+
n.put(e.PAD1, 8)
|
|
222
|
+
return e.createBytes(n, i)
|
|
223
|
+
}),
|
|
224
|
+
(e.createBytes = function (o, e) {
|
|
225
|
+
for (
|
|
226
|
+
var r = 0, t = 0, i = 0, n = new Array(e.length), a = new Array(e.length), d = 0;
|
|
227
|
+
d < e.length;
|
|
228
|
+
d++
|
|
229
|
+
) {
|
|
230
|
+
const u = e[d].dataCount
|
|
231
|
+
const s = e[d].totalCount - u
|
|
232
|
+
;(t = Math.max(t, u)), (i = Math.max(i, s)), (n[d] = new Array(u))
|
|
233
|
+
for (var g = 0; g < n[d].length; g++) n[d][g] = 255 & o.buffer[g + r]
|
|
234
|
+
r += u
|
|
235
|
+
const l = h.getErrorCorrectPolynomial(s)
|
|
236
|
+
const c = new f(n[d], l.getLength() - 1).mod(l)
|
|
237
|
+
a[d] = new Array(l.getLength() - 1)
|
|
238
|
+
for (g = 0; g < a[d].length; g++) {
|
|
239
|
+
const m = g + c.getLength() - a[d].length
|
|
240
|
+
a[d][g] = m >= 0 ? c.get(m) : 0
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
let v = 0
|
|
244
|
+
for (g = 0; g < e.length; g++) v += e[g].totalCount
|
|
245
|
+
const p = new Array(v)
|
|
246
|
+
let C = 0
|
|
247
|
+
for (g = 0; g < t; g++) for (d = 0; d < e.length; d++) g < n[d].length && (p[C++] = n[d][g])
|
|
248
|
+
for (g = 0; g < i; g++) for (d = 0; d < e.length; d++) g < a[d].length && (p[C++] = a[d][g])
|
|
249
|
+
return p
|
|
250
|
+
})
|
|
251
|
+
for (
|
|
252
|
+
var r = { MODE_NUMBER: 1, MODE_ALPHA_NUM: 2, MODE_8BIT_BYTE: 4, MODE_KANJI: 8 },
|
|
253
|
+
t = { L: 1, M: 0, Q: 3, H: 2 },
|
|
254
|
+
i = 0,
|
|
255
|
+
n = 1,
|
|
256
|
+
a = 2,
|
|
257
|
+
d = 3,
|
|
258
|
+
u = 4,
|
|
259
|
+
s = 5,
|
|
260
|
+
g = 6,
|
|
261
|
+
l = 7,
|
|
262
|
+
h = {
|
|
263
|
+
PATTERN_POSITION_TABLE: [
|
|
264
|
+
[],
|
|
265
|
+
[6, 18],
|
|
266
|
+
[6, 22],
|
|
267
|
+
[6, 26],
|
|
268
|
+
[6, 30],
|
|
269
|
+
[6, 34],
|
|
270
|
+
[6, 22, 38],
|
|
271
|
+
[6, 24, 42],
|
|
272
|
+
[6, 26, 46],
|
|
273
|
+
[6, 28, 50],
|
|
274
|
+
[6, 30, 54],
|
|
275
|
+
[6, 32, 58],
|
|
276
|
+
[6, 34, 62],
|
|
277
|
+
[6, 26, 46, 66],
|
|
278
|
+
[6, 26, 48, 70],
|
|
279
|
+
[6, 26, 50, 74],
|
|
280
|
+
[6, 30, 54, 78],
|
|
281
|
+
[6, 30, 56, 82],
|
|
282
|
+
[6, 30, 58, 86],
|
|
283
|
+
[6, 34, 62, 90],
|
|
284
|
+
[6, 28, 50, 72, 94],
|
|
285
|
+
[6, 26, 50, 74, 98],
|
|
286
|
+
[6, 30, 54, 78, 102],
|
|
287
|
+
[6, 28, 54, 80, 106],
|
|
288
|
+
[6, 32, 58, 84, 110],
|
|
289
|
+
[6, 30, 58, 86, 114],
|
|
290
|
+
[6, 34, 62, 90, 118],
|
|
291
|
+
[6, 26, 50, 74, 98, 122],
|
|
292
|
+
[6, 30, 54, 78, 102, 126],
|
|
293
|
+
[6, 26, 52, 78, 104, 130],
|
|
294
|
+
[6, 30, 56, 82, 108, 134],
|
|
295
|
+
[6, 34, 60, 86, 112, 138],
|
|
296
|
+
[6, 30, 58, 86, 114, 142],
|
|
297
|
+
[6, 34, 62, 90, 118, 146],
|
|
298
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
299
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
300
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
301
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
302
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
303
|
+
[6, 30, 58, 86, 114, 142, 170],
|
|
304
|
+
],
|
|
305
|
+
G15: 1335,
|
|
306
|
+
G18: 7973,
|
|
307
|
+
G15_MASK: 21522,
|
|
308
|
+
getBCHTypeInfo: function (o) {
|
|
309
|
+
for (var e = o << 10; h.getBCHDigit(e) - h.getBCHDigit(h.G15) >= 0; )
|
|
310
|
+
e ^= h.G15 << (h.getBCHDigit(e) - h.getBCHDigit(h.G15))
|
|
311
|
+
return ((o << 10) | e) ^ h.G15_MASK
|
|
312
|
+
},
|
|
313
|
+
getBCHTypeNumber: function (o) {
|
|
314
|
+
for (var e = o << 12; h.getBCHDigit(e) - h.getBCHDigit(h.G18) >= 0; )
|
|
315
|
+
e ^= h.G18 << (h.getBCHDigit(e) - h.getBCHDigit(h.G18))
|
|
316
|
+
return (o << 12) | e
|
|
317
|
+
},
|
|
318
|
+
getBCHDigit: function (o) {
|
|
319
|
+
for (var e = 0; o != 0; ) e++, (o >>>= 1)
|
|
320
|
+
return e
|
|
321
|
+
},
|
|
322
|
+
getPatternPosition: function (o) {
|
|
323
|
+
return h.PATTERN_POSITION_TABLE[o - 1]
|
|
324
|
+
},
|
|
325
|
+
getMask: function (o, e, r) {
|
|
326
|
+
switch (o) {
|
|
327
|
+
case i:
|
|
328
|
+
return (e + r) % 2 == 0
|
|
329
|
+
case n:
|
|
330
|
+
return e % 2 == 0
|
|
331
|
+
case a:
|
|
332
|
+
return r % 3 == 0
|
|
333
|
+
case d:
|
|
334
|
+
return (e + r) % 3 == 0
|
|
335
|
+
case u:
|
|
336
|
+
return (Math.floor(e / 2) + Math.floor(r / 3)) % 2 == 0
|
|
337
|
+
case s:
|
|
338
|
+
return ((e * r) % 2) + ((e * r) % 3) == 0
|
|
339
|
+
case g:
|
|
340
|
+
return (((e * r) % 2) + ((e * r) % 3)) % 2 == 0
|
|
341
|
+
case l:
|
|
342
|
+
return (((e * r) % 3) + ((e + r) % 2)) % 2 == 0
|
|
343
|
+
default:
|
|
344
|
+
throw new Error('bad maskPattern:' + o)
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
getErrorCorrectPolynomial: function (o) {
|
|
348
|
+
for (var e = new f([1], 0), r = 0; r < o; r++) e = e.multiply(new f([1, c.gexp(r)], 0))
|
|
349
|
+
return e
|
|
350
|
+
},
|
|
351
|
+
getLengthInBits: function (o, e) {
|
|
352
|
+
if (e >= 1 && e < 10)
|
|
353
|
+
switch (o) {
|
|
354
|
+
case r.MODE_NUMBER:
|
|
355
|
+
return 10
|
|
356
|
+
case r.MODE_ALPHA_NUM:
|
|
357
|
+
return 9
|
|
358
|
+
case r.MODE_8BIT_BYTE:
|
|
359
|
+
case r.MODE_KANJI:
|
|
360
|
+
return 8
|
|
361
|
+
default:
|
|
362
|
+
throw new Error('mode:' + o)
|
|
363
|
+
}
|
|
364
|
+
else if (e < 27)
|
|
365
|
+
switch (o) {
|
|
366
|
+
case r.MODE_NUMBER:
|
|
367
|
+
return 12
|
|
368
|
+
case r.MODE_ALPHA_NUM:
|
|
369
|
+
return 11
|
|
370
|
+
case r.MODE_8BIT_BYTE:
|
|
371
|
+
return 16
|
|
372
|
+
case r.MODE_KANJI:
|
|
373
|
+
return 10
|
|
374
|
+
default:
|
|
375
|
+
throw new Error('mode:' + o)
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
if (!(e < 41)) throw new Error('type:' + e)
|
|
379
|
+
switch (o) {
|
|
380
|
+
case r.MODE_NUMBER:
|
|
381
|
+
return 14
|
|
382
|
+
case r.MODE_ALPHA_NUM:
|
|
383
|
+
return 13
|
|
384
|
+
case r.MODE_8BIT_BYTE:
|
|
385
|
+
return 16
|
|
386
|
+
case r.MODE_KANJI:
|
|
387
|
+
return 12
|
|
388
|
+
default:
|
|
389
|
+
throw new Error('mode:' + o)
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
getLostPoint: function (o) {
|
|
394
|
+
for (var e = o.getModuleCount(), r = 0, t = 0; t < e; t++)
|
|
395
|
+
for (var i = 0; i < e; i++) {
|
|
396
|
+
for (var n = 0, a = o.isDark(t, i), d = -1; d <= 1; d++)
|
|
397
|
+
if (!(t + d < 0 || e <= t + d))
|
|
398
|
+
for (let u = -1; u <= 1; u++)
|
|
399
|
+
i + u < 0 ||
|
|
400
|
+
e <= i + u ||
|
|
401
|
+
(d == 0 && u == 0) ||
|
|
402
|
+
(a == o.isDark(t + d, i + u) && n++)
|
|
403
|
+
n > 5 && (r += 3 + n - 5)
|
|
404
|
+
}
|
|
405
|
+
for (t = 0; t < e - 1; t++)
|
|
406
|
+
for (i = 0; i < e - 1; i++) {
|
|
407
|
+
let s = 0
|
|
408
|
+
o.isDark(t, i) && s++,
|
|
409
|
+
o.isDark(t + 1, i) && s++,
|
|
410
|
+
o.isDark(t, i + 1) && s++,
|
|
411
|
+
o.isDark(t + 1, i + 1) && s++,
|
|
412
|
+
(s != 0 && s != 4) || (r += 3)
|
|
413
|
+
}
|
|
414
|
+
for (t = 0; t < e; t++)
|
|
415
|
+
for (i = 0; i < e - 6; i++)
|
|
416
|
+
o.isDark(t, i) &&
|
|
417
|
+
!o.isDark(t, i + 1) &&
|
|
418
|
+
o.isDark(t, i + 2) &&
|
|
419
|
+
o.isDark(t, i + 3) &&
|
|
420
|
+
o.isDark(t, i + 4) &&
|
|
421
|
+
!o.isDark(t, i + 5) &&
|
|
422
|
+
o.isDark(t, i + 6) &&
|
|
423
|
+
(r += 40)
|
|
424
|
+
for (i = 0; i < e; i++)
|
|
425
|
+
for (t = 0; t < e - 6; t++)
|
|
426
|
+
o.isDark(t, i) &&
|
|
427
|
+
!o.isDark(t + 1, i) &&
|
|
428
|
+
o.isDark(t + 2, i) &&
|
|
429
|
+
o.isDark(t + 3, i) &&
|
|
430
|
+
o.isDark(t + 4, i) &&
|
|
431
|
+
!o.isDark(t + 5, i) &&
|
|
432
|
+
o.isDark(t + 6, i) &&
|
|
433
|
+
(r += 40)
|
|
434
|
+
let g = 0
|
|
435
|
+
for (i = 0; i < e; i++) for (t = 0; t < e; t++) o.isDark(t, i) && g++
|
|
436
|
+
return (r += 10 * (Math.abs((100 * g) / e / e - 50) / 5))
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
c = {
|
|
440
|
+
glog: function (o) {
|
|
441
|
+
if (o < 1) throw new Error('glog(' + o + ')')
|
|
442
|
+
return c.LOG_TABLE[o]
|
|
443
|
+
},
|
|
444
|
+
gexp: function (o) {
|
|
445
|
+
for (; o < 0; ) o += 255
|
|
446
|
+
for (; o >= 256; ) o -= 255
|
|
447
|
+
return c.EXP_TABLE[o]
|
|
448
|
+
},
|
|
449
|
+
EXP_TABLE: new Array(256),
|
|
450
|
+
LOG_TABLE: new Array(256),
|
|
451
|
+
},
|
|
452
|
+
m = 0;
|
|
453
|
+
m < 8;
|
|
454
|
+
m++
|
|
455
|
+
)
|
|
456
|
+
c.EXP_TABLE[m] = 1 << m
|
|
457
|
+
for (m = 8; m < 256; m++)
|
|
458
|
+
c.EXP_TABLE[m] = c.EXP_TABLE[m - 4] ^ c.EXP_TABLE[m - 5] ^ c.EXP_TABLE[m - 6] ^ c.EXP_TABLE[m - 8]
|
|
459
|
+
for (m = 0; m < 255; m++) c.LOG_TABLE[c.EXP_TABLE[m]] = m
|
|
460
|
+
function f(o, e) {
|
|
461
|
+
if (o.length == null) throw new Error(o.length + '/' + e)
|
|
462
|
+
for (var r = 0; r < o.length && o[r] == 0; ) r++
|
|
463
|
+
this.num = new Array(o.length - r + e)
|
|
464
|
+
for (let t = 0; t < o.length - r; t++) this.num[t] = o[t + r]
|
|
465
|
+
}
|
|
466
|
+
function v(o, e) {
|
|
467
|
+
;(this.totalCount = o), (this.dataCount = e)
|
|
468
|
+
}
|
|
469
|
+
function p() {
|
|
470
|
+
;(this.buffer = []), (this.length = 0)
|
|
471
|
+
}
|
|
472
|
+
function C(o) {
|
|
473
|
+
return (
|
|
474
|
+
(o.setFillStyle =
|
|
475
|
+
o.setFillStyle ||
|
|
476
|
+
function (e) {
|
|
477
|
+
o.fillStyle = e
|
|
478
|
+
}),
|
|
479
|
+
(o.setFontSize =
|
|
480
|
+
o.setFontSize ||
|
|
481
|
+
function (e) {
|
|
482
|
+
o.font = `${e}px`
|
|
483
|
+
}),
|
|
484
|
+
(o.setTextAlign =
|
|
485
|
+
o.setTextAlign ||
|
|
486
|
+
function (e) {
|
|
487
|
+
o.textAlign = e
|
|
488
|
+
}),
|
|
489
|
+
(o.setTextBaseline =
|
|
490
|
+
o.setTextBaseline ||
|
|
491
|
+
function (e) {
|
|
492
|
+
o.textBaseline = e
|
|
493
|
+
}),
|
|
494
|
+
(o.setGlobalAlpha =
|
|
495
|
+
o.setGlobalAlpha ||
|
|
496
|
+
function (e) {
|
|
497
|
+
o.globalAlpha = e
|
|
498
|
+
}),
|
|
499
|
+
(o.setStrokeStyle =
|
|
500
|
+
o.setStrokeStyle ||
|
|
501
|
+
function (e) {
|
|
502
|
+
o.strokeStyle = e
|
|
503
|
+
}),
|
|
504
|
+
(o.setShadow =
|
|
505
|
+
o.setShadow ||
|
|
506
|
+
function (e, r, t, i) {
|
|
507
|
+
;(o.shadowOffsetX = e), (o.shadowOffsetY = r), (o.shadowBlur = t), (o.shadowColor = i)
|
|
508
|
+
}),
|
|
509
|
+
(o.draw =
|
|
510
|
+
o.draw ||
|
|
511
|
+
function (o, e) {
|
|
512
|
+
e && e()
|
|
513
|
+
}),
|
|
514
|
+
(o.clearRect =
|
|
515
|
+
o.clearRect ||
|
|
516
|
+
function (e, r, t, i) {
|
|
517
|
+
o.draw(!1)
|
|
518
|
+
}),
|
|
519
|
+
o
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
function b(o, e) {
|
|
523
|
+
let r = (this.data = '')
|
|
524
|
+
let t = (this.size = 200)
|
|
525
|
+
;(this.useDynamicSize = !1), (this.dynamicSize = t)
|
|
526
|
+
let i = (this.typeNumber = -1)
|
|
527
|
+
this.errorCorrectLevel = b.errorCorrectLevel.H
|
|
528
|
+
let n = (this.margin = 0)
|
|
529
|
+
;(this.areaColor = '#FFFFFF'),
|
|
530
|
+
(this.backgroundColor = 'rgba(255,255,255,0)'),
|
|
531
|
+
(this.backgroundImageSrc = void 0)
|
|
532
|
+
let a = (this.backgroundImageWidth = void 0)
|
|
533
|
+
let d = (this.backgroundImageHeight = void 0)
|
|
534
|
+
let u = (this.backgroundImageX = void 0)
|
|
535
|
+
let s = (this.backgroundImageY = void 0)
|
|
536
|
+
;(this.backgroundImageAlpha = 1), (this.backgroundImageBorderRadius = 0)
|
|
537
|
+
let g = (this.backgroundPadding = 0)
|
|
538
|
+
;(this.foregroundColor = '#000000'), (this.foregroundImageSrc = void 0)
|
|
539
|
+
let l = (this.foregroundImageWidth = void 0)
|
|
540
|
+
let h = (this.foregroundImageHeight = void 0)
|
|
541
|
+
let c = (this.foregroundImageX = void 0)
|
|
542
|
+
let m = (this.foregroundImageY = void 0)
|
|
543
|
+
let f = (this.foregroundImagePadding = 0)
|
|
544
|
+
this.foregroundImageBackgroundColor = '#FFFFFF'
|
|
545
|
+
let v = (this.foregroundImageBorderRadius = 0)
|
|
546
|
+
let p = (this.foregroundImageShadowOffsetX = 0)
|
|
547
|
+
let k = (this.foregroundImageShadowOffsetY = 0)
|
|
548
|
+
let y = (this.foregroundImageShadowBlur = 0)
|
|
549
|
+
this.foregroundImageShadowColor = '#808080'
|
|
550
|
+
let w = (this.foregroundPadding = 0)
|
|
551
|
+
let I = (this.positionProbeBackgroundColor = void 0)
|
|
552
|
+
let B = (this.positionProbeForegroundColor = void 0)
|
|
553
|
+
let S = (this.separatorColor = void 0)
|
|
554
|
+
let P = (this.positionAdjustBackgroundColor = void 0)
|
|
555
|
+
let L = (this.positionAdjustForegroundColor = void 0)
|
|
556
|
+
let D = (this.timingBackgroundColor = void 0)
|
|
557
|
+
let A = (this.timingForegroundColor = void 0)
|
|
558
|
+
let E = (this.typeNumberBackgroundColor = void 0)
|
|
559
|
+
let T = (this.typeNumberForegroundColor = void 0)
|
|
560
|
+
let N = (this.darkBlockColor = void 0)
|
|
561
|
+
;(this.base = void 0), (this.modules = []), (this.moduleCount = 0), (this.drawModules = [])
|
|
562
|
+
let M = (this.canvasContext = void 0)
|
|
563
|
+
this.loadImage,
|
|
564
|
+
(this.drawReserve = !1),
|
|
565
|
+
(this.isMaked = !1),
|
|
566
|
+
Object.defineProperties(this, {
|
|
567
|
+
data: {
|
|
568
|
+
get() {
|
|
569
|
+
if (r === '' || void 0 === r)
|
|
570
|
+
throw (console.error('[uQRCode]: data must be set!'), new b.Error('data must be set!'))
|
|
571
|
+
return r
|
|
572
|
+
},
|
|
573
|
+
set(o) {
|
|
574
|
+
r = String(o)
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
size: {
|
|
578
|
+
get: () => t,
|
|
579
|
+
set(o) {
|
|
580
|
+
t = Number(o)
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
typeNumber: {
|
|
584
|
+
get: () => i,
|
|
585
|
+
set(o) {
|
|
586
|
+
i = Number(o)
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
margin: {
|
|
590
|
+
get: () => n,
|
|
591
|
+
set(o) {
|
|
592
|
+
n = Number(o)
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
backgroundImageWidth: {
|
|
596
|
+
get() {
|
|
597
|
+
return void 0 === a
|
|
598
|
+
? this.dynamicSize
|
|
599
|
+
: this.useDynamicSize
|
|
600
|
+
? (this.dynamicSize / this.size) * a
|
|
601
|
+
: a
|
|
602
|
+
},
|
|
603
|
+
set(o) {
|
|
604
|
+
a = Number(o)
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
backgroundImageHeight: {
|
|
608
|
+
get() {
|
|
609
|
+
return void 0 === d
|
|
610
|
+
? this.dynamicSize
|
|
611
|
+
: this.useDynamicSize
|
|
612
|
+
? (this.dynamicSize / this.size) * d
|
|
613
|
+
: d
|
|
614
|
+
},
|
|
615
|
+
set(o) {
|
|
616
|
+
d = Number(o)
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
backgroundImageX: {
|
|
620
|
+
get() {
|
|
621
|
+
return void 0 === u ? 0 : this.useDynamicSize ? (this.dynamicSize / this.size) * u : u
|
|
622
|
+
},
|
|
623
|
+
set(o) {
|
|
624
|
+
u = Number(o)
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
backgroundImageY: {
|
|
628
|
+
get() {
|
|
629
|
+
return void 0 === s ? 0 : this.useDynamicSize ? (this.dynamicSize / this.size) * s : s
|
|
630
|
+
},
|
|
631
|
+
set(o) {
|
|
632
|
+
s = Number(o)
|
|
633
|
+
},
|
|
634
|
+
},
|
|
635
|
+
backgroundPadding: {
|
|
636
|
+
get: () => g,
|
|
637
|
+
set(o) {
|
|
638
|
+
g = o > 1 ? 1 : o < 0 ? 0 : o
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
foregroundImageWidth: {
|
|
642
|
+
get() {
|
|
643
|
+
return void 0 === l
|
|
644
|
+
? (this.dynamicSize - 2 * this.margin) / 4
|
|
645
|
+
: this.useDynamicSize
|
|
646
|
+
? (this.dynamicSize / this.size) * l
|
|
647
|
+
: l
|
|
648
|
+
},
|
|
649
|
+
set(o) {
|
|
650
|
+
l = Number(o)
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
foregroundImageHeight: {
|
|
654
|
+
get() {
|
|
655
|
+
return void 0 === h
|
|
656
|
+
? (this.dynamicSize - 2 * this.margin) / 4
|
|
657
|
+
: this.useDynamicSize
|
|
658
|
+
? (this.dynamicSize / this.size) * h
|
|
659
|
+
: h
|
|
660
|
+
},
|
|
661
|
+
set(o) {
|
|
662
|
+
h = Number(o)
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
foregroundImageX: {
|
|
666
|
+
get() {
|
|
667
|
+
return void 0 === c
|
|
668
|
+
? this.dynamicSize / 2 - this.foregroundImageWidth / 2
|
|
669
|
+
: this.useDynamicSize
|
|
670
|
+
? (this.dynamicSize / this.size) * c
|
|
671
|
+
: c
|
|
672
|
+
},
|
|
673
|
+
set(o) {
|
|
674
|
+
c = Number(o)
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
foregroundImageY: {
|
|
678
|
+
get() {
|
|
679
|
+
return void 0 === m
|
|
680
|
+
? this.dynamicSize / 2 - this.foregroundImageHeight / 2
|
|
681
|
+
: this.useDynamicSize
|
|
682
|
+
? (this.dynamicSize / this.size) * m
|
|
683
|
+
: m
|
|
684
|
+
},
|
|
685
|
+
set(o) {
|
|
686
|
+
m = Number(o)
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
foregroundImagePadding: {
|
|
690
|
+
get() {
|
|
691
|
+
return this.useDynamicSize ? (this.dynamicSize / this.size) * f : f
|
|
692
|
+
},
|
|
693
|
+
set(o) {
|
|
694
|
+
f = Number(o)
|
|
695
|
+
},
|
|
696
|
+
},
|
|
697
|
+
foregroundImageBorderRadius: {
|
|
698
|
+
get() {
|
|
699
|
+
return this.useDynamicSize ? (this.dynamicSize / this.size) * v : v
|
|
700
|
+
},
|
|
701
|
+
set(o) {
|
|
702
|
+
v = Number(o)
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
foregroundImageShadowOffsetX: {
|
|
706
|
+
get() {
|
|
707
|
+
return this.useDynamicSize ? (this.dynamicSize / this.size) * p : p
|
|
708
|
+
},
|
|
709
|
+
set(o) {
|
|
710
|
+
p = Number(o)
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
foregroundImageShadowOffsetY: {
|
|
714
|
+
get() {
|
|
715
|
+
return this.useDynamicSize ? (this.dynamicSize / this.size) * k : k
|
|
716
|
+
},
|
|
717
|
+
set(o) {
|
|
718
|
+
k = Number(o)
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
foregroundImageShadowBlur: {
|
|
722
|
+
get() {
|
|
723
|
+
return this.useDynamicSize ? (this.dynamicSize / this.size) * y : y
|
|
724
|
+
},
|
|
725
|
+
set(o) {
|
|
726
|
+
y = Number(o)
|
|
727
|
+
},
|
|
728
|
+
},
|
|
729
|
+
foregroundPadding: {
|
|
730
|
+
get: () => w,
|
|
731
|
+
set(o) {
|
|
732
|
+
w = o > 1 ? 1 : o < 0 ? 0 : o
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
positionProbeBackgroundColor: {
|
|
736
|
+
get() {
|
|
737
|
+
return I || this.backgroundColor
|
|
738
|
+
},
|
|
739
|
+
set(o) {
|
|
740
|
+
I = o
|
|
741
|
+
},
|
|
742
|
+
},
|
|
743
|
+
positionProbeForegroundColor: {
|
|
744
|
+
get() {
|
|
745
|
+
return B || this.foregroundColor
|
|
746
|
+
},
|
|
747
|
+
set(o) {
|
|
748
|
+
B = o
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
separatorColor: {
|
|
752
|
+
get() {
|
|
753
|
+
return S || this.backgroundColor
|
|
754
|
+
},
|
|
755
|
+
set(o) {
|
|
756
|
+
S = o
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
positionAdjustBackgroundColor: {
|
|
760
|
+
get() {
|
|
761
|
+
return P || this.backgroundColor
|
|
762
|
+
},
|
|
763
|
+
set(o) {
|
|
764
|
+
P = o
|
|
765
|
+
},
|
|
766
|
+
},
|
|
767
|
+
positionAdjustForegroundColor: {
|
|
768
|
+
get() {
|
|
769
|
+
return L || this.foregroundColor
|
|
770
|
+
},
|
|
771
|
+
set(o) {
|
|
772
|
+
L = o
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
timingBackgroundColor: {
|
|
776
|
+
get() {
|
|
777
|
+
return D || this.backgroundColor
|
|
778
|
+
},
|
|
779
|
+
set(o) {
|
|
780
|
+
D = o
|
|
781
|
+
},
|
|
782
|
+
},
|
|
783
|
+
timingForegroundColor: {
|
|
784
|
+
get() {
|
|
785
|
+
return A || this.foregroundColor
|
|
786
|
+
},
|
|
787
|
+
set(o) {
|
|
788
|
+
A = o
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
typeNumberBackgroundColor: {
|
|
792
|
+
get() {
|
|
793
|
+
return E || this.backgroundColor
|
|
794
|
+
},
|
|
795
|
+
set(o) {
|
|
796
|
+
E = o
|
|
797
|
+
},
|
|
798
|
+
},
|
|
799
|
+
typeNumberForegroundColor: {
|
|
800
|
+
get() {
|
|
801
|
+
return T || this.foregroundColor
|
|
802
|
+
},
|
|
803
|
+
set(o) {
|
|
804
|
+
T = o
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
darkBlockColor: {
|
|
808
|
+
get() {
|
|
809
|
+
return N || this.foregroundColor
|
|
810
|
+
},
|
|
811
|
+
set(o) {
|
|
812
|
+
N = o
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
canvasContext: {
|
|
816
|
+
get() {
|
|
817
|
+
if (void 0 === M)
|
|
818
|
+
throw (
|
|
819
|
+
(console.error('[uQRCode]: use drawCanvas, you need to set the canvasContext!'),
|
|
820
|
+
new b.Error('use drawCanvas, you need to set the canvasContext!'))
|
|
821
|
+
)
|
|
822
|
+
return M
|
|
823
|
+
},
|
|
824
|
+
set(o) {
|
|
825
|
+
M = C(o)
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
}),
|
|
829
|
+
b.plugins.forEach((o) => o(b, this, !1)),
|
|
830
|
+
o && this.setOptions(o),
|
|
831
|
+
e && (this.canvasContext = C(e))
|
|
832
|
+
}
|
|
833
|
+
;(f.prototype = {
|
|
834
|
+
get: function (o) {
|
|
835
|
+
return this.num[o]
|
|
836
|
+
},
|
|
837
|
+
getLength: function () {
|
|
838
|
+
return this.num.length
|
|
839
|
+
},
|
|
840
|
+
multiply: function (o) {
|
|
841
|
+
for (var e = new Array(this.getLength() + o.getLength() - 1), r = 0; r < this.getLength(); r++)
|
|
842
|
+
for (let t = 0; t < o.getLength(); t++)
|
|
843
|
+
e[r + t] ^= c.gexp(c.glog(this.get(r)) + c.glog(o.get(t)))
|
|
844
|
+
return new f(e, 0)
|
|
845
|
+
},
|
|
846
|
+
mod: function (o) {
|
|
847
|
+
if (this.getLength() - o.getLength() < 0) return this
|
|
848
|
+
for (
|
|
849
|
+
var e = c.glog(this.get(0)) - c.glog(o.get(0)), r = new Array(this.getLength()), t = 0;
|
|
850
|
+
t < this.getLength();
|
|
851
|
+
t++
|
|
852
|
+
)
|
|
853
|
+
r[t] = this.get(t)
|
|
854
|
+
for (t = 0; t < o.getLength(); t++) r[t] ^= c.gexp(c.glog(o.get(t)) + e)
|
|
855
|
+
return new f(r, 0).mod(o)
|
|
856
|
+
},
|
|
857
|
+
}),
|
|
858
|
+
(v.RS_BLOCK_TABLE = [
|
|
859
|
+
[1, 26, 19],
|
|
860
|
+
[1, 26, 16],
|
|
861
|
+
[1, 26, 13],
|
|
862
|
+
[1, 26, 9],
|
|
863
|
+
[1, 44, 34],
|
|
864
|
+
[1, 44, 28],
|
|
865
|
+
[1, 44, 22],
|
|
866
|
+
[1, 44, 16],
|
|
867
|
+
[1, 70, 55],
|
|
868
|
+
[1, 70, 44],
|
|
869
|
+
[2, 35, 17],
|
|
870
|
+
[2, 35, 13],
|
|
871
|
+
[1, 100, 80],
|
|
872
|
+
[2, 50, 32],
|
|
873
|
+
[2, 50, 24],
|
|
874
|
+
[4, 25, 9],
|
|
875
|
+
[1, 134, 108],
|
|
876
|
+
[2, 67, 43],
|
|
877
|
+
[2, 33, 15, 2, 34, 16],
|
|
878
|
+
[2, 33, 11, 2, 34, 12],
|
|
879
|
+
[2, 86, 68],
|
|
880
|
+
[4, 43, 27],
|
|
881
|
+
[4, 43, 19],
|
|
882
|
+
[4, 43, 15],
|
|
883
|
+
[2, 98, 78],
|
|
884
|
+
[4, 49, 31],
|
|
885
|
+
[2, 32, 14, 4, 33, 15],
|
|
886
|
+
[4, 39, 13, 1, 40, 14],
|
|
887
|
+
[2, 121, 97],
|
|
888
|
+
[2, 60, 38, 2, 61, 39],
|
|
889
|
+
[4, 40, 18, 2, 41, 19],
|
|
890
|
+
[4, 40, 14, 2, 41, 15],
|
|
891
|
+
[2, 146, 116],
|
|
892
|
+
[3, 58, 36, 2, 59, 37],
|
|
893
|
+
[4, 36, 16, 4, 37, 17],
|
|
894
|
+
[4, 36, 12, 4, 37, 13],
|
|
895
|
+
[2, 86, 68, 2, 87, 69],
|
|
896
|
+
[4, 69, 43, 1, 70, 44],
|
|
897
|
+
[6, 43, 19, 2, 44, 20],
|
|
898
|
+
[6, 43, 15, 2, 44, 16],
|
|
899
|
+
[4, 101, 81],
|
|
900
|
+
[1, 80, 50, 4, 81, 51],
|
|
901
|
+
[4, 50, 22, 4, 51, 23],
|
|
902
|
+
[3, 36, 12, 8, 37, 13],
|
|
903
|
+
[2, 116, 92, 2, 117, 93],
|
|
904
|
+
[6, 58, 36, 2, 59, 37],
|
|
905
|
+
[4, 46, 20, 6, 47, 21],
|
|
906
|
+
[7, 42, 14, 4, 43, 15],
|
|
907
|
+
[4, 133, 107],
|
|
908
|
+
[8, 59, 37, 1, 60, 38],
|
|
909
|
+
[8, 44, 20, 4, 45, 21],
|
|
910
|
+
[12, 33, 11, 4, 34, 12],
|
|
911
|
+
[3, 145, 115, 1, 146, 116],
|
|
912
|
+
[4, 64, 40, 5, 65, 41],
|
|
913
|
+
[11, 36, 16, 5, 37, 17],
|
|
914
|
+
[11, 36, 12, 5, 37, 13],
|
|
915
|
+
[5, 109, 87, 1, 110, 88],
|
|
916
|
+
[5, 65, 41, 5, 66, 42],
|
|
917
|
+
[5, 54, 24, 7, 55, 25],
|
|
918
|
+
[11, 36, 12],
|
|
919
|
+
[5, 122, 98, 1, 123, 99],
|
|
920
|
+
[7, 73, 45, 3, 74, 46],
|
|
921
|
+
[15, 43, 19, 2, 44, 20],
|
|
922
|
+
[3, 45, 15, 13, 46, 16],
|
|
923
|
+
[1, 135, 107, 5, 136, 108],
|
|
924
|
+
[10, 74, 46, 1, 75, 47],
|
|
925
|
+
[1, 50, 22, 15, 51, 23],
|
|
926
|
+
[2, 42, 14, 17, 43, 15],
|
|
927
|
+
[5, 150, 120, 1, 151, 121],
|
|
928
|
+
[9, 69, 43, 4, 70, 44],
|
|
929
|
+
[17, 50, 22, 1, 51, 23],
|
|
930
|
+
[2, 42, 14, 19, 43, 15],
|
|
931
|
+
[3, 141, 113, 4, 142, 114],
|
|
932
|
+
[3, 70, 44, 11, 71, 45],
|
|
933
|
+
[17, 47, 21, 4, 48, 22],
|
|
934
|
+
[9, 39, 13, 16, 40, 14],
|
|
935
|
+
[3, 135, 107, 5, 136, 108],
|
|
936
|
+
[3, 67, 41, 13, 68, 42],
|
|
937
|
+
[15, 54, 24, 5, 55, 25],
|
|
938
|
+
[15, 43, 15, 10, 44, 16],
|
|
939
|
+
[4, 144, 116, 4, 145, 117],
|
|
940
|
+
[17, 68, 42],
|
|
941
|
+
[17, 50, 22, 6, 51, 23],
|
|
942
|
+
[19, 46, 16, 6, 47, 17],
|
|
943
|
+
[2, 139, 111, 7, 140, 112],
|
|
944
|
+
[17, 74, 46],
|
|
945
|
+
[7, 54, 24, 16, 55, 25],
|
|
946
|
+
[34, 37, 13],
|
|
947
|
+
[4, 151, 121, 5, 152, 122],
|
|
948
|
+
[4, 75, 47, 14, 76, 48],
|
|
949
|
+
[11, 54, 24, 14, 55, 25],
|
|
950
|
+
[16, 45, 15, 14, 46, 16],
|
|
951
|
+
[6, 147, 117, 4, 148, 118],
|
|
952
|
+
[6, 73, 45, 14, 74, 46],
|
|
953
|
+
[11, 54, 24, 16, 55, 25],
|
|
954
|
+
[30, 46, 16, 2, 47, 17],
|
|
955
|
+
[8, 132, 106, 4, 133, 107],
|
|
956
|
+
[8, 75, 47, 13, 76, 48],
|
|
957
|
+
[7, 54, 24, 22, 55, 25],
|
|
958
|
+
[22, 45, 15, 13, 46, 16],
|
|
959
|
+
[10, 142, 114, 2, 143, 115],
|
|
960
|
+
[19, 74, 46, 4, 75, 47],
|
|
961
|
+
[28, 50, 22, 6, 51, 23],
|
|
962
|
+
[33, 46, 16, 4, 47, 17],
|
|
963
|
+
[8, 152, 122, 4, 153, 123],
|
|
964
|
+
[22, 73, 45, 3, 74, 46],
|
|
965
|
+
[8, 53, 23, 26, 54, 24],
|
|
966
|
+
[12, 45, 15, 28, 46, 16],
|
|
967
|
+
[3, 147, 117, 10, 148, 118],
|
|
968
|
+
[3, 73, 45, 23, 74, 46],
|
|
969
|
+
[4, 54, 24, 31, 55, 25],
|
|
970
|
+
[11, 45, 15, 31, 46, 16],
|
|
971
|
+
[7, 146, 116, 7, 147, 117],
|
|
972
|
+
[21, 73, 45, 7, 74, 46],
|
|
973
|
+
[1, 53, 23, 37, 54, 24],
|
|
974
|
+
[19, 45, 15, 26, 46, 16],
|
|
975
|
+
[5, 145, 115, 10, 146, 116],
|
|
976
|
+
[19, 75, 47, 10, 76, 48],
|
|
977
|
+
[15, 54, 24, 25, 55, 25],
|
|
978
|
+
[23, 45, 15, 25, 46, 16],
|
|
979
|
+
[13, 145, 115, 3, 146, 116],
|
|
980
|
+
[2, 74, 46, 29, 75, 47],
|
|
981
|
+
[42, 54, 24, 1, 55, 25],
|
|
982
|
+
[23, 45, 15, 28, 46, 16],
|
|
983
|
+
[17, 145, 115],
|
|
984
|
+
[10, 74, 46, 23, 75, 47],
|
|
985
|
+
[10, 54, 24, 35, 55, 25],
|
|
986
|
+
[19, 45, 15, 35, 46, 16],
|
|
987
|
+
[17, 145, 115, 1, 146, 116],
|
|
988
|
+
[14, 74, 46, 21, 75, 47],
|
|
989
|
+
[29, 54, 24, 19, 55, 25],
|
|
990
|
+
[11, 45, 15, 46, 46, 16],
|
|
991
|
+
[13, 145, 115, 6, 146, 116],
|
|
992
|
+
[14, 74, 46, 23, 75, 47],
|
|
993
|
+
[44, 54, 24, 7, 55, 25],
|
|
994
|
+
[59, 46, 16, 1, 47, 17],
|
|
995
|
+
[12, 151, 121, 7, 152, 122],
|
|
996
|
+
[12, 75, 47, 26, 76, 48],
|
|
997
|
+
[39, 54, 24, 14, 55, 25],
|
|
998
|
+
[22, 45, 15, 41, 46, 16],
|
|
999
|
+
[6, 151, 121, 14, 152, 122],
|
|
1000
|
+
[6, 75, 47, 34, 76, 48],
|
|
1001
|
+
[46, 54, 24, 10, 55, 25],
|
|
1002
|
+
[2, 45, 15, 64, 46, 16],
|
|
1003
|
+
[17, 152, 122, 4, 153, 123],
|
|
1004
|
+
[29, 74, 46, 14, 75, 47],
|
|
1005
|
+
[49, 54, 24, 10, 55, 25],
|
|
1006
|
+
[24, 45, 15, 46, 46, 16],
|
|
1007
|
+
[4, 152, 122, 18, 153, 123],
|
|
1008
|
+
[13, 74, 46, 32, 75, 47],
|
|
1009
|
+
[48, 54, 24, 14, 55, 25],
|
|
1010
|
+
[42, 45, 15, 32, 46, 16],
|
|
1011
|
+
[20, 147, 117, 4, 148, 118],
|
|
1012
|
+
[40, 75, 47, 7, 76, 48],
|
|
1013
|
+
[43, 54, 24, 22, 55, 25],
|
|
1014
|
+
[10, 45, 15, 67, 46, 16],
|
|
1015
|
+
[19, 148, 118, 6, 149, 119],
|
|
1016
|
+
[18, 75, 47, 31, 76, 48],
|
|
1017
|
+
[34, 54, 24, 34, 55, 25],
|
|
1018
|
+
[20, 45, 15, 61, 46, 16],
|
|
1019
|
+
]),
|
|
1020
|
+
(v.getRSBlocks = function (o, e) {
|
|
1021
|
+
const r = v.getRsBlockTable(o, e)
|
|
1022
|
+
if (r == null) throw new Error('bad rs block @ typeNumber:' + o + '/errorCorrectLevel:' + e)
|
|
1023
|
+
for (var t = r.length / 3, i = [], n = 0; n < t; n++)
|
|
1024
|
+
for (let a = r[3 * n + 0], d = r[3 * n + 1], u = r[3 * n + 2], s = 0; s < a; s++)
|
|
1025
|
+
i.push(new v(d, u))
|
|
1026
|
+
return i
|
|
1027
|
+
}),
|
|
1028
|
+
(v.getRsBlockTable = function (o, e) {
|
|
1029
|
+
switch (e) {
|
|
1030
|
+
case t.L:
|
|
1031
|
+
return v.RS_BLOCK_TABLE[4 * (o - 1) + 0]
|
|
1032
|
+
case t.M:
|
|
1033
|
+
return v.RS_BLOCK_TABLE[4 * (o - 1) + 1]
|
|
1034
|
+
case t.Q:
|
|
1035
|
+
return v.RS_BLOCK_TABLE[4 * (o - 1) + 2]
|
|
1036
|
+
case t.H:
|
|
1037
|
+
return v.RS_BLOCK_TABLE[4 * (o - 1) + 3]
|
|
1038
|
+
default:
|
|
1039
|
+
}
|
|
1040
|
+
}),
|
|
1041
|
+
(p.prototype = {
|
|
1042
|
+
get: function (o) {
|
|
1043
|
+
const e = Math.floor(o / 8)
|
|
1044
|
+
return ((this.buffer[e] >>> (7 - (o % 8))) & 1) == 1
|
|
1045
|
+
},
|
|
1046
|
+
put: function (o, e) {
|
|
1047
|
+
for (let r = 0; r < e; r++) this.putBit(((o >>> (e - r - 1)) & 1) == 1)
|
|
1048
|
+
},
|
|
1049
|
+
getLengthInBits: function () {
|
|
1050
|
+
return this.length
|
|
1051
|
+
},
|
|
1052
|
+
putBit: function (o) {
|
|
1053
|
+
const e = Math.floor(this.length / 8)
|
|
1054
|
+
this.buffer.length <= e && this.buffer.push(0),
|
|
1055
|
+
o && (this.buffer[e] |= 128 >>> this.length % 8),
|
|
1056
|
+
this.length++
|
|
1057
|
+
},
|
|
1058
|
+
}),
|
|
1059
|
+
(e.errorCorrectLevel = t),
|
|
1060
|
+
(b.errorCorrectLevel = e.errorCorrectLevel),
|
|
1061
|
+
(b.Error = function (o) {
|
|
1062
|
+
this.errMsg = '[uQRCode]: ' + o
|
|
1063
|
+
}),
|
|
1064
|
+
(b.plugins = []),
|
|
1065
|
+
(b.use = function (o) {
|
|
1066
|
+
typeof o === 'function' && b.plugins.push(o)
|
|
1067
|
+
}),
|
|
1068
|
+
(b.prototype.loadImage = function (o) {
|
|
1069
|
+
return Promise.resolve(o)
|
|
1070
|
+
}),
|
|
1071
|
+
(b.prototype.setOptions = function (o) {
|
|
1072
|
+
let e,
|
|
1073
|
+
r,
|
|
1074
|
+
t,
|
|
1075
|
+
i,
|
|
1076
|
+
n,
|
|
1077
|
+
a,
|
|
1078
|
+
d,
|
|
1079
|
+
u,
|
|
1080
|
+
s,
|
|
1081
|
+
g,
|
|
1082
|
+
l,
|
|
1083
|
+
h,
|
|
1084
|
+
c,
|
|
1085
|
+
m,
|
|
1086
|
+
f,
|
|
1087
|
+
v,
|
|
1088
|
+
p,
|
|
1089
|
+
C,
|
|
1090
|
+
b,
|
|
1091
|
+
k,
|
|
1092
|
+
y,
|
|
1093
|
+
w,
|
|
1094
|
+
I,
|
|
1095
|
+
B,
|
|
1096
|
+
S,
|
|
1097
|
+
P,
|
|
1098
|
+
L,
|
|
1099
|
+
D,
|
|
1100
|
+
A,
|
|
1101
|
+
E,
|
|
1102
|
+
T,
|
|
1103
|
+
N,
|
|
1104
|
+
M,
|
|
1105
|
+
z,
|
|
1106
|
+
R,
|
|
1107
|
+
_,
|
|
1108
|
+
O,
|
|
1109
|
+
F,
|
|
1110
|
+
x,
|
|
1111
|
+
H,
|
|
1112
|
+
X,
|
|
1113
|
+
Y,
|
|
1114
|
+
j,
|
|
1115
|
+
W,
|
|
1116
|
+
G,
|
|
1117
|
+
K,
|
|
1118
|
+
Q,
|
|
1119
|
+
U,
|
|
1120
|
+
$,
|
|
1121
|
+
J,
|
|
1122
|
+
q,
|
|
1123
|
+
V,
|
|
1124
|
+
Z,
|
|
1125
|
+
oo,
|
|
1126
|
+
eo,
|
|
1127
|
+
ro
|
|
1128
|
+
o &&
|
|
1129
|
+
(Object.keys(o).forEach((e) => {
|
|
1130
|
+
this[e] = o[e]
|
|
1131
|
+
}),
|
|
1132
|
+
(function (o = {}, e = {}, r = !1) {
|
|
1133
|
+
let t
|
|
1134
|
+
t = r ? o : { ...o }
|
|
1135
|
+
for (const o in e) {
|
|
1136
|
+
const i = e[o]
|
|
1137
|
+
i != null &&
|
|
1138
|
+
(i.constructor == Object
|
|
1139
|
+
? (t[o] = this.deepReplace(t[o], i))
|
|
1140
|
+
: i.constructor != String || i
|
|
1141
|
+
? (t[o] = i)
|
|
1142
|
+
: (t[o] = t[o]))
|
|
1143
|
+
}
|
|
1144
|
+
})(
|
|
1145
|
+
this,
|
|
1146
|
+
{
|
|
1147
|
+
data: o.data || o.text,
|
|
1148
|
+
size: o.size,
|
|
1149
|
+
useDynamicSize: o.useDynamicSize,
|
|
1150
|
+
typeNumber: o.typeNumber,
|
|
1151
|
+
errorCorrectLevel: o.errorCorrectLevel,
|
|
1152
|
+
margin: o.margin,
|
|
1153
|
+
areaColor: o.areaColor,
|
|
1154
|
+
backgroundColor:
|
|
1155
|
+
o.backgroundColor || ((e = o.background) === null || void 0 === e ? void 0 : e.color),
|
|
1156
|
+
backgroundImageSrc:
|
|
1157
|
+
o.backgroundImageSrc ||
|
|
1158
|
+
((r = o.background) === null || void 0 === r || (t = r.image) === null || void 0 === t
|
|
1159
|
+
? void 0
|
|
1160
|
+
: t.src),
|
|
1161
|
+
backgroundImageWidth:
|
|
1162
|
+
o.backgroundImageWidth ||
|
|
1163
|
+
((i = o.background) === null || void 0 === i || (n = i.image) === null || void 0 === n
|
|
1164
|
+
? void 0
|
|
1165
|
+
: n.width),
|
|
1166
|
+
backgroundImageHeight:
|
|
1167
|
+
o.backgroundImageHeight ||
|
|
1168
|
+
((a = o.background) === null || void 0 === a || (d = a.image) === null || void 0 === d
|
|
1169
|
+
? void 0
|
|
1170
|
+
: d.height),
|
|
1171
|
+
backgroundImageX:
|
|
1172
|
+
o.backgroundImageX ||
|
|
1173
|
+
((u = o.background) === null || void 0 === u || (s = u.image) === null || void 0 === s
|
|
1174
|
+
? void 0
|
|
1175
|
+
: s.x),
|
|
1176
|
+
backgroundImageY:
|
|
1177
|
+
o.backgroundImageY ||
|
|
1178
|
+
((g = o.background) === null || void 0 === g || (l = g.image) === null || void 0 === l
|
|
1179
|
+
? void 0
|
|
1180
|
+
: l.y),
|
|
1181
|
+
backgroundImageAlpha:
|
|
1182
|
+
o.backgroundImageAlpha ||
|
|
1183
|
+
((h = o.background) === null || void 0 === h || (c = h.image) === null || void 0 === c
|
|
1184
|
+
? void 0
|
|
1185
|
+
: c.alpha),
|
|
1186
|
+
backgroundImageBorderRadius:
|
|
1187
|
+
o.backgroundImageBorderRadius ||
|
|
1188
|
+
((m = o.background) === null || void 0 === m || (f = m.image) === null || void 0 === f
|
|
1189
|
+
? void 0
|
|
1190
|
+
: f.borderRadius),
|
|
1191
|
+
backgroundPadding: o.backgroundPadding,
|
|
1192
|
+
foregroundColor:
|
|
1193
|
+
o.foregroundColor || ((v = o.foreground) === null || void 0 === v ? void 0 : v.color),
|
|
1194
|
+
foregroundImageSrc:
|
|
1195
|
+
o.foregroundImageSrc ||
|
|
1196
|
+
((p = o.foreground) === null || void 0 === p || (C = p.image) === null || void 0 === C
|
|
1197
|
+
? void 0
|
|
1198
|
+
: C.src),
|
|
1199
|
+
foregroundImageWidth:
|
|
1200
|
+
o.foregroundImageWidth ||
|
|
1201
|
+
((b = o.foreground) === null || void 0 === b || (k = b.image) === null || void 0 === k
|
|
1202
|
+
? void 0
|
|
1203
|
+
: k.width),
|
|
1204
|
+
foregroundImageHeight:
|
|
1205
|
+
o.foregroundImageHeight ||
|
|
1206
|
+
((y = o.foreground) === null || void 0 === y || (w = y.image) === null || void 0 === w
|
|
1207
|
+
? void 0
|
|
1208
|
+
: w.height),
|
|
1209
|
+
foregroundImageX:
|
|
1210
|
+
o.foregroundImageX ||
|
|
1211
|
+
((I = o.foreground) === null || void 0 === I || (B = I.image) === null || void 0 === B
|
|
1212
|
+
? void 0
|
|
1213
|
+
: B.x),
|
|
1214
|
+
foregroundImageY:
|
|
1215
|
+
o.foregroundImageY ||
|
|
1216
|
+
((S = o.foreground) === null || void 0 === S || (P = S.image) === null || void 0 === P
|
|
1217
|
+
? void 0
|
|
1218
|
+
: P.y),
|
|
1219
|
+
foregroundImagePadding:
|
|
1220
|
+
o.foregroundImagePadding ||
|
|
1221
|
+
((L = o.foreground) === null || void 0 === L || (D = L.image) === null || void 0 === D
|
|
1222
|
+
? void 0
|
|
1223
|
+
: D.padding),
|
|
1224
|
+
foregroundImageBackgroundColor:
|
|
1225
|
+
o.foregroundImageBackgroundColor ||
|
|
1226
|
+
((A = o.foreground) === null || void 0 === A || (E = A.image) === null || void 0 === E
|
|
1227
|
+
? void 0
|
|
1228
|
+
: E.backgroundColor),
|
|
1229
|
+
foregroundImageBorderRadius:
|
|
1230
|
+
o.foregroundImageBorderRadius ||
|
|
1231
|
+
((T = o.foreground) === null || void 0 === T || (N = T.image) === null || void 0 === N
|
|
1232
|
+
? void 0
|
|
1233
|
+
: N.borderRadius),
|
|
1234
|
+
foregroundImageShadowOffsetX:
|
|
1235
|
+
o.foregroundImageShadowOffsetX ||
|
|
1236
|
+
((M = o.foreground) === null || void 0 === M || (z = M.image) === null || void 0 === z
|
|
1237
|
+
? void 0
|
|
1238
|
+
: z.shadowOffsetX),
|
|
1239
|
+
foregroundImageShadowOffsetY:
|
|
1240
|
+
o.foregroundImageShadowOffsetY ||
|
|
1241
|
+
((R = o.foreground) === null || void 0 === R || (_ = R.image) === null || void 0 === _
|
|
1242
|
+
? void 0
|
|
1243
|
+
: _.shadowOffsetY),
|
|
1244
|
+
foregroundImageShadowBlur:
|
|
1245
|
+
o.foregroundImageShadowBlur ||
|
|
1246
|
+
((O = o.foreground) === null || void 0 === O || (F = O.image) === null || void 0 === F
|
|
1247
|
+
? void 0
|
|
1248
|
+
: F.shadowBlur),
|
|
1249
|
+
foregroundImageShadowColor:
|
|
1250
|
+
o.foregroundImageShadowColor ||
|
|
1251
|
+
((x = o.foreground) === null || void 0 === x || (H = x.image) === null || void 0 === H
|
|
1252
|
+
? void 0
|
|
1253
|
+
: H.shadowColor),
|
|
1254
|
+
foregroundPadding: o.foregroundPadding,
|
|
1255
|
+
positionProbeBackgroundColor:
|
|
1256
|
+
o.positionProbeBackgroundColor ||
|
|
1257
|
+
((X = o.positionProbe) === null || void 0 === X ? void 0 : X.backgroundColor) ||
|
|
1258
|
+
((Y = o.positionDetection) === null || void 0 === Y ? void 0 : Y.backgroundColor),
|
|
1259
|
+
positionProbeForegroundColor:
|
|
1260
|
+
o.positionProbeForegroundColor ||
|
|
1261
|
+
((j = o.positionProbe) === null || void 0 === j ? void 0 : j.foregroundColor) ||
|
|
1262
|
+
((W = o.positionDetection) === null || void 0 === W ? void 0 : W.foregroundColor),
|
|
1263
|
+
separatorColor:
|
|
1264
|
+
o.separatorColor || ((G = o.separator) === null || void 0 === G ? void 0 : G.color),
|
|
1265
|
+
positionAdjustBackgroundColor:
|
|
1266
|
+
o.positionAdjustBackgroundColor ||
|
|
1267
|
+
((K = o.positionAdjust) === null || void 0 === K ? void 0 : K.backgroundColor) ||
|
|
1268
|
+
((Q = o.alignment) === null || void 0 === Q ? void 0 : Q.backgroundColor),
|
|
1269
|
+
positionAdjustForegroundColor:
|
|
1270
|
+
o.positionAdjustForegroundColor ||
|
|
1271
|
+
((U = o.positionAdjust) === null || void 0 === U ? void 0 : U.foregroundColor) ||
|
|
1272
|
+
(($ = o.alignment) === null || void 0 === $ ? void 0 : $.foregroundColor),
|
|
1273
|
+
timingBackgroundColor:
|
|
1274
|
+
o.timingBackgroundColor ||
|
|
1275
|
+
((J = o.timing) === null || void 0 === J ? void 0 : J.backgroundColor),
|
|
1276
|
+
timingForegroundColor:
|
|
1277
|
+
o.timingForegroundColor ||
|
|
1278
|
+
((q = o.timing) === null || void 0 === q ? void 0 : q.foregroundColor),
|
|
1279
|
+
typeNumberBackgroundColor:
|
|
1280
|
+
o.typeNumberBackgroundColor ||
|
|
1281
|
+
((V = o.typeNumber) === null || void 0 === V ? void 0 : V.backgroundColor) ||
|
|
1282
|
+
((Z = o.versionInformation) === null || void 0 === Z ? void 0 : Z.backgroundColor),
|
|
1283
|
+
typeNumberForegroundColor:
|
|
1284
|
+
o.typeNumberForegroundColor ||
|
|
1285
|
+
((oo = o.typeNumber) === null || void 0 === oo ? void 0 : oo.foregroundColor) ||
|
|
1286
|
+
((eo = o.versionInformation) === null || void 0 === eo ? void 0 : eo.foregroundColor),
|
|
1287
|
+
darkBlockColor:
|
|
1288
|
+
o.darkBlockColor || ((ro = o.darkBlock) === null || void 0 === ro ? void 0 : ro.color),
|
|
1289
|
+
},
|
|
1290
|
+
!0,
|
|
1291
|
+
))
|
|
1292
|
+
}),
|
|
1293
|
+
(b.prototype.make = function () {
|
|
1294
|
+
const {
|
|
1295
|
+
foregroundColor: o,
|
|
1296
|
+
backgroundColor: r,
|
|
1297
|
+
typeNumber: t,
|
|
1298
|
+
errorCorrectLevel: i,
|
|
1299
|
+
data: n,
|
|
1300
|
+
size: a,
|
|
1301
|
+
margin: d,
|
|
1302
|
+
useDynamicSize: u,
|
|
1303
|
+
} = this
|
|
1304
|
+
if (o === r)
|
|
1305
|
+
throw (
|
|
1306
|
+
(console.error('[uQRCode]: foregroundColor and backgroundColor cannot be the same!'),
|
|
1307
|
+
new b.Error('foregroundColor and backgroundColor cannot be the same!'))
|
|
1308
|
+
)
|
|
1309
|
+
const s = new e(t, i)
|
|
1310
|
+
s.addData(
|
|
1311
|
+
(function (o) {
|
|
1312
|
+
o = o.toString()
|
|
1313
|
+
for (var e, r = '', t = 0; t < o.length; t++)
|
|
1314
|
+
(e = o.charCodeAt(t)) >= 1 && e <= 127
|
|
1315
|
+
? (r += o.charAt(t))
|
|
1316
|
+
: e > 2047
|
|
1317
|
+
? ((r += String.fromCharCode(224 | ((e >> 12) & 15))),
|
|
1318
|
+
(r += String.fromCharCode(128 | ((e >> 6) & 63))),
|
|
1319
|
+
(r += String.fromCharCode(128 | ((e >> 0) & 63))))
|
|
1320
|
+
: ((r += String.fromCharCode(192 | ((e >> 6) & 31))),
|
|
1321
|
+
(r += String.fromCharCode(128 | ((e >> 0) & 63))))
|
|
1322
|
+
return r
|
|
1323
|
+
})(n),
|
|
1324
|
+
),
|
|
1325
|
+
s.make(),
|
|
1326
|
+
(this.base = s),
|
|
1327
|
+
(this.typeNumber = s.typeNumber),
|
|
1328
|
+
(this.modules = s.modules),
|
|
1329
|
+
(this.moduleCount = s.moduleCount),
|
|
1330
|
+
(this.dynamicSize = u ? Math.ceil((a - 2 * d) / s.moduleCount) * s.moduleCount + 2 * d : a),
|
|
1331
|
+
(function (o) {
|
|
1332
|
+
const {
|
|
1333
|
+
dynamicSize: e,
|
|
1334
|
+
margin: r,
|
|
1335
|
+
backgroundColor: t,
|
|
1336
|
+
backgroundPadding: i,
|
|
1337
|
+
foregroundColor: n,
|
|
1338
|
+
foregroundPadding: a,
|
|
1339
|
+
modules: d,
|
|
1340
|
+
moduleCount: u,
|
|
1341
|
+
} = o
|
|
1342
|
+
const s = (e - 2 * r) / u
|
|
1343
|
+
let g = s
|
|
1344
|
+
let l = 0
|
|
1345
|
+
i > 0 && ((l = (g * i) / 2), (g -= 2 * l))
|
|
1346
|
+
let h = s
|
|
1347
|
+
let c = 0
|
|
1348
|
+
a > 0 && ((c = (h * a) / 2), (h -= 2 * c))
|
|
1349
|
+
for (let m = 0; m < u; m++)
|
|
1350
|
+
for (let f = 0; f < u; f++) {
|
|
1351
|
+
const v = f * s + r
|
|
1352
|
+
const p = m * s + r
|
|
1353
|
+
if (d[m][f]) {
|
|
1354
|
+
var C = c
|
|
1355
|
+
var b = v + c
|
|
1356
|
+
var k = p + c
|
|
1357
|
+
var y = h
|
|
1358
|
+
var w = h
|
|
1359
|
+
d[m][f] = {
|
|
1360
|
+
type: ['foreground'],
|
|
1361
|
+
color: n,
|
|
1362
|
+
isBlack: !0,
|
|
1363
|
+
isDrawn: !1,
|
|
1364
|
+
destX: v,
|
|
1365
|
+
destY: p,
|
|
1366
|
+
destWidth: s,
|
|
1367
|
+
destHeight: s,
|
|
1368
|
+
x: b,
|
|
1369
|
+
y: k,
|
|
1370
|
+
width: y,
|
|
1371
|
+
height: w,
|
|
1372
|
+
paddingTop: C,
|
|
1373
|
+
paddingRight: C,
|
|
1374
|
+
paddingBottom: C,
|
|
1375
|
+
paddingLeft: C,
|
|
1376
|
+
}
|
|
1377
|
+
} else
|
|
1378
|
+
(C = l),
|
|
1379
|
+
(b = v + l),
|
|
1380
|
+
(k = p + l),
|
|
1381
|
+
(y = g),
|
|
1382
|
+
(w = g),
|
|
1383
|
+
(d[m][f] = {
|
|
1384
|
+
type: ['background'],
|
|
1385
|
+
color: t,
|
|
1386
|
+
isBlack: !1,
|
|
1387
|
+
isDrawn: !1,
|
|
1388
|
+
destX: v,
|
|
1389
|
+
destY: p,
|
|
1390
|
+
destWidth: s,
|
|
1391
|
+
destHeight: s,
|
|
1392
|
+
x: b,
|
|
1393
|
+
y: k,
|
|
1394
|
+
width: y,
|
|
1395
|
+
height: w,
|
|
1396
|
+
paddingTop: C,
|
|
1397
|
+
paddingRight: C,
|
|
1398
|
+
paddingBottom: C,
|
|
1399
|
+
paddingLeft: C,
|
|
1400
|
+
})
|
|
1401
|
+
}
|
|
1402
|
+
})(this),
|
|
1403
|
+
(function (o) {
|
|
1404
|
+
const {
|
|
1405
|
+
modules: e,
|
|
1406
|
+
moduleCount: r,
|
|
1407
|
+
positionProbeBackgroundColor: t,
|
|
1408
|
+
positionProbeForegroundColor: i,
|
|
1409
|
+
} = o
|
|
1410
|
+
const n = r - 7
|
|
1411
|
+
;[
|
|
1412
|
+
[0, 0, 1],
|
|
1413
|
+
[1, 0, 1],
|
|
1414
|
+
[2, 0, 1],
|
|
1415
|
+
[3, 0, 1],
|
|
1416
|
+
[4, 0, 1],
|
|
1417
|
+
[5, 0, 1],
|
|
1418
|
+
[6, 0, 1],
|
|
1419
|
+
[0, 1, 1],
|
|
1420
|
+
[1, 1, 0],
|
|
1421
|
+
[2, 1, 0],
|
|
1422
|
+
[3, 1, 0],
|
|
1423
|
+
[4, 1, 0],
|
|
1424
|
+
[5, 1, 0],
|
|
1425
|
+
[6, 1, 1],
|
|
1426
|
+
[0, 2, 1],
|
|
1427
|
+
[1, 2, 0],
|
|
1428
|
+
[2, 2, 1],
|
|
1429
|
+
[3, 2, 1],
|
|
1430
|
+
[4, 2, 1],
|
|
1431
|
+
[5, 2, 0],
|
|
1432
|
+
[6, 2, 1],
|
|
1433
|
+
[0, 3, 1],
|
|
1434
|
+
[1, 3, 0],
|
|
1435
|
+
[2, 3, 1],
|
|
1436
|
+
[3, 3, 1],
|
|
1437
|
+
[4, 3, 1],
|
|
1438
|
+
[5, 3, 0],
|
|
1439
|
+
[6, 3, 1],
|
|
1440
|
+
[0, 4, 1],
|
|
1441
|
+
[1, 4, 0],
|
|
1442
|
+
[2, 4, 1],
|
|
1443
|
+
[3, 4, 1],
|
|
1444
|
+
[4, 4, 1],
|
|
1445
|
+
[5, 4, 0],
|
|
1446
|
+
[6, 4, 1],
|
|
1447
|
+
[0, 5, 1],
|
|
1448
|
+
[1, 5, 0],
|
|
1449
|
+
[2, 5, 0],
|
|
1450
|
+
[3, 5, 0],
|
|
1451
|
+
[4, 5, 0],
|
|
1452
|
+
[5, 5, 0],
|
|
1453
|
+
[6, 5, 1],
|
|
1454
|
+
[0, 6, 1],
|
|
1455
|
+
[1, 6, 1],
|
|
1456
|
+
[2, 6, 1],
|
|
1457
|
+
[3, 6, 1],
|
|
1458
|
+
[4, 6, 1],
|
|
1459
|
+
[5, 6, 1],
|
|
1460
|
+
[6, 6, 1],
|
|
1461
|
+
].forEach((o) => {
|
|
1462
|
+
const r = e[o[0]][o[1]]
|
|
1463
|
+
const a = e[o[0] + n][o[1]]
|
|
1464
|
+
const d = e[o[0]][o[1] + n]
|
|
1465
|
+
d.type.push('positionProbe'),
|
|
1466
|
+
a.type.push('positionProbe'),
|
|
1467
|
+
r.type.push('positionProbe'),
|
|
1468
|
+
(r.color = o[2] == 1 ? i : t),
|
|
1469
|
+
(a.color = o[2] == 1 ? i : t),
|
|
1470
|
+
(d.color = o[2] == 1 ? i : t)
|
|
1471
|
+
})
|
|
1472
|
+
})(this),
|
|
1473
|
+
(function (o) {
|
|
1474
|
+
const { modules: e, moduleCount: r, separatorColor: t } = o
|
|
1475
|
+
;[
|
|
1476
|
+
[7, 0],
|
|
1477
|
+
[7, 1],
|
|
1478
|
+
[7, 2],
|
|
1479
|
+
[7, 3],
|
|
1480
|
+
[7, 4],
|
|
1481
|
+
[7, 5],
|
|
1482
|
+
[7, 6],
|
|
1483
|
+
[7, 7],
|
|
1484
|
+
[0, 7],
|
|
1485
|
+
[1, 7],
|
|
1486
|
+
[2, 7],
|
|
1487
|
+
[3, 7],
|
|
1488
|
+
[4, 7],
|
|
1489
|
+
[5, 7],
|
|
1490
|
+
[6, 7],
|
|
1491
|
+
].forEach((o) => {
|
|
1492
|
+
const i = e[o[0]][o[1]]
|
|
1493
|
+
const n = e[r - o[0] - 1][o[1]]
|
|
1494
|
+
const a = e[o[0]][r - o[1] - 1]
|
|
1495
|
+
a.type.push('separator'),
|
|
1496
|
+
n.type.push('separator'),
|
|
1497
|
+
i.type.push('separator'),
|
|
1498
|
+
(i.color = t),
|
|
1499
|
+
(n.color = t),
|
|
1500
|
+
(a.color = t)
|
|
1501
|
+
})
|
|
1502
|
+
})(this),
|
|
1503
|
+
(function (o) {
|
|
1504
|
+
const {
|
|
1505
|
+
typeNumber: e,
|
|
1506
|
+
modules: r,
|
|
1507
|
+
moduleCount: t,
|
|
1508
|
+
foregroundColor: i,
|
|
1509
|
+
backgroundColor: n,
|
|
1510
|
+
positionAdjustForegroundColor: a,
|
|
1511
|
+
positionAdjustBackgroundColor: d,
|
|
1512
|
+
timingForegroundColor: u,
|
|
1513
|
+
timingBackgroundColor: s,
|
|
1514
|
+
} = o
|
|
1515
|
+
const g = [
|
|
1516
|
+
[],
|
|
1517
|
+
[6, 18],
|
|
1518
|
+
[6, 22],
|
|
1519
|
+
[6, 26],
|
|
1520
|
+
[6, 30],
|
|
1521
|
+
[6, 34],
|
|
1522
|
+
[6, 22, 38],
|
|
1523
|
+
[6, 24, 42],
|
|
1524
|
+
[6, 26, 46],
|
|
1525
|
+
[6, 28, 50],
|
|
1526
|
+
[6, 30, 54],
|
|
1527
|
+
[6, 32, 58],
|
|
1528
|
+
[6, 34, 62],
|
|
1529
|
+
[6, 26, 46, 66],
|
|
1530
|
+
[6, 26, 48, 70],
|
|
1531
|
+
[6, 26, 50, 74],
|
|
1532
|
+
[6, 30, 54, 78],
|
|
1533
|
+
[6, 30, 56, 82],
|
|
1534
|
+
[6, 30, 58, 86],
|
|
1535
|
+
[6, 34, 62, 90],
|
|
1536
|
+
[6, 28, 50, 72, 94],
|
|
1537
|
+
[6, 26, 50, 74, 98],
|
|
1538
|
+
[6, 30, 54, 78, 102],
|
|
1539
|
+
[6, 28, 54, 80, 106],
|
|
1540
|
+
[6, 32, 58, 84, 110],
|
|
1541
|
+
[6, 30, 58, 86, 114],
|
|
1542
|
+
[6, 34, 62, 90, 118],
|
|
1543
|
+
[6, 26, 50, 74, 98, 122],
|
|
1544
|
+
[6, 30, 54, 78, 102, 126],
|
|
1545
|
+
[6, 26, 52, 78, 104, 130],
|
|
1546
|
+
[6, 30, 56, 82, 108, 134],
|
|
1547
|
+
[6, 34, 60, 86, 112, 138],
|
|
1548
|
+
[6, 30, 58, 86, 114, 142],
|
|
1549
|
+
[6, 34, 62, 90, 118, 146],
|
|
1550
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
1551
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
1552
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
1553
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
1554
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
1555
|
+
[6, 30, 58, 86, 114, 142, 170],
|
|
1556
|
+
][e - 1]
|
|
1557
|
+
if (g) {
|
|
1558
|
+
const o = [
|
|
1559
|
+
[-2, -2, 1],
|
|
1560
|
+
[-1, -2, 1],
|
|
1561
|
+
[0, -2, 1],
|
|
1562
|
+
[1, -2, 1],
|
|
1563
|
+
[2, -2, 1],
|
|
1564
|
+
[-2, -1, 1],
|
|
1565
|
+
[-1, -1, 0],
|
|
1566
|
+
[0, -1, 0],
|
|
1567
|
+
[1, -1, 0],
|
|
1568
|
+
[2, -1, 1],
|
|
1569
|
+
[-2, 0, 1],
|
|
1570
|
+
[-1, 0, 0],
|
|
1571
|
+
[0, 0, 1],
|
|
1572
|
+
[1, 0, 0],
|
|
1573
|
+
[2, 0, 1],
|
|
1574
|
+
[-2, 1, 1],
|
|
1575
|
+
[-1, 1, 0],
|
|
1576
|
+
[0, 1, 0],
|
|
1577
|
+
[1, 1, 0],
|
|
1578
|
+
[2, 1, 1],
|
|
1579
|
+
[-2, 2, 1],
|
|
1580
|
+
[-1, 2, 1],
|
|
1581
|
+
[0, 2, 1],
|
|
1582
|
+
[1, 2, 1],
|
|
1583
|
+
[2, 2, 1],
|
|
1584
|
+
]
|
|
1585
|
+
const e = g.length
|
|
1586
|
+
for (let l = 0; l < e; l++)
|
|
1587
|
+
for (let h = 0; h < e; h++) {
|
|
1588
|
+
const { x: e, y: c } = { x: g[l], y: g[h] }
|
|
1589
|
+
;(e < 9 && c < 9) ||
|
|
1590
|
+
(e > t - 9 - 1 && c < 9) ||
|
|
1591
|
+
(c > t - 9 - 1 && e < 9) ||
|
|
1592
|
+
o.forEach((o) => {
|
|
1593
|
+
const t = r[e + o[0]][c + o[1]]
|
|
1594
|
+
t.type.push('positionAdjust'),
|
|
1595
|
+
t.type.includes('timing')
|
|
1596
|
+
? o[2] == 1
|
|
1597
|
+
? (t.color = a == i ? u : a)
|
|
1598
|
+
: (t.color = a == i && d == n ? s : d)
|
|
1599
|
+
: (t.color = o[2] == 1 ? a : d)
|
|
1600
|
+
})
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
})(this),
|
|
1604
|
+
(function (o) {
|
|
1605
|
+
const { modules: e, moduleCount: r, timingForegroundColor: t, timingBackgroundColor: i } = o
|
|
1606
|
+
const n = r - 16
|
|
1607
|
+
for (let o = 0; o < n; o++) {
|
|
1608
|
+
const a = e[6][8 + o]
|
|
1609
|
+
const d = e[8 + o][6]
|
|
1610
|
+
a.type.push('timing'),
|
|
1611
|
+
d.type.push('timing'),
|
|
1612
|
+
(a.color = (1 & o) ^ 1 ? t : i),
|
|
1613
|
+
(d.color = (1 & o) ^ 1 ? t : i)
|
|
1614
|
+
}
|
|
1615
|
+
})(this),
|
|
1616
|
+
(function (o) {
|
|
1617
|
+
const { modules: e, moduleCount: r, darkBlockColor: t } = o
|
|
1618
|
+
const i = e[r - 7 - 1][8]
|
|
1619
|
+
i.type.push('darkBlock'), (i.color = t)
|
|
1620
|
+
})(this),
|
|
1621
|
+
(function (o) {
|
|
1622
|
+
const {
|
|
1623
|
+
typeNumber: e,
|
|
1624
|
+
modules: r,
|
|
1625
|
+
moduleCount: t,
|
|
1626
|
+
typeNumberBackgroundColor: i,
|
|
1627
|
+
typeNumberForegroundColor: n,
|
|
1628
|
+
} = o
|
|
1629
|
+
if (e < 7) return r
|
|
1630
|
+
const a = [
|
|
1631
|
+
0,
|
|
1632
|
+
0,
|
|
1633
|
+
0,
|
|
1634
|
+
0,
|
|
1635
|
+
0,
|
|
1636
|
+
0,
|
|
1637
|
+
0,
|
|
1638
|
+
'000111110010010100',
|
|
1639
|
+
'001000010110111100',
|
|
1640
|
+
'001001101010011001',
|
|
1641
|
+
'001010010011010011',
|
|
1642
|
+
'001011101111110110',
|
|
1643
|
+
'001100011101100010',
|
|
1644
|
+
'001101100001000111',
|
|
1645
|
+
'001110011000001101',
|
|
1646
|
+
'001111100100101000',
|
|
1647
|
+
'010000101101111000',
|
|
1648
|
+
'010001010001011101',
|
|
1649
|
+
'010010101000010111',
|
|
1650
|
+
'010011010100110010',
|
|
1651
|
+
'010100100110100110',
|
|
1652
|
+
'010101011010000011',
|
|
1653
|
+
'010110100011001001',
|
|
1654
|
+
'010111011111101100',
|
|
1655
|
+
'011000111011000100',
|
|
1656
|
+
'011001000111100001',
|
|
1657
|
+
'011010111110101011',
|
|
1658
|
+
'011011000010001110',
|
|
1659
|
+
'011100110000011010',
|
|
1660
|
+
'011101001100111111',
|
|
1661
|
+
'011110110101110101',
|
|
1662
|
+
'011111001001010000',
|
|
1663
|
+
'100000100111010101',
|
|
1664
|
+
'100001011011110000',
|
|
1665
|
+
'100010100010111010',
|
|
1666
|
+
'100011011110011111',
|
|
1667
|
+
'100100101100001011',
|
|
1668
|
+
'100101010000101110',
|
|
1669
|
+
'100110101001100100',
|
|
1670
|
+
'100111010101000001',
|
|
1671
|
+
'101000110001101001',
|
|
1672
|
+
]
|
|
1673
|
+
const d = a[e] + a[e]
|
|
1674
|
+
const u = [t - 11, t - 10, t - 9]
|
|
1675
|
+
;[
|
|
1676
|
+
[5, u[2]],
|
|
1677
|
+
[5, u[1]],
|
|
1678
|
+
[5, u[0]],
|
|
1679
|
+
[4, u[2]],
|
|
1680
|
+
[4, u[1]],
|
|
1681
|
+
[4, u[0]],
|
|
1682
|
+
[3, u[2]],
|
|
1683
|
+
[3, u[1]],
|
|
1684
|
+
[3, u[0]],
|
|
1685
|
+
[2, u[2]],
|
|
1686
|
+
[2, u[1]],
|
|
1687
|
+
[2, u[0]],
|
|
1688
|
+
[1, u[2]],
|
|
1689
|
+
[1, u[1]],
|
|
1690
|
+
[1, u[0]],
|
|
1691
|
+
[0, u[2]],
|
|
1692
|
+
[0, u[1]],
|
|
1693
|
+
[0, u[0]],
|
|
1694
|
+
[u[2], 5],
|
|
1695
|
+
[u[1], 5],
|
|
1696
|
+
[u[0], 5],
|
|
1697
|
+
[u[2], 4],
|
|
1698
|
+
[u[1], 4],
|
|
1699
|
+
[u[0], 4],
|
|
1700
|
+
[u[2], 3],
|
|
1701
|
+
[u[1], 3],
|
|
1702
|
+
[u[0], 3],
|
|
1703
|
+
[u[2], 2],
|
|
1704
|
+
[u[1], 2],
|
|
1705
|
+
[u[0], 2],
|
|
1706
|
+
[u[2], 1],
|
|
1707
|
+
[u[1], 1],
|
|
1708
|
+
[u[0], 1],
|
|
1709
|
+
[u[2], 0],
|
|
1710
|
+
[u[1], 0],
|
|
1711
|
+
[u[0], 0],
|
|
1712
|
+
].forEach((o, e) => {
|
|
1713
|
+
const t = r[o[0]][o[1]]
|
|
1714
|
+
t.type.push('typeNumber'), (t.color = d[e] == '1' ? n : i)
|
|
1715
|
+
})
|
|
1716
|
+
})(this),
|
|
1717
|
+
(this.isMaked = !0),
|
|
1718
|
+
(this.drawModules = [])
|
|
1719
|
+
}),
|
|
1720
|
+
(b.prototype.getDrawModules = function () {
|
|
1721
|
+
if (this.drawModules && this.drawModules.length > 0) return this.drawModules
|
|
1722
|
+
const o = (this.drawModules = [])
|
|
1723
|
+
const {
|
|
1724
|
+
modules: e,
|
|
1725
|
+
moduleCount: r,
|
|
1726
|
+
dynamicSize: t,
|
|
1727
|
+
areaColor: i,
|
|
1728
|
+
backgroundImageSrc: n,
|
|
1729
|
+
backgroundImageX: a,
|
|
1730
|
+
backgroundImageY: d,
|
|
1731
|
+
backgroundImageWidth: u,
|
|
1732
|
+
backgroundImageHeight: s,
|
|
1733
|
+
backgroundImageAlpha: g,
|
|
1734
|
+
backgroundImageBorderRadius: l,
|
|
1735
|
+
foregroundImageSrc: h,
|
|
1736
|
+
foregroundImageX: c,
|
|
1737
|
+
foregroundImageY: m,
|
|
1738
|
+
foregroundImageWidth: f,
|
|
1739
|
+
foregroundImageHeight: v,
|
|
1740
|
+
foregroundImagePadding: p,
|
|
1741
|
+
foregroundImageBackgroundColor: C,
|
|
1742
|
+
foregroundImageBorderRadius: b,
|
|
1743
|
+
foregroundImageShadowOffsetX: k,
|
|
1744
|
+
foregroundImageShadowOffsetY: y,
|
|
1745
|
+
foregroundImageShadowBlur: w,
|
|
1746
|
+
foregroundImageShadowColor: I,
|
|
1747
|
+
} = this
|
|
1748
|
+
i && o.push({ name: 'area', type: 'area', color: i, x: 0, y: 0, width: t, height: t }),
|
|
1749
|
+
n &&
|
|
1750
|
+
o.push({
|
|
1751
|
+
name: 'backgroundImage',
|
|
1752
|
+
type: 'image',
|
|
1753
|
+
imageSrc: n,
|
|
1754
|
+
mappingName: 'backgroundImageSrc',
|
|
1755
|
+
x: a,
|
|
1756
|
+
y: d,
|
|
1757
|
+
width: u,
|
|
1758
|
+
height: s,
|
|
1759
|
+
alpha: g,
|
|
1760
|
+
borderRadius: l,
|
|
1761
|
+
})
|
|
1762
|
+
for (let B = 0; B < r; B++)
|
|
1763
|
+
for (let S = 0; S < r; S++) {
|
|
1764
|
+
const P = e[B][S]
|
|
1765
|
+
P.isDrawn ||
|
|
1766
|
+
(P.type.includes('foreground')
|
|
1767
|
+
? o.push({
|
|
1768
|
+
name: 'foreground',
|
|
1769
|
+
type: 'tile',
|
|
1770
|
+
color: P.color,
|
|
1771
|
+
destX: P.destX,
|
|
1772
|
+
destY: P.destY,
|
|
1773
|
+
destWidth: P.destWidth,
|
|
1774
|
+
destHeight: P.destHeight,
|
|
1775
|
+
x: P.x,
|
|
1776
|
+
y: P.y,
|
|
1777
|
+
width: P.width,
|
|
1778
|
+
height: P.height,
|
|
1779
|
+
paddingTop: P.paddingTop,
|
|
1780
|
+
paddingRight: P.paddingRight,
|
|
1781
|
+
paddingBottom: P.paddingBottom,
|
|
1782
|
+
paddingLeft: P.paddingLeft,
|
|
1783
|
+
rowIndex: B,
|
|
1784
|
+
colIndex: S,
|
|
1785
|
+
})
|
|
1786
|
+
: o.push({
|
|
1787
|
+
name: 'background',
|
|
1788
|
+
type: 'tile',
|
|
1789
|
+
color: P.color,
|
|
1790
|
+
destX: P.destX,
|
|
1791
|
+
destY: P.destY,
|
|
1792
|
+
destWidth: P.destWidth,
|
|
1793
|
+
destHeight: P.destHeight,
|
|
1794
|
+
x: P.x,
|
|
1795
|
+
y: P.y,
|
|
1796
|
+
width: P.width,
|
|
1797
|
+
height: P.height,
|
|
1798
|
+
paddingTop: P.paddingTop,
|
|
1799
|
+
paddingRight: P.paddingRight,
|
|
1800
|
+
paddingBottom: P.paddingBottom,
|
|
1801
|
+
paddingLeft: P.paddingLeft,
|
|
1802
|
+
rowIndex: B,
|
|
1803
|
+
colIndex: S,
|
|
1804
|
+
}),
|
|
1805
|
+
(P.isDrawn = !0))
|
|
1806
|
+
}
|
|
1807
|
+
return (
|
|
1808
|
+
h &&
|
|
1809
|
+
o.push({
|
|
1810
|
+
name: 'foregroundImage',
|
|
1811
|
+
type: 'image',
|
|
1812
|
+
imageSrc: h,
|
|
1813
|
+
mappingName: 'foregroundImageSrc',
|
|
1814
|
+
x: c,
|
|
1815
|
+
y: m,
|
|
1816
|
+
width: f,
|
|
1817
|
+
height: v,
|
|
1818
|
+
padding: p,
|
|
1819
|
+
backgroundColor: C,
|
|
1820
|
+
borderRadius: b,
|
|
1821
|
+
shadowOffsetX: k,
|
|
1822
|
+
shadowOffsetY: y,
|
|
1823
|
+
shadowBlur: w,
|
|
1824
|
+
shadowColor: I,
|
|
1825
|
+
}),
|
|
1826
|
+
o
|
|
1827
|
+
)
|
|
1828
|
+
}),
|
|
1829
|
+
(b.prototype.isBlack = function (o, e) {
|
|
1830
|
+
const r = this.moduleCount
|
|
1831
|
+
return !(o < 0 || e < 0 || o >= r || e >= r) && this.modules[o][e].isBlack
|
|
1832
|
+
}),
|
|
1833
|
+
(b.prototype.drawCanvas = function () {
|
|
1834
|
+
const {
|
|
1835
|
+
isMaked: o,
|
|
1836
|
+
canvasContext: e,
|
|
1837
|
+
useDynamicSize: r,
|
|
1838
|
+
dynamicSize: t,
|
|
1839
|
+
foregroundColor: i,
|
|
1840
|
+
foregroundPadding: n,
|
|
1841
|
+
backgroundColor: a,
|
|
1842
|
+
backgroundPadding: d,
|
|
1843
|
+
drawReserve: u,
|
|
1844
|
+
margin: s,
|
|
1845
|
+
} = this
|
|
1846
|
+
if (!o)
|
|
1847
|
+
return (
|
|
1848
|
+
console.error('[uQRCode]: please execute the make method first!'),
|
|
1849
|
+
Promise.reject(new b.Error('please execute the make method first!'))
|
|
1850
|
+
)
|
|
1851
|
+
const g = this.getDrawModules()
|
|
1852
|
+
const l = async (o, r) => {
|
|
1853
|
+
try {
|
|
1854
|
+
e.clearRect(0, 0, t, t), e.draw(!1)
|
|
1855
|
+
for (let i = 0; i < g.length; i++) {
|
|
1856
|
+
const n = g[i]
|
|
1857
|
+
switch ((e.save(), n.type)) {
|
|
1858
|
+
case 'area':
|
|
1859
|
+
e.setFillStyle(n.color), e.fillRect(n.x, n.y, n.width, n.height)
|
|
1860
|
+
break
|
|
1861
|
+
case 'tile':
|
|
1862
|
+
var a = n.x
|
|
1863
|
+
var d = n.y
|
|
1864
|
+
var s = n.width
|
|
1865
|
+
var l = n.height
|
|
1866
|
+
e.setFillStyle(n.color), e.fillRect(a, d, s, l)
|
|
1867
|
+
break
|
|
1868
|
+
case 'image':
|
|
1869
|
+
if (n.name === 'backgroundImage') {
|
|
1870
|
+
;(a = Math.round(n.x)),
|
|
1871
|
+
(d = Math.round(n.y)),
|
|
1872
|
+
(s = Math.round(n.width)),
|
|
1873
|
+
(l = Math.round(n.height))
|
|
1874
|
+
s < 2 * (c = Math.round(n.borderRadius)) && (c = s / 2),
|
|
1875
|
+
l < 2 * c && (c = l / 2),
|
|
1876
|
+
e.setGlobalAlpha(n.alpha),
|
|
1877
|
+
c > 0 &&
|
|
1878
|
+
(e.beginPath(),
|
|
1879
|
+
e.moveTo(a + c, d),
|
|
1880
|
+
e.arcTo(a + s, d, a + s, d + l, c),
|
|
1881
|
+
e.arcTo(a + s, d + l, a, d + l, c),
|
|
1882
|
+
e.arcTo(a, d + l, a, d, c),
|
|
1883
|
+
e.arcTo(a, d, a + s, d, c),
|
|
1884
|
+
e.closePath(),
|
|
1885
|
+
e.setStrokeStyle('rgba(0,0,0,0)'),
|
|
1886
|
+
e.stroke(),
|
|
1887
|
+
e.clip())
|
|
1888
|
+
try {
|
|
1889
|
+
var h = await this.loadImage(n.imageSrc)
|
|
1890
|
+
e.drawImage(h, a, d, s, l)
|
|
1891
|
+
} catch (o) {
|
|
1892
|
+
throw (
|
|
1893
|
+
(console.error(`[uQRCode]: ${n.mappingName} invalid!`),
|
|
1894
|
+
new b.Error(`${n.mappingName} invalid!`))
|
|
1895
|
+
)
|
|
1896
|
+
}
|
|
1897
|
+
} else if (n.name === 'foregroundImage') {
|
|
1898
|
+
;(a = Math.round(n.x)),
|
|
1899
|
+
(d = Math.round(n.y)),
|
|
1900
|
+
(s = Math.round(n.width)),
|
|
1901
|
+
(l = Math.round(n.height))
|
|
1902
|
+
var c
|
|
1903
|
+
const m = Math.round(n.padding)
|
|
1904
|
+
s < 2 * (c = Math.round(n.borderRadius)) && (c = s / 2), l < 2 * c && (c = l / 2)
|
|
1905
|
+
const f = a - m
|
|
1906
|
+
const v = d - m
|
|
1907
|
+
const p = s + 2 * m
|
|
1908
|
+
const C = l + 2 * m
|
|
1909
|
+
let k = Math.round((p / s) * c)
|
|
1910
|
+
p < 2 * k && (k = p / 2),
|
|
1911
|
+
C < 2 * k && (k = C / 2),
|
|
1912
|
+
e.save(),
|
|
1913
|
+
e.setShadow(n.shadowOffsetX, n.shadowOffsetY, n.shadowBlur, n.shadowColor),
|
|
1914
|
+
k > 0
|
|
1915
|
+
? (e.beginPath(),
|
|
1916
|
+
e.moveTo(f + k, v),
|
|
1917
|
+
e.arcTo(f + p, v, f + p, v + C, k),
|
|
1918
|
+
e.arcTo(f + p, v + C, f, v + C, k),
|
|
1919
|
+
e.arcTo(f, v + C, f, v, k),
|
|
1920
|
+
e.arcTo(f, v, f + p, v, k),
|
|
1921
|
+
e.closePath(),
|
|
1922
|
+
e.setFillStyle(n.backgroundColor),
|
|
1923
|
+
e.fill())
|
|
1924
|
+
: (e.setFillStyle(n.backgroundColor), e.fillRect(f, v, p, C)),
|
|
1925
|
+
e.restore(),
|
|
1926
|
+
e.save(),
|
|
1927
|
+
k > 0
|
|
1928
|
+
? (e.beginPath(),
|
|
1929
|
+
e.moveTo(f + k, v),
|
|
1930
|
+
e.arcTo(f + p, v, f + p, v + C, k),
|
|
1931
|
+
e.arcTo(f + p, v + C, f, v + C, k),
|
|
1932
|
+
e.arcTo(f, v + C, f, v, k),
|
|
1933
|
+
e.arcTo(f, v, f + p, v, k),
|
|
1934
|
+
e.closePath(),
|
|
1935
|
+
e.setFillStyle(m > 0 ? n.backgroundColor : 'rgba(0,0,0,0)'),
|
|
1936
|
+
e.fill())
|
|
1937
|
+
: (e.setFillStyle(m > 0 ? n.backgroundColor : 'rgba(0,0,0,0)'),
|
|
1938
|
+
e.fillRect(f, v, p, C)),
|
|
1939
|
+
e.restore(),
|
|
1940
|
+
c > 0 &&
|
|
1941
|
+
(e.beginPath(),
|
|
1942
|
+
e.moveTo(a + c, d),
|
|
1943
|
+
e.arcTo(a + s, d, a + s, d + l, c),
|
|
1944
|
+
e.arcTo(a + s, d + l, a, d + l, c),
|
|
1945
|
+
e.arcTo(a, d + l, a, d, c),
|
|
1946
|
+
e.arcTo(a, d, a + s, d, c),
|
|
1947
|
+
e.closePath(),
|
|
1948
|
+
e.setStrokeStyle('rgba(0,0,0,0)'),
|
|
1949
|
+
e.stroke(),
|
|
1950
|
+
e.clip())
|
|
1951
|
+
try {
|
|
1952
|
+
h = await this.loadImage(n.imageSrc)
|
|
1953
|
+
e.drawImage(h, a, d, s, l)
|
|
1954
|
+
} catch (o) {
|
|
1955
|
+
throw (
|
|
1956
|
+
(console.error(`[uQRCode]: ${n.mappingName} invalid!`),
|
|
1957
|
+
new b.Error(`${n.mappingName} invalid!`))
|
|
1958
|
+
)
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
u && e.draw(!0), e.restore()
|
|
1963
|
+
}
|
|
1964
|
+
e.draw(!0), setTimeout(o, 150)
|
|
1965
|
+
} catch (o) {
|
|
1966
|
+
if (!(o instanceof b.Error)) throw o
|
|
1967
|
+
r(o)
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
return new Promise((o, e) => {
|
|
1971
|
+
l(o, e)
|
|
1972
|
+
})
|
|
1973
|
+
}),
|
|
1974
|
+
(b.prototype.draw = function () {
|
|
1975
|
+
return this.drawCanvas()
|
|
1976
|
+
}),
|
|
1977
|
+
(b.prototype.register = function (o) {
|
|
1978
|
+
o && o(b, this, !0)
|
|
1979
|
+
})
|
|
1980
|
+
export { b as default }
|