function yt(it){return it&&it.__esModule&&Object.prototype.hasOwnProperty.call(it,"default")?it.default:it}var _t={exports:{}},xt=_t.exports,bt;function St(){return bt||(bt=1,(function(it,U){(function(J,nt){it.exports=nt()})(xt,(()=>(()=>{var J={873:(B,j)=>{var Q,ct,ot=(function(){var G=function(g,c){var h=g,e=tt[c],t=null,r=0,n=null,i=[],a={},w=function(o,d){t=(function(s){for(var u=new Array(s),l=0;l=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),l=0;l<15;l+=1){var b=!o&&(u>>l&1)==1;l<6?t[l][8]=b:l<8?t[l+1][8]=b:t[r-15+l][8]=b}for(l=0;l<15;l+=1)b=!o&&(u>>l&1)==1,l<8?t[8][r-l-1]=b:l<9?t[8][15-l-1+1]=b:t[8][15-l-1]=b;t[r-8][8]=!o},y=function(o,d){for(var s=-1,u=r-1,l=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>>l&1)==1),C(u,M-O)&&(D=!D),t[u][M-O]=D,(l-=1)==-1&&(b+=1,l=7)}if((u+=s)<0||r<=u){u-=s,s=-s;break}}},$=function(o,d,s){for(var u=lt.getRSBlocks(o,d),l=st(),b=0;b8*M)throw"code length overflow. ("+l.getLengthInBits()+">"+8*M+")";for(l.getLengthInBits()+4<=8*M&&l.put(0,4);l.getLengthInBits()%8!=0;)l.putBit(!1);for(;!(l.getLengthInBits()>=8*M||(l.put(236,8),l.getLengthInBits()>=8*M));)l.put(17,8);return(function(O,D){for(var q=0,L=0,E=0,P=new Array(D.length),z=new Array(D.length),x=0;x=0?H.getAt(T):0}}var vt=0;for(A=0;AD)&&(C=D,M=O)}return M})())},a.createTableTag=function(o,d){o=o||2;var s="";s+='";for(var l=0;l';s+=""}return(s+="")+"
"},a.createSvgTag=function(o,d,s,u){var l={};typeof arguments[0]=="object"&&(o=(l=arguments[0]).cellSize,d=l.margin,s=l.alt,u=l.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,q="";for(O="l"+o+",0 0,"+o+" -"+o+",0 0,-"+o+"z ",q+=''+S(u.text)+"":"",q+=s.text?''+S(s.text)+"":"",q+='',q+='"},a.createDataURL=function(o,d){o=o||2,d=d===void 0?4*o:d;var s=a.getModuleCount()*o+2*d,u=d,l=s-d;return ht(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(P){P=P===void 0?2:P;var z,x,I,R,A,X=1*a.getModuleCount()+2*P,H=P,T=X-P,vt={"██":"█","█ ":"▀"," █":"▄"," ":" "},dt={"██":"▀","█ ":"▀"," █":" "," ":" "},V="";for(z=0;z=T?dt[A]:vt[A];V+=` `}return X%2&&P>0?V.substring(0,V.length-X-1)+Array(X+1).join("▀"):V.substring(0,V.length-1)})(d);o-=1,d=d===void 0?2*o:d;var s,u,l,b,C=a.getModuleCount()*o+2*d,M=d,O=C-d,D=Array(o+1).join("██"),q=Array(o+1).join(" "),L="",E="";for(s=0;s>>8),r.push(255&a)):r.push(e)}}return r}};var rt,Z,Y,k,K,tt={L:1,M:0,Q:3,H:2},N=(rt=[[],[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]],Z=1335,Y=7973,K=function(g){for(var c=0;g!=0;)c+=1,g>>>=1;return c},(k={}).getBCHTypeInfo=function(g){for(var c=g<<10;K(c)-K(Z)>=0;)c^=Z<=0;)c^=Y<5&&(h+=3+r-5)}for(e=0;e=256;)e-=255;return g[e]}}})();function et(g,c){if(g.length===void 0)throw g.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);g.length<=t&&g.push(0),e&&(g[t]|=128>>>c%8),c+=1}};return h},gt=function(g){var c=g,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+=g[e];return h+"]"}};return c},mt=function(g){var c=g,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},ht=function(g,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)}});q.write(d,u);var L=0,E=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?Z.push(224|k>>12,128|k>>6&63,128|63&k):(Y++,k=65536+((1023&k)<<10|1023&rt.charCodeAt(Y)),Z.push(240|k>>18,128|k>>12&63,128|k>>6&63,128|63&k))}return Z})(G)},(ct=typeof(Q=function(){return ot})=="function"?Q.apply(j,[]):Q)===void 0||(B.exports=ct)}},nt={};function W(B){var j=nt[B];if(j!==void 0)return j.exports;var Q=nt[B]={exports:{}};return J[B](Q,Q.exports,W),Q.exports}W.n=B=>{var j=B&&B.__esModule?()=>B.default:()=>B;return W.d(j,{a:j}),j},W.d=(B,j)=>{for(var Q in j)W.o(j,Q)&&!W.o(B,Q)&&Object.defineProperty(B,Q,{enumerable:!0,get:j[Q]})},W.o=(B,j)=>Object.prototype.hasOwnProperty.call(B,j);var ut={};return(()=>{W.d(ut,{default:()=>c});const B=h=>!!h&&typeof h=="object"&&!Array.isArray(h);function j(h,...e){if(!e.length)return h;const t=e.shift();return t!==void 0&&B(h)&&B(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:B(n)&&B(i)?h[r]=j(Object.assign({},n),i):h[r]=i})),j(h,...e)):h}function Q(h,e){const t=document.createElement("a");t.download=e,t.href=h,document.body.appendChild(t),t.click(),document.body.removeChild(t)}const ct={L:.07,M:.15,Q:.25,H:.3};class ot{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 G={dot:"dot",square:"square",extraRounded:"extra-rounded"},rt=Object.values(G);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;switch(this._type){case G.square:i=this._drawSquare;break;case G.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 Y={dot:"dot",square:"square"},k=Object.values(Y);class K{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===Y.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 tt="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 et{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=et.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===tt?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*ct[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===tt?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 ot({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===tt){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+l])})),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===tt?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,l,b,C,M,O,D,q,L;const E=_+m*a*(r-7),P=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:E,y:P,height:w,width:w,name:`corners-square-color-${m}-${v}-${this._instanceId}`})),((s=t.cornersSquareOptions)===null||s===void 0?void 0:s.type)&&rt.includes(t.cornersSquareOptions.type)){const I=new Z({svg:this._element,type:t.cornersSquareOptions.type,window:this._window});I.draw(E,P,w,y),I._element&&z&&z.appendChild(I._element)}else{const I=new ot({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+X])})),I._element&&z&&z.appendChild(I._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:E+2*a,y:P+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 I=new K({svg:this._element,type:t.cornersDotOptions.type,window:this._window});I.draw(E+2*a,P+2*a,f,y),I._element&&x&&x.appendChild(I._element)}else{const I=new ot({svg:this._element,type:((q=t.cornersDotOptions)===null||q===void 0?void 0:q.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+X])})),I._element&&x&&x.appendChild(I._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?.getContext("2d"))===null||w===void 0||w.drawImage(i,0,0),this._imageUri=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("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)}}et.instanceCount=0;const lt=et,st="canvas",gt={};for(let h=0;h<=40;h++)gt[h]=h;const ft={type:st,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:gt[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 at(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 wt(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=at(e.dotsOptions.gradient)),e.cornersSquareOptions&&(e.cornersSquareOptions=Object.assign({},e.cornersSquareOptions),e.cornersSquareOptions.gradient&&(e.cornersSquareOptions.gradient=at(e.cornersSquareOptions.gradient))),e.cornersDotOptions&&(e.cornersDotOptions=Object.assign({},e.cornersDotOptions),e.cornersDotOptions.gradient&&(e.cornersDotOptions.gradient=at(e.cornersDotOptions.gradient))),e.backgroundOptions&&(e.backgroundOptions=Object.assign({},e.backgroundOptions),e.backgroundOptions.gradient&&(e.backgroundOptions.gradient=at(e.backgroundOptions.gradient))),e}var pt=W(873),mt=W.n(pt);function ht(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 g{constructor(e){e?.jsdom?this._window=new e.jsdom("",{resources:"usable"}).window:this._window=window,this._options=e?wt(j(ft,e)):ft,this.update()}static _clearContainer(e){e&&(e.innerHTML="")}_setupSvg(){if(!this._qr)return;const e=new lt(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:${ht("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){g._clearContainer(this._container),this._options=e?wt(j(this._options,e)):this._options,this._options.data&&(this._qr=mt()(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===st?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===st?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=ht(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?Buffer.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,Q(`data:${ht(t)};charset=utf-8,${encodeURIComponent(i)}`,`${r}.svg`)}else Q(n.toDataURL(ht(t)),`${r}.${t}`)}}const c=g})(),ut.default})()))})(_t)),_t.exports}var Ct=St();const At=yt(Ct),Mt=At;class $t extends HTMLElement{connectedCallback(){if(this.url=this.getQrCodeUrl(),!this.url){console.error("[photos-qr-code] missing required attr: url");return}this.imageWidth=this.getNumberAttr("image-width")||300,this.imageHeight=this.getNumberAttr("image-height")||300,this.init()}init(){this.renderQRCode()}renderQRCode(){const U=this.getAttribute("logo-url");new Mt({width:this.imageWidth,height:this.imageHeight,margin:Math.floor(10/300*this.imageWidth),type:"svg",data:this.url,image:U,imageOptions:{margin:Math.floor(10/300*this.imageWidth)},dotsOptions:{type:"square",color:"#000000",roundSize:!0},backgroundOptions:{round:0,color:"#ffffff"}}).append(this)}getQrCodeUrl(){let U=this.getAttribute("url");if(!U)return"";if(U.includes("/photos/download")){const J=new URL(U),nt=new URLSearchParams(window.location.search);let W=!1;nt.forEach((ut,B)=>{B.startsWith("utm_")&&(J.searchParams.set(B,ut),W=!0)}),W&&(J.hostname="www.google.com",J.pathname="/photos/download/",U=J.toString(),this.setAttribute("url",U))}return U}getSlotElement(U){return this.querySelector(`[data-slot="${U}"]`)}getSlotElements(U){return Array.from(this.querySelectorAll(`[data-slot="${U}"]`))}getNumberAttr(U){const J=this.getAttribute(U);return J?window.parseInt(J):0}}customElements.get("photos-qr-code")||customElements.define("photos-qr-code",$t);