@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/angular.cjs +1 -1
- package/dist/angular.mjs +1 -1
- package/dist/{chunk-PJYR3PPM.mjs → chunk-BI4MXPFZ.mjs} +1 -1
- package/dist/chunk-OBIGPYJW.mjs +1 -0
- package/dist/{chunk-2RNYFQOI.mjs → chunk-YNTX4ZO3.mjs} +1 -1
- package/dist/cli.js +2 -2
- package/dist/core/types.d.ts +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/quter-pixels.d.ts +1 -0
- package/dist/react-native.cjs +1 -1
- package/dist/react-native.mjs +1 -1
- package/dist/vanilla.cjs +1 -1
- package/dist/vanilla.global.js +1 -1
- package/dist/vanilla.mjs +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-RW5M2XKX.mjs +0 -1
package/dist/vanilla.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Quter=(()=>{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});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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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()}}return xt(Sr);})();
|
|
1
|
+
"use strict";var Quter=(()=>{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});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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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()}}return wt(Sr);})();
|
package/dist/vanilla.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-YNTX4ZO3.mjs";import"./chunk-OBIGPYJW.mjs";import"./chunk-BI4MXPFZ.mjs";export{a as renderQuter};
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var le=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var xt=(t,e,r)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ct=(t,e)=>{for(var r in e)le(t,r,{get:e[r],enumerable:!0})},wt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ht(e))!yt.call(t,i)&&i!==r&&le(t,i,{get:()=>e[i],enumerable:!(n=pt(e,i))||n.enumerable});return t};var $t=t=>wt(le({},"__esModule",{value:!0}),t);var xe=(t,e,r)=>xt(t,typeof e!="symbol"?e+"":e,r);var Er={};Ct(Er,{Quter:()=>gt,default:()=>vr});module.exports=$t(Er);var q=require("vue");function St(){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 Mt(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var ue=St(),ee=Mt(ue);function At(t,e){return t===0||e===0?0:ue[ee[t]+ee[e]]}function Rt(t,e){return ue[ee[t]*e%255]}function vt(t){let e=[1];for(let r=0;r<t;r++){let n=[1,Rt(2,r)],i=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++)i[o+s]^=At(e[o],n[s]);e=i}return Uint8Array.from(e)}var Qe=new Map;function Et(t){let e=Qe.get(t);return e||(e=vt(t),Qe.set(t,e)),e}function Lt(t,e){let r=Et(e),n=r.length,i=t.length,o=new Uint8Array(i+e);o.set(t);for(let s=0;s<i;s++){let c=o[s];if(c!==0){let f=ee[c];for(let a=0;a<n;a++)o[s+a]^=ue[ee[r[a]]+f]}}return o.slice(i)}var It=[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],kt=[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],Ue=[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 te(t,e){return Ue[(t-1)*4+e]}function Pe(t,e,r){let n=(e-1)*4+r,i=It[n],o=kt[n],s=Ue[n],c=Math.floor(s/o),f=o-s%o,a=t instanceof Uint8Array?t:Uint8Array.from(t),u=new Array(o),d=new Array(o),$=new Array(o),h=0,b=0;for(let y=0;y<o;y++){let p=y<f?c:c+1;u[y]=h,d[y]=p,p>b&&(b=p),$[y]=Lt(a.subarray(h,h+p),i),h+=p}let w=new Uint8Array(a.length+o*i),A=0;for(let y=0;y<b;y++)for(let p=0;p<o;p++)y<d[p]&&(w[A++]=a[u[p]+y]);for(let y=0;y<i;y++)for(let p=0;p<o;p++)w[A++]=$[p][y];return w}var Te={numeric:1,alphanumeric:2,byte:4};function Ot(){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 J=Ot();function Qt(t){return t<128?J[t]:-1}function G(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 Be=[[1,9],[10,26],[27,40]],Ut=[0,4,7];function Pt(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+G(n.mode,e)+Pt(n.mode,n.charCount);return Math.ceil(r/8)}function Ce(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var K=0,re=1,ne=2,Tt=["numeric","alphanumeric","byte"];function Bt(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Ne=33,De=48;function Ft(t){let e=0,r=0,n=0,i=0;for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);s<128?(r++,s>=48&&s<=57?(n++,i++):J[s]>=0&&i++):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:i}}function Nt(t,e){let r=new Int32Array(e),n=new Uint8Array(e),i=new Uint8Array(e),o=0;for(let s=0;s<t.length;){let c=t.codePointAt(s);r[o]=s,n[o]=Bt(c),c>=48&&c<=57?i[o]=2:Qt(c)>=0&&(i[o]=1),o++,s+=c>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:i}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:i}=Ft(t),o=n*Fe+(i-n)*Ne+(r-i)*De,s=a=>{let u=4+Math.min(G("numeric",a),G("alphanumeric",a),G("byte",a));return Math.ceil((o/6+u)/8)},c;if(n===e?c=Ce(t,"numeric",e,r):i===e&&n===0?c=Ce(t,"alphanumeric",e,r):i===0&&(c=Ce(t,"byte",r,r)),c){let a=[c];return{forVersion:()=>a,minDataBytes:s}}let f;return{forVersion(a){return f??(f=Nt(t,e)),Dt(t,a,e,f)},minDataBytes:s}}function Dt(t,e,r,{cpIndex:n,cpBytes:i,cpClass:o}){let s=(4+G("numeric",e))*6,c=(4+G("alphanumeric",e))*6,f=(4+G("byte",e))*6,a=[s,c,f],u=new Int8Array(r*3).fill(-1),d=new Float64Array(3),$=new Float64Array([s,c,f]);for(let m=0;m<r;m++){let x=m*3,g=o[m];d[K]=1/0,d[re]=1/0,d[ne]=$[ne]+i[m]*De,u[x+ne]=ne,g!==0&&(d[re]=$[re]+Ne,u[x+re]=re),g===2&&(d[K]=$[K]+Fe,u[x+K]=K);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+a[l];(u[x+l]===-1||L<d[l])&&(d[l]=L,u[x+l]=R)}let S=$;$=d,d=S}let h=K;for(let m=1;m<3;m++)$[m]<$[h]&&(h=m);let b=new Int8Array(r),w=h;for(let m=r-1;m>=0;m--)w=u[m*3+w],b[m]=w;let A=[],y=0,p=0;for(;p<r;){let m=b[p],x=p,g=0;for(;x<r&&b[x]===m;)g+=i[x],x++;A.push({mode:Tt[m],start:n[p],end:x<r?n[x]:t.length,charCount:m===ne?g:x-p,byteStart:y,byteEnd:y+g}),y+=g,p=x}return A}var _t={L:0,M:1,Q:2,H:3},qe;function qt(){return qe??(qe=new TextEncoder)}var $e=class{constructor(e){xe(this,"bytes");xe(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&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}},Gt=[236,17];function Wt(t,e,r,n,i){let o=new $e(n);for(let a of e)if(o.writeBits(Te[a.mode],4),o.writeBits(a.charCount,G(a.mode,r)),a.mode==="numeric")for(let u=a.start;u<a.end;u+=3){let d=Math.min(3,a.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(a.mode==="alphanumeric")for(let u=a.start;u<a.end;u+=2)if(u+1<a.end){let d=J[t.charCodeAt(u)]*45+J[t.charCodeAt(u+1)];o.writeBits(d,11)}else o.writeBits(J[t.charCodeAt(u)],6);else for(let u=a.byteStart;u<a.byteEnd;u++)o.writeBits(i[u],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,f=0;for(let a=o.bitLength>>3;a<n;a++)c[a]=Gt[f%2],f++;return c}function Ge(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=_t[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=_e(t),o=h=>i.forVersion(h),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 h=te(s,n),b=we(c,s);if(b>h)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${b} bytes, capacity ${h})`)}else{let h;for(let[b,w]of Be){if(i.minDataBytes(b)>te(w,n))continue;let A=o(b),y=we(A,b);for(let p=b;p<=w;p++)if(y<=te(p,n)){h={version:p,segments:A};break}if(h)break}if(!h)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=h.version,c=h.segments}let a=c.some(h=>h.mode==="byte")?qt().encode(t):null,u=te(s,n),d=Wt(t,c,s,u,a);return{codewords:Pe(d,s,n),version:s,ecLevelIndex:n,segments:c}}var Ht=[(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 Vt(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,i)}function jt(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=Ht[e];for(let n=0;n<12;n++)for(let i=0;i<6;i++)t[e*72+n*6+i]=r(n,i)?1:0}return t}var je=jt(),We=1488,He=93,Ve=2047;function Xt(t,e,r,n,i){let{prevRow:o,colRunVal:s,colRunLen:c,colWin:f}=i;s.fill(-1),c.fill(0),f.fill(0);let a=0,u=0;for(let d=0;d<r;d++){let $=n+d%12*6,h=d*r,b=d>=10,w=0,A=-1,y=0,p=0,m=-1,x=-1;for(let g=0;g<r;g++){let S=h+g,l=t[S]^je[$+w]&(e[S]^1);u+=l,l===A?y++:(y>=5&&(a+=y-2),A=l,y=1),p=(p<<1|l)&Ve,g>=10&&(p===We||p===He)&&(a+=40),l===s[g]?c[g]++:(c[g]>=5&&(a+=c[g]-2),s[g]=l,c[g]=1);let R=(f[g]<<1|l)&Ve;f[g]=R,b&&(R===We||R===He)&&(a+=40);let L=o[g];d>0&&g>0&&l===m&&l===L&&l===x&&(a+=3),o[g]=l,x=L,m=l,w++,w===6&&(w=0)}y>=5&&(a+=y-2)}for(let d=0;d<r;d++)c[d]>=5&&(a+=c[d]-2);return a+=Vt(u,r*r),a}function Yt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,o=1/0;for(let s=0;s<8;s++){let c=Xt(t,e,r,s*72,n);c<o&&(o=c,i=s)}return i}function Xe(t,e,r){let n=Yt(t,e,r),i=n*72;for(let o=0;o<r;o++){let s=i+o%12*6,c=o*r,f=0;for(let a=0;a<r;a++)e[c+a]||(t[c+a]^=je[s+f]),f++,f===6&&(f=0)}return n}function Kt(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,i=[6];for(let o=1;o<e;o++)i.push(r-(e-1-o)*n);return i}var Jt=[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],Zt=[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 Se(t,e,r,n,i){for(let o=-1;o<=7;o++)for(let s=-1;s<=7;s++){let c=n+o,f=i+s;if(c<0||f<0||c>=r||f>=r)continue;let a=c*r+f;e[a]=1,o===-1||o===7||s===-1||s===7?t[a]=0:o===0||o===6||s===0||s===6||o>=2&&o<=4&&s>=2&&s<=4?t[a]=1:t[a]=0}}function zt(t,e,r,n,i){for(let o=-2;o<=2;o++)for(let s=-2;s<=2;s++){let c=(n+o)*r+(i+s);e[c]=1,o===-2||o===2||s===-2||s===2||o===0&&s===0?t[c]=1:t[c]=0}}function er(t,e,r){for(let n=8;n<r-8;n++){let i=n%2===0?1:0,o=6*r+n,s=n*r+6;t[o]=i,t[s]=i,e[o]=1,e[s]=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 tr(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 rr(t,e,r,n){if(n<7)return;let i=Zt[n-7];for(let o=0;o<18;o++){let s=i>>o&1,c=Math.floor(o/3),f=o%3,a=c*r+(r-11+f),u=(r-11+f)*r+c;t[a]=s,e[a]=1,t[u]=s,e[u]=1}}function nr(t,e,r,n){let i=0,o=n.length*8,s=r-1,c=!0;for(;s>=0;){if(s===6){s--;continue}let f=c?r-1:0,a=c?-1:r,u=c?-1:1;for(let d=f;d!==a;d+=u){let $=d*r;for(let h=0;h<=1;h++){let b=s-h;b<0||e[$+b]||(i<o?(t[$+b]=n[i>>3]>>7-(i&7)&1,i++):t[$+b]=0)}}s-=2,c=!c}}var or=16,X=new Map;function Ke(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,i=X.get(n);if(i)return X.delete(n),X.set(n,i),i;let o=ir(t,e,r);return X.set(n,o),X.size>or&&X.delete(X.keys().next().value),o}function ir(t,e,r){let n=Ge(t,e,r),{codewords:i,version:o,ecLevelIndex:s}=n,c=o*4+17,f=new Uint8Array(c*c),a=new Uint8Array(c*c);Se(f,a,c,0,0),Se(f,a,c,0,c-7),Se(f,a,c,c-7,0),er(f,a,c);let u=(4*o+9)*c+8;f[u]=1,a[u]=1;let d=Kt(o);for(let b of d)for(let w of d)b<=8&&w<=8||b<=8&&w>=c-8||b>=c-8&&w<=8||zt(f,a,c,b,w);rr(f,a,c,o),tr(a,c),nr(f,a,c,i);let $=Xe(f,a,c),h=Jt[s*8+$];return ar(f,h,c),{matrix:f,version:o,size:c}}function ar(t,e,r){for(let n=0;n<15;n++){let[i,o]=Ye[n];t[i*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 C=t=>Math.round(t*100)/100,Q=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),i=r-n*100,o;return i===0?o=String(n):i%10===0?o=`${n}.${i/10}`:i<10?o=`${n}.0${i}`:o=`${n}.${i}`,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 sr(t,e,r,n){let i=k(Q(r)),o=new Array(e),s=new Array(e+1),c=new Array(e+1);for(let a=0;a<=e;a++){let u=Q(a*r);s[a]=k(u),c[a]=k(-u),a<e&&(o[a]=k(Q(n+a*r)))}let f=[];for(let a=0;a<e;a++){let u=a*e,d=k(Q(n+a*r)),$=Me(a,e)+1,h=Ae(a,e),b=-1;for(let w=$;w<h;w++)if(t[u+w]===1)b===-1&&(b=w);else if(b!==-1){let A=w-b;f.push(`M${o[b]},${d}h${s[A]}v${i}h${c[A]}z`),b=-1}if(b!==-1){let w=h-b;f.push(`M${o[b]},${d}h${s[w]}v${i}h${c[w]}z`)}}return f.join(" ")}function cr(t,e,r,n,i){let o=C(r),s=[];if(i==="circle"){let p=o/2,m=C(p),x=`a${k(Q(m))},${k(Q(m))} 0 1,0 `,g=`${x}${k(Q(m*2))},0${x}${k(Q(-m*2))},0z`,S=new Array(e);for(let l=0;l<e;l++){let R=C(C(n+l*r)+p);S[l]=`M${k(Q(R-m))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(Q(C(n+l*r)+p))}${g}`,O=Me(l,e)+1,E=Ae(l,e);for(let I=O;I<E;I++)t[R+I]===1&&s.push(S[I]+L)}return s.join(" ")}let c=C(o*.45),f=[k(Q(o)),k(Q(o-c)),k(Q(o-2*c))],a=[k(Q(-o)),k(Q(-(o-c))),k(Q(-(o-2*c)))],u=k(Q(c)),d=k(Q(-c)),$=`q${u},0 ${u},${u}`,h=`q0,${u} ${d},${u}`,b=`q${d},0 ${d},${d}`,w=`q0,${d} ${u},${d}`,A=new Array(e),y=new Array(e);for(let p=0;p<e;p++){let m=C(n+p*r);A[p]=k(Q(m)),y[p]=k(Q(m+c))}for(let p=0;p<e;p++){let m=p*e,x=k(Q(C(n+p*r))),g=Me(p,e)+1,S=Ae(p,e);for(let l=g;l<S;l++){if(t[m+l]!==1)continue;let R=p>0&&t[m-e+l]===1,L=l<e-1&&t[m+l+1]===1,O=p<e-1&&t[m+e+l]===1,E=l>0&&t[m+l-1]===1,I=!(R||E),M=!(R||L),v=!(O||L),P=!(O||E);s.push(`M${I?y[l]:A[l]},${x}h${f[(I?1:0)+(M?1:0)]}`+(M?$:"")+`v${f[(M?1:0)+(v?1:0)]}`+(v?h:"")+`h${a[(v?1:0)+(P?1:0)]}`+(P?b:"")+`v${a[(P?1:0)+(I?1:0)]}`+(I?w:"")+"z")}}return s.join(" ")}var lr=2,Je=new WeakMap;function Ze(t,e,r,n,i){let o=Je.get(t);o||(o=new Map,Je.set(t,o));let s=`${r}|${n}|${i}`,c=o.get(s);if(c!==void 0)return c;let f=i==="square"?sr(t,e,r,n):cr(t,e,r,n,i);return o.size>=lr&&o.clear(),o.set(s,f),f}var ur=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function ze(t){return t.replace(ur,"")}function et(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,i=C(t/n);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:i,marginPx:C(e*i),svgSize:C(i*n)}}function fe(t,e,r){let n=C(r);return`M${C(t)},${C(e)}h${n}v${n}h${-n}z`}function de(t,e,r,n,i){let o=C(Math.min(i,r/2,n/2)),s=C(r-2*o),c=C(n-2*o);return`M${C(t+o)},${C(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 fr(t,e,r,n){if(n==="circle"){let i=C(r/2),o=C(i*2);return`M${C(t)},${C(e+r/2)}a${i},${i} 0 1,0 ${o},0a${i},${i} 0 1,0 ${-o},0z`}return n==="rounded"?de(t,e,r,r,r*.3):fe(t,e,r)}function dr(t,e,r,n){let i=r/7,o=r-2*i,s=i;if(n==="square"){let a=fe(t,e,r),u=fe(t+s,e+s,o);return`${a} ${u}`}if(n==="rounded"){let a=de(t,e,r,r,r*.15),u=fe(t+s,e+s,o);return`${a} ${u}`}if(n==="circle"){let a=t+r/2,u=C(e+r/2),d=$=>{let h=C($),b=C(h*2);return`M${C(a-h)},${u}a${h},${h} 0 1,0 ${b},0a${h},${h} 0 1,0 ${-b},0z`};return`${d(r/2)} ${d(o/2)}`}let c=de(t,e,r,r,r*.35),f=de(t+s,e+s,o,o,o*.2);return`${c} ${f}`}function tt(t,e,r,n,i){let o=C(7*r),s=C(3*r),c=C(2*r);return{square:dr(t,e,o,n),dot:fr(C(t+c),C(e+c),s,i)}}function Re(t,e,r){return r+t*e}function rt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,o])=>({x:Re(o,e,r),y:Re(i,e,r)}))}var Y={L:.0225,M:.04,Q:.0625,H:.09},mr=Y.H,br=.4;function ve(t){return t<=Y.L?"L":t<=Y.M?"M":t<=Y.Q?"Q":"H"}var gr=/[\u0000-\u0020]/g;function me(t){let e=t.replace(gr,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function ot(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function it(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):br:0)*mr;return r?{ecLevel:r,absoluteArea:Math.min(i,Y[r]),targetArea:i,clamped:i>Y[r]}:i>0?{ecLevel:ve(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function nt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var pr={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:i,marginPx:o}){let s=n*i,c=t*s*s,f=Math.sqrt(c*e),a=Math.sqrt(c/e);if(!(f>0)||!(a>0))return pr;let u=f/i,d=a/i,$=Y[r]*n*n,h=Math.max(1,n-16),b=Math.min(nt(u),h),w=1;for(;;){let l=Math.min(1,b/u);if(w=Math.min(nt(d*l),h),b*w<=$||b<=1)break;b-=2}let A=Math.min(1,b/u,w/d),y=f*A,p=a*A,m=b*i,x=w*i,g=o+(n-b)/2*i,S=o+(n-w)/2*i;return{clearX:g,clearY:S,clearWidth:m,clearHeight:x,boxX:g+(m-y)/2,boxY:S+(x-p)/2,boxWidth:y,boxHeight:p}}function Ee(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 hr(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function Z(t){let{value:e,size:r=256,margin:n=4,dotStyle:i="square",dotColor:o="#000000",backgroundColor:s="#ffffff",corner:c,logo:f,qr:a}=t,u=f?.src&&me(f.src)?f.src:void 0,d=!!(u||f?.custom),$=a?.errorCorrectionLevel,{ecLevel:h,absoluteArea:b,targetArea:w,clamped:A}=it(d,f?.size,$),y=[];A&&y.push(`[QRCode] logo.size=${f?.size} needs ECL \u2265 "${ve(w)}"; ECL "${$}" set, logo clamped.`);let{matrix:p,size:m}=Ke(e,h,a?.version),{moduleSize:x,marginPx:g,svgSize:S}=et(r,n,m),l=Ee(c,o),R=Ze(p,m,x,g,i),L=rt(m,x,g).map(T=>{let{square:B,dot:H}=tt(C(T.x),C(T.y),x,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:C(T.x),y:C(T.y),width:C(7*x),height:C(7*x),fill:l.backgroundColor}},square:{d:B,fill:l.squareColor,fillRule:"evenodd"},dot:{d:H,fill:l.dotColor}}}),O=(f?.margin??0)*x,E=at({absoluteArea:b,aspectRatio:ot(f?.aspectRatio),ecLevel:h,qrSize:m,moduleSize:x,marginPx:g}),I=C(E.boxX+O),M=C(E.boxY+O),v=C(Math.max(0,E.boxWidth-O*2)),P=C(Math.max(0,E.boxHeight-O*2)),N=d&&v>0&&P>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||P<=0)&&y.push(`[QRCode] logo.margin=${f?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:C(r),viewBox:S,ecLevel:h,background:s==="transparent"?void 0:s,modules:R?{d:R,fill:o}:void 0,finders:L,clear:N&&(f?.hideDots??!0)?{x:C(E.clearX),y:C(E.clearY),width:C(E.clearWidth),height:C(E.clearHeight)}:void 0,logo:N?{src:u,x:I,y:M,width:v,height:P,radius:C(hr(f?.radius)*Math.min(v,P)/2)}:void 0,warnings:y}}function oe(t,e){return`${t}${e}`}function yr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Le(t){let e=yr(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 ie(t,e){let{x1:r,y1:n,x2:i,y2:o}=Le(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${i}" 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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function W(t){return ze(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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"]),Cr=["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 Cr)ct.add(t);function wr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function $r(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!ct.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${wr(e)}:${i}`}).join(";")}function be(t){let{value:e,size:r=256,margin:n=4,dotStyle:i="square",dotColor:o="#000000",dotGradient:s,backgroundColor:c="#ffffff",backgroundGradient:f,corner:a,logo:u,qr:d,className:$,style:h,ariaLabel:b,idPrefix:w}=t,A=Z(t),y=Ee(a,o),p=u?.src&&me(u.src)?u.src:void 0,m=(w??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",x=[e,r,n,i,o,JSON.stringify(s??null),c,JSON.stringify(f??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,a?.backgroundColor??"",JSON.stringify(a?.square?.gradient??null),JSON.stringify(a?.dot?.gradient??null),A.ecLevel,d?.version??"",p??"",u?.size??"",u?.aspectRatio??"",u?.margin??"",u?.hideDots??"",$??"",b??"",w??""];u?.radius!==void 0&&x.push(u.radius),u?.custom&&x.push("custom");let g=`${m}${xr(x.join("\0"))}`,S=`${g}t`,l=`${g}m`,R=`${g}c`,L=oe(g,"d"),O=oe(g,"b"),E=oe(g,"s"),I=oe(g,"p"),{size:M,viewBox:v,background:P,modules:N,finders:T}=A,{clear:B,logo:H}=A,U=`<svg role="img" aria-labelledby="${S}" width="${M}" height="${M}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(U+=` class="${W($)}"`),h&&(U+=` style="${W($r(h))}"`),U+=">",U+=`<title id="${S}">${W(b??`QR code: ${e}`)}</title>`;let ae=[s&&ie(L,s),f&&ie(O,f),a?.square?.gradient&&ie(E,a.square.gradient),a?.dot?.gradient&&ie(I,a.dot.gradient)].filter(Boolean);ae.length&&(U+=`<defs>${ae.join("")}</defs>`),P!==void 0&&(U+=`<rect width="${v}" height="${v}" fill="${f?`url(#${O})`:W(P)}"/>`),B&&(U+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${B.x}" y="${B.y}" width="${B.width}" height="${B.height}" fill="black"/></mask></defs>`),U+=`<g${B?` mask="url(#${l})"`:""}>`,N&&(U+=`<path d="${N.d}" fill="${s?`url(#${L})`:W(N.fill)}"/>`);for(let{background:D,square:V,dot:j}of T)U+="<g>"+(D?`<rect x="${D.x}" y="${D.y}" width="${D.width}" height="${D.height}" fill="${W(D.fill)}"/>`:"")+`<path d="${V.d}" fill="${a?.square?.gradient?`url(#${E})`:W(V.fill)}" fill-rule="evenodd"/><path d="${j.d}" fill="${a?.dot?.gradient?`url(#${I})`:W(j.fill)}"/></g>`;if(U+="</g>",H?.src){let{x:D,y:V,width:j,height:se,radius:F}=H;F>0&&(U+=`<defs><clipPath id="${R}"><rect x="${D}" y="${V}" width="${j}" height="${se}" rx="${F}" ry="${F}"/></clipPath></defs>`),U+=`<image href="${W(H.src)}" x="${D}" y="${V}" width="${j}" height="${se}"${F>0?` clip-path="url(#${R})"`:""}/>`}return U+="</svg>",U}function lt(t,e,r,n){if(n){let i=Le(n),o=Number.parseFloat(i.x1)/100*e,s=Number.parseFloat(i.y1)/100*e,c=Number.parseFloat(i.x2)/100*e,f=Number.parseFloat(i.y2)/100*e,a=t.createLinearGradient(o,s,c,f);a.addColorStop(0,n.startColor),a.addColorStop(1,n.endColor),t.fillStyle=a,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:i,matrixSize:o,margin:s,filter:c,backgroundColor:f,backgroundAlpha:a}=r,u=r.gapColor,d=new Uint8ClampedArray(t),$=n/(o+s*2),h=Math.max(r.coreSize??.4,r.minCoreSize??0),b=(1-h)/2,w=(m,x)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(m-.5)**2+(x-.5)**2<=h**2/4;let g=h*.28,S=Math.max(Math.abs(m-.5)-(h/2-g),0),l=Math.max(Math.abs(x-.5)-(h/2-g),0);return S**2+l**2<=g**2},A=(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,p=(m,x=t)=>{let g=x[m+3]/255,S=e[m+3]/255,l=g+S*(1-g),R=(L,O)=>l===0?0:(L*g+O*S*(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<i;m+=1)for(let x=0;x<n;x+=1){let g=x/$-s,S=m/$-s,l=(m*n+x)*4;if(g<0||S<0||g>=o||S>=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(S);if(A(g,S)){d[l]=f[0],d[l+1]=f[1],d[l+2]=f[2],d[l+3]=a;continue}if(y(R,L)){p(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let O=g-R,E=S-L;if(O>=b&&O<1-b&&E>=b&&E<1-b&&w(O,E)){p(l);continue}if(u){let v=u[3]/255,P=e[l+3]/255,N=v+P*(1-v),T=(B,H)=>N===0?0:(B*v+H*P*(1-v))/N;d[l]=T(u[0],e[l]),d[l+1]=T(u[1],e[l+1]),d[l+2]=T(u[2],e[l+2]),d[l+3]=N*255;continue}let M=l;if(c==="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 mt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Ie(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 Sr(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 Mr(t,e,r,n,i,o,s){let c=s==="fill"?Math.max(i/e.naturalWidth,o/e.naturalHeight):Math.min(i/e.naturalWidth,o/e.naturalHeight),f=e.naturalWidth*c,a=e.naturalHeight*c;t.drawImage(e,r+(i-f)/2,n+(o-a)/2,f,a)}function Ar(t,e){let r=be({...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 Rr(t,e,r){let{imagePath:n,imageDotSize:i,imageDotStyle:o,imageColor:s,filter:c,fillType:f="scale_to_fit",logo:a,...u}=e;if(!n||!mt(n))throw new Error("The image URL uses an unsupported scheme.");if(a?.src&&!mt(a.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=Ie(n),$=a?.src?Ie(a.src):Promise.resolve(void 0),[h,b]=await Promise.all([d,$]);if(r())return;let w=a?{...a,src:void 0,custom:!0,aspectRatio:a.aspectRatio??(b?b.naturalWidth/b.naturalHeight:1)}:void 0,A={...u,dotStyle:o??u.dotStyle,backgroundColor:u.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...u.qr},logo:w},y=Z(A),p=Z({...A,corner:{square:{style:"square"},dot:{style:"square"}}}),m=p.finders[0].square.d,g=Number(m.match(/h([\d.]+)v/)?.[1])/7,S=Number(m.match(/^M([\d.]+),/)?.[1])/g,l=Math.round(p.viewBox/g-S*2),R=l+S*2;if(!Number.isFinite(g)||!Number.isFinite(S)||l<21)throw new Error("Unable to determine QR module dimensions.");let L=be({...A,dotColor:A.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),O=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Ie(O);if(r())return;let I=A.size??256,M=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=M,v.height=M;let P=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=M,N.height=M;let T=N.getContext("2d",{willReadFrequently:!0});if(!P||!T)throw new Error("Canvas 2D context is unavailable.");P.drawImage(E,0,0,M,M);let B=e.backgroundColor??"#ffffff",U=Sr(B==="transparent"?"#ffffff":B),ae=[U[0],U[1],U[2]];lt(T,M,B,A.backgroundGradient);let D=M/R,V=S*D,j=l*D;Mr(T,h,V,V,j,j,f);let se=dt(P.getImageData(0,0,M,M).data,T.getImageData(0,0,M,M).data,{width:M,height:M,matrixSize:l,margin:S,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:ut(i),dotStyle:o??u.dotStyle,clear:y.clear?{x:y.clear.x/g-S,y:y.clear.y/g-S,width:y.clear.width/g,height:y.clear.height/g}:void 0,filter:ft(s,c),backgroundColor:ae,backgroundAlpha:B==="transparent"?0:U[3]}),F=document.createElement("canvas");F.width=Math.round(I),F.height=Math.round(I),F.setAttribute("role","img"),F.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),F.style.width=`${I}px`,F.style.height=`${I}px`;let ke=F.getContext("2d"),ce=document.createElement("canvas");ce.width=M,ce.height=M;let _=ce.getContext("2d");if(!ke||!_)throw new Error("Canvas 2D context is unavailable.");let Oe=_.createImageData(M,M);if(Oe.data.set(se),_.putImageData(Oe,0,0),b&&y.logo){let z=M/y.viewBox,ge=y.logo.x*z,pe=y.logo.y*z,he=y.logo.width*z,ye=y.logo.height*z;y.logo.radius>0?(_.save(),_.beginPath(),_.roundRect(ge,pe,he,ye,y.logo.radius*z),_.clip(),_.drawImage(b,ge,pe,he,ye),_.restore()):_.drawImage(b,ge,pe,he,ye)}ke.drawImage(ce,0,0,F.width,F.height),r()||t.replaceChildren(F)}finally{URL.revokeObjectURL(O)}}function bt(t,e){let r=!1;return e.imagePath?Rr(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):Ar(t,e),()=>{r=!0,t.replaceChildren()}}var gt=(0,q.defineComponent)({name:"Quter",props:{value:{type:String,required:!0},size:Number,margin:Number,dotStyle:String,dotColor:String,dotGradient:Object,backgroundColor:String,backgroundGradient:Object,corner:Object,qr:Object,logo:Object,imagePath:String,imageDotStyle:String,imageDotSize:Number,imageColor:Boolean,filter:String,fillType:String,ariaLabel:String,onImageError:Function},setup(t,{attrs:e}){let r=(0,q.ref)(null),n;return(0,q.watchEffect)(()=>{r.value&&(n?.(),n=bt(r.value,t))}),(0,q.onBeforeUnmount)(()=>n?.()),()=>(0,q.h)("div",{...e,ref:r})}}),vr=gt;0&&(module.exports={Quter});
|
|
1
|
+
"use strict";var le=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var Ct=(t,e,r)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var wt=(t,e)=>{for(var r in e)le(t,r,{get:e[r],enumerable:!0})},$t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yt(e))!xt.call(t,i)&&i!==r&&le(t,i,{get:()=>e[i],enumerable:!(n=ht(e,i))||n.enumerable});return t};var Mt=t=>$t(le({},"__esModule",{value:!0}),t);var xe=(t,e,r)=>Ct(t,typeof e!="symbol"?e+"":e,r);var Er={};wt(Er,{Quter:()=>pt,default:()=>vr});module.exports=Mt(Er);var q=require("vue");function St(){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 At(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var ue=St(),ee=At(ue);function Rt(t,e){return t===0||e===0?0:ue[ee[t]+ee[e]]}function vt(t,e){return ue[ee[t]*e%255]}function Et(t){let e=[1];for(let r=0;r<t;r++){let n=[1,vt(2,r)],i=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++)i[o+s]^=Rt(e[o],n[s]);e=i}return Uint8Array.from(e)}var Qe=new Map;function Lt(t){let e=Qe.get(t);return e||(e=Et(t),Qe.set(t,e)),e}function It(t,e){let r=Lt(e),n=r.length,i=t.length,o=new Uint8Array(i+e);o.set(t);for(let s=0;s<i;s++){let c=o[s];if(c!==0){let u=ee[c];for(let a=0;a<n;a++)o[s+a]^=ue[ee[r[a]]+u]}}return o.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],Ot=[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],Ue=[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 te(t,e){return Ue[(t-1)*4+e]}function Pe(t,e,r){let n=(e-1)*4+r,i=kt[n],o=Ot[n],s=Ue[n],c=Math.floor(s/o),u=o-s%o,a=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 p=y<u?c:c+1;f[y]=x,d[y]=p,p>g&&(g=p),$[y]=It(a.subarray(x,x+p),i),x+=p}let w=new Uint8Array(a.length+o*i),A=0;for(let y=0;y<g;y++)for(let p=0;p<o;p++)y<d[p]&&(w[A++]=a[f[p]+y]);for(let y=0;y<i;y++)for(let p=0;p<o;p++)w[A++]=$[p][y];return w}var Te={numeric:1,alphanumeric:2,byte:4};function Qt(){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 J=Qt();function Ut(t){return t<128?J[t]:-1}function G(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 Be=[[1,9],[10,26],[27,40]],Pt=[0,4,7];function Tt(t,e){return t==="numeric"?10*Math.floor(e/3)+Pt[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+G(n.mode,e)+Tt(n.mode,n.charCount);return Math.ceil(r/8)}function Ce(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var K=0,re=1,ne=2,Bt=["numeric","alphanumeric","byte"];function Ft(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Ne=33,De=48;function Nt(t){let e=0,r=0,n=0,i=0;for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);s<128?(r++,s>=48&&s<=57?(n++,i++):J[s]>=0&&i++):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:i}}function Dt(t,e){let r=new Int32Array(e),n=new Uint8Array(e),i=new Uint8Array(e),o=0;for(let s=0;s<t.length;){let c=t.codePointAt(s);r[o]=s,n[o]=Ft(c),c>=48&&c<=57?i[o]=2:Ut(c)>=0&&(i[o]=1),o++,s+=c>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:i}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:i}=Nt(t),o=n*Fe+(i-n)*Ne+(r-i)*De,s=a=>{let f=4+Math.min(G("numeric",a),G("alphanumeric",a),G("byte",a));return Math.ceil((o/6+f)/8)},c;if(n===e?c=Ce(t,"numeric",e,r):i===e&&n===0?c=Ce(t,"alphanumeric",e,r):i===0&&(c=Ce(t,"byte",r,r)),c){let a=[c];return{forVersion:()=>a,minDataBytes:s}}let u;return{forVersion(a){return u??(u=Dt(t,e)),_t(t,a,e,u)},minDataBytes:s}}function _t(t,e,r,{cpIndex:n,cpBytes:i,cpClass:o}){let s=(4+G("numeric",e))*6,c=(4+G("alphanumeric",e))*6,u=(4+G("byte",e))*6,a=[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 h=b*3,m=o[b];d[K]=1/0,d[re]=1/0,d[ne]=$[ne]+i[b]*De,f[h+ne]=ne,m!==0&&(d[re]=$[re]+Ne,f[h+re]=re),m===2&&(d[K]=$[K]+Fe,f[h+K]=K);for(let l=0;l<3;l++)for(let R=0;R<3;R++){if(f[h+R]===-1)continue;let L=Math.ceil(d[R]/6)*6+a[l];(f[h+l]===-1||L<d[l])&&(d[l]=L,f[h+l]=R)}let M=$;$=d,d=M}let x=K;for(let b=1;b<3;b++)$[b]<$[x]&&(x=b);let g=new Int8Array(r),w=x;for(let b=r-1;b>=0;b--)w=f[b*3+w],g[b]=w;let A=[],y=0,p=0;for(;p<r;){let b=g[p],h=p,m=0;for(;h<r&&g[h]===b;)m+=i[h],h++;A.push({mode:Bt[b],start:n[p],end:h<r?n[h]:t.length,charCount:b===ne?m:h-p,byteStart:y,byteEnd:y+m}),y+=m,p=h}return A}var qt={L:0,M:1,Q:2,H:3},qe;function Gt(){return qe??(qe=new TextEncoder)}var $e=class{constructor(e){xe(this,"bytes");xe(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&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}},Wt=[236,17];function Ht(t,e,r,n,i){let o=new $e(n);for(let a of e)if(o.writeBits(Te[a.mode],4),o.writeBits(a.charCount,G(a.mode,r)),a.mode==="numeric")for(let f=a.start;f<a.end;f+=3){let d=Math.min(3,a.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(a.mode==="alphanumeric")for(let f=a.start;f<a.end;f+=2)if(f+1<a.end){let d=J[t.charCodeAt(f)]*45+J[t.charCodeAt(f+1)];o.writeBits(d,11)}else o.writeBits(J[t.charCodeAt(f)],6);else for(let f=a.byteStart;f<a.byteEnd;f++)o.writeBits(i[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 a=o.bitLength>>3;a<n;a++)c[a]=Wt[u%2],u++;return c}function Ge(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=qt[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=_e(t),o=x=>i.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=te(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,w]of Be){if(i.minDataBytes(g)>te(w,n))continue;let A=o(g),y=we(A,g);for(let p=g;p<=w;p++)if(y<=te(p,n)){x={version:p,segments:A};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 a=c.some(x=>x.mode==="byte")?Gt().encode(t):null,f=te(s,n),d=Ht(t,c,s,f,a);return{codewords:Pe(d,s,n),version:s,ecLevelIndex:n,segments:c}}var Vt=[(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 jt(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,i)}function Xt(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=Vt[e];for(let n=0;n<12;n++)for(let i=0;i<6;i++)t[e*72+n*6+i]=r(n,i)?1:0}return t}var je=Xt(),We=1488,He=93,Ve=2047;function Yt(t,e,r,n,i){let{prevRow:o,colRunVal:s,colRunLen:c,colWin:u}=i;s.fill(-1),c.fill(0),u.fill(0);let a=0,f=0;for(let d=0;d<r;d++){let $=n+d%12*6,x=d*r,g=d>=10,w=0,A=-1,y=0,p=0,b=-1,h=-1;for(let m=0;m<r;m++){let M=x+m,l=t[M]^je[$+w]&(e[M]^1);f+=l,l===A?y++:(y>=5&&(a+=y-2),A=l,y=1),p=(p<<1|l)&Ve,m>=10&&(p===We||p===He)&&(a+=40),l===s[m]?c[m]++:(c[m]>=5&&(a+=c[m]-2),s[m]=l,c[m]=1);let R=(u[m]<<1|l)&Ve;u[m]=R,g&&(R===We||R===He)&&(a+=40);let L=o[m];d>0&&m>0&&l===b&&l===L&&l===h&&(a+=3),o[m]=l,h=L,b=l,w++,w===6&&(w=0)}y>=5&&(a+=y-2)}for(let d=0;d<r;d++)c[d]>=5&&(a+=c[d]-2);return a+=jt(f,r*r),a}function Kt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,o=1/0;for(let s=0;s<8;s++){let c=Yt(t,e,r,s*72,n);c<o&&(o=c,i=s)}return i}function Xe(t,e,r){let n=Kt(t,e,r),i=n*72;for(let o=0;o<r;o++){let s=i+o%12*6,c=o*r,u=0;for(let a=0;a<r;a++)e[c+a]||(t[c+a]^=je[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,i=[6];for(let o=1;o<e;o++)i.push(r-(e-1-o)*n);return i}var Zt=[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],zt=[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 Me(t,e,r,n,i){for(let o=-1;o<=7;o++)for(let s=-1;s<=7;s++){let c=n+o,u=i+s;if(c<0||u<0||c>=r||u>=r)continue;let a=c*r+u;e[a]=1,o===-1||o===7||s===-1||s===7?t[a]=0:o===0||o===6||s===0||s===6||o>=2&&o<=4&&s>=2&&s<=4?t[a]=1:t[a]=0}}function er(t,e,r,n,i){for(let o=-2;o<=2;o++)for(let s=-2;s<=2;s++){let c=(n+o)*r+(i+s);e[c]=1,o===-2||o===2||s===-2||s===2||o===0&&s===0?t[c]=1:t[c]=0}}function tr(t,e,r){for(let n=8;n<r-8;n++){let i=n%2===0?1:0,o=6*r+n,s=n*r+6;t[o]=i,t[s]=i,e[o]=1,e[s]=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 rr(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 nr(t,e,r,n){if(n<7)return;let i=zt[n-7];for(let o=0;o<18;o++){let s=i>>o&1,c=Math.floor(o/3),u=o%3,a=c*r+(r-11+u),f=(r-11+u)*r+c;t[a]=s,e[a]=1,t[f]=s,e[f]=1}}function or(t,e,r,n){let i=0,o=n.length*8,s=r-1,c=!0;for(;s>=0;){if(s===6){s--;continue}let u=c?r-1:0,a=c?-1:r,f=c?-1:1;for(let d=u;d!==a;d+=f){let $=d*r;for(let x=0;x<=1;x++){let g=s-x;g<0||e[$+g]||(i<o?(t[$+g]=n[i>>3]>>7-(i&7)&1,i++):t[$+g]=0)}}s-=2,c=!c}}var ir=16,X=new Map;function Ke(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,i=X.get(n);if(i)return X.delete(n),X.set(n,i),i;let o=ar(t,e,r);return X.set(n,o),X.size>ir&&X.delete(X.keys().next().value),o}function ar(t,e,r){let n=Ge(t,e,r),{codewords:i,version:o,ecLevelIndex:s}=n,c=o*4+17,u=new Uint8Array(c*c),a=new Uint8Array(c*c);Me(u,a,c,0,0),Me(u,a,c,0,c-7),Me(u,a,c,c-7,0),tr(u,a,c);let f=(4*o+9)*c+8;u[f]=1,a[f]=1;let d=Jt(o);for(let g of d)for(let w of d)g<=8&&w<=8||g<=8&&w>=c-8||g>=c-8&&w<=8||er(u,a,c,g,w);nr(u,a,c,o),rr(a,c),or(u,a,c,i);let $=Xe(u,a,c),x=Zt[s*8+$];return sr(u,x,c),{matrix:u,version:o,size:c}}function sr(t,e,r){for(let n=0;n<15;n++){let[i,o]=Ye[n];t[i*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 C=t=>Math.round(t*100)/100,Q=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),i=r-n*100,o;return i===0?o=String(n):i%10===0?o=`${n}.${i/10}`:i<10?o=`${n}.0${i}`:o=`${n}.${i}`,e?`-${o}`:o}function Se(t,e){return t<=7||t>=e-8?7:-1}function Ae(t,e){return t<=7?e-8:e}function cr(t,e,r,n){let i=k(Q(r)),o=new Array(e),s=new Array(e+1),c=new Array(e+1);for(let a=0;a<=e;a++){let f=Q(a*r);s[a]=k(f),c[a]=k(-f),a<e&&(o[a]=k(Q(n+a*r)))}let u=[];for(let a=0;a<e;a++){let f=a*e,d=k(Q(n+a*r)),$=Se(a,e)+1,x=Ae(a,e),g=-1;for(let w=$;w<x;w++)if(t[f+w]===1)g===-1&&(g=w);else if(g!==-1){let A=w-g;u.push(`M${o[g]},${d}h${s[A]}v${i}h${c[A]}z`),g=-1}if(g!==-1){let w=x-g;u.push(`M${o[g]},${d}h${s[w]}v${i}h${c[w]}z`)}}return u.join(" ")}function lr(t,e,r,n,i){let o=C(r),s=[];if(i==="circle"){let p=o/2,b=C(p),h=`a${k(Q(b))},${k(Q(b))} 0 1,0 `,m=`${h}${k(Q(b*2))},0${h}${k(Q(-b*2))},0z`,M=new Array(e);for(let l=0;l<e;l++){let R=C(C(n+l*r)+p);M[l]=`M${k(Q(R-b))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(Q(C(n+l*r)+p))}${m}`,O=Se(l,e)+1,E=Ae(l,e);for(let I=O;I<E;I++)t[R+I]===1&&s.push(M[I]+L)}return s.join(" ")}let c=C(o*.45),u=[k(Q(o)),k(Q(o-c)),k(Q(o-2*c))],a=[k(Q(-o)),k(Q(-(o-c))),k(Q(-(o-2*c)))],f=k(Q(c)),d=k(Q(-c)),$=`q${f},0 ${f},${f}`,x=`q0,${f} ${d},${f}`,g=`q${d},0 ${d},${d}`,w=`q0,${d} ${f},${d}`,A=new Array(e),y=new Array(e);for(let p=0;p<e;p++){let b=C(n+p*r);A[p]=k(Q(b)),y[p]=k(Q(b+c))}for(let p=0;p<e;p++){let b=p*e,h=k(Q(C(n+p*r))),m=Se(p,e)+1,M=Ae(p,e);for(let l=m;l<M;l++){if(t[b+l]!==1)continue;let R=p>0&&t[b-e+l]===1,L=l<e-1&&t[b+l+1]===1,O=p<e-1&&t[b+e+l]===1,E=l>0&&t[b+l-1]===1,I=!(R||E),S=!(R||L),v=!(O||L),P=!(O||E);s.push(`M${I?y[l]:A[l]},${h}h${u[(I?1:0)+(S?1:0)]}`+(S?$:"")+`v${u[(S?1:0)+(v?1:0)]}`+(v?x:"")+`h${a[(v?1:0)+(P?1:0)]}`+(P?g:"")+`v${a[(P?1:0)+(I?1:0)]}`+(I?w:"")+"z")}}return s.join(" ")}var ur=2,Je=new WeakMap;function Ze(t,e,r,n,i){let o=Je.get(t);o||(o=new Map,Je.set(t,o));let s=`${r}|${n}|${i}`,c=o.get(s);if(c!==void 0)return c;let u=i==="square"?cr(t,e,r,n):lr(t,e,r,n,i);return o.size>=ur&&o.clear(),o.set(s,u),u}var fr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function ze(t){return t.replace(fr,"")}function et(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,i=C(t/n);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:i,marginPx:C(e*i),svgSize:C(i*n)}}function fe(t,e,r){let n=C(r);return`M${C(t)},${C(e)}h${n}v${n}h${-n}z`}function de(t,e,r,n,i){let o=C(Math.min(i,r/2,n/2)),s=C(r-2*o),c=C(n-2*o);return`M${C(t+o)},${C(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 dr(t,e,r,n){if(n==="circle"){let i=C(r/2),o=C(i*2);return`M${C(t)},${C(e+r/2)}a${i},${i} 0 1,0 ${o},0a${i},${i} 0 1,0 ${-o},0z`}return n==="rounded"?de(t,e,r,r,r*.3):fe(t,e,r)}function mr(t,e,r,n){let i=r/7,o=r-2*i,s=i;if(n==="square"){let a=fe(t,e,r),f=fe(t+s,e+s,o);return`${a} ${f}`}if(n==="rounded"){let a=de(t,e,r,r,r*.15),f=fe(t+s,e+s,o);return`${a} ${f}`}if(n==="circle"){let a=t+r/2,f=C(e+r/2),d=$=>{let x=C($),g=C(x*2);return`M${C(a-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=de(t,e,r,r,r*.35),u=de(t+s,e+s,o,o,o*.2);return`${c} ${u}`}function tt(t,e,r,n,i){let o=C(7*r),s=C(3*r),c=C(2*r);return{square:mr(t,e,o,n),dot:dr(C(t+c),C(e+c),s,i)}}function Re(t,e,r){return r+t*e}function rt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,o])=>({x:Re(o,e,r),y:Re(i,e,r)}))}var Y={L:.0225,M:.04,Q:.0625,H:.09},br=Y.H,gr=.4;function ve(t){return t<=Y.L?"L":t<=Y.M?"M":t<=Y.Q?"Q":"H"}var pr=/[\u0000-\u0020]/g;function me(t){let e=t.replace(pr,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function ot(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function it(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):gr:0)*br;return r?{ecLevel:r,absoluteArea:Math.min(i,Y[r]),targetArea:i,clamped:i>Y[r]}:i>0?{ecLevel:ve(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function nt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var hr={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:i,marginPx:o}){let s=n*i,c=t*s*s,u=Math.sqrt(c*e),a=Math.sqrt(c/e);if(!(u>0)||!(a>0))return hr;let f=u/i,d=a/i,$=Y[r]*n*n,x=Math.max(1,n-16),g=Math.min(nt(f),x),w=1;for(;;){let l=Math.min(1,g/f);if(w=Math.min(nt(d*l),x),g*w<=$||g<=1)break;g-=2}let A=Math.min(1,g/f,w/d),y=u*A,p=a*A,b=g*i,h=w*i,m=o+(n-g)/2*i,M=o+(n-w)/2*i;return{clearX:m,clearY:M,clearWidth:b,clearHeight:h,boxX:m+(b-y)/2,boxY:M+(h-p)/2,boxWidth:y,boxHeight:p}}function Ee(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 st(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function Z(t){let{value:e,size:r=256,margin:n=4,dotStyle:i="square",dotColor:o="#000000",backgroundColor:s="#ffffff",corner:c,logo:u,qr:a}=t,f=u?.src&&me(u.src)?u.src:void 0,d=!!(f||u?.custom),$=a?.errorCorrectionLevel,{ecLevel:x,absoluteArea:g,targetArea:w,clamped:A}=it(d,u?.size,$),y=[];A&&y.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${ve(w)}"; ECL "${$}" set, logo clamped.`);let{matrix:p,size:b}=Ke(e,x,a?.version),{moduleSize:h,marginPx:m,svgSize:M}=et(r,n,b),l=Ee(c,o),R=Ze(p,b,h,m,i),L=rt(b,h,m).map(B=>{let{square:T,dot:H}=tt(C(B.x),C(B.y),h,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:C(B.x),y:C(B.y),width:C(7*h),height:C(7*h),fill:l.backgroundColor}},square:{d:T,fill:l.squareColor,fillRule:"evenodd"},dot:{d:H,fill:l.dotColor}}}),O=(u?.margin??0)*h,E=at({absoluteArea:g,aspectRatio:ot(u?.aspectRatio),ecLevel:x,qrSize:b,moduleSize:h,marginPx:m}),I=C(E.boxX+O),S=C(E.boxY+O),v=C(Math.max(0,E.boxWidth-O*2)),P=C(Math.max(0,E.boxHeight-O*2)),N=d&&v>0&&P>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||P<=0)&&y.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:C(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:C(E.clearX),y:C(E.clearY),width:C(E.clearWidth),height:C(E.clearHeight),radius:C(st(u?.radius)*Math.min(E.clearWidth,E.clearHeight)/2)}:void 0,logo:N?{src:f,x:I,y:S,width:v,height:P,radius:C(st(u?.radius)*Math.min(v,P)/2)}:void 0,warnings:y}}function oe(t,e){return`${t}${e}`}function yr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Le(t){let e=yr(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 ie(t,e){let{x1:r,y1:n,x2:i,y2:o}=Le(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${i}" y2="${o}"><stop offset="0%" stop-color="${ct(e.startColor)}"/><stop offset="100%" stop-color="${ct(e.endColor)}"/></linearGradient>`}function ct(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function W(t){return ze(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var lt=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"]),Cr=["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 Cr)lt.add(t);function wr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function $r(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!lt.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${wr(e)}:${i}`}).join(";")}function be(t){let{value:e,size:r=256,margin:n=4,dotStyle:i="square",dotColor:o="#000000",dotGradient:s,backgroundColor:c="#ffffff",backgroundGradient:u,corner:a,logo:f,qr:d,className:$,style:x,ariaLabel:g,idPrefix:w}=t,A=Z(t),y=Ee(a,o),p=f?.src&&me(f.src)?f.src:void 0,b=(w??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",h=[e,r,n,i,o,JSON.stringify(s??null),c,JSON.stringify(u??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,a?.backgroundColor??"",JSON.stringify(a?.square?.gradient??null),JSON.stringify(a?.dot?.gradient??null),A.ecLevel,d?.version??"",p??"",f?.size??"",f?.aspectRatio??"",f?.margin??"",f?.hideDots??"",$??"",g??"",w??""];f?.radius!==void 0&&h.push(f.radius),f?.custom&&h.push("custom");let m=`${b}${xr(h.join("\0"))}`,M=`${m}t`,l=`${m}m`,R=`${m}c`,L=oe(m,"d"),O=oe(m,"b"),E=oe(m,"s"),I=oe(m,"p"),{size:S,viewBox:v,background:P,modules:N,finders:B}=A,{clear:T,logo:H}=A,U=`<svg role="img" aria-labelledby="${M}" width="${S}" height="${S}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(U+=` class="${W($)}"`),x&&(U+=` style="${W($r(x))}"`),U+=">",U+=`<title id="${M}">${W(g??`QR code: ${e}`)}</title>`;let ae=[s&&ie(L,s),u&&ie(O,u),a?.square?.gradient&&ie(E,a.square.gradient),a?.dot?.gradient&&ie(I,a.dot.gradient)].filter(Boolean);ae.length&&(U+=`<defs>${ae.join("")}</defs>`),P!==void 0&&(U+=`<rect width="${v}" height="${v}" fill="${u?`url(#${O})`:W(P)}"/>`),T&&(U+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${T.x}" y="${T.y}" width="${T.width}" height="${T.height}" rx="${T.radius}" ry="${T.radius}" fill="black"/></mask></defs>`),U+=`<g${T?` mask="url(#${l})"`:""}>`,N&&(U+=`<path d="${N.d}" fill="${s?`url(#${L})`:W(N.fill)}"/>`);for(let{background:D,square:V,dot:j}of B)U+="<g>"+(D?`<rect x="${D.x}" y="${D.y}" width="${D.width}" height="${D.height}" fill="${W(D.fill)}"/>`:"")+`<path d="${V.d}" fill="${a?.square?.gradient?`url(#${E})`:W(V.fill)}" fill-rule="evenodd"/><path d="${j.d}" fill="${a?.dot?.gradient?`url(#${I})`:W(j.fill)}"/></g>`;if(U+="</g>",H?.src){let{x:D,y:V,width:j,height:se,radius:F}=H;F>0&&(U+=`<defs><clipPath id="${R}"><rect x="${D}" y="${V}" width="${j}" height="${se}" rx="${F}" ry="${F}"/></clipPath></defs>`),U+=`<image href="${W(H.src)}" x="${D}" y="${V}" width="${j}" height="${se}"${F>0?` clip-path="url(#${R})"`:""}/>`}return U+="</svg>",U}function ut(t,e,r,n){if(n){let i=Le(n),o=Number.parseFloat(i.x1)/100*e,s=Number.parseFloat(i.y1)/100*e,c=Number.parseFloat(i.x2)/100*e,u=Number.parseFloat(i.y2)/100*e,a=t.createLinearGradient(o,s,c,u);a.addColorStop(0,n.startColor),a.addColorStop(1,n.endColor),t.fillStyle=a,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function ft(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function dt(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function mt(t,e,r){let{width:n,height:i,matrixSize:o,margin:s,filter:c,backgroundColor:u,backgroundAlpha:a}=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,w=(b,h)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(b-.5)**2+(h-.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(h-.5)-(x/2-m),0);return M**2+l**2<=m**2},A=(b,h)=>{let m=r.clear;if(!m||b<m.x||h<m.y||b>=m.x+m.width||h>=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(h,m.y+m.height-M));return(b-l)**2+(h-R)**2<=M**2},y=(b,h)=>b<8&&h<8||b>=o-8&&h<8||b<8&&h>=o-8,p=(b,h=t)=>{let m=h[b+3]/255,M=e[b+3]/255,l=m+M*(1-m),R=(L,O)=>l===0?0:(L*m+O*M*(1-m))/l;d[b]=R(h[b],e[b]),d[b+1]=R(h[b+1],e[b+1]),d[b+2]=R(h[b+2],e[b+2]),d[b+3]=l*255};for(let b=0;b<i;b+=1)for(let h=0;h<n;h+=1){let m=h/$-s,M=b/$-s,l=(b*n+h)*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(A(m,M)){d[l]=u[0],d[l+1]=u[1],d[l+2]=u[2],d[l+3]=a;continue}if(y(R,L)){p(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let O=m-R,E=M-L;if(O>=g&&O<1-g&&E>=g&&E<1-g&&w(O,E)){p(l);continue}if(f){let v=f[3]/255,P=e[l+3]/255,N=v+P*(1-v),B=(T,H)=>N===0?0:(T*v+H*P*(1-v))/N;d[l]=B(f[0],e[l]),d[l+1]=B(f[1],e[l+1]),d[l+2]=B(f[2],e[l+2]),d[l+3]=N*255;continue}let S=l;if(c==="color")d[l]=e[S],d[l+1]=e[S+1],d[l+2]=e[S+2];else{let v=e[S]*.2126+e[S+1]*.7152+e[S+2]*.0722;d[l]=v,d[l+1]=v,d[l+2]=v}d[l+3]=e[S+3]}return d}function bt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Ie(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 Mr(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 Sr(t,e,r,n,i,o,s){let c=s==="fill"?Math.max(i/e.naturalWidth,o/e.naturalHeight):Math.min(i/e.naturalWidth,o/e.naturalHeight),u=e.naturalWidth*c,a=e.naturalHeight*c;t.drawImage(e,r+(i-u)/2,n+(o-a)/2,u,a)}function Ar(t,e){let r=be({...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 Rr(t,e,r){let{imagePath:n,imageDotSize:i,imageDotStyle:o,imageColor:s,filter:c,fillType:u="scale_to_fit",logo:a,...f}=e;if(!n||!bt(n))throw new Error("The image URL uses an unsupported scheme.");if(a?.src&&!bt(a.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=Ie(n),$=a?.src?Ie(a.src):Promise.resolve(void 0),[x,g]=await Promise.all([d,$]);if(r())return;let w=a?{...a,src:void 0,custom:!0,aspectRatio:a.aspectRatio??(g?g.naturalWidth/g.naturalHeight:1)}:void 0,A={...f,dotStyle:o??f.dotStyle,backgroundColor:f.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...f.qr},logo:w},y=Z(A),p=Z({...A,corner:{square:{style:"square"},dot:{style:"square"}}}),b=p.finders[0].square.d,m=Number(b.match(/h([\d.]+)v/)?.[1])/7,M=Number(b.match(/^M([\d.]+),/)?.[1])/m,l=Math.round(p.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=be({...A,dotColor:A.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),O=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Ie(O);if(r())return;let I=A.size??256,S=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=S,v.height=S;let P=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=S,N.height=S;let B=N.getContext("2d",{willReadFrequently:!0});if(!P||!B)throw new Error("Canvas 2D context is unavailable.");P.drawImage(E,0,0,S,S);let T=e.backgroundColor??"#ffffff",U=Mr(T==="transparent"?"#ffffff":T),ae=[U[0],U[1],U[2]];ut(B,S,T,A.backgroundGradient);let D=S/R,V=M*D,j=l*D;Sr(B,x,V,V,j,j,u);let se=mt(P.getImageData(0,0,S,S).data,B.getImageData(0,0,S,S).data,{width:S,height:S,matrixSize:l,margin:M,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:ft(i),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:dt(s,c),backgroundColor:ae,backgroundAlpha:T==="transparent"?0:U[3]}),F=document.createElement("canvas");F.width=Math.round(I),F.height=Math.round(I),F.setAttribute("role","img"),F.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),F.style.width=`${I}px`,F.style.height=`${I}px`;let ke=F.getContext("2d"),ce=document.createElement("canvas");ce.width=S,ce.height=S;let _=ce.getContext("2d");if(!ke||!_)throw new Error("Canvas 2D context is unavailable.");let Oe=_.createImageData(S,S);if(Oe.data.set(se),_.putImageData(Oe,0,0),g&&y.logo){let z=S/y.viewBox,ge=y.logo.x*z,pe=y.logo.y*z,he=y.logo.width*z,ye=y.logo.height*z;y.logo.radius>0?(_.save(),_.beginPath(),_.roundRect(ge,pe,he,ye,y.logo.radius*z),_.clip(),_.drawImage(g,ge,pe,he,ye),_.restore()):_.drawImage(g,ge,pe,he,ye)}ke.drawImage(ce,0,0,F.width,F.height),r()||t.replaceChildren(F)}finally{URL.revokeObjectURL(O)}}function gt(t,e){let r=!1;return e.imagePath?Rr(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):Ar(t,e),()=>{r=!0,t.replaceChildren()}}var pt=(0,q.defineComponent)({name:"Quter",props:{value:{type:String,required:!0},size:Number,margin:Number,dotStyle:String,dotColor:String,dotGradient:Object,backgroundColor:String,backgroundGradient:Object,corner:Object,qr:Object,logo:Object,imagePath:String,imageDotStyle:String,imageDotSize:Number,imageColor:Boolean,filter:String,fillType:String,ariaLabel:String,onImageError:Function},setup(t,{attrs:e}){let r=(0,q.ref)(null),n;return(0,q.watchEffect)(()=>{r.value&&(n?.(),n=gt(r.value,t))}),(0,q.onBeforeUnmount)(()=>n?.()),()=>(0,q.h)("div",{...e,ref:r})}}),vr=pt;0&&(module.exports={Quter});
|
package/dist/vue.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-YNTX4ZO3.mjs";import"./chunk-OBIGPYJW.mjs";import"./chunk-BI4MXPFZ.mjs";import{defineComponent as i,h as n,onBeforeUnmount as a,ref as l,watchEffect as s}from"vue";var d=i({name:"Quter",props:{value:{type:String,required:!0},size:Number,margin:Number,dotStyle:String,dotColor:String,dotGradient:Object,backgroundColor:String,backgroundGradient:Object,corner:Object,qr:Object,logo:Object,imagePath:String,imageDotStyle:String,imageDotSize:Number,imageColor:Boolean,filter:String,fillType:String,ariaLabel:String,onImageError:Function},setup(t,{attrs:p}){let e=l(null),o;return s(()=>{e.value&&(o?.(),o=r(e.value,t))}),a(()=>o?.()),()=>n("div",{...p,ref:e})}}),y=d;export{d as Quter,y as default};
|
package/package.json
CHANGED
package/dist/chunk-RW5M2XKX.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as v}from"./chunk-PJYR3PPM.mjs";function L(u,t,o,d){if(d){let f=v(d),m=Number.parseFloat(f.x1)/100*t,p=Number.parseFloat(f.y1)/100*t,w=Number.parseFloat(f.x2)/100*t,y=Number.parseFloat(f.y2)/100*t,s=u.createLinearGradient(m,p,w,y);s.addColorStop(0,d.startColor),s.addColorStop(1,d.endColor),u.fillStyle=s,u.fillRect(0,0,t,t)}else o!=="transparent"&&(u.fillStyle=o,u.fillRect(0,0,t,t))}function j(u=0){if(!Number.isFinite(u)||u<0||u>1)throw new RangeError("imageDotSize must be between 0 and 1.");return u}function z(u,t){return u===void 0?t??"threshold":u?"color":"threshold"}function H(u,t,o){let{width:d,height:f,matrixSize:m,margin:p,filter:w,backgroundColor:y,backgroundAlpha:s}=o,C=o.gapColor,n=new Uint8ClampedArray(u),R=d/(m+p*2),S=Math.max(o.coreSize??.4,o.minCoreSize??0),F=(1-S)/2,N=(e,a)=>{if(!o.dotStyle||o.dotStyle==="square")return!0;if(o.dotStyle==="circle")return(e-.5)**2+(a-.5)**2<=S**2/4;let c=S*.28,l=Math.max(Math.abs(e-.5)-(S/2-c),0),r=Math.max(Math.abs(a-.5)-(S/2-c),0);return l**2+r**2<=c**2},D=(e,a)=>o.clear!==void 0&&e>=o.clear.x&&a>=o.clear.y&&e<o.clear.x+o.clear.width&&a<o.clear.y+o.clear.height,B=(e,a)=>e<8&&a<8||e>=m-8&&a<8||e<8&&a>=m-8,U=(e,a=u)=>{let c=a[e+3]/255,l=t[e+3]/255,r=c+l*(1-c),i=(Q,A)=>r===0?0:(Q*c+A*l*(1-c))/r;n[e]=i(a[e],t[e]),n[e+1]=i(a[e+1],t[e+1]),n[e+2]=i(a[e+2],t[e+2]),n[e+3]=r*255};for(let e=0;e<f;e+=1)for(let a=0;a<d;a+=1){let c=a/R-p,l=e/R-p,r=(e*d+a)*4;if(c<0||l<0||c>=m||l>=m){n[r]=t[r],n[r+1]=t[r+1],n[r+2]=t[r+2],n[r+3]=t[r+3];continue}let i=Math.floor(c),Q=Math.floor(l);if(D(c,l)){n[r]=y[0],n[r+1]=y[1],n[r+2]=y[2],n[r+3]=s;continue}if(B(i,Q)){U(r,o.transparentFinderBackground&&o.finderPixels?o.finderPixels:u);continue}let A=c-i,k=l-Q;if(A>=F&&A<1-F&&k>=F&&k<1-F&&N(A,k)){U(r);continue}if(C){let b=C[3]/255,g=t[r+3]/255,M=b+g*(1-b),I=(G,q)=>M===0?0:(G*b+q*g*(1-b))/M;n[r]=I(C[0],t[r]),n[r+1]=I(C[1],t[r+1]),n[r+2]=I(C[2],t[r+2]),n[r+3]=M*255;continue}let h=r;if(w==="color")n[r]=t[h],n[r+1]=t[h+1],n[r+2]=t[h+2];else{let b=t[h]*.2126+t[h+1]*.7152+t[h+2]*.0722;n[r]=b,n[r+1]=b,n[r+2]=b}n[r+3]=t[h+3]}return n}export{L as a,j as b,z as c,H as d};
|