@winkcor/quter 1.0.0 → 1.0.1

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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Ce=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var Tt=(t,e,r)=>e in t?Ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Dt=(t,e)=>{for(var r in e)Ce(t,r,{get:e[r],enumerable:!0})},_t=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ft(e))!Nt.call(t,i)&&i!==r&&Ce(t,i,{get:()=>e[i],enumerable:!(o=Ot(e,i))||o.enumerable});return t};var Gt=t=>_t(Ce({},"__esModule",{value:!0}),t);var Le=(t,e,r)=>Tt(t,typeof e!="symbol"?e+"":e,r);var jr={};Dt(jr,{QRCode:()=>ve,Quter:()=>kt,default:()=>Vr});module.exports=Gt(jr);var q=require("react");function Wt(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function qt(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var Re=Wt(),se=qt(Re);function Ht(t,e){return t===0||e===0?0:Re[se[t]+se[e]]}function Vt(t,e){return Re[se[t]*e%255]}function jt(t){let e=[1];for(let r=0;r<t;r++){let o=[1,Vt(2,r)],i=new Array(e.length+o.length-1).fill(0);for(let n=0;n<e.length;n++)for(let a=0;a<o.length;a++)i[n+a]^=Ht(e[n],o[a]);e=i}return Uint8Array.from(e)}var je=new Map;function Xt(t){let e=je.get(t);return e||(e=jt(t),je.set(t,e)),e}function Yt(t,e){let r=Xt(e),o=r.length,i=t.length,n=new Uint8Array(i+e);n.set(t);for(let a=0;a<i;a++){let c=n[a];if(c!==0){let l=se[c];for(let s=0;s<o;s++)n[a+s]^=Re[se[r[s]]+l]}}return n.slice(i)}var Kt=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],Jt=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Xe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ce(t,e){return Xe[(t-1)*4+e]}function Ye(t,e,r){let o=(e-1)*4+r,i=Kt[o],n=Jt[o],a=Xe[o],c=Math.floor(a/n),l=n-a%n,s=t instanceof Uint8Array?t:Uint8Array.from(t),f=new Array(n),d=new Array(n),R=new Array(n),g=0,y=0;for(let w=0;w<n;w++){let b=w<l?c:c+1;f[w]=g,d[w]=b,b>y&&(y=b),R[w]=Yt(s.subarray(g,g+b),i),g+=b}let x=new Uint8Array(s.length+n*i),v=0;for(let w=0;w<y;w++)for(let b=0;b<n;b++)w<d[b]&&(x[v++]=s[f[b]+w]);for(let w=0;w<i;w++)for(let b=0;b<n;b++)x[v++]=R[b][w];return x}var Ke={numeric:1,alphanumeric:2,byte:4};function Zt(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var ae=Zt();function zt(t){return t<128?ae[t]:-1}function j(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Je=[[1,9],[10,26],[27,40]],er=[0,4,7];function tr(t,e){return t==="numeric"?10*Math.floor(e/3)+er[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function Ue(t,e){let r=0;for(let o of t)r+=4+j(o.mode,e)+tr(o.mode,o.charCount);return Math.ceil(r/8)}function Qe(t,e,r,o){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:o}}var ie=0,le=1,ue=2,rr=["numeric","alphanumeric","byte"];function nr(t){return t<128?1:t<2048?2:t<65536?3:4}var Ze=20,ze=33,et=48;function or(t){let e=0,r=0,o=0,i=0;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);a<128?(r++,a>=48&&a<=57?(o++,i++):ae[a]>=0&&i++):a<2048?r+=2:a>=55296&&a<=56319&&(t.charCodeAt(n+1)&64512)===56320?(r+=4,n++):r+=3,e++}return{count:e,totalBytes:r,digits:o,alnums:i}}function ir(t,e){let r=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),n=0;for(let a=0;a<t.length;){let c=t.codePointAt(a);r[n]=a,o[n]=nr(c),c>=48&&c<=57?i[n]=2:zt(c)>=0&&(i[n]=1),n++,a+=c>65535?2:1}return{cpIndex:r,cpBytes:o,cpClass:i}}function tt(t){let{count:e,totalBytes:r,digits:o,alnums:i}=or(t),n=o*Ze+(i-o)*ze+(r-i)*et,a=s=>{let f=4+Math.min(j("numeric",s),j("alphanumeric",s),j("byte",s));return Math.ceil((n/6+f)/8)},c;if(o===e?c=Qe(t,"numeric",e,r):i===e&&o===0?c=Qe(t,"alphanumeric",e,r):i===0&&(c=Qe(t,"byte",r,r)),c){let s=[c];return{forVersion:()=>s,minDataBytes:a}}let l;return{forVersion(s){return l??(l=ir(t,e)),ar(t,s,e,l)},minDataBytes:a}}function ar(t,e,r,{cpIndex:o,cpBytes:i,cpClass:n}){let a=(4+j("numeric",e))*6,c=(4+j("alphanumeric",e))*6,l=(4+j("byte",e))*6,s=[a,c,l],f=new Int8Array(r*3).fill(-1),d=new Float64Array(3),R=new Float64Array([a,c,l]);for(let m=0;m<r;m++){let p=m*3,h=n[m];d[ie]=1/0,d[le]=1/0,d[ue]=R[ue]+i[m]*et,f[p+ue]=ue,h!==0&&(d[le]=R[le]+ze,f[p+le]=le),h===2&&(d[ie]=R[ie]+Ze,f[p+ie]=ie);for(let u=0;u<3;u++)for(let E=0;E<3;E++){if(f[p+E]===-1)continue;let k=Math.ceil(d[E]/6)*6+s[u];(f[p+u]===-1||k<d[u])&&(d[u]=k,f[p+u]=E)}let A=R;R=d,d=A}let g=ie;for(let m=1;m<3;m++)R[m]<R[g]&&(g=m);let y=new Int8Array(r),x=g;for(let m=r-1;m>=0;m--)x=f[m*3+x],y[m]=x;let v=[],w=0,b=0;for(;b<r;){let m=y[b],p=b,h=0;for(;p<r&&y[p]===m;)h+=i[p],p++;v.push({mode:rr[m],start:o[b],end:p<r?o[p]:t.length,charCount:m===ue?h:p-b,byteStart:w,byteEnd:w+h}),w+=h,b=p}return v}var sr={L:0,M:1,Q:2,H:3},rt;function cr(){return rt??(rt=new TextEncoder)}var Pe=class{constructor(e){Le(this,"bytes");Le(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let o=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},lr=[236,17];function ur(t,e,r,o,i){let n=new Pe(o);for(let s of e)if(n.writeBits(Ke[s.mode],4),n.writeBits(s.charCount,j(s.mode,r)),s.mode==="numeric")for(let f=s.start;f<s.end;f+=3){let d=Math.min(3,s.end-f),R=t.charCodeAt(f)-48;d>=2&&(R=R*10+(t.charCodeAt(f+1)-48)),d>=3&&(R=R*10+(t.charCodeAt(f+2)-48)),n.writeBits(R,d===3?10:d===2?7:4)}else if(s.mode==="alphanumeric")for(let f=s.start;f<s.end;f+=2)if(f+1<s.end){let d=ae[t.charCodeAt(f)]*45+ae[t.charCodeAt(f+1)];n.writeBits(d,11)}else n.writeBits(ae[t.charCodeAt(f)],6);else for(let f=s.byteStart;f<s.byteEnd;f++)n.writeBits(i[f],8);let a=o*8;if(n.bitLength>a)throw new RangeError(`encoded data (${n.bitLength} bits) exceeds capacity (${a} bits) for the selected version`);n.skipBits(Math.min(4,a-n.bitLength)),n.alignToByte();let c=n.bytes,l=0;for(let s=n.bitLength>>3;s<o;s++)c[s]=lr[l%2],l++;return c}function nt(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=sr[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=tt(t),n=g=>i.forVersion(g),a,c;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);a=r,c=n(a);let g=ce(a,o),y=Ue(c,a);if(y>g)throw new RangeError(`data too large for version ${a} with EC level "${e}" (needs ${y} bytes, capacity ${g})`)}else{let g;for(let[y,x]of Je){if(i.minDataBytes(y)>ce(x,o))continue;let v=n(y),w=Ue(v,y);for(let b=y;b<=x;b++)if(w<=ce(b,o)){g={version:b,segments:v};break}if(g)break}if(!g)throw new RangeError(`data too large for any QR version with EC level "${e}"`);a=g.version,c=g.segments}let s=c.some(g=>g.mode==="byte")?cr().encode(t):null,f=ce(a,o),d=ur(t,c,a,f,s);return{codewords:Ye(d,a,o),version:a,ecLevelIndex:o,segments:c}}var dr=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function fr(t,e){let r=t/e*100,o=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(o,i)}function mr(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=dr[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=r(o,i)?1:0}return t}var st=mr(),ot=1488,it=93,at=2047;function gr(t,e,r,o,i){let{prevRow:n,colRunVal:a,colRunLen:c,colWin:l}=i;a.fill(-1),c.fill(0),l.fill(0);let s=0,f=0;for(let d=0;d<r;d++){let R=o+d%12*6,g=d*r,y=d>=10,x=0,v=-1,w=0,b=0,m=-1,p=-1;for(let h=0;h<r;h++){let A=g+h,u=t[A]^st[R+x]&(e[A]^1);f+=u,u===v?w++:(w>=5&&(s+=w-2),v=u,w=1),b=(b<<1|u)&at,h>=10&&(b===ot||b===it)&&(s+=40),u===a[h]?c[h]++:(c[h]>=5&&(s+=c[h]-2),a[h]=u,c[h]=1);let E=(l[h]<<1|u)&at;l[h]=E,y&&(E===ot||E===it)&&(s+=40);let k=n[h];d>0&&h>0&&u===m&&u===k&&u===p&&(s+=3),n[h]=u,p=k,m=u,x++,x===6&&(x=0)}w>=5&&(s+=w-2)}for(let d=0;d<r;d++)c[d]>=5&&(s+=c[d]-2);return s+=fr(f,r*r),s}function br(t,e,r){let o={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,n=1/0;for(let a=0;a<8;a++){let c=gr(t,e,r,a*72,o);c<n&&(n=c,i=a)}return i}function ct(t,e,r){let o=br(t,e,r),i=o*72;for(let n=0;n<r;n++){let a=i+n%12*6,c=n*r,l=0;for(let s=0;s<r;s++)e[c+s]||(t[c+s]^=st[a+l]),l++,l===6&&(l=0)}return o}function hr(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,o=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,i=[6];for(let n=1;n<e;n++)i.push(r-(e-1-n)*o);return i}var pr=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],yr=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function Be(t,e,r,o,i){for(let n=-1;n<=7;n++)for(let a=-1;a<=7;a++){let c=o+n,l=i+a;if(c<0||l<0||c>=r||l>=r)continue;let s=c*r+l;e[s]=1,n===-1||n===7||a===-1||a===7?t[s]=0:n===0||n===6||a===0||a===6||n>=2&&n<=4&&a>=2&&a<=4?t[s]=1:t[s]=0}}function xr(t,e,r,o,i){for(let n=-2;n<=2;n++)for(let a=-2;a<=2;a++){let c=(o+n)*r+(i+a);e[c]=1,n===-2||n===2||a===-2||a===2||n===0&&a===0?t[c]=1:t[c]=0}}function wr(t,e,r){for(let o=8;o<r-8;o++){let i=o%2===0?1:0,n=6*r+o,a=o*r+6;t[n]=i,t[a]=i,e[n]=1,e[a]=1}}var lt=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Cr(t,e){for(let[r,o]of lt)t[r*e+o]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function Rr(t,e,r,o){if(o<7)return;let i=yr[o-7];for(let n=0;n<18;n++){let a=i>>n&1,c=Math.floor(n/3),l=n%3,s=c*r+(r-11+l),f=(r-11+l)*r+c;t[s]=a,e[s]=1,t[f]=a,e[f]=1}}function $r(t,e,r,o){let i=0,n=o.length*8,a=r-1,c=!0;for(;a>=0;){if(a===6){a--;continue}let l=c?r-1:0,s=c?-1:r,f=c?-1:1;for(let d=l;d!==s;d+=f){let R=d*r;for(let g=0;g<=1;g++){let y=a-g;y<0||e[R+y]||(i<n?(t[R+y]=o[i>>3]>>7-(i&7)&1,i++):t[R+y]=0)}}a-=2,c=!c}}var Sr=16,te=new Map;function ut(t,e="M",r){let o=`${e}|${r??"a"}|${t}`,i=te.get(o);if(i)return te.delete(o),te.set(o,i),i;let n=Ar(t,e,r);return te.set(o,n),te.size>Sr&&te.delete(te.keys().next().value),n}function Ar(t,e,r){let o=nt(t,e,r),{codewords:i,version:n,ecLevelIndex:a}=o,c=n*4+17,l=new Uint8Array(c*c),s=new Uint8Array(c*c);Be(l,s,c,0,0),Be(l,s,c,0,c-7),Be(l,s,c,c-7,0),wr(l,s,c);let f=(4*n+9)*c+8;l[f]=1,s[f]=1;let d=hr(n);for(let y of d)for(let x of d)y<=8&&x<=8||y<=8&&x>=c-8||y>=c-8&&x<=8||xr(l,s,c,y,x);Rr(l,s,c,n),Cr(s,c),$r(l,s,c,i);let R=ct(l,s,c),g=pr[a*8+R];return Mr(l,g,c),{matrix:l,version:n,size:c}}function Mr(t,e,r){for(let o=0;o<15;o++){let[i,n]=lt[o];t[i*r+n]=e>>14-o&1}for(let o=0;o<8;o++)t[8*r+r-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(r-7+o)*r+8]=e>>o+8&1;t[(r-8)*r+8]=1}var $=t=>Math.round(t*100)/100,N=t=>Math.round(t*100);function O(t){let e=t<0,r=e?-t:t,o=Math.floor(r/100),i=r-o*100,n;return i===0?n=String(o):i%10===0?n=`${o}.${i/10}`:i<10?n=`${o}.0${i}`:n=`${o}.${i}`,e?`-${n}`:n}function Oe(t,e){return t<=7||t>=e-8?7:-1}function Fe(t,e){return t<=7?e-8:e}function vr(t,e,r,o){let i=O(N(r)),n=new Array(e),a=new Array(e+1),c=new Array(e+1);for(let s=0;s<=e;s++){let f=N(s*r);a[s]=O(f),c[s]=O(-f),s<e&&(n[s]=O(N(o+s*r)))}let l=[];for(let s=0;s<e;s++){let f=s*e,d=O(N(o+s*r)),R=Oe(s,e)+1,g=Fe(s,e),y=-1;for(let x=R;x<g;x++)if(t[f+x]===1)y===-1&&(y=x);else if(y!==-1){let v=x-y;l.push(`M${n[y]},${d}h${a[v]}v${i}h${c[v]}z`),y=-1}if(y!==-1){let x=g-y;l.push(`M${n[y]},${d}h${a[x]}v${i}h${c[x]}z`)}}return l.join(" ")}function Er(t,e,r,o,i){let n=$(r),a=[];if(i==="circle"){let b=n/2,m=$(b),p=`a${O(N(m))},${O(N(m))} 0 1,0 `,h=`${p}${O(N(m*2))},0${p}${O(N(-m*2))},0z`,A=new Array(e);for(let u=0;u<e;u++){let E=$($(o+u*r)+b);A[u]=`M${O(N(E-m))},`}for(let u=0;u<e;u++){let E=u*e,k=`${O(N($(o+u*r)+b))}${h}`,Q=Oe(u,e)+1,I=Fe(u,e);for(let B=Q;B<I;B++)t[E+B]===1&&a.push(A[B]+k)}return a.join(" ")}let c=$(n*.45),l=[O(N(n)),O(N(n-c)),O(N(n-2*c))],s=[O(N(-n)),O(N(-(n-c))),O(N(-(n-2*c)))],f=O(N(c)),d=O(N(-c)),R=`q${f},0 ${f},${f}`,g=`q0,${f} ${d},${f}`,y=`q${d},0 ${d},${d}`,x=`q0,${d} ${f},${d}`,v=new Array(e),w=new Array(e);for(let b=0;b<e;b++){let m=$(o+b*r);v[b]=O(N(m)),w[b]=O(N(m+c))}for(let b=0;b<e;b++){let m=b*e,p=O(N($(o+b*r))),h=Oe(b,e)+1,A=Fe(b,e);for(let u=h;u<A;u++){if(t[m+u]!==1)continue;let E=b>0&&t[m-e+u]===1,k=u<e-1&&t[m+u+1]===1,Q=b<e-1&&t[m+e+u]===1,I=u>0&&t[m+u-1]===1,B=!(E||I),M=!(E||k),L=!(Q||k),T=!(Q||I);a.push(`M${B?w[u]:v[u]},${p}h${l[(B?1:0)+(M?1:0)]}`+(M?R:"")+`v${l[(M?1:0)+(L?1:0)]}`+(L?g:"")+`h${s[(L?1:0)+(T?1:0)]}`+(T?y:"")+`v${s[(T?1:0)+(B?1:0)]}`+(B?x:"")+"z")}}return a.join(" ")}var Ir=2,dt=new WeakMap;function ft(t,e,r,o,i){let n=dt.get(t);n||(n=new Map,dt.set(t,n));let a=`${r}|${o}|${i}`,c=n.get(a);if(c!==void 0)return c;let l=i==="square"?vr(t,e,r,o):Er(t,e,r,o,i);return n.size>=Ir&&n.clear(),n.set(a,l),l}var kr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function mt(t){return t.replace(kr,"")}function gt(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=r+e*2,i=$(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:$(e*i),svgSize:$(i*o)}}function $e(t,e,r){let o=$(r);return`M${$(t)},${$(e)}h${o}v${o}h${-o}z`}function Se(t,e,r,o,i){let n=$(Math.min(i,r/2,o/2)),a=$(r-2*n),c=$(o-2*n);return`M${$(t+n)},${$(e)}h${a}q${n},0 ${n},${n}v${c}q0,${n} ${-n},${n}h${-a}q${-n},0 ${-n},${-n}v${-c}q0,${-n} ${n},${-n}z`}function Lr(t,e,r,o){if(o==="circle"){let i=$(r/2),n=$(i*2);return`M${$(t)},${$(e+r/2)}a${i},${i} 0 1,0 ${n},0a${i},${i} 0 1,0 ${-n},0z`}return o==="rounded"?Se(t,e,r,r,r*.3):$e(t,e,r)}function Qr(t,e,r,o){let i=r/7,n=r-2*i,a=i;if(o==="square"){let s=$e(t,e,r),f=$e(t+a,e+a,n);return`${s} ${f}`}if(o==="rounded"){let s=Se(t,e,r,r,r*.15),f=$e(t+a,e+a,n);return`${s} ${f}`}if(o==="circle"){let s=t+r/2,f=$(e+r/2),d=R=>{let g=$(R),y=$(g*2);return`M${$(s-g)},${f}a${g},${g} 0 1,0 ${y},0a${g},${g} 0 1,0 ${-y},0z`};return`${d(r/2)} ${d(n/2)}`}let c=Se(t,e,r,r,r*.35),l=Se(t+a,e+a,n,n,n*.2);return`${c} ${l}`}function bt(t,e,r,o,i){let n=$(7*r),a=$(3*r),c=$(2*r);return{square:Qr(t,e,n,o),dot:Lr($(t+c),$(e+c),a,i)}}function Ne(t,e,r){return r+t*e}function ht(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,n])=>({x:Ne(n,e,r),y:Ne(i,e,r)}))}var re={L:.0225,M:.04,Q:.0625,H:.09},Ur=re.H,Pr=.4;function Te(t){return t<=re.L?"L":t<=re.M?"M":t<=re.Q?"Q":"H"}var Br=/[\u0000-\u0020]/g;function Ae(t){let e=t.replace(Br,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function yt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function xt(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):Pr:0)*Ur;return r?{ecLevel:r,absoluteArea:Math.min(i,re[r]),targetArea:i,clamped:i>re[r]}:i>0?{ecLevel:Te(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function pt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var Or={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function wt({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:o,moduleSize:i,marginPx:n}){let a=o*i,c=t*a*a,l=Math.sqrt(c*e),s=Math.sqrt(c/e);if(!(l>0)||!(s>0))return Or;let f=l/i,d=s/i,R=re[r]*o*o,g=Math.max(1,o-16),y=Math.min(pt(f),g),x=1;for(;;){let u=Math.min(1,y/f);if(x=Math.min(pt(d*u),g),y*x<=R||y<=1)break;y-=2}let v=Math.min(1,y/f,x/d),w=l*v,b=s*v,m=y*i,p=x*i,h=n+(o-y)/2*i,A=n+(o-x)/2*i;return{clearX:h,clearY:A,clearWidth:m,clearHeight:p,boxX:h+(m-w)/2,boxY:A+(p-b)/2,boxWidth:w,boxHeight:b}}function De(t,e){let r=t?.square?.style??"square",o=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function Fr(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",backgroundColor:a="#ffffff",corner:c,logo:l,qr:s}=t,f=l?.src&&Ae(l.src)?l.src:void 0,d=!!(f||l?.custom),R=s?.errorCorrectionLevel,{ecLevel:g,absoluteArea:y,targetArea:x,clamped:v}=xt(d,l?.size,R),w=[];v&&w.push(`[QRCode] logo.size=${l?.size} needs ECL \u2265 "${Te(x)}"; ECL "${R}" set, logo clamped.`);let{matrix:b,size:m}=ut(e,g,s?.version),{moduleSize:p,marginPx:h,svgSize:A}=gt(r,o,m),u=De(c,n),E=ft(b,m,p,h,i),k=ht(m,p,h).map(S=>{let{square:F,dot:_}=bt($(S.x),$(S.y),p,u.squareStyle,u.dotStyle);return{...u.backgroundColor===void 0?{}:{background:{x:$(S.x),y:$(S.y),width:$(7*p),height:$(7*p),fill:u.backgroundColor}},square:{d:F,fill:u.squareColor,fillRule:"evenodd"},dot:{d:_,fill:u.dotColor}}}),Q=(l?.margin??0)*p,I=wt({absoluteArea:y,aspectRatio:yt(l?.aspectRatio),ecLevel:g,qrSize:m,moduleSize:p,marginPx:h}),B=$(I.boxX+Q),M=$(I.boxY+Q),L=$(Math.max(0,I.boxWidth-Q*2)),T=$(Math.max(0,I.boxHeight-Q*2)),C=d&&L>0&&T>0;return d&&I.boxWidth>0&&I.boxHeight>0&&(L<=0||T<=0)&&w.push(`[QRCode] logo.margin=${l?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:$(r),viewBox:A,ecLevel:g,background:a==="transparent"?void 0:a,modules:E?{d:E,fill:n}:void 0,finders:k,clear:C&&(l?.hideDots??!0)?{x:$(I.clearX),y:$(I.clearY),width:$(I.clearWidth),height:$(I.clearHeight)}:void 0,logo:C?{src:f,x:B,y:M,width:L,height:T,radius:$(Fr(l?.radius)*Math.min(L,T)/2)}:void 0,warnings:w}}function de(t,e){return`${t}${e}`}function Nr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function fe(t){let e=Nr(t)*Math.PI/180,r=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function me(t,e){let{x1:r,y1:o,x2:i,y2:n}=fe(e);return`<linearGradient id="${t}" x1="${r}" y1="${o}" x2="${i}" y2="${n}"><stop offset="0%" stop-color="${Ct(e.startColor)}"/><stop offset="100%" stop-color="${Ct(e.endColor)}"/></linearGradient>`}function Ct(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tr(t){let e=2166136261,r=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function X(t){return mt(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Rt=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),Dr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of Dr)Rt.add(t);function _r(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Gr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!Rt.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${_r(e)}:${i}`}).join(";")}function Me(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",dotGradient:a,backgroundColor:c="#ffffff",backgroundGradient:l,corner:s,logo:f,qr:d,className:R,style:g,ariaLabel:y,idPrefix:x}=t,v=J(t),w=De(s,n),b=f?.src&&Ae(f.src)?f.src:void 0,m=(x??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",p=[e,r,o,i,n,JSON.stringify(a??null),c,JSON.stringify(l??null),w.squareStyle,w.squareColor,w.dotStyle,w.dotColor,s?.backgroundColor??"",JSON.stringify(s?.square?.gradient??null),JSON.stringify(s?.dot?.gradient??null),v.ecLevel,d?.version??"",b??"",f?.size??"",f?.aspectRatio??"",f?.margin??"",f?.hideDots??"",R??"",y??"",x??""];f?.radius!==void 0&&p.push(f.radius),f?.custom&&p.push("custom");let h=`${m}${Tr(p.join("\0"))}`,A=`${h}t`,u=`${h}m`,E=`${h}c`,k=de(h,"d"),Q=de(h,"b"),I=de(h,"s"),B=de(h,"p"),{size:M,viewBox:L,background:T,modules:C,finders:S}=v,{clear:F,logo:_}=v,D=`<svg role="img" aria-labelledby="${A}" width="${M}" height="${M}" viewBox="0 0 ${L} ${L}" xmlns="http://www.w3.org/2000/svg"`;R&&(D+=` class="${X(R)}"`),g&&(D+=` style="${X(Gr(g))}"`),D+=">",D+=`<title id="${A}">${X(y??`QR code: ${e}`)}</title>`;let ge=[a&&me(k,a),l&&me(Q,l),s?.square?.gradient&&me(I,s.square.gradient),s?.dot?.gradient&&me(B,s.dot.gradient)].filter(Boolean);ge.length&&(D+=`<defs>${ge.join("")}</defs>`),T!==void 0&&(D+=`<rect width="${L}" height="${L}" fill="${l?`url(#${Q})`:X(T)}"/>`),F&&(D+=`<defs><mask id="${u}"><rect width="${L}" height="${L}" fill="white"/><rect x="${F.x}" y="${F.y}" width="${F.width}" height="${F.height}" fill="black"/></mask></defs>`),D+=`<g${F?` mask="url(#${u})"`:""}>`,C&&(D+=`<path d="${C.d}" fill="${a?`url(#${k})`:X(C.fill)}"/>`);for(let{background:G,square:P,dot:Y}of S)D+="<g>"+(G?`<rect x="${G.x}" y="${G.y}" width="${G.width}" height="${G.height}" fill="${X(G.fill)}"/>`:"")+`<path d="${P.d}" fill="${s?.square?.gradient?`url(#${I})`:X(P.fill)}" fill-rule="evenodd"/><path d="${Y.d}" fill="${s?.dot?.gradient?`url(#${B})`:X(Y.fill)}"/></g>`;if(D+="</g>",_?.src){let{x:G,y:P,width:Y,height:ne,radius:K}=_;K>0&&(D+=`<defs><clipPath id="${E}"><rect x="${G}" y="${P}" width="${Y}" height="${ne}" rx="${K}" ry="${K}"/></clipPath></defs>`),D+=`<image href="${X(_.src)}" x="${G}" y="${P}" width="${Y}" height="${ne}"${K>0?` clip-path="url(#${E})"`:""}/>`}return D+="</svg>",D}var H=require("react");var U=require("react/jsx-runtime"),$t=(0,H.forwardRef)(function({value:e,size:r,margin:o,dotStyle:i,dotColor:n,dotGradient:a,backgroundColor:c,backgroundGradient:l,corner:s,qr:f,logo:d,className:R,style:g,ariaLabel:y,idPrefix:x,...v},w){let b=(0,H.useId)().replace(/:/g,""),m=d?.element?void 0:d?.src,[p,h]=(0,H.useState)();(0,H.useEffect)(()=>{if(!m){h(void 0);return}let S=new Image;return S.onload=()=>{S.naturalHeight>0&&h({src:m,aspectRatio:S.naturalWidth/S.naturalHeight})},S.onerror=()=>h(void 0),S.src=m,()=>{S.onload=null,S.onerror=null}},[m]);let A=`${b}m`,u=`${b}c`,E=`${b}t`,k=`${b}d`,Q=`${b}b`,I=`${b}s`,B=`${b}p`,M=[];a&&M.push({id:k,gradient:a}),l&&M.push({id:Q,gradient:l}),s?.square?.gradient&&M.push({id:I,gradient:s.square.gradient}),s?.dot?.gradient&&M.push({id:B,gradient:s.dot.gradient});let{element:L,...T}=d??{},C=J({value:e,size:r,margin:o,dotStyle:i,dotColor:n,dotGradient:a,backgroundColor:c,backgroundGradient:l,corner:s,qr:f,logo:d&&{...T,custom:!!L,aspectRatio:d.aspectRatio??(p&&p.src===m?p.aspectRatio:1)}});return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("svg",{...v,ref:w,role:"img","aria-labelledby":E,width:C.size,height:C.size,viewBox:`0 0 ${C.viewBox} ${C.viewBox}`,xmlns:"http://www.w3.org/2000/svg",className:R,style:g,children:[(0,U.jsx)("title",{id:E,children:y??`QR code: ${e}`}),M.length>0&&(0,U.jsx)("defs",{children:M.map(({id:S,gradient:F})=>(0,U.jsxs)("linearGradient",{id:S,...fe(F),children:[(0,U.jsx)("stop",{offset:"0%",stopColor:F.startColor}),(0,U.jsx)("stop",{offset:"100%",stopColor:F.endColor})]},S))}),C.background!==void 0&&(0,U.jsx)("rect",{width:C.viewBox,height:C.viewBox,fill:l?`url(#${Q})`:C.background}),C.clear&&(0,U.jsx)("defs",{children:(0,U.jsxs)("mask",{id:A,children:[(0,U.jsx)("rect",{width:C.viewBox,height:C.viewBox,fill:"white"}),(0,U.jsx)("rect",{x:C.clear.x,y:C.clear.y,width:C.clear.width,height:C.clear.height,fill:"black"})]})}),(0,U.jsxs)("g",{mask:C.clear?`url(#${A})`:void 0,children:[C.modules&&(0,U.jsx)("path",{d:C.modules.d,fill:a?`url(#${k})`:C.modules.fill}),C.finders.map((S,F)=>(0,U.jsxs)("g",{children:[S.background&&(0,U.jsx)("rect",{x:S.background.x,y:S.background.y,width:S.background.width,height:S.background.height,fill:S.background.fill}),(0,U.jsx)("path",{d:S.square.d,fill:s?.square?.gradient?`url(#${I})`:S.square.fill,fillRule:"evenodd"}),(0,U.jsx)("path",{d:S.dot.d,fill:s?.dot?.gradient?`url(#${B})`:S.dot.fill})]},F))]}),C.logo&&(L||C.logo.src)&&(0,U.jsxs)(U.Fragment,{children:[C.logo.radius>0&&(0,U.jsx)("defs",{children:(0,U.jsx)("clipPath",{id:u,children:(0,U.jsx)("rect",{x:C.logo.x,y:C.logo.y,width:C.logo.width,height:C.logo.height,rx:C.logo.radius,ry:C.logo.radius})})}),L?(0,U.jsx)("foreignObject",{x:C.logo.x,y:C.logo.y,width:C.logo.width,height:C.logo.height,clipPath:C.logo.radius>0?`url(#${u})`:void 0,children:L}):(0,U.jsx)("image",{href:C.logo.src,x:C.logo.x,y:C.logo.y,width:C.logo.width,height:C.logo.height,clipPath:C.logo.radius>0?`url(#${u})`:void 0})]})]})})});$t.displayName="QRCode";var ve=(0,H.memo)($t);function St(t,e,r,o){if(o){let i=fe(o),n=Number.parseFloat(i.x1)/100*e,a=Number.parseFloat(i.y1)/100*e,c=Number.parseFloat(i.x2)/100*e,l=Number.parseFloat(i.y2)/100*e,s=t.createLinearGradient(n,a,c,l);s.addColorStop(0,o.startColor),s.addColorStop(1,o.endColor),t.fillStyle=s,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function At(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function Mt(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function vt(t,e,r){let{width:o,height:i,matrixSize:n,margin:a,filter:c,backgroundColor:l,backgroundAlpha:s}=r,f=r.gapColor,d=new Uint8ClampedArray(t),R=o/(n+a*2),g=Math.max(r.coreSize??.4,r.minCoreSize??0),y=(1-g)/2,x=(m,p)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(m-.5)**2+(p-.5)**2<=g**2/4;let h=g*.28,A=Math.max(Math.abs(m-.5)-(g/2-h),0),u=Math.max(Math.abs(p-.5)-(g/2-h),0);return A**2+u**2<=h**2},v=(m,p)=>r.clear!==void 0&&m>=r.clear.x&&p>=r.clear.y&&m<r.clear.x+r.clear.width&&p<r.clear.y+r.clear.height,w=(m,p)=>m<8&&p<8||m>=n-8&&p<8||m<8&&p>=n-8,b=(m,p=t)=>{let h=p[m+3]/255,A=e[m+3]/255,u=h+A*(1-h),E=(k,Q)=>u===0?0:(k*h+Q*A*(1-h))/u;d[m]=E(p[m],e[m]),d[m+1]=E(p[m+1],e[m+1]),d[m+2]=E(p[m+2],e[m+2]),d[m+3]=u*255};for(let m=0;m<i;m+=1)for(let p=0;p<o;p+=1){let h=p/R-a,A=m/R-a,u=(m*o+p)*4;if(h<0||A<0||h>=n||A>=n){d[u]=e[u],d[u+1]=e[u+1],d[u+2]=e[u+2],d[u+3]=e[u+3];continue}let E=Math.floor(h),k=Math.floor(A);if(v(h,A)){d[u]=l[0],d[u+1]=l[1],d[u+2]=l[2],d[u+3]=s;continue}if(w(E,k)){b(u,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let Q=h-E,I=A-k;if(Q>=y&&Q<1-y&&I>=y&&I<1-y&&x(Q,I)){b(u);continue}if(f){let L=f[3]/255,T=e[u+3]/255,C=L+T*(1-L),S=(F,_)=>C===0?0:(F*L+_*T*(1-L))/C;d[u]=S(f[0],e[u]),d[u+1]=S(f[1],e[u+1]),d[u+2]=S(f[2],e[u+2]),d[u+3]=C*255;continue}let M=u;if(c==="color")d[u]=e[M],d[u+1]=e[M+1],d[u+2]=e[M+2];else{let L=e[M]*.2126+e[M+1]*.7152+e[M+2]*.0722;d[u]=L,d[u+1]=L,d[u+2]=L}d[u+3]=e[M+3]}return d}var Z=require("react/jsx-runtime");function Et(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Wr(t,e){e?e(t):console.error("quter: unable to render the image-based QR code.",t)}function Ee(t){return new Promise((e,r)=>{let o=new Image;o.crossOrigin="anonymous",o.onload=()=>e(o),o.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),o.src=t})}function It(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let o=r.getImageData(0,0,1,1).data;return[o[0],o[1],o[2],o[3]]}function qr(t,e,r,o,i,n,a){let c=a==="fill"?Math.max(i/e.naturalWidth,n/e.naturalHeight):Math.min(i/e.naturalWidth,n/e.naturalHeight),l=e.naturalWidth*c,s=e.naturalHeight*c;t.drawImage(e,r+(i-l)/2,o+(n-s)/2,l,s)}function Hr({imagePath:t,imageDotSize:e,imageGapColor:r,transparentFinderBackground:o,logo:i,filter:n,fillType:a,onImageError:c,qrOptions:l,svgProps:s}){let f=(0,q.useRef)(null),[d,R]=(0,q.useState)(!1),[g,y]=(0,q.useState)(),x=l.size??256,v=i?.element,{className:w,style:b,...m}=s;(0,q.useEffect)(()=>{let h=!1,A,u;return R(!1),(async()=>{try{if(!t||!Et(t))throw new Error("The image URL uses an unsupported scheme.");if(n!=="threshold"&&n!=="color")throw new Error('The image filter must be "threshold" or "color".');if(a!=="scale_to_fit"&&a!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let k=i?.element?void 0:i?.src;if(k&&!Et(k))throw new Error("The center image URL uses an unsupported scheme.");let[Q,I]=await Promise.all([Ee(t),k?Ee(k):Promise.resolve(void 0)]);if(h)return;let B=i?{...i,element:void 0,src:void 0,aspectRatio:i.aspectRatio??(I?I.naturalWidth/I.naturalHeight:1),custom:!0}:void 0,M=J({...l,logo:B}),L=J({...l,corner:{square:{style:"square"},dot:{style:"square"}},logo:B});y(M.logo?{...M.logo,viewBox:M.viewBox}:void 0);let T=L.finders[0].square.d,S=Number(T.match(/h([\d.]+)v/)?.[1])/7,F=Number(T.match(/^M([\d.]+),/)?.[1])/S,_=Math.round(L.viewBox/S-F*2),D=_+F*2;if(!Number.isFinite(S)||!Number.isFinite(F)||_<21)throw new Error("Unable to determine QR module dimensions.");let ge=Me({...l,dotColor:l.dotColor??"#000000",backgroundColor:"#ffffff",backgroundGradient:void 0,logo:B,ariaLabel:`QR code: ${l.value}`});A=URL.createObjectURL(new Blob([ge],{type:"image/svg+xml"}));let G=await Ee(A),P=Math.max(Math.ceil(D*8),Math.ceil(x*2)),Y;if(o){let ee=Me({...l,corner:l.corner?{...l.corner,backgroundColor:void 0}:void 0,dotColor:l.dotColor??"#000000",backgroundColor:"transparent",backgroundGradient:void 0,logo:B,ariaLabel:`QR code: ${l.value}`});u=URL.createObjectURL(new Blob([ee],{type:"image/svg+xml"}));let we=await Ee(u);if(h||!f.current)return;let W=document.createElement("canvas");W.width=P,W.height=W.width;let oe=W.getContext("2d",{willReadFrequently:!0});if(!oe)throw new Error("Canvas 2D context is unavailable.");oe.drawImage(we,0,0,W.width,W.height),Y=oe.getImageData(0,0,W.width,W.height).data}if(h||!f.current)return;let ne=document.createElement("canvas");ne.width=P,ne.height=P;let K=ne.getContext("2d",{willReadFrequently:!0}),Ie=document.createElement("canvas");Ie.width=P,Ie.height=P;let be=Ie.getContext("2d",{willReadFrequently:!0});if(!K||!be)throw new Error("Canvas 2D context is unavailable.");K.drawImage(G,0,0,P,P);let he=l.backgroundColor??"#ffffff",pe=It(he==="transparent"?"#ffffff":he),Lt=r?It(r):void 0,Qt=[pe[0],pe[1],pe[2]];St(be,P,he,l.backgroundGradient);let _e=P/D,ye=F,Ge=ye*_e,We=_*_e;qr(be,Q,Ge,Ge,We,We,a);let Ut=K.getImageData(0,0,P,P).data,Pt=be.getImageData(0,0,P,P).data,Bt=vt(Ut,Pt,{width:P,height:P,matrixSize:_,margin:ye,minCoreSize:Math.min(1,D/Math.max(1,Math.round(x))),coreSize:e,dotStyle:l.dotStyle,clear:M.clear?{x:M.clear.x/S-ye,y:M.clear.y/S-ye,width:M.clear.width/S,height:M.clear.height/S}:void 0,filter:n,backgroundColor:Qt,backgroundAlpha:he==="transparent"?0:pe[3],gapColor:Lt,transparentFinderBackground:o,finderPixels:Y}),z=f.current;z.width=Math.round(x),z.height=Math.round(x);let ke=z.getContext("2d");if(!ke)throw new Error("Canvas 2D context is unavailable.");let xe=document.createElement("canvas");xe.width=P,xe.height=P;let V=xe.getContext("2d");if(!V)throw new Error("Canvas 2D context is unavailable.");let qe=V.createImageData(P,P);if(qe.data.set(Bt),V.putImageData(qe,0,0),I&&M.logo){let ee=P/M.viewBox,we=M.logo.x*ee,W=M.logo.y*ee,oe=M.logo.width*ee,He=M.logo.height*ee,Ve=M.logo.radius*ee;V.save(),Ve>0&&(V.beginPath(),V.roundRect(we,W,oe,He,Ve),V.clip()),V.drawImage(I,we,W,oe,He),V.restore()}ke.clearRect(0,0,z.width,z.height),ke.drawImage(xe,0,0,z.width,z.height),h||R(!0)}catch(k){h||Wr(k,c)}})(),()=>{h=!0,A&&URL.revokeObjectURL(A),u&&URL.revokeObjectURL(u)}},[n,a,e,r,t,i,c,l,x]);let p=(0,q.useMemo)(()=>{if(g)return{position:"absolute",left:`${g.x/g.viewBox*100}%`,top:`${g.y/g.viewBox*100}%`,width:`${g.width/g.viewBox*100}%`,height:`${g.height/g.viewBox*100}%`,borderRadius:`${g.radius/Math.min(g.width,g.height)*100}%`,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",pointerEvents:"none"}},[g]);return(0,Z.jsxs)("span",{className:w,style:{position:"relative",display:"inline-block",lineHeight:0,...b},children:[(0,Z.jsx)(ve,{...m,...l,className:w,logo:i,style:{...b,opacity:d?0:b?.opacity}}),(0,Z.jsx)("canvas",{ref:f,"aria-hidden":"true",style:{...b,position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",visibility:d?"visible":"hidden"}}),v&&p&&(0,Z.jsx)("span",{style:p,children:v})]})}function kt({imagePath:t,imageDotStyle:e,imageDotSize:r,imageGapColor:o,transparentFinderBackground:i,logo:n,imageColor:a,filter:c,fillType:l="scale_to_fit",background:s,version:f,onImageError:d,backgroundColor:R,dotGradient:g,backgroundGradient:y,qr:x,value:v,size:w,margin:b,dotStyle:m,dotColor:p,corner:h,ariaLabel:A,...u}){let E=Mt(a,c),k=t?At(r):r??.4,Q=(0,q.useMemo)(()=>({value:v,size:w,margin:b,dotStyle:m,dotColor:p,dotGradient:g,corner:h,backgroundGradient:y,backgroundColor:R??s??"#ffffff",qr:{errorCorrectionLevel:t?"H":void 0,...x,version:f??x?.version}}),[s,R,y,h,p,g,m,t,b,x,w,v,f]),I=(0,q.useMemo)(()=>({...Q,dotStyle:e??Q.dotStyle}),[e,Q]);return t?(0,Z.jsx)(Hr,{imagePath:t,imageDotSize:k,imageGapColor:o,transparentFinderBackground:i??Q.corner?.backgroundColor==="transparent",logo:n,filter:E,fillType:l,onImageError:d,qrOptions:I,svgProps:{...u,ariaLabel:A}}):(0,Z.jsx)(ve,{...u,...Q,ariaLabel:A,logo:n})}var Vr=kt;0&&(module.exports={QRCode,Quter});
1
+ "use strict";var Ce=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var Dt=(t,e,r)=>e in t?Ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _t=(t,e)=>{for(var r in e)Ce(t,r,{get:e[r],enumerable:!0})},Gt=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nt(e))!Tt.call(t,i)&&i!==r&&Ce(t,i,{get:()=>e[i],enumerable:!(o=Ft(e,i))||o.enumerable});return t};var Wt=t=>Gt(Ce({},"__esModule",{value:!0}),t);var Le=(t,e,r)=>Dt(t,typeof e!="symbol"?e+"":e,r);var jr={};_t(jr,{QRCode:()=>ve,Quter:()=>Lt,default:()=>Vr});module.exports=Wt(jr);var q=require("react");function qt(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function Ht(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var Re=qt(),se=Ht(Re);function Vt(t,e){return t===0||e===0?0:Re[se[t]+se[e]]}function jt(t,e){return Re[se[t]*e%255]}function Xt(t){let e=[1];for(let r=0;r<t;r++){let o=[1,jt(2,r)],i=new Array(e.length+o.length-1).fill(0);for(let n=0;n<e.length;n++)for(let a=0;a<o.length;a++)i[n+a]^=Vt(e[n],o[a]);e=i}return Uint8Array.from(e)}var je=new Map;function Yt(t){let e=je.get(t);return e||(e=Xt(t),je.set(t,e)),e}function Kt(t,e){let r=Yt(e),o=r.length,i=t.length,n=new Uint8Array(i+e);n.set(t);for(let a=0;a<i;a++){let c=n[a];if(c!==0){let l=se[c];for(let s=0;s<o;s++)n[a+s]^=Re[se[r[s]]+l]}}return n.slice(i)}var Jt=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],Zt=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Xe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ce(t,e){return Xe[(t-1)*4+e]}function Ye(t,e,r){let o=(e-1)*4+r,i=Jt[o],n=Zt[o],a=Xe[o],c=Math.floor(a/n),l=n-a%n,s=t instanceof Uint8Array?t:Uint8Array.from(t),f=new Array(n),d=new Array(n),R=new Array(n),b=0,y=0;for(let C=0;C<n;C++){let h=C<l?c:c+1;f[C]=b,d[C]=h,h>y&&(y=h),R[C]=Kt(s.subarray(b,b+h),i),b+=h}let x=new Uint8Array(s.length+n*i),E=0;for(let C=0;C<y;C++)for(let h=0;h<n;h++)C<d[h]&&(x[E++]=s[f[h]+C]);for(let C=0;C<i;C++)for(let h=0;h<n;h++)x[E++]=R[h][C];return x}var Ke={numeric:1,alphanumeric:2,byte:4};function zt(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var ae=zt();function er(t){return t<128?ae[t]:-1}function j(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Je=[[1,9],[10,26],[27,40]],tr=[0,4,7];function rr(t,e){return t==="numeric"?10*Math.floor(e/3)+tr[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function Ue(t,e){let r=0;for(let o of t)r+=4+j(o.mode,e)+rr(o.mode,o.charCount);return Math.ceil(r/8)}function Qe(t,e,r,o){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:o}}var ie=0,le=1,ue=2,nr=["numeric","alphanumeric","byte"];function or(t){return t<128?1:t<2048?2:t<65536?3:4}var Ze=20,ze=33,et=48;function ir(t){let e=0,r=0,o=0,i=0;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);a<128?(r++,a>=48&&a<=57?(o++,i++):ae[a]>=0&&i++):a<2048?r+=2:a>=55296&&a<=56319&&(t.charCodeAt(n+1)&64512)===56320?(r+=4,n++):r+=3,e++}return{count:e,totalBytes:r,digits:o,alnums:i}}function ar(t,e){let r=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),n=0;for(let a=0;a<t.length;){let c=t.codePointAt(a);r[n]=a,o[n]=or(c),c>=48&&c<=57?i[n]=2:er(c)>=0&&(i[n]=1),n++,a+=c>65535?2:1}return{cpIndex:r,cpBytes:o,cpClass:i}}function tt(t){let{count:e,totalBytes:r,digits:o,alnums:i}=ir(t),n=o*Ze+(i-o)*ze+(r-i)*et,a=s=>{let f=4+Math.min(j("numeric",s),j("alphanumeric",s),j("byte",s));return Math.ceil((n/6+f)/8)},c;if(o===e?c=Qe(t,"numeric",e,r):i===e&&o===0?c=Qe(t,"alphanumeric",e,r):i===0&&(c=Qe(t,"byte",r,r)),c){let s=[c];return{forVersion:()=>s,minDataBytes:a}}let l;return{forVersion(s){return l??(l=ar(t,e)),sr(t,s,e,l)},minDataBytes:a}}function sr(t,e,r,{cpIndex:o,cpBytes:i,cpClass:n}){let a=(4+j("numeric",e))*6,c=(4+j("alphanumeric",e))*6,l=(4+j("byte",e))*6,s=[a,c,l],f=new Int8Array(r*3).fill(-1),d=new Float64Array(3),R=new Float64Array([a,c,l]);for(let m=0;m<r;m++){let p=m*3,g=n[m];d[ie]=1/0,d[le]=1/0,d[ue]=R[ue]+i[m]*et,f[p+ue]=ue,g!==0&&(d[le]=R[le]+ze,f[p+le]=le),g===2&&(d[ie]=R[ie]+Ze,f[p+ie]=ie);for(let u=0;u<3;u++)for(let v=0;v<3;v++){if(f[p+v]===-1)continue;let k=Math.ceil(d[v]/6)*6+s[u];(f[p+u]===-1||k<d[u])&&(d[u]=k,f[p+u]=v)}let M=R;R=d,d=M}let b=ie;for(let m=1;m<3;m++)R[m]<R[b]&&(b=m);let y=new Int8Array(r),x=b;for(let m=r-1;m>=0;m--)x=f[m*3+x],y[m]=x;let E=[],C=0,h=0;for(;h<r;){let m=y[h],p=h,g=0;for(;p<r&&y[p]===m;)g+=i[p],p++;E.push({mode:nr[m],start:o[h],end:p<r?o[p]:t.length,charCount:m===ue?g:p-h,byteStart:C,byteEnd:C+g}),C+=g,h=p}return E}var cr={L:0,M:1,Q:2,H:3},rt;function lr(){return rt??(rt=new TextEncoder)}var Pe=class{constructor(e){Le(this,"bytes");Le(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let o=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},ur=[236,17];function dr(t,e,r,o,i){let n=new Pe(o);for(let s of e)if(n.writeBits(Ke[s.mode],4),n.writeBits(s.charCount,j(s.mode,r)),s.mode==="numeric")for(let f=s.start;f<s.end;f+=3){let d=Math.min(3,s.end-f),R=t.charCodeAt(f)-48;d>=2&&(R=R*10+(t.charCodeAt(f+1)-48)),d>=3&&(R=R*10+(t.charCodeAt(f+2)-48)),n.writeBits(R,d===3?10:d===2?7:4)}else if(s.mode==="alphanumeric")for(let f=s.start;f<s.end;f+=2)if(f+1<s.end){let d=ae[t.charCodeAt(f)]*45+ae[t.charCodeAt(f+1)];n.writeBits(d,11)}else n.writeBits(ae[t.charCodeAt(f)],6);else for(let f=s.byteStart;f<s.byteEnd;f++)n.writeBits(i[f],8);let a=o*8;if(n.bitLength>a)throw new RangeError(`encoded data (${n.bitLength} bits) exceeds capacity (${a} bits) for the selected version`);n.skipBits(Math.min(4,a-n.bitLength)),n.alignToByte();let c=n.bytes,l=0;for(let s=n.bitLength>>3;s<o;s++)c[s]=ur[l%2],l++;return c}function nt(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=cr[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=tt(t),n=b=>i.forVersion(b),a,c;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);a=r,c=n(a);let b=ce(a,o),y=Ue(c,a);if(y>b)throw new RangeError(`data too large for version ${a} with EC level "${e}" (needs ${y} bytes, capacity ${b})`)}else{let b;for(let[y,x]of Je){if(i.minDataBytes(y)>ce(x,o))continue;let E=n(y),C=Ue(E,y);for(let h=y;h<=x;h++)if(C<=ce(h,o)){b={version:h,segments:E};break}if(b)break}if(!b)throw new RangeError(`data too large for any QR version with EC level "${e}"`);a=b.version,c=b.segments}let s=c.some(b=>b.mode==="byte")?lr().encode(t):null,f=ce(a,o),d=dr(t,c,a,f,s);return{codewords:Ye(d,a,o),version:a,ecLevelIndex:o,segments:c}}var fr=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function mr(t,e){let r=t/e*100,o=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(o,i)}function gr(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=fr[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=r(o,i)?1:0}return t}var st=gr(),ot=1488,it=93,at=2047;function br(t,e,r,o,i){let{prevRow:n,colRunVal:a,colRunLen:c,colWin:l}=i;a.fill(-1),c.fill(0),l.fill(0);let s=0,f=0;for(let d=0;d<r;d++){let R=o+d%12*6,b=d*r,y=d>=10,x=0,E=-1,C=0,h=0,m=-1,p=-1;for(let g=0;g<r;g++){let M=b+g,u=t[M]^st[R+x]&(e[M]^1);f+=u,u===E?C++:(C>=5&&(s+=C-2),E=u,C=1),h=(h<<1|u)&at,g>=10&&(h===ot||h===it)&&(s+=40),u===a[g]?c[g]++:(c[g]>=5&&(s+=c[g]-2),a[g]=u,c[g]=1);let v=(l[g]<<1|u)&at;l[g]=v,y&&(v===ot||v===it)&&(s+=40);let k=n[g];d>0&&g>0&&u===m&&u===k&&u===p&&(s+=3),n[g]=u,p=k,m=u,x++,x===6&&(x=0)}C>=5&&(s+=C-2)}for(let d=0;d<r;d++)c[d]>=5&&(s+=c[d]-2);return s+=mr(f,r*r),s}function hr(t,e,r){let o={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,n=1/0;for(let a=0;a<8;a++){let c=br(t,e,r,a*72,o);c<n&&(n=c,i=a)}return i}function ct(t,e,r){let o=hr(t,e,r),i=o*72;for(let n=0;n<r;n++){let a=i+n%12*6,c=n*r,l=0;for(let s=0;s<r;s++)e[c+s]||(t[c+s]^=st[a+l]),l++,l===6&&(l=0)}return o}function pr(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,o=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,i=[6];for(let n=1;n<e;n++)i.push(r-(e-1-n)*o);return i}var yr=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],xr=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function Be(t,e,r,o,i){for(let n=-1;n<=7;n++)for(let a=-1;a<=7;a++){let c=o+n,l=i+a;if(c<0||l<0||c>=r||l>=r)continue;let s=c*r+l;e[s]=1,n===-1||n===7||a===-1||a===7?t[s]=0:n===0||n===6||a===0||a===6||n>=2&&n<=4&&a>=2&&a<=4?t[s]=1:t[s]=0}}function wr(t,e,r,o,i){for(let n=-2;n<=2;n++)for(let a=-2;a<=2;a++){let c=(o+n)*r+(i+a);e[c]=1,n===-2||n===2||a===-2||a===2||n===0&&a===0?t[c]=1:t[c]=0}}function Cr(t,e,r){for(let o=8;o<r-8;o++){let i=o%2===0?1:0,n=6*r+o,a=o*r+6;t[n]=i,t[a]=i,e[n]=1,e[a]=1}}var lt=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Rr(t,e){for(let[r,o]of lt)t[r*e+o]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function $r(t,e,r,o){if(o<7)return;let i=xr[o-7];for(let n=0;n<18;n++){let a=i>>n&1,c=Math.floor(n/3),l=n%3,s=c*r+(r-11+l),f=(r-11+l)*r+c;t[s]=a,e[s]=1,t[f]=a,e[f]=1}}function Mr(t,e,r,o){let i=0,n=o.length*8,a=r-1,c=!0;for(;a>=0;){if(a===6){a--;continue}let l=c?r-1:0,s=c?-1:r,f=c?-1:1;for(let d=l;d!==s;d+=f){let R=d*r;for(let b=0;b<=1;b++){let y=a-b;y<0||e[R+y]||(i<n?(t[R+y]=o[i>>3]>>7-(i&7)&1,i++):t[R+y]=0)}}a-=2,c=!c}}var Sr=16,te=new Map;function ut(t,e="M",r){let o=`${e}|${r??"a"}|${t}`,i=te.get(o);if(i)return te.delete(o),te.set(o,i),i;let n=Ar(t,e,r);return te.set(o,n),te.size>Sr&&te.delete(te.keys().next().value),n}function Ar(t,e,r){let o=nt(t,e,r),{codewords:i,version:n,ecLevelIndex:a}=o,c=n*4+17,l=new Uint8Array(c*c),s=new Uint8Array(c*c);Be(l,s,c,0,0),Be(l,s,c,0,c-7),Be(l,s,c,c-7,0),Cr(l,s,c);let f=(4*n+9)*c+8;l[f]=1,s[f]=1;let d=pr(n);for(let y of d)for(let x of d)y<=8&&x<=8||y<=8&&x>=c-8||y>=c-8&&x<=8||wr(l,s,c,y,x);$r(l,s,c,n),Rr(s,c),Mr(l,s,c,i);let R=ct(l,s,c),b=yr[a*8+R];return vr(l,b,c),{matrix:l,version:n,size:c}}function vr(t,e,r){for(let o=0;o<15;o++){let[i,n]=lt[o];t[i*r+n]=e>>14-o&1}for(let o=0;o<8;o++)t[8*r+r-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(r-7+o)*r+8]=e>>o+8&1;t[(r-8)*r+8]=1}var $=t=>Math.round(t*100)/100,N=t=>Math.round(t*100);function F(t){let e=t<0,r=e?-t:t,o=Math.floor(r/100),i=r-o*100,n;return i===0?n=String(o):i%10===0?n=`${o}.${i/10}`:i<10?n=`${o}.0${i}`:n=`${o}.${i}`,e?`-${n}`:n}function Oe(t,e){return t<=7||t>=e-8?7:-1}function Fe(t,e){return t<=7?e-8:e}function Er(t,e,r,o){let i=F(N(r)),n=new Array(e),a=new Array(e+1),c=new Array(e+1);for(let s=0;s<=e;s++){let f=N(s*r);a[s]=F(f),c[s]=F(-f),s<e&&(n[s]=F(N(o+s*r)))}let l=[];for(let s=0;s<e;s++){let f=s*e,d=F(N(o+s*r)),R=Oe(s,e)+1,b=Fe(s,e),y=-1;for(let x=R;x<b;x++)if(t[f+x]===1)y===-1&&(y=x);else if(y!==-1){let E=x-y;l.push(`M${n[y]},${d}h${a[E]}v${i}h${c[E]}z`),y=-1}if(y!==-1){let x=b-y;l.push(`M${n[y]},${d}h${a[x]}v${i}h${c[x]}z`)}}return l.join(" ")}function Ir(t,e,r,o,i){let n=$(r),a=[];if(i==="circle"){let h=n/2,m=$(h),p=`a${F(N(m))},${F(N(m))} 0 1,0 `,g=`${p}${F(N(m*2))},0${p}${F(N(-m*2))},0z`,M=new Array(e);for(let u=0;u<e;u++){let v=$($(o+u*r)+h);M[u]=`M${F(N(v-m))},`}for(let u=0;u<e;u++){let v=u*e,k=`${F(N($(o+u*r)+h))}${g}`,Q=Oe(u,e)+1,I=Fe(u,e);for(let B=Q;B<I;B++)t[v+B]===1&&a.push(M[B]+k)}return a.join(" ")}let c=$(n*.45),l=[F(N(n)),F(N(n-c)),F(N(n-2*c))],s=[F(N(-n)),F(N(-(n-c))),F(N(-(n-2*c)))],f=F(N(c)),d=F(N(-c)),R=`q${f},0 ${f},${f}`,b=`q0,${f} ${d},${f}`,y=`q${d},0 ${d},${d}`,x=`q0,${d} ${f},${d}`,E=new Array(e),C=new Array(e);for(let h=0;h<e;h++){let m=$(o+h*r);E[h]=F(N(m)),C[h]=F(N(m+c))}for(let h=0;h<e;h++){let m=h*e,p=F(N($(o+h*r))),g=Oe(h,e)+1,M=Fe(h,e);for(let u=g;u<M;u++){if(t[m+u]!==1)continue;let v=h>0&&t[m-e+u]===1,k=u<e-1&&t[m+u+1]===1,Q=h<e-1&&t[m+e+u]===1,I=u>0&&t[m+u-1]===1,B=!(v||I),A=!(v||k),L=!(Q||k),T=!(Q||I);a.push(`M${B?C[u]:E[u]},${p}h${l[(B?1:0)+(A?1:0)]}`+(A?R:"")+`v${l[(A?1:0)+(L?1:0)]}`+(L?b:"")+`h${s[(L?1:0)+(T?1:0)]}`+(T?y:"")+`v${s[(T?1:0)+(B?1:0)]}`+(B?x:"")+"z")}}return a.join(" ")}var kr=2,dt=new WeakMap;function ft(t,e,r,o,i){let n=dt.get(t);n||(n=new Map,dt.set(t,n));let a=`${r}|${o}|${i}`,c=n.get(a);if(c!==void 0)return c;let l=i==="square"?Er(t,e,r,o):Ir(t,e,r,o,i);return n.size>=kr&&n.clear(),n.set(a,l),l}var Lr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function mt(t){return t.replace(Lr,"")}function gt(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=r+e*2,i=$(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:$(e*i),svgSize:$(i*o)}}function $e(t,e,r){let o=$(r);return`M${$(t)},${$(e)}h${o}v${o}h${-o}z`}function Me(t,e,r,o,i){let n=$(Math.min(i,r/2,o/2)),a=$(r-2*n),c=$(o-2*n);return`M${$(t+n)},${$(e)}h${a}q${n},0 ${n},${n}v${c}q0,${n} ${-n},${n}h${-a}q${-n},0 ${-n},${-n}v${-c}q0,${-n} ${n},${-n}z`}function Qr(t,e,r,o){if(o==="circle"){let i=$(r/2),n=$(i*2);return`M${$(t)},${$(e+r/2)}a${i},${i} 0 1,0 ${n},0a${i},${i} 0 1,0 ${-n},0z`}return o==="rounded"?Me(t,e,r,r,r*.3):$e(t,e,r)}function Ur(t,e,r,o){let i=r/7,n=r-2*i,a=i;if(o==="square"){let s=$e(t,e,r),f=$e(t+a,e+a,n);return`${s} ${f}`}if(o==="rounded"){let s=Me(t,e,r,r,r*.15),f=$e(t+a,e+a,n);return`${s} ${f}`}if(o==="circle"){let s=t+r/2,f=$(e+r/2),d=R=>{let b=$(R),y=$(b*2);return`M${$(s-b)},${f}a${b},${b} 0 1,0 ${y},0a${b},${b} 0 1,0 ${-y},0z`};return`${d(r/2)} ${d(n/2)}`}let c=Me(t,e,r,r,r*.35),l=Me(t+a,e+a,n,n,n*.2);return`${c} ${l}`}function bt(t,e,r,o,i){let n=$(7*r),a=$(3*r),c=$(2*r);return{square:Ur(t,e,n,o),dot:Qr($(t+c),$(e+c),a,i)}}function Ne(t,e,r){return r+t*e}function ht(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,n])=>({x:Ne(n,e,r),y:Ne(i,e,r)}))}var re={L:.0225,M:.04,Q:.0625,H:.09},Pr=re.H,Br=.4;function Te(t){return t<=re.L?"L":t<=re.M?"M":t<=re.Q?"Q":"H"}var Or=/[\u0000-\u0020]/g;function Se(t){let e=t.replace(Or,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function yt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function xt(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):Br:0)*Pr;return r?{ecLevel:r,absoluteArea:Math.min(i,re[r]),targetArea:i,clamped:i>re[r]}:i>0?{ecLevel:Te(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function pt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var Fr={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function wt({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:o,moduleSize:i,marginPx:n}){let a=o*i,c=t*a*a,l=Math.sqrt(c*e),s=Math.sqrt(c/e);if(!(l>0)||!(s>0))return Fr;let f=l/i,d=s/i,R=re[r]*o*o,b=Math.max(1,o-16),y=Math.min(pt(f),b),x=1;for(;;){let u=Math.min(1,y/f);if(x=Math.min(pt(d*u),b),y*x<=R||y<=1)break;y-=2}let E=Math.min(1,y/f,x/d),C=l*E,h=s*E,m=y*i,p=x*i,g=n+(o-y)/2*i,M=n+(o-x)/2*i;return{clearX:g,clearY:M,clearWidth:m,clearHeight:p,boxX:g+(m-C)/2,boxY:M+(p-h)/2,boxWidth:C,boxHeight:h}}function De(t,e){let r=t?.square?.style??"square",o=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function Ct(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",backgroundColor:a="#ffffff",corner:c,logo:l,qr:s}=t,f=l?.src&&Se(l.src)?l.src:void 0,d=!!(f||l?.custom),R=s?.errorCorrectionLevel,{ecLevel:b,absoluteArea:y,targetArea:x,clamped:E}=xt(d,l?.size,R),C=[];E&&C.push(`[QRCode] logo.size=${l?.size} needs ECL \u2265 "${Te(x)}"; ECL "${R}" set, logo clamped.`);let{matrix:h,size:m}=ut(e,b,s?.version),{moduleSize:p,marginPx:g,svgSize:M}=gt(r,o,m),u=De(c,n),v=ft(h,m,p,g,i),k=ht(m,p,g).map(S=>{let{square:O,dot:_}=bt($(S.x),$(S.y),p,u.squareStyle,u.dotStyle);return{...u.backgroundColor===void 0?{}:{background:{x:$(S.x),y:$(S.y),width:$(7*p),height:$(7*p),fill:u.backgroundColor}},square:{d:O,fill:u.squareColor,fillRule:"evenodd"},dot:{d:_,fill:u.dotColor}}}),Q=(l?.margin??0)*p,I=wt({absoluteArea:y,aspectRatio:yt(l?.aspectRatio),ecLevel:b,qrSize:m,moduleSize:p,marginPx:g}),B=$(I.boxX+Q),A=$(I.boxY+Q),L=$(Math.max(0,I.boxWidth-Q*2)),T=$(Math.max(0,I.boxHeight-Q*2)),w=d&&L>0&&T>0;return d&&I.boxWidth>0&&I.boxHeight>0&&(L<=0||T<=0)&&C.push(`[QRCode] logo.margin=${l?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:$(r),viewBox:M,ecLevel:b,background:a==="transparent"?void 0:a,modules:v?{d:v,fill:n}:void 0,finders:k,clear:w&&(l?.hideDots??!0)?{x:$(I.clearX),y:$(I.clearY),width:$(I.clearWidth),height:$(I.clearHeight),radius:$(Ct(l?.radius)*Math.min(I.clearWidth,I.clearHeight)/2)}:void 0,logo:w?{src:f,x:B,y:A,width:L,height:T,radius:$(Ct(l?.radius)*Math.min(L,T)/2)}:void 0,warnings:C}}function de(t,e){return`${t}${e}`}function Nr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function fe(t){let e=Nr(t)*Math.PI/180,r=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function me(t,e){let{x1:r,y1:o,x2:i,y2:n}=fe(e);return`<linearGradient id="${t}" x1="${r}" y1="${o}" x2="${i}" y2="${n}"><stop offset="0%" stop-color="${Rt(e.startColor)}"/><stop offset="100%" stop-color="${Rt(e.endColor)}"/></linearGradient>`}function Rt(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tr(t){let e=2166136261,r=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function X(t){return mt(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var $t=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),Dr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of Dr)$t.add(t);function _r(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Gr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!$t.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${_r(e)}:${i}`}).join(";")}function Ae(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",dotGradient:a,backgroundColor:c="#ffffff",backgroundGradient:l,corner:s,logo:f,qr:d,className:R,style:b,ariaLabel:y,idPrefix:x}=t,E=J(t),C=De(s,n),h=f?.src&&Se(f.src)?f.src:void 0,m=(x??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",p=[e,r,o,i,n,JSON.stringify(a??null),c,JSON.stringify(l??null),C.squareStyle,C.squareColor,C.dotStyle,C.dotColor,s?.backgroundColor??"",JSON.stringify(s?.square?.gradient??null),JSON.stringify(s?.dot?.gradient??null),E.ecLevel,d?.version??"",h??"",f?.size??"",f?.aspectRatio??"",f?.margin??"",f?.hideDots??"",R??"",y??"",x??""];f?.radius!==void 0&&p.push(f.radius),f?.custom&&p.push("custom");let g=`${m}${Tr(p.join("\0"))}`,M=`${g}t`,u=`${g}m`,v=`${g}c`,k=de(g,"d"),Q=de(g,"b"),I=de(g,"s"),B=de(g,"p"),{size:A,viewBox:L,background:T,modules:w,finders:S}=E,{clear:O,logo:_}=E,D=`<svg role="img" aria-labelledby="${M}" width="${A}" height="${A}" viewBox="0 0 ${L} ${L}" xmlns="http://www.w3.org/2000/svg"`;R&&(D+=` class="${X(R)}"`),b&&(D+=` style="${X(Gr(b))}"`),D+=">",D+=`<title id="${M}">${X(y??`QR code: ${e}`)}</title>`;let ge=[a&&me(k,a),l&&me(Q,l),s?.square?.gradient&&me(I,s.square.gradient),s?.dot?.gradient&&me(B,s.dot.gradient)].filter(Boolean);ge.length&&(D+=`<defs>${ge.join("")}</defs>`),T!==void 0&&(D+=`<rect width="${L}" height="${L}" fill="${l?`url(#${Q})`:X(T)}"/>`),O&&(D+=`<defs><mask id="${u}"><rect width="${L}" height="${L}" fill="white"/><rect x="${O.x}" y="${O.y}" width="${O.width}" height="${O.height}" rx="${O.radius}" ry="${O.radius}" fill="black"/></mask></defs>`),D+=`<g${O?` mask="url(#${u})"`:""}>`,w&&(D+=`<path d="${w.d}" fill="${a?`url(#${k})`:X(w.fill)}"/>`);for(let{background:G,square:P,dot:Y}of S)D+="<g>"+(G?`<rect x="${G.x}" y="${G.y}" width="${G.width}" height="${G.height}" fill="${X(G.fill)}"/>`:"")+`<path d="${P.d}" fill="${s?.square?.gradient?`url(#${I})`:X(P.fill)}" fill-rule="evenodd"/><path d="${Y.d}" fill="${s?.dot?.gradient?`url(#${B})`:X(Y.fill)}"/></g>`;if(D+="</g>",_?.src){let{x:G,y:P,width:Y,height:ne,radius:K}=_;K>0&&(D+=`<defs><clipPath id="${v}"><rect x="${G}" y="${P}" width="${Y}" height="${ne}" rx="${K}" ry="${K}"/></clipPath></defs>`),D+=`<image href="${X(_.src)}" x="${G}" y="${P}" width="${Y}" height="${ne}"${K>0?` clip-path="url(#${v})"`:""}/>`}return D+="</svg>",D}var H=require("react");var U=require("react/jsx-runtime"),Mt=(0,H.forwardRef)(function({value:e,size:r,margin:o,dotStyle:i,dotColor:n,dotGradient:a,backgroundColor:c,backgroundGradient:l,corner:s,qr:f,logo:d,className:R,style:b,ariaLabel:y,idPrefix:x,...E},C){let h=(0,H.useId)().replace(/:/g,""),m=d?.element?void 0:d?.src,[p,g]=(0,H.useState)();(0,H.useEffect)(()=>{if(!m){g(void 0);return}let S=new Image;return S.onload=()=>{S.naturalHeight>0&&g({src:m,aspectRatio:S.naturalWidth/S.naturalHeight})},S.onerror=()=>g(void 0),S.src=m,()=>{S.onload=null,S.onerror=null}},[m]);let M=`${h}m`,u=`${h}c`,v=`${h}t`,k=`${h}d`,Q=`${h}b`,I=`${h}s`,B=`${h}p`,A=[];a&&A.push({id:k,gradient:a}),l&&A.push({id:Q,gradient:l}),s?.square?.gradient&&A.push({id:I,gradient:s.square.gradient}),s?.dot?.gradient&&A.push({id:B,gradient:s.dot.gradient});let{element:L,...T}=d??{},w=J({value:e,size:r,margin:o,dotStyle:i,dotColor:n,dotGradient:a,backgroundColor:c,backgroundGradient:l,corner:s,qr:f,logo:d&&{...T,custom:!!L,aspectRatio:d.aspectRatio??(p&&p.src===m?p.aspectRatio:1)}});return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("svg",{...E,ref:C,role:"img","aria-labelledby":v,width:w.size,height:w.size,viewBox:`0 0 ${w.viewBox} ${w.viewBox}`,xmlns:"http://www.w3.org/2000/svg",className:R,style:b,children:[(0,U.jsx)("title",{id:v,children:y??`QR code: ${e}`}),A.length>0&&(0,U.jsx)("defs",{children:A.map(({id:S,gradient:O})=>(0,U.jsxs)("linearGradient",{id:S,...fe(O),children:[(0,U.jsx)("stop",{offset:"0%",stopColor:O.startColor}),(0,U.jsx)("stop",{offset:"100%",stopColor:O.endColor})]},S))}),w.background!==void 0&&(0,U.jsx)("rect",{width:w.viewBox,height:w.viewBox,fill:l?`url(#${Q})`:w.background}),w.clear&&(0,U.jsx)("defs",{children:(0,U.jsxs)("mask",{id:M,children:[(0,U.jsx)("rect",{width:w.viewBox,height:w.viewBox,fill:"white"}),(0,U.jsx)("rect",{x:w.clear.x,y:w.clear.y,width:w.clear.width,height:w.clear.height,rx:w.clear.radius,ry:w.clear.radius,fill:"black"})]})}),(0,U.jsxs)("g",{mask:w.clear?`url(#${M})`:void 0,children:[w.modules&&(0,U.jsx)("path",{d:w.modules.d,fill:a?`url(#${k})`:w.modules.fill}),w.finders.map((S,O)=>(0,U.jsxs)("g",{children:[S.background&&(0,U.jsx)("rect",{x:S.background.x,y:S.background.y,width:S.background.width,height:S.background.height,fill:S.background.fill}),(0,U.jsx)("path",{d:S.square.d,fill:s?.square?.gradient?`url(#${I})`:S.square.fill,fillRule:"evenodd"}),(0,U.jsx)("path",{d:S.dot.d,fill:s?.dot?.gradient?`url(#${B})`:S.dot.fill})]},O))]}),w.logo&&(L||w.logo.src)&&(0,U.jsxs)(U.Fragment,{children:[w.logo.radius>0&&(0,U.jsx)("defs",{children:(0,U.jsx)("clipPath",{id:u,children:(0,U.jsx)("rect",{x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,rx:w.logo.radius,ry:w.logo.radius})})}),L?(0,U.jsx)("foreignObject",{x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,clipPath:w.logo.radius>0?`url(#${u})`:void 0,children:L}):(0,U.jsx)("image",{href:w.logo.src,x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,clipPath:w.logo.radius>0?`url(#${u})`:void 0})]})]})})});Mt.displayName="QRCode";var ve=(0,H.memo)(Mt);function St(t,e,r,o){if(o){let i=fe(o),n=Number.parseFloat(i.x1)/100*e,a=Number.parseFloat(i.y1)/100*e,c=Number.parseFloat(i.x2)/100*e,l=Number.parseFloat(i.y2)/100*e,s=t.createLinearGradient(n,a,c,l);s.addColorStop(0,o.startColor),s.addColorStop(1,o.endColor),t.fillStyle=s,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function At(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function vt(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function Et(t,e,r){let{width:o,height:i,matrixSize:n,margin:a,filter:c,backgroundColor:l,backgroundAlpha:s}=r,f=r.gapColor,d=new Uint8ClampedArray(t),R=o/(n+a*2),b=Math.max(r.coreSize??.4,r.minCoreSize??0),y=(1-b)/2,x=(m,p)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(m-.5)**2+(p-.5)**2<=b**2/4;let g=b*.28,M=Math.max(Math.abs(m-.5)-(b/2-g),0),u=Math.max(Math.abs(p-.5)-(b/2-g),0);return M**2+u**2<=g**2},E=(m,p)=>{let g=r.clear;if(!g||m<g.x||p<g.y||m>=g.x+g.width||p>=g.y+g.height)return!1;let M=Math.min(g.radius??0,g.width/2,g.height/2),u=Math.max(g.x+M,Math.min(m,g.x+g.width-M)),v=Math.max(g.y+M,Math.min(p,g.y+g.height-M));return(m-u)**2+(p-v)**2<=M**2},C=(m,p)=>m<8&&p<8||m>=n-8&&p<8||m<8&&p>=n-8,h=(m,p=t)=>{let g=p[m+3]/255,M=e[m+3]/255,u=g+M*(1-g),v=(k,Q)=>u===0?0:(k*g+Q*M*(1-g))/u;d[m]=v(p[m],e[m]),d[m+1]=v(p[m+1],e[m+1]),d[m+2]=v(p[m+2],e[m+2]),d[m+3]=u*255};for(let m=0;m<i;m+=1)for(let p=0;p<o;p+=1){let g=p/R-a,M=m/R-a,u=(m*o+p)*4;if(g<0||M<0||g>=n||M>=n){d[u]=e[u],d[u+1]=e[u+1],d[u+2]=e[u+2],d[u+3]=e[u+3];continue}let v=Math.floor(g),k=Math.floor(M);if(E(g,M)){d[u]=l[0],d[u+1]=l[1],d[u+2]=l[2],d[u+3]=s;continue}if(C(v,k)){h(u,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let Q=g-v,I=M-k;if(Q>=y&&Q<1-y&&I>=y&&I<1-y&&x(Q,I)){h(u);continue}if(f){let L=f[3]/255,T=e[u+3]/255,w=L+T*(1-L),S=(O,_)=>w===0?0:(O*L+_*T*(1-L))/w;d[u]=S(f[0],e[u]),d[u+1]=S(f[1],e[u+1]),d[u+2]=S(f[2],e[u+2]),d[u+3]=w*255;continue}let A=u;if(c==="color")d[u]=e[A],d[u+1]=e[A+1],d[u+2]=e[A+2];else{let L=e[A]*.2126+e[A+1]*.7152+e[A+2]*.0722;d[u]=L,d[u+1]=L,d[u+2]=L}d[u+3]=e[A+3]}return d}var Z=require("react/jsx-runtime");function It(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Wr(t,e){e?e(t):console.error("quter: unable to render the image-based QR code.",t)}function Ee(t){return new Promise((e,r)=>{let o=new Image;o.crossOrigin="anonymous",o.onload=()=>e(o),o.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),o.src=t})}function kt(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let o=r.getImageData(0,0,1,1).data;return[o[0],o[1],o[2],o[3]]}function qr(t,e,r,o,i,n,a){let c=a==="fill"?Math.max(i/e.naturalWidth,n/e.naturalHeight):Math.min(i/e.naturalWidth,n/e.naturalHeight),l=e.naturalWidth*c,s=e.naturalHeight*c;t.drawImage(e,r+(i-l)/2,o+(n-s)/2,l,s)}function Hr({imagePath:t,imageDotSize:e,imageGapColor:r,transparentFinderBackground:o,logo:i,filter:n,fillType:a,onImageError:c,qrOptions:l,svgProps:s}){let f=(0,q.useRef)(null),[d,R]=(0,q.useState)(!1),[b,y]=(0,q.useState)(),x=l.size??256,E=i?.element,{className:C,style:h,...m}=s;(0,q.useEffect)(()=>{let g=!1,M,u;return R(!1),(async()=>{try{if(!t||!It(t))throw new Error("The image URL uses an unsupported scheme.");if(n!=="threshold"&&n!=="color")throw new Error('The image filter must be "threshold" or "color".');if(a!=="scale_to_fit"&&a!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let k=i?.element?void 0:i?.src;if(k&&!It(k))throw new Error("The center image URL uses an unsupported scheme.");let[Q,I]=await Promise.all([Ee(t),k?Ee(k):Promise.resolve(void 0)]);if(g)return;let B=i?{...i,element:void 0,src:void 0,aspectRatio:i.aspectRatio??(I?I.naturalWidth/I.naturalHeight:1),custom:!0}:void 0,A=J({...l,logo:B}),L=J({...l,corner:{square:{style:"square"},dot:{style:"square"}},logo:B});y(A.logo?{...A.logo,viewBox:A.viewBox}:void 0);let T=L.finders[0].square.d,S=Number(T.match(/h([\d.]+)v/)?.[1])/7,O=Number(T.match(/^M([\d.]+),/)?.[1])/S,_=Math.round(L.viewBox/S-O*2),D=_+O*2;if(!Number.isFinite(S)||!Number.isFinite(O)||_<21)throw new Error("Unable to determine QR module dimensions.");let ge=Ae({...l,dotColor:l.dotColor??"#000000",backgroundColor:"#ffffff",backgroundGradient:void 0,logo:B,ariaLabel:`QR code: ${l.value}`});M=URL.createObjectURL(new Blob([ge],{type:"image/svg+xml"}));let G=await Ee(M),P=Math.max(Math.ceil(D*8),Math.ceil(x*2)),Y;if(o){let ee=Ae({...l,corner:l.corner?{...l.corner,backgroundColor:void 0}:void 0,dotColor:l.dotColor??"#000000",backgroundColor:"transparent",backgroundGradient:void 0,logo:B,ariaLabel:`QR code: ${l.value}`});u=URL.createObjectURL(new Blob([ee],{type:"image/svg+xml"}));let we=await Ee(u);if(g||!f.current)return;let W=document.createElement("canvas");W.width=P,W.height=W.width;let oe=W.getContext("2d",{willReadFrequently:!0});if(!oe)throw new Error("Canvas 2D context is unavailable.");oe.drawImage(we,0,0,W.width,W.height),Y=oe.getImageData(0,0,W.width,W.height).data}if(g||!f.current)return;let ne=document.createElement("canvas");ne.width=P,ne.height=P;let K=ne.getContext("2d",{willReadFrequently:!0}),Ie=document.createElement("canvas");Ie.width=P,Ie.height=P;let be=Ie.getContext("2d",{willReadFrequently:!0});if(!K||!be)throw new Error("Canvas 2D context is unavailable.");K.drawImage(G,0,0,P,P);let he=l.backgroundColor??"#ffffff",pe=kt(he==="transparent"?"#ffffff":he),Qt=r?kt(r):void 0,Ut=[pe[0],pe[1],pe[2]];St(be,P,he,l.backgroundGradient);let _e=P/D,ye=O,Ge=ye*_e,We=_*_e;qr(be,Q,Ge,Ge,We,We,a);let Pt=K.getImageData(0,0,P,P).data,Bt=be.getImageData(0,0,P,P).data,Ot=Et(Pt,Bt,{width:P,height:P,matrixSize:_,margin:ye,minCoreSize:Math.min(1,D/Math.max(1,Math.round(x))),coreSize:e,dotStyle:l.dotStyle,clear:A.clear?{x:A.clear.x/S-ye,y:A.clear.y/S-ye,width:A.clear.width/S,height:A.clear.height/S,radius:A.clear.radius/S}:void 0,filter:n,backgroundColor:Ut,backgroundAlpha:he==="transparent"?0:pe[3],gapColor:Qt,transparentFinderBackground:o,finderPixels:Y}),z=f.current;z.width=Math.round(x),z.height=Math.round(x);let ke=z.getContext("2d");if(!ke)throw new Error("Canvas 2D context is unavailable.");let xe=document.createElement("canvas");xe.width=P,xe.height=P;let V=xe.getContext("2d");if(!V)throw new Error("Canvas 2D context is unavailable.");let qe=V.createImageData(P,P);if(qe.data.set(Ot),V.putImageData(qe,0,0),I&&A.logo){let ee=P/A.viewBox,we=A.logo.x*ee,W=A.logo.y*ee,oe=A.logo.width*ee,He=A.logo.height*ee,Ve=A.logo.radius*ee;V.save(),Ve>0&&(V.beginPath(),V.roundRect(we,W,oe,He,Ve),V.clip()),V.drawImage(I,we,W,oe,He),V.restore()}ke.clearRect(0,0,z.width,z.height),ke.drawImage(xe,0,0,z.width,z.height),g||R(!0)}catch(k){g||Wr(k,c)}})(),()=>{g=!0,M&&URL.revokeObjectURL(M),u&&URL.revokeObjectURL(u)}},[n,a,e,r,t,i,c,l,x]);let p=(0,q.useMemo)(()=>{if(b)return{position:"absolute",left:`${b.x/b.viewBox*100}%`,top:`${b.y/b.viewBox*100}%`,width:`${b.width/b.viewBox*100}%`,height:`${b.height/b.viewBox*100}%`,borderRadius:`${b.radius/Math.min(b.width,b.height)*100}%`,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",pointerEvents:"none"}},[b]);return(0,Z.jsxs)("span",{className:C,style:{position:"relative",display:"inline-block",lineHeight:0,...h},children:[(0,Z.jsx)(ve,{...m,...l,className:C,logo:i,style:{...h,opacity:d?0:h?.opacity}}),(0,Z.jsx)("canvas",{ref:f,"aria-hidden":"true",style:{...h,position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",visibility:d?"visible":"hidden"}}),E&&p&&(0,Z.jsx)("span",{style:p,children:E})]})}function Lt({imagePath:t,imageDotStyle:e,imageDotSize:r,imageGapColor:o,transparentFinderBackground:i,logo:n,imageColor:a,filter:c,fillType:l="scale_to_fit",background:s,version:f,onImageError:d,backgroundColor:R,dotGradient:b,backgroundGradient:y,qr:x,value:E,size:C,margin:h,dotStyle:m,dotColor:p,corner:g,ariaLabel:M,...u}){let v=vt(a,c),k=t?At(r):r??.4,Q=(0,q.useMemo)(()=>({value:E,size:C,margin:h,dotStyle:m,dotColor:p,dotGradient:b,corner:g,backgroundGradient:y,backgroundColor:R??s??"#ffffff",qr:{errorCorrectionLevel:t?"H":void 0,...x,version:f??x?.version}}),[s,R,y,g,p,b,m,t,h,x,C,E,f]),I=(0,q.useMemo)(()=>({...Q,dotStyle:e??Q.dotStyle}),[e,Q]);return t?(0,Z.jsx)(Hr,{imagePath:t,imageDotSize:k,imageGapColor:o,transparentFinderBackground:i??Q.corner?.backgroundColor==="transparent",logo:n,filter:v,fillType:l,onImageError:d,qrOptions:I,svgProps:{...u,ariaLabel:M}}):(0,Z.jsx)(ve,{...u,...Q,ariaLabel:M,logo:n})}var Vr=Lt;0&&(module.exports={QRCode,Quter});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as he,b as pe,c as we,d as be}from"./chunk-RW5M2XKX.mjs";import{a as z,b as me,c as ne}from"./chunk-PJYR3PPM.mjs";import{useEffect as Oe,useMemo as ae,useRef as Ue,useState as ye}from"react";import{forwardRef as Le,memo as $e,useEffect as Ge,useId as Me,useState as De}from"react";import{Fragment as Ce,jsx as l,jsxs as H}from"react/jsx-runtime";var ve=Le(function({value:r,size:c,margin:s,dotStyle:u,dotColor:m,dotGradient:h,backgroundColor:k,backgroundGradient:o,corner:g,qr:S,logo:v,className:L,style:d,ariaLabel:N,idPrefix:y,...$},G){let f=Me().replace(/:/g,""),x=v?.element?void 0:v?.src,[E,p]=De();Ge(()=>{if(!x){p(void 0);return}let t=new Image;return t.onload=()=>{t.naturalHeight>0&&p({src:x,aspectRatio:t.naturalWidth/t.naturalHeight})},t.onerror=()=>p(void 0),t.src=x,()=>{t.onload=null,t.onerror=null}},[x]);let R=`${f}m`,w=`${f}c`,_=`${f}t`,b=`${f}d`,Q=`${f}b`,I=`${f}s`,M=`${f}p`,i=[];h&&i.push({id:b,gradient:h}),o&&i.push({id:Q,gradient:o}),g?.square?.gradient&&i.push({id:I,gradient:g.square.gradient}),g?.dot?.gradient&&i.push({id:M,gradient:g.dot.gradient});let{element:D,...W}=v??{},e=z({value:r,size:c,margin:s,dotStyle:u,dotColor:m,dotGradient:h,backgroundColor:k,backgroundGradient:o,corner:g,qr:S,logo:v&&{...W,custom:!!D,aspectRatio:v.aspectRatio??(E&&E.src===x?E.aspectRatio:1)}});return l(Ce,{children:H("svg",{...$,ref:G,role:"img","aria-labelledby":_,width:e.size,height:e.size,viewBox:`0 0 ${e.viewBox} ${e.viewBox}`,xmlns:"http://www.w3.org/2000/svg",className:L,style:d,children:[l("title",{id:_,children:N??`QR code: ${r}`}),i.length>0&&l("defs",{children:i.map(({id:t,gradient:P})=>H("linearGradient",{id:t,...me(P),children:[l("stop",{offset:"0%",stopColor:P.startColor}),l("stop",{offset:"100%",stopColor:P.endColor})]},t))}),e.background!==void 0&&l("rect",{width:e.viewBox,height:e.viewBox,fill:o?`url(#${Q})`:e.background}),e.clear&&l("defs",{children:H("mask",{id:R,children:[l("rect",{width:e.viewBox,height:e.viewBox,fill:"white"}),l("rect",{x:e.clear.x,y:e.clear.y,width:e.clear.width,height:e.clear.height,fill:"black"})]})}),H("g",{mask:e.clear?`url(#${R})`:void 0,children:[e.modules&&l("path",{d:e.modules.d,fill:h?`url(#${b})`:e.modules.fill}),e.finders.map((t,P)=>H("g",{children:[t.background&&l("rect",{x:t.background.x,y:t.background.y,width:t.background.width,height:t.background.height,fill:t.background.fill}),l("path",{d:t.square.d,fill:g?.square?.gradient?`url(#${I})`:t.square.fill,fillRule:"evenodd"}),l("path",{d:t.dot.d,fill:g?.dot?.gradient?`url(#${M})`:t.dot.fill})]},P))]}),e.logo&&(D||e.logo.src)&&H(Ce,{children:[e.logo.radius>0&&l("defs",{children:l("clipPath",{id:w,children:l("rect",{x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,rx:e.logo.radius,ry:e.logo.radius})})}),D?l("foreignObject",{x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,clipPath:e.logo.radius>0?`url(#${w})`:void 0,children:D}):l("image",{href:e.logo.src,x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,clipPath:e.logo.radius>0?`url(#${w})`:void 0})]})]})})});ve.displayName="QRCode";var ie=$e(ve);import{jsx as T,jsxs as ze}from"react/jsx-runtime";function xe(n){return!/^\s*(?:javascript|vbscript):/i.test(n)&&!/^data:(?!image\/)/i.test(n)}function Ne(n,r){r?r(n):console.error("quter: unable to render the image-based QR code.",n)}function Y(n){return new Promise((r,c)=>{let s=new Image;s.crossOrigin="anonymous",s.onload=()=>r(s),s.onerror=()=>c(new Error("An image could not be loaded for the QR code.")),s.src=n})}function Re(n){let r=document.createElement("canvas");r.width=1,r.height=1;let c=r.getContext("2d");if(!c)throw new Error("Canvas 2D context is unavailable.");c.fillStyle=n,c.fillRect(0,0,1,1);let s=c.getImageData(0,0,1,1).data;return[s[0],s[1],s[2],s[3]]}function Fe(n,r,c,s,u,m,h){let k=h==="fill"?Math.max(u/r.naturalWidth,m/r.naturalHeight):Math.min(u/r.naturalWidth,m/r.naturalHeight),o=r.naturalWidth*k,g=r.naturalHeight*k;n.drawImage(r,c+(u-o)/2,s+(m-g)/2,o,g)}function He({imagePath:n,imageDotSize:r,imageGapColor:c,transparentFinderBackground:s,logo:u,filter:m,fillType:h,onImageError:k,qrOptions:o,svgProps:g}){let S=Ue(null),[v,L]=ye(!1),[d,N]=ye(),y=o.size??256,$=u?.element,{className:G,style:f,...x}=g;Oe(()=>{let p=!1,R,w;return L(!1),(async()=>{try{if(!n||!xe(n))throw new Error("The image URL uses an unsupported scheme.");if(m!=="threshold"&&m!=="color")throw new Error('The image filter must be "threshold" or "color".');if(h!=="scale_to_fit"&&h!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let b=u?.element?void 0:u?.src;if(b&&!xe(b))throw new Error("The center image URL uses an unsupported scheme.");let[Q,I]=await Promise.all([Y(n),b?Y(b):Promise.resolve(void 0)]);if(p)return;let M=u?{...u,element:void 0,src:void 0,aspectRatio:u.aspectRatio??(I?I.naturalWidth/I.naturalHeight:1),custom:!0}:void 0,i=z({...o,logo:M}),D=z({...o,corner:{square:{style:"square"},dot:{style:"square"}},logo:M});N(i.logo?{...i.logo,viewBox:i.viewBox}:void 0);let W=D.finders[0].square.d,t=Number(W.match(/h([\d.]+)v/)?.[1])/7,P=Number(W.match(/^M([\d.]+),/)?.[1])/t,q=Math.round(D.viewBox/t-P*2),Z=q+P*2;if(!Number.isFinite(t)||!Number.isFinite(P)||q<21)throw new Error("Unable to determine QR module dimensions.");let Qe=ne({...o,dotColor:o.dotColor??"#000000",backgroundColor:"#ffffff",backgroundGradient:void 0,logo:M,ariaLabel:`QR code: ${o.value}`});R=URL.createObjectURL(new Blob([Qe],{type:"image/svg+xml"}));let Ie=await Y(R),a=Math.max(Math.ceil(Z*8),Math.ceil(y*2)),se;if(s){let U=ne({...o,corner:o.corner?{...o.corner,backgroundColor:void 0}:void 0,dotColor:o.dotColor??"#000000",backgroundColor:"transparent",backgroundGradient:void 0,logo:M,ariaLabel:`QR code: ${o.value}`});w=URL.createObjectURL(new Blob([U],{type:"image/svg+xml"}));let X=await Y(w);if(p||!S.current)return;let C=document.createElement("canvas");C.width=a,C.height=C.width;let F=C.getContext("2d",{willReadFrequently:!0});if(!F)throw new Error("Canvas 2D context is unavailable.");F.drawImage(X,0,0,C.width,C.height),se=F.getImageData(0,0,C.width,C.height).data}if(p||!S.current)return;let ee=document.createElement("canvas");ee.width=a,ee.height=a;let te=ee.getContext("2d",{willReadFrequently:!0}),oe=document.createElement("canvas");oe.width=a,oe.height=a;let A=oe.getContext("2d",{willReadFrequently:!0});if(!te||!A)throw new Error("Canvas 2D context is unavailable.");te.drawImage(Ie,0,0,a,a);let V=o.backgroundColor??"#ffffff",j=Re(V==="transparent"?"#ffffff":V),Pe=c?Re(c):void 0,ke=[j[0],j[1],j[2]];he(A,a,V,o.backgroundGradient);let de=a/Z,J=P,le=J*de,ce=q*de;Fe(A,Q,le,le,ce,ce,h);let Se=te.getImageData(0,0,a,a).data,Ee=A.getImageData(0,0,a,a).data,Be=be(Se,Ee,{width:a,height:a,matrixSize:q,margin:J,minCoreSize:Math.min(1,Z/Math.max(1,Math.round(y))),coreSize:r,dotStyle:o.dotStyle,clear:i.clear?{x:i.clear.x/t-J,y:i.clear.y/t-J,width:i.clear.width/t,height:i.clear.height/t}:void 0,filter:m,backgroundColor:ke,backgroundAlpha:V==="transparent"?0:j[3],gapColor:Pe,transparentFinderBackground:s,finderPixels:se}),O=S.current;O.width=Math.round(y),O.height=Math.round(y);let re=O.getContext("2d");if(!re)throw new Error("Canvas 2D context is unavailable.");let K=document.createElement("canvas");K.width=a,K.height=a;let B=K.getContext("2d");if(!B)throw new Error("Canvas 2D context is unavailable.");let ue=B.createImageData(a,a);if(ue.data.set(Be),B.putImageData(ue,0,0),I&&i.logo){let U=a/i.viewBox,X=i.logo.x*U,C=i.logo.y*U,F=i.logo.width*U,ge=i.logo.height*U,fe=i.logo.radius*U;B.save(),fe>0&&(B.beginPath(),B.roundRect(X,C,F,ge,fe),B.clip()),B.drawImage(I,X,C,F,ge),B.restore()}re.clearRect(0,0,O.width,O.height),re.drawImage(K,0,0,O.width,O.height),p||L(!0)}catch(b){p||Ne(b,k)}})(),()=>{p=!0,R&&URL.revokeObjectURL(R),w&&URL.revokeObjectURL(w)}},[m,h,r,c,n,u,k,o,y]);let E=ae(()=>{if(d)return{position:"absolute",left:`${d.x/d.viewBox*100}%`,top:`${d.y/d.viewBox*100}%`,width:`${d.width/d.viewBox*100}%`,height:`${d.height/d.viewBox*100}%`,borderRadius:`${d.radius/Math.min(d.width,d.height)*100}%`,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",pointerEvents:"none"}},[d]);return ze("span",{className:G,style:{position:"relative",display:"inline-block",lineHeight:0,...f},children:[T(ie,{...x,...o,className:G,logo:u,style:{...f,opacity:v?0:f?.opacity}}),T("canvas",{ref:S,"aria-hidden":"true",style:{...f,position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",visibility:v?"visible":"hidden"}}),$&&E&&T("span",{style:E,children:$})]})}function _e({imagePath:n,imageDotStyle:r,imageDotSize:c,imageGapColor:s,transparentFinderBackground:u,logo:m,imageColor:h,filter:k,fillType:o="scale_to_fit",background:g,version:S,onImageError:v,backgroundColor:L,dotGradient:d,backgroundGradient:N,qr:y,value:$,size:G,margin:f,dotStyle:x,dotColor:E,corner:p,ariaLabel:R,...w}){let _=we(h,k),b=n?pe(c):c??.4,Q=ae(()=>({value:$,size:G,margin:f,dotStyle:x,dotColor:E,dotGradient:d,corner:p,backgroundGradient:N,backgroundColor:L??g??"#ffffff",qr:{errorCorrectionLevel:n?"H":void 0,...y,version:S??y?.version}}),[g,L,N,p,E,d,x,n,f,y,G,$,S]),I=ae(()=>({...Q,dotStyle:r??Q.dotStyle}),[r,Q]);return n?T(He,{imagePath:n,imageDotSize:b,imageGapColor:s,transparentFinderBackground:u??Q.corner?.backgroundColor==="transparent",logo:m,filter:_,fillType:o,onImageError:v,qrOptions:I,svgProps:{...w,ariaLabel:R}}):T(ie,{...w,...Q,ariaLabel:R,logo:m})}var Ze=_e;export{ie as QRCode,_e as Quter,Ze as default};
1
+ import{a as he,b as pe,c as we,d as be}from"./chunk-OBIGPYJW.mjs";import{a as z,b as me,c as ne}from"./chunk-BI4MXPFZ.mjs";import{useEffect as Oe,useMemo as ae,useRef as Ue,useState as ye}from"react";import{forwardRef as Le,memo as $e,useEffect as Ge,useId as Me,useState as De}from"react";import{Fragment as Ce,jsx as l,jsxs as H}from"react/jsx-runtime";var ve=Le(function({value:r,size:c,margin:s,dotStyle:u,dotColor:m,dotGradient:h,backgroundColor:k,backgroundGradient:o,corner:g,qr:S,logo:v,className:L,style:d,ariaLabel:N,idPrefix:y,...$},G){let f=Me().replace(/:/g,""),x=v?.element?void 0:v?.src,[E,p]=De();Ge(()=>{if(!x){p(void 0);return}let t=new Image;return t.onload=()=>{t.naturalHeight>0&&p({src:x,aspectRatio:t.naturalWidth/t.naturalHeight})},t.onerror=()=>p(void 0),t.src=x,()=>{t.onload=null,t.onerror=null}},[x]);let R=`${f}m`,w=`${f}c`,_=`${f}t`,b=`${f}d`,Q=`${f}b`,I=`${f}s`,M=`${f}p`,i=[];h&&i.push({id:b,gradient:h}),o&&i.push({id:Q,gradient:o}),g?.square?.gradient&&i.push({id:I,gradient:g.square.gradient}),g?.dot?.gradient&&i.push({id:M,gradient:g.dot.gradient});let{element:D,...W}=v??{},e=z({value:r,size:c,margin:s,dotStyle:u,dotColor:m,dotGradient:h,backgroundColor:k,backgroundGradient:o,corner:g,qr:S,logo:v&&{...W,custom:!!D,aspectRatio:v.aspectRatio??(E&&E.src===x?E.aspectRatio:1)}});return l(Ce,{children:H("svg",{...$,ref:G,role:"img","aria-labelledby":_,width:e.size,height:e.size,viewBox:`0 0 ${e.viewBox} ${e.viewBox}`,xmlns:"http://www.w3.org/2000/svg",className:L,style:d,children:[l("title",{id:_,children:N??`QR code: ${r}`}),i.length>0&&l("defs",{children:i.map(({id:t,gradient:P})=>H("linearGradient",{id:t,...me(P),children:[l("stop",{offset:"0%",stopColor:P.startColor}),l("stop",{offset:"100%",stopColor:P.endColor})]},t))}),e.background!==void 0&&l("rect",{width:e.viewBox,height:e.viewBox,fill:o?`url(#${Q})`:e.background}),e.clear&&l("defs",{children:H("mask",{id:R,children:[l("rect",{width:e.viewBox,height:e.viewBox,fill:"white"}),l("rect",{x:e.clear.x,y:e.clear.y,width:e.clear.width,height:e.clear.height,rx:e.clear.radius,ry:e.clear.radius,fill:"black"})]})}),H("g",{mask:e.clear?`url(#${R})`:void 0,children:[e.modules&&l("path",{d:e.modules.d,fill:h?`url(#${b})`:e.modules.fill}),e.finders.map((t,P)=>H("g",{children:[t.background&&l("rect",{x:t.background.x,y:t.background.y,width:t.background.width,height:t.background.height,fill:t.background.fill}),l("path",{d:t.square.d,fill:g?.square?.gradient?`url(#${I})`:t.square.fill,fillRule:"evenodd"}),l("path",{d:t.dot.d,fill:g?.dot?.gradient?`url(#${M})`:t.dot.fill})]},P))]}),e.logo&&(D||e.logo.src)&&H(Ce,{children:[e.logo.radius>0&&l("defs",{children:l("clipPath",{id:w,children:l("rect",{x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,rx:e.logo.radius,ry:e.logo.radius})})}),D?l("foreignObject",{x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,clipPath:e.logo.radius>0?`url(#${w})`:void 0,children:D}):l("image",{href:e.logo.src,x:e.logo.x,y:e.logo.y,width:e.logo.width,height:e.logo.height,clipPath:e.logo.radius>0?`url(#${w})`:void 0})]})]})})});ve.displayName="QRCode";var ie=$e(ve);import{jsx as T,jsxs as ze}from"react/jsx-runtime";function xe(n){return!/^\s*(?:javascript|vbscript):/i.test(n)&&!/^data:(?!image\/)/i.test(n)}function Ne(n,r){r?r(n):console.error("quter: unable to render the image-based QR code.",n)}function Y(n){return new Promise((r,c)=>{let s=new Image;s.crossOrigin="anonymous",s.onload=()=>r(s),s.onerror=()=>c(new Error("An image could not be loaded for the QR code.")),s.src=n})}function Re(n){let r=document.createElement("canvas");r.width=1,r.height=1;let c=r.getContext("2d");if(!c)throw new Error("Canvas 2D context is unavailable.");c.fillStyle=n,c.fillRect(0,0,1,1);let s=c.getImageData(0,0,1,1).data;return[s[0],s[1],s[2],s[3]]}function Fe(n,r,c,s,u,m,h){let k=h==="fill"?Math.max(u/r.naturalWidth,m/r.naturalHeight):Math.min(u/r.naturalWidth,m/r.naturalHeight),o=r.naturalWidth*k,g=r.naturalHeight*k;n.drawImage(r,c+(u-o)/2,s+(m-g)/2,o,g)}function He({imagePath:n,imageDotSize:r,imageGapColor:c,transparentFinderBackground:s,logo:u,filter:m,fillType:h,onImageError:k,qrOptions:o,svgProps:g}){let S=Ue(null),[v,L]=ye(!1),[d,N]=ye(),y=o.size??256,$=u?.element,{className:G,style:f,...x}=g;Oe(()=>{let p=!1,R,w;return L(!1),(async()=>{try{if(!n||!xe(n))throw new Error("The image URL uses an unsupported scheme.");if(m!=="threshold"&&m!=="color")throw new Error('The image filter must be "threshold" or "color".');if(h!=="scale_to_fit"&&h!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let b=u?.element?void 0:u?.src;if(b&&!xe(b))throw new Error("The center image URL uses an unsupported scheme.");let[Q,I]=await Promise.all([Y(n),b?Y(b):Promise.resolve(void 0)]);if(p)return;let M=u?{...u,element:void 0,src:void 0,aspectRatio:u.aspectRatio??(I?I.naturalWidth/I.naturalHeight:1),custom:!0}:void 0,i=z({...o,logo:M}),D=z({...o,corner:{square:{style:"square"},dot:{style:"square"}},logo:M});N(i.logo?{...i.logo,viewBox:i.viewBox}:void 0);let W=D.finders[0].square.d,t=Number(W.match(/h([\d.]+)v/)?.[1])/7,P=Number(W.match(/^M([\d.]+),/)?.[1])/t,q=Math.round(D.viewBox/t-P*2),Z=q+P*2;if(!Number.isFinite(t)||!Number.isFinite(P)||q<21)throw new Error("Unable to determine QR module dimensions.");let Qe=ne({...o,dotColor:o.dotColor??"#000000",backgroundColor:"#ffffff",backgroundGradient:void 0,logo:M,ariaLabel:`QR code: ${o.value}`});R=URL.createObjectURL(new Blob([Qe],{type:"image/svg+xml"}));let Ie=await Y(R),a=Math.max(Math.ceil(Z*8),Math.ceil(y*2)),se;if(s){let U=ne({...o,corner:o.corner?{...o.corner,backgroundColor:void 0}:void 0,dotColor:o.dotColor??"#000000",backgroundColor:"transparent",backgroundGradient:void 0,logo:M,ariaLabel:`QR code: ${o.value}`});w=URL.createObjectURL(new Blob([U],{type:"image/svg+xml"}));let X=await Y(w);if(p||!S.current)return;let C=document.createElement("canvas");C.width=a,C.height=C.width;let F=C.getContext("2d",{willReadFrequently:!0});if(!F)throw new Error("Canvas 2D context is unavailable.");F.drawImage(X,0,0,C.width,C.height),se=F.getImageData(0,0,C.width,C.height).data}if(p||!S.current)return;let ee=document.createElement("canvas");ee.width=a,ee.height=a;let te=ee.getContext("2d",{willReadFrequently:!0}),oe=document.createElement("canvas");oe.width=a,oe.height=a;let A=oe.getContext("2d",{willReadFrequently:!0});if(!te||!A)throw new Error("Canvas 2D context is unavailable.");te.drawImage(Ie,0,0,a,a);let V=o.backgroundColor??"#ffffff",j=Re(V==="transparent"?"#ffffff":V),Pe=c?Re(c):void 0,ke=[j[0],j[1],j[2]];he(A,a,V,o.backgroundGradient);let de=a/Z,J=P,le=J*de,ce=q*de;Fe(A,Q,le,le,ce,ce,h);let Se=te.getImageData(0,0,a,a).data,Ee=A.getImageData(0,0,a,a).data,Be=be(Se,Ee,{width:a,height:a,matrixSize:q,margin:J,minCoreSize:Math.min(1,Z/Math.max(1,Math.round(y))),coreSize:r,dotStyle:o.dotStyle,clear:i.clear?{x:i.clear.x/t-J,y:i.clear.y/t-J,width:i.clear.width/t,height:i.clear.height/t,radius:i.clear.radius/t}:void 0,filter:m,backgroundColor:ke,backgroundAlpha:V==="transparent"?0:j[3],gapColor:Pe,transparentFinderBackground:s,finderPixels:se}),O=S.current;O.width=Math.round(y),O.height=Math.round(y);let re=O.getContext("2d");if(!re)throw new Error("Canvas 2D context is unavailable.");let K=document.createElement("canvas");K.width=a,K.height=a;let B=K.getContext("2d");if(!B)throw new Error("Canvas 2D context is unavailable.");let ue=B.createImageData(a,a);if(ue.data.set(Be),B.putImageData(ue,0,0),I&&i.logo){let U=a/i.viewBox,X=i.logo.x*U,C=i.logo.y*U,F=i.logo.width*U,ge=i.logo.height*U,fe=i.logo.radius*U;B.save(),fe>0&&(B.beginPath(),B.roundRect(X,C,F,ge,fe),B.clip()),B.drawImage(I,X,C,F,ge),B.restore()}re.clearRect(0,0,O.width,O.height),re.drawImage(K,0,0,O.width,O.height),p||L(!0)}catch(b){p||Ne(b,k)}})(),()=>{p=!0,R&&URL.revokeObjectURL(R),w&&URL.revokeObjectURL(w)}},[m,h,r,c,n,u,k,o,y]);let E=ae(()=>{if(d)return{position:"absolute",left:`${d.x/d.viewBox*100}%`,top:`${d.y/d.viewBox*100}%`,width:`${d.width/d.viewBox*100}%`,height:`${d.height/d.viewBox*100}%`,borderRadius:`${d.radius/Math.min(d.width,d.height)*100}%`,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",pointerEvents:"none"}},[d]);return ze("span",{className:G,style:{position:"relative",display:"inline-block",lineHeight:0,...f},children:[T(ie,{...x,...o,className:G,logo:u,style:{...f,opacity:v?0:f?.opacity}}),T("canvas",{ref:S,"aria-hidden":"true",style:{...f,position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",visibility:v?"visible":"hidden"}}),$&&E&&T("span",{style:E,children:$})]})}function _e({imagePath:n,imageDotStyle:r,imageDotSize:c,imageGapColor:s,transparentFinderBackground:u,logo:m,imageColor:h,filter:k,fillType:o="scale_to_fit",background:g,version:S,onImageError:v,backgroundColor:L,dotGradient:d,backgroundGradient:N,qr:y,value:$,size:G,margin:f,dotStyle:x,dotColor:E,corner:p,ariaLabel:R,...w}){let _=we(h,k),b=n?pe(c):c??.4,Q=ae(()=>({value:$,size:G,margin:f,dotStyle:x,dotColor:E,dotGradient:d,corner:p,backgroundGradient:N,backgroundColor:L??g??"#ffffff",qr:{errorCorrectionLevel:n?"H":void 0,...y,version:S??y?.version}}),[g,L,N,p,E,d,x,n,f,y,G,$,S]),I=ae(()=>({...Q,dotStyle:r??Q.dotStyle}),[r,Q]);return n?T(He,{imagePath:n,imageDotSize:b,imageGapColor:s,transparentFinderBackground:u??Q.corner?.backgroundColor==="transparent",logo:m,filter:_,fillType:o,onImageError:v,qrOptions:I,svgProps:{...w,ariaLabel:R}}):T(ie,{...w,...Q,ariaLabel:R,logo:m})}var Ze=_e;export{ie as QRCode,_e as Quter,Ze as default};
@@ -16,6 +16,7 @@ interface QuterPixelOptions {
16
16
  y: number;
17
17
  width: number;
18
18
  height: number;
19
+ radius?: number;
19
20
  };
20
21
  filter: QuterFilter;
21
22
  backgroundColor: readonly [number, number, number];
@@ -1 +1 @@
1
- "use strict";var z=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var jt=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Kt=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},Zt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Xt(t))!Yt.call(e,s)&&s!==n&&z(e,s,{get:()=>t[s],enumerable:!(o=Vt(t,s))||o.enumerable});return e};var Jt=e=>Zt(z({},"__esModule",{value:!0}),e);var ot=(e,t,n)=>jt(e,typeof t!="symbol"?t+"":t,n);var Ke={};Kt(Ke,{QRCode:()=>Gt,Quter:()=>Ht,default:()=>je});module.exports=Jt(Ke);var rt=require("react"),$=require("react-native-svg");function zt(){let e=new Uint8Array(512),t=1;for(let n=0;n<256;n++)e[n]=t,t<<=1,t&256&&(t^=285);for(let n=256;n<512;n++)e[n]=e[n-255];return e}function te(e){let t=new Uint8Array(256);for(let n=0;n<256;n++)t[e[n]]=n;return t}var tt=zt(),X=te(tt);function ee(e,t){return e===0||t===0?0:tt[X[e]+X[t]]}function ne(e,t){return tt[X[e]*t%255]}function re(e){let t=[1];for(let n=0;n<e;n++){let o=[1,ne(2,n)],s=new Array(t.length+o.length-1).fill(0);for(let r=0;r<t.length;r++)for(let c=0;c<o.length;c++)s[r+c]^=ee(t[r],o[c]);t=s}return Uint8Array.from(t)}var gt=new Map;function oe(e){let t=gt.get(e);return t||(t=re(e),gt.set(e,t)),t}function se(e,t){let n=oe(t),o=n.length,s=e.length,r=new Uint8Array(s+t);r.set(e);for(let c=0;c<s;c++){let i=r[c];if(i!==0){let l=X[i];for(let a=0;a<o;a++)r[c+a]^=tt[X[n[a]]+l]}}return r.slice(s)}var ce=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],ie=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],pt=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function Y(e,t){return pt[(e-1)*4+t]}function yt(e,t,n){let o=(t-1)*4+n,s=ce[o],r=ie[o],c=pt[o],i=Math.floor(c/r),l=r-c%r,a=e instanceof Uint8Array?e:Uint8Array.from(e),u=new Array(r),f=new Array(r),R=new Array(r),m=0,g=0;for(let x=0;x<r;x++){let b=x<l?i:i+1;u[x]=m,f[x]=b,b>g&&(g=b),R[x]=se(a.subarray(m,m+b),s),m+=b}let h=new Uint8Array(a.length+r*s),C=0;for(let x=0;x<g;x++)for(let b=0;b<r;b++)x<f[b]&&(h[C++]=a[u[b]+x]);for(let x=0;x<s;x++)for(let b=0;b<r;b++)h[C++]=R[b][x];return h}var ht={numeric:1,alphanumeric:2,byte:4};function ae(){let e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",t=new Int8Array(128).fill(-1);for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=n;return t}var G=ae();function le(e){return e<128?G[e]:-1}function N(e,t){return e==="numeric"?t<=9?10:t<=26?12:14:e==="alphanumeric"?t<=9?9:t<=26?11:13:t<=9?8:16}var xt=[[1,9],[10,26],[27,40]],ue=[0,4,7];function fe(e,t){return e==="numeric"?10*Math.floor(t/3)+ue[t%3]:e==="alphanumeric"?11*Math.floor(t/2)+6*(t%2):8*t}function ct(e,t){let n=0;for(let o of e)n+=4+N(o.mode,t)+fe(o.mode,o.charCount);return Math.ceil(n/8)}function st(e,t,n,o){return{mode:t,start:0,end:e.length,charCount:n,byteStart:0,byteEnd:o}}var W=0,j=1,K=2,be=["numeric","alphanumeric","byte"];function de(e){return e<128?1:e<2048?2:e<65536?3:4}var At=20,Mt=33,Rt=48;function me(e){let t=0,n=0,o=0,s=0;for(let r=0;r<e.length;r++){let c=e.charCodeAt(r);c<128?(n++,c>=48&&c<=57?(o++,s++):G[c]>=0&&s++):c<2048?n+=2:c>=55296&&c<=56319&&(e.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3,t++}return{count:t,totalBytes:n,digits:o,alnums:s}}function ge(e,t){let n=new Int32Array(t),o=new Uint8Array(t),s=new Uint8Array(t),r=0;for(let c=0;c<e.length;){let i=e.codePointAt(c);n[r]=c,o[r]=de(i),i>=48&&i<=57?s[r]=2:le(i)>=0&&(s[r]=1),r++,c+=i>65535?2:1}return{cpIndex:n,cpBytes:o,cpClass:s}}function wt(e){let{count:t,totalBytes:n,digits:o,alnums:s}=me(e),r=o*At+(s-o)*Mt+(n-s)*Rt,c=a=>{let u=4+Math.min(N("numeric",a),N("alphanumeric",a),N("byte",a));return Math.ceil((r/6+u)/8)},i;if(o===t?i=st(e,"numeric",t,n):s===t&&o===0?i=st(e,"alphanumeric",t,n):s===0&&(i=st(e,"byte",n,n)),i){let a=[i];return{forVersion:()=>a,minDataBytes:c}}let l;return{forVersion(a){return l??(l=ge(e,t)),pe(e,a,t,l)},minDataBytes:c}}function pe(e,t,n,{cpIndex:o,cpBytes:s,cpClass:r}){let c=(4+N("numeric",t))*6,i=(4+N("alphanumeric",t))*6,l=(4+N("byte",t))*6,a=[c,i,l],u=new Int8Array(n*3).fill(-1),f=new Float64Array(3),R=new Float64Array([c,i,l]);for(let y=0;y<n;y++){let A=y*3,M=r[y];f[W]=1/0,f[j]=1/0,f[K]=R[K]+s[y]*Rt,u[A+K]=K,M!==0&&(f[j]=R[j]+Mt,u[A+j]=j),M===2&&(f[W]=R[W]+At,u[A+W]=W);for(let d=0;d<3;d++)for(let L=0;L<3;L++){if(u[A+L]===-1)continue;let k=Math.ceil(f[L]/6)*6+a[d];(u[A+d]===-1||k<f[d])&&(f[d]=k,u[A+d]=L)}let E=R;R=f,f=E}let m=W;for(let y=1;y<3;y++)R[y]<R[m]&&(m=y);let g=new Int8Array(n),h=m;for(let y=n-1;y>=0;y--)h=u[y*3+h],g[y]=h;let C=[],x=0,b=0;for(;b<n;){let y=g[b],A=b,M=0;for(;A<n&&g[A]===y;)M+=s[A],A++;C.push({mode:be[y],start:o[b],end:A<n?o[A]:e.length,charCount:y===K?M:A-b,byteStart:x,byteEnd:x+M}),x+=M,b=A}return C}var ye={L:0,M:1,Q:2,H:3},$t;function he(){return $t??($t=new TextEncoder)}var it=class{constructor(t){ot(this,"bytes");ot(this,"bitPos",0);this.bytes=new Uint8Array(t)}writeBits(t,n){let o=this.bitPos;for(let s=n-1;s>=0;s--)t>>s&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(t){this.bitPos+=t}alignToByte(){this.bitPos=this.bitPos+7&-8}},xe=[236,17];function Ae(e,t,n,o,s){let r=new it(o);for(let a of t)if(r.writeBits(ht[a.mode],4),r.writeBits(a.charCount,N(a.mode,n)),a.mode==="numeric")for(let u=a.start;u<a.end;u+=3){let f=Math.min(3,a.end-u),R=e.charCodeAt(u)-48;f>=2&&(R=R*10+(e.charCodeAt(u+1)-48)),f>=3&&(R=R*10+(e.charCodeAt(u+2)-48)),r.writeBits(R,f===3?10:f===2?7:4)}else if(a.mode==="alphanumeric")for(let u=a.start;u<a.end;u+=2)if(u+1<a.end){let f=G[e.charCodeAt(u)]*45+G[e.charCodeAt(u+1)];r.writeBits(f,11)}else r.writeBits(G[e.charCodeAt(u)],6);else for(let u=a.byteStart;u<a.byteEnd;u++)r.writeBits(s[u],8);let c=o*8;if(r.bitLength>c)throw new RangeError(`encoded data (${r.bitLength} bits) exceeds capacity (${c} bits) for the selected version`);r.skipBits(Math.min(4,c-r.bitLength)),r.alignToByte();let i=r.bytes,l=0;for(let a=r.bitLength>>3;a<o;a++)i[a]=xe[l%2],l++;return i}function Ct(e,t="M",n){if(typeof e!="string")throw new TypeError(`data must be a string, got ${typeof e}`);if(e.length===0)throw new RangeError("data must not be empty");let o=ye[t];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(t)}`);let s=wt(e),r=m=>s.forVersion(m),c,i;if(n!==void 0){if(!Number.isInteger(n)||n<1||n>40)throw new RangeError(`version must be an integer between 1 and 40, got ${n}`);c=n,i=r(c);let m=Y(c,o),g=ct(i,c);if(g>m)throw new RangeError(`data too large for version ${c} with EC level "${t}" (needs ${g} bytes, capacity ${m})`)}else{let m;for(let[g,h]of xt){if(s.minDataBytes(g)>Y(h,o))continue;let C=r(g),x=ct(C,g);for(let b=g;b<=h;b++)if(x<=Y(b,o)){m={version:b,segments:C};break}if(m)break}if(!m)throw new RangeError(`data too large for any QR version with EC level "${t}"`);c=m.version,i=m.segments}let a=i.some(m=>m.mode==="byte")?he().encode(e):null,u=Y(c,o),f=Ae(e,i,c,u,a);return{codewords:yt(f,c,o),version:c,ecLevelIndex:o,segments:i}}var Me=[(e,t)=>(e+t)%2===0,(e,t)=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0];function Re(e,t){let n=e/t*100,o=Math.floor(Math.abs(n-50)/5)*10,s=Math.ceil(Math.abs(n-50)/5)*10;return Math.min(o,s)}function we(){let e=new Uint8Array(576);for(let t=0;t<8;t++){let n=Me[t];for(let o=0;o<12;o++)for(let s=0;s<6;s++)e[t*72+o*6+s]=n(o,s)?1:0}return e}var Et=we(),St=1488,Lt=93,vt=2047;function $e(e,t,n,o,s){let{prevRow:r,colRunVal:c,colRunLen:i,colWin:l}=s;c.fill(-1),i.fill(0),l.fill(0);let a=0,u=0;for(let f=0;f<n;f++){let R=o+f%12*6,m=f*n,g=f>=10,h=0,C=-1,x=0,b=0,y=-1,A=-1;for(let M=0;M<n;M++){let E=m+M,d=e[E]^Et[R+h]&(t[E]^1);u+=d,d===C?x++:(x>=5&&(a+=x-2),C=d,x=1),b=(b<<1|d)&vt,M>=10&&(b===St||b===Lt)&&(a+=40),d===c[M]?i[M]++:(i[M]>=5&&(a+=i[M]-2),c[M]=d,i[M]=1);let L=(l[M]<<1|d)&vt;l[M]=L,g&&(L===St||L===Lt)&&(a+=40);let k=r[M];f>0&&M>0&&d===y&&d===k&&d===A&&(a+=3),r[M]=d,A=k,y=d,h++,h===6&&(h=0)}x>=5&&(a+=x-2)}for(let f=0;f<n;f++)i[f]>=5&&(a+=i[f]-2);return a+=Re(u,n*n),a}function Ce(e,t,n){let o={prevRow:new Uint8Array(n),colRunVal:new Int8Array(n),colRunLen:new Uint16Array(n),colWin:new Uint16Array(n)},s=0,r=1/0;for(let c=0;c<8;c++){let i=$e(e,t,n,c*72,o);i<r&&(r=i,s=c)}return s}function It(e,t,n){let o=Ce(e,t,n),s=o*72;for(let r=0;r<n;r++){let c=s+r%12*6,i=r*n,l=0;for(let a=0;a<n;a++)t[i+a]||(e[i+a]^=Et[c+l]),l++,l===6&&(l=0)}return o}function Se(e){if(e===1)return[];let t=(e/7|0)+2,n=e*4+10,o=e===32?26:Math.ceil((n-6)/(t-1)/2)*2,s=[6];for(let r=1;r<t;r++)s.push(n-(t-1-r)*o);return s}var Le=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],ve=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function at(e,t,n,o,s){for(let r=-1;r<=7;r++)for(let c=-1;c<=7;c++){let i=o+r,l=s+c;if(i<0||l<0||i>=n||l>=n)continue;let a=i*n+l;t[a]=1,r===-1||r===7||c===-1||c===7?e[a]=0:r===0||r===6||c===0||c===6||r>=2&&r<=4&&c>=2&&c<=4?e[a]=1:e[a]=0}}function Ee(e,t,n,o,s){for(let r=-2;r<=2;r++)for(let c=-2;c<=2;c++){let i=(o+r)*n+(s+c);t[i]=1,r===-2||r===2||c===-2||c===2||r===0&&c===0?e[i]=1:e[i]=0}}function Ie(e,t,n){for(let o=8;o<n-8;o++){let s=o%2===0?1:0,r=6*n+o,c=o*n+6;e[r]=s,e[c]=s,t[r]=1,t[c]=1}}var Ut=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Ue(e,t){for(let[n,o]of Ut)e[n*t+o]=1;for(let n=0;n<8;n++)e[8*t+t-1-n]=1;for(let n=0;n<7;n++)e[(t-7+n)*t+8]=1}function ke(e,t,n,o){if(o<7)return;let s=ve[o-7];for(let r=0;r<18;r++){let c=s>>r&1,i=Math.floor(r/3),l=r%3,a=i*n+(n-11+l),u=(n-11+l)*n+i;e[a]=c,t[a]=1,e[u]=c,t[u]=1}}function Pe(e,t,n,o){let s=0,r=o.length*8,c=n-1,i=!0;for(;c>=0;){if(c===6){c--;continue}let l=i?n-1:0,a=i?-1:n,u=i?-1:1;for(let f=l;f!==a;f+=u){let R=f*n;for(let m=0;m<=1;m++){let g=c-m;g<0||t[R+g]||(s<r?(e[R+g]=o[s>>3]>>7-(s&7)&1,s++):e[R+g]=0)}}c-=2,i=!i}}var Be=16,q=new Map;function kt(e,t="M",n){let o=`${t}|${n??"a"}|${e}`,s=q.get(o);if(s)return q.delete(o),q.set(o,s),s;let r=Oe(e,t,n);return q.set(o,r),q.size>Be&&q.delete(q.keys().next().value),r}function Oe(e,t,n){let o=Ct(e,t,n),{codewords:s,version:r,ecLevelIndex:c}=o,i=r*4+17,l=new Uint8Array(i*i),a=new Uint8Array(i*i);at(l,a,i,0,0),at(l,a,i,0,i-7),at(l,a,i,i-7,0),Ie(l,a,i);let u=(4*r+9)*i+8;l[u]=1,a[u]=1;let f=Se(r);for(let g of f)for(let h of f)g<=8&&h<=8||g<=8&&h>=i-8||g>=i-8&&h<=8||Ee(l,a,i,g,h);ke(l,a,i,r),Ue(a,i),Pe(l,a,i,s);let R=It(l,a,i),m=Le[c*8+R];return Te(l,m,i),{matrix:l,version:r,size:i}}function Te(e,t,n){for(let o=0;o<15;o++){let[s,r]=Ut[o];e[s*n+r]=t>>14-o&1}for(let o=0;o<8;o++)e[8*n+n-1-o]=t>>o&1;for(let o=0;o<7;o++)e[(n-7+o)*n+8]=t>>o+8&1;e[(n-8)*n+8]=1}var p=e=>Math.round(e*100)/100,I=e=>Math.round(e*100);function v(e){let t=e<0,n=t?-e:e,o=Math.floor(n/100),s=n-o*100,r;return s===0?r=String(o):s%10===0?r=`${o}.${s/10}`:s<10?r=`${o}.0${s}`:r=`${o}.${s}`,t?`-${r}`:r}function lt(e,t){return e<=7||e>=t-8?7:-1}function ut(e,t){return e<=7?t-8:t}function Qe(e,t,n,o){let s=v(I(n)),r=new Array(t),c=new Array(t+1),i=new Array(t+1);for(let a=0;a<=t;a++){let u=I(a*n);c[a]=v(u),i[a]=v(-u),a<t&&(r[a]=v(I(o+a*n)))}let l=[];for(let a=0;a<t;a++){let u=a*t,f=v(I(o+a*n)),R=lt(a,t)+1,m=ut(a,t),g=-1;for(let h=R;h<m;h++)if(e[u+h]===1)g===-1&&(g=h);else if(g!==-1){let C=h-g;l.push(`M${r[g]},${f}h${c[C]}v${s}h${i[C]}z`),g=-1}if(g!==-1){let h=m-g;l.push(`M${r[g]},${f}h${c[h]}v${s}h${i[h]}z`)}}return l.join(" ")}function Ne(e,t,n,o,s){let r=p(n),c=[];if(s==="circle"){let b=r/2,y=p(b),A=`a${v(I(y))},${v(I(y))} 0 1,0 `,M=`${A}${v(I(y*2))},0${A}${v(I(-y*2))},0z`,E=new Array(t);for(let d=0;d<t;d++){let L=p(p(o+d*n)+b);E[d]=`M${v(I(L-y))},`}for(let d=0;d<t;d++){let L=d*t,k=`${v(I(p(o+d*n)+b))}${M}`,O=lt(d,t)+1,U=ut(d,t);for(let P=O;P<U;P++)e[L+P]===1&&c.push(E[P]+k)}return c.join(" ")}let i=p(r*.45),l=[v(I(r)),v(I(r-i)),v(I(r-2*i))],a=[v(I(-r)),v(I(-(r-i))),v(I(-(r-2*i)))],u=v(I(i)),f=v(I(-i)),R=`q${u},0 ${u},${u}`,m=`q0,${u} ${f},${u}`,g=`q${f},0 ${f},${f}`,h=`q0,${f} ${u},${f}`,C=new Array(t),x=new Array(t);for(let b=0;b<t;b++){let y=p(o+b*n);C[b]=v(I(y)),x[b]=v(I(y+i))}for(let b=0;b<t;b++){let y=b*t,A=v(I(p(o+b*n))),M=lt(b,t)+1,E=ut(b,t);for(let d=M;d<E;d++){if(e[y+d]!==1)continue;let L=b>0&&e[y-t+d]===1,k=d<t-1&&e[y+d+1]===1,O=b<t-1&&e[y+t+d]===1,U=d>0&&e[y+d-1]===1,P=!(L||U),_=!(L||k),T=!(O||k),Q=!(O||U);c.push(`M${P?x[d]:C[d]},${A}h${l[(P?1:0)+(_?1:0)]}`+(_?R:"")+`v${l[(_?1:0)+(T?1:0)]}`+(T?m:"")+`h${a[(T?1:0)+(Q?1:0)]}`+(Q?g:"")+`v${a[(Q?1:0)+(P?1:0)]}`+(P?h:"")+"z")}}return c.join(" ")}var _e=2,Pt=new WeakMap;function Bt(e,t,n,o,s){let r=Pt.get(e);r||(r=new Map,Pt.set(e,r));let c=`${n}|${o}|${s}`,i=r.get(c);if(i!==void 0)return i;let l=s==="square"?Qe(e,t,n,o):Ne(e,t,n,o,s);return r.size>=_e&&r.clear(),r.set(c,l),l}function Ot(e,t,n){if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(e)}`);if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(t)}`);let o=n+t*2,s=p(e/o);if(e>0&&s===0)throw new RangeError(`[QRCode] margin ${t} leaves no room for a ${n}-module symbol at size ${e}`);return{totalModules:o,moduleSize:s,marginPx:p(t*s),svgSize:p(s*o)}}function et(e,t,n){let o=p(n);return`M${p(e)},${p(t)}h${o}v${o}h${-o}z`}function nt(e,t,n,o,s){let r=p(Math.min(s,n/2,o/2)),c=p(n-2*r),i=p(o-2*r);return`M${p(e+r)},${p(t)}h${c}q${r},0 ${r},${r}v${i}q0,${r} ${-r},${r}h${-c}q${-r},0 ${-r},${-r}v${-i}q0,${-r} ${r},${-r}z`}function De(e,t,n,o){if(o==="circle"){let s=p(n/2),r=p(s*2);return`M${p(e)},${p(t+n/2)}a${s},${s} 0 1,0 ${r},0a${s},${s} 0 1,0 ${-r},0z`}return o==="rounded"?nt(e,t,n,n,n*.3):et(e,t,n)}function qe(e,t,n,o){let s=n/7,r=n-2*s,c=s;if(o==="square"){let a=et(e,t,n),u=et(e+c,t+c,r);return`${a} ${u}`}if(o==="rounded"){let a=nt(e,t,n,n,n*.15),u=et(e+c,t+c,r);return`${a} ${u}`}if(o==="circle"){let a=e+n/2,u=p(t+n/2),f=R=>{let m=p(R),g=p(m*2);return`M${p(a-m)},${u}a${m},${m} 0 1,0 ${g},0a${m},${m} 0 1,0 ${-g},0z`};return`${f(n/2)} ${f(r/2)}`}let i=nt(e,t,n,n,n*.35),l=nt(e+c,t+c,r,r,r*.2);return`${i} ${l}`}function Tt(e,t,n,o,s){let r=p(7*n),c=p(3*n),i=p(2*n);return{square:qe(e,t,r,o),dot:De(p(e+i),p(t+i),c,s)}}function ft(e,t,n){return n+e*t}function Qt(e,t,n){return[[0,0],[0,e-7],[e-7,0]].map(([s,r])=>({x:ft(r,t,n),y:ft(s,t,n)}))}var F={L:.0225,M:.04,Q:.0625,H:.09},Fe=F.H,We=.4;function bt(e){return e<=F.L?"L":e<=F.M?"M":e<=F.Q?"Q":"H"}var Ge=/[\u0000-\u0020]/g;function _t(e){let t=e.replace(Ge,"").toLowerCase();return!(t.startsWith("javascript:")||t.startsWith("data:")&&!t.startsWith("data:image/"))}function Dt(e){return e!==void 0&&Number.isFinite(e)&&e>0?e:1}function qt(e,t,n){let s=(e?t!==void 0?Math.max(0,Math.min(1,t)):We:0)*Fe;return n?{ecLevel:n,absoluteArea:Math.min(s,F[n]),targetArea:s,clamped:s>F[n]}:s>0?{ecLevel:bt(s),absoluteArea:s,targetArea:s,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:s,clamped:!1}}function Nt(e){let t=Math.ceil(e);return Math.max(1,t%2===0?t+1:t)}var He={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function Ft({absoluteArea:e,aspectRatio:t,ecLevel:n,qrSize:o,moduleSize:s,marginPx:r}){let c=o*s,i=e*c*c,l=Math.sqrt(i*t),a=Math.sqrt(i/t);if(!(l>0)||!(a>0))return He;let u=l/s,f=a/s,R=F[n]*o*o,m=Math.max(1,o-16),g=Math.min(Nt(u),m),h=1;for(;;){let d=Math.min(1,g/u);if(h=Math.min(Nt(f*d),m),g*h<=R||g<=1)break;g-=2}let C=Math.min(1,g/u,h/f),x=l*C,b=a*C,y=g*s,A=h*s,M=r+(o-g)/2*s,E=r+(o-h)/2*s;return{clearX:M,clearY:E,clearWidth:y,clearHeight:A,boxX:M+(y-x)/2,boxY:E+(A-b)/2,boxWidth:x,boxHeight:b}}function Ve(e,t){let n=e?.square?.style??"square",o=n==="extra-rounded"?"rounded":n==="circle"?"circle":"square";return{squareStyle:n,squareColor:e?.square?.color??t,dotStyle:e?.dot?.style??o,dotColor:e?.dot?.color??t,backgroundColor:e?.backgroundColor}}function Xe(e){return e!==void 0&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function dt(e){let{value:t,size:n=256,margin:o=4,dotStyle:s="square",dotColor:r="#000000",backgroundColor:c="#ffffff",corner:i,logo:l,qr:a}=e,u=l?.src&&_t(l.src)?l.src:void 0,f=!!(u||l?.custom),R=a?.errorCorrectionLevel,{ecLevel:m,absoluteArea:g,targetArea:h,clamped:C}=qt(f,l?.size,R),x=[];C&&x.push(`[QRCode] logo.size=${l?.size} needs ECL \u2265 "${bt(h)}"; ECL "${R}" set, logo clamped.`);let{matrix:b,size:y}=kt(t,m,a?.version),{moduleSize:A,marginPx:M,svgSize:E}=Ot(n,o,y),d=Ve(i,r),L=Bt(b,y,A,M,s),k=Qt(y,A,M).map(D=>{let{square:Z,dot:J}=Tt(p(D.x),p(D.y),A,d.squareStyle,d.dotStyle);return{...d.backgroundColor===void 0?{}:{background:{x:p(D.x),y:p(D.y),width:p(7*A),height:p(7*A),fill:d.backgroundColor}},square:{d:Z,fill:d.squareColor,fillRule:"evenodd"},dot:{d:J,fill:d.dotColor}}}),O=(l?.margin??0)*A,U=Ft({absoluteArea:g,aspectRatio:Dt(l?.aspectRatio),ecLevel:m,qrSize:y,moduleSize:A,marginPx:M}),P=p(U.boxX+O),_=p(U.boxY+O),T=p(Math.max(0,U.boxWidth-O*2)),Q=p(Math.max(0,U.boxHeight-O*2)),H=f&&T>0&&Q>0;return f&&U.boxWidth>0&&U.boxHeight>0&&(T<=0||Q<=0)&&x.push(`[QRCode] logo.margin=${l?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:p(n),viewBox:E,ecLevel:m,background:c==="transparent"?void 0:c,modules:L?{d:L,fill:r}:void 0,finders:k,clear:H&&(l?.hideDots??!0)?{x:p(U.clearX),y:p(U.clearY),width:p(U.clearWidth),height:p(U.clearHeight)}:void 0,logo:H?{src:u,x:P,y:_,width:T,height:Q,radius:p(Xe(l?.radius)*Math.min(T,Q)/2)}:void 0,warnings:x}}function Ye(e){let t=e.angle??0;return Number.isFinite(t)?(t%360+360)%360:0}function Wt(e){let t=Ye(e)*Math.PI/180,n=Math.cos(t)/2,o=Math.sin(t)/2;return{x1:`${Math.round((.5-n)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+n)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}var S=require("react/jsx-runtime");function Gt({value:e,size:t,margin:n,dotStyle:o,dotColor:s,dotGradient:r,backgroundColor:c,backgroundGradient:i,corner:l,qr:a,logo:u,ariaLabel:f,style:R}){let m=(0,rt.useId)().replace(/[^a-zA-Z0-9_-]/g,""),g=`${m}m`,h=`${m}c`,C=`${m}d`,x=`${m}b`,b=`${m}s`,y=`${m}p`,A=l?.square?.gradient,M=l?.dot?.gradient,E=[];r&&E.push({id:C,gradient:r}),i&&E.push({id:x,gradient:i}),A&&E.push({id:b,gradient:A}),M&&E.push({id:y,gradient:M});let d=u!==void 0,L=u?.size,k=u?.aspectRatio??1,O=u?.margin,U=u?.hideDots,P=u?.radius,_=l?.square?.style,T=l?.square?.color,Q=l?.backgroundColor,H=l?.dot?.style,D=l?.dot?.color,Z=a?.errorCorrectionLevel,J=a?.version,w=(0,rt.useMemo)(()=>dt({value:e,size:t,margin:n,dotStyle:o,dotColor:s,backgroundColor:c,dotGradient:r,backgroundGradient:i,corner:{backgroundColor:Q,square:{style:_,color:T,gradient:A},dot:{style:H,color:D,gradient:M}},qr:{errorCorrectionLevel:Z,version:J},logo:d?{size:L,aspectRatio:k,margin:O,hideDots:U,radius:P,custom:!0}:void 0}),[c,i,D,Q,M,H,s,r,o,Z,d,k,U,O,P,L,n,t,T,A,_,e,J]),mt=w.logo?.radius?`url(#${h})`:void 0;return(0,S.jsxs)($.Svg,{width:w.size,height:w.size,viewBox:`0 0 ${w.viewBox} ${w.viewBox}`,accessible:!0,accessibilityLabel:f??`QR code: ${e}`,accessibilityRole:"image",style:R,children:[w.background!==void 0&&(0,S.jsx)($.Rect,{x:0,y:0,width:w.viewBox,height:w.viewBox,fill:i?`url(#${x})`:w.background}),(w.clear||E.length>0)&&(0,S.jsxs)($.Defs,{children:[w.clear&&(0,S.jsxs)($.Mask,{id:g,children:[(0,S.jsx)($.Rect,{x:0,y:0,width:w.viewBox,height:w.viewBox,fill:"white"}),(0,S.jsx)($.Rect,{x:w.clear.x,y:w.clear.y,width:w.clear.width,height:w.clear.height,fill:"black"})]}),E.map(({id:B,gradient:V})=>(0,S.jsxs)($.LinearGradient,{id:B,...Wt(V),children:[(0,S.jsx)($.Stop,{offset:"0%",stopColor:V.startColor}),(0,S.jsx)($.Stop,{offset:"100%",stopColor:V.endColor})]},B))]}),(0,S.jsxs)($.G,{mask:w.clear?`url(#${g})`:void 0,children:[w.modules&&(0,S.jsx)($.Path,{d:w.modules.d,fill:r?`url(#${C})`:w.modules.fill,fillRule:w.modules.fillRule}),w.finders.map((B,V)=>(0,S.jsxs)($.G,{children:[B.background&&(0,S.jsx)($.Rect,{x:B.background.x,y:B.background.y,width:B.background.width,height:B.background.height,fill:B.background.fill}),(0,S.jsx)($.Path,{d:B.square.d,fill:A?`url(#${b})`:B.square.fill,fillRule:B.square.fillRule}),(0,S.jsx)($.Path,{d:B.dot.d,fill:M?`url(#${y})`:B.dot.fill})]},V))]}),w.logo&&u&&(0,S.jsxs)(S.Fragment,{children:[mt&&(0,S.jsx)($.Defs,{children:(0,S.jsx)($.ClipPath,{id:h,children:(0,S.jsx)($.Rect,{x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,rx:w.logo.radius,ry:w.logo.radius})})}),(0,S.jsx)($.Image,{href:u.source,x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,preserveAspectRatio:"xMidYMid meet",clipPath:mt})]})]})}var Ht=Gt,je=Ht;0&&(module.exports={QRCode,Quter});
1
+ "use strict";var z=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var Kt=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zt=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},Jt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Yt(t))!jt.call(e,s)&&s!==n&&z(e,s,{get:()=>t[s],enumerable:!(o=Xt(t,s))||o.enumerable});return e};var zt=e=>Jt(z({},"__esModule",{value:!0}),e);var ot=(e,t,n)=>Kt(e,typeof t!="symbol"?t+"":t,n);var Ke={};Zt(Ke,{QRCode:()=>Ht,Quter:()=>Vt,default:()=>je});module.exports=zt(Ke);var rt=require("react"),$=require("react-native-svg");function te(){let e=new Uint8Array(512),t=1;for(let n=0;n<256;n++)e[n]=t,t<<=1,t&256&&(t^=285);for(let n=256;n<512;n++)e[n]=e[n-255];return e}function ee(e){let t=new Uint8Array(256);for(let n=0;n<256;n++)t[e[n]]=n;return t}var tt=te(),X=ee(tt);function ne(e,t){return e===0||t===0?0:tt[X[e]+X[t]]}function re(e,t){return tt[X[e]*t%255]}function oe(e){let t=[1];for(let n=0;n<e;n++){let o=[1,re(2,n)],s=new Array(t.length+o.length-1).fill(0);for(let r=0;r<t.length;r++)for(let c=0;c<o.length;c++)s[r+c]^=ne(t[r],o[c]);t=s}return Uint8Array.from(t)}var gt=new Map;function se(e){let t=gt.get(e);return t||(t=oe(e),gt.set(e,t)),t}function ce(e,t){let n=se(t),o=n.length,s=e.length,r=new Uint8Array(s+t);r.set(e);for(let c=0;c<s;c++){let i=r[c];if(i!==0){let l=X[i];for(let a=0;a<o;a++)r[c+a]^=tt[X[n[a]]+l]}}return r.slice(s)}var ie=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],ae=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],pt=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function Y(e,t){return pt[(e-1)*4+t]}function yt(e,t,n){let o=(t-1)*4+n,s=ie[o],r=ae[o],c=pt[o],i=Math.floor(c/r),l=r-c%r,a=e instanceof Uint8Array?e:Uint8Array.from(e),u=new Array(r),f=new Array(r),R=new Array(r),m=0,g=0;for(let x=0;x<r;x++){let d=x<l?i:i+1;u[x]=m,f[x]=d,d>g&&(g=d),R[x]=ce(a.subarray(m,m+d),s),m+=d}let h=new Uint8Array(a.length+r*s),C=0;for(let x=0;x<g;x++)for(let d=0;d<r;d++)x<f[d]&&(h[C++]=a[u[d]+x]);for(let x=0;x<s;x++)for(let d=0;d<r;d++)h[C++]=R[d][x];return h}var ht={numeric:1,alphanumeric:2,byte:4};function le(){let e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",t=new Int8Array(128).fill(-1);for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=n;return t}var G=le();function ue(e){return e<128?G[e]:-1}function N(e,t){return e==="numeric"?t<=9?10:t<=26?12:14:e==="alphanumeric"?t<=9?9:t<=26?11:13:t<=9?8:16}var xt=[[1,9],[10,26],[27,40]],fe=[0,4,7];function de(e,t){return e==="numeric"?10*Math.floor(t/3)+fe[t%3]:e==="alphanumeric"?11*Math.floor(t/2)+6*(t%2):8*t}function ct(e,t){let n=0;for(let o of e)n+=4+N(o.mode,t)+de(o.mode,o.charCount);return Math.ceil(n/8)}function st(e,t,n,o){return{mode:t,start:0,end:e.length,charCount:n,byteStart:0,byteEnd:o}}var W=0,j=1,K=2,be=["numeric","alphanumeric","byte"];function me(e){return e<128?1:e<2048?2:e<65536?3:4}var At=20,Mt=33,Rt=48;function ge(e){let t=0,n=0,o=0,s=0;for(let r=0;r<e.length;r++){let c=e.charCodeAt(r);c<128?(n++,c>=48&&c<=57?(o++,s++):G[c]>=0&&s++):c<2048?n+=2:c>=55296&&c<=56319&&(e.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3,t++}return{count:t,totalBytes:n,digits:o,alnums:s}}function pe(e,t){let n=new Int32Array(t),o=new Uint8Array(t),s=new Uint8Array(t),r=0;for(let c=0;c<e.length;){let i=e.codePointAt(c);n[r]=c,o[r]=me(i),i>=48&&i<=57?s[r]=2:ue(i)>=0&&(s[r]=1),r++,c+=i>65535?2:1}return{cpIndex:n,cpBytes:o,cpClass:s}}function wt(e){let{count:t,totalBytes:n,digits:o,alnums:s}=ge(e),r=o*At+(s-o)*Mt+(n-s)*Rt,c=a=>{let u=4+Math.min(N("numeric",a),N("alphanumeric",a),N("byte",a));return Math.ceil((r/6+u)/8)},i;if(o===t?i=st(e,"numeric",t,n):s===t&&o===0?i=st(e,"alphanumeric",t,n):s===0&&(i=st(e,"byte",n,n)),i){let a=[i];return{forVersion:()=>a,minDataBytes:c}}let l;return{forVersion(a){return l??(l=pe(e,t)),ye(e,a,t,l)},minDataBytes:c}}function ye(e,t,n,{cpIndex:o,cpBytes:s,cpClass:r}){let c=(4+N("numeric",t))*6,i=(4+N("alphanumeric",t))*6,l=(4+N("byte",t))*6,a=[c,i,l],u=new Int8Array(n*3).fill(-1),f=new Float64Array(3),R=new Float64Array([c,i,l]);for(let y=0;y<n;y++){let A=y*3,M=r[y];f[W]=1/0,f[j]=1/0,f[K]=R[K]+s[y]*Rt,u[A+K]=K,M!==0&&(f[j]=R[j]+Mt,u[A+j]=j),M===2&&(f[W]=R[W]+At,u[A+W]=W);for(let b=0;b<3;b++)for(let L=0;L<3;L++){if(u[A+L]===-1)continue;let k=Math.ceil(f[L]/6)*6+a[b];(u[A+b]===-1||k<f[b])&&(f[b]=k,u[A+b]=L)}let E=R;R=f,f=E}let m=W;for(let y=1;y<3;y++)R[y]<R[m]&&(m=y);let g=new Int8Array(n),h=m;for(let y=n-1;y>=0;y--)h=u[y*3+h],g[y]=h;let C=[],x=0,d=0;for(;d<n;){let y=g[d],A=d,M=0;for(;A<n&&g[A]===y;)M+=s[A],A++;C.push({mode:be[y],start:o[d],end:A<n?o[A]:e.length,charCount:y===K?M:A-d,byteStart:x,byteEnd:x+M}),x+=M,d=A}return C}var he={L:0,M:1,Q:2,H:3},$t;function xe(){return $t??($t=new TextEncoder)}var it=class{constructor(t){ot(this,"bytes");ot(this,"bitPos",0);this.bytes=new Uint8Array(t)}writeBits(t,n){let o=this.bitPos;for(let s=n-1;s>=0;s--)t>>s&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(t){this.bitPos+=t}alignToByte(){this.bitPos=this.bitPos+7&-8}},Ae=[236,17];function Me(e,t,n,o,s){let r=new it(o);for(let a of t)if(r.writeBits(ht[a.mode],4),r.writeBits(a.charCount,N(a.mode,n)),a.mode==="numeric")for(let u=a.start;u<a.end;u+=3){let f=Math.min(3,a.end-u),R=e.charCodeAt(u)-48;f>=2&&(R=R*10+(e.charCodeAt(u+1)-48)),f>=3&&(R=R*10+(e.charCodeAt(u+2)-48)),r.writeBits(R,f===3?10:f===2?7:4)}else if(a.mode==="alphanumeric")for(let u=a.start;u<a.end;u+=2)if(u+1<a.end){let f=G[e.charCodeAt(u)]*45+G[e.charCodeAt(u+1)];r.writeBits(f,11)}else r.writeBits(G[e.charCodeAt(u)],6);else for(let u=a.byteStart;u<a.byteEnd;u++)r.writeBits(s[u],8);let c=o*8;if(r.bitLength>c)throw new RangeError(`encoded data (${r.bitLength} bits) exceeds capacity (${c} bits) for the selected version`);r.skipBits(Math.min(4,c-r.bitLength)),r.alignToByte();let i=r.bytes,l=0;for(let a=r.bitLength>>3;a<o;a++)i[a]=Ae[l%2],l++;return i}function Ct(e,t="M",n){if(typeof e!="string")throw new TypeError(`data must be a string, got ${typeof e}`);if(e.length===0)throw new RangeError("data must not be empty");let o=he[t];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(t)}`);let s=wt(e),r=m=>s.forVersion(m),c,i;if(n!==void 0){if(!Number.isInteger(n)||n<1||n>40)throw new RangeError(`version must be an integer between 1 and 40, got ${n}`);c=n,i=r(c);let m=Y(c,o),g=ct(i,c);if(g>m)throw new RangeError(`data too large for version ${c} with EC level "${t}" (needs ${g} bytes, capacity ${m})`)}else{let m;for(let[g,h]of xt){if(s.minDataBytes(g)>Y(h,o))continue;let C=r(g),x=ct(C,g);for(let d=g;d<=h;d++)if(x<=Y(d,o)){m={version:d,segments:C};break}if(m)break}if(!m)throw new RangeError(`data too large for any QR version with EC level "${t}"`);c=m.version,i=m.segments}let a=i.some(m=>m.mode==="byte")?xe().encode(e):null,u=Y(c,o),f=Me(e,i,c,u,a);return{codewords:yt(f,c,o),version:c,ecLevelIndex:o,segments:i}}var Re=[(e,t)=>(e+t)%2===0,(e,t)=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0];function we(e,t){let n=e/t*100,o=Math.floor(Math.abs(n-50)/5)*10,s=Math.ceil(Math.abs(n-50)/5)*10;return Math.min(o,s)}function $e(){let e=new Uint8Array(576);for(let t=0;t<8;t++){let n=Re[t];for(let o=0;o<12;o++)for(let s=0;s<6;s++)e[t*72+o*6+s]=n(o,s)?1:0}return e}var Et=$e(),St=1488,Lt=93,vt=2047;function Ce(e,t,n,o,s){let{prevRow:r,colRunVal:c,colRunLen:i,colWin:l}=s;c.fill(-1),i.fill(0),l.fill(0);let a=0,u=0;for(let f=0;f<n;f++){let R=o+f%12*6,m=f*n,g=f>=10,h=0,C=-1,x=0,d=0,y=-1,A=-1;for(let M=0;M<n;M++){let E=m+M,b=e[E]^Et[R+h]&(t[E]^1);u+=b,b===C?x++:(x>=5&&(a+=x-2),C=b,x=1),d=(d<<1|b)&vt,M>=10&&(d===St||d===Lt)&&(a+=40),b===c[M]?i[M]++:(i[M]>=5&&(a+=i[M]-2),c[M]=b,i[M]=1);let L=(l[M]<<1|b)&vt;l[M]=L,g&&(L===St||L===Lt)&&(a+=40);let k=r[M];f>0&&M>0&&b===y&&b===k&&b===A&&(a+=3),r[M]=b,A=k,y=b,h++,h===6&&(h=0)}x>=5&&(a+=x-2)}for(let f=0;f<n;f++)i[f]>=5&&(a+=i[f]-2);return a+=we(u,n*n),a}function Se(e,t,n){let o={prevRow:new Uint8Array(n),colRunVal:new Int8Array(n),colRunLen:new Uint16Array(n),colWin:new Uint16Array(n)},s=0,r=1/0;for(let c=0;c<8;c++){let i=Ce(e,t,n,c*72,o);i<r&&(r=i,s=c)}return s}function It(e,t,n){let o=Se(e,t,n),s=o*72;for(let r=0;r<n;r++){let c=s+r%12*6,i=r*n,l=0;for(let a=0;a<n;a++)t[i+a]||(e[i+a]^=Et[c+l]),l++,l===6&&(l=0)}return o}function Le(e){if(e===1)return[];let t=(e/7|0)+2,n=e*4+10,o=e===32?26:Math.ceil((n-6)/(t-1)/2)*2,s=[6];for(let r=1;r<t;r++)s.push(n-(t-1-r)*o);return s}var ve=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Ee=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function at(e,t,n,o,s){for(let r=-1;r<=7;r++)for(let c=-1;c<=7;c++){let i=o+r,l=s+c;if(i<0||l<0||i>=n||l>=n)continue;let a=i*n+l;t[a]=1,r===-1||r===7||c===-1||c===7?e[a]=0:r===0||r===6||c===0||c===6||r>=2&&r<=4&&c>=2&&c<=4?e[a]=1:e[a]=0}}function Ie(e,t,n,o,s){for(let r=-2;r<=2;r++)for(let c=-2;c<=2;c++){let i=(o+r)*n+(s+c);t[i]=1,r===-2||r===2||c===-2||c===2||r===0&&c===0?e[i]=1:e[i]=0}}function Ue(e,t,n){for(let o=8;o<n-8;o++){let s=o%2===0?1:0,r=6*n+o,c=o*n+6;e[r]=s,e[c]=s,t[r]=1,t[c]=1}}var Ut=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function ke(e,t){for(let[n,o]of Ut)e[n*t+o]=1;for(let n=0;n<8;n++)e[8*t+t-1-n]=1;for(let n=0;n<7;n++)e[(t-7+n)*t+8]=1}function Pe(e,t,n,o){if(o<7)return;let s=Ee[o-7];for(let r=0;r<18;r++){let c=s>>r&1,i=Math.floor(r/3),l=r%3,a=i*n+(n-11+l),u=(n-11+l)*n+i;e[a]=c,t[a]=1,e[u]=c,t[u]=1}}function Be(e,t,n,o){let s=0,r=o.length*8,c=n-1,i=!0;for(;c>=0;){if(c===6){c--;continue}let l=i?n-1:0,a=i?-1:n,u=i?-1:1;for(let f=l;f!==a;f+=u){let R=f*n;for(let m=0;m<=1;m++){let g=c-m;g<0||t[R+g]||(s<r?(e[R+g]=o[s>>3]>>7-(s&7)&1,s++):e[R+g]=0)}}c-=2,i=!i}}var Oe=16,q=new Map;function kt(e,t="M",n){let o=`${t}|${n??"a"}|${e}`,s=q.get(o);if(s)return q.delete(o),q.set(o,s),s;let r=Te(e,t,n);return q.set(o,r),q.size>Oe&&q.delete(q.keys().next().value),r}function Te(e,t,n){let o=Ct(e,t,n),{codewords:s,version:r,ecLevelIndex:c}=o,i=r*4+17,l=new Uint8Array(i*i),a=new Uint8Array(i*i);at(l,a,i,0,0),at(l,a,i,0,i-7),at(l,a,i,i-7,0),Ue(l,a,i);let u=(4*r+9)*i+8;l[u]=1,a[u]=1;let f=Le(r);for(let g of f)for(let h of f)g<=8&&h<=8||g<=8&&h>=i-8||g>=i-8&&h<=8||Ie(l,a,i,g,h);Pe(l,a,i,r),ke(a,i),Be(l,a,i,s);let R=It(l,a,i),m=ve[c*8+R];return Qe(l,m,i),{matrix:l,version:r,size:i}}function Qe(e,t,n){for(let o=0;o<15;o++){let[s,r]=Ut[o];e[s*n+r]=t>>14-o&1}for(let o=0;o<8;o++)e[8*n+n-1-o]=t>>o&1;for(let o=0;o<7;o++)e[(n-7+o)*n+8]=t>>o+8&1;e[(n-8)*n+8]=1}var p=e=>Math.round(e*100)/100,I=e=>Math.round(e*100);function v(e){let t=e<0,n=t?-e:e,o=Math.floor(n/100),s=n-o*100,r;return s===0?r=String(o):s%10===0?r=`${o}.${s/10}`:s<10?r=`${o}.0${s}`:r=`${o}.${s}`,t?`-${r}`:r}function lt(e,t){return e<=7||e>=t-8?7:-1}function ut(e,t){return e<=7?t-8:t}function Ne(e,t,n,o){let s=v(I(n)),r=new Array(t),c=new Array(t+1),i=new Array(t+1);for(let a=0;a<=t;a++){let u=I(a*n);c[a]=v(u),i[a]=v(-u),a<t&&(r[a]=v(I(o+a*n)))}let l=[];for(let a=0;a<t;a++){let u=a*t,f=v(I(o+a*n)),R=lt(a,t)+1,m=ut(a,t),g=-1;for(let h=R;h<m;h++)if(e[u+h]===1)g===-1&&(g=h);else if(g!==-1){let C=h-g;l.push(`M${r[g]},${f}h${c[C]}v${s}h${i[C]}z`),g=-1}if(g!==-1){let h=m-g;l.push(`M${r[g]},${f}h${c[h]}v${s}h${i[h]}z`)}}return l.join(" ")}function _e(e,t,n,o,s){let r=p(n),c=[];if(s==="circle"){let d=r/2,y=p(d),A=`a${v(I(y))},${v(I(y))} 0 1,0 `,M=`${A}${v(I(y*2))},0${A}${v(I(-y*2))},0z`,E=new Array(t);for(let b=0;b<t;b++){let L=p(p(o+b*n)+d);E[b]=`M${v(I(L-y))},`}for(let b=0;b<t;b++){let L=b*t,k=`${v(I(p(o+b*n)+d))}${M}`,O=lt(b,t)+1,U=ut(b,t);for(let P=O;P<U;P++)e[L+P]===1&&c.push(E[P]+k)}return c.join(" ")}let i=p(r*.45),l=[v(I(r)),v(I(r-i)),v(I(r-2*i))],a=[v(I(-r)),v(I(-(r-i))),v(I(-(r-2*i)))],u=v(I(i)),f=v(I(-i)),R=`q${u},0 ${u},${u}`,m=`q0,${u} ${f},${u}`,g=`q${f},0 ${f},${f}`,h=`q0,${f} ${u},${f}`,C=new Array(t),x=new Array(t);for(let d=0;d<t;d++){let y=p(o+d*n);C[d]=v(I(y)),x[d]=v(I(y+i))}for(let d=0;d<t;d++){let y=d*t,A=v(I(p(o+d*n))),M=lt(d,t)+1,E=ut(d,t);for(let b=M;b<E;b++){if(e[y+b]!==1)continue;let L=d>0&&e[y-t+b]===1,k=b<t-1&&e[y+b+1]===1,O=d<t-1&&e[y+t+b]===1,U=b>0&&e[y+b-1]===1,P=!(L||U),_=!(L||k),T=!(O||k),Q=!(O||U);c.push(`M${P?x[b]:C[b]},${A}h${l[(P?1:0)+(_?1:0)]}`+(_?R:"")+`v${l[(_?1:0)+(T?1:0)]}`+(T?m:"")+`h${a[(T?1:0)+(Q?1:0)]}`+(Q?g:"")+`v${a[(Q?1:0)+(P?1:0)]}`+(P?h:"")+"z")}}return c.join(" ")}var De=2,Pt=new WeakMap;function Bt(e,t,n,o,s){let r=Pt.get(e);r||(r=new Map,Pt.set(e,r));let c=`${n}|${o}|${s}`,i=r.get(c);if(i!==void 0)return i;let l=s==="square"?Ne(e,t,n,o):_e(e,t,n,o,s);return r.size>=De&&r.clear(),r.set(c,l),l}function Ot(e,t,n){if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(e)}`);if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(t)}`);let o=n+t*2,s=p(e/o);if(e>0&&s===0)throw new RangeError(`[QRCode] margin ${t} leaves no room for a ${n}-module symbol at size ${e}`);return{totalModules:o,moduleSize:s,marginPx:p(t*s),svgSize:p(s*o)}}function et(e,t,n){let o=p(n);return`M${p(e)},${p(t)}h${o}v${o}h${-o}z`}function nt(e,t,n,o,s){let r=p(Math.min(s,n/2,o/2)),c=p(n-2*r),i=p(o-2*r);return`M${p(e+r)},${p(t)}h${c}q${r},0 ${r},${r}v${i}q0,${r} ${-r},${r}h${-c}q${-r},0 ${-r},${-r}v${-i}q0,${-r} ${r},${-r}z`}function qe(e,t,n,o){if(o==="circle"){let s=p(n/2),r=p(s*2);return`M${p(e)},${p(t+n/2)}a${s},${s} 0 1,0 ${r},0a${s},${s} 0 1,0 ${-r},0z`}return o==="rounded"?nt(e,t,n,n,n*.3):et(e,t,n)}function Fe(e,t,n,o){let s=n/7,r=n-2*s,c=s;if(o==="square"){let a=et(e,t,n),u=et(e+c,t+c,r);return`${a} ${u}`}if(o==="rounded"){let a=nt(e,t,n,n,n*.15),u=et(e+c,t+c,r);return`${a} ${u}`}if(o==="circle"){let a=e+n/2,u=p(t+n/2),f=R=>{let m=p(R),g=p(m*2);return`M${p(a-m)},${u}a${m},${m} 0 1,0 ${g},0a${m},${m} 0 1,0 ${-g},0z`};return`${f(n/2)} ${f(r/2)}`}let i=nt(e,t,n,n,n*.35),l=nt(e+c,t+c,r,r,r*.2);return`${i} ${l}`}function Tt(e,t,n,o,s){let r=p(7*n),c=p(3*n),i=p(2*n);return{square:Fe(e,t,r,o),dot:qe(p(e+i),p(t+i),c,s)}}function ft(e,t,n){return n+e*t}function Qt(e,t,n){return[[0,0],[0,e-7],[e-7,0]].map(([s,r])=>({x:ft(r,t,n),y:ft(s,t,n)}))}var F={L:.0225,M:.04,Q:.0625,H:.09},We=F.H,Ge=.4;function dt(e){return e<=F.L?"L":e<=F.M?"M":e<=F.Q?"Q":"H"}var He=/[\u0000-\u0020]/g;function _t(e){let t=e.replace(He,"").toLowerCase();return!(t.startsWith("javascript:")||t.startsWith("data:")&&!t.startsWith("data:image/"))}function Dt(e){return e!==void 0&&Number.isFinite(e)&&e>0?e:1}function qt(e,t,n){let s=(e?t!==void 0?Math.max(0,Math.min(1,t)):Ge:0)*We;return n?{ecLevel:n,absoluteArea:Math.min(s,F[n]),targetArea:s,clamped:s>F[n]}:s>0?{ecLevel:dt(s),absoluteArea:s,targetArea:s,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:s,clamped:!1}}function Nt(e){let t=Math.ceil(e);return Math.max(1,t%2===0?t+1:t)}var Ve={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function Ft({absoluteArea:e,aspectRatio:t,ecLevel:n,qrSize:o,moduleSize:s,marginPx:r}){let c=o*s,i=e*c*c,l=Math.sqrt(i*t),a=Math.sqrt(i/t);if(!(l>0)||!(a>0))return Ve;let u=l/s,f=a/s,R=F[n]*o*o,m=Math.max(1,o-16),g=Math.min(Nt(u),m),h=1;for(;;){let b=Math.min(1,g/u);if(h=Math.min(Nt(f*b),m),g*h<=R||g<=1)break;g-=2}let C=Math.min(1,g/u,h/f),x=l*C,d=a*C,y=g*s,A=h*s,M=r+(o-g)/2*s,E=r+(o-h)/2*s;return{clearX:M,clearY:E,clearWidth:y,clearHeight:A,boxX:M+(y-x)/2,boxY:E+(A-d)/2,boxWidth:x,boxHeight:d}}function Xe(e,t){let n=e?.square?.style??"square",o=n==="extra-rounded"?"rounded":n==="circle"?"circle":"square";return{squareStyle:n,squareColor:e?.square?.color??t,dotStyle:e?.dot?.style??o,dotColor:e?.dot?.color??t,backgroundColor:e?.backgroundColor}}function Wt(e){return e!==void 0&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function bt(e){let{value:t,size:n=256,margin:o=4,dotStyle:s="square",dotColor:r="#000000",backgroundColor:c="#ffffff",corner:i,logo:l,qr:a}=e,u=l?.src&&_t(l.src)?l.src:void 0,f=!!(u||l?.custom),R=a?.errorCorrectionLevel,{ecLevel:m,absoluteArea:g,targetArea:h,clamped:C}=qt(f,l?.size,R),x=[];C&&x.push(`[QRCode] logo.size=${l?.size} needs ECL \u2265 "${dt(h)}"; ECL "${R}" set, logo clamped.`);let{matrix:d,size:y}=kt(t,m,a?.version),{moduleSize:A,marginPx:M,svgSize:E}=Ot(n,o,y),b=Xe(i,r),L=Bt(d,y,A,M,s),k=Qt(y,A,M).map(D=>{let{square:Z,dot:J}=Tt(p(D.x),p(D.y),A,b.squareStyle,b.dotStyle);return{...b.backgroundColor===void 0?{}:{background:{x:p(D.x),y:p(D.y),width:p(7*A),height:p(7*A),fill:b.backgroundColor}},square:{d:Z,fill:b.squareColor,fillRule:"evenodd"},dot:{d:J,fill:b.dotColor}}}),O=(l?.margin??0)*A,U=Ft({absoluteArea:g,aspectRatio:Dt(l?.aspectRatio),ecLevel:m,qrSize:y,moduleSize:A,marginPx:M}),P=p(U.boxX+O),_=p(U.boxY+O),T=p(Math.max(0,U.boxWidth-O*2)),Q=p(Math.max(0,U.boxHeight-O*2)),H=f&&T>0&&Q>0;return f&&U.boxWidth>0&&U.boxHeight>0&&(T<=0||Q<=0)&&x.push(`[QRCode] logo.margin=${l?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:p(n),viewBox:E,ecLevel:m,background:c==="transparent"?void 0:c,modules:L?{d:L,fill:r}:void 0,finders:k,clear:H&&(l?.hideDots??!0)?{x:p(U.clearX),y:p(U.clearY),width:p(U.clearWidth),height:p(U.clearHeight),radius:p(Wt(l?.radius)*Math.min(U.clearWidth,U.clearHeight)/2)}:void 0,logo:H?{src:u,x:P,y:_,width:T,height:Q,radius:p(Wt(l?.radius)*Math.min(T,Q)/2)}:void 0,warnings:x}}function Ye(e){let t=e.angle??0;return Number.isFinite(t)?(t%360+360)%360:0}function Gt(e){let t=Ye(e)*Math.PI/180,n=Math.cos(t)/2,o=Math.sin(t)/2;return{x1:`${Math.round((.5-n)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+n)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}var S=require("react/jsx-runtime");function Ht({value:e,size:t,margin:n,dotStyle:o,dotColor:s,dotGradient:r,backgroundColor:c,backgroundGradient:i,corner:l,qr:a,logo:u,ariaLabel:f,style:R}){let m=(0,rt.useId)().replace(/[^a-zA-Z0-9_-]/g,""),g=`${m}m`,h=`${m}c`,C=`${m}d`,x=`${m}b`,d=`${m}s`,y=`${m}p`,A=l?.square?.gradient,M=l?.dot?.gradient,E=[];r&&E.push({id:C,gradient:r}),i&&E.push({id:x,gradient:i}),A&&E.push({id:d,gradient:A}),M&&E.push({id:y,gradient:M});let b=u!==void 0,L=u?.size,k=u?.aspectRatio??1,O=u?.margin,U=u?.hideDots,P=u?.radius,_=l?.square?.style,T=l?.square?.color,Q=l?.backgroundColor,H=l?.dot?.style,D=l?.dot?.color,Z=a?.errorCorrectionLevel,J=a?.version,w=(0,rt.useMemo)(()=>bt({value:e,size:t,margin:n,dotStyle:o,dotColor:s,backgroundColor:c,dotGradient:r,backgroundGradient:i,corner:{backgroundColor:Q,square:{style:_,color:T,gradient:A},dot:{style:H,color:D,gradient:M}},qr:{errorCorrectionLevel:Z,version:J},logo:b?{size:L,aspectRatio:k,margin:O,hideDots:U,radius:P,custom:!0}:void 0}),[c,i,D,Q,M,H,s,r,o,Z,b,k,U,O,P,L,n,t,T,A,_,e,J]),mt=w.logo?.radius?`url(#${h})`:void 0;return(0,S.jsxs)($.Svg,{width:w.size,height:w.size,viewBox:`0 0 ${w.viewBox} ${w.viewBox}`,accessible:!0,accessibilityLabel:f??`QR code: ${e}`,accessibilityRole:"image",style:R,children:[w.background!==void 0&&(0,S.jsx)($.Rect,{x:0,y:0,width:w.viewBox,height:w.viewBox,fill:i?`url(#${x})`:w.background}),(w.clear||E.length>0)&&(0,S.jsxs)($.Defs,{children:[w.clear&&(0,S.jsxs)($.Mask,{id:g,children:[(0,S.jsx)($.Rect,{x:0,y:0,width:w.viewBox,height:w.viewBox,fill:"white"}),(0,S.jsx)($.Rect,{x:w.clear.x,y:w.clear.y,width:w.clear.width,height:w.clear.height,rx:w.clear.radius,ry:w.clear.radius,fill:"black"})]}),E.map(({id:B,gradient:V})=>(0,S.jsxs)($.LinearGradient,{id:B,...Gt(V),children:[(0,S.jsx)($.Stop,{offset:"0%",stopColor:V.startColor}),(0,S.jsx)($.Stop,{offset:"100%",stopColor:V.endColor})]},B))]}),(0,S.jsxs)($.G,{mask:w.clear?`url(#${g})`:void 0,children:[w.modules&&(0,S.jsx)($.Path,{d:w.modules.d,fill:r?`url(#${C})`:w.modules.fill,fillRule:w.modules.fillRule}),w.finders.map((B,V)=>(0,S.jsxs)($.G,{children:[B.background&&(0,S.jsx)($.Rect,{x:B.background.x,y:B.background.y,width:B.background.width,height:B.background.height,fill:B.background.fill}),(0,S.jsx)($.Path,{d:B.square.d,fill:A?`url(#${d})`:B.square.fill,fillRule:B.square.fillRule}),(0,S.jsx)($.Path,{d:B.dot.d,fill:M?`url(#${y})`:B.dot.fill})]},V))]}),w.logo&&u&&(0,S.jsxs)(S.Fragment,{children:[mt&&(0,S.jsx)($.Defs,{children:(0,S.jsx)($.ClipPath,{id:h,children:(0,S.jsx)($.Rect,{x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,rx:w.logo.radius,ry:w.logo.radius})})}),(0,S.jsx)($.Image,{href:u.source,x:w.logo.x,y:w.logo.y,width:w.logo.width,height:w.logo.height,preserveAspectRatio:"xMidYMid meet",clipPath:mt})]})]})}var Vt=Ht,je=Vt;0&&(module.exports={QRCode,Quter});
@@ -1 +1 @@
1
- import{a as Z,b as _}from"./chunk-PJYR3PPM.mjs";import{useId as U,useMemo as V}from"react";import{ClipPath as W,Defs as E,G as F,Image as X,LinearGradient as j,Mask as oo,Path as m,Rect as p,Svg as eo,Stop as J}from"react-native-svg";import{Fragment as ro,jsx as t,jsxs as s}from"react/jsx-runtime";function to({value:h,size:f,margin:y,dotStyle:R,dotColor:x,dotGradient:d,backgroundColor:C,backgroundGradient:c,corner:r,qr:v,logo:i,ariaLabel:K,style:T}){let l=U().replace(/[^a-zA-Z0-9_-]/g,""),w=`${l}m`,b=`${l}c`,$=`${l}d`,k=`${l}b`,P=`${l}s`,Q=`${l}p`,n=r?.square?.gradient,g=r?.dot?.gradient,a=[];d&&a.push({id:$,gradient:d}),c&&a.push({id:k,gradient:c}),n&&a.push({id:P,gradient:n}),g&&a.push({id:Q,gradient:g});let q=i!==void 0,I=i?.size,L=i?.aspectRatio??1,D=i?.margin,B=i?.hideDots,N=i?.radius,O=r?.square?.style,S=r?.square?.color,M=r?.backgroundColor,z=r?.dot?.style,G=r?.dot?.color,A=v?.errorCorrectionLevel,H=v?.version,o=V(()=>Z({value:h,size:f,margin:y,dotStyle:R,dotColor:x,backgroundColor:C,dotGradient:d,backgroundGradient:c,corner:{backgroundColor:M,square:{style:O,color:S,gradient:n},dot:{style:z,color:G,gradient:g}},qr:{errorCorrectionLevel:A,version:H},logo:q?{size:I,aspectRatio:L,margin:D,hideDots:B,radius:N,custom:!0}:void 0}),[C,c,G,M,g,z,x,d,R,A,q,L,B,D,N,I,y,f,S,n,O,h,H]),Y=o.logo?.radius?`url(#${b})`:void 0;return s(eo,{width:o.size,height:o.size,viewBox:`0 0 ${o.viewBox} ${o.viewBox}`,accessible:!0,accessibilityLabel:K??`QR code: ${h}`,accessibilityRole:"image",style:T,children:[o.background!==void 0&&t(p,{x:0,y:0,width:o.viewBox,height:o.viewBox,fill:c?`url(#${k})`:o.background}),(o.clear||a.length>0)&&s(E,{children:[o.clear&&s(oo,{id:w,children:[t(p,{x:0,y:0,width:o.viewBox,height:o.viewBox,fill:"white"}),t(p,{x:o.clear.x,y:o.clear.y,width:o.clear.width,height:o.clear.height,fill:"black"})]}),a.map(({id:e,gradient:u})=>s(j,{id:e,..._(u),children:[t(J,{offset:"0%",stopColor:u.startColor}),t(J,{offset:"100%",stopColor:u.endColor})]},e))]}),s(F,{mask:o.clear?`url(#${w})`:void 0,children:[o.modules&&t(m,{d:o.modules.d,fill:d?`url(#${$})`:o.modules.fill,fillRule:o.modules.fillRule}),o.finders.map((e,u)=>s(F,{children:[e.background&&t(p,{x:e.background.x,y:e.background.y,width:e.background.width,height:e.background.height,fill:e.background.fill}),t(m,{d:e.square.d,fill:n?`url(#${P})`:e.square.fill,fillRule:e.square.fillRule}),t(m,{d:e.dot.d,fill:g?`url(#${Q})`:e.dot.fill})]},u))]}),o.logo&&i&&s(ro,{children:[Y&&t(E,{children:t(W,{id:b,children:t(p,{x:o.logo.x,y:o.logo.y,width:o.logo.width,height:o.logo.height,rx:o.logo.radius,ry:o.logo.radius})})}),t(X,{href:i.source,x:o.logo.x,y:o.logo.y,width:o.logo.width,height:o.logo.height,preserveAspectRatio:"xMidYMid meet",clipPath:Y})]})]})}var io=to,no=io;export{to as QRCode,io as Quter,no as default};
1
+ import{a as Z,b as _}from"./chunk-BI4MXPFZ.mjs";import{useId as U,useMemo as V}from"react";import{ClipPath as W,Defs as E,G as F,Image as X,LinearGradient as j,Mask as oo,Path as m,Rect as p,Svg as eo,Stop as J}from"react-native-svg";import{Fragment as ro,jsx as t,jsxs as s}from"react/jsx-runtime";function to({value:h,size:y,margin:f,dotStyle:R,dotColor:x,dotGradient:d,backgroundColor:C,backgroundGradient:c,corner:r,qr:v,logo:i,ariaLabel:K,style:T}){let l=U().replace(/[^a-zA-Z0-9_-]/g,""),w=`${l}m`,b=`${l}c`,$=`${l}d`,k=`${l}b`,P=`${l}s`,Q=`${l}p`,n=r?.square?.gradient,g=r?.dot?.gradient,a=[];d&&a.push({id:$,gradient:d}),c&&a.push({id:k,gradient:c}),n&&a.push({id:P,gradient:n}),g&&a.push({id:Q,gradient:g});let q=i!==void 0,I=i?.size,L=i?.aspectRatio??1,D=i?.margin,B=i?.hideDots,N=i?.radius,O=r?.square?.style,S=r?.square?.color,M=r?.backgroundColor,z=r?.dot?.style,G=r?.dot?.color,A=v?.errorCorrectionLevel,H=v?.version,o=V(()=>Z({value:h,size:y,margin:f,dotStyle:R,dotColor:x,backgroundColor:C,dotGradient:d,backgroundGradient:c,corner:{backgroundColor:M,square:{style:O,color:S,gradient:n},dot:{style:z,color:G,gradient:g}},qr:{errorCorrectionLevel:A,version:H},logo:q?{size:I,aspectRatio:L,margin:D,hideDots:B,radius:N,custom:!0}:void 0}),[C,c,G,M,g,z,x,d,R,A,q,L,B,D,N,I,f,y,S,n,O,h,H]),Y=o.logo?.radius?`url(#${b})`:void 0;return s(eo,{width:o.size,height:o.size,viewBox:`0 0 ${o.viewBox} ${o.viewBox}`,accessible:!0,accessibilityLabel:K??`QR code: ${h}`,accessibilityRole:"image",style:T,children:[o.background!==void 0&&t(p,{x:0,y:0,width:o.viewBox,height:o.viewBox,fill:c?`url(#${k})`:o.background}),(o.clear||a.length>0)&&s(E,{children:[o.clear&&s(oo,{id:w,children:[t(p,{x:0,y:0,width:o.viewBox,height:o.viewBox,fill:"white"}),t(p,{x:o.clear.x,y:o.clear.y,width:o.clear.width,height:o.clear.height,rx:o.clear.radius,ry:o.clear.radius,fill:"black"})]}),a.map(({id:e,gradient:u})=>s(j,{id:e,..._(u),children:[t(J,{offset:"0%",stopColor:u.startColor}),t(J,{offset:"100%",stopColor:u.endColor})]},e))]}),s(F,{mask:o.clear?`url(#${w})`:void 0,children:[o.modules&&t(m,{d:o.modules.d,fill:d?`url(#${$})`:o.modules.fill,fillRule:o.modules.fillRule}),o.finders.map((e,u)=>s(F,{children:[e.background&&t(p,{x:e.background.x,y:e.background.y,width:e.background.width,height:e.background.height,fill:e.background.fill}),t(m,{d:e.square.d,fill:n?`url(#${P})`:e.square.fill,fillRule:e.square.fillRule}),t(m,{d:e.dot.d,fill:g?`url(#${Q})`:e.dot.fill})]},u))]}),o.logo&&i&&s(ro,{children:[Y&&t(E,{children:t(W,{id:b,children:t(p,{x:o.logo.x,y:o.logo.y,width:o.logo.width,height:o.logo.height,rx:o.logo.radius,ry:o.logo.radius})})}),t(X,{href:i.source,x:o.logo.x,y:o.logo.y,width:o.logo.width,height:o.logo.height,preserveAspectRatio:"xMidYMid meet",clipPath:Y})]})]})}var io=to,no=io;export{to as QRCode,io as Quter,no as default};
package/dist/vanilla.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var se=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var gt=Object.prototype.hasOwnProperty;var ht=(t,e,r)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var pt=(t,e)=>{for(var r in e)se(t,r,{get:e[r],enumerable:!0})},yt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of bt(e))!gt.call(t,a)&&a!==r&&se(t,a,{get:()=>e[a],enumerable:!(n=mt(e,a))||n.enumerable});return t};var xt=t=>yt(se({},"__esModule",{value:!0}),t);var ye=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);var Sr={};pt(Sr,{renderQuter:()=>Mr});module.exports=xt(Sr);function wt(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function Ct(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var le=wt(),z=Ct(le);function $t(t,e){return t===0||e===0?0:le[z[t]+z[e]]}function At(t,e){return le[z[t]*e%255]}function Mt(t){let e=[1];for(let r=0;r<t;r++){let n=[1,At(2,r)],a=new Array(e.length+n.length-1).fill(0);for(let o=0;o<e.length;o++)for(let c=0;c<n.length;c++)a[o+c]^=$t(e[o],n[c]);e=a}return Uint8Array.from(e)}var Ue=new Map;function St(t){let e=Ue.get(t);return e||(e=Mt(t),Ue.set(t,e)),e}function Rt(t,e){let r=St(e),n=r.length,a=t.length,o=new Uint8Array(a+e);o.set(t);for(let c=0;c<a;c++){let s=o[c];if(s!==0){let f=z[s];for(let i=0;i<n;i++)o[c+i]^=le[z[r[i]]+f]}}return o.slice(a)}var vt=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],Et=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Oe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ee(t,e){return Oe[(t-1)*4+e]}function Be(t,e,r){let n=(e-1)*4+r,a=vt[n],o=Et[n],c=Oe[n],s=Math.floor(c/o),f=o-c%o,i=t instanceof Uint8Array?t:Uint8Array.from(t),u=new Array(o),d=new Array(o),$=new Array(o),p=0,b=0;for(let y=0;y<o;y++){let h=y<f?s:s+1;u[y]=p,d[y]=h,h>b&&(b=h),$[y]=Rt(i.subarray(p,p+h),a),p+=h}let C=new Uint8Array(i.length+o*a),S=0;for(let y=0;y<b;y++)for(let h=0;h<o;h++)y<d[h]&&(C[S++]=i[u[h]+y]);for(let y=0;y<a;y++)for(let h=0;h<o;h++)C[S++]=$[h][y];return C}var Qe={numeric:1,alphanumeric:2,byte:4};function Lt(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var K=Lt();function It(t){return t<128?K[t]:-1}function q(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Pe=[[1,9],[10,26],[27,40]],kt=[0,4,7];function Ut(t,e){return t==="numeric"?10*Math.floor(e/3)+kt[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function we(t,e){let r=0;for(let n of t)r+=4+q(n.mode,e)+Ut(n.mode,n.charCount);return Math.ceil(r/8)}function xe(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var j=0,te=1,re=2,Ot=["numeric","alphanumeric","byte"];function Bt(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Te=33,Ne=48;function Qt(t){let e=0,r=0,n=0,a=0;for(let o=0;o<t.length;o++){let c=t.charCodeAt(o);c<128?(r++,c>=48&&c<=57?(n++,a++):K[c]>=0&&a++):c<2048?r+=2:c>=55296&&c<=56319&&(t.charCodeAt(o+1)&64512)===56320?(r+=4,o++):r+=3,e++}return{count:e,totalBytes:r,digits:n,alnums:a}}function Pt(t,e){let r=new Int32Array(e),n=new Uint8Array(e),a=new Uint8Array(e),o=0;for(let c=0;c<t.length;){let s=t.codePointAt(c);r[o]=c,n[o]=Bt(s),s>=48&&s<=57?a[o]=2:It(s)>=0&&(a[o]=1),o++,c+=s>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:a}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:a}=Qt(t),o=n*Fe+(a-n)*Te+(r-a)*Ne,c=i=>{let u=4+Math.min(q("numeric",i),q("alphanumeric",i),q("byte",i));return Math.ceil((o/6+u)/8)},s;if(n===e?s=xe(t,"numeric",e,r):a===e&&n===0?s=xe(t,"alphanumeric",e,r):a===0&&(s=xe(t,"byte",r,r)),s){let i=[s];return{forVersion:()=>i,minDataBytes:c}}let f;return{forVersion(i){return f??(f=Pt(t,e)),Ft(t,i,e,f)},minDataBytes:c}}function Ft(t,e,r,{cpIndex:n,cpBytes:a,cpClass:o}){let c=(4+q("numeric",e))*6,s=(4+q("alphanumeric",e))*6,f=(4+q("byte",e))*6,i=[c,s,f],u=new Int8Array(r*3).fill(-1),d=new Float64Array(3),$=new Float64Array([c,s,f]);for(let m=0;m<r;m++){let x=m*3,g=o[m];d[j]=1/0,d[te]=1/0,d[re]=$[re]+a[m]*Ne,u[x+re]=re,g!==0&&(d[te]=$[te]+Te,u[x+te]=te),g===2&&(d[j]=$[j]+Fe,u[x+j]=j);for(let l=0;l<3;l++)for(let R=0;R<3;R++){if(u[x+R]===-1)continue;let L=Math.ceil(d[R]/6)*6+i[l];(u[x+l]===-1||L<d[l])&&(d[l]=L,u[x+l]=R)}let A=$;$=d,d=A}let p=j;for(let m=1;m<3;m++)$[m]<$[p]&&(p=m);let b=new Int8Array(r),C=p;for(let m=r-1;m>=0;m--)C=u[m*3+C],b[m]=C;let S=[],y=0,h=0;for(;h<r;){let m=b[h],x=h,g=0;for(;x<r&&b[x]===m;)g+=a[x],x++;S.push({mode:Ot[m],start:n[h],end:x<r?n[x]:t.length,charCount:m===re?g:x-h,byteStart:y,byteEnd:y+g}),y+=g,h=x}return S}var Tt={L:0,M:1,Q:2,H:3},De;function Nt(){return De??(De=new TextEncoder)}var Ce=class{constructor(e){ye(this,"bytes");ye(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let a=r-1;a>=0;a--)e>>a&1&&(this.bytes[n>>3]|=128>>(n&7)),n++;this.bitPos=n}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},_t=[236,17];function Dt(t,e,r,n,a){let o=new Ce(n);for(let i of e)if(o.writeBits(Qe[i.mode],4),o.writeBits(i.charCount,q(i.mode,r)),i.mode==="numeric")for(let u=i.start;u<i.end;u+=3){let d=Math.min(3,i.end-u),$=t.charCodeAt(u)-48;d>=2&&($=$*10+(t.charCodeAt(u+1)-48)),d>=3&&($=$*10+(t.charCodeAt(u+2)-48)),o.writeBits($,d===3?10:d===2?7:4)}else if(i.mode==="alphanumeric")for(let u=i.start;u<i.end;u+=2)if(u+1<i.end){let d=K[t.charCodeAt(u)]*45+K[t.charCodeAt(u+1)];o.writeBits(d,11)}else o.writeBits(K[t.charCodeAt(u)],6);else for(let u=i.byteStart;u<i.byteEnd;u++)o.writeBits(a[u],8);let c=n*8;if(o.bitLength>c)throw new RangeError(`encoded data (${o.bitLength} bits) exceeds capacity (${c} bits) for the selected version`);o.skipBits(Math.min(4,c-o.bitLength)),o.alignToByte();let s=o.bytes,f=0;for(let i=o.bitLength>>3;i<n;i++)s[i]=_t[f%2],f++;return s}function qe(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let n=Tt[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let a=_e(t),o=p=>a.forVersion(p),c,s;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);c=r,s=o(c);let p=ee(c,n),b=we(s,c);if(b>p)throw new RangeError(`data too large for version ${c} with EC level "${e}" (needs ${b} bytes, capacity ${p})`)}else{let p;for(let[b,C]of Pe){if(a.minDataBytes(b)>ee(C,n))continue;let S=o(b),y=we(S,b);for(let h=b;h<=C;h++)if(y<=ee(h,n)){p={version:h,segments:S};break}if(p)break}if(!p)throw new RangeError(`data too large for any QR version with EC level "${e}"`);c=p.version,s=p.segments}let i=s.some(p=>p.mode==="byte")?Nt().encode(t):null,u=ee(c,n),d=Dt(t,s,c,u,i);return{codewords:Be(d,c,n),version:c,ecLevelIndex:n,segments:s}}var qt=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function Gt(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,a=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,a)}function Wt(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=qt[e];for(let n=0;n<12;n++)for(let a=0;a<6;a++)t[e*72+n*6+a]=r(n,a)?1:0}return t}var Ve=Wt(),Ge=1488,We=93,He=2047;function Ht(t,e,r,n,a){let{prevRow:o,colRunVal:c,colRunLen:s,colWin:f}=a;c.fill(-1),s.fill(0),f.fill(0);let i=0,u=0;for(let d=0;d<r;d++){let $=n+d%12*6,p=d*r,b=d>=10,C=0,S=-1,y=0,h=0,m=-1,x=-1;for(let g=0;g<r;g++){let A=p+g,l=t[A]^Ve[$+C]&(e[A]^1);u+=l,l===S?y++:(y>=5&&(i+=y-2),S=l,y=1),h=(h<<1|l)&He,g>=10&&(h===Ge||h===We)&&(i+=40),l===c[g]?s[g]++:(s[g]>=5&&(i+=s[g]-2),c[g]=l,s[g]=1);let R=(f[g]<<1|l)&He;f[g]=R,b&&(R===Ge||R===We)&&(i+=40);let L=o[g];d>0&&g>0&&l===m&&l===L&&l===x&&(i+=3),o[g]=l,x=L,m=l,C++,C===6&&(C=0)}y>=5&&(i+=y-2)}for(let d=0;d<r;d++)s[d]>=5&&(i+=s[d]-2);return i+=Gt(u,r*r),i}function Vt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},a=0,o=1/0;for(let c=0;c<8;c++){let s=Ht(t,e,r,c*72,n);s<o&&(o=s,a=c)}return a}function Xe(t,e,r){let n=Vt(t,e,r),a=n*72;for(let o=0;o<r;o++){let c=a+o%12*6,s=o*r,f=0;for(let i=0;i<r;i++)e[s+i]||(t[s+i]^=Ve[c+f]),f++,f===6&&(f=0)}return n}function Xt(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,n=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,a=[6];for(let o=1;o<e;o++)a.push(r-(e-1-o)*n);return a}var Yt=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],jt=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function $e(t,e,r,n,a){for(let o=-1;o<=7;o++)for(let c=-1;c<=7;c++){let s=n+o,f=a+c;if(s<0||f<0||s>=r||f>=r)continue;let i=s*r+f;e[i]=1,o===-1||o===7||c===-1||c===7?t[i]=0:o===0||o===6||c===0||c===6||o>=2&&o<=4&&c>=2&&c<=4?t[i]=1:t[i]=0}}function Kt(t,e,r,n,a){for(let o=-2;o<=2;o++)for(let c=-2;c<=2;c++){let s=(n+o)*r+(a+c);e[s]=1,o===-2||o===2||c===-2||c===2||o===0&&c===0?t[s]=1:t[s]=0}}function Jt(t,e,r){for(let n=8;n<r-8;n++){let a=n%2===0?1:0,o=6*r+n,c=n*r+6;t[o]=a,t[c]=a,e[o]=1,e[c]=1}}var Ye=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Zt(t,e){for(let[r,n]of Ye)t[r*e+n]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function zt(t,e,r,n){if(n<7)return;let a=jt[n-7];for(let o=0;o<18;o++){let c=a>>o&1,s=Math.floor(o/3),f=o%3,i=s*r+(r-11+f),u=(r-11+f)*r+s;t[i]=c,e[i]=1,t[u]=c,e[u]=1}}function er(t,e,r,n){let a=0,o=n.length*8,c=r-1,s=!0;for(;c>=0;){if(c===6){c--;continue}let f=s?r-1:0,i=s?-1:r,u=s?-1:1;for(let d=f;d!==i;d+=u){let $=d*r;for(let p=0;p<=1;p++){let b=c-p;b<0||e[$+b]||(a<o?(t[$+b]=n[a>>3]>>7-(a&7)&1,a++):t[$+b]=0)}}c-=2,s=!s}}var tr=16,X=new Map;function je(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,a=X.get(n);if(a)return X.delete(n),X.set(n,a),a;let o=rr(t,e,r);return X.set(n,o),X.size>tr&&X.delete(X.keys().next().value),o}function rr(t,e,r){let n=qe(t,e,r),{codewords:a,version:o,ecLevelIndex:c}=n,s=o*4+17,f=new Uint8Array(s*s),i=new Uint8Array(s*s);$e(f,i,s,0,0),$e(f,i,s,0,s-7),$e(f,i,s,s-7,0),Jt(f,i,s);let u=(4*o+9)*s+8;f[u]=1,i[u]=1;let d=Xt(o);for(let b of d)for(let C of d)b<=8&&C<=8||b<=8&&C>=s-8||b>=s-8&&C<=8||Kt(f,i,s,b,C);zt(f,i,s,o),Zt(i,s),er(f,i,s,a);let $=Xe(f,i,s),p=Yt[c*8+$];return nr(f,p,s),{matrix:f,version:o,size:s}}function nr(t,e,r){for(let n=0;n<15;n++){let[a,o]=Ye[n];t[a*r+o]=e>>14-n&1}for(let n=0;n<8;n++)t[8*r+r-1-n]=e>>n&1;for(let n=0;n<7;n++)t[(r-7+n)*r+8]=e>>n+8&1;t[(r-8)*r+8]=1}var w=t=>Math.round(t*100)/100,O=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),a=r-n*100,o;return a===0?o=String(n):a%10===0?o=`${n}.${a/10}`:a<10?o=`${n}.0${a}`:o=`${n}.${a}`,e?`-${o}`:o}function Ae(t,e){return t<=7||t>=e-8?7:-1}function Me(t,e){return t<=7?e-8:e}function or(t,e,r,n){let a=k(O(r)),o=new Array(e),c=new Array(e+1),s=new Array(e+1);for(let i=0;i<=e;i++){let u=O(i*r);c[i]=k(u),s[i]=k(-u),i<e&&(o[i]=k(O(n+i*r)))}let f=[];for(let i=0;i<e;i++){let u=i*e,d=k(O(n+i*r)),$=Ae(i,e)+1,p=Me(i,e),b=-1;for(let C=$;C<p;C++)if(t[u+C]===1)b===-1&&(b=C);else if(b!==-1){let S=C-b;f.push(`M${o[b]},${d}h${c[S]}v${a}h${s[S]}z`),b=-1}if(b!==-1){let C=p-b;f.push(`M${o[b]},${d}h${c[C]}v${a}h${s[C]}z`)}}return f.join(" ")}function ar(t,e,r,n,a){let o=w(r),c=[];if(a==="circle"){let h=o/2,m=w(h),x=`a${k(O(m))},${k(O(m))} 0 1,0 `,g=`${x}${k(O(m*2))},0${x}${k(O(-m*2))},0z`,A=new Array(e);for(let l=0;l<e;l++){let R=w(w(n+l*r)+h);A[l]=`M${k(O(R-m))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(O(w(n+l*r)+h))}${g}`,U=Ae(l,e)+1,E=Me(l,e);for(let I=U;I<E;I++)t[R+I]===1&&c.push(A[I]+L)}return c.join(" ")}let s=w(o*.45),f=[k(O(o)),k(O(o-s)),k(O(o-2*s))],i=[k(O(-o)),k(O(-(o-s))),k(O(-(o-2*s)))],u=k(O(s)),d=k(O(-s)),$=`q${u},0 ${u},${u}`,p=`q0,${u} ${d},${u}`,b=`q${d},0 ${d},${d}`,C=`q0,${d} ${u},${d}`,S=new Array(e),y=new Array(e);for(let h=0;h<e;h++){let m=w(n+h*r);S[h]=k(O(m)),y[h]=k(O(m+s))}for(let h=0;h<e;h++){let m=h*e,x=k(O(w(n+h*r))),g=Ae(h,e)+1,A=Me(h,e);for(let l=g;l<A;l++){if(t[m+l]!==1)continue;let R=h>0&&t[m-e+l]===1,L=l<e-1&&t[m+l+1]===1,U=h<e-1&&t[m+e+l]===1,E=l>0&&t[m+l-1]===1,I=!(R||E),M=!(R||L),v=!(U||L),Q=!(U||E);c.push(`M${I?y[l]:S[l]},${x}h${f[(I?1:0)+(M?1:0)]}`+(M?$:"")+`v${f[(M?1:0)+(v?1:0)]}`+(v?p:"")+`h${i[(v?1:0)+(Q?1:0)]}`+(Q?b:"")+`v${i[(Q?1:0)+(I?1:0)]}`+(I?C:"")+"z")}}return c.join(" ")}var ir=2,Ke=new WeakMap;function Je(t,e,r,n,a){let o=Ke.get(t);o||(o=new Map,Ke.set(t,o));let c=`${r}|${n}|${a}`,s=o.get(c);if(s!==void 0)return s;let f=a==="square"?or(t,e,r,n):ar(t,e,r,n,a);return o.size>=ir&&o.clear(),o.set(c,f),f}var cr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ze(t){return t.replace(cr,"")}function ze(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let n=r+e*2,a=w(t/n);if(t>0&&a===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:a,marginPx:w(e*a),svgSize:w(a*n)}}function ue(t,e,r){let n=w(r);return`M${w(t)},${w(e)}h${n}v${n}h${-n}z`}function fe(t,e,r,n,a){let o=w(Math.min(a,r/2,n/2)),c=w(r-2*o),s=w(n-2*o);return`M${w(t+o)},${w(e)}h${c}q${o},0 ${o},${o}v${s}q0,${o} ${-o},${o}h${-c}q${-o},0 ${-o},${-o}v${-s}q0,${-o} ${o},${-o}z`}function sr(t,e,r,n){if(n==="circle"){let a=w(r/2),o=w(a*2);return`M${w(t)},${w(e+r/2)}a${a},${a} 0 1,0 ${o},0a${a},${a} 0 1,0 ${-o},0z`}return n==="rounded"?fe(t,e,r,r,r*.3):ue(t,e,r)}function lr(t,e,r,n){let a=r/7,o=r-2*a,c=a;if(n==="square"){let i=ue(t,e,r),u=ue(t+c,e+c,o);return`${i} ${u}`}if(n==="rounded"){let i=fe(t,e,r,r,r*.15),u=ue(t+c,e+c,o);return`${i} ${u}`}if(n==="circle"){let i=t+r/2,u=w(e+r/2),d=$=>{let p=w($),b=w(p*2);return`M${w(i-p)},${u}a${p},${p} 0 1,0 ${b},0a${p},${p} 0 1,0 ${-b},0z`};return`${d(r/2)} ${d(o/2)}`}let s=fe(t,e,r,r,r*.35),f=fe(t+c,e+c,o,o,o*.2);return`${s} ${f}`}function et(t,e,r,n,a){let o=w(7*r),c=w(3*r),s=w(2*r);return{square:lr(t,e,o,n),dot:sr(w(t+s),w(e+s),c,a)}}function Se(t,e,r){return r+t*e}function tt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([a,o])=>({x:Se(o,e,r),y:Se(a,e,r)}))}var Y={L:.0225,M:.04,Q:.0625,H:.09},ur=Y.H,fr=.4;function Re(t){return t<=Y.L?"L":t<=Y.M?"M":t<=Y.Q?"Q":"H"}var dr=/[\u0000-\u0020]/g;function de(t){let e=t.replace(dr,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function nt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function ot(t,e,r){let a=(t?e!==void 0?Math.max(0,Math.min(1,e)):fr:0)*ur;return r?{ecLevel:r,absoluteArea:Math.min(a,Y[r]),targetArea:a,clamped:a>Y[r]}:a>0?{ecLevel:Re(a),absoluteArea:a,targetArea:a,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:a,clamped:!1}}function rt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var mr={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function at({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:n,moduleSize:a,marginPx:o}){let c=n*a,s=t*c*c,f=Math.sqrt(s*e),i=Math.sqrt(s/e);if(!(f>0)||!(i>0))return mr;let u=f/a,d=i/a,$=Y[r]*n*n,p=Math.max(1,n-16),b=Math.min(rt(u),p),C=1;for(;;){let l=Math.min(1,b/u);if(C=Math.min(rt(d*l),p),b*C<=$||b<=1)break;b-=2}let S=Math.min(1,b/u,C/d),y=f*S,h=i*S,m=b*a,x=C*a,g=o+(n-b)/2*a,A=o+(n-C)/2*a;return{clearX:g,clearY:A,clearWidth:m,clearHeight:x,boxX:g+(m-y)/2,boxY:A+(x-h)/2,boxWidth:y,boxHeight:h}}function ve(t,e){let r=t?.square?.style??"square",n=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??n,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function br(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",backgroundColor:c="#ffffff",corner:s,logo:f,qr:i}=t,u=f?.src&&de(f.src)?f.src:void 0,d=!!(u||f?.custom),$=i?.errorCorrectionLevel,{ecLevel:p,absoluteArea:b,targetArea:C,clamped:S}=ot(d,f?.size,$),y=[];S&&y.push(`[QRCode] logo.size=${f?.size} needs ECL \u2265 "${Re(C)}"; ECL "${$}" set, logo clamped.`);let{matrix:h,size:m}=je(e,p,i?.version),{moduleSize:x,marginPx:g,svgSize:A}=ze(r,n,m),l=ve(s,o),R=Je(h,m,x,g,a),L=tt(m,x,g).map(P=>{let{square:F,dot:W}=et(w(P.x),w(P.y),x,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:w(P.x),y:w(P.y),width:w(7*x),height:w(7*x),fill:l.backgroundColor}},square:{d:F,fill:l.squareColor,fillRule:"evenodd"},dot:{d:W,fill:l.dotColor}}}),U=(f?.margin??0)*x,E=at({absoluteArea:b,aspectRatio:nt(f?.aspectRatio),ecLevel:p,qrSize:m,moduleSize:x,marginPx:g}),I=w(E.boxX+U),M=w(E.boxY+U),v=w(Math.max(0,E.boxWidth-U*2)),Q=w(Math.max(0,E.boxHeight-U*2)),N=d&&v>0&&Q>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||Q<=0)&&y.push(`[QRCode] logo.margin=${f?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:w(r),viewBox:A,ecLevel:p,background:c==="transparent"?void 0:c,modules:R?{d:R,fill:o}:void 0,finders:L,clear:N&&(f?.hideDots??!0)?{x:w(E.clearX),y:w(E.clearY),width:w(E.clearWidth),height:w(E.clearHeight)}:void 0,logo:N?{src:u,x:I,y:M,width:v,height:Q,radius:w(br(f?.radius)*Math.min(v,Q)/2)}:void 0,warnings:y}}function ne(t,e){return`${t}${e}`}function gr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Ee(t){let e=gr(t)*Math.PI/180,r=Math.cos(e)/2,n=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-n)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+n)*100)}%`}}function oe(t,e){let{x1:r,y1:n,x2:a,y2:o}=Ee(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${a}" y2="${o}"><stop offset="0%" stop-color="${it(e.startColor)}"/><stop offset="100%" stop-color="${it(e.endColor)}"/></linearGradient>`}function it(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);e=Math.imul(e^a,16777619),r=Math.imul(r^a,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function G(t){return Ze(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ct=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),pr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of pr)ct.add(t);function yr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function xr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let a=typeof r=="number"&&r!==0&&!ct.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${yr(e)}:${a}`}).join(";")}function me(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",dotGradient:c,backgroundColor:s="#ffffff",backgroundGradient:f,corner:i,logo:u,qr:d,className:$,style:p,ariaLabel:b,idPrefix:C}=t,S=J(t),y=ve(i,o),h=u?.src&&de(u.src)?u.src:void 0,m=(C??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",x=[e,r,n,a,o,JSON.stringify(c??null),s,JSON.stringify(f??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,i?.backgroundColor??"",JSON.stringify(i?.square?.gradient??null),JSON.stringify(i?.dot?.gradient??null),S.ecLevel,d?.version??"",h??"",u?.size??"",u?.aspectRatio??"",u?.margin??"",u?.hideDots??"",$??"",b??"",C??""];u?.radius!==void 0&&x.push(u.radius),u?.custom&&x.push("custom");let g=`${m}${hr(x.join("\0"))}`,A=`${g}t`,l=`${g}m`,R=`${g}c`,L=ne(g,"d"),U=ne(g,"b"),E=ne(g,"s"),I=ne(g,"p"),{size:M,viewBox:v,background:Q,modules:N,finders:P}=S,{clear:F,logo:W}=S,B=`<svg role="img" aria-labelledby="${A}" width="${M}" height="${M}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(B+=` class="${G($)}"`),p&&(B+=` style="${G(xr(p))}"`),B+=">",B+=`<title id="${A}">${G(b??`QR code: ${e}`)}</title>`;let ae=[c&&oe(L,c),f&&oe(U,f),i?.square?.gradient&&oe(E,i.square.gradient),i?.dot?.gradient&&oe(I,i.dot.gradient)].filter(Boolean);ae.length&&(B+=`<defs>${ae.join("")}</defs>`),Q!==void 0&&(B+=`<rect width="${v}" height="${v}" fill="${f?`url(#${U})`:G(Q)}"/>`),F&&(B+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${F.x}" y="${F.y}" width="${F.width}" height="${F.height}" fill="black"/></mask></defs>`),B+=`<g${F?` mask="url(#${l})"`:""}>`,N&&(B+=`<path d="${N.d}" fill="${c?`url(#${L})`:G(N.fill)}"/>`);for(let{background:_,square:H,dot:V}of P)B+="<g>"+(_?`<rect x="${_.x}" y="${_.y}" width="${_.width}" height="${_.height}" fill="${G(_.fill)}"/>`:"")+`<path d="${H.d}" fill="${i?.square?.gradient?`url(#${E})`:G(H.fill)}" fill-rule="evenodd"/><path d="${V.d}" fill="${i?.dot?.gradient?`url(#${I})`:G(V.fill)}"/></g>`;if(B+="</g>",W?.src){let{x:_,y:H,width:V,height:ie,radius:T}=W;T>0&&(B+=`<defs><clipPath id="${R}"><rect x="${_}" y="${H}" width="${V}" height="${ie}" rx="${T}" ry="${T}"/></clipPath></defs>`),B+=`<image href="${G(W.src)}" x="${_}" y="${H}" width="${V}" height="${ie}"${T>0?` clip-path="url(#${R})"`:""}/>`}return B+="</svg>",B}function st(t,e,r,n){if(n){let a=Ee(n),o=Number.parseFloat(a.x1)/100*e,c=Number.parseFloat(a.y1)/100*e,s=Number.parseFloat(a.x2)/100*e,f=Number.parseFloat(a.y2)/100*e,i=t.createLinearGradient(o,c,s,f);i.addColorStop(0,n.startColor),i.addColorStop(1,n.endColor),t.fillStyle=i,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function lt(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function ut(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function ft(t,e,r){let{width:n,height:a,matrixSize:o,margin:c,filter:s,backgroundColor:f,backgroundAlpha:i}=r,u=r.gapColor,d=new Uint8ClampedArray(t),$=n/(o+c*2),p=Math.max(r.coreSize??.4,r.minCoreSize??0),b=(1-p)/2,C=(m,x)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(m-.5)**2+(x-.5)**2<=p**2/4;let g=p*.28,A=Math.max(Math.abs(m-.5)-(p/2-g),0),l=Math.max(Math.abs(x-.5)-(p/2-g),0);return A**2+l**2<=g**2},S=(m,x)=>r.clear!==void 0&&m>=r.clear.x&&x>=r.clear.y&&m<r.clear.x+r.clear.width&&x<r.clear.y+r.clear.height,y=(m,x)=>m<8&&x<8||m>=o-8&&x<8||m<8&&x>=o-8,h=(m,x=t)=>{let g=x[m+3]/255,A=e[m+3]/255,l=g+A*(1-g),R=(L,U)=>l===0?0:(L*g+U*A*(1-g))/l;d[m]=R(x[m],e[m]),d[m+1]=R(x[m+1],e[m+1]),d[m+2]=R(x[m+2],e[m+2]),d[m+3]=l*255};for(let m=0;m<a;m+=1)for(let x=0;x<n;x+=1){let g=x/$-c,A=m/$-c,l=(m*n+x)*4;if(g<0||A<0||g>=o||A>=o){d[l]=e[l],d[l+1]=e[l+1],d[l+2]=e[l+2],d[l+3]=e[l+3];continue}let R=Math.floor(g),L=Math.floor(A);if(S(g,A)){d[l]=f[0],d[l+1]=f[1],d[l+2]=f[2],d[l+3]=i;continue}if(y(R,L)){h(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let U=g-R,E=A-L;if(U>=b&&U<1-b&&E>=b&&E<1-b&&C(U,E)){h(l);continue}if(u){let v=u[3]/255,Q=e[l+3]/255,N=v+Q*(1-v),P=(F,W)=>N===0?0:(F*v+W*Q*(1-v))/N;d[l]=P(u[0],e[l]),d[l+1]=P(u[1],e[l+1]),d[l+2]=P(u[2],e[l+2]),d[l+3]=N*255;continue}let M=l;if(s==="color")d[l]=e[M],d[l+1]=e[M+1],d[l+2]=e[M+2];else{let v=e[M]*.2126+e[M+1]*.7152+e[M+2]*.0722;d[l]=v,d[l+1]=v,d[l+2]=v}d[l+3]=e[M+3]}return d}function dt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Le(t){return new Promise((e,r)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>e(n),n.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),n.src=t})}function wr(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let n=r.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]]}function Cr(t,e,r,n,a,o,c){let s=c==="fill"?Math.max(a/e.naturalWidth,o/e.naturalHeight):Math.min(a/e.naturalWidth,o/e.naturalHeight),f=e.naturalWidth*s,i=e.naturalHeight*s;t.drawImage(e,r+(a-f)/2,n+(o-i)/2,f,i)}function $r(t,e){let r=me({...e,ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),n=new DOMParser().parseFromString(r,"image/svg+xml");t.replaceChildren(document.importNode(n.documentElement,!0))}async function Ar(t,e,r){let{imagePath:n,imageDotSize:a,imageDotStyle:o,imageColor:c,filter:s,fillType:f="scale_to_fit",logo:i,...u}=e;if(!n||!dt(n))throw new Error("The image URL uses an unsupported scheme.");if(i?.src&&!dt(i.src))throw new Error("The center image URL uses an unsupported scheme.");if(f!=="scale_to_fit"&&f!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let d=Le(n),$=i?.src?Le(i.src):Promise.resolve(void 0),[p,b]=await Promise.all([d,$]);if(r())return;let C=i?{...i,src:void 0,custom:!0,aspectRatio:i.aspectRatio??(b?b.naturalWidth/b.naturalHeight:1)}:void 0,S={...u,dotStyle:o??u.dotStyle,backgroundColor:u.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...u.qr},logo:C},y=J(S),h=J({...S,corner:{square:{style:"square"},dot:{style:"square"}}}),m=h.finders[0].square.d,g=Number(m.match(/h([\d.]+)v/)?.[1])/7,A=Number(m.match(/^M([\d.]+),/)?.[1])/g,l=Math.round(h.viewBox/g-A*2),R=l+A*2;if(!Number.isFinite(g)||!Number.isFinite(A)||l<21)throw new Error("Unable to determine QR module dimensions.");let L=me({...S,dotColor:S.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),U=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Le(U);if(r())return;let I=S.size??256,M=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=M,v.height=M;let Q=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=M,N.height=M;let P=N.getContext("2d",{willReadFrequently:!0});if(!Q||!P)throw new Error("Canvas 2D context is unavailable.");Q.drawImage(E,0,0,M,M);let F=e.backgroundColor??"#ffffff",B=wr(F==="transparent"?"#ffffff":F),ae=[B[0],B[1],B[2]];st(P,M,F,S.backgroundGradient);let _=M/R,H=A*_,V=l*_;Cr(P,p,H,H,V,V,f);let ie=ft(Q.getImageData(0,0,M,M).data,P.getImageData(0,0,M,M).data,{width:M,height:M,matrixSize:l,margin:A,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:lt(a),dotStyle:o??u.dotStyle,clear:y.clear?{x:y.clear.x/g-A,y:y.clear.y/g-A,width:y.clear.width/g,height:y.clear.height/g}:void 0,filter:ut(c,s),backgroundColor:ae,backgroundAlpha:F==="transparent"?0:B[3]}),T=document.createElement("canvas");T.width=Math.round(I),T.height=Math.round(I),T.setAttribute("role","img"),T.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),T.style.width=`${I}px`,T.style.height=`${I}px`;let Ie=T.getContext("2d"),ce=document.createElement("canvas");ce.width=M,ce.height=M;let D=ce.getContext("2d");if(!Ie||!D)throw new Error("Canvas 2D context is unavailable.");let ke=D.createImageData(M,M);if(ke.data.set(ie),D.putImageData(ke,0,0),b&&y.logo){let Z=M/y.viewBox,be=y.logo.x*Z,ge=y.logo.y*Z,he=y.logo.width*Z,pe=y.logo.height*Z;y.logo.radius>0?(D.save(),D.beginPath(),D.roundRect(be,ge,he,pe,y.logo.radius*Z),D.clip(),D.drawImage(b,be,ge,he,pe),D.restore()):D.drawImage(b,be,ge,he,pe)}Ie.drawImage(ce,0,0,T.width,T.height),r()||t.replaceChildren(T)}finally{URL.revokeObjectURL(U)}}function Mr(t,e){let r=!1;return e.imagePath?Ar(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):$r(t,e),()=>{r=!0,t.replaceChildren()}}0&&(module.exports={renderQuter});
1
+ "use strict";var ce=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var pt=(t,e,r)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var yt=(t,e)=>{for(var r in e)ce(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gt(e))!ht.call(t,a)&&a!==r&&ce(t,a,{get:()=>e[a],enumerable:!(n=bt(e,a))||n.enumerable});return t};var wt=t=>xt(ce({},"__esModule",{value:!0}),t);var ye=(t,e,r)=>pt(t,typeof e!="symbol"?e+"":e,r);var Sr={};yt(Sr,{renderQuter:()=>Ar});module.exports=wt(Sr);function Ct(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function $t(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var le=Ct(),z=$t(le);function Mt(t,e){return t===0||e===0?0:le[z[t]+z[e]]}function At(t,e){return le[z[t]*e%255]}function St(t){let e=[1];for(let r=0;r<t;r++){let n=[1,At(2,r)],a=new Array(e.length+n.length-1).fill(0);for(let o=0;o<e.length;o++)for(let s=0;s<n.length;s++)a[o+s]^=Mt(e[o],n[s]);e=a}return Uint8Array.from(e)}var Ue=new Map;function Rt(t){let e=Ue.get(t);return e||(e=St(t),Ue.set(t,e)),e}function vt(t,e){let r=Rt(e),n=r.length,a=t.length,o=new Uint8Array(a+e);o.set(t);for(let s=0;s<a;s++){let c=o[s];if(c!==0){let u=z[c];for(let i=0;i<n;i++)o[s+i]^=le[z[r[i]]+u]}}return o.slice(a)}var Et=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],Lt=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Oe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ee(t,e){return Oe[(t-1)*4+e]}function Be(t,e,r){let n=(e-1)*4+r,a=Et[n],o=Lt[n],s=Oe[n],c=Math.floor(s/o),u=o-s%o,i=t instanceof Uint8Array?t:Uint8Array.from(t),f=new Array(o),d=new Array(o),$=new Array(o),x=0,g=0;for(let y=0;y<o;y++){let h=y<u?c:c+1;f[y]=x,d[y]=h,h>g&&(g=h),$[y]=vt(i.subarray(x,x+h),a),x+=h}let C=new Uint8Array(i.length+o*a),S=0;for(let y=0;y<g;y++)for(let h=0;h<o;h++)y<d[h]&&(C[S++]=i[f[h]+y]);for(let y=0;y<a;y++)for(let h=0;h<o;h++)C[S++]=$[h][y];return C}var Qe={numeric:1,alphanumeric:2,byte:4};function It(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var K=It();function kt(t){return t<128?K[t]:-1}function q(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Pe=[[1,9],[10,26],[27,40]],Ut=[0,4,7];function Ot(t,e){return t==="numeric"?10*Math.floor(e/3)+Ut[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function we(t,e){let r=0;for(let n of t)r+=4+q(n.mode,e)+Ot(n.mode,n.charCount);return Math.ceil(r/8)}function xe(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var Y=0,te=1,re=2,Bt=["numeric","alphanumeric","byte"];function Qt(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Te=33,Ne=48;function Pt(t){let e=0,r=0,n=0,a=0;for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);s<128?(r++,s>=48&&s<=57?(n++,a++):K[s]>=0&&a++):s<2048?r+=2:s>=55296&&s<=56319&&(t.charCodeAt(o+1)&64512)===56320?(r+=4,o++):r+=3,e++}return{count:e,totalBytes:r,digits:n,alnums:a}}function Ft(t,e){let r=new Int32Array(e),n=new Uint8Array(e),a=new Uint8Array(e),o=0;for(let s=0;s<t.length;){let c=t.codePointAt(s);r[o]=s,n[o]=Qt(c),c>=48&&c<=57?a[o]=2:kt(c)>=0&&(a[o]=1),o++,s+=c>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:a}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:a}=Pt(t),o=n*Fe+(a-n)*Te+(r-a)*Ne,s=i=>{let f=4+Math.min(q("numeric",i),q("alphanumeric",i),q("byte",i));return Math.ceil((o/6+f)/8)},c;if(n===e?c=xe(t,"numeric",e,r):a===e&&n===0?c=xe(t,"alphanumeric",e,r):a===0&&(c=xe(t,"byte",r,r)),c){let i=[c];return{forVersion:()=>i,minDataBytes:s}}let u;return{forVersion(i){return u??(u=Ft(t,e)),Tt(t,i,e,u)},minDataBytes:s}}function Tt(t,e,r,{cpIndex:n,cpBytes:a,cpClass:o}){let s=(4+q("numeric",e))*6,c=(4+q("alphanumeric",e))*6,u=(4+q("byte",e))*6,i=[s,c,u],f=new Int8Array(r*3).fill(-1),d=new Float64Array(3),$=new Float64Array([s,c,u]);for(let b=0;b<r;b++){let p=b*3,m=o[b];d[Y]=1/0,d[te]=1/0,d[re]=$[re]+a[b]*Ne,f[p+re]=re,m!==0&&(d[te]=$[te]+Te,f[p+te]=te),m===2&&(d[Y]=$[Y]+Fe,f[p+Y]=Y);for(let l=0;l<3;l++)for(let R=0;R<3;R++){if(f[p+R]===-1)continue;let L=Math.ceil(d[R]/6)*6+i[l];(f[p+l]===-1||L<d[l])&&(d[l]=L,f[p+l]=R)}let M=$;$=d,d=M}let x=Y;for(let b=1;b<3;b++)$[b]<$[x]&&(x=b);let g=new Int8Array(r),C=x;for(let b=r-1;b>=0;b--)C=f[b*3+C],g[b]=C;let S=[],y=0,h=0;for(;h<r;){let b=g[h],p=h,m=0;for(;p<r&&g[p]===b;)m+=a[p],p++;S.push({mode:Bt[b],start:n[h],end:p<r?n[p]:t.length,charCount:b===re?m:p-h,byteStart:y,byteEnd:y+m}),y+=m,h=p}return S}var Nt={L:0,M:1,Q:2,H:3},De;function _t(){return De??(De=new TextEncoder)}var Ce=class{constructor(e){ye(this,"bytes");ye(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let a=r-1;a>=0;a--)e>>a&1&&(this.bytes[n>>3]|=128>>(n&7)),n++;this.bitPos=n}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},Dt=[236,17];function qt(t,e,r,n,a){let o=new Ce(n);for(let i of e)if(o.writeBits(Qe[i.mode],4),o.writeBits(i.charCount,q(i.mode,r)),i.mode==="numeric")for(let f=i.start;f<i.end;f+=3){let d=Math.min(3,i.end-f),$=t.charCodeAt(f)-48;d>=2&&($=$*10+(t.charCodeAt(f+1)-48)),d>=3&&($=$*10+(t.charCodeAt(f+2)-48)),o.writeBits($,d===3?10:d===2?7:4)}else if(i.mode==="alphanumeric")for(let f=i.start;f<i.end;f+=2)if(f+1<i.end){let d=K[t.charCodeAt(f)]*45+K[t.charCodeAt(f+1)];o.writeBits(d,11)}else o.writeBits(K[t.charCodeAt(f)],6);else for(let f=i.byteStart;f<i.byteEnd;f++)o.writeBits(a[f],8);let s=n*8;if(o.bitLength>s)throw new RangeError(`encoded data (${o.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);o.skipBits(Math.min(4,s-o.bitLength)),o.alignToByte();let c=o.bytes,u=0;for(let i=o.bitLength>>3;i<n;i++)c[i]=Dt[u%2],u++;return c}function qe(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let n=Nt[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let a=_e(t),o=x=>a.forVersion(x),s,c;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);s=r,c=o(s);let x=ee(s,n),g=we(c,s);if(g>x)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${g} bytes, capacity ${x})`)}else{let x;for(let[g,C]of Pe){if(a.minDataBytes(g)>ee(C,n))continue;let S=o(g),y=we(S,g);for(let h=g;h<=C;h++)if(y<=ee(h,n)){x={version:h,segments:S};break}if(x)break}if(!x)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=x.version,c=x.segments}let i=c.some(x=>x.mode==="byte")?_t().encode(t):null,f=ee(s,n),d=qt(t,c,s,f,i);return{codewords:Be(d,s,n),version:s,ecLevelIndex:n,segments:c}}var Wt=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function Gt(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,a=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,a)}function Ht(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=Wt[e];for(let n=0;n<12;n++)for(let a=0;a<6;a++)t[e*72+n*6+a]=r(n,a)?1:0}return t}var Ve=Ht(),We=1488,Ge=93,He=2047;function Vt(t,e,r,n,a){let{prevRow:o,colRunVal:s,colRunLen:c,colWin:u}=a;s.fill(-1),c.fill(0),u.fill(0);let i=0,f=0;for(let d=0;d<r;d++){let $=n+d%12*6,x=d*r,g=d>=10,C=0,S=-1,y=0,h=0,b=-1,p=-1;for(let m=0;m<r;m++){let M=x+m,l=t[M]^Ve[$+C]&(e[M]^1);f+=l,l===S?y++:(y>=5&&(i+=y-2),S=l,y=1),h=(h<<1|l)&He,m>=10&&(h===We||h===Ge)&&(i+=40),l===s[m]?c[m]++:(c[m]>=5&&(i+=c[m]-2),s[m]=l,c[m]=1);let R=(u[m]<<1|l)&He;u[m]=R,g&&(R===We||R===Ge)&&(i+=40);let L=o[m];d>0&&m>0&&l===b&&l===L&&l===p&&(i+=3),o[m]=l,p=L,b=l,C++,C===6&&(C=0)}y>=5&&(i+=y-2)}for(let d=0;d<r;d++)c[d]>=5&&(i+=c[d]-2);return i+=Gt(f,r*r),i}function Xt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},a=0,o=1/0;for(let s=0;s<8;s++){let c=Vt(t,e,r,s*72,n);c<o&&(o=c,a=s)}return a}function Xe(t,e,r){let n=Xt(t,e,r),a=n*72;for(let o=0;o<r;o++){let s=a+o%12*6,c=o*r,u=0;for(let i=0;i<r;i++)e[c+i]||(t[c+i]^=Ve[s+u]),u++,u===6&&(u=0)}return n}function jt(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,n=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,a=[6];for(let o=1;o<e;o++)a.push(r-(e-1-o)*n);return a}var Yt=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Kt=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function $e(t,e,r,n,a){for(let o=-1;o<=7;o++)for(let s=-1;s<=7;s++){let c=n+o,u=a+s;if(c<0||u<0||c>=r||u>=r)continue;let i=c*r+u;e[i]=1,o===-1||o===7||s===-1||s===7?t[i]=0:o===0||o===6||s===0||s===6||o>=2&&o<=4&&s>=2&&s<=4?t[i]=1:t[i]=0}}function Jt(t,e,r,n,a){for(let o=-2;o<=2;o++)for(let s=-2;s<=2;s++){let c=(n+o)*r+(a+s);e[c]=1,o===-2||o===2||s===-2||s===2||o===0&&s===0?t[c]=1:t[c]=0}}function Zt(t,e,r){for(let n=8;n<r-8;n++){let a=n%2===0?1:0,o=6*r+n,s=n*r+6;t[o]=a,t[s]=a,e[o]=1,e[s]=1}}var je=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function zt(t,e){for(let[r,n]of je)t[r*e+n]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function er(t,e,r,n){if(n<7)return;let a=Kt[n-7];for(let o=0;o<18;o++){let s=a>>o&1,c=Math.floor(o/3),u=o%3,i=c*r+(r-11+u),f=(r-11+u)*r+c;t[i]=s,e[i]=1,t[f]=s,e[f]=1}}function tr(t,e,r,n){let a=0,o=n.length*8,s=r-1,c=!0;for(;s>=0;){if(s===6){s--;continue}let u=c?r-1:0,i=c?-1:r,f=c?-1:1;for(let d=u;d!==i;d+=f){let $=d*r;for(let x=0;x<=1;x++){let g=s-x;g<0||e[$+g]||(a<o?(t[$+g]=n[a>>3]>>7-(a&7)&1,a++):t[$+g]=0)}}s-=2,c=!c}}var rr=16,X=new Map;function Ye(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,a=X.get(n);if(a)return X.delete(n),X.set(n,a),a;let o=nr(t,e,r);return X.set(n,o),X.size>rr&&X.delete(X.keys().next().value),o}function nr(t,e,r){let n=qe(t,e,r),{codewords:a,version:o,ecLevelIndex:s}=n,c=o*4+17,u=new Uint8Array(c*c),i=new Uint8Array(c*c);$e(u,i,c,0,0),$e(u,i,c,0,c-7),$e(u,i,c,c-7,0),Zt(u,i,c);let f=(4*o+9)*c+8;u[f]=1,i[f]=1;let d=jt(o);for(let g of d)for(let C of d)g<=8&&C<=8||g<=8&&C>=c-8||g>=c-8&&C<=8||Jt(u,i,c,g,C);er(u,i,c,o),zt(i,c),tr(u,i,c,a);let $=Xe(u,i,c),x=Yt[s*8+$];return or(u,x,c),{matrix:u,version:o,size:c}}function or(t,e,r){for(let n=0;n<15;n++){let[a,o]=je[n];t[a*r+o]=e>>14-n&1}for(let n=0;n<8;n++)t[8*r+r-1-n]=e>>n&1;for(let n=0;n<7;n++)t[(r-7+n)*r+8]=e>>n+8&1;t[(r-8)*r+8]=1}var w=t=>Math.round(t*100)/100,O=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),a=r-n*100,o;return a===0?o=String(n):a%10===0?o=`${n}.${a/10}`:a<10?o=`${n}.0${a}`:o=`${n}.${a}`,e?`-${o}`:o}function Me(t,e){return t<=7||t>=e-8?7:-1}function Ae(t,e){return t<=7?e-8:e}function ar(t,e,r,n){let a=k(O(r)),o=new Array(e),s=new Array(e+1),c=new Array(e+1);for(let i=0;i<=e;i++){let f=O(i*r);s[i]=k(f),c[i]=k(-f),i<e&&(o[i]=k(O(n+i*r)))}let u=[];for(let i=0;i<e;i++){let f=i*e,d=k(O(n+i*r)),$=Me(i,e)+1,x=Ae(i,e),g=-1;for(let C=$;C<x;C++)if(t[f+C]===1)g===-1&&(g=C);else if(g!==-1){let S=C-g;u.push(`M${o[g]},${d}h${s[S]}v${a}h${c[S]}z`),g=-1}if(g!==-1){let C=x-g;u.push(`M${o[g]},${d}h${s[C]}v${a}h${c[C]}z`)}}return u.join(" ")}function ir(t,e,r,n,a){let o=w(r),s=[];if(a==="circle"){let h=o/2,b=w(h),p=`a${k(O(b))},${k(O(b))} 0 1,0 `,m=`${p}${k(O(b*2))},0${p}${k(O(-b*2))},0z`,M=new Array(e);for(let l=0;l<e;l++){let R=w(w(n+l*r)+h);M[l]=`M${k(O(R-b))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(O(w(n+l*r)+h))}${m}`,U=Me(l,e)+1,E=Ae(l,e);for(let I=U;I<E;I++)t[R+I]===1&&s.push(M[I]+L)}return s.join(" ")}let c=w(o*.45),u=[k(O(o)),k(O(o-c)),k(O(o-2*c))],i=[k(O(-o)),k(O(-(o-c))),k(O(-(o-2*c)))],f=k(O(c)),d=k(O(-c)),$=`q${f},0 ${f},${f}`,x=`q0,${f} ${d},${f}`,g=`q${d},0 ${d},${d}`,C=`q0,${d} ${f},${d}`,S=new Array(e),y=new Array(e);for(let h=0;h<e;h++){let b=w(n+h*r);S[h]=k(O(b)),y[h]=k(O(b+c))}for(let h=0;h<e;h++){let b=h*e,p=k(O(w(n+h*r))),m=Me(h,e)+1,M=Ae(h,e);for(let l=m;l<M;l++){if(t[b+l]!==1)continue;let R=h>0&&t[b-e+l]===1,L=l<e-1&&t[b+l+1]===1,U=h<e-1&&t[b+e+l]===1,E=l>0&&t[b+l-1]===1,I=!(R||E),A=!(R||L),v=!(U||L),Q=!(U||E);s.push(`M${I?y[l]:S[l]},${p}h${u[(I?1:0)+(A?1:0)]}`+(A?$:"")+`v${u[(A?1:0)+(v?1:0)]}`+(v?x:"")+`h${i[(v?1:0)+(Q?1:0)]}`+(Q?g:"")+`v${i[(Q?1:0)+(I?1:0)]}`+(I?C:"")+"z")}}return s.join(" ")}var sr=2,Ke=new WeakMap;function Je(t,e,r,n,a){let o=Ke.get(t);o||(o=new Map,Ke.set(t,o));let s=`${r}|${n}|${a}`,c=o.get(s);if(c!==void 0)return c;let u=a==="square"?ar(t,e,r,n):ir(t,e,r,n,a);return o.size>=sr&&o.clear(),o.set(s,u),u}var cr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ze(t){return t.replace(cr,"")}function ze(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let n=r+e*2,a=w(t/n);if(t>0&&a===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:a,marginPx:w(e*a),svgSize:w(a*n)}}function ue(t,e,r){let n=w(r);return`M${w(t)},${w(e)}h${n}v${n}h${-n}z`}function fe(t,e,r,n,a){let o=w(Math.min(a,r/2,n/2)),s=w(r-2*o),c=w(n-2*o);return`M${w(t+o)},${w(e)}h${s}q${o},0 ${o},${o}v${c}q0,${o} ${-o},${o}h${-s}q${-o},0 ${-o},${-o}v${-c}q0,${-o} ${o},${-o}z`}function lr(t,e,r,n){if(n==="circle"){let a=w(r/2),o=w(a*2);return`M${w(t)},${w(e+r/2)}a${a},${a} 0 1,0 ${o},0a${a},${a} 0 1,0 ${-o},0z`}return n==="rounded"?fe(t,e,r,r,r*.3):ue(t,e,r)}function ur(t,e,r,n){let a=r/7,o=r-2*a,s=a;if(n==="square"){let i=ue(t,e,r),f=ue(t+s,e+s,o);return`${i} ${f}`}if(n==="rounded"){let i=fe(t,e,r,r,r*.15),f=ue(t+s,e+s,o);return`${i} ${f}`}if(n==="circle"){let i=t+r/2,f=w(e+r/2),d=$=>{let x=w($),g=w(x*2);return`M${w(i-x)},${f}a${x},${x} 0 1,0 ${g},0a${x},${x} 0 1,0 ${-g},0z`};return`${d(r/2)} ${d(o/2)}`}let c=fe(t,e,r,r,r*.35),u=fe(t+s,e+s,o,o,o*.2);return`${c} ${u}`}function et(t,e,r,n,a){let o=w(7*r),s=w(3*r),c=w(2*r);return{square:ur(t,e,o,n),dot:lr(w(t+c),w(e+c),s,a)}}function Se(t,e,r){return r+t*e}function tt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([a,o])=>({x:Se(o,e,r),y:Se(a,e,r)}))}var j={L:.0225,M:.04,Q:.0625,H:.09},fr=j.H,dr=.4;function Re(t){return t<=j.L?"L":t<=j.M?"M":t<=j.Q?"Q":"H"}var mr=/[\u0000-\u0020]/g;function de(t){let e=t.replace(mr,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function nt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function ot(t,e,r){let a=(t?e!==void 0?Math.max(0,Math.min(1,e)):dr:0)*fr;return r?{ecLevel:r,absoluteArea:Math.min(a,j[r]),targetArea:a,clamped:a>j[r]}:a>0?{ecLevel:Re(a),absoluteArea:a,targetArea:a,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:a,clamped:!1}}function rt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var br={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function at({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:n,moduleSize:a,marginPx:o}){let s=n*a,c=t*s*s,u=Math.sqrt(c*e),i=Math.sqrt(c/e);if(!(u>0)||!(i>0))return br;let f=u/a,d=i/a,$=j[r]*n*n,x=Math.max(1,n-16),g=Math.min(rt(f),x),C=1;for(;;){let l=Math.min(1,g/f);if(C=Math.min(rt(d*l),x),g*C<=$||g<=1)break;g-=2}let S=Math.min(1,g/f,C/d),y=u*S,h=i*S,b=g*a,p=C*a,m=o+(n-g)/2*a,M=o+(n-C)/2*a;return{clearX:m,clearY:M,clearWidth:b,clearHeight:p,boxX:m+(b-y)/2,boxY:M+(p-h)/2,boxWidth:y,boxHeight:h}}function ve(t,e){let r=t?.square?.style??"square",n=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??n,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function it(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",backgroundColor:s="#ffffff",corner:c,logo:u,qr:i}=t,f=u?.src&&de(u.src)?u.src:void 0,d=!!(f||u?.custom),$=i?.errorCorrectionLevel,{ecLevel:x,absoluteArea:g,targetArea:C,clamped:S}=ot(d,u?.size,$),y=[];S&&y.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${Re(C)}"; ECL "${$}" set, logo clamped.`);let{matrix:h,size:b}=Ye(e,x,i?.version),{moduleSize:p,marginPx:m,svgSize:M}=ze(r,n,b),l=ve(c,o),R=Je(h,b,p,m,a),L=tt(b,p,m).map(F=>{let{square:P,dot:G}=et(w(F.x),w(F.y),p,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:w(F.x),y:w(F.y),width:w(7*p),height:w(7*p),fill:l.backgroundColor}},square:{d:P,fill:l.squareColor,fillRule:"evenodd"},dot:{d:G,fill:l.dotColor}}}),U=(u?.margin??0)*p,E=at({absoluteArea:g,aspectRatio:nt(u?.aspectRatio),ecLevel:x,qrSize:b,moduleSize:p,marginPx:m}),I=w(E.boxX+U),A=w(E.boxY+U),v=w(Math.max(0,E.boxWidth-U*2)),Q=w(Math.max(0,E.boxHeight-U*2)),N=d&&v>0&&Q>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||Q<=0)&&y.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:w(r),viewBox:M,ecLevel:x,background:s==="transparent"?void 0:s,modules:R?{d:R,fill:o}:void 0,finders:L,clear:N&&(u?.hideDots??!0)?{x:w(E.clearX),y:w(E.clearY),width:w(E.clearWidth),height:w(E.clearHeight),radius:w(it(u?.radius)*Math.min(E.clearWidth,E.clearHeight)/2)}:void 0,logo:N?{src:f,x:I,y:A,width:v,height:Q,radius:w(it(u?.radius)*Math.min(v,Q)/2)}:void 0,warnings:y}}function ne(t,e){return`${t}${e}`}function gr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Ee(t){let e=gr(t)*Math.PI/180,r=Math.cos(e)/2,n=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-n)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+n)*100)}%`}}function oe(t,e){let{x1:r,y1:n,x2:a,y2:o}=Ee(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${a}" y2="${o}"><stop offset="0%" stop-color="${st(e.startColor)}"/><stop offset="100%" stop-color="${st(e.endColor)}"/></linearGradient>`}function st(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);e=Math.imul(e^a,16777619),r=Math.imul(r^a,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function W(t){return Ze(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ct=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),pr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of pr)ct.add(t);function yr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function xr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let a=typeof r=="number"&&r!==0&&!ct.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${yr(e)}:${a}`}).join(";")}function me(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",dotGradient:s,backgroundColor:c="#ffffff",backgroundGradient:u,corner:i,logo:f,qr:d,className:$,style:x,ariaLabel:g,idPrefix:C}=t,S=J(t),y=ve(i,o),h=f?.src&&de(f.src)?f.src:void 0,b=(C??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",p=[e,r,n,a,o,JSON.stringify(s??null),c,JSON.stringify(u??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,i?.backgroundColor??"",JSON.stringify(i?.square?.gradient??null),JSON.stringify(i?.dot?.gradient??null),S.ecLevel,d?.version??"",h??"",f?.size??"",f?.aspectRatio??"",f?.margin??"",f?.hideDots??"",$??"",g??"",C??""];f?.radius!==void 0&&p.push(f.radius),f?.custom&&p.push("custom");let m=`${b}${hr(p.join("\0"))}`,M=`${m}t`,l=`${m}m`,R=`${m}c`,L=ne(m,"d"),U=ne(m,"b"),E=ne(m,"s"),I=ne(m,"p"),{size:A,viewBox:v,background:Q,modules:N,finders:F}=S,{clear:P,logo:G}=S,B=`<svg role="img" aria-labelledby="${M}" width="${A}" height="${A}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(B+=` class="${W($)}"`),x&&(B+=` style="${W(xr(x))}"`),B+=">",B+=`<title id="${M}">${W(g??`QR code: ${e}`)}</title>`;let ae=[s&&oe(L,s),u&&oe(U,u),i?.square?.gradient&&oe(E,i.square.gradient),i?.dot?.gradient&&oe(I,i.dot.gradient)].filter(Boolean);ae.length&&(B+=`<defs>${ae.join("")}</defs>`),Q!==void 0&&(B+=`<rect width="${v}" height="${v}" fill="${u?`url(#${U})`:W(Q)}"/>`),P&&(B+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${P.x}" y="${P.y}" width="${P.width}" height="${P.height}" rx="${P.radius}" ry="${P.radius}" fill="black"/></mask></defs>`),B+=`<g${P?` mask="url(#${l})"`:""}>`,N&&(B+=`<path d="${N.d}" fill="${s?`url(#${L})`:W(N.fill)}"/>`);for(let{background:_,square:H,dot:V}of F)B+="<g>"+(_?`<rect x="${_.x}" y="${_.y}" width="${_.width}" height="${_.height}" fill="${W(_.fill)}"/>`:"")+`<path d="${H.d}" fill="${i?.square?.gradient?`url(#${E})`:W(H.fill)}" fill-rule="evenodd"/><path d="${V.d}" fill="${i?.dot?.gradient?`url(#${I})`:W(V.fill)}"/></g>`;if(B+="</g>",G?.src){let{x:_,y:H,width:V,height:ie,radius:T}=G;T>0&&(B+=`<defs><clipPath id="${R}"><rect x="${_}" y="${H}" width="${V}" height="${ie}" rx="${T}" ry="${T}"/></clipPath></defs>`),B+=`<image href="${W(G.src)}" x="${_}" y="${H}" width="${V}" height="${ie}"${T>0?` clip-path="url(#${R})"`:""}/>`}return B+="</svg>",B}function lt(t,e,r,n){if(n){let a=Ee(n),o=Number.parseFloat(a.x1)/100*e,s=Number.parseFloat(a.y1)/100*e,c=Number.parseFloat(a.x2)/100*e,u=Number.parseFloat(a.y2)/100*e,i=t.createLinearGradient(o,s,c,u);i.addColorStop(0,n.startColor),i.addColorStop(1,n.endColor),t.fillStyle=i,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function ut(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function ft(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function dt(t,e,r){let{width:n,height:a,matrixSize:o,margin:s,filter:c,backgroundColor:u,backgroundAlpha:i}=r,f=r.gapColor,d=new Uint8ClampedArray(t),$=n/(o+s*2),x=Math.max(r.coreSize??.4,r.minCoreSize??0),g=(1-x)/2,C=(b,p)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(b-.5)**2+(p-.5)**2<=x**2/4;let m=x*.28,M=Math.max(Math.abs(b-.5)-(x/2-m),0),l=Math.max(Math.abs(p-.5)-(x/2-m),0);return M**2+l**2<=m**2},S=(b,p)=>{let m=r.clear;if(!m||b<m.x||p<m.y||b>=m.x+m.width||p>=m.y+m.height)return!1;let M=Math.min(m.radius??0,m.width/2,m.height/2),l=Math.max(m.x+M,Math.min(b,m.x+m.width-M)),R=Math.max(m.y+M,Math.min(p,m.y+m.height-M));return(b-l)**2+(p-R)**2<=M**2},y=(b,p)=>b<8&&p<8||b>=o-8&&p<8||b<8&&p>=o-8,h=(b,p=t)=>{let m=p[b+3]/255,M=e[b+3]/255,l=m+M*(1-m),R=(L,U)=>l===0?0:(L*m+U*M*(1-m))/l;d[b]=R(p[b],e[b]),d[b+1]=R(p[b+1],e[b+1]),d[b+2]=R(p[b+2],e[b+2]),d[b+3]=l*255};for(let b=0;b<a;b+=1)for(let p=0;p<n;p+=1){let m=p/$-s,M=b/$-s,l=(b*n+p)*4;if(m<0||M<0||m>=o||M>=o){d[l]=e[l],d[l+1]=e[l+1],d[l+2]=e[l+2],d[l+3]=e[l+3];continue}let R=Math.floor(m),L=Math.floor(M);if(S(m,M)){d[l]=u[0],d[l+1]=u[1],d[l+2]=u[2],d[l+3]=i;continue}if(y(R,L)){h(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let U=m-R,E=M-L;if(U>=g&&U<1-g&&E>=g&&E<1-g&&C(U,E)){h(l);continue}if(f){let v=f[3]/255,Q=e[l+3]/255,N=v+Q*(1-v),F=(P,G)=>N===0?0:(P*v+G*Q*(1-v))/N;d[l]=F(f[0],e[l]),d[l+1]=F(f[1],e[l+1]),d[l+2]=F(f[2],e[l+2]),d[l+3]=N*255;continue}let A=l;if(c==="color")d[l]=e[A],d[l+1]=e[A+1],d[l+2]=e[A+2];else{let v=e[A]*.2126+e[A+1]*.7152+e[A+2]*.0722;d[l]=v,d[l+1]=v,d[l+2]=v}d[l+3]=e[A+3]}return d}function mt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Le(t){return new Promise((e,r)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>e(n),n.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),n.src=t})}function wr(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let n=r.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]]}function Cr(t,e,r,n,a,o,s){let c=s==="fill"?Math.max(a/e.naturalWidth,o/e.naturalHeight):Math.min(a/e.naturalWidth,o/e.naturalHeight),u=e.naturalWidth*c,i=e.naturalHeight*c;t.drawImage(e,r+(a-u)/2,n+(o-i)/2,u,i)}function $r(t,e){let r=me({...e,ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),n=new DOMParser().parseFromString(r,"image/svg+xml");t.replaceChildren(document.importNode(n.documentElement,!0))}async function Mr(t,e,r){let{imagePath:n,imageDotSize:a,imageDotStyle:o,imageColor:s,filter:c,fillType:u="scale_to_fit",logo:i,...f}=e;if(!n||!mt(n))throw new Error("The image URL uses an unsupported scheme.");if(i?.src&&!mt(i.src))throw new Error("The center image URL uses an unsupported scheme.");if(u!=="scale_to_fit"&&u!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let d=Le(n),$=i?.src?Le(i.src):Promise.resolve(void 0),[x,g]=await Promise.all([d,$]);if(r())return;let C=i?{...i,src:void 0,custom:!0,aspectRatio:i.aspectRatio??(g?g.naturalWidth/g.naturalHeight:1)}:void 0,S={...f,dotStyle:o??f.dotStyle,backgroundColor:f.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...f.qr},logo:C},y=J(S),h=J({...S,corner:{square:{style:"square"},dot:{style:"square"}}}),b=h.finders[0].square.d,m=Number(b.match(/h([\d.]+)v/)?.[1])/7,M=Number(b.match(/^M([\d.]+),/)?.[1])/m,l=Math.round(h.viewBox/m-M*2),R=l+M*2;if(!Number.isFinite(m)||!Number.isFinite(M)||l<21)throw new Error("Unable to determine QR module dimensions.");let L=me({...S,dotColor:S.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),U=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Le(U);if(r())return;let I=S.size??256,A=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=A,v.height=A;let Q=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=A,N.height=A;let F=N.getContext("2d",{willReadFrequently:!0});if(!Q||!F)throw new Error("Canvas 2D context is unavailable.");Q.drawImage(E,0,0,A,A);let P=e.backgroundColor??"#ffffff",B=wr(P==="transparent"?"#ffffff":P),ae=[B[0],B[1],B[2]];lt(F,A,P,S.backgroundGradient);let _=A/R,H=M*_,V=l*_;Cr(F,x,H,H,V,V,u);let ie=dt(Q.getImageData(0,0,A,A).data,F.getImageData(0,0,A,A).data,{width:A,height:A,matrixSize:l,margin:M,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:ut(a),dotStyle:o??f.dotStyle,clear:y.clear?{x:y.clear.x/m-M,y:y.clear.y/m-M,width:y.clear.width/m,height:y.clear.height/m,radius:y.clear.radius/m}:void 0,filter:ft(s,c),backgroundColor:ae,backgroundAlpha:P==="transparent"?0:B[3]}),T=document.createElement("canvas");T.width=Math.round(I),T.height=Math.round(I),T.setAttribute("role","img"),T.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),T.style.width=`${I}px`,T.style.height=`${I}px`;let Ie=T.getContext("2d"),se=document.createElement("canvas");se.width=A,se.height=A;let D=se.getContext("2d");if(!Ie||!D)throw new Error("Canvas 2D context is unavailable.");let ke=D.createImageData(A,A);if(ke.data.set(ie),D.putImageData(ke,0,0),g&&y.logo){let Z=A/y.viewBox,be=y.logo.x*Z,ge=y.logo.y*Z,he=y.logo.width*Z,pe=y.logo.height*Z;y.logo.radius>0?(D.save(),D.beginPath(),D.roundRect(be,ge,he,pe,y.logo.radius*Z),D.clip(),D.drawImage(g,be,ge,he,pe),D.restore()):D.drawImage(g,be,ge,he,pe)}Ie.drawImage(se,0,0,T.width,T.height),r()||t.replaceChildren(T)}finally{URL.revokeObjectURL(U)}}function Ar(t,e){let r=!1;return e.imagePath?Mr(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):$r(t,e),()=>{r=!0,t.replaceChildren()}}0&&(module.exports={renderQuter});