mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-18 17:56:38 +08:00
1 line
45 KiB
JavaScript
1 line
45 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AwesomeQR=e():t.AwesomeQR=e()}(this,function(){return r={154:(t,e,r)=>{r=r(342);e.parseFont=r,e.createCanvas=function(t,e){return Object.assign(document.createElement("canvas"),{width:t,height:e})},e.createImageData=function(t,e,r){switch(arguments.length){case 0:return new ImageData;case 1:return new ImageData(t);case 2:return new ImageData(t,e);default:return new ImageData(t,e,r)}},e.loadImage=function(i,n){return new Promise(function(t,e){const r=Object.assign(document.createElement("img"),n);function o(){r.onload=null,r.onerror=null}r.onload=function(){o(),t(r)},r.onerror=function(){o(),e(new Error('Failed to load the image "'+i+'"'))},r.src=i})}},342:t=>{"use strict";const e="'([^']+)'|\"([^\"]+)\"|[\\w\\s-]+",n=new RegExp("(bold|bolder|lighter|[1-9]00) +","i"),a=new RegExp("(italic|oblique) +","i"),s=new RegExp("(small-caps) +","i"),l=new RegExp("(ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded) +","i"),u=new RegExp("([\\d\\.]+)(px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q) *((?:"+e+")( *, *(?:"+e+"))*)"),h={};t.exports=function(t){if(h[t])return h[t];const e=u.exec(t);if(e){const i={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(e[1]),unit:e[2],family:e[3].replace(/["']/g,"").replace(/ *, */g,",")};var r,o=t.substring(0,e.index);switch((r=n.exec(o))&&(i.weight=r[1]),(r=a.exec(o))&&(i.style=r[1]),(r=s.exec(o))&&(i.variant=r[1]),(o=l.exec(o))&&(i.stretch=o[1]),i.unit){case"pt":i.size/=.75;break;case"pc":i.size*=16;break;case"in":i.size*=96;break;case"cm":i.size*=96/2.54;break;case"mm":i.size*=96/25.4;break;case"%":break;case"em":case"rem":i.size*=16/.75;break;case"q":i.size*=96/25.4/4}return h[t]=i}}},662:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loop=e.conditional=e.parse=void 0,e.parse=function e(r,t){var o,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:i;return Array.isArray(t)?t.forEach(function(t){return e(r,t,i,n)}):"function"==typeof t?t(r,i,n,e):(o=Object.keys(t)[0],Array.isArray(t[o])?(n[o]={},e(r,t[o],i,n[o])):n[o]=t[o](r,i,n,e)),i},e.conditional=function(i,n){return function(t,e,r,o){n(t,e,r)&&o(t,i,e,r)}},e.loop=function(a,s){return function(t,e,r,o){for(var i=[];s(t,e,r);){var n={};o(t,a,e,n),i.push(n)}return i}}},58:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.readBits=e.readArray=e.readUnsigned=e.readString=e.peekBytes=e.readBytes=e.peekByte=e.readByte=e.buildStream=void 0,e.buildStream=function(t){return{data:t,pos:0}},e.readByte=function(){return function(t){return t.data[t.pos++]}},e.peekByte=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return function(t){return t.data[t.pos+e]}};function u(e){return function(t){return t.data.subarray(t.pos,t.pos+=e)}}e.readBytes=u,e.peekBytes=function(e){return function(t){return t.data.subarray(t.pos,t.pos+e)}},e.readString=function(e){return function(t){return Array.from(u(e)(t)).map(function(t){return String.fromCharCode(t)}).join("")}},e.readUnsigned=function(e){return function(t){t=u(2)(t);return e?(t[1]<<8)+t[0]:(t[0]<<8)+t[1]}},e.readArray=function(s,l){return function(t,e,r){for(var o="function"==typeof l?l(t,e,r):l,i=u(s),n=new Array(o),a=0;a<o;a++)n[a]=i(t);return n}},e.readBits=function(i){return function(t){for(var e=t.data[t.pos++],o=new Array(8),r=0;r<8;r++)o[7-r]=!!(e&1<<r);return Object.keys(i).reduce(function(t,e){var r=i[e];return r.length?t[e]=function(t,e,r){for(var o=0,i=0;i<r;i++)o+=t[e+i]&&Math.pow(2,r-i-1);return o}(o,r.index,r.length):t[e]=o[r.index],t},{})}}},323:(t,e,r)=>{"use strict";e.Z=void 0;var o=r(662),u=r(58),i={blocks:function(t){for(var e=[],r=t.data.length,o=0,i=(0,u.readByte)()(t);0!==i;i=(0,u.readByte)()(t)){if(t.pos+i>=r){var n=r-t.pos;e.push((0,u.readBytes)(n)(t)),o+=n;break}e.push((0,u.readBytes)(i)(t)),o+=i}for(var a=new Uint8Array(o),s=0,l=0;l<e.length;l++)a.set(e[l],s),s+=e[l].length;return a}},n=(0,o.conditional)({gce:[{codes:(0,u.readBytes)(2)},{byteSize:(0,u.readByte)()},{extras:(0,u.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,u.readUnsigned)(!0)},{transparentColorIndex:(0,u.readByte)()},{terminator:(0,u.readByte)()}]},function(t){t=(0,u.peekBytes)(2)(t);return 33===t[0]&&249===t[1]}),a=(0,o.conditional)({image:[{code:(0,u.readByte)()},{descriptor:[{left:(0,u.readUnsigned)(!0)},{top:(0,u.readUnsigned)(!0)},{width:(0,u.readUnsigned)(!0)},{height:(0,u.readUnsigned)(!0)},{lct:(0,u.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,o.conditional)({lct:(0,u.readArray)(3,function(t,e,r){return Math.pow(2,r.descriptor.lct.size+1)})},function(t,e,r){return r.descriptor.lct.exists}),{data:[{minCodeSize:(0,u.readByte)()},i]}]},function(t){return 44===(0,u.peekByte)()(t)}),s=(0,o.conditional)({text:[{codes:(0,u.readBytes)(2)},{blockSize:(0,u.readByte)()},{preData:function(t,e,r){return(0,u.readBytes)(r.text.blockSize)(t)}},i]},function(t){t=(0,u.peekBytes)(2)(t);return 33===t[0]&&1===t[1]}),r=(0,o.conditional)({application:[{codes:(0,u.readBytes)(2)},{blockSize:(0,u.readByte)()},{id:function(t,e,r){return(0,u.readString)(r.blockSize)(t)}},i]},function(t){t=(0,u.peekBytes)(2)(t);return 33===t[0]&&255===t[1]}),i=(0,o.conditional)({comment:[{codes:(0,u.readBytes)(2)},i]},function(t){t=(0,u.peekBytes)(2)(t);return 33===t[0]&&254===t[1]}),s=[{header:[{signature:(0,u.readString)(3)},{version:(0,u.readString)(3)}]},{lsd:[{width:(0,u.readUnsigned)(!0)},{height:(0,u.readUnsigned)(!0)},{gct:(0,u.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,u.readByte)()},{pixelAspectRatio:(0,u.readByte)()}]},(0,o.conditional)({gct:(0,u.readArray)(3,function(t,e){return Math.pow(2,e.lsd.gct.size+1)})},function(t,e){return e.lsd.gct.exists}),{frames:(0,o.loop)([n,r,i,a,s],function(t){t=(0,u.peekByte)()(t);return 33===t||44===t})}];e.Z=s},294:function(t,e,r){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},i=this&&this.__awaiter||function(t,a,s,l){return new(s=s||Promise)(function(r,e){function o(t){try{n(l.next(t))}catch(t){e(t)}}function i(t){try{n(l.throw(t))}catch(t){e(t)}}function n(t){var e;t.done?r(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(o,i)}n((l=l.apply(t,a||[])).next())})},$=this&&this.__generator||function(r,o){var i,n,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(a=2&e[0]?n.return:e[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,e[1])).done)return a;switch(n=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,n=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!((a=0<(a=s.trys).length&&a[a.length-1])||6!==e[0]&&2!==e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=o.call(r,s)}catch(t){e=[6,t],n=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AwesomeQR=void 0;var tt=r(154),et=r(952),rt=r(937),ot=n(r(137)),r=(it.prototype.draw=function(){var e=this;return new Promise(function(t){return e._draw().then(t)})},it.prototype._clear=function(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)},it._prepareRoundedCornerClip=function(t,e,r,o,i,n){t.beginPath(),t.moveTo(e,r),t.arcTo(e+o,r,e+o,r+i,n),t.arcTo(e+o,r+i,e,r+i,n),t.arcTo(e,r+i,e,r,n),t.arcTo(e,r,e+o,r,n),t.closePath()},it._getAverageRGB=function(t){var e,r={r:0,g:0,b:0},o=-4,i={r:0,g:0,b:0},n=0,a=t.naturalHeight||t.height,s=t.naturalWidth||t.width,l=tt.createCanvas(s,a).getContext("2d");if(!l)return r;l.drawImage(t,0,0);try{e=l.getImageData(0,0,s,a)}catch(t){return r}for(;(o+=20)<e.data.length;)200<e.data[o]||200<e.data[o+1]||200<e.data[o+2]||(++n,i.r+=e.data[o],i.g+=e.data[o+1],i.b+=e.data[o+2]);return i.r=~~(i.r/n),i.g=~~(i.g/n),i.b=~~(i.b/n),i},it._drawDot=function(t,e,r,o,i,n){t.fillRect((e+(i=void 0===i?0:i))*o,(r+i)*o,(n=void 0===n?1:n)*o,n*o)},it._drawAlignProtector=function(t,e,r,o){t.clearRect((e-2)*o,(r-2)*o,5*o,5*o),t.fillRect((e-2)*o,(r-2)*o,5*o,5*o)},it._drawAlign=function(r,o,i,n,a,s,t,e){void 0===a&&(a=0),void 0===s&&(s=1);var l=r.fillStyle;r.fillStyle=t,new Array(4).fill(0).map(function(t,e){it._drawDot(r,o-2+e,i-2,n,a,s),it._drawDot(r,o+2,i-2+e,n,a,s),it._drawDot(r,o+2-e,i+2,n,a,s),it._drawDot(r,o-2,i+2-e,n,a,s)}),it._drawDot(r,o,i,n,a,s),e||(r.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map(function(t,e){it._drawDot(r,o-1+e,i-1,n,a,s),it._drawDot(r,o+1,i-1+e,n,a,s),it._drawDot(r,o+1-e,i+1,n,a,s),it._drawDot(r,o-1,i+1-e,n,a,s)})),r.fillStyle=l},it.prototype._draw=function(){var W,V;return i(this,void 0,void 0,function(){var e,o,r,i,n,a,s,l,u,h,c,d,f,p,g,m,y,v,w,b,C,B,P,x,A,E,R,k,D,T,_,L,M,S,I,O,N,Q,F,U,j,z,G,H,q,K,X,Y,J,Z;return $(this,function(t){switch(t.label){case 0:if(e=null===(W=this.qrCode)||void 0===W?void 0:W.moduleCount,o=this.options.size,((Q=this.options.margin)<0||o<=2*Q)&&(Q=0),r=Math.ceil(Q),z=o-2*Q,i=this.options.whiteMargin,n=this.options.backgroundDimming,a=Math.ceil(z/e),l=(s=a*e)+2*r,u=tt.createCanvas(l,l),h=u.getContext("2d"),this._clear(),h.save(),h.translate(r,r),c=tt.createCanvas(l,l),d=c.getContext("2d"),f=null,p=[],!this.options.gifBackground)return[3,1];if(G=et.parseGIF(this.options.gifBackground),f=G,p=et.decompressFrames(G,!0),this.options.autoColor){for(S=v=y=m=g=0;S<p[0].colorTable.length;S++)200<(w=p[0].colorTable[S])[0]||200<w[1]||200<w[2]||0===w[0]&&0===w[1]&&0===w[2]||(v++,g+=w[0],m+=w[1],y+=w[2]);g=~~(g/v),m=~~(m/v),y=~~(y/v),this.options.colorDark="rgb("+g+","+m+","+y+")"}return[3,4];case 1:return this.options.backgroundImage?[4,tt.loadImage(this.options.backgroundImage)]:[3,3];case 2:return U=t.sent(),this.options.autoColor&&(F=it._getAverageRGB(U),this.options.colorDark="rgb("+F.r+","+F.g+","+F.b+")"),d.drawImage(U,0,0,U.width,U.height,0,0,l,l),d.rect(0,0,l,l),d.fillStyle=n,d.fill(),[3,4];case 3:d.rect(0,0,l,l),d.fillStyle=this.options.colorLight,d.fill(),t.label=4;case 4:for(b=rt.QRUtil.getPatternPosition(this.qrCode.typeNumber),C=(null===(W=null===(W=this.options.components)||void 0===W?void 0:W.data)||void 0===W?void 0:W.scale)||.4,B=.5*(1-C),P=0;P<e;P++)for(x=0;x<e;x++){for(k=this.qrCode.isDark(P,x),R=6==P&&8<=x&&x<=e-8||6==x&&8<=P&&P<=e-8,A=x<8&&(P<8||e-8<=P)||e-8<=x&&P<8||R,S=1;S<b.length-1;S++)A=A||P>=b[S]-2&&P<=b[S]+2&&x>=b[S]-2&&x<=b[S]+2;E=x*a+(A?0:B*a),R=P*a+(A?0:B*a),h.strokeStyle=k?this.options.colorDark:this.options.colorLight,h.lineWidth=.5,h.fillStyle=k?this.options.colorDark:"rgba(255, 255, 255, 0.6)",0===b.length?A||h.fillRect(E,R,(A?1:C)*a,(A?1:C)*a):(k=x<e-4&&e-4-5<=x&&P<e-4&&e-4-5<=P,A||k||h.fillRect(E,R,(A?1:C)*a,(A?1:C)*a))}if(D=b[b.length-1],h.fillStyle="rgba(255, 255, 255, 0.6)",h.fillRect(0,0,8*a,8*a),h.fillRect(0,(e-8)*a,8*a,8*a),h.fillRect((e-8)*a,0,8*a,8*a),null!==(W=null===(W=this.options.components)||void 0===W?void 0:W.timing)&&void 0!==W&&W.protectors&&(h.fillRect(8*a,6*a,(e-8-8)*a,a),h.fillRect(6*a,8*a,a,(e-8-8)*a)),null!==(W=null===(W=this.options.components)||void 0===W?void 0:W.cornerAlignment)&&void 0!==W&&W.protectors&&it._drawAlignProtector(h,D,D,a),null!==(W=null===(W=this.options.components)||void 0===W?void 0:W.alignment)&&void 0!==W&&W.protectors)for(S=0;S<b.length;S++)for(I=0;I<b.length;I++)O=b[I],N=b[S],(6!==O||6!==N&&N!==D)&&(6!==N||6!==O&&O!==D)&&(O===D&&N===D||it._drawAlignProtector(h,O,N,a));for(h.fillStyle=this.options.colorDark,h.fillRect(0,0,7*a,a),h.fillRect((e-7)*a,0,7*a,a),h.fillRect(0,6*a,7*a,a),h.fillRect((e-7)*a,6*a,7*a,a),h.fillRect(0,(e-7)*a,7*a,a),h.fillRect(0,(e-7+6)*a,7*a,a),h.fillRect(0,0,a,7*a),h.fillRect(6*a,0,a,7*a),h.fillRect((e-7)*a,0,a,7*a),h.fillRect((e-7+6)*a,0,a,7*a),h.fillRect(0,(e-7)*a,a,7*a),h.fillRect(6*a,(e-7)*a,a,7*a),h.fillRect(2*a,2*a,3*a,3*a),h.fillRect((e-7+2)*a,2*a,3*a,3*a),h.fillRect(2*a,(e-7+2)*a,3*a,3*a),T=(null===(W=null===(W=this.options.components)||void 0===W?void 0:W.timing)||void 0===W?void 0:W.scale)||.4,_=.5*(1-T),S=0;S<e-8;S+=2)it._drawDot(h,8+S,6,a,_,T),it._drawDot(h,6,8+S,a,_,T);for(j=(null===(W=null===(W=this.options.components)||void 0===W?void 0:W.cornerAlignment)||void 0===W?void 0:W.scale)||.4,it._drawAlign(h,D,D,a,.5*(1-j),j,this.options.colorDark,(null===(W=null===(W=this.options.components)||void 0===W?void 0:W.cornerAlignment)||void 0===W?void 0:W.protectors)||!1),L=(null===(W=null===(W=this.options.components)||void 0===W?void 0:W.alignment)||void 0===W?void 0:W.scale)||.4,M=.5*(1-L),S=0;S<b.length;S++)for(I=0;I<b.length;I++)O=b[I],N=b[S],(6!==O||6!==N&&N!==D)&&(6!==N||6!==O&&O!==D)&&(O===D&&N===D||it._drawAlign(h,O,N,a,M,L,this.options.colorDark,(null===(V=null===(V=this.options.components)||void 0===V?void 0:V.alignment)||void 0===V?void 0:V.protectors)||!1));return i&&(h.fillStyle="#FFFFFF",h.fillRect(-r,-r,l,r),h.fillRect(-r,s,l,r),h.fillRect(s,-r,r,l),h.fillRect(-r,-r,r,l)),this.options.logoImage?[4,tt.loadImage(this.options.logoImage)]:[3,6];case 5:Q=t.sent(),z=this.options.logoScale,G=this.options.logoMargin,F=this.options.logoCornerRadius,G<0&&(G=0),F<0&&(F=0),z=j=.5*(l-(U=s*(z=z<=0||1<=z?.2:z))),h.restore(),h.fillStyle="#FFFFFF",h.save(),it._prepareRoundedCornerClip(h,j-G,z-G,U+2*G,U+2*G,F+G),h.clip(),G=h.globalCompositeOperation,h.globalCompositeOperation="destination-out",h.fill(),h.globalCompositeOperation=G,h.restore(),h.save(),it._prepareRoundedCornerClip(h,j,z,U,U,F),h.clip(),h.drawImage(Q,j,z,U,U),h.restore(),h.save(),h.translate(r,r),t.label=6;case 6:if(f){if(p.forEach(function(t){H||((H=new ot.default(o,o)).setDelay(t.delay),H.setRepeat(0));var e=t.dims,r=e.width,e=e.height;q||(q=tt.createCanvas(r,e),(K=q.getContext("2d")).rect(0,0,q.width,q.height),K.fillStyle="#ffffff",K.fill()),X&&J&&r===X.width&&e===X.height||(X=tt.createCanvas(r,e),Y=X.getContext("2d"),J=Y.createImageData(r,e)),J.data.set(t.patch),Y.putImageData(J,0,0),K.drawImage(X,t.dims.left,t.dims.top);r=tt.createCanvas(l,l),e=r.getContext("2d");e.drawImage(q,0,0,l,l),e.rect(0,0,l,l),e.fillStyle=n,e.fill(),e.drawImage(u,0,0,l,l);t=tt.createCanvas(o,o),e=t.getContext("2d");e.drawImage(r,0,0,o,o),H.addFrame(e.getImageData(0,0,t.width,t.height).data)}),!H)throw new Error("No frames.");return H.finish(),nt(this.canvas)?(Z=H.stream().toFlattenUint8Array(),Z=Z.reduce(function(t,e){return t+String.fromCharCode(e)},""),[2,Promise.resolve("data:image/gif;base64,"+window.btoa(Z))]):[2,Promise.resolve(Buffer.from(H.stream().toFlattenUint8Array()))]}return d.drawImage(u,0,0,l,l),h.drawImage(c,-r,-r,l,l),(Z=tt.createCanvas(o,o)).getContext("2d").drawImage(u,0,0,o,o),this.canvas=Z,nt(this.canvas)?[2,Promise.resolve(this.canvas.toDataURL())]:[2,Promise.resolve(this.canvas.toBuffer())]}})})},it.CorrectLevel=rt.QRErrorCorrectLevel,it.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"#ffffff",correctLevel:rt.QRErrorCorrectLevel.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:it.defaultComponentOptions={data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}},autoColor:!0},it);function it(t){var e=Object.assign({},t);if(Object.keys(it.defaultOptions).forEach(function(t){t in e||Object.defineProperty(e,t,{value:it.defaultOptions[t],enumerable:!0,writable:!0})}),e.components?"object"==typeof e.components&&Object.keys(it.defaultComponentOptions).forEach(function(t){t in e.components?Object.defineProperty(e.components,t,{value:o(o({},it.defaultComponentOptions[t]),e.components[t]),enumerable:!0,writable:!0}):Object.defineProperty(e.components,t,{value:it.defaultComponentOptions[t],enumerable:!0,writable:!0})}):e.components=it.defaultComponentOptions,null!==e.dotScale&&void 0!==e.dotScale){if(e.dotScale<=0||1<e.dotScale)throw new Error("dotScale should be in range (0, 1].");e.components.data.scale=e.dotScale,e.components.timing.scale=e.dotScale,e.components.alignment.scale=e.dotScale}this.options=e,this.canvas=tt.createCanvas(t.size,t.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new rt.QRCodeModel(-1,this.options.correctLevel),Number.isInteger(this.options.maskPattern)&&(this.qrCode.maskPattern=this.options.maskPattern),Number.isInteger(this.options.version)&&(this.qrCode.typeNumber=this.options.version),this.qrCode.addData(this.options.text),this.qrCode.make()}function nt(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}e.AwesomeQR=r},642:function(t,e,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){t[o=void 0===o?r:o]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||o(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(937),e);var n=r(294);Object.defineProperty(e,"AwesomeQR",{enumerable:!0,get:function(){return n.AwesomeQR}})},937:(t,s)=>{"use strict";function l(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=Number(t)?3:0)}Object.defineProperty(s,"__esModule",{value:!0}),s.QRMath=s.QRUtil=s.QRMaskPattern=s.QRErrorCorrectLevel=s.QRCodeModel=void 0;var e=(o.prototype.getLength=function(){return this.parsedData.length},o.prototype.write=function(t){for(var e=0,r=this.parsedData.length;e<r;e++)t.put(this.parsedData[e],8)},o),r=(u.prototype.addData=function(a){if(this.typeNumber<=0)this.typeNumber=function(t){for(var e=1,r=l(a),o=0,i=f.length;o<i;o++){var n=0;switch(t){case s.QRErrorCorrectLevel.L:n=f[o][0];break;case s.QRErrorCorrectLevel.M:n=f[o][1];break;case s.QRErrorCorrectLevel.Q:n=f[o][2];break;case s.QRErrorCorrectLevel.H:n=f[o][3]}if(r<=n)break;e++}if(e>f.length)throw new Error("Too long data");return e}(this.errorCorrectLevel);else{if(40<this.typeNumber)throw new Error("Invalid QR version: "+this.typeNumber);if(!function(t,e){var r=l(a),o=t-1,i=0;switch(e){case s.QRErrorCorrectLevel.L:i=f[o][0];break;case s.QRErrorCorrectLevel.M:i=f[o][1];break;case s.QRErrorCorrectLevel.Q:i=f[o][2];break;case s.QRErrorCorrectLevel.H:i=f[o][3]}return r<=i}(this.typeNumber,this.errorCorrectLevel))throw new Error("Data is too long for QR version: "+this.typeNumber)}var t=new e(a);this.dataList.push(t),this.dataCache=void 0},u.prototype.isDark=function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},u.prototype.getModuleCount=function(){return this.moduleCount},u.prototype.make=function(){this.makeImpl(!1,this.getBestMaskPattern())},u.prototype.makeImpl=function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),7<=this.typeNumber&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=u.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},u.prototype.setupPositionProbePattern=function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},u.prototype.getBestMaskPattern=function(){if(Number.isInteger(this.maskPattern)&&Object.values(s.QRMaskPattern).includes(this.maskPattern))return this.maskPattern;for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=m.getLostPoint(this);(0==r||o<t)&&(t=o,e=r)}return e},u.prototype.setupTimingPattern=function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},u.prototype.setupPositionAdjustPattern=function(){for(var t=m.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var o=t[e],i=t[r];if(null==this.modules[o][i])for(var n=-2;n<=2;n++)for(var a=-2;a<=2;a++)this.modules[o+n][i+a]=-2==n||2==n||-2==a||2==a||0==n&&0==a}},u.prototype.setupTypeNumber=function(t){for(var e=m.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var o=!t&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++)o=!t&&1==(e>>r&1),this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o},u.prototype.setupTypeInfo=function(t,e){for(var e=this.errorCorrectLevel<<3|e,r=m.getBCHTypeInfo(e),o=0;o<15;o++){var i=!t&&1==(r>>o&1);o<6?this.modules[o][8]=i:o<8?this.modules[o+1][8]=i:this.modules[this.moduleCount-15+o][8]=i}for(o=0;o<15;o++)i=!t&&1==(r>>o&1),o<8?this.modules[8][this.moduleCount-o-1]=i:o<9?this.modules[8][15-o-1+1]=i:this.modules[8][15-o-1]=i;this.modules[this.moduleCount-8][8]=!t},u.prototype.mapData=function(t,e){for(var r=-1,o=this.moduleCount-1,i=7,n=0,a=this.moduleCount-1;0<a;a-=2)for(6==a&&a--;;){for(var s,l=0;l<2;l++)null==this.modules[o][a-l]&&(s=!1,n<t.length&&(s=1==(t[n]>>>i&1)),m.getMask(e,o,a-l)&&(s=!s),this.modules[o][a-l]=s,-1==--i&&(n++,i=7));if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}},u.createData=function(t,e,r){for(var o=c.getRSBlocks(t,e),i=new d,n=0;n<r.length;n++){var a=r[n];i.put(a.mode,4),i.put(a.getLength(),m.getLengthInBits(a.mode,t)),a.write(i)}for(var s=0,n=0;n<o.length;n++)s+=o[n].dataCount;if(i.getLengthInBits()>8*s)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+8*s+")");for(i.getLengthInBits()+4<=8*s&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*s||(i.put(u.PAD0,8),i.getLengthInBits()>=8*s));)i.put(u.PAD1,8);return u.createBytes(i,o)},u.createBytes=function(t,e){for(var r=0,o=0,i=0,n=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s++){var l=e[s].dataCount,u=e[s].totalCount-l,o=Math.max(o,l),i=Math.max(i,u);n[s]=new Array(l);for(var h=0;h<n[s].length;h++)n[s][h]=255&t.buffer[h+r];r+=l;var u=m.getErrorCorrectPolynomial(u),c=new y(n[s],u.getLength()-1).mod(u);for(a[s]=new Array(u.getLength()-1),h=0;h<a[s].length;h++){var d=h+c.getLength()-a[s].length;a[s][h]=0<=d?c.get(d):0}}for(var f=0,h=0;h<e.length;h++)f+=e[h].totalCount;var p=new Array(f),g=0;for(h=0;h<o;h++)for(s=0;s<e.length;s++)h<n[s].length&&(p[g++]=n[s][h]);for(h=0;h<i;h++)for(s=0;s<e.length;s++)h<a[s].length&&(p[g++]=a[s][h]);return p},u.PAD0=236,u.PAD1=17,u);function u(t,e){void 0===t&&(t=-1),void 0===e&&(e=s.QRErrorCorrectLevel.L),this.moduleCount=0,this.dataList=[],this.typeNumber=t,this.errorCorrectLevel=e,this.moduleCount=0,this.dataList=[]}function o(t){this.mode=a.MODE_8BIT_BYTE,this.parsedData=[],this.data=t;for(var e=[],r=0,o=this.data.length;r<o;r++){var i=[],n=this.data.charCodeAt(r);65536<n?(i[0]=240|(1835008&n)>>>18,i[1]=128|(258048&n)>>>12,i[2]=128|(4032&n)>>>6,i[3]=128|63&n):2048<n?(i[0]=224|(61440&n)>>>12,i[1]=128|(4032&n)>>>6,i[2]=128|63&n):128<n?(i[0]=192|(1984&n)>>>6,i[1]=128|63&n):i[0]=n,e.push(i)}this.parsedData=Array.prototype.concat.apply([],e),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}s.QRCodeModel=r,s.QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var a={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8};s.QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var m=(i.getBCHTypeInfo=function(t){for(var e=t<<10;0<=i.getBCHDigit(e)-i.getBCHDigit(i.G15);)e^=i.G15<<i.getBCHDigit(e)-i.getBCHDigit(i.G15);return(t<<10|e)^i.G15_MASK},i.getBCHTypeNumber=function(t){for(var e=t<<12;0<=i.getBCHDigit(e)-i.getBCHDigit(i.G18);)e^=i.G18<<i.getBCHDigit(e)-i.getBCHDigit(i.G18);return t<<12|e},i.getBCHDigit=function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},i.getPatternPosition=function(t){return i.PATTERN_POSITION_TABLE[t-1]},i.getMask=function(t,e,r){switch(t){case s.QRMaskPattern.PATTERN000:return(e+r)%2==0;case s.QRMaskPattern.PATTERN001:return e%2==0;case s.QRMaskPattern.PATTERN010:return r%3==0;case s.QRMaskPattern.PATTERN011:return(e+r)%3==0;case s.QRMaskPattern.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case s.QRMaskPattern.PATTERN101:return e*r%2+e*r%3==0;case s.QRMaskPattern.PATTERN110:return(e*r%2+e*r%3)%2==0;case s.QRMaskPattern.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},i.getErrorCorrectPolynomial=function(t){for(var e=new y([1],0),r=0;r<t;r++)e=e.multiply(new y([1,n.gexp(r)],0));return e},i.getLengthInBits=function(t,e){if(1<=e&&e<10)switch(t){case a.MODE_NUMBER:return 10;case a.MODE_ALPHA_NUM:return 9;case a.MODE_8BIT_BYTE:case a.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case a.MODE_NUMBER:return 12;case a.MODE_ALPHA_NUM:return 11;case a.MODE_8BIT_BYTE:return 16;case a.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case a.MODE_NUMBER:return 14;case a.MODE_ALPHA_NUM:return 13;case a.MODE_8BIT_BYTE:return 16;case a.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},i.getLostPoint=function(t){for(var e=t.getModuleCount(),r=0,o=0;o<e;o++)for(var i=0;i<e;i++){for(var n=0,a=t.isDark(o,i),s=-1;s<=1;s++)if(!(o+s<0||e<=o+s))for(var l=-1;l<=1;l++)i+l<0||e<=i+l||0==s&&0==l||a==t.isDark(o+s,i+l)&&n++;5<n&&(r+=3+n-5)}for(o=0;o<e-1;o++)for(i=0;i<e-1;i++){var u=0;t.isDark(o,i)&&u++,t.isDark(o+1,i)&&u++,t.isDark(o,i+1)&&u++,t.isDark(o+1,i+1)&&u++,0!=u&&4!=u||(r+=3)}for(o=0;o<e;o++)for(i=0;i<e-6;i++)t.isDark(o,i)&&!t.isDark(o,i+1)&&t.isDark(o,i+2)&&t.isDark(o,i+3)&&t.isDark(o,i+4)&&!t.isDark(o,i+5)&&t.isDark(o,i+6)&&(r+=40);for(i=0;i<e;i++)for(o=0;o<e-6;o++)t.isDark(o,i)&&!t.isDark(o+1,i)&&t.isDark(o+2,i)&&t.isDark(o+3,i)&&t.isDark(o+4,i)&&!t.isDark(o+5,i)&&t.isDark(o+6,i)&&(r+=40);for(var h=0,i=0;i<e;i++)for(o=0;o<e;o++)t.isDark(o,i)&&h++;return r+Math.abs(100*h/e/e-50)/5*10},i.PATTERN_POSITION_TABLE=[[],[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]],i.G15=1335,i.G18=7973,i.G15_MASK=21522,i);function i(){}s.QRUtil=m;var n=(h.glog=function(t){if(t<1)throw new Error("glog("+t+")");return h.LOG_TABLE[t]},h.gexp=function(t){for(;t<0;)t+=255;for(;256<=t;)t-=255;return h.EXP_TABLE[t]},h.EXP_TABLE=new Array(256),h.LOG_TABLE=new Array(256),h._constructor=function(){for(var t=0;t<8;t++)h.EXP_TABLE[t]=1<<t;for(t=8;t<256;t++)h.EXP_TABLE[t]=h.EXP_TABLE[t-4]^h.EXP_TABLE[t-5]^h.EXP_TABLE[t-6]^h.EXP_TABLE[t-8];for(t=0;t<255;t++)h.LOG_TABLE[h.EXP_TABLE[t]]=t}(),h);function h(){}s.QRMath=n;var y=(v.prototype.get=function(t){return this.num[t]},v.prototype.getLength=function(){return this.num.length},v.prototype.multiply=function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<t.getLength();o++)e[r+o]^=n.gexp(n.glog(this.get(r))+n.glog(t.get(o)));return new v(e,0)},v.prototype.mod=function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=n.glog(this.get(0))-n.glog(t.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(o=0;o<t.getLength();o++)r[o]^=n.gexp(n.glog(t.get(o))+e);return new v(r,0).mod(t)},v),c=(g.getRSBlocks=function(t,e){var r=g.getRsBlockTable(t,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var o=r.length/3,i=[],n=0;n<o;n++)for(var a=r[3*n+0],s=r[3*n+1],l=r[3*n+2],u=0;u<a;u++)i.push(new g(s,l));return i},g.getRsBlockTable=function(t,e){switch(e){case s.QRErrorCorrectLevel.L:return g.RS_BLOCK_TABLE[4*(t-1)+0];case s.QRErrorCorrectLevel.M:return g.RS_BLOCK_TABLE[4*(t-1)+1];case s.QRErrorCorrectLevel.Q:return g.RS_BLOCK_TABLE[4*(t-1)+2];case s.QRErrorCorrectLevel.H:return g.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},g.RS_BLOCK_TABLE=[[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],[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]],g),d=(p.prototype.get=function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},p.prototype.put=function(t,e){for(var r=0;r<e;r++)this.putBit(1==(t>>>e-r-1&1))},p.prototype.getLengthInBits=function(){return this.length},p.prototype.putBit=function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++},p),f=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function p(){this.buffer=[],this.length=0}function g(t,e){this.totalCount=t,this.dataCount=e}function v(t,e){if(null==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}},137:(t,e,r)=>{var o=r(110),i=r(970);function n(){this.page=-1,this.pages=[],this.newPage()}n.pageSize=4096,n.charMap={};for(var a=0;a<256;a++)n.charMap[a]=String.fromCharCode(a);function s(t,e){this.width=~~t,this.height=~~e,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new n}n.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(n.pageSize),this.cursor=0},n.prototype.getData=function(){for(var t="",e=0;e<this.pages.length;e++)for(var r=0;r<n.pageSize;r++)t+=n.charMap[this.pages[e][r]];return t},n.prototype.toFlattenUint8Array=function(){const t=[];for(var e=0;e<this.pages.length;e++)if(e===this.pages.length-1){const r=Uint8Array.from(this.pages[e].slice(0,this.cursor));t.push(r)}else t.push(this.pages[e]);const r=new Uint8Array(t.reduce((t,e)=>t+e.length,0));return t.reduce((t,e)=>(r.set(e,t),t+e.length),0),r},n.prototype.writeByte=function(t){this.cursor>=n.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},n.prototype.writeUTFBytes=function(t){for(var e=t.length,r=0;r<e;r++)this.writeByte(t.charCodeAt(r))},n.prototype.writeBytes=function(t,e,r){for(var o=r||t.length,i=e||0;i<o;i++)this.writeByte(t[i])},s.prototype.setDelay=function(t){this.delay=Math.round(t/10)},s.prototype.setFrameRate=function(t){this.delay=Math.round(100/t)},s.prototype.setDispose=function(t){0<=t&&(this.dispose=t)},s.prototype.setRepeat=function(t){this.repeat=t},s.prototype.setTransparent=function(t){this.transparent=t},s.prototype.addFrame=function(t){this.image=t,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),0<=this.repeat&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},s.prototype.finish=function(){this.out.writeByte(59)},s.prototype.setQuality=function(t){this.sample=t=t<1?1:t},s.prototype.setDither=function(t){this.dither=t=!0===t?"FloydSteinberg":t},s.prototype.setGlobalPalette=function(t){this.globalPalette=t},s.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},s.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},s.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new o(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},s.prototype.indexPixels=function(t){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var r=0,o=0;o<e;o++){var i=this.findClosestRGB(255&this.pixels[r++],255&this.pixels[r++],255&this.pixels[r++]);this.usedEntry[i]=!0,this.indexedPixels[o]=i}},s.prototype.ditherPixels=function(t,e){var r={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[.25,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!t||!r[t])throw"Unknown dithering kernel: "+t;var o,i=r[t],n=this.height,a=this.width,s=this.pixels,l=e?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var u=0;u<n;u++){e&&(l*=-1);for(var h=1==l?0:a-1,c=1==l?a:0;h!==c;h+=l){var d=s[C=3*(o=u*a+h)],f=s[1+C],p=s[2+C];C=this.findClosestRGB(d,f,p),this.usedEntry[C]=!0,this.indexedPixels[o]=C,C*=3;for(var g=d-this.colorTab[C],m=f-this.colorTab[1+C],y=p-this.colorTab[2+C],v=1==l?0:i.length-1,w=1==l?i.length:0;v!==w;v+=l){var b,C,B=i[v][1],P=i[v][2];0<=B+h&&B+h<a&&0<=P+u&&P+u<n&&(b=i[v][0],C=o+B+P*a,s[C*=3]=Math.max(0,Math.min(255,s[C]+g*b)),s[1+C]=Math.max(0,Math.min(255,s[1+C]+m*b)),s[2+C]=Math.max(0,Math.min(255,s[2+C]+y*b)))}}}},s.prototype.findClosest=function(t,e){return this.findClosestRGB((16711680&t)>>16,(65280&t)>>8,255&t,e)},s.prototype.findClosestRGB=function(t,e,r,o){if(null===this.colorTab)return-1;if(this.neuQuant&&!o)return this.neuQuant.lookupRGB(t,e,r);for(var i=0,n=16777216,a=this.colorTab.length,s=0,l=0;s<a;l++){var u=t-(255&this.colorTab[s++]),h=e-(255&this.colorTab[s++]),c=r-(255&this.colorTab[s++]),c=u*u+h*h+c*c;(!o||this.usedEntry[l])&&c<n&&(n=c,i=l)}return i},s.prototype.getImagePixels=function(){var t=this.width,e=this.height;this.pixels=new Uint8Array(t*e*3);for(var r=this.image,o=0,i=0,n=0;n<e;n++)for(var a=0;a<t;a++)this.pixels[i++]=r[o++],this.pixels[i++]=r[o++],this.pixels[i++]=r[o++],o++},s.prototype.writeGraphicCtrlExt=function(){var t,e;this.out.writeByte(33),this.out.writeByte(249),this.out.writeByte(4),e=null===this.transparent?t=0:(t=1,2),0<=this.dispose&&(e=7&this.dispose),this.out.writeByte(0|(e<<=2)|t),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},s.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},s.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},s.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},s.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e<t;e++)this.out.writeByte(0)},s.prototype.writeShort=function(t){this.out.writeByte(255&t),this.out.writeByte(t>>8&255)},s.prototype.writePixels=function(){new i(this.width,this.height,this.indexedPixels,this.colorDepth).encode(this.out)},s.prototype.stream=function(){return this.out},t.exports=s},970:t=>{var E=5003,R=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];t.exports=function(e,r,t,o){var i,l,u,h,c,d,n,a,f,s=Math.max(2,o),p=new Uint8Array(256),g=new Int32Array(E),m=new Int32Array(E),y=0,v=0,w=!1;function b(t,e){p[l++]=t,254<=l&&B(e)}function C(t){for(var e=0;e<t;++e)g[e]=-1}function B(t){0<l&&(t.writeByte(l),t.writeBytes(p,0,l),l=0)}function P(t){return(1<<t)-1}function x(){return 0===n?-1:(--n,255&t[a++])}function A(t,e){for(i&=R[y],0<y?i|=t<<y:i=t,y+=f;8<=y;)b(255&i,e),i>>=8,y-=8;if((u<v||w)&&(w?(u=P(f=h),w=!1):u=12==++f?4096:P(f)),t==d){for(;0<y;)b(255&i,e),i>>=8,y-=8;B(e)}}this.encode=function(t){t.writeByte(s),n=e*r,a=0,function(t,e){var r,o,i,n,a,s;for(w=!1,u=P(f=h=t),d=1+(c=1<<t-1),v=c+2,l=0,i=x(),a=0,r=E;r<65536;r*=2)++a;a=8-a,C(E),A(c,e);t:for(;-1!=(s=x());)if(r=(s<<12)+i,g[o=s<<a^i]!==r){if(0<=g[o]){n=0===o?1:5003-o;do{if((o-=n)<0&&(o+=5003),g[o]===r){i=m[o];continue t}}while(0<=g[o])}A(i,e),i=s,v<4096?(m[o]=v++,g[o]=r):(s=e,C(E),v=c+2,w=!0,A(c,s))}else i=m[o];A(i,e),A(d,e)}(s+1,t),t.writeByte(0)}}},110:t=>{var x=256,A=1<<18;t.exports=function(v,w){var b,h,C,B,P;this.buildColormap=function(){!function(){var t,e;for(b=[],h=new Int32Array(256),C=new Int32Array(x),B=new Int32Array(x),P=new Int32Array(32),t=0;t<x;t++)e=(t<<12)/x,b[t]=new Float64Array([e,e,e,0]),B[t]=256,C[t]=0}(),function(){var t,e,r,o,i=v.length,n=30+(w-1)/3,a=i/(3*w),s=~~(a/100),l=1024,u=2048,h=u>>6;for(h<=1&&(h=0),y=0;y<h;y++)P[y]=l*(256*(h*h-y*y)/(h*h));for(var c,d,f,p,g=i<1509?(w=1,3):i%499!=0?1497:i%491!=0?1473:i%487!=0?1461:1509,m=0,y=0;y<a;)if(c=l,d=o=function(t,e,r){for(var o,i=~(1<<31),n=i,a=-1,s=a,l=0;l<x;l++)o=b[l],(o=Math.abs(o[0]-t)+Math.abs(o[1]-e)+Math.abs(o[2]-r))<i&&(i=o,a=l),(o=o-(C[l]>>12))<n&&(n=o,s=l),o=B[l]>>10,B[l]-=o,C[l]+=o<<10;return B[a]+=64,C[a]-=65536,s}(t=(255&v[m])<<4,e=(255&v[m+1])<<4,r=(255&v[m+2])<<4),f=e,p=r,b[d][0]-=c*(b[d][0]-t)/1024,b[d][1]-=c*(b[d][1]-f)/1024,b[d][2]-=c*(b[d][2]-p)/1024,0!==h&&function(t,e,r,o,i){for(var n,a,s=Math.abs(e-t),l=Math.min(e+t,x),u=e+1,h=e-1,c=1;u<l||s<h;)a=P[c++],u<l&&((n=b[u++])[0]-=a*(n[0]-r)/A,n[1]-=a*(n[1]-o)/A,n[2]-=a*(n[2]-i)/A),s<h&&((n=b[h--])[0]-=a*(n[0]-r)/A,n[1]-=a*(n[1]-o)/A,n[2]-=a*(n[2]-i)/A)}(h,o,t,e,r),(m+=g)>=i&&(m-=i),++y%(s=0===s?1:s)==0)for(l-=l/n,(h=(u-=u/30)>>6)<=1&&(h=0),o=0;o<h;o++)P[o]=l*(256*(h*h-o*o)/(h*h))}(),function(){for(var t=0;t<x;t++)b[t][0]>>=4,b[t][1]>>=4,b[t][2]>>=4,b[t][3]=t}(),function(){for(var t,e,r,o,i,n=0,a=0,s=0;s<x;s++){for(i=(e=b[o=s])[1],t=s+1;t<x;t++)(r=b[t])[1]<i&&(o=t,i=r[1]);if(r=b[o],s!=o&&(t=r[0],r[0]=e[0],e[0]=t,t=r[1],r[1]=e[1],e[1]=t,t=r[2],r[2]=e[2],e[2]=t,t=r[3],r[3]=e[3],e[3]=t),i!=n){for(h[n]=a+s>>1,t=n+1;t<i;t++)h[t]=s;n=i,a=s}}for(h[n]=a+255>>1,t=n+1;t<256;t++)h[t]=255}()},this.getColormap=function(){for(var t=[],e=[],r=0;r<x;r++)e[b[r][3]]=r;for(var o=0,i=0;i<x;i++){var n=e[i];t[o++]=b[n][0],t[o++]=b[n][1],t[o++]=b[n][2]}return t},this.lookupRGB=function(t,e,r){for(var o,i,n,a=1e3,s=-1,l=h[e],u=l-1;l<x||0<=u;)l<x&&((n=(i=b[l])[1]-e)>=a?l=x:(l++,n<0&&(n=-n),(n+=o=(o=i[0]-t)<0?-o:o)<a&&((n+=o=(o=i[2]-r)<0?-o:o)<a&&(a=n,s=i[3])))),0<=u&&((n=e-(i=b[u])[1])>=a?u=-1:(u--,n<0&&(n=-n),(n+=o=(o=i[0]-t)<0?-o:o)<a&&((n+=o=(o=i[2]-r)<0?-o:o)<a&&(a=n,s=i[3]))));return s}}},952:(t,e,r)=>{"use strict";r.r(e),r.d(e,{decompressFrame:()=>s,decompressFrames:()=>l,parseGIF:()=>a});var o=r(323),i=r(662),n=r(58);const a=t=>{t=new Uint8Array(t);return(0,i.parse)((0,n.buildStream)(t),o.Z)},s=(t,e,r)=>{if(t.image){var o=t["image"],P=o.descriptor.width*o.descriptor.height,i=((t,e)=>{var r,o,i,n,a,s,l,u,h,c,d,f,p,g,m,y,v=P;const w=new Array(P),b=new Array(4096),C=new Array(4096),B=new Array(4097);for(a=1+(o=1<<(c=t)),r=2+o,l=-1,i=(1<<(n=c+1))-1,u=0;u<o;u++)b[u]=0,C[u]=u;for(h=d=f=p=g=m=y=0;h<v;){if(0===g){if(f<n){d+=e[y]<<f,f+=8,y++;continue}if(u=d&i,d>>=n,f-=n,r<u||u==a)break;if(u==o){i=(1<<(n=c+1))-1,r=2+o,l=-1;continue}if(-1==l){B[g++]=C[u],p=l=u;continue}for((s=u)==r&&(B[g++]=p,u=l);o<u;)B[g++]=C[u],u=b[u];p=255&C[u],B[g++]=p,r<4096&&(b[r]=l,C[r]=p,0==(++r&i)&&r<4096&&(n++,i+=r)),l=s}g--,w[m++]=B[g],h++}for(h=m;h<v;h++)w[h]=0;return w})(o.data.minCodeSize,o.data.blocks);const n={pixels:i=o.descriptor.lct.interlaced?((r,o)=>{const i=new Array(r.length),t=r.length/o,e=[0,4,2,1],n=[8,8,4,2];for(var a=0,s=0;s<4;s++)for(var l=e[s];l<t;l+=n[s])(function(t,e){e=r.slice(e*o,(e+1)*o);i.splice.apply(i,[t*o,o].concat(e))})(l,a),a++;return i})(i,o.descriptor.width):i,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height}};return o.descriptor.lct&&o.descriptor.lct.exists?n.colorTable=o.lct:n.colorTable=e,t.gce&&(n.delay=10*(t.gce.delay||10),n.disposalType=t.gce.extras.disposal,t.gce.extras.transparentColorGiven&&(n.transparentIndex=t.gce.transparentColorIndex)),r&&(n.patch=(t=>{const e=t.pixels.length,r=new Uint8ClampedArray(4*e);for(var o=0;o<e;o++){const e=4*o,i=t.pixels[o],n=t.colorTable[i];r[e]=n[0],r[1+e]=n[1],r[2+e]=n[2],r[3+e]=i!==t.transparentIndex?255:0}return r})(n)),n}console.warn("gif frame does not have associated image.")},l=(e,r)=>e.frames.filter(t=>t.image).map(t=>s(t,e.gct,r))}},i={},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o(642);function o(t){var e=i[t];if(void 0!==e)return e.exports;e=i[t]={exports:{}};return r[t].call(e.exports,e,e.exports,o),e.exports}var r,i}); |