6 lines
47 KiB
JavaScript
6 lines
47 KiB
JavaScript
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<s;g+=1){u[g]=new Array(s);for(var b=0;b<s;b+=1)u[g][b]=null}return u})(r=4*h+17),f(0,0),f(r-7,0),f(0,r-7),p(),_(),v(o,d),h>=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<r-8;o+=1)t[o][6]==null&&(t[o][6]=o%2==0);for(var d=8;d<r-8;d+=1)t[6][d]==null&&(t[6][d]=d%2==0)},p=function(){for(var o=N.getPatternPosition(h),d=0;d<o.length;d+=1)for(var s=0;s<o.length;s+=1){var u=o[d],g=o[s];if(t[u][g]==null)for(var b=-2;b<=2;b+=1)for(var C=-2;C<=2;C+=1)t[u+b][g+C]=b==-2||b==2||C==-2||C==2||b==0&&C==0}},m=function(o){for(var d=N.getBCHTypeNumber(h),s=0;s<18;s+=1){var u=!o&&(d>>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<o.length&&(D=(o[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;b<s.length;b+=1){var C=s[b];g.put(C.getMode(),4),g.put(C.getLength(),N.getLengthInBits(C.getMode(),o)),C.write(g)}var M=0;for(b=0;b<u.length;b+=1)M+=u[b].dataCount;if(g.getLengthInBits()>8*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<D.length;x+=1){var P=D[x].dataCount,R=D[x].totalCount-P;L=Math.max(L,P),I=Math.max(I,R),q[x]=new Array(P);for(var A=0;A<q[x].length;A+=1)q[x][A]=255&O.getBuffer()[A+B];B+=P;var Q=N.getErrorCorrectPolynomial(R),H=V(q[x],Q.getLength()-1).mod(Q);for(z[x]=new Array(Q.getLength()-1),A=0;A<z[x].length;A+=1){var T=A+H.getLength()-z[x].length;z[x][A]=T>=0?H.getAt(T):0}}var lt=0;for(A=0;A<D.length;A+=1)lt+=D[A].totalCount;var ot=new Array(lt),W=0;for(A=0;A<L;A+=1)for(x=0;x<D.length;x+=1)A<q[x].length&&(ot[W]=q[x][A],W+=1);for(A=0;A<I;A+=1)for(x=0;x<D.length;x+=1)A<z[x].length&&(ot[W]=z[x][A],W+=1);return ot})(g,u)};a.addData=function(o,d){var s=null;switch(d=d||"Byte"){case"Numeric":s=dt(o);break;case"Alphanumeric":s=ut(o);break;case"Byte":s=rt(o);break;case"Kanji":s=ct(o);break;default:throw"mode:"+d}i.push(s),n=null},a.isDark=function(o,d){if(o<0||r<=o||d<0||r<=d)throw o+","+d;return t[o][d]},a.getModuleCount=function(){return r},a.make=function(){if(h<1){for(var o=1;o<40;o++){for(var d=ht.getRSBlocks(o,e),s=it(),u=0;u<i.length;u++){var g=i[u];s.put(g.getMode(),4),s.put(g.getLength(),N.getLengthInBits(g.getMode(),o)),g.write(s)}var b=0;for(u=0;u<d.length;u++)b+=d[u].dataCount;if(s.getLengthInBits()<=8*b)break}h=o}w(!1,(function(){for(var C=0,M=0,O=0;O<8;O+=1){w(!0,O);var D=N.getLostPoint(a);(O==0||C>D)&&(C=D,M=O)}return M})())},a.createTableTag=function(o,d){o=o||2;var s="";s+='<table style="',s+=" border-width: 0px; border-style: none;",s+=" border-collapse: collapse;",s+=" padding: 0px; margin: "+(d=d===void 0?4*o:d)+"px;",s+='">',s+="<tbody>";for(var u=0;u<a.getModuleCount();u+=1){s+="<tr>";for(var g=0;g<a.getModuleCount();g+=1)s+='<td style="',s+=" border-width: 0px; border-style: none;",s+=" border-collapse: collapse;",s+=" padding: 0px; margin: 0px;",s+=" width: "+o+"px;",s+=" height: "+o+"px;",s+=" background-color: ",s+=a.isDark(u,g)?"#000000":"#ffffff",s+=";",s+='"/>';s+="</tr>"}return(s+="</tbody>")+"</table>"},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+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',B+=g.scalable?"":' width="'+D+'px" height="'+D+'px"',B+=' viewBox="0 0 '+D+" "+D+'" ',B+=' preserveAspectRatio="xMinYMin meet"',B+=u.text||s.text?' role="img" aria-labelledby="'+S([u.id,s.id].join(" ").trim())+'"':"",B+=">",B+=u.text?'<title id="'+S(u.id)+'">'+S(u.text)+"</title>":"",B+=s.text?'<description id="'+S(s.id)+'">'+S(s.text)+"</description>":"",B+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',B+='<path d="',C=0;C<a.getModuleCount();C+=1)for(M=C*o+d,b=0;b<a.getModuleCount();b+=1)a.isDark(C,b)&&(B+="M"+(b*o+d)+","+M+O);return(B+='" stroke="transparent" fill="black"/>')+"</svg>"},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<g&&u<=C&&C<g){var M=Math.floor((b-u)/o),O=Math.floor((C-u)/o);return a.isDark(O,M)?0:1}return 1}))},a.createImgTag=function(o,d,s){o=o||2,d=d===void 0?4*o:d;var u=a.getModuleCount()*o+2*d,g="";return g+="<img",g+=' src="',g+=a.createDataURL(o,d),g+='"',g+=' width="',g+=u,g+='"',g+=' height="',g+=u,g+='"',s&&(g+=' alt="',g+=S(s),g+='"'),g+"/>"};var S=function(o){for(var d="",s=0;s<o.length;s+=1){var u=o.charAt(s);switch(u){case"<":d+="<";break;case">":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<Q;z+=2){for(P=Math.floor((z-H)/1),R=Math.floor((z+1-H)/1),x=0;x<Q;x+=1)A="█",H<=x&&x<T&&H<=z&&z<T&&a.isDark(P,Math.floor((x-H)/1))&&(A=" "),H<=x&&x<T&&H<=z+1&&z+1<T&&a.isDark(R,Math.floor((x-H)/1))?A+=" ":A+="█",W+=q<1&&z+1>=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<C;s+=1){for(g=Math.floor((s-M)/o),I="",u=0;u<C;u+=1)b=1,M<=u&&u<O&&M<=s&&s<O&&a.isDark(g,Math.floor((u-M)/o))&&(b=0),I+=b?D:B;for(g=0;g<o;g+=1)L+=I+`
|
|
`}return L.substring(0,L.length-1)},a.renderTo2dContext=function(o,d){d=d||2;for(var s=a.getModuleCount(),u=0;u<s;u++)for(var g=0;g<s;g++)o.fillStyle=a.isDark(u,g)?"black":"white",o.fillRect(u*d,g*d,d,d)},a};Y.stringToBytes=(Y.stringToBytesFuncs={default:function(l){for(var c=[],h=0;h<l.length;h+=1){var e=l.charCodeAt(h);c.push(255&e)}return c}}).default,Y.createStringToBytes=function(l,c){var h=(function(){for(var t=wt(l),r=function(){var _=t.read();if(_==-1)throw"eof";return _},n=0,i={};;){var a=t.read();if(a==-1)break;var w=r(),f=r()<<8|r();i[String.fromCharCode(a<<8|w)]=f,n+=1}if(n!=c)throw n+" != "+c;return i})(),e=63;return function(t){for(var r=[],n=0;n<t.length;n+=1){var i=t.charCodeAt(n);if(i<128)r.push(i);else{var a=h[t.charAt(n)];typeof a=="number"?(255&a)==a?r.push(a):(r.push(a>>>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<<Z(c)-Z(G);return 21522^(l<<10|c)},k.getBCHTypeNumber=function(l){for(var c=l<<12;Z(c)-Z(X)>=0;)c^=X<<Z(c)-Z(X);return l<<12|c},k.getPatternPosition=function(l){return tt[l-1]},k.getMaskFunction=function(l){switch(l){case 0:return function(c,h){return(c+h)%2==0};case 1:return function(c,h){return c%2==0};case 2:return function(c,h){return h%3==0};case 3:return function(c,h){return(c+h)%3==0};case 4:return function(c,h){return(Math.floor(c/2)+Math.floor(h/3))%2==0};case 5:return function(c,h){return c*h%2+c*h%3==0};case 6:return function(c,h){return(c*h%2+c*h%3)%2==0};case 7:return function(c,h){return(c*h%3+(c+h)%2)%2==0};default:throw"bad maskPattern:"+l}},k.getErrorCorrectPolynomial=function(l){for(var c=V([1],0),h=0;h<l;h+=1)c=c.multiply(V([1,F.gexp(h)],0));return c},k.getLengthInBits=function(l,c){if(1<=c&&c<10)switch(l){case 1:return 10;case 2:return 9;case 4:case 8:return 8;default:throw"mode:"+l}else if(c<27)switch(l){case 1:return 12;case 2:return 11;case 4:return 16;case 8:return 10;default:throw"mode:"+l}else{if(!(c<41))throw"type:"+c;switch(l){case 1:return 14;case 2:return 13;case 4:return 16;case 8:return 12;default:throw"mode:"+l}}},k.getLostPoint=function(l){for(var c=l.getModuleCount(),h=0,e=0;e<c;e+=1)for(var t=0;t<c;t+=1){for(var r=0,n=l.isDark(e,t),i=-1;i<=1;i+=1)if(!(e+i<0||c<=e+i))for(var a=-1;a<=1;a+=1)t+a<0||c<=t+a||i==0&&a==0||n==l.isDark(e+i,t+a)&&(r+=1);r>5&&(h+=3+r-5)}for(e=0;e<c-1;e+=1)for(t=0;t<c-1;t+=1){var w=0;l.isDark(e,t)&&(w+=1),l.isDark(e+1,t)&&(w+=1),l.isDark(e,t+1)&&(w+=1),l.isDark(e+1,t+1)&&(w+=1),w!=0&&w!=4||(h+=3)}for(e=0;e<c;e+=1)for(t=0;t<c-6;t+=1)l.isDark(e,t)&&!l.isDark(e,t+1)&&l.isDark(e,t+2)&&l.isDark(e,t+3)&&l.isDark(e,t+4)&&!l.isDark(e,t+5)&&l.isDark(e,t+6)&&(h+=40);for(t=0;t<c;t+=1)for(e=0;e<c-6;e+=1)l.isDark(e,t)&&!l.isDark(e+1,t)&&l.isDark(e+2,t)&&l.isDark(e+3,t)&&l.isDark(e+4,t)&&!l.isDark(e+5,t)&&l.isDark(e+6,t)&&(h+=40);var f=0;for(t=0;t<c;t+=1)for(e=0;e<c;e+=1)l.isDark(e,t)&&(f+=1);return h+Math.abs(100*f/c/c-50)/5*10},k),F=(function(){for(var l=new Array(256),c=new Array(256),h=0;h<8;h+=1)l[h]=1<<h;for(h=8;h<256;h+=1)l[h]=l[h-4]^l[h-5]^l[h-6]^l[h-8];for(h=0;h<255;h+=1)c[l[h]]=h;return{glog:function(e){if(e<1)throw"glog("+e+")";return c[e]},gexp:function(e){for(;e<0;)e+=255;for(;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<l.length&&l[t]==0;)t+=1;for(var r=new Array(l.length-t+c),n=0;n<l.length-t;n+=1)r[n]=l[n+t];return r})(),e={getAt:function(t){return h[t]},getLength:function(){return h.length},multiply:function(t){for(var r=new Array(e.getLength()+t.getLength()-1),n=0;n<e.getLength();n+=1)for(var i=0;i<t.getLength();i+=1)r[n+i]^=F.gexp(F.glog(e.getAt(n))+F.glog(t.getAt(i)));return V(r,0)},mod:function(t){if(e.getLength()-t.getLength()<0)return e;for(var r=F.glog(e.getAt(0))-F.glog(t.getAt(0)),n=new Array(e.getLength()),i=0;i<e.getLength();i+=1)n[i]=e.getAt(i);for(i=0;i<t.getLength();i+=1)n[i]^=F.gexp(F.glog(t.getAt(i))+r);return V(n,0).mod(t)}};return e}var ht=(function(){var l=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],c=function(e,t){var r={};return r.totalCount=e,r.dataCount=t,r},h={getRSBlocks:function(e,t){var r=(function(m,v){switch(v){case K.L:return l[4*(m-1)+0];case K.M:return l[4*(m-1)+1];case K.Q:return l[4*(m-1)+2];case K.H:return l[4*(m-1)+3];default:return}})(e,t);if(r===void 0)throw"bad rs block @ typeNumber:"+e+"/errorCorrectionLevel:"+t;for(var n=r.length/3,i=[],a=0;a<n;a+=1)for(var w=r[3*a+0],f=r[3*a+1],_=r[3*a+2],p=0;p<w;p+=1)i.push(c(f,_));return i}};return h})(),it=function(){var l=[],c=0,h={getBuffer:function(){return l},getAt:function(e){var t=Math.floor(e/8);return(l[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r+=1)h.putBit((e>>>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<n.length;)r.put(e(n.substring(i,i+3)),10),i+=3;i<n.length&&(n.length-i==1?r.put(e(n.substring(i,i+1)),4):n.length-i==2&&r.put(e(n.substring(i,i+2)),7))}},e=function(r){for(var n=0,i=0;i<r.length;i+=1)n=10*n+t(r.charAt(i));return n},t=function(r){if("0"<=r&&r<="9")return r.charCodeAt(0)-48;throw"illegal char :"+r};return h},ut=function(l){var c=l,h={getMode:function(){return 2},getLength:function(t){return c.length},write:function(t){for(var r=c,n=0;n+1<r.length;)t.put(45*e(r.charAt(n))+e(r.charAt(n+1)),11),n+=2;n<r.length&&t.put(e(r.charAt(n)),6)}},e=function(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-48;if("A"<=t&&t<="Z")return t.charCodeAt(0)-65+10;switch(t){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+t}};return h},rt=function(l){var c=Y.stringToBytes(l);return{getMode:function(){return 4},getLength:function(h){return c.length},write:function(h){for(var e=0;e<c.length;e+=1)h.put(c[e],8)}}},ct=function(l){var c=Y.stringToBytesFuncs.SJIS;if(!c)throw"sjis not supported.";(function(){var t=c("友");if(t.length!=2||(t[0]<<8|t[1])!=38726)throw"sjis not supported."})();var h=c(l),e={getMode:function(){return 8},getLength:function(t){return~~(h.length/2)},write:function(t){for(var r=h,n=0;n+1<r.length;){var i=(255&r[n])<<8|255&r[n+1];if(33088<=i&&i<=40956)i-=33088;else{if(!(57408<=i&&i<=60351))throw"illegal char at "+(n+1)+"/"+i;i-=49472}i=192*(i>>>8&255)+(255&i),t.put(i,13),n+=2}if(n<r.length)throw"illegal char at "+(n+1)}};return e},gt=function(){var l=[],c={writeByte:function(h){l.push(255&h)},writeShort:function(h){c.writeByte(h),c.writeByte(h>>>8)},writeBytes:function(h,e,t){e=e||0,t=t||h.length;for(var r=0;r<t;r+=1)c.writeByte(h[r+e])},writeString:function(h){for(var e=0;e<h.length;e+=1)c.writeByte(h.charCodeAt(e))},toByteArray:function(){return l},toString:function(){var h="";h+="[";for(var e=0;e<l.length;e+=1)e>0&&(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<<o,s=1+(1<<o),u=o+1,g=S(),b=0;b<d;b+=1)g.add(String.fromCharCode(b));g.add(String.fromCharCode(d)),g.add(String.fromCharCode(s));var C,M,O,D=gt(),B=(C=D,M=0,O=0,{write:function(z,x){if(z>>>x)throw"length over";for(;M+x>=8;)C.writeByte(255&(z<<M|O)),x-=8-M,z>>>=8-M,O=0,M=0;O|=z<<M,M+=x},flush:function(){M>0&&C.writeByte(O)}});B.write(d,u);var L=0,I=String.fromCharCode(v[L]);for(L+=1;L<v.length;){var q=String.fromCharCode(v[L]);L+=1,g.contains(I+q)?I+=q:(B.write(g.indexOf(I),u),g.size()<4095&&(g.size()==1<<u&&(u+=1),g.add(I+q)),I=q)}return B.write(g.indexOf(I),u),B.write(s,u),B.flush(),D.toByteArray()},S=function(){var o={},d=0,s={add:function(u){if(s.contains(u))throw"dup key:"+u;o[u]=d,d+=1},size:function(){return d},indexOf:function(u){return o[u]},contains:function(u){return o[u]!==void 0}};return s};return y})(l,c),t=0;t<c;t+=1)for(var r=0;r<l;r+=1)e.setPixel(r,t,h(r,t));var n=gt();e.write(n);for(var i=(function(){var f=0,_=0,p=0,m="",v={},y=function(S){m+=String.fromCharCode($(63&S))},$=function(S){if(!(S<0)){if(S<26)return 65+S;if(S<52)return S-26+97;if(S<62)return S-52+48;if(S==62)return 43;if(S==63)return 47}throw"n:"+S};return v.writeByte=function(S){for(f=f<<8|255&S,_+=8,p+=1;_>=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<S;o+=1)m+="="},v.toString=function(){return m},v})(),a=n.toByteArray(),w=0;w<a.length;w+=1)i.writeByte(a[w]);return i.flush(),"data:image/gif;base64,"+i};return Y})();et.stringToBytesFuncs["UTF-8"]=function(Y){return(function(tt){for(var G=[],X=0;X<tt.length;X++){var k=tt.charCodeAt(X);k<128?G.push(k):k<2048?G.push(192|k>>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),$&&$<o.x&&(o.x=$),o.x%2==0&&o.x--,d.x=o.x*S,o.y=1+2*Math.ceil((o.x*s-1)/2),d.y=Math.round(d.x*s),(o.y*o.x>y||$&&$<o.y)&&($&&$<o.y?(o.y=$,o.y%2==0&&o.x--):o.y-=2,d.y=o.y*S,o.x=1+2*Math.ceil((o.y/s-1)/2),d.x=Math.round(d.y/s)),{height:d.y,width:d.x,hideYDots:o.y,hideXDots:o.x}})({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:p,maxHiddenAxisDots:t-14,dotSize:i})}this.drawBackground(),this.drawDots(((w,f)=>{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<i;v++)for(let y=0;y<i;y++)e&&!e(v,y)||!((r=this._qr)===null||r===void 0)&&r.isDark(v,y)&&(m.draw(_+y*f,p+v*f,f,(($,S)=>!(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<y;s++){o[s]=[];for(let u=0;u<y;u++)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<y;s++)for(let u=0;u<y;u++)o[s][u]&&(m.draw($+u*f,S+s*f,f,((g,b)=>{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<N.length;R++)for(let A=0;A<N[R].length;A++)!((g=N[R])===null||g===void 0)&&g[A]&&(P.draw(I+A*a,q+R*a,a,((Q,H)=>{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<F.length;R++)for(let A=0;A<F[R].length;A++)!((L=F[R])===null||L===void 0)&&L[A]&&(P.draw(I+A*a,q+R*a,a,((Q,H)=>{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=`<?xml version="1.0" standalone="no"?>\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=`<?xml version="1.0" standalone="no"?>\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};
|