import{d as F,j as B,aH as G,h as N,o as $,aG as X}from"./arco.f3c60d68.js";/*! * qrcode.vue v3.6.0 * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3 * © 2017-PRESENT @scopewu(https://github.com/scopewu) * MIT License. */var S=function(){return S=Object.assign||function(f){for(var l,s=1,d=arguments.length;sn.MAX_VERSION)throw new RangeError("Version value out of range");if(a<-1||a>7)throw new RangeError("Mask value out of range");this.size=e*4+17;for(var i=[],u=0;u7)throw new RangeError("Invalid value");var h,g;for(h=t;;h++){var M=n.getNumDataCodewords(h,r)*8,m=c.getTotalBits(e,h);if(m<=M){g=m;break}if(h>=a)throw new RangeError("Data too long")}for(var C=0,p=[n.Ecc.MEDIUM,n.Ecc.QUARTILE,n.Ecc.HIGH];C>>3]|=D<<7-(_&7)}),new n(h,r,b,i)},n.prototype.getModule=function(e,r){return 0<=e&&e>>9)*1335;var i=(r<<10|t)^21522;d(i>>>15==0);for(var a=0;a<=5;a++)this.setFunctionModule(8,a,s(i,a));this.setFunctionModule(8,7,s(i,6)),this.setFunctionModule(8,8,s(i,7)),this.setFunctionModule(7,8,s(i,8));for(var a=9;a<15;a++)this.setFunctionModule(14-a,8,s(i,a));for(var a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,s(i,a));for(var a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,s(i,a));this.setFunctionModule(8,this.size-8,!0)},n.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,r=0;r<12;r++)e=e<<1^(e>>>11)*7973;var t=this.version<<12|e;d(t>>>18==0);for(var r=0;r<18;r++){var a=s(t,r),i=this.size-11+r%3,u=Math.floor(r/3);this.setFunctionModule(i,u,a),this.setFunctionModule(u,i,a)}}},n.prototype.drawFinderPattern=function(e,r){for(var t=-4;t<=4;t++)for(var a=-4;a<=4;a++){var i=Math.max(Math.abs(a),Math.abs(t)),u=e+a,h=r+t;0<=u&&u=h)&&w.push(y[R])})},C=0;C=1;t-=2){t==6&&(t=5);for(var a=0;a>>3],7-(r&7)),r++)}}d(r==e.length*8)},n.prototype.applyMask=function(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(var r=0;r5&&e++):(this.finderPenaltyAddHistory(a,i),t||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),t=this.modules[r][u],a=1);e+=this.finderPenaltyTerminateAndCount(t,a,i)*n.PENALTY_N3}for(var u=0;u5&&e++):(this.finderPenaltyAddHistory(h,i),t||(e+=this.finderPenaltyCountPatterns(i)*n.PENALTY_N3),t=this.modules[r][u],h=1);e+=this.finderPenaltyTerminateAndCount(t,h,i)*n.PENALTY_N3}for(var r=0;rn.MAX_VERSION)throw new RangeError("Version number out of range");var r=(16*e+128)*e+64;if(e>=2){var t=Math.floor(e/7)+2;r-=(25*t-10)*t-55,e>=7&&(r-=36)}return d(208<=r&&r<=29648),r},n.getNumDataCodewords=function(e,r){return Math.floor(n.getNumRawDataModules(e)/8)-n.ECC_CODEWORDS_PER_BLOCK[r.ordinal][e]*n.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][e]},n.reedSolomonComputeDivisor=function(e){if(e<1||e>255)throw new RangeError("Degree out of range");for(var r=[],t=0;t>>8!=0||r>>>8!=0)throw new RangeError("Byte out of range");for(var t=0,a=7;a>=0;a--)t=t<<1^(t>>>7)*285,t^=(r>>>a&1)*e;return d(t>>>8==0),t},n.prototype.finderPenaltyCountPatterns=function(e){var r=e[1];d(r<=this.size*3);var t=r>0&&e[2]==r&&e[3]==r*3&&e[4]==r&&e[5]==r;return(t&&e[0]>=r*4&&e[6]>=r?1:0)+(t&&e[6]>=r*4&&e[0]>=r?1:0)},n.prototype.finderPenaltyTerminateAndCount=function(e,r,t){return e&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)},n.prototype.finderPenaltyAddHistory=function(e,r){r[0]==0&&(e+=this.size),r.pop(),r.unshift(e)},n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n}();o.QrCode=f;function l(n,e,r){if(e<0||e>31||n>>>e!=0)throw new RangeError("Value out of range");for(var t=e-1;t>=0;t--)r.push(n>>>t&1)}function s(n,e){return(n>>>e&1)!=0}function d(n){if(!n)throw new Error("Assertion error")}var c=function(){function n(e,r,t){if(this.mode=e,this.numChars=r,this.bitData=t,r<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}return n.makeBytes=function(e){for(var r=[],t=0,a=e;t=1<=f.y+f.h?l:l.map(function(d,c){return c=f.x+f.w?d:!1})})}var H={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:Q,validator:function(o){return k(o)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},V=S(S({},H),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),Z=F({name:"QRCodeSvg",props:H,setup:function(o){var f=B(0),l=B(""),s,d=function(){var n=o.value,e=o.level,r=o.margin,t=r>>>0,a=k(e)?e:Q,i=O.QrCode.encodeText(n,U[a]).getModules();if(f.value=i.length+t*2,o.imageSettings.src){var u=K(i,o.size,t,o.imageSettings);s={x:u.x+t,y:u.y+t,width:u.w,height:u.h},u.excavation&&(i=W(i,u.excavation))}l.value=Y(i,t)},c=function(){if(!o.gradient)return null;var n=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return N(o.gradientType==="linear"?"linearGradient":"radialGradient",S({id:"qr-gradient"},n),[N("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),N("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return d(),G(d),function(){return N("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(f.value," ").concat(f.value)},[N("defs",{},[c()]),N("rect",{width:"100%",height:"100%",fill:o.background}),N("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:l.value}),o.imageSettings.src&&N("image",S({href:o.imageSettings.src},s))])}}}),x=F({name:"QRCodeCanvas",props:H,setup:function(o,f){var l=B(null),s=B(null),d=function(){var n=o.value,e=o.level,r=o.size,t=o.margin,a=o.background,i=o.foreground,u=o.gradient,h=o.gradientType,g=o.gradientStartColor,M=o.gradientEndColor,m=t>>>0,C=k(e)?e:Q,p=l.value;if(!!p){var E=p.getContext("2d");if(!!E){var v=O.QrCode.encodeText(n,U[C]).getModules(),w=v.length+m*2,P=s.value,R={x:0,y:0,width:0,height:0},y=o.imageSettings.src&&P!=null&&P.naturalWidth!==0&&P.naturalHeight!==0;if(y){var A=K(v,o.size,m,o.imageSettings);R={x:A.x+m,y:A.y+m,width:A.w,height:A.h},A.excavation&&(v=W(v,A.excavation))}var L=window.devicePixelRatio||1,T=r/w*L;if(p.height=p.width=r*L,E.scale(T,T),E.fillStyle=a,E.fillRect(0,0,w,w),u){var I=void 0;h==="linear"?I=E.createLinearGradient(0,0,w,w):I=E.createRadialGradient(w/2,w/2,0,w/2,w/2,w/2),I.addColorStop(0,g),I.addColorStop(1,M),E.fillStyle=I}else E.fillStyle=i;J?E.fill(new Path2D(Y(v,m))):v.forEach(function(b,D){b.forEach(function(_,q){_&&E.fillRect(q+m,D+m,1,1)})}),y&&E.drawImage(P,R.x,R.y,R.width,R.height)}}};$(d),G(d);var c=f.attrs.style;return function(){return N(X,[N("canvas",S(S({},f.attrs),{ref:l,style:S(S({},c),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&N("img",{ref:s,src:o.imageSettings.src,style:{display:"none"},onLoad:d})])}}}),ee=F({name:"Qrcode",render:function(){var o=this.$props,f=o.renderAs,l=o.value,s=o.size,d=o.margin,c=o.level,n=o.background,e=o.foreground,r=o.imageSettings,t=o.gradient,a=o.gradientType,i=o.gradientStartColor,u=o.gradientEndColor;return N(f==="svg"?Z:x,{value:l,size:s,margin:d,level:c,background:n,foreground:e,imageSettings:r,gradient:t,gradientType:a,gradientStartColor:i,gradientEndColor:u})},props:V});export{ee as Q};