//--------------------------------------------------------------------- // uQRCode二维码生成插件 v3.5.1 // // uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。 // // Copyright (c) Sansnn uQRCode All rights reserved. // // Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // // github地址: // https://github.com/Sansnn/uQRCode // // npm地址: // https://www.npmjs.com/package/uqrcodejs // // uni-app插件市场地址: // https://ext.dcloud.net.cn/plugin?id=1287 // // 复制使用请保留本段注释,感谢支持开源! // //--------------------------------------------------------------------- //--------------------------------------------------------------------- // QRCode for JavaScript // // Copyright (c) 2009 Kazuhiko Arase // // URL: http://www.d-project.com/ // // Licensed under the MIT license: // http://www.opensource.org/licenses/mit-license.php // // The word "QR Code" is registered trademark of // DENSO WAVE INCORPORATED // http://www.denso-wave.com/qrcode/faqpatent-e.html // //--------------------------------------------------------------------- "use strict";let uQRCode;!function(){function o(o){this.mode=u.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}function r(o,e){if(null==o.length)throw new Error(o.length+"/"+e);for(var r=0;r{i(o)}).catch(o=>{n(o)}).finally(()=>{if(e.length){const r=e.shift();o(r.task,r.resolve,r.reject)}else r=!1})}let e=this.waitingQueue=[],r=this.isRunning=!1;this.exec=function(t){return new Promise((i,n)=>{r?e.push({task:t,resolve:i,reject:n}):(r=!0,o(t,i,n))})}}function a(o,e){var r=this.data="",t=this.size=200,i=this.typeNumber=-1,n=(this.errorCorrectLevel=d.H,this.useDynamicSize=!1,this.dynamicSize=void 0,this.margin=0),u=(this.backgroundColor="#FFFFFF",this.backgroundImageSrc=void 0,this.backgroundImageWidth=void 0),s=this.backgroundImageHeight=void 0,g=this.backgroundImageX=void 0,l=this.backgroundImageY=void 0,h=(this.backgroundImageAlpha=1,this.backgroundImageBorderRadius=0,this.foregroundColor="#000000",this.foregroundImageSrc=void 0,this.foregroundImageWidth=void 0),m=this.foregroundImageHeight=void 0,c=this.foregroundImageX=void 0,f=this.foregroundImageY=void 0,v=this.foregroundImagePadding=0,p=(this.foregroundImageBackgroundColor="#FFFFFF",this.foregroundImageBorderRadius=0),C=this.foregroundImageShadowOffsetX=0,b=this.foregroundImageShadowOffsetY=0,y=this.foregroundImageShadowBlur=0,I=(this.foregroundImageShadowColor="#808080",this.positionProbeBackgroundColor=void 0),k=this.positionProbeForegroundColor=void 0,w=(this.positionProbeImageSrc=void 0,this.positionProbeLeftUpperImageSrc=void 0),S=this.positionProbeRightUpperImageSrc=void 0,P=this.positionProbeLeftLowerImageSrc=void 0,B=this.separatorColor=void 0,T=this.positionAdjustBackgroundColor=void 0,L=this.positionAdjustForegroundColor=void 0,A=(this.positionAdjustImageSrc=void 0,this.timingBackgroundColor=void 0),D=this.timingForegroundColor=void 0,E=this.typeNumberBackgroundColor=void 0,N=this.typeNumberForegroundColor=void 0,x=this.darkBlockColor=void 0,R=(this.patterns=[],this.canvasContext=void 0);this.queue=!1,this.modules=[],this.moduleCount=0,this.drawModules=[];Object.defineProperties(this,{data:{get:()=>(""!==r&&void 0!==r||console.error("[uQRCode]: data must be set!"),r),set(o){r=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===u?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*u:u},set(o){u=Number(o)}},backgroundImageHeight:{get(){return void 0===s?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*s:s},set(o){s=Number(o)}},backgroundImageX:{get(){return void 0===g?0:this.useDynamicSize?this.dynamicSize/this.size*g:g},set(o){g=Number(o)}},backgroundImageY:{get(){return void 0===l?0:this.useDynamicSize?this.dynamicSize/this.size*l:l},set(o){l=Number(o)}},foregroundImageWidth:{get(){return void 0===h?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*h:h},set(o){h=Number(o)}},foregroundImageHeight:{get(){return void 0===m?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*m:m},set(o){m=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===f?this.dynamicSize/2-this.foregroundImageHeight/2:this.useDynamicSize?this.dynamicSize/this.size*f:f},set(o){f=Number(o)}},foregroundImagePadding:{get(){return this.useDynamicSize?this.dynamicSize/this.size*v:v},set(o){v=Number(o)}},foregroundImageBorderRadius:{get(){return this.useDynamicSize?this.dynamicSize/this.size*p:p},set(o){p=Number(o)}},foregroundImageShadowOffsetX:{get(){return this.useDynamicSize?this.dynamicSize/this.size*C:C},set(o){C=Number(o)}},foregroundImageShadowOffsetY:{get(){return this.useDynamicSize?this.dynamicSize/this.size*b:b},set(o){b=Number(o)}},foregroundImageShadowBlur:{get(){return this.useDynamicSize?this.dynamicSize/this.size*y:y},set(o){y=Number(o)}},positionProbeBackgroundColor:{get(){return I||this.backgroundColor},set(o){I=o}},positionProbeForegroundColor:{get(){return k||this.foregroundColor},set(o){k=o}},positionProbeLeftUpperImageSrc:{get(){return w||this.positionProbeImageSrc},set(o){w=o}},positionProbeRightUpperImageSrc:{get(){return S||this.positionProbeImageSrc},set(o){S=o}},positionProbeLeftLowerImageSrc:{get(){return P||this.positionProbeImageSrc},set(o){P=o}},separatorColor:{get(){return B||this.backgroundColor},set(o){B=o}},positionAdjustBackgroundColor:{get(){return T||this.backgroundColor},set(o){T=o}},positionAdjustForegroundColor:{get(){return L||this.foregroundColor},set(o){L=o}},timingBackgroundColor:{get(){return A||this.backgroundColor},set(o){A=o}},timingForegroundColor:{get(){return D||this.foregroundColor},set(o){D=o}},typeNumberBackgroundColor:{get(){return E||this.backgroundColor},set(o){E=o}},typeNumberForegroundColor:{get(){return N||this.foregroundColor},set(o){N=o}},darkBlockColor:{get(){return x||this.foregroundColor},set(o){x=o}},canvasContext:{get:()=>(void 0===R&&console.error("[uQRCode]: use drawCanvas, you need to set the canvasContext!"),R),set(o){R=a.getCanvasContext(o)}}}),o&&this.setOptions(o),e&&(this.canvasContext=a.getCanvasContext(e))}o.prototype={getLength:function(o){return this.data.length},write:function(o){for(var e=0;e=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=g.getLostPoint(this);(0==r||o>t)&&(o=t,e=r)}return e},createMovieClip:function(o,e,r){var t=o.createEmptyMovieClip(e,r),i=1;this.make();for(var n=0;n>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=g.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 u=0;u<2;u++)if(null==this.modules[t][a-u]){var d=!1;n>>i&1));var s=g.getMask(e,t,a-u);s&&(d=!d),this.modules[t][a-u]=d,i--,-1==i&&(n++,i=7)}if(t+=r,t<0||this.moduleCount<=t){t-=r,r=-r;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(o,r,n){for(var a=t.getRSBlocks(o,r),u=new i,d=0;d8*l)throw new Error("code length overflow. ("+u.getLengthInBits()+">"+8*l+")");for(u.getLengthInBits()+4<=8*l&&u.put(0,4);u.getLengthInBits()%8!=0;)u.putBit(!1);for(;!(u.getLengthInBits()>=8*l||(u.put(e.PAD0,8),u.getLengthInBits()>=8*l));)u.put(e.PAD1,8);return e.createBytes(u,a)},e.createBytes=function(o,e){for(var t=0,i=0,n=0,a=new Array(e.length),u=new Array(e.length),d=0;d=0?f.get(v):0}}var p=0;for(h=0;h=0;)e^=g.G15<=0;)e^=g.G18<>>=1;return e},getPatternPosition:function(o){return g.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,e,r){switch(o){case s.PATTERN000:return(e+r)%2==0;case s.PATTERN001:return e%2==0;case s.PATTERN010:return r%3==0;case s.PATTERN011:return(e+r)%3==0;case s.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case s.PATTERN101:return e*r%2+e*r%3==0;case s.PATTERN110:return(e*r%2+e*r%3)%2==0;case s.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var e=new r([1],0),t=0;t5&&(r+=3+n-5)}for(t=0;t=256;)o-=255;return l.EXP_TABLE[o]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;h<8;h++)l.EXP_TABLE[h]=1<>>7-o%8&1)},put:function(o,e){for(var r=0;r>>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++}},a.errorCorrectLevel=d,a.queue=new n,a.queueLoadImage=new n,a.isQueueLoadImage=!1,a.loadImageCache=[],a.utf16To8=function(o){for(var e,r="",t=0;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},a.deepReplace=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])}return t},a.getSomePropertyToNewObject=function(o={},e=[]){let r={};return e.forEach(e=>{r[e]=o[e]}),r},a.getCanvasContext=function(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.draw=o.draw||function(o,e){e&&e()},o},a.getLoadImage=function(o){return"function"==typeof o?function(e,r=!1){return a.isQueueLoadImage?a.queueLoadImage.exec(()=>new Promise((t,i)=>{setTimeout(()=>{const r=a.loadImageCache.find(o=>o.src==e);r?t(r.img):o(e).then(o=>{a.loadImageCache.push({src:e,img:o}),t(o)}).catch(o=>{i(o)})},r?150:10)})):o(e)}:function(o){return Promise.resolve(o)}};var m=a.loadImage=function(o){return Promise.resolve(o)};Object.defineProperty(a,"loadImage",{get:()=>m,set(o){m=a.getLoadImage(o)}}),a.prototype={setOptions(o){var e,r,t,i,n,u,d,s,g,l,h,m,c,f,v,p,C,b,y,I,k,w,S,P,B,T,L,A,D,E,N,x,R,z,_,M,O,F,j,H,X,Y,U,Q,G,K,W,q,J,$,V,Z,oo,eo,ro,to,io,no,ao,uo,so,go,lo,ho,mo,co,fo,vo,po,Co,bo,yo,Io,ko,wo,So,Po,Bo,To,Lo,Ao,Do,Eo,No,xo;o&&a.deepReplace(this,{data:o.data||o.text,size:o.size,typeNumber:o.typeNumber,errorCorrectLevel:o.errorCorrectLevel,useDynamicSize:o.useDynamicSize,margin:o.margin,backgroundColor:o.backgroundColor||(null===(e=o.background)||void 0===e?void 0:e.color),backgroundImageSrc:o.backgroundImageSrc||(null===(r=o.background)||void 0===r?void 0:null===(t=r.image)||void 0===t?void 0:t.src),backgroundImageWidth:o.backgroundImageWidth||(null===(i=o.background)||void 0===i?void 0:null===(n=i.image)||void 0===n?void 0:n.width),backgroundImageHeight:o.backgroundImageHeight||(null===(u=o.background)||void 0===u?void 0:null===(d=u.image)||void 0===d?void 0:d.height),backgroundImageX:o.backgroundImageX||(null===(s=o.background)||void 0===s?void 0:null===(g=s.image)||void 0===g?void 0:g.x),backgroundImageY:o.backgroundImageY||(null===(l=o.background)||void 0===l?void 0:null===(h=l.image)||void 0===h?void 0:h.y),backgroundImageAlpha:o.backgroundImageAlpha||(null===(m=o.background)||void 0===m?void 0:null===(c=m.image)||void 0===c?void 0:c.alpha),backgroundImageBorderRadius:o.backgroundImageBorderRadius||(null===(f=o.background)||void 0===f?void 0:null===(v=f.image)||void 0===v?void 0:v.borderRadius),foregroundColor:o.foregroundColor||(null===(p=o.foreground)||void 0===p?void 0:p.color),foregroundImageSrc:o.foregroundImageSrc||(null===(C=o.foreground)||void 0===C?void 0:null===(b=C.image)||void 0===b?void 0:b.src),foregroundImageWidth:o.foregroundImageWidth||(null===(y=o.foreground)||void 0===y?void 0:null===(I=y.image)||void 0===I?void 0:I.width),foregroundImageHeight:o.foregroundImageHeight||(null===(k=o.foreground)||void 0===k?void 0:null===(w=k.image)||void 0===w?void 0:w.height),foregroundImageX:o.foregroundImageX||(null===(S=o.foreground)||void 0===S?void 0:null===(P=S.image)||void 0===P?void 0:P.x),foregroundImageY:o.foregroundImageY||(null===(B=o.foreground)||void 0===B?void 0:null===(T=B.image)||void 0===T?void 0:T.y),foregroundImagePadding:o.foregroundImagePadding||(null===(L=o.foreground)||void 0===L?void 0:null===(A=L.image)||void 0===A?void 0:A.padding),foregroundImageBackgroundColor:o.foregroundImageBackgroundColor||(null===(D=o.foreground)||void 0===D?void 0:null===(E=D.image)||void 0===E?void 0:E.backgroundColor),foregroundImageBorderRadius:o.foregroundImageBorderRadius||(null===(N=o.foreground)||void 0===N?void 0:null===(x=N.image)||void 0===x?void 0:x.borderRadius),foregroundImageShadowOffsetX:o.foregroundImageShadowOffsetX||(null===(R=o.foreground)||void 0===R?void 0:null===(z=R.image)||void 0===z?void 0:z.shadowOffsetX),foregroundImageShadowOffsetY:o.foregroundImageShadowOffsetY||(null===(_=o.foreground)||void 0===_?void 0:null===(M=_.image)||void 0===M?void 0:M.shadowOffsetY),foregroundImageShadowBlur:o.foregroundImageShadowBlur||(null===(O=o.foreground)||void 0===O?void 0:null===(F=O.image)||void 0===F?void 0:F.shadowBlur),foregroundImageShadowColor:o.foregroundImageShadowColor||(null===(j=o.foreground)||void 0===j?void 0:null===(H=j.image)||void 0===H?void 0:H.shadowColor),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===(U=o.positionProbe)||void 0===U?void 0:U.foregroundColor)||(null===(Q=o.positionDetection)||void 0===Q?void 0:Q.foregroundColor),positionProbeImageSrc:o.positionProbeImageSrc||(null===(G=o.art)||void 0===G?void 0:null===(K=G.positionProbe)||void 0===K?void 0:K.imageSrc)||(null===(W=o.art)||void 0===W?void 0:null===(q=W.positionDetection)||void 0===q?void 0:q.image),positionProbeLeftUpperImageSrc:o.positionProbeLeftUpperImageSrc||(null===(J=o.art)||void 0===J?void 0:null===($=J.positionProbe)||void 0===$?void 0:null===(V=$.leftUpper)||void 0===V?void 0:V.imageSrc)||(null===(Z=o.art)||void 0===Z?void 0:null===(oo=Z.positionDetection)||void 0===oo?void 0:null===(eo=oo.upperLeft)||void 0===eo?void 0:eo.image),positionProbeRightUpperImageSrc:o.positionProbeRightUpperImageSrc||(null===(ro=o.art)||void 0===ro?void 0:null===(to=ro.positionProbe)||void 0===to?void 0:null===(io=to.rightUpper)||void 0===io?void 0:io.imageSrc)||(null===(no=o.art)||void 0===no?void 0:null===(ao=no.positionDetection)||void 0===ao?void 0:null===(uo=ao.upperRight)||void 0===uo?void 0:uo.image),positionProbeLeftLowerImageSrc:o.positionProbeLeftLowerImageSrc||(null===(so=o.art)||void 0===so?void 0:null===(go=so.positionProbe)||void 0===go?void 0:null===(lo=go.leftLower)||void 0===lo?void 0:lo.imageSrc)||(null===(ho=o.art)||void 0===ho?void 0:null===(mo=ho.positionDetection)||void 0===mo?void 0:null===(co=mo.lowerLeft)||void 0===co?void 0:co.image),separatorColor:o.separatorColor||(null===(fo=o.separator)||void 0===fo?void 0:fo.color),positionAdjustBackgroundColor:o.positionAdjustBackgroundColor||(null===(vo=o.positionAdjust)||void 0===vo?void 0:vo.backgroundColor)||(null===(po=o.alignment)||void 0===po?void 0:po.backgroundColor),positionAdjustForegroundColor:o.positionAdjustForegroundColor||(null===(Co=o.positionAdjust)||void 0===Co?void 0:Co.foregroundColor)||(null===(bo=o.alignment)||void 0===bo?void 0:bo.foregroundColor),positionAdjustImageSrc:o.positionAdjustImageSrc||(null===(yo=o.art)||void 0===yo?void 0:null===(Io=yo.positionAdjust)||void 0===Io?void 0:Io.imageSrc)||(null===(ko=o.art)||void 0===ko?void 0:null===(wo=ko.alignment)||void 0===wo?void 0:wo.image),timingBackgroundColor:o.timingBackgroundColor||(null===(So=o.timing)||void 0===So?void 0:So.backgroundColor),timingForegroundColor:o.timingForegroundColor||(null===(Po=o.timing)||void 0===Po?void 0:Po.foregroundColor),typeNumberBackgroundColor:o.typeNumberBackgroundColor||(null===(Bo=o.typeNumber)||void 0===Bo?void 0:Bo.backgroundColor)||(null===(To=o.versionInformation)||void 0===To?void 0:To.backgroundColor),typeNumberForegroundColor:o.typeNumberForegroundColor||(null===(Lo=o.typeNumber)||void 0===Lo?void 0:Lo.foregroundColor)||(null===(Ao=o.versionInformation)||void 0===Ao?void 0:Ao.foregroundColor),darkBlockColor:o.darkBlockColor||(null===(Do=o.darkBlock)||void 0===Do?void 0:Do.color),patterns:o.patterns||(null===(Eo=o.art)||void 0===Eo?void 0:Eo.patterns)||(null===(No=o.art)||void 0===No?void 0:null===(xo=No.shape)||void 0===xo?void 0:xo.map(o=>(o.imageSrc=o.image,o))),queue:o.queue},!0)},make(){this.foregroundColor===this.backgroundColor&&console.error("[uQRCode]: foregroundColor and backgroundColor cannot be the same!");var o=new e(this.typeNumber,this.errorCorrectLevel);o.addData(a.utf16To8(this.data.toString())),o.make(),this.typeNumber=o.typeNumber,this.modules=o.modules,this.moduleCount=o.moduleCount;var r=this.size-2*this.margin;this.dynamicSize=Math.ceil(r/o.moduleCount)*o.moduleCount+2*this.margin,this.useDynamicSize||(this.dynamicSize=this.size),this.paintData(),this.paintPositionProbe(),this.paintSeparator(),this.paintTiming(),this.paintPositionAdjust(),this.paintDarkBlock(),this.paintTypeNumber(),this.getDrawModules()},paintData(){let{dynamicSize:o,margin:e,backgroundColor:r,foregroundColor:t,modules:i,moduleCount:n}=this,a=(o-2*e)/n;for(var u=0;u{var i=o[e[0]][e[1]],a=o[e[0]+n][e[1]],u=o[e[0]][e[1]+n];u.type.push("positionProbe"),a.type.push("positionProbe"),i.type.push("positionProbe"),i.color=1==e[2]?t:r,a.color=1==e[2]?t:r,u.color=1==e[2]?t:r})},paintSeparator(){let{modules:o,moduleCount:e,separatorColor:r}=this;[[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(t=>{var i=o[t[0]][t[1]],n=o[e-t[0]-1][t[1]],a=o[t[0]][e-t[1]-1];a.type.push("separator"),n.type.push("separator"),i.type.push("separator"),i.color=r,n.color=r,a.color=r})},paintPositionAdjust(){let{typeNumber:o,modules:e,moduleCount:r,foregroundColor:t,backgroundColor:i,positionAdjustForegroundColor:n,positionAdjustBackgroundColor:a,timingForegroundColor:u,timingBackgroundColor:d}=this;const s=[[],[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]],g=s[o-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]],s=g.length;for(let l=0;lr-9-1&&m<9||m>r-9-1&&s<9||o.forEach(o=>{var r=e[s+o[0]][m+o[1]];r.type.push("positionAdjust"),r.type.includes("timing")?1==o[2]?r.color=n==t?u:n:r.color=n==t&&a==i?d:a:r.color=1==o[2]?n:a})}}},paintTiming(){let{modules:o,moduleCount:e,timingForegroundColor:r,timingBackgroundColor:t}=this,i=e-16;for(let e=0;e{var n=e[o[0]][o[1]];n.type.push("typeNumber"),n.color="1"==a[r]?i:t})},getDrawModules(){let o=this.drawModules=[],{modules:e,moduleCount:r,dynamicSize:t,backgroundColor:i,backgroundImageSrc:n,backgroundImageX:a,backgroundImageY:u,backgroundImageWidth:d,backgroundImageHeight:s,backgroundImageAlpha:g,backgroundImageBorderRadius:l,positionProbeLeftUpperImageSrc:h,positionProbeRightUpperImageSrc:m,positionProbeLeftLowerImageSrc:c,positionAdjustImageSrc:f,patterns:v,foregroundImageSrc:p,foregroundImageX:C,foregroundImageY:b,foregroundImageWidth:y,foregroundImageHeight:I,foregroundImagePadding:k,foregroundImageBackgroundColor:w,foregroundImageBorderRadius:S,foregroundImageShadowOffsetX:P,foregroundImageShadowOffsetY:B,foregroundImageShadowBlur:T,foregroundImageShadowColor:L}=this;if(i&&o.push({name:"background",type:"block",color:i,x:0,y:0,width:t,height:t}),n&&o.push({name:"backgroundImage",type:"image",imageSrc:n,imageSource:"backgroundImageSrc",x:a,y:u,width:d,height:s,alpha:g,borderRadius:l}),h){o.push({name:"foreground",type:"image",imageSrc:h,imageSource:"positionProbeLeftUpperImageSrc",x:e[0][0].x,y:e[0][0].y,width:e[0][7].x-e[0][0].x,height:e[7][0].y-e[0][0].y});for(var A=0;A<7;A++)for(var D=0;D<7;D++){var E=e[A][D];E.isDrawn=!0}}if(m){o.push({name:"foreground",type:"image",imageSrc:m,imageSource:"positionProbeRightUpperImageSrc",x:e[0][r-7].x,y:e[0][r-7].y,width:e[0][r-1].x-e[0][r-7-1].x,height:e[7][r-7-1].y-e[0][r-7].y});for(A=0;A<7;A++)for(D=7;D>0;D--){E=e[A][r-D];E.isDrawn=!0}}if(c){o.push({name:"foreground",type:"image",imageSrc:c,imageSource:"positionProbeLeftLowerImageSrc",x:e[r-7][0].x,y:e[r-7][0].y,width:e[r-7][7].x-e[r-7][0].x,height:e[r-1][0].y-e[r-7-1][0].y});for(A=7;A>0;A--)for(D=0;D<7;D++){E=e[r-A][D];E.isDrawn=!0}}if(f){let t=[];for(var N=0;N{o.push({name:"foreground",type:"image",imageSrc:f,imageSource:"positionAdjustImageSrc",x:r.x,y:r.y,width:r.width,height:r.height});for(var t=0;to.imageSrc);if(F.length>0)for(A=0;A{e.draw(!1);let n=!1;for(var u=0;u0?d.backgroundColor:"rgba(0,0,0,0)"),e.fill(),e.beginPath(),e.moveTo(s+m,g),e.arcTo(s+l,g,s+l,g+h,m),e.arcTo(s+l,g+h,s,g+h,m),e.arcTo(s,g+h,s,g,m),e.arcTo(s,g,s+l,g,m),e.closePath(),e.strokeStyle="rgba(0,0,0,0)",e.stroke(),e.clip()}try{var b=await a.loadImage(d.imageSrc);e.drawImage(b,d.x,d.y,d.width,d.height)}catch(o){console.error(`[uQRCode]: ${d.imageSource} invalid!`),t({errmsg:`[uQRCode]: ${d.imageSource} invalid!`}),n=!0}}if(n)return;i&&e.draw(!0),e.restore()}e.draw(!0),setTimeout(r,150)};return new Promise((o,e)=>{i?a.queue.exec(()=>new Promise((o,e)=>{n(o,e)})).then(()=>{setTimeout(o,150)}).catch(o=>{e(o)}):n(o,e)})},draw(){return this.drawCanvas()}},uQRCode=a,uQRCode.export=function(){var o,e;o="undefined"!=typeof window?window:global,e=uQRCode,"undefined"!=typeof module&&"object"==typeof exports?module.exports=e:"function"==typeof define&&(define.amd||define.cmd)?define(function(){return e}):o.UQRCode=e}}(); //--------------------------------------------------------------------- // 默认导出方式,非vite(vue3)使用该方式。 // ↓ //--------------------------------------------------------------------- // uQRCode.export(); //--------------------------------------------------------------------- // ES6导出方式,vite(vue3)使用该方式。 // ↓ //--------------------------------------------------------------------- export default uQRCode;