2 lines
56 KiB
JavaScript
2 lines
56 KiB
JavaScript
import{_ as Ee,o as le,c as Ae,H as Be,g as De,h as At,r as gt,j as Pe,w as X,a as zt,b as H,d as J,bL as ke,q as _e}from"./index.2a72fe30.js";function Mt(i){return i===""?i:i==="true"||i=="1"}function Te(i,t){return new Promise((e,r)=>{var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=new FileReader;o.onloadend=function(){e(o.result)},o.readAsArrayBuffer(n.response)},n.open("GET",i),n.send()})}function ot(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Yt(i,t){for(var e="",r=0,n=-1,o=0,a,l=0;l<=i.length;++l){if(l<i.length)a=i.charCodeAt(l);else{if(a===47)break;a=47}if(a===47){if(!(n===l-1||o===1))if(n!==l-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){var s=e.lastIndexOf("/");if(s!==e.length-1){s===-1?(e="",r=0):(e=e.slice(0,s),r=e.length-1-e.lastIndexOf("/")),n=l,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,n=l,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+="/"+i.slice(n+1,l):e=i.slice(n+1,l),r=l-n-1;n=l,o=0}else a===46&&o!==-1?++o:o=-1}return e}function Se(i,t){var e=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return e?e===t.root?e+r:e+i+r:r}var mt={resolve:function(){for(var t="",e=!1,r,n=arguments.length-1;n>=-1&&!e;n--){var o;n>=0?o=arguments[n]:(r===void 0&&(r=process.cwd()),o=r),ot(o),o.length!==0&&(t=o+"/"+t,e=o.charCodeAt(0)===47)}return t=Yt(t,!e),e?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(ot(t),t.length===0)return".";var e=t.charCodeAt(0)===47,r=t.charCodeAt(t.length-1)===47;return t=Yt(t,!e),t.length===0&&!e&&(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return ot(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,e=0;e<arguments.length;++e){var r=arguments[e];ot(r),r.length>0&&(t===void 0?t=r:t+="/"+r)}return t===void 0?".":mt.normalize(t)},relative:function(t,e){if(ot(t),ot(e),t===e||(t=mt.resolve(t),e=mt.resolve(e),t===e))return"";for(var r=1;r<t.length&&t.charCodeAt(r)===47;++r);for(var n=t.length,o=n-r,a=1;a<e.length&&e.charCodeAt(a)===47;++a);for(var l=e.length,s=l-a,u=o<s?o:s,f=-1,h=0;h<=u;++h){if(h===u){if(s>u){if(e.charCodeAt(a+h)===47)return e.slice(a+h+1);if(h===0)return e.slice(a+h)}else o>u&&(t.charCodeAt(r+h)===47?f=h:h===0&&(f=0));break}var v=t.charCodeAt(r+h),b=e.charCodeAt(a+h);if(v!==b)break;v===47&&(f=h)}var D="";for(h=r+f+1;h<=n;++h)(h===n||t.charCodeAt(h)===47)&&(D.length===0?D+="..":D+="/..");return D.length>0?D+e.slice(a+f):(a+=f,e.charCodeAt(a)===47&&++a,e.slice(a))},_makeLong:function(t){return t},dirname:function(t){if(ot(t),t.length===0)return".";for(var e=t.charCodeAt(0),r=e===47,n=-1,o=!0,a=t.length-1;a>=1;--a)if(e=t.charCodeAt(a),e===47){if(!o){n=a;break}}else o=!1;return n===-1?r?"/":".":r&&n===1?"//":t.slice(0,n)},basename:function(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ot(t);var r=0,n=-1,o=!0,a;if(e!==void 0&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var l=e.length-1,s=-1;for(a=t.length-1;a>=0;--a){var u=t.charCodeAt(a);if(u===47){if(!o){r=a+1;break}}else s===-1&&(o=!1,s=a+1),l>=0&&(u===e.charCodeAt(l)?--l===-1&&(n=a):(l=-1,n=s))}return r===n?n=s:n===-1&&(n=t.length),t.slice(r,n)}else{for(a=t.length-1;a>=0;--a)if(t.charCodeAt(a)===47){if(!o){r=a+1;break}}else n===-1&&(o=!1,n=a+1);return n===-1?"":t.slice(r,n)}},extname:function(t){ot(t);for(var e=-1,r=0,n=-1,o=!0,a=0,l=t.length-1;l>=0;--l){var s=t.charCodeAt(l);if(s===47){if(!o){r=l+1;break}continue}n===-1&&(o=!1,n=l+1),s===46?e===-1?e=l:a!==1&&(a=1):e!==-1&&(a=-1)}return e===-1||n===-1||a===0||a===1&&e===n-1&&e===r+1?"":t.slice(e,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return Se("/",t)},parse:function(t){ot(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(t.length===0)return e;var r=t.charCodeAt(0),n=r===47,o;n?(e.root="/",o=1):o=0;for(var a=-1,l=0,s=-1,u=!0,f=t.length-1,h=0;f>=o;--f){if(r=t.charCodeAt(f),r===47){if(!u){l=f+1;break}continue}s===-1&&(u=!1,s=f+1),r===46?a===-1?a=f:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||s===-1||h===0||h===1&&a===s-1&&a===l+1?s!==-1&&(l===0&&n?e.base=e.name=t.slice(1,s):e.base=e.name=t.slice(l,s)):(l===0&&n?(e.name=t.slice(1,a),e.base=t.slice(1,s)):(e.name=t.slice(l,a),e.base=t.slice(l,s)),e.ext=t.slice(a,s)),l>0?e.dir=t.slice(0,l-1):n&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};mt.posix=mt;const Fe=mt.extname,ue=mt.basename;class Ie{constructor(){let t=(()=>typeof global>"u")(),e="image/png",r="image/jpeg",n="image/jpeg",o="image/webp",a="application/pdf",l="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:t?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:t?{png:e,jpg:r,jpeg:n,webp:o}:{png:e,jpg:r,jpeg:n,pdf:a,svg:l},mimes:t?{[e]:"png",[r]:"jpg",[o]:"webp"}:{[e]:"png",[r]:"jpg",[a]:"pdf",[l]:"svg"}})}toMime(t){return this.formats[(t||"").replace(/^\./,"").toLowerCase()]}fromMime(t){return this.mimes[t]}}function Le(i,{filename:t="",extension:e="",format:k,page:n,quality:o,matte:a,density:l,outline:s,archive:b}={}){var{fromMime:f,toMime:h,expected:v}=new Ie,b=b||"canvas",D=k||e.replace(/@\d+x$/i,"")||Fe(t),k=f(h(D)||D),L=h(k),g=i.length;if(!D)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!k)throw new Error(`Unsupported file format "${D}" (expected ${v})`);if(!g)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let p,E,d=t.replace(/{(\d*)}/g,(m,C)=>(E=!0,C=parseInt(C,10),p=isFinite(C)?C:isFinite(p)?p:-1,"{}")),y=n>0?n-1:n<0?g+n:void 0;if(isFinite(y)&&y<0||y>=g)throw new RangeError(g==1?`Canvas only has a \u2018page 1\u2019 (${y} is out of bounds)`:`Canvas has pages 1\u2013${g} (${y} is out of bounds)`);if(i=isFinite(y)?[i[y]]:E||k=="pdf"?i:i.slice(-1),o===void 0)o=.92;else if(typeof o!="number"||!isFinite(o)||o<0||o>1)throw new TypeError("The quality option must be an number in the 0.0\u20131.0 range");if(l===void 0){let m=(e||ue(t,D)).match(/@(\d+)x$/i);l=m?parseInt(m[1],10):1}else if(typeof l!="number"||!Number.isInteger(l)||l<1)throw new TypeError("The density option must be a non-negative integer");return s===void 0?s=!0:k=="svg"&&(s=!!s),{filename:t,pattern:d,format:k,mime:L,pages:i,padding:p,quality:o,matte:a,density:l,outline:s,archive:b}}class _t{static for(t){return new _t().append(t).get()}constructor(){this.crc=-1}get(){return~this.crc}append(t){for(var e=this.crc|0,r=this.table,n=0,o=t.length|0;n<o;n++)e=e>>>8^r[(e^t[n])&255];return this.crc=e,this}}_t.prototype.table=(()=>{var i,t,e,r=[];for(i=0;i<256;i++){for(e=i,t=0;t<8;t++)e=e&1?e>>>1^3988292384:e>>>1;r[i]=e}return r})();function Nt(i){let t=new Uint8Array(i),e=new DataView(t.buffer),r={array:t,view:e,size:i,set8(n,o){return e.setUint8(n,o),r},set16(n,o){return e.setUint16(n,o,!0),r},set32(n,o){return e.setUint32(n,o,!0),r},bytes(n,o){return t.set(o,n),r}};return r}class Tt{constructor(t){let e=new Date;Object.assign(this,{directory:t,offset:0,files:[],time:(e.getHours()<<6|e.getMinutes())<<5|e.getSeconds()/2,date:(e.getFullYear()-1980<<4|e.getMonth()+1)<<5|e.getDate()}),this.add(t)}async add(t,e){let r=!e,n=Tt.encoder.encode(`${this.directory}/${r?"":t}`),o=new Uint8Array(r?0:await e.arrayBuffer()),a=30+n.length,l=a+o.length,s=16,{offset:u}=this,f=Nt(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,_t.for(o)).set32(14,o.length).set32(18,o.length).set16(22,n.length);u+=a;let h=Nt(a+o.length+s).set32(0,67324752).bytes(4,f.array).bytes(30,n).bytes(a,o);u+=o.length,h.set32(l,134695760).bytes(l+4,f.array.slice(10,22)),u+=s,this.files.push({offset:u,folder:r,name:n,header:f,payload:h}),this.offset=u}toBuffer(){let t=this.files.reduce((h,{name:v})=>46+v.length+h,0),e=Nt(t+22),r=0;for(var{offset:n,name:o,header:a,folder:l}of this.files)e.set32(r,33639248).set16(r+4,20).bytes(r+6,a.array).set8(r+38,l?16:0).set32(r+42,n).bytes(r+46,o),r+=46+o.length;e.set32(r,101010256).set16(r+8,this.files.length).set16(r+10,this.files.length).set32(r+12,t).set32(r+16,this.offset);let s=new Uint8Array(this.offset+e.size),u=0;for(var{payload:f}of this.files)s.set(f.array,u),u+=f.size;return s.set(e.array,u),s}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}}Tt.encoder=new TextEncoder;const jt=(i,t,e,r)=>{if(r){let{width:n,height:o}=i,a=Object.assign(document.createElement("canvas"),{width:n,height:o}),l=a.getContext("2d");l.fillStyle=r,l.fillRect(0,0,n,o),l.drawImage(i,0,0),i=a}return new Promise((n,o)=>i.toBlob(n,t,e))},Me=(...i)=>jt(...i).then(t=>t.arrayBuffer()),Ne=async(i,t,e,r,n)=>{ce(n,await jt(i,t,e,r))},Oe=async(i,t,e,r,n,o,a)=>{let l=f=>o.replace("{}",String(f+1).padStart(a,"0")),s=ue(n,".zip")||"archive",u=new Tt(s);await Promise.all(i.map(async(f,h)=>{let v=l(h);await u.add(v,await jt(f,t,e,r))})),ce(`${s}.zip`,u.blob)},ce=(i,t)=>{const e=window.URL.createObjectURL(t),r=document.createElement("a");r.style.display="none",r.href=e,r.setAttribute("download",i),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>window.URL.revokeObjectURL(e),100)},Re=(i,t,e)=>i.map(r=>{if(t==1&&!e)return r.canvas;let n=document.createElement("canvas"),o=n.getContext("2d"),a=r.canvas?r.canvas:r;return n.width=a.width*t,n.height=a.height*t,e&&(o.fillStyle=e,o.fillRect(0,0,n.width,n.height)),o.scale(t,t),o.drawImage(a,0,0),n}),$e={asBuffer:Me,asDownload:Ne,asZipDownload:Oe,atScale:Re,options:Le},{asBuffer:Ot,asDownload:ze,asZipDownload:Ge,atScale:Rt,options:$t}=$e,Qt=Symbol.for("toDataURL"),Ue=i=>new Promise((t,e)=>Object.assign(new fe,{crossOrigin:"Anonymous",onload:t,onerror:e,src:i}));class je{constructor(t,e){let r=document.createElement("canvas"),n=[];Object.defineProperty(r,"async",{value:!0,writable:!1,enumerable:!0});for(var[o,a]of Object.entries({png:()=>Ot(r,"image/png"),jpg:()=>Ot(r,"image/jpeg"),pages:()=>n.concat(r).map(l=>l.getContext("2d"))}))Object.defineProperty(r,o,{get:a});return Object.assign(r,{width:t,height:e,newPage(...l){var{width:u,height:f}=r,s=Object.assign(document.createElement("canvas"),{width:u,height:f});s.getContext("2d").drawImage(r,0,0),n.push(s);var[u,f]=l.length?l:[u,f];return Object.assign(r,{width:u,height:f}).getContext("2d")},saveAs(l,s){s=typeof s=="number"?{quality:s}:s;let u=$t(this.pages,{filename:l,...s}),{pattern:f,padding:h,mime:v,quality:b,matte:D,density:k,archive:L}=u,g=Rt(u.pages,k);return h==null?ze(g[0],v,b,D,l):Ge(g,v,b,D,L,f,h)},toBuffer(l="png",s={}){s=typeof s=="number"?{quality:s}:s;let u=$t(this.pages,{extension:l,...s}),{mime:f,quality:h,matte:v,pages:b,density:D}=u,k=Rt(b,D,v)[0];return Ot(k,f,h,v)},[Qt]:r.toDataURL.bind(r),toDataURL(l="png",s={}){s=typeof s=="number"?{quality:s}:s;let u=$t(this.pages,{extension:l,...s}),{mime:f,quality:h,matte:v,pages:b,density:D}=u,k=Rt(b,D,v)[0],L=k[k===r?Qt:"toDataURL"](f,h);return Promise.resolve(L)}})}}const{CanvasRenderingContext2D:He,CanvasGradient:Ke,CanvasPattern:Xe,Image:fe,ImageData:Ze,Path2D:Ve,DOMMatrix:We,DOMRect:Je,DOMPoint:qe}=window,Ye={Canvas:je,loadImage:Ue,CanvasRenderingContext2D:He,CanvasGradient:Ke,CanvasPattern:Xe,Image:fe,ImageData:Ze,Path2D:Ve,DOMMatrix:We,DOMRect:Je,DOMPoint:qe},xt=(i,t,e={},r=e)=>{if(Array.isArray(t))t.forEach(n=>xt(i,n,e,r));else if(typeof t=="function")t(i,e,r,xt);else{const n=Object.keys(t)[0];Array.isArray(t[n])?(r[n]={},xt(i,t[n],e,r[n])):r[n]=t[n](i,e,r,xt)}return e},vt=(i,t)=>(e,r,n,o)=>{t(e,r,n)&&o(e,i,r,n)},Qe=(i,t)=>(e,r,n,o)=>{const a=[];let l=e.pos;for(;t(e,r,n);){const s={};if(o(e,i,r,s),e.pos===l)break;l=e.pos,a.push(s)}return a},tr=i=>({data:i,pos:0}),tt=()=>i=>i.data[i.pos++],he=(i=0)=>t=>t.data[t.pos+i],at=i=>t=>t.data.subarray(t.pos,t.pos+=i),St=i=>t=>t.data.subarray(t.pos,t.pos+i),Gt=i=>t=>Array.from(at(i)(t)).map(e=>String.fromCharCode(e)).join(""),pt=i=>t=>{const e=at(2)(t);return i?(e[1]<<8)+e[0]:(e[0]<<8)+e[1]},de=(i,t)=>(e,r,n)=>{const o=typeof t=="function"?t(e,r,n):t,a=at(i),l=new Array(o);for(var s=0;s<o;s++)l[s]=a(e);return l},er=(i,t,e)=>{for(var r=0,n=0;n<e;n++)r+=i[t+n]&&2**(e-n-1);return r},Ht=i=>t=>{const e=tt()(t),r=new Array(8);for(var n=0;n<8;n++)r[7-n]=!!(e&1<<n);return Object.keys(i).reduce((o,a)=>{const l=i[a];return l.length?o[a]=er(r,l.index,l.length):o[a]=r[l.index],o},{})};var Ft={blocks:i=>{const e=[],r=i.data.length;for(var n=0,o=tt()(i);o!==0&&o;o=tt()(i)){if(i.pos+o>=r){const u=r-i.pos;e.push(at(u)(i)),n+=u;break}e.push(at(o)(i)),n+=o}const a=new Uint8Array(n);for(var l=0,s=0;s<e.length;s++)a.set(e[s],l),l+=e[s].length;return a}};const rr=vt({gce:[{codes:at(2)},{byteSize:tt()},{extras:Ht({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:pt(!0)},{transparentColorIndex:tt()},{terminator:tt()}]},i=>{var t=St(2)(i);return t[0]===33&&t[1]===249}),nr=vt({image:[{code:tt()},{descriptor:[{left:pt(!0)},{top:pt(!0)},{width:pt(!0)},{height:pt(!0)},{lct:Ht({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},vt({lct:de(3,(i,t,e)=>Math.pow(2,e.descriptor.lct.size+1))},(i,t,e)=>e.descriptor.lct.exists),{data:[{minCodeSize:tt()},Ft]}]},i=>he()(i)===44),or=vt({text:[{codes:at(2)},{blockSize:tt()},{preData:(i,t,e)=>at(e.text.blockSize)(i)},Ft]},i=>{var t=St(2)(i);return t[0]===33&&t[1]===1}),ir=vt({application:[{codes:at(2)},{blockSize:tt()},{id:(i,t,e)=>Gt(e.blockSize)(i)},Ft]},i=>{var t=St(2)(i);return t[0]===33&&t[1]===255}),ar=vt({comment:[{codes:at(2)},Ft]},i=>{var t=St(2)(i);return t[0]===33&&t[1]===254}),sr=[{header:[{signature:Gt(3)},{version:Gt(3)}]},{lsd:[{width:pt(!0)},{height:pt(!0)},{gct:Ht({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:tt()},{pixelAspectRatio:tt()}]},vt({gct:de(3,(i,t)=>Math.pow(2,t.lsd.gct.size+1))},(i,t)=>t.lsd.gct.exists),{frames:Qe([rr,ir,ar,nr,or],i=>{var t=he()(i);return t===33||t===44})}],lr=(i,t)=>{const e=new Array(i.length),r=i.length/t,n=function(f,h){const v=i.slice(h*t,(h+1)*t);e.splice.apply(e,[f*t,t].concat(v))},o=[0,4,2,1],a=[8,8,4,2];for(var l=0,s=0;s<4;s++)for(var u=o[s];u<r;u+=a[s])n(u,l),l++;return e},ur=(i,t,e)=>{const o=e;var a,l,s,u,f,h,v,y,b,D,d,k,m,C,_,A;const L=new Array(e),g=new Array(4096),p=new Array(4096),E=new Array(4096+1);for(k=i,l=1<<k,f=l+1,a=l+2,v=-1,u=k+1,s=(1<<u)-1,b=0;b<l;b++)g[b]=0,p[b]=b;var d,y,m,C,A,_;for(d=y=m=C=A=_=0,D=0;D<o;){if(C===0){if(y<u){d+=t[_]<<y,y+=8,_++;continue}if(b=d&s,d>>=u,y-=u,b>a||b==f)break;if(b==l){u=k+1,s=(1<<u)-1,a=l+2,v=-1;continue}if(v==-1){E[C++]=p[b],v=b,m=b;continue}for(h=b,b==a&&(E[C++]=m,b=v);b>l;)E[C++]=p[b],b=g[b];m=p[b]&255,E[C++]=m,a<4096&&(g[a]=v,p[a]=m,a++,(a&s)===0&&a<4096&&(u++,s+=a)),v=h}C--,L[A++]=E[C],D++}for(D=A;D<o;D++)L[D]=0;return L},cr=i=>{const t=new Uint8Array(i);return xt(tr(t),sr)},fr=i=>{const t=i.pixels.length,e=new Uint8ClampedArray(t*4);for(var r=0;r<t;r++){const n=r*4,o=i.pixels[r],a=i.colorTable[o];e[n]=a[0],e[n+1]=a[1],e[n+2]=a[2],e[n+3]=o!==i.transparentIndex?255:0}return e},hr=(i,t,e)=>{if(!i.image){console.warn("gif frame does not have associated image.");return}const{image:r}=i,n=r.descriptor.width*r.descriptor.height;var o=ur(r.data.minCodeSize,r.data.blocks,n);r.descriptor.lct.interlaced&&(o=lr(o,r.descriptor.width));const a={pixels:o,dims:{top:i.image.descriptor.top,left:i.image.descriptor.left,width:i.image.descriptor.width,height:i.image.descriptor.height}};return r.descriptor.lct&&r.descriptor.lct.exists?a.colorTable=r.lct:a.colorTable=t,i.gce&&(a.delay=(i.gce.delay||10)*10,a.disposalType=i.gce.extras.disposal,i.gce.extras.transparentColorGiven&&(a.transparentIndex=i.gce.transparentColorIndex)),e&&(a.patch=fr(a)),a},dr=(i,t)=>i.frames.filter(e=>e.image).map(e=>hr(e,i.gct,t));function gr(i,t,e){const r=ge(t),n=i-1;let o=0;switch(e){case W.L:o=it[n][0];break;case W.M:o=it[n][1];break;case W.Q:o=it[n][2];break;case W.H:o=it[n][3];break}return r<=o}function pr(i,t){for(var e=1,r=ge(i),n=0,o=it.length;n<o;n++){var a=0;switch(t){case W.L:a=it[n][0];break;case W.M:a=it[n][1];break;case W.Q:a=it[n][2];break;case W.H:a=it[n][3];break}if(r<=a)break;e++}if(e>it.length)throw new Error("Too long data");return e}function ge(i){var t=encodeURI(i).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=Number(i)?3:0)}class mr{constructor(t){this.mode=Y.MODE_8BIT_BYTE,this.parsedData=[],this.data=t;const e=[];for(let r=0,n=this.data.length;r<n;r++){const o=[],a=this.data.charCodeAt(r);a>65536?(o[0]=240|(a&1835008)>>>18,o[1]=128|(a&258048)>>>12,o[2]=128|(a&4032)>>>6,o[3]=128|a&63):a>2048?(o[0]=224|(a&61440)>>>12,o[1]=128|(a&4032)>>>6,o[2]=128|a&63):a>128?(o[0]=192|(a&1984)>>>6,o[1]=128|a&63):o[0]=a,e.push(o)}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))}getLength(){return this.parsedData.length}write(t){for(let e=0,r=this.parsedData.length;e<r;e++)t.put(this.parsedData[e],8)}}class ht{constructor(t=-1,e=W.L){this.moduleCount=0,this.dataList=[],this.typeNumber=t,this.errorCorrectLevel=e,this.moduleCount=0,this.dataList=[]}addData(t){if(this.typeNumber<=0)this.typeNumber=pr(t,this.errorCorrectLevel);else{if(this.typeNumber>40)throw new Error(`Invalid QR version: ${this.typeNumber}`);if(!gr(this.typeNumber,t,this.errorCorrectLevel))throw new Error(`Data is too long for QR version: ${this.typeNumber}`)}const e=new mr(t);this.dataList.push(e),this.dataCache=void 0}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(`${t},${e}`);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++)this.modules[r][n]=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),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=ht.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(let n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)}getBestMaskPattern(){if(Number.isInteger(this.maskPattern)&&Object.values(lt).includes(this.maskPattern))return this.maskPattern;let t=0,e=0;for(let r=0;r<8;r++){this.makeImpl(!0,r);const n=I.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=I.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let r=0;r<t.length;r++){const n=t[e],o=t[r];if(this.modules[n][o]==null)for(let a=-2;a<=2;a++)for(let l=-2;l<=2;l++)a==-2||a==2||l==-2||l==2||a==0&&l==0?this.modules[n+a][o+l]=!0:this.modules[n+a][o+l]=!1}}setupTypeNumber(t){const e=I.getBCHTypeNumber(this.typeNumber);for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}}setupTypeInfo(t,e){const r=this.errorCorrectLevel<<3|e,n=I.getBCHTypeInfo(r);for(var o=0;o<15;o++){var a=!t&&(n>>o&1)==1;o<6?this.modules[o][8]=a:o<8?this.modules[o+1][8]=a:this.modules[this.moduleCount-15+o][8]=a}for(var o=0;o<15;o++){var a=!t&&(n>>o&1)==1;o<8?this.modules[8][this.moduleCount-o-1]=a:o<9?this.modules[8][15-o-1+1]=a:this.modules[8][15-o-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let r=-1,n=this.moduleCount-1,o=7,a=0;for(let l=this.moduleCount-1;l>0;l-=2)for(l==6&&l--;;){for(let s=0;s<2;s++)if(this.modules[n][l-s]==null){let u=!1;a<t.length&&(u=(t[a]>>>o&1)==1),I.getMask(e,n,l-s)&&(u=!u),this.modules[n][l-s]=u,o--,o==-1&&(a++,o=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}static createData(t,e,r){const n=ut.getRSBlocks(t,e),o=new vr;for(var a=0;a<r.length;a++){const s=r[a];o.put(s.mode,4),o.put(s.getLength(),I.getLengthInBits(s.mode,t)),s.write(o)}let l=0;for(var a=0;a<n.length;a++)l+=n[a].dataCount;if(o.getLengthInBits()>l*8)throw new Error(`code length overflow. (${o.getLengthInBits()}>${l*8})`);for(o.getLengthInBits()+4<=l*8&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=l*8||(o.put(ht.PAD0,8),o.getLengthInBits()>=l*8));)o.put(ht.PAD1,8);return ht.createBytes(o,n)}static createBytes(t,e){let r=0,n=0,o=0;const a=new Array(e.length),l=new Array(e.length);for(var s=0;s<e.length;s++){const b=e[s].dataCount,D=e[s].totalCount-b;n=Math.max(n,b),o=Math.max(o,D),a[s]=new Array(b);for(var u=0;u<a[s].length;u++)a[s][u]=255&t.buffer[u+r];r+=b;const k=I.getErrorCorrectPolynomial(D),g=new wt(a[s],k.getLength()-1).mod(k);l[s]=new Array(k.getLength()-1);for(var u=0;u<l[s].length;u++){const E=u+g.getLength()-l[s].length;l[s][u]=E>=0?g.get(E):0}}let f=0;for(var u=0;u<e.length;u++)f+=e[u].totalCount;const h=new Array(f);let v=0;for(var u=0;u<n;u++)for(var s=0;s<e.length;s++)u<a[s].length&&(h[v++]=a[s][u]);for(var u=0;u<o;u++)for(var s=0;s<e.length;s++)u<l[s].length&&(h[v++]=l[s][u]);return h}}ht.PAD0=236;ht.PAD1=17;const W={L:1,M:0,Q:3,H:2},Y={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3},lt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};class I{static getBCHTypeInfo(t){let e=t<<10;for(;I.getBCHDigit(e)-I.getBCHDigit(I.G15)>=0;)e^=I.G15<<I.getBCHDigit(e)-I.getBCHDigit(I.G15);return(t<<10|e)^I.G15_MASK}static getBCHTypeNumber(t){let e=t<<12;for(;I.getBCHDigit(e)-I.getBCHDigit(I.G18)>=0;)e^=I.G18<<I.getBCHDigit(e)-I.getBCHDigit(I.G18);return t<<12|e}static getBCHDigit(t){let e=0;for(;t!=0;)e++,t>>>=1;return e}static getPatternPosition(t){return I.PATTERN_POSITION_TABLE[t-1]}static getMask(t,e,r){switch(t){case lt.PATTERN000:return(e+r)%2==0;case lt.PATTERN001:return e%2==0;case lt.PATTERN010:return r%3==0;case lt.PATTERN011:return(e+r)%3==0;case lt.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case lt.PATTERN101:return e*r%2+e*r%3==0;case lt.PATTERN110:return(e*r%2+e*r%3)%2==0;case lt.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error(`bad maskPattern:${t}`)}}static getErrorCorrectPolynomial(t){let e=new wt([1],0);for(let r=0;r<t;r++)e=e.multiply(new wt([1,U.gexp(r)],0));return e}static getLengthInBits(t,e){if(1<=e&&e<10)switch(t){case Y.MODE_NUMBER:return 10;case Y.MODE_ALPHA_NUM:return 9;case Y.MODE_8BIT_BYTE:return 8;case Y.MODE_KANJI:return 8;default:throw new Error(`mode:${t}`)}else if(e<27)switch(t){case Y.MODE_NUMBER:return 12;case Y.MODE_ALPHA_NUM:return 11;case Y.MODE_8BIT_BYTE:return 16;case Y.MODE_KANJI:return 10;default:throw new Error(`mode:${t}`)}else if(e<41)switch(t){case Y.MODE_NUMBER:return 14;case Y.MODE_ALPHA_NUM:return 13;case Y.MODE_8BIT_BYTE:return 16;case Y.MODE_KANJI:return 12;default:throw new Error(`mode:${t}`)}else throw new Error(`type:${e}`)}static getLostPoint(t){const e=t.getModuleCount();let r=0;for(var n=0;n<e;n++)for(var o=0;o<e;o++){let s=0;const u=t.isDark(n,o);for(let f=-1;f<=1;f++)if(!(n+f<0||e<=n+f))for(let h=-1;h<=1;h++)o+h<0||e<=o+h||f==0&&h==0||u==t.isDark(n+f,o+h)&&s++;s>5&&(r+=3+s-5)}for(var n=0;n<e-1;n++)for(var o=0;o<e-1;o++){let f=0;t.isDark(n,o)&&f++,t.isDark(n+1,o)&&f++,t.isDark(n,o+1)&&f++,t.isDark(n+1,o+1)&&f++,(f==0||f==4)&&(r+=3)}for(var n=0;n<e;n++)for(var o=0;o<e-6;o++)t.isDark(n,o)&&!t.isDark(n,o+1)&&t.isDark(n,o+2)&&t.isDark(n,o+3)&&t.isDark(n,o+4)&&!t.isDark(n,o+5)&&t.isDark(n,o+6)&&(r+=40);for(var o=0;o<e;o++)for(var n=0;n<e-6;n++)t.isDark(n,o)&&!t.isDark(n+1,o)&&t.isDark(n+2,o)&&t.isDark(n+3,o)&&t.isDark(n+4,o)&&!t.isDark(n+5,o)&&t.isDark(n+6,o)&&(r+=40);let a=0;for(var o=0;o<e;o++)for(var n=0;n<e;n++)t.isDark(n,o)&&a++;return r+=Math.abs(100*a/e/e-50)/5*10,r}}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=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0;I.G18=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;I.G15_MASK=1<<14|1<<12|1<<10|1<<4|1<<1;class U{static glog(t){if(t<1)throw new Error(`glog(${t})`);return U.LOG_TABLE[t]}static gexp(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return U.EXP_TABLE[t]}}U.EXP_TABLE=new Array(256);U.LOG_TABLE=new Array(256);U._constructor=function(){for(var i=0;i<8;i++)U.EXP_TABLE[i]=1<<i;for(var i=8;i<256;i++)U.EXP_TABLE[i]=U.EXP_TABLE[i-4]^U.EXP_TABLE[i-5]^U.EXP_TABLE[i-6]^U.EXP_TABLE[i-8];for(var i=0;i<255;i++)U.LOG_TABLE[U.EXP_TABLE[i]]=i}();class wt{constructor(t,e){if(t.length==null)throw new Error(`${t.length}/${e}`);let r=0;for(;r<t.length&&t[r]==0;)r++;this.num=new Array(t.length-r+e);for(let n=0;n<t.length-r;n++)this.num[n]=t[n+r]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let r=0;r<this.getLength();r++)for(let n=0;n<t.getLength();n++)e[r+n]^=U.gexp(U.glog(this.get(r))+U.glog(t.get(n)));return new wt(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=U.glog(this.get(0))-U.glog(t.get(0)),r=new Array(this.getLength());for(var n=0;n<this.getLength();n++)r[n]=this.get(n);for(var n=0;n<t.getLength();n++)r[n]^=U.gexp(U.glog(t.get(n))+e);return new wt(r,0).mod(t)}}class ut{constructor(t,e){this.totalCount=t,this.dataCount=e}static getRSBlocks(t,e){const r=ut.getRsBlockTable(t,e);if(r==null)throw new Error(`bad rs block @ typeNumber:${t}/errorCorrectLevel:${e}`);const n=r.length/3,o=[];for(let a=0;a<n;a++){const l=r[a*3+0],s=r[a*3+1],u=r[a*3+2];for(let f=0;f<l;f++)o.push(new ut(s,u))}return o}static getRsBlockTable(t,e){switch(e){case W.L:return ut.RS_BLOCK_TABLE[(t-1)*4+0];case W.M:return ut.RS_BLOCK_TABLE[(t-1)*4+1];case W.Q:return ut.RS_BLOCK_TABLE[(t-1)*4+2];case W.H:return ut.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}ut.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]];class vr{constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}const it=[[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]];var br=100,Z=256,te=Z-1,ft=4,pe=16,Kt=1<<pe,me=10,Xt=10,wr=Kt>>Xt,yr=Kt<<me-Xt,Cr=Z>>3,Ut=6,xr=1<<Ut,Er=Cr*xr,Ar=30,ve=10,Bt=1<<ve,be=8,ee=1<<be,Br=ve+be,bt=1<<Br,re=499,ne=491,oe=487,we=503,Dr=3*we;function Pr(i,t){var e,r,n,o,a;function l(){e=[],r=new Int32Array(256),n=new Int32Array(Z),o=new Int32Array(Z),a=new Int32Array(Z>>3);var g,p;for(g=0;g<Z;g++)p=(g<<ft+8)/Z,e[g]=new Float64Array([p,p,p,0]),o[g]=Kt/Z,n[g]=0}function s(){for(var g=0;g<Z;g++)e[g][0]>>=ft,e[g][1]>>=ft,e[g][2]>>=ft,e[g][3]=g}function u(g,p,E,d,y){e[p][0]-=g*(e[p][0]-E)/Bt,e[p][1]-=g*(e[p][1]-d)/Bt,e[p][2]-=g*(e[p][2]-y)/Bt}function f(g,p,E,d,y){for(var m=Math.abs(p-g),C=Math.min(p+g,Z),A=p+1,_=p-1,M=1,c,N;A<C||_>m;)N=a[M++],A<C&&(c=e[A++],c[0]-=N*(c[0]-E)/bt,c[1]-=N*(c[1]-d)/bt,c[2]-=N*(c[2]-y)/bt),_>m&&(c=e[_--],c[0]-=N*(c[0]-E)/bt,c[1]-=N*(c[1]-d)/bt,c[2]-=N*(c[2]-y)/bt)}function h(g,p,E){var d=2147483647,y=d,m=-1,C=m,A,_,M,c,N;for(A=0;A<Z;A++)_=e[A],M=Math.abs(_[0]-g)+Math.abs(_[1]-p)+Math.abs(_[2]-E),M<d&&(d=M,m=A),c=M-(n[A]>>pe-ft),c<y&&(y=c,C=A),N=o[A]>>Xt,o[A]-=N,n[A]+=N<<me;return o[m]+=wr,n[m]-=yr,C}function v(){var g,p,E,d,y,m,C=0,A=0;for(g=0;g<Z;g++){for(E=e[g],y=g,m=E[1],p=g+1;p<Z;p++)d=e[p],d[1]<m&&(y=p,m=d[1]);if(d=e[y],g!=y&&(p=d[0],d[0]=E[0],E[0]=p,p=d[1],d[1]=E[1],E[1]=p,p=d[2],d[2]=E[2],E[2]=p,p=d[3],d[3]=E[3],E[3]=p),m!=C){for(r[C]=A+g>>1,p=C+1;p<m;p++)r[p]=g;C=m,A=g}}for(r[C]=A+te>>1,p=C+1;p<256;p++)r[p]=te}function b(g,p,E){for(var d,y,m,C=1e3,A=-1,_=r[p],M=_-1;_<Z||M>=0;)_<Z&&(y=e[_],m=y[1]-p,m>=C?_=Z:(_++,m<0&&(m=-m),d=y[0]-g,d<0&&(d=-d),m+=d,m<C&&(d=y[2]-E,d<0&&(d=-d),m+=d,m<C&&(C=m,A=y[3])))),M>=0&&(y=e[M],m=p-y[1],m>=C?M=-1:(M--,m<0&&(m=-m),d=y[0]-g,d<0&&(d=-d),m+=d,m<C&&(d=y[2]-E,d<0&&(d=-d),m+=d,m<C&&(C=m,A=y[3]))));return A}function D(){var g,p=i.length,E=30+(t-1)/3,d=p/(3*t),y=~~(d/br),m=Bt,C=Er,A=C>>Ut;for(A<=1&&(A=0),g=0;g<A;g++)a[g]=m*((A*A-g*g)*ee/(A*A));var _;p<Dr?(t=1,_=3):p%re!==0?_=3*re:p%ne!==0?_=3*ne:p%oe!==0?_=3*oe:_=3*we;var M,c,N,x,O=0;for(g=0;g<d;)if(M=(i[O]&255)<<ft,c=(i[O+1]&255)<<ft,N=(i[O+2]&255)<<ft,x=h(M,c,N),u(m,x,M,c,N),A!==0&&f(A,x,M,c,N),O+=_,O>=p&&(O-=p),g++,y===0&&(y=1),g%y===0)for(m-=m/E,C-=C/Ar,A=C>>Ut,A<=1&&(A=0),x=0;x<A;x++)a[x]=m*((A*A-x*x)*ee/(A*A))}function k(){l(),D(),s(),v()}this.buildColormap=k;function L(){for(var g=[],p=[],E=0;E<Z;E++)p[e[E][3]]=E;for(var d=0,y=0;y<Z;y++){var m=p[y];g[d++]=e[m][0],g[d++]=e[m][1],g[d++]=e[m][2]}return g}this.getColormap=L,this.lookupRGB=b}var ie=-1,Dt=12,Ct=5003,kr=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function _r(i,t,e,r){var n=Math.max(2,r),o=new Uint8Array(256),a=new Int32Array(Ct),l=new Int32Array(Ct),s,u=0,f,h=0,v,b=!1,D,k,L,g,p,E;function d(x,O){o[f++]=x,f>=254&&_(O)}function y(x){m(Ct),h=k+2,b=!0,N(k,x)}function m(x){for(var O=0;O<x;++O)a[O]=-1}function C(x,O){var w,dt,G,et,ct,j,rt;for(D=x,b=!1,E=D,v=M(E),k=1<<x-1,L=k+1,h=k+2,f=0,et=c(),rt=0,w=Ct;w<65536;w*=2)++rt;rt=8-rt,j=Ct,m(j),N(k,O);t:for(;(dt=c())!=ie;){if(w=(dt<<Dt)+et,G=dt<<rt^et,a[G]===w){et=l[G];continue}else if(a[G]>=0){ct=j-G,G===0&&(ct=1);do if((G-=ct)<0&&(G+=j),a[G]===w){et=l[G];continue t}while(a[G]>=0)}N(et,O),et=dt,h<1<<Dt?(l[G]=h++,a[G]=w):y(O)}N(et,O),N(L,O)}function A(x){x.writeByte(n),g=i*t,p=0,C(n+1,x),x.writeByte(0)}function _(x){f>0&&(x.writeByte(f),x.writeBytes(o,0,f),f=0)}function M(x){return(1<<x)-1}function c(){if(g===0)return ie;--g;var x=e[p++];return x&255}function N(x,O){for(s&=kr[u],u>0?s|=x<<u:s=x,u+=E;u>=8;)d(s&255,O),s>>=8,u-=8;if((h>v||b)&&(b?(v=M(E=D),b=!1):(++E,E==Dt?v=1<<Dt:v=M(E))),x==L){for(;u>0;)d(s&255,O),s>>=8,u-=8;_(O)}}this.encode=A}function q(){this.page=-1,this.pages=[],this.newPage()}q.pageSize=4096;q.charMap={};for(var Pt=0;Pt<256;Pt++)q.charMap[Pt]=String.fromCharCode(Pt);q.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(q.pageSize),this.cursor=0};q.prototype.getData=function(){for(var i="",t=0;t<this.pages.length;t++)for(var e=0;e<q.pageSize;e++)i+=q.charMap[this.pages[t][e]];return i};q.prototype.toFlattenUint8Array=function(){const i=[];for(var t=0;t<this.pages.length;t++)if(t===this.pages.length-1){const r=Uint8Array.from(this.pages[t].slice(0,this.cursor));i.push(r)}else i.push(this.pages[t]);const e=new Uint8Array(i.reduce((r,n)=>r+n.length,0));return i.reduce((r,n)=>(e.set(n,r),r+n.length),0),e};q.prototype.writeByte=function(i){this.cursor>=q.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=i};q.prototype.writeUTFBytes=function(i){for(var t=i.length,e=0;e<t;e++)this.writeByte(i.charCodeAt(e))};q.prototype.writeBytes=function(i,t,e){for(var r=e||i.length,n=t||0;n<r;n++)this.writeByte(i[n])};function R(i,t){this.width=~~i,this.height=~~t,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 q}R.prototype.setDelay=function(i){this.delay=Math.round(i/10)};R.prototype.setFrameRate=function(i){this.delay=Math.round(100/i)};R.prototype.setDispose=function(i){i>=0&&(this.dispose=i)};R.prototype.setRepeat=function(i){this.repeat=i};R.prototype.setTransparent=function(i){this.transparent=i};R.prototype.addFrame=function(i){this.image=i,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),this.globalPalette===!0&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),!this.firstFrame&&!this.globalPalette&&this.writePalette(),this.writePixels(),this.firstFrame=!1};R.prototype.finish=function(){this.out.writeByte(59)};R.prototype.setQuality=function(i){i<1&&(i=1),this.sample=i};R.prototype.setDither=function(i){i===!0&&(i="FloydSteinberg"),this.dither=i};R.prototype.setGlobalPalette=function(i){this.globalPalette=i};R.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};R.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};R.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new Pr(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,this.transparent!==null&&(this.transIndex=this.findClosest(this.transparent,!0))};R.prototype.indexPixels=function(i){var t=this.pixels.length/3;this.indexedPixels=new Uint8Array(t);for(var e=0,r=0;r<t;r++){var n=this.findClosestRGB(this.pixels[e++]&255,this.pixels[e++]&255,this.pixels[e++]&255);this.usedEntry[n]=!0,this.indexedPixels[r]=n}};R.prototype.ditherPixels=function(i,t){var e={FalseFloydSteinberg:[[.375,1,0],[.375,0,1],[.25,1,1]],FloydSteinberg:[[.4375,1,0],[.1875,-1,1],[.3125,0,1],[.0625,1,1]],Stucki:[[.19047619047619047,1,0],[.09523809523809523,2,0],[.047619047619047616,-2,1],[.09523809523809523,-1,1],[.19047619047619047,0,1],[.09523809523809523,1,1],[.047619047619047616,2,1],[.023809523809523808,-2,2],[.047619047619047616,-1,2],[.09523809523809523,0,2],[.047619047619047616,1,2],[.023809523809523808,2,2]],Atkinson:[[.125,1,0],[.125,2,0],[.125,-1,1],[.125,0,1],[.125,1,1],[.125,0,2]]};if(!i||!e[i])throw"Unknown dithering kernel: "+i;var r=e[i],n=0,o=this.height,a=this.width,l=this.pixels,s=t?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var u=0;u<o;u++){t&&(s=s*-1);for(var f=s==1?0:a-1,h=s==1?a:0;f!==h;f+=s){n=u*a+f;var v=n*3,b=l[v],D=l[v+1],k=l[v+2];v=this.findClosestRGB(b,D,k),this.usedEntry[v]=!0,this.indexedPixels[n]=v,v*=3;for(var L=this.colorTab[v],g=this.colorTab[v+1],p=this.colorTab[v+2],E=b-L,d=D-g,y=k-p,m=s==1?0:r.length-1,C=s==1?r.length:0;m!==C;m+=s){var A=r[m][1],_=r[m][2];if(A+f>=0&&A+f<a&&_+u>=0&&_+u<o){var M=r[m][0];v=n+A+_*a,v*=3,l[v]=Math.max(0,Math.min(255,l[v]+E*M)),l[v+1]=Math.max(0,Math.min(255,l[v+1]+d*M)),l[v+2]=Math.max(0,Math.min(255,l[v+2]+y*M))}}}}};R.prototype.findClosest=function(i,t){return this.findClosestRGB((i&16711680)>>16,(i&65280)>>8,i&255,t)};R.prototype.findClosestRGB=function(i,t,e,r){if(this.colorTab===null)return-1;if(this.neuQuant&&!r)return this.neuQuant.lookupRGB(i,t,e);for(var n=0,o=256*256*256,a=this.colorTab.length,l=0,s=0;l<a;s++){var u=i-(this.colorTab[l++]&255),f=t-(this.colorTab[l++]&255),h=e-(this.colorTab[l++]&255),v=u*u+f*f+h*h;(!r||this.usedEntry[s])&&v<o&&(o=v,n=s)}return n};R.prototype.getImagePixels=function(){var i=this.width,t=this.height;this.pixels=new Uint8Array(i*t*3);for(var e=this.image,r=0,n=0,o=0;o<t;o++)for(var a=0;a<i;a++)this.pixels[n++]=e[r++],this.pixels[n++]=e[r++],this.pixels[n++]=e[r++],r++};R.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33),this.out.writeByte(249),this.out.writeByte(4);var i,t;this.transparent===null?(i=0,t=0):(i=1,t=2),this.dispose>=0&&(t=this.dispose&7),t<<=2,this.out.writeByte(0|t|0|i),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)};R.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)};R.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)};R.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)};R.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var i=3*256-this.colorTab.length,t=0;t<i;t++)this.out.writeByte(0)};R.prototype.writeShort=function(i){this.out.writeByte(i&255),this.out.writeByte(i>>8&255)};R.prototype.writePixels=function(){var i=new _r(this.width,this.height,this.indexedPixels,this.colorDepth);i.encode(this.out)};R.prototype.stream=function(){return this.out};var Tr=globalThis&&globalThis.__awaiter||function(i,t,e,r){function n(o){return o instanceof e?o:new e(function(a){a(o)})}return new(e||(e=Promise))(function(o,a){function l(f){try{u(r.next(f))}catch(h){a(h)}}function s(f){try{u(r.throw(f))}catch(h){a(h)}}function u(f){f.done?o(f.value):n(f.value).then(l,s)}u((r=r.apply(i,t||[])).next())})};const{Canvas:st}=Ye,kt=.4;function ae(i){if(!i)return;function t(e){e.onload=null,e.onerror=null}return new Promise(function(e,r){if(i.slice(0,4)=="data"){let o=new Image;o.onload=function(){e(o),t(o)},o.onerror=function(){r("Image load error"),t(o)},o.src=i;return}let n=new Image;n.setAttribute("crossOrigin","Anonymous"),n.onload=function(){e(n)},n.onerror=function(){r("Image load error")},n.src=i})}class F{constructor(t){const e=Object.assign({},t);if(Object.keys(F.defaultOptions).forEach(r=>{r in e||Object.defineProperty(e,r,{value:F.defaultOptions[r],enumerable:!0,writable:!0})}),e.components?typeof e.components=="object"&&Object.keys(F.defaultComponentOptions).forEach(r=>{r in e.components?Object.defineProperty(e.components,r,{value:Object.assign(Object.assign({},F.defaultComponentOptions[r]),e.components[r]),enumerable:!0,writable:!0}):Object.defineProperty(e.components,r,{value:F.defaultComponentOptions[r],enumerable:!0,writable:!0})}):e.components=F.defaultComponentOptions,e.dotScale!==null&&e.dotScale!==void 0){if(e.dotScale<=0||e.dotScale>1)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=new st(t.size,t.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new ht(-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()}draw(){return new Promise(t=>this._draw().then(t))}_clear(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}static _prepareRoundedCornerClip(t,e,r,n,o,a){t.beginPath(),t.moveTo(e,r),t.arcTo(e+n,r,e+n,r+o,a),t.arcTo(e+n,r+o,e,r+o,a),t.arcTo(e,r+o,e,r,a),t.arcTo(e,r,e+n,r,a),t.closePath()}static _getAverageRGB(t){const r={r:0,g:0,b:0};let n,o,a=-4;const l={r:0,g:0,b:0};let s=0;o=t.naturalHeight||t.height,n=t.naturalWidth||t.width;const f=new st(n,o).getContext("2d");if(!f)return r;f.drawImage(t,0,0);let h;try{h=f.getImageData(0,0,n,o)}catch{return r}for(;(a+=5*4)<h.data.length;)h.data[a]>200||h.data[a+1]>200||h.data[a+2]>200||(++s,l.r+=h.data[a],l.g+=h.data[a+1],l.b+=h.data[a+2]);return l.r=~~(l.r/s),l.g=~~(l.g/s),l.b=~~(l.b/s),l}static _drawDot(t,e,r,n,o=0,a=1){t.fillRect((e+o)*n,(r+o)*n,a*n,a*n)}static _drawAlignProtector(t,e,r,n){t.clearRect((e-2)*n,(r-2)*n,5*n,5*n),t.fillRect((e-2)*n,(r-2)*n,5*n,5*n)}static _drawAlign(t,e,r,n,o=0,a=1,l,s){const u=t.fillStyle;t.fillStyle=l,new Array(4).fill(0).map((f,h)=>{F._drawDot(t,e-2+h,r-2,n,o,a),F._drawDot(t,e+2,r-2+h,n,o,a),F._drawDot(t,e+2-h,r+2,n,o,a),F._drawDot(t,e-2,r+2-h,n,o,a)}),F._drawDot(t,e,r,n,o,a),s||(t.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map((f,h)=>{F._drawDot(t,e-1+h,r-1,n,o,a),F._drawDot(t,e+1,r-1+h,n,o,a),F._drawDot(t,e+1-h,r+1,n,o,a),F._drawDot(t,e-1,r+1-h,n,o,a)})),t.fillStyle=u}_draw(){var t,e,r,n,o,a,l,s,u,f,h,v,b,D,k,L,g,p,E;return Tr(this,void 0,void 0,function*(){const d=(t=this.qrCode)===null||t===void 0?void 0:t.moduleCount,y=this.options.size;let m=this.options.margin;(m<0||m*2>=y)&&(m=0);const C=Math.ceil(m),A=y-2*m,_=this.options.whiteMargin,M=this.options.backgroundDimming,c=Math.ceil(A/d),N=c*d,x=N+2*C,O=new st(x,x),w=O.getContext("2d");this._clear(),w.save(),w.translate(C,C);const dt=new st(x,x),G=dt.getContext("2d");let et=null,ct=[];if(this.options.gifBackground){const B=cr(this.options.gifBackground);if(et=B,ct=dr(B,!0),this.options.autoColor){let P=0,T=0,S=0,K=0;for(let $=0;$<ct[0].colorTable.length;$++){const z=ct[0].colorTable[$];z[0]>200||z[1]>200||z[2]>200||z[0]===0&&z[1]===0&&z[2]===0||(K++,P+=z[0],T+=z[1],S+=z[2])}P=~~(P/K),T=~~(T/K),S=~~(S/K),this.options.colorDark=`rgb(${P},${T},${S})`}}else if(this.options.backgroundImage){const B=yield ae(this.options.backgroundImage);if(this.options.autoColor){const P=F._getAverageRGB(B);this.options.colorDark=`rgb(${P.r},${P.g},${P.b})`}G.drawImage(B,0,0,B.width,B.height,0,0,x,x),G.rect(0,0,x,x),G.fillStyle=M,G.fill()}else G.rect(0,0,x,x),G.fillStyle=this.options.colorLight,G.fill();const j=I.getPatternPosition(this.qrCode.typeNumber),rt=((r=(e=this.options.components)===null||e===void 0?void 0:e.data)===null||r===void 0?void 0:r.scale)||kt,Zt=(1-rt)*.5;for(let B=0;B<d;B++)for(let P=0;P<d;P++){const T=this.qrCode.isDark(B,P),S=P<8&&(B<8||B>=d-8)||P>=d-8&&B<8,K=B==6&&P>=8&&P<=d-8||P==6&&B>=8&&B<=d-8;let $=S||K;for(let V=1;V<j.length-1;V++)$=$||B>=j[V]-2&&B<=j[V]+2&&P>=j[V]-2&&P<=j[V]+2;const z=P*c+($?0:Zt*c),nt=B*c+($?0:Zt*c);if(w.strokeStyle=T?this.options.colorDark:this.options.colorLight,w.lineWidth=.5,w.fillStyle=T?this.options.colorDark:this.options.colorLight,j.length===0)$||w.fillRect(z,nt,($?1:rt)*c,($?1:rt)*c);else{const V=P<d-4&&P>=d-4-5&&B<d-4&&B>=d-4-5;!$&&!V&&w.fillRect(z,nt,($?1:rt)*c,($?1:rt)*c)}}const Q=j[j.length-1],ye=this.options.colorLight;if(w.fillStyle=ye,w.fillRect(0,0,8*c,8*c),w.fillRect(0,(d-8)*c,8*c,8*c),w.fillRect((d-8)*c,0,8*c,8*c),!((o=(n=this.options.components)===null||n===void 0?void 0:n.timing)===null||o===void 0)&&o.protectors&&(w.fillRect(8*c,6*c,(d-8-8)*c,c),w.fillRect(6*c,8*c,c,(d-8-8)*c)),!((l=(a=this.options.components)===null||a===void 0?void 0:a.cornerAlignment)===null||l===void 0)&&l.protectors&&F._drawAlignProtector(w,Q,Q,c),!((u=(s=this.options.components)===null||s===void 0?void 0:s.alignment)===null||u===void 0)&&u.protectors)for(let B=0;B<j.length;B++)for(let P=0;P<j.length;P++){const T=j[P],S=j[B];if(!(T===6&&(S===6||S===Q))){if(S===6&&(T===6||T===Q))continue;if(T===Q&&S===Q)continue;F._drawAlignProtector(w,T,S,c)}}w.fillStyle=this.options.colorDark,w.fillRect(0,0,7*c,c),w.fillRect((d-7)*c,0,7*c,c),w.fillRect(0,6*c,7*c,c),w.fillRect((d-7)*c,6*c,7*c,c),w.fillRect(0,(d-7)*c,7*c,c),w.fillRect(0,(d-7+6)*c,7*c,c),w.fillRect(0,0,c,7*c),w.fillRect(6*c,0,c,7*c),w.fillRect((d-7)*c,0,c,7*c),w.fillRect((d-7+6)*c,0,c,7*c),w.fillRect(0,(d-7)*c,c,7*c),w.fillRect(6*c,(d-7)*c,c,7*c),w.fillRect(2*c,2*c,3*c,3*c),w.fillRect((d-7+2)*c,2*c,3*c,3*c),w.fillRect(2*c,(d-7+2)*c,3*c,3*c);const It=((h=(f=this.options.components)===null||f===void 0?void 0:f.timing)===null||h===void 0?void 0:h.scale)||kt,Vt=(1-It)*.5;for(let B=0;B<d-8;B+=2)F._drawDot(w,8+B,6,c,Vt,It),F._drawDot(w,6,8+B,c,Vt,It);const Wt=((b=(v=this.options.components)===null||v===void 0?void 0:v.cornerAlignment)===null||b===void 0?void 0:b.scale)||kt,Ce=(1-Wt)*.5;F._drawAlign(w,Q,Q,c,Ce,Wt,this.options.colorDark,((k=(D=this.options.components)===null||D===void 0?void 0:D.cornerAlignment)===null||k===void 0?void 0:k.protectors)||!1);const Jt=((g=(L=this.options.components)===null||L===void 0?void 0:L.alignment)===null||g===void 0?void 0:g.scale)||kt,xe=(1-Jt)*.5;for(let B=0;B<j.length;B++)for(let P=0;P<j.length;P++){const T=j[P],S=j[B];if(!(T===6&&(S===6||S===Q))){if(S===6&&(T===6||T===Q))continue;if(T===Q&&S===Q)continue;F._drawAlign(w,T,S,c,xe,Jt,this.options.colorDark,((E=(p=this.options.components)===null||p===void 0?void 0:p.alignment)===null||E===void 0?void 0:E.protectors)||!1)}}if(_&&(w.fillStyle=this.options.backgroundColor,w.fillRect(-C,-C,x,C),w.fillRect(-C,N,x,C),w.fillRect(N,-C,C,x),w.fillRect(-C,-C,C,x)),this.options.logoImage){const B=yield ae(this.options.logoImage);let P=this.options.logoScale,T=this.options.logoMargin,S=this.options.logoCornerRadius;(P<=0||P>=1)&&(P=.2),T<0&&(T=0),S<0&&(S=0);const K=N*P,$=.5*(x-K),z=$;w.restore(),w.fillStyle=this.options.logoBackgroundColor,w.save(),F._prepareRoundedCornerClip(w,$-T,z-T,K+2*T,K+2*T,S+T),w.clip();const nt=w.globalCompositeOperation;w.globalCompositeOperation="destination-out",w.fill(),w.globalCompositeOperation=nt,w.restore(),w.save(),F._prepareRoundedCornerClip(w,$,z,K,K,S),w.clip(),w.drawImage(B,$,z,K,K),w.restore(),w.save(),w.translate(C,C)}if(et){let B,P,T,S,K,$;if(ct.forEach(function(z){B||(B=new R(y,y),B.setDelay(z.delay),B.setRepeat(0));const{width:nt,height:V}=z.dims;P||(P=new st(nt,V),T=P.getContext("2d"),T.rect(0,0,P.width,P.height),T.fillStyle="#ffffff",T.fill()),(!S||!$||nt!==S.width||V!==S.height)&&(S=new st(nt,V),K=S.getContext("2d"),$=K.createImageData(nt,V)),$.data.set(z.patch),K.putImageData($,0,0),T.drawImage(S.getContext("2d").canvas,z.dims.left,z.dims.top);const Et=new st(x,x),yt=Et.getContext("2d");yt.drawImage(P.getContext("2d").canvas,0,0,x,x),yt.rect(0,0,x,x),yt.fillStyle=M,yt.fill(),yt.drawImage(O.getContext("2d").canvas,0,0,x,x);const Lt=new st(y,y),qt=Lt.getContext("2d");qt.drawImage(Et.getContext("2d").canvas,0,0,y,y),B.addFrame(qt.getImageData(0,0,Lt.width,Lt.height).data)}),!B)throw new Error("No frames.");if(B.finish(),se(this.canvas)){const nt=B.stream().toFlattenUint8Array().reduce((V,Et)=>V+String.fromCharCode(Et),"");return Promise.resolve(`data:image/gif;base64,${window.btoa(nt)}`)}return Promise.resolve(Buffer.from(B.stream().toFlattenUint8Array()))}else{G.drawImage(O.getContext("2d").canvas,0,0,x,x),w.drawImage(dt.getContext("2d").canvas,-C,-C,x,x);const B=new st(y,y);B.getContext("2d").drawImage(O.getContext("2d").canvas,0,0,y,y),this.canvas=B;const T=this.options.gifBackground?"gif":"png";return se(this.canvas)?Promise.resolve(this.canvas.toDataURL(T)):Promise.resolve(this.canvas.toBuffer(T))}})}}F.CorrectLevel=W;F.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}};F.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"rgba(255, 255, 255, 0.6)",correctLevel:W.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:F.defaultComponentOptions,autoColor:!0,logoBackgroundColor:"#ffffff",backgroundColor:"#ffffff"};function se(i){try{return i instanceof HTMLElement}catch{return typeof i=="object"&&i.nodeType===1&&typeof i.style=="object"&&typeof i.ownerDocument=="object"}}const Sr={props:{text:{type:String,required:!0},qid:{type:String},correctLevel:{type:Number,default:1},size:{type:Number,default:200},margin:{type:Number,default:20},colorDark:{type:String,default:"#000000"},colorLight:{type:String,default:"#FFFFFF"},bgSrc:{type:String,default:void 0},background:{type:String,default:"rgba(0,0,0,0)"},backgroundDimming:{type:String,default:"rgba(0,0,0,0)"},logoSrc:{type:String,default:void 0},logoBackgroundColor:{type:String,default:"rgba(255,255,255,1)"},gifBgSrc:{type:String,default:void 0},logoScale:{type:Number,default:.2},logoMargin:{type:Number,default:0},logoCornerRadius:{type:Number,default:8},whiteMargin:{type:[Boolean,String],default:!0},dotScale:{type:Number,default:1},autoColor:{type:[Boolean,String],default:!0},binarize:{type:[Boolean,String],default:!1},binarizeThreshold:{type:Number,default:128},callback:{type:Function,default:function(){}},bindElement:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#FFFFFF"},components:{default:function(){return{data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}}}}},name:"vue-qr",data(){return{imgUrl:""}},watch:{$props:{deep:!0,handler(){this.main()}}},mounted(){this.main()},methods:{async main(){if(this.gifBgSrc){const e=await Te(this.gifBgSrc),r=this.logoSrc;this.render(void 0,r,e);return}const i=this.bgSrc,t=this.logoSrc;this.render(i,t)},async render(i,t,e){const r=this;new F({gifBackground:e,text:r.text,size:r.size,margin:r.margin,colorDark:r.colorDark,colorLight:r.colorLight,backgroundColor:r.backgroundColor,backgroundImage:i,backgroundDimming:r.backgroundDimming,logoImage:t,logoScale:r.logoScale,logoBackgroundColor:r.logoBackgroundColor,correctLevel:r.correctLevel,logoMargin:r.logoMargin,logoCornerRadius:r.logoCornerRadius,whiteMargin:Mt(r.whiteMargin),dotScale:r.dotScale,autoColor:Mt(r.autoColor),binarize:Mt(r.binarize),binarizeThreshold:r.binarizeThreshold,components:r.components}).draw().then(n=>{this.imgUrl=n,r.callback&&r.callback(n,r.qid)})}}},Fr=["src"];function Ir(i,t,e,r,n,o){return e.bindElement?(le(),Ae("img",{key:0,style:{display:"inline-block"},src:n.imgUrl},null,8,Fr)):Be("",!0)}const Lr=Ee(Sr,[["render",Ir]]),Mr={style:{display:"flex"}},Nr=zt("a",{href:"https://github.com/Binaryify/vue-qr",target:"_blank"},"https://github.com/Binaryify/vue-qr",-1),Rr=De({__name:"index",setup(i){const t=At(null),e=At(null),r=At("black"),n=At("https://github.com/zouzhibin/vue-admin-perfect"),o=l=>{switch(l){case 1:r.value="black",t.value=null;return;case 2:t.value=_e;return;case 3:r.value=ke();return;case 4:let s=new Date().getTime(),u=document.createElement("a");u.style.display="none",u.download=s,u.href=e.value,document.body.appendChild(u),u.click(),u.remove();return}},a=l=>{e.value=l};return(l,s)=>{const u=gt("el-input"),f=gt("collection"),h=gt("el-icon"),v=gt("el-button"),b=gt("el-descriptions-item"),D=gt("el-descriptions"),k=gt("PageWrapLayout");return le(),Pe(k,null,{default:X(()=>[zt("div",Mr,[H(u,{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=L=>n.value=L),placeholder:"\u8BF7\u8F93\u5165",style:{width:"400px","max-width":"100%"}},null,8,["modelValue"]),H(v,{type:"primary",onClick:s[1]||(s[1]=L=>o(1))},{default:X(()=>[H(h,{style:{"margin-right":"6px"}},{default:X(()=>[H(f)]),_:1}),J(" \u751F\u6210\u666E\u901A\u4E8C\u7EF4\u7801 ")]),_:1}),H(v,{type:"primary",onClick:s[2]||(s[2]=L=>o(2))},{default:X(()=>[J("\u751F\u6210\u5E26logo")]),_:1}),H(v,{type:"primary",onClick:s[3]||(s[3]=L=>o(3))},{default:X(()=>[J("\u751F\u6210\u968F\u673A\u989C\u8272\u4E8C\u7EF4\u7801")]),_:1}),H(v,{type:"primary",onClick:s[4]||(s[4]=L=>o(4))},{default:X(()=>[J("\u4E0B\u8F7D")]),_:1})]),zt("div",null,[H(Lr,{logoSrc:t.value,text:n.value,size:200,callback:a,"color-dark":r.value},null,8,["logoSrc","text","color-dark"])]),H(D,{title:"\u914D\u7F6E\u9879 ",column:1,border:"",class:"descriptions"},{default:X(()=>[H(b,{label:"\u5B98\u65B9\u6587\u6863"},{default:X(()=>[Nr]),_:1}),H(b,{label:"text"},{default:X(()=>[J(" \u4E8C\u7EF4\u7801\u5185\u5BB9\uFF0C\u9ED8\u8BA4\u4E3A 'https://github.com/zouzhibin/vue-admin-perfect' ")]),_:1}),H(b,{label:"logoSrc"},{default:X(()=>[J(" \u5D4C\u5165\u81F3\u4E8C\u7EF4\u7801\u4E2D\u5FC3\u7684 LOGO \u5730\u5740 ")]),_:1}),H(b,{label:"size"},{default:X(()=>[J(" \u5C3A\u5BF8, \u957F\u5BBD\u4E00\u81F4, \u5305\u542B\u5916\u8FB9\u8DDD\uFF0C\u9ED8\u8BA4\u4E3A 200 ")]),_:1}),H(b,{label:"margin"},{default:X(()=>[J(" \u4E8C\u7EF4\u7801\u56FE\u50CF\u7684\u5916\u8FB9\u8DDD, \u9ED8\u8BA4 20px ")]),_:1}),H(b,{label:"logoMargin"},{default:X(()=>[J(" \u6807\u8BC6\u5468\u56F4\u7684\u7A7A\u767D\u8FB9\u6846, \u9ED8\u8BA4\u4E3A0 ")]),_:1}),H(b,{label:"correctLevel"},{default:X(()=>[J(" \u5BB9\u9519\u7EA7\u522B 0-3 ")]),_:1}),H(b,{label:"autoColor"},{default:X(()=>[J(" \u82E5\u4E3A true, \u80CC\u666F\u56FE\u7684\u4E3B\u8981\u989C\u8272\u5C06\u4F5C\u4E3A\u5B9E\u70B9\u7684\u989C\u8272, \u5373 colorDark,\u9ED8\u8BA4 true ")]),_:1}),H(b,{label:"colorDark"},{default:X(()=>[J(" \u5B9E\u70B9\u7684\u989C\u8272,\u9ED8\u8BA4\u989C\u8272\u503C =>\u9ED1\u8272 ")]),_:1}),H(b,{label:"colorLight"},{default:X(()=>[J(" \u7A7A\u767D\u533A\u7684\u989C\u8272 ")]),_:1}),H(b,{label:"callback"},{default:X(()=>[J(" \u751F\u6210\u7684\u4E8C\u7EF4\u7801 Data URI \u53EF\u4EE5\u5728\u56DE\u8C03\u4E2D\u53D6\u5F97,\u7B2C\u4E00\u4E2A\u53C2\u6570\u4E3A\u4E8C\u7EF4\u7801 data URL, \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4E3A props \u4F20\u8FC7\u6765\u7684 qid(\u56E0\u4E3A\u4E8C\u7EF4\u7801\u751F\u6210\u662F\u5F02\u6B65\u7684,\u6240\u4EE5\u52A0\u4E2A id \u7528\u4E8E\u6392\u5E8F) ")]),_:1})]),_:1})]),_:1})}}});export{Rr as default};
|