import{af as bt,B as yt}from"./main-D6qyxymd.js";var ft={exports:{}},xt=ft.exports,_t;function St(){return _t||(_t=1,(function(mt,Mt){(function(pt,st){mt.exports=st()})(xt,(()=>(()=>{var pt={873:(j,E)=>{var U,at,et=(function(){var Y=function(l,c){var h=l,e=K[c],t=null,r=0,n=null,i=[],a={},w=function(o,d){t=(function(s){for(var u=new Array(s),g=0;g=7&&m(o),n==null&&(n=$(h,e,i)),y(n,d)},f=function(o,d){for(var s=-1;s<=7;s+=1)if(!(o+s<=-1||r<=o+s))for(var u=-1;u<=7;u+=1)d+u<=-1||r<=d+u||(t[o+s][d+u]=0<=s&&s<=6&&(u==0||u==6)||0<=u&&u<=6&&(s==0||s==6)||2<=s&&s<=4&&2<=u&&u<=4)},_=function(){for(var o=8;o>s&1)==1;t[Math.floor(s/3)][s%3+r-8-3]=u}for(s=0;s<18;s+=1)u=!o&&(d>>s&1)==1,t[s%3+r-8-3][Math.floor(s/3)]=u},v=function(o,d){for(var s=e<<3|d,u=N.getBCHTypeInfo(s),g=0;g<15;g+=1){var b=!o&&(u>>g&1)==1;g<6?t[g][8]=b:g<8?t[g+1][8]=b:t[r-15+g][8]=b}for(g=0;g<15;g+=1)b=!o&&(u>>g&1)==1,g<8?t[8][r-g-1]=b:g<9?t[8][15-g-1+1]=b:t[8][15-g-1]=b;t[r-8][8]=!o},y=function(o,d){for(var s=-1,u=r-1,g=7,b=0,C=N.getMaskFunction(d),M=r-1;M>0;M-=2)for(M==6&&(M-=1);;){for(var O=0;O<2;O+=1)if(t[u][M-O]==null){var D=!1;b>>g&1)==1),C(u,M-O)&&(D=!D),t[u][M-O]=D,(g-=1)==-1&&(b+=1,g=7)}if((u+=s)<0||r<=u){u-=s,s=-s;break}}},$=function(o,d,s){for(var u=ht.getRSBlocks(o,d),g=it(),b=0;b8*M)throw"code length overflow. ("+g.getLengthInBits()+">"+8*M+")";for(g.getLengthInBits()+4<=8*M&&g.put(0,4);g.getLengthInBits()%8!=0;)g.putBit(!1);for(;!(g.getLengthInBits()>=8*M||(g.put(236,8),g.getLengthInBits()>=8*M));)g.put(17,8);return(function(O,D){for(var B=0,L=0,I=0,q=new Array(D.length),z=new Array(D.length),x=0;x=0?H.getAt(T):0}}var lt=0;for(A=0;AD)&&(C=D,M=O)}return M})())},a.createTableTag=function(o,d){o=o||2;var s="";s+='";for(var g=0;g';s+=""}return(s+="")+"
"},a.createSvgTag=function(o,d,s,u){var g={};typeof arguments[0]=="object"&&(o=(g=arguments[0]).cellSize,d=g.margin,s=g.alt,u=g.title),o=o||2,d=d===void 0?4*o:d,(s=typeof s=="string"?{text:s}:s||{}).text=s.text||null,s.id=s.text?s.id||"qrcode-description":null,(u=typeof u=="string"?{text:u}:u||{}).text=u.text||null,u.id=u.text?u.id||"qrcode-title":null;var b,C,M,O,D=a.getModuleCount()*o+2*d,B="";for(O="l"+o+",0 0,"+o+" -"+o+",0 0,-"+o+"z ",B+=''+S(u.text)+"":"",B+=s.text?''+S(s.text)+"":"",B+='',B+='"},a.createDataURL=function(o,d){o=o||2,d=d===void 0?4*o:d;var s=a.getModuleCount()*o+2*d,u=d,g=s-d;return nt(s,s,(function(b,C){if(u<=b&&b"};var S=function(o){for(var d="",s=0;s":d+=">";break;case"&":d+="&";break;case'"':d+=""";break;default:d+=u}}return d};return a.createASCII=function(o,d){if((o=o||1)<2)return(function(q){q=q===void 0?2:q;var z,x,P,R,A,Q=1*a.getModuleCount()+2*q,H=q,T=Q-q,lt={"██":"█","█ ":"▀"," █":"▄"," ":" "},ot={"██":"▀","█ ":"▀"," █":" "," ":" "},W="";for(z=0;z=T?ot[A]:lt[A];W+=` `}return Q%2&&q>0?W.substring(0,W.length-Q-1)+Array(Q+1).join("▀"):W.substring(0,W.length-1)})(d);o-=1,d=d===void 0?2*o:d;var s,u,g,b,C=a.getModuleCount()*o+2*d,M=d,O=C-d,D=Array(o+1).join("██"),B=Array(o+1).join(" "),L="",I="";for(s=0;s>>8),r.push(255&a)):r.push(e)}}return r}};var tt,G,X,k,Z,K={L:1,M:0,Q:3,H:2},N=(tt=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G=1335,X=7973,Z=function(l){for(var c=0;l!=0;)c+=1,l>>>=1;return c},(k={}).getBCHTypeInfo=function(l){for(var c=l<<10;Z(c)-Z(G)>=0;)c^=G<=0;)c^=X<5&&(h+=3+r-5)}for(e=0;e=256;)e-=255;return l[e]}}})();function V(l,c){if(l.length===void 0)throw l.length+"/"+c;var h=(function(){for(var t=0;t>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return c},putBit:function(e){var t=Math.floor(c/8);l.length<=t&&l.push(0),e&&(l[t]|=128>>>c%8),c+=1}};return h},dt=function(l){var c=l,h={getMode:function(){return 1},getLength:function(r){return c.length},write:function(r){for(var n=c,i=0;i+2>>8&255)+(255&i),t.put(i,13),n+=2}if(n>>8)},writeBytes:function(h,e,t){e=e||0,t=t||h.length;for(var r=0;r0&&(h+=","),h+=l[e];return h+"]"}};return c},wt=function(l){var c=l,h=0,e=0,t=0,r={read:function(){for(;t<8;){if(h>=c.length){if(t==0)return-1;throw"unexpected end of file./"+t}var i=c.charAt(h);if(h+=1,i=="=")return t=0,-1;i.match(/^\s$/)||(e=e<<6|n(i.charCodeAt(0)),t+=6)}var a=e>>>t-8&255;return t-=8,a}},n=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw"c:"+i};return r},nt=function(l,c,h){for(var e=(function(f,_){var p=f,m=_,v=new Array(f*_),y={setPixel:function(o,d,s){v[d*p+o]=s},write:function(o){o.writeString("GIF87a"),o.writeShort(p),o.writeShort(m),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(0),o.writeByte(0),o.writeByte(0),o.writeByte(255),o.writeByte(255),o.writeByte(255),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(p),o.writeShort(m),o.writeByte(0);var d=$(2);o.writeByte(2);for(var s=0;d.length-s>255;)o.writeByte(255),o.writeBytes(d,s,255),s+=255;o.writeByte(d.length-s),o.writeBytes(d,s,d.length-s),o.writeByte(0),o.writeString(";")}},$=function(o){for(var d=1<>>x)throw"length over";for(;M+x>=8;)C.writeByte(255&(z<>>=8-M,O=0,M=0;O|=z<0&&C.writeByte(O)}});B.write(d,u);var L=0,I=String.fromCharCode(v[L]);for(L+=1;L=6;)y(f>>>_-6),_-=6},v.flush=function(){if(_>0&&(y(f<<6-_),f=0,_=0),p%3!=0)for(var S=3-p%3,o=0;o>6,128|63&k):k<55296||k>=57344?G.push(224|k>>12,128|k>>6&63,128|63&k):(X++,k=65536+((1023&k)<<10|1023&tt.charCodeAt(X)),G.push(240|k>>18,128|k>>12&63,128|k>>6&63,128|63&k))}return G})(Y)},(at=typeof(U=function(){return et})=="function"?U.apply(E,[]):U)===void 0||(j.exports=at)}},st={};function J(j){var E=st[j];if(E!==void 0)return E.exports;var U=st[j]={exports:{}};return pt[j](U,U.exports,J),U.exports}J.n=j=>{var E=j&&j.__esModule?()=>j.default:()=>j;return J.d(E,{a:E}),E},J.d=(j,E)=>{for(var U in E)J.o(E,U)&&!J.o(j,U)&&Object.defineProperty(j,U,{enumerable:!0,get:E[U]})},J.o=(j,E)=>Object.prototype.hasOwnProperty.call(j,E);var vt={};return(()=>{J.d(vt,{default:()=>c});const j=h=>!!h&&typeof h=="object"&&!Array.isArray(h);function E(h,...e){if(!e.length)return h;const t=e.shift();return t!==void 0&&j(h)&&j(t)?(h=Object.assign({},h),Object.keys(t).forEach((r=>{const n=h[r],i=t[r];Array.isArray(n)&&Array.isArray(i)?h[r]=i:j(n)&&j(i)?h[r]=E(Object.assign({},n),i):h[r]=i})),E(h,...e)):h}function U(h,e){const t=document.createElement("a");t.download=e,t.href=h,document.body.appendChild(t),t.click(),document.body.removeChild(t)}const at={L:.07,M:.15,Q:.25,H:.3};class et{constructor({svg:e,type:t,window:r}){this._svg=e,this._type=t,this._window=r}draw(e,t,r,n){let i;switch(this._type){case"dots":i=this._drawDot;break;case"classy":i=this._drawClassy;break;case"classy-rounded":i=this._drawClassyRounded;break;case"rounded":i=this._drawRounded;break;case"extra-rounded":i=this._drawExtraRounded;break;default:i=this._drawSquare}i.call(this,{x:e,y:t,size:r,getNeighbor:n})}_rotateFigure({x:e,y:t,size:r,rotation:n=0,draw:i}){var a;const w=e+r/2,f=t+r/2;i(),(a=this._element)===null||a===void 0||a.setAttribute("transform",`rotate(${180*n/Math.PI},${w},${f})`)}_basicDot(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(r+t/2)),this._element.setAttribute("cy",String(n+t/2)),this._element.setAttribute("r",String(t/2))}}))}_basicSquare(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(r)),this._element.setAttribute("y",String(n)),this._element.setAttribute("width",String(t)),this._element.setAttribute("height",String(t))}}))}_basicSideRounded(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${n}v ${t}h `+t/2+`a ${t/2} ${t/2}, 0, 0, 0, 0 ${-t}`)}}))}_basicCornerRounded(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${n}v ${t}h ${t}v `+-t/2+`a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`)}}))}_basicCornerExtraRounded(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${n}v ${t}h ${t}a ${t} ${t}, 0, 0, 0, ${-t} ${-t}`)}}))}_basicCornersRounded(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${r} ${n}v `+t/2+`a ${t/2} ${t/2}, 0, 0, 0, ${t/2} ${t/2}h `+t/2+"v "+-t/2+`a ${t/2} ${t/2}, 0, 0, 0, ${-t/2} ${-t/2}`)}}))}_drawDot({x:e,y:t,size:r}){this._basicDot({x:e,y:t,size:r,rotation:0})}_drawSquare({x:e,y:t,size:r}){this._basicSquare({x:e,y:t,size:r,rotation:0})}_drawRounded({x:e,y:t,size:r,getNeighbor:n}){const i=n?+n(-1,0):0,a=n?+n(1,0):0,w=n?+n(0,-1):0,f=n?+n(0,1):0,_=i+a+w+f;if(_!==0)if(_>2||i&&a||w&&f)this._basicSquare({x:e,y:t,size:r,rotation:0});else{if(_===2){let p=0;return i&&w?p=Math.PI/2:w&&a?p=Math.PI:a&&f&&(p=-Math.PI/2),void this._basicCornerRounded({x:e,y:t,size:r,rotation:p})}if(_===1){let p=0;return w?p=Math.PI/2:a?p=Math.PI:f&&(p=-Math.PI/2),void this._basicSideRounded({x:e,y:t,size:r,rotation:p})}}else this._basicDot({x:e,y:t,size:r,rotation:0})}_drawExtraRounded({x:e,y:t,size:r,getNeighbor:n}){const i=n?+n(-1,0):0,a=n?+n(1,0):0,w=n?+n(0,-1):0,f=n?+n(0,1):0,_=i+a+w+f;if(_!==0)if(_>2||i&&a||w&&f)this._basicSquare({x:e,y:t,size:r,rotation:0});else{if(_===2){let p=0;return i&&w?p=Math.PI/2:w&&a?p=Math.PI:a&&f&&(p=-Math.PI/2),void this._basicCornerExtraRounded({x:e,y:t,size:r,rotation:p})}if(_===1){let p=0;return w?p=Math.PI/2:a?p=Math.PI:f&&(p=-Math.PI/2),void this._basicSideRounded({x:e,y:t,size:r,rotation:p})}}else this._basicDot({x:e,y:t,size:r,rotation:0})}_drawClassy({x:e,y:t,size:r,getNeighbor:n}){const i=n?+n(-1,0):0,a=n?+n(1,0):0,w=n?+n(0,-1):0,f=n?+n(0,1):0;i+a+w+f!==0?i||w?a||f?this._basicSquare({x:e,y:t,size:r,rotation:0}):this._basicCornerRounded({x:e,y:t,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:e,y:t,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:t,size:r,rotation:Math.PI/2})}_drawClassyRounded({x:e,y:t,size:r,getNeighbor:n}){const i=n?+n(-1,0):0,a=n?+n(1,0):0,w=n?+n(0,-1):0,f=n?+n(0,1):0;i+a+w+f!==0?i||w?a||f?this._basicSquare({x:e,y:t,size:r,rotation:0}):this._basicCornerExtraRounded({x:e,y:t,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:e,y:t,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:t,size:r,rotation:Math.PI/2})}}const Y={dot:"dot",square:"square",extraRounded:"extra-rounded"},tt=Object.values(Y);class G{constructor({svg:e,type:t,window:r}){this._svg=e,this._type=t,this._window=r}draw(e,t,r,n){let i;switch(this._type){case Y.square:i=this._drawSquare;break;case Y.extraRounded:i=this._drawExtraRounded;break;default:i=this._drawDot}i.call(this,{x:e,y:t,size:r,rotation:n})}_rotateFigure({x:e,y:t,size:r,rotation:n=0,draw:i}){var a;const w=e+r/2,f=t+r/2;i(),(a=this._element)===null||a===void 0||a.setAttribute("transform",`rotate(${180*n/Math.PI},${w},${f})`)}_basicDot(e){const{size:t,x:r,y:n}=e,i=t/7;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r+t/2} ${n}a ${t/2} ${t/2} 0 1 0 0.1 0zm 0 ${i}a ${t/2-i} ${t/2-i} 0 1 1 -0.1 0Z`)}}))}_basicSquare(e){const{size:t,x:r,y:n}=e,i=t/7;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r} ${n}v ${t}h ${t}v `+-t+`zM ${r+i} ${n+i}h `+(t-2*i)+"v "+(t-2*i)+"h "+(2*i-t)+"z")}}))}_basicExtraRounded(e){const{size:t,x:r,y:n}=e,i=t/7;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${r} ${n+2.5*i}v `+2*i+`a ${2.5*i} ${2.5*i}, 0, 0, 0, ${2.5*i} ${2.5*i}h `+2*i+`a ${2.5*i} ${2.5*i}, 0, 0, 0, ${2.5*i} ${2.5*-i}v `+-2*i+`a ${2.5*i} ${2.5*i}, 0, 0, 0, ${2.5*-i} ${2.5*-i}h `+-2*i+`a ${2.5*i} ${2.5*i}, 0, 0, 0, ${2.5*-i} ${2.5*i}M ${r+2.5*i} ${n+i}h `+2*i+`a ${1.5*i} ${1.5*i}, 0, 0, 1, ${1.5*i} ${1.5*i}v `+2*i+`a ${1.5*i} ${1.5*i}, 0, 0, 1, ${1.5*-i} ${1.5*i}h `+-2*i+`a ${1.5*i} ${1.5*i}, 0, 0, 1, ${1.5*-i} ${1.5*-i}v `+-2*i+`a ${1.5*i} ${1.5*i}, 0, 0, 1, ${1.5*i} ${1.5*-i}`)}}))}_drawDot({x:e,y:t,size:r,rotation:n}){this._basicDot({x:e,y:t,size:r,rotation:n})}_drawSquare({x:e,y:t,size:r,rotation:n}){this._basicSquare({x:e,y:t,size:r,rotation:n})}_drawExtraRounded({x:e,y:t,size:r,rotation:n}){this._basicExtraRounded({x:e,y:t,size:r,rotation:n})}}const X={dot:"dot",square:"square"},k=Object.values(X);class Z{constructor({svg:e,type:t,window:r}){this._svg=e,this._type=t,this._window=r}draw(e,t,r,n){let i;i=this._type===X.square?this._drawSquare:this._drawDot,i.call(this,{x:e,y:t,size:r,rotation:n})}_rotateFigure({x:e,y:t,size:r,rotation:n=0,draw:i}){var a;const w=e+r/2,f=t+r/2;i(),(a=this._element)===null||a===void 0||a.setAttribute("transform",`rotate(${180*n/Math.PI},${w},${f})`)}_basicDot(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(r+t/2)),this._element.setAttribute("cy",String(n+t/2)),this._element.setAttribute("r",String(t/2))}}))}_basicSquare(e){const{size:t,x:r,y:n}=e;this._rotateFigure(Object.assign(Object.assign({},e),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(r)),this._element.setAttribute("y",String(n)),this._element.setAttribute("width",String(t)),this._element.setAttribute("height",String(t))}}))}_drawDot({x:e,y:t,size:r,rotation:n}){this._basicDot({x:e,y:t,size:r,rotation:n})}_drawSquare({x:e,y:t,size:r,rotation:n}){this._basicSquare({x:e,y:t,size:r,rotation:n})}}const K="circle",N=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],F=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class V{constructor(e,t){this._roundSize=r=>this._options.dotsOptions.roundSize?Math.floor(r):r,this._window=t,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(e.width)),this._element.setAttribute("height",String(e.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),e.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=e.image,this._instanceId=V.instanceCount++,this._options=e}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(e){const t=e.getModuleCount(),r=Math.min(this._options.width,this._options.height)-2*this._options.margin,n=this._options.shape===K?r/Math.sqrt(2):r,i=this._roundSize(n/t);let a={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=e,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:w,qrOptions:f}=this._options,_=w.imageSize*at[f.errorCorrectionLevel],p=Math.floor(_*t*t);a=(function({originalHeight:m,originalWidth:v,maxHiddenDots:y,maxHiddenAxisDots:$,dotSize:S}){const o={x:0,y:0},d={x:0,y:0};if(m<=0||v<=0||y<=0||S<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const s=m/v;return o.x=Math.floor(Math.sqrt(y/s)),o.x<=0&&(o.x=1),$&&$y||$&&${var _,p,m,v,y,$;return!(this._options.imageOptions.hideBackgroundDots&&w>=(t-a.hideYDots)/2&&w<(t+a.hideYDots)/2&&f>=(t-a.hideXDots)/2&&f<(t+a.hideXDots)/2||!((_=N[w])===null||_===void 0)&&_[f]||!((p=N[w-t+7])===null||p===void 0)&&p[f]||!((m=N[w])===null||m===void 0)&&m[f-t+7]||!((v=F[w])===null||v===void 0)&&v[f]||!((y=F[w-t+7])===null||y===void 0)&&y[f]||!(($=F[w])===null||$===void 0)&&$[f-t+7])})),this.drawCorners(),this._options.image&&await this.drawImage({width:a.width,height:a.height,count:t,dotSize:i})}drawBackground(){var e,t,r;const n=this._element,i=this._options;if(n){const a=(e=i.backgroundOptions)===null||e===void 0?void 0:e.gradient,w=(t=i.backgroundOptions)===null||t===void 0?void 0:t.color;let f=i.height,_=i.width;if(a||w){const p=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((r=i.backgroundOptions)===null||r===void 0)&&r.round&&(f=_=Math.min(i.width,i.height),p.setAttribute("rx",String(f/2*i.backgroundOptions.round))),p.setAttribute("x",String(this._roundSize((i.width-_)/2))),p.setAttribute("y",String(this._roundSize((i.height-f)/2))),p.setAttribute("width",String(_)),p.setAttribute("height",String(f)),this._backgroundClipPath.appendChild(p),this._createColor({options:a,color:w,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:`background-color-${this._instanceId}`})}}}drawDots(e){var t,r;if(!this._qr)throw"QR code is not defined";const n=this._options,i=this._qr.getModuleCount();if(i>n.width||i>n.height)throw"The canvas is too small.";const a=Math.min(n.width,n.height)-2*n.margin,w=n.shape===K?a/Math.sqrt(2):a,f=this._roundSize(w/i),_=this._roundSize((n.width-i*f)/2),p=this._roundSize((n.height-i*f)/2),m=new et({svg:this._element,type:n.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(t=n.dotsOptions)===null||t===void 0?void 0:t.gradient,color:n.dotsOptions.color,additionalRotation:0,x:0,y:0,height:n.height,width:n.width,name:`dot-color-${this._instanceId}`});for(let v=0;v!(y+$<0||v+S<0||y+$>=i||v+S>=i)&&!(e&&!e(v+S,y+$))&&!!this._qr&&this._qr.isDark(v+S,y+$))),m._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(m._element));if(n.shape===K){const v=this._roundSize((a/f-i)/2),y=i+2*v,$=_-v*f,S=p-v*f,o=[],d=this._roundSize(y/2);for(let s=0;s=v-1&&s<=y-v&&u>=v-1&&u<=y-v||Math.sqrt((s-d)*(s-d)+(u-d)*(u-d))>d?o[s][u]=0:o[s][u]=this._qr.isDark(u-2*v<0?u:u>=i?u-2*v:u-v,s-2*v<0?s:s>=i?s-2*v:s-v)?1:0}for(let s=0;s{var C;return!!(!((C=o[s+b])===null||C===void 0)&&C[u+g])})),m._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(m._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const e=this._element,t=this._options;if(!e)throw"Element code is not defined";const r=this._qr.getModuleCount(),n=Math.min(t.width,t.height)-2*t.margin,i=t.shape===K?n/Math.sqrt(2):n,a=this._roundSize(i/r),w=7*a,f=3*a,_=this._roundSize((t.width-r*a)/2),p=this._roundSize((t.height-r*a)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach((([m,v,y])=>{var $,S,o,d,s,u,g,b,C,M,O,D,B,L;const I=_+m*a*(r-7),q=p+v*a*(r-7);let z=this._dotsClipPath,x=this._dotsClipPath;if((!(($=t.cornersSquareOptions)===null||$===void 0)&&$.gradient||!((S=t.cornersSquareOptions)===null||S===void 0)&&S.color)&&(z=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),z.setAttribute("id",`clip-path-corners-square-color-${m}-${v}-${this._instanceId}`),this._defs.appendChild(z),this._cornersSquareClipPath=this._cornersDotClipPath=x=z,this._createColor({options:(o=t.cornersSquareOptions)===null||o===void 0?void 0:o.gradient,color:(d=t.cornersSquareOptions)===null||d===void 0?void 0:d.color,additionalRotation:y,x:I,y:q,height:w,width:w,name:`corners-square-color-${m}-${v}-${this._instanceId}`})),((s=t.cornersSquareOptions)===null||s===void 0?void 0:s.type)&&tt.includes(t.cornersSquareOptions.type)){const P=new G({svg:this._element,type:t.cornersSquareOptions.type,window:this._window});P.draw(I,q,w,y),P._element&&z&&z.appendChild(P._element)}else{const P=new et({svg:this._element,type:((u=t.cornersSquareOptions)===null||u===void 0?void 0:u.type)||t.dotsOptions.type,window:this._window});for(let R=0;R{var T;return!!(!((T=N[R+H])===null||T===void 0)&&T[A+Q])})),P._element&&z&&z.appendChild(P._element))}if((!((b=t.cornersDotOptions)===null||b===void 0)&&b.gradient||!((C=t.cornersDotOptions)===null||C===void 0)&&C.color)&&(x=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),x.setAttribute("id",`clip-path-corners-dot-color-${m}-${v}-${this._instanceId}`),this._defs.appendChild(x),this._cornersDotClipPath=x,this._createColor({options:(M=t.cornersDotOptions)===null||M===void 0?void 0:M.gradient,color:(O=t.cornersDotOptions)===null||O===void 0?void 0:O.color,additionalRotation:y,x:I+2*a,y:q+2*a,height:f,width:f,name:`corners-dot-color-${m}-${v}-${this._instanceId}`})),((D=t.cornersDotOptions)===null||D===void 0?void 0:D.type)&&k.includes(t.cornersDotOptions.type)){const P=new Z({svg:this._element,type:t.cornersDotOptions.type,window:this._window});P.draw(I+2*a,q+2*a,f,y),P._element&&x&&x.appendChild(P._element)}else{const P=new et({svg:this._element,type:((B=t.cornersDotOptions)===null||B===void 0?void 0:B.type)||t.dotsOptions.type,window:this._window});for(let R=0;R{var T;return!!(!((T=F[R+H])===null||T===void 0)&&T[A+Q])})),P._element&&x&&x.appendChild(P._element))}}))}loadImage(){return new Promise(((e,t)=>{var r;const n=this._options;if(!n.image)return t("Image is not defined");if(!((r=n.nodeCanvas)===null||r===void 0)&&r.loadImage)n.nodeCanvas.loadImage(n.image).then((i=>{var a,w;if(this._image=i,this._options.imageOptions.saveAsBlob){const f=(a=n.nodeCanvas)===null||a===void 0?void 0:a.createCanvas(this._image.width,this._image.height);(w=f==null?void 0:f.getContext("2d"))===null||w===void 0||w.drawImage(i,0,0),this._imageUri=f==null?void 0:f.toDataURL()}e()})).catch(t);else{const i=new this._window.Image;typeof n.imageOptions.crossOrigin=="string"&&(i.crossOrigin=n.imageOptions.crossOrigin),this._image=i,i.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await(async function(a,w){return new Promise((f=>{const _=new w.XMLHttpRequest;_.onload=function(){const p=new w.FileReader;p.onloadend=function(){f(p.result)},p.readAsDataURL(_.response)},_.open("GET",a),_.responseType="blob",_.send()}))})(n.image||"",this._window)),e()},i.src=n.image}}))}async drawImage({width:e,height:t,count:r,dotSize:n}){const i=this._options,a=this._roundSize((i.width-r*n)/2),w=this._roundSize((i.height-r*n)/2),f=a+this._roundSize(i.imageOptions.margin+(r*n-e)/2),_=w+this._roundSize(i.imageOptions.margin+(r*n-t)/2),p=e-2*i.imageOptions.margin,m=t-2*i.imageOptions.margin,v=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");v.setAttribute("href",this._imageUri||""),v.setAttribute("xlink:href",this._imageUri||""),v.setAttribute("x",String(f)),v.setAttribute("y",String(_)),v.setAttribute("width",`${p}px`),v.setAttribute("height",`${m}px`),this._element.appendChild(v)}_createColor({options:e,color:t,additionalRotation:r,x:n,y:i,height:a,width:w,name:f}){const _=w>a?w:a,p=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(p.setAttribute("x",String(n)),p.setAttribute("y",String(i)),p.setAttribute("height",String(a)),p.setAttribute("width",String(w)),p.setAttribute("clip-path",`url('#clip-path-${f}')`),e){let m;if(e.type==="radial")m=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),m.setAttribute("id",f),m.setAttribute("gradientUnits","userSpaceOnUse"),m.setAttribute("fx",String(n+w/2)),m.setAttribute("fy",String(i+a/2)),m.setAttribute("cx",String(n+w/2)),m.setAttribute("cy",String(i+a/2)),m.setAttribute("r",String(_/2));else{const v=((e.rotation||0)+r)%(2*Math.PI),y=(v+2*Math.PI)%(2*Math.PI);let $=n+w/2,S=i+a/2,o=n+w/2,d=i+a/2;y>=0&&y<=.25*Math.PI||y>1.75*Math.PI&&y<=2*Math.PI?($-=w/2,S-=a/2*Math.tan(v),o+=w/2,d+=a/2*Math.tan(v)):y>.25*Math.PI&&y<=.75*Math.PI?(S-=a/2,$-=w/2/Math.tan(v),d+=a/2,o+=w/2/Math.tan(v)):y>.75*Math.PI&&y<=1.25*Math.PI?($+=w/2,S+=a/2*Math.tan(v),o-=w/2,d-=a/2*Math.tan(v)):y>1.25*Math.PI&&y<=1.75*Math.PI&&(S+=a/2,$+=w/2/Math.tan(v),d-=a/2,o-=w/2/Math.tan(v)),m=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),m.setAttribute("id",f),m.setAttribute("gradientUnits","userSpaceOnUse"),m.setAttribute("x1",String(Math.round($))),m.setAttribute("y1",String(Math.round(S))),m.setAttribute("x2",String(Math.round(o))),m.setAttribute("y2",String(Math.round(d)))}e.colorStops.forEach((({offset:v,color:y})=>{const $=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");$.setAttribute("offset",100*v+"%"),$.setAttribute("stop-color",y),m.appendChild($)})),p.setAttribute("fill",`url('#${f}')`),this._defs.appendChild(m)}else t&&p.setAttribute("fill",t);this._element.appendChild(p)}}V.instanceCount=0;const ht=V,it="canvas",dt={};for(let h=0;h<=40;h++)dt[h]=h;const ut={type:it,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:dt[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function rt(h){const e=Object.assign({},h);if(!e.colorStops||!e.colorStops.length)throw"Field 'colorStops' is required in gradient";return e.rotation?e.rotation=Number(e.rotation):e.rotation=0,e.colorStops=e.colorStops.map((t=>Object.assign(Object.assign({},t),{offset:Number(t.offset)}))),e}function ct(h){const e=Object.assign({},h);return e.width=Number(e.width),e.height=Number(e.height),e.margin=Number(e.margin),e.imageOptions=Object.assign(Object.assign({},e.imageOptions),{hideBackgroundDots:!!e.imageOptions.hideBackgroundDots,imageSize:Number(e.imageOptions.imageSize),margin:Number(e.imageOptions.margin)}),e.margin>Math.min(e.width,e.height)&&(e.margin=Math.min(e.width,e.height)),e.dotsOptions=Object.assign({},e.dotsOptions),e.dotsOptions.gradient&&(e.dotsOptions.gradient=rt(e.dotsOptions.gradient)),e.cornersSquareOptions&&(e.cornersSquareOptions=Object.assign({},e.cornersSquareOptions),e.cornersSquareOptions.gradient&&(e.cornersSquareOptions.gradient=rt(e.cornersSquareOptions.gradient))),e.cornersDotOptions&&(e.cornersDotOptions=Object.assign({},e.cornersDotOptions),e.cornersDotOptions.gradient&&(e.cornersDotOptions.gradient=rt(e.cornersDotOptions.gradient))),e.backgroundOptions&&(e.backgroundOptions=Object.assign({},e.backgroundOptions),e.backgroundOptions.gradient&&(e.backgroundOptions.gradient=rt(e.backgroundOptions.gradient))),e}var gt=J(873),wt=J.n(gt);function nt(h){if(!h)throw new Error("Extension must be defined");h[0]==="."&&(h=h.substring(1));const e={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[h.toLowerCase()];if(!e)throw new Error(`Extension "${h}" is not supported`);return e}class l{constructor(e){e!=null&&e.jsdom?this._window=new e.jsdom("",{resources:"usable"}).window:this._window=window,this._options=e?ct(E(ut,e)):ut,this.update()}static _clearContainer(e){e&&(e.innerHTML="")}_setupSvg(){if(!this._qr)return;const e=new ht(this._options,this._window);this._svg=e.getElement(),this._svgDrawingPromise=e.drawQR(this._qr).then((()=>{var t;this._svg&&((t=this._extension)===null||t===void 0||t.call(this,e.getElement(),this._options))}))}_setupCanvas(){var e,t;this._qr&&(!((e=this._options.nodeCanvas)===null||e===void 0)&&e.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(t=this._svgDrawingPromise)===null||t===void 0?void 0:t.then((()=>{var r;if(!this._svg)return;const n=this._svg,i=new this._window.XMLSerializer().serializeToString(n),a=btoa(i),w=`data:${nt("svg")};base64,${a}`;if(!((r=this._options.nodeCanvas)===null||r===void 0)&&r.loadImage)return this._options.nodeCanvas.loadImage(w).then((f=>{var _,p;f.width=this._options.width,f.height=this._options.height,(p=(_=this._nodeCanvas)===null||_===void 0?void 0:_.getContext("2d"))===null||p===void 0||p.drawImage(f,0,0)}));{const f=new this._window.Image;return new Promise((_=>{f.onload=()=>{var p,m;(m=(p=this._domCanvas)===null||p===void 0?void 0:p.getContext("2d"))===null||m===void 0||m.drawImage(f,0,0),_()},f.src=w}))}})))}async _getElement(e="png"){if(!this._qr)throw"QR code is empty";return e.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(e){l._clearContainer(this._container),this._options=e?ct(E(this._options,e)):this._options,this._options.data&&(this._qr=wt()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||(function(t){switch(!0){case/^[0-9]*$/.test(t):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(t):return"Alphanumeric";default:return"Byte"}})(this._options.data)),this._qr.make(),this._options.type===it?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(e){if(e){if(typeof e.appendChild!="function")throw"Container should be a single DOM node";this._options.type===it?this._domCanvas&&e.appendChild(this._domCanvas):this._svg&&e.appendChild(this._svg),this._container=e}}applyExtension(e){if(!e)throw"Extension function should be defined.";this._extension=e,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(e="png"){if(!this._qr)throw"QR code is empty";const t=await this._getElement(e),r=nt(e);if(!t)return null;if(e.toLowerCase()==="svg"){const n=`\r ${new this._window.XMLSerializer().serializeToString(t)}`;return typeof Blob>"u"||this._options.jsdom?bt.from(n):new Blob([n],{type:r})}return new Promise((n=>{const i=t;if("toBuffer"in i)if(r==="image/png")n(i.toBuffer(r));else if(r==="image/jpeg")n(i.toBuffer(r));else{if(r!=="application/pdf")throw Error("Unsupported extension");n(i.toBuffer(r))}else"toBlob"in i&&i.toBlob(n,r,1)}))}async download(e){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let t="png",r="qr";typeof e=="string"?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof e=="object"&&e!==null&&(e.name&&(r=e.name),e.extension&&(t=e.extension));const n=await this._getElement(t);if(n)if(t.toLowerCase()==="svg"){let i=new XMLSerializer().serializeToString(n);i=`\r `+i,U(`data:${nt(t)};charset=utf-8,${encodeURIComponent(i)}`,`${r}.svg`)}else U(n.toDataURL(nt(t)),`${r}.${t}`)}}const c=l})(),vt.default})()))})(ft)),ft.exports}var Ct=St();const At=yt(Ct),Ot=Object.freeze(Object.defineProperty({__proto__:null,default:At},Symbol.toStringTag,{value:"Module"}));export{Ot as q};