The bundles carried all thirteen translations at once and a page fetched them a third time as raw source; each page now loads only its own language. Alongside that: JavaScript is minified, the eight stylesheets are served as one file, the QR scanner is fetched after the app is up instead of on every visit, Inter ships once rather than five copies of the same file, and Font Awesome is subset to the 82 icons this app draws instead of all 2468. 1.85 MB across 43 requests becomes under 700 KB across 33. On mobile the page starts drawing in 1.6 s instead of 6.3 s and is usable in 4.5 s instead of 11 s. Pages also carry their text in the HTML now. Everything was drawn by JavaScript into an empty div, so crawlers saw correct metadata around nothing, and twelve of the thirteen language pages had never been shown to anyone. The documentation is published under /docs/ with a new FAQ, and unknown addresses return a real 404. Separately: the localized shells were served with the year-long immutable cache header meant for static assets, which pinned anyone who opened /de/ or /ru/ to that build. The header is fixed and the service worker refreshes what it cached. Claude-Session: https://claude.ai/code/session_014KjzTXxrhzYoDDWChYQ4u2
34 lines
459 KiB
JavaScript
34 lines
459 KiB
JavaScript
var r0=Object.create;var ca=Object.defineProperty;var i0=Object.getOwnPropertyDescriptor;var s0=Object.getOwnPropertyNames;var o0=Object.getPrototypeOf,a0=Object.prototype.hasOwnProperty;var Se=(r,a)=>()=>{try{return a||r((a={exports:{}}).exports,a),a.exports}catch(s){throw a=0,s}};var l0=(r,a,s,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of s0(a))!a0.call(r,d)&&d!==s&&ca(r,d,{get:()=>a[d],enumerable:!(f=i0(a,d))||f.enumerable});return r};var Br=(r,a,s)=>(s=r!=null?r0(o0(r)):{},l0(a||!r||!r.__esModule?ca(s,"default",{value:r,enumerable:!0}):s,r));var ua=Se((Rd,fa)=>{fa.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var En=Se(Ln=>{var Ns,c0=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Ln.getSymbolSize=function(a){if(!a)throw new Error('"version" cannot be null or undefined');if(a<1||a>40)throw new Error('"version" should be in range from 1 to 40');return a*4+17};Ln.getSymbolTotalCodewords=function(a){return c0[a]};Ln.getBCHDigit=function(r){let a=0;for(;r!==0;)a++,r>>>=1;return a};Ln.setToSJISFunction=function(a){if(typeof a!="function")throw new Error('"toSJISFunc" is not a valid function.');Ns=a};Ln.isKanjiModeEnabled=function(){return typeof Ns<"u"};Ln.toSJIS=function(a){return Ns(a)}});var Ii=Se(Lt=>{Lt.L={bit:1};Lt.M={bit:0};Lt.Q={bit:3};Lt.H={bit:2};function f0(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return Lt.L;case"m":case"medium":return Lt.M;case"q":case"quartile":return Lt.Q;case"h":case"high":return Lt.H;default:throw new Error("Unknown EC Level: "+r)}}Lt.isValid=function(a){return a&&typeof a.bit<"u"&&a.bit>=0&&a.bit<4};Lt.from=function(a,s){if(Lt.isValid(a))return a;try{return f0(a)}catch{return s}}});var ga=Se((Bd,da)=>{function ha(){this.buffer=[],this.length=0}ha.prototype={get:function(r){let a=Math.floor(r/8);return(this.buffer[a]>>>7-r%8&1)===1},put:function(r,a){for(let s=0;s<a;s++)this.putBit((r>>>a-s-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),r&&(this.buffer[a]|=128>>>this.length%8),this.length++}};da.exports=ha});var wa=Se((Ld,xa)=>{function Lr(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Lr.prototype.set=function(r,a,s,f){let d=r*this.size+a;this.data[d]=s,f&&(this.reservedBit[d]=!0)};Lr.prototype.get=function(r,a){return this.data[r*this.size+a]};Lr.prototype.xor=function(r,a,s){this.data[r*this.size+a]^=s};Lr.prototype.isReserved=function(r,a){return this.reservedBit[r*this.size+a]};xa.exports=Lr});var pa=Se(bi=>{var u0=En().getSymbolSize;bi.getRowColCoords=function(a){if(a===1)return[];let s=Math.floor(a/7)+2,f=u0(a),d=f===145?26:Math.ceil((f-13)/(2*s-2))*2,h=[f-7];for(let p=1;p<s-1;p++)h[p]=h[p-1]-d;return h.push(6),h.reverse()};bi.getPositions=function(a){let s=[],f=bi.getRowColCoords(a),d=f.length;for(let h=0;h<d;h++)for(let p=0;p<d;p++)h===0&&p===0||h===0&&p===d-1||h===d-1&&p===0||s.push([f[h],f[p]]);return s}});var ma=Se(Ea=>{var h0=En().getSymbolSize,Aa=7;Ea.getPositions=function(a){let s=h0(a);return[[0,0],[s-Aa,0],[0,s-Aa]]}});var Ca=Se(Pe=>{Pe.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var kn={N1:3,N2:3,N3:40,N4:10};Pe.isValid=function(a){return a!=null&&a!==""&&!isNaN(a)&&a>=0&&a<=7};Pe.from=function(a){return Pe.isValid(a)?parseInt(a,10):void 0};Pe.getPenaltyN1=function(a){let s=a.size,f=0,d=0,h=0,p=null,A=null;for(let y=0;y<s;y++){d=h=0,p=A=null;for(let x=0;x<s;x++){let _=a.get(y,x);_===p?d++:(d>=5&&(f+=kn.N1+(d-5)),p=_,d=1),_=a.get(x,y),_===A?h++:(h>=5&&(f+=kn.N1+(h-5)),A=_,h=1)}d>=5&&(f+=kn.N1+(d-5)),h>=5&&(f+=kn.N1+(h-5))}return f};Pe.getPenaltyN2=function(a){let s=a.size,f=0;for(let d=0;d<s-1;d++)for(let h=0;h<s-1;h++){let p=a.get(d,h)+a.get(d,h+1)+a.get(d+1,h)+a.get(d+1,h+1);(p===4||p===0)&&f++}return f*kn.N2};Pe.getPenaltyN3=function(a){let s=a.size,f=0,d=0,h=0;for(let p=0;p<s;p++){d=h=0;for(let A=0;A<s;A++)d=d<<1&2047|a.get(p,A),A>=10&&(d===1488||d===93)&&f++,h=h<<1&2047|a.get(A,p),A>=10&&(h===1488||h===93)&&f++}return f*kn.N3};Pe.getPenaltyN4=function(a){let s=0,f=a.data.length;for(let h=0;h<f;h++)s+=a.data[h];return Math.abs(Math.ceil(s*100/f/5)-10)*kn.N4};function d0(r,a,s){switch(r){case Pe.Patterns.PATTERN000:return(a+s)%2===0;case Pe.Patterns.PATTERN001:return a%2===0;case Pe.Patterns.PATTERN010:return s%3===0;case Pe.Patterns.PATTERN011:return(a+s)%3===0;case Pe.Patterns.PATTERN100:return(Math.floor(a/2)+Math.floor(s/3))%2===0;case Pe.Patterns.PATTERN101:return a*s%2+a*s%3===0;case Pe.Patterns.PATTERN110:return(a*s%2+a*s%3)%2===0;case Pe.Patterns.PATTERN111:return(a*s%3+(a+s)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}Pe.applyMask=function(a,s){let f=s.size;for(let d=0;d<f;d++)for(let h=0;h<f;h++)s.isReserved(h,d)||s.xor(h,d,d0(a,h,d))};Pe.getBestMask=function(a,s){let f=Object.keys(Pe.Patterns).length,d=0,h=1/0;for(let p=0;p<f;p++){s(p),Pe.applyMask(p,a);let A=Pe.getPenaltyN1(a)+Pe.getPenaltyN2(a)+Pe.getPenaltyN3(a)+Pe.getPenaltyN4(a);Pe.applyMask(p,a),A<h&&(h=A,d=p)}return d}});var Os=Se(Ms=>{var mn=Ii(),Si=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ti=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ms.getBlocksCount=function(a,s){switch(s){case mn.L:return Si[(a-1)*4+0];case mn.M:return Si[(a-1)*4+1];case mn.Q:return Si[(a-1)*4+2];case mn.H:return Si[(a-1)*4+3];default:return}};Ms.getTotalCodewordsCount=function(a,s){switch(s){case mn.L:return Ti[(a-1)*4+0];case mn.M:return Ti[(a-1)*4+1];case mn.Q:return Ti[(a-1)*4+2];case mn.H:return Ti[(a-1)*4+3];default:return}}});var _a=Se(Mi=>{var kr=new Uint8Array(512),Ni=new Uint8Array(256);(function(){let a=1;for(let s=0;s<255;s++)kr[s]=a,Ni[a]=s,a<<=1,a&256&&(a^=285);for(let s=255;s<512;s++)kr[s]=kr[s-255]})();Mi.log=function(a){if(a<1)throw new Error("log("+a+")");return Ni[a]};Mi.exp=function(a){return kr[a]};Mi.mul=function(a,s){return a===0||s===0?0:kr[Ni[a]+Ni[s]]}});var ya=Se(Pr=>{var Rs=_a();Pr.mul=function(a,s){let f=new Uint8Array(a.length+s.length-1);for(let d=0;d<a.length;d++)for(let h=0;h<s.length;h++)f[d+h]^=Rs.mul(a[d],s[h]);return f};Pr.mod=function(a,s){let f=new Uint8Array(a);for(;f.length-s.length>=0;){let d=f[0];for(let p=0;p<s.length;p++)f[p]^=Rs.mul(s[p],d);let h=0;for(;h<f.length&&f[h]===0;)h++;f=f.slice(h)}return f};Pr.generateECPolynomial=function(a){let s=new Uint8Array([1]);for(let f=0;f<a;f++)s=Pr.mul(s,new Uint8Array([1,Rs.exp(f)]));return s}});var Sa=Se((Vd,ba)=>{var Ia=ya();function Ds(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Ds.prototype.initialize=function(a){this.degree=a,this.genPoly=Ia.generateECPolynomial(this.degree)};Ds.prototype.encode=function(a){if(!this.genPoly)throw new Error("Encoder not initialized");let s=new Uint8Array(a.length+this.degree);s.set(a);let f=Ia.mod(s,this.genPoly),d=this.degree-f.length;if(d>0){let h=new Uint8Array(this.degree);return h.set(f,d),h}return f};ba.exports=Ds});var vs=Se(Ta=>{Ta.isValid=function(a){return!isNaN(a)&&a>=1&&a<=40}});var Bs=Se(an=>{var Na="[0-9]+",g0="[A-Z $%*+\\-./:]+",Fr="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Fr=Fr.replace(/u/g,"\\u");var x0="(?:(?![A-Z0-9 $%*+\\-./:]|"+Fr+`)(?:.|[\r
|
|
]))+`;an.KANJI=new RegExp(Fr,"g");an.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");an.BYTE=new RegExp(x0,"g");an.NUMERIC=new RegExp(Na,"g");an.ALPHANUMERIC=new RegExp(g0,"g");var w0=new RegExp("^"+Fr+"$"),p0=new RegExp("^"+Na+"$"),A0=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");an.testKanji=function(a){return w0.test(a)};an.testNumeric=function(a){return p0.test(a)};an.testAlphanumeric=function(a){return A0.test(a)}});var Cn=Se(Qe=>{var E0=vs(),Ls=Bs();Qe.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Qe.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Qe.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Qe.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Qe.MIXED={bit:-1};Qe.getCharCountIndicator=function(a,s){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!E0.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?a.ccBits[0]:s<27?a.ccBits[1]:a.ccBits[2]};Qe.getBestModeForData=function(a){return Ls.testNumeric(a)?Qe.NUMERIC:Ls.testAlphanumeric(a)?Qe.ALPHANUMERIC:Ls.testKanji(a)?Qe.KANJI:Qe.BYTE};Qe.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")};Qe.isValid=function(a){return a&&a.bit&&a.ccBits};function m0(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return Qe.NUMERIC;case"alphanumeric":return Qe.ALPHANUMERIC;case"kanji":return Qe.KANJI;case"byte":return Qe.BYTE;default:throw new Error("Unknown mode: "+r)}}Qe.from=function(a,s){if(Qe.isValid(a))return a;try{return m0(a)}catch{return s}}});var va=Se(Pn=>{var Oi=En(),C0=Os(),Ma=Ii(),_n=Cn(),ks=vs(),Ra=7973,Oa=Oi.getBCHDigit(Ra);function _0(r,a,s){for(let f=1;f<=40;f++)if(a<=Pn.getCapacity(f,s,r))return f}function Da(r,a){return _n.getCharCountIndicator(r,a)+4}function y0(r,a){let s=0;return r.forEach(function(f){let d=Da(f.mode,a);s+=d+f.getBitsLength()}),s}function I0(r,a){for(let s=1;s<=40;s++)if(y0(r,s)<=Pn.getCapacity(s,a,_n.MIXED))return s}Pn.from=function(a,s){return ks.isValid(a)?parseInt(a,10):s};Pn.getCapacity=function(a,s,f){if(!ks.isValid(a))throw new Error("Invalid QR Code version");typeof f>"u"&&(f=_n.BYTE);let d=Oi.getSymbolTotalCodewords(a),h=C0.getTotalCodewordsCount(a,s),p=(d-h)*8;if(f===_n.MIXED)return p;let A=p-Da(f,a);switch(f){case _n.NUMERIC:return Math.floor(A/10*3);case _n.ALPHANUMERIC:return Math.floor(A/11*2);case _n.KANJI:return Math.floor(A/13);case _n.BYTE:default:return Math.floor(A/8)}};Pn.getBestVersionForData=function(a,s){let f,d=Ma.from(s,Ma.M);if(Array.isArray(a)){if(a.length>1)return I0(a,d);if(a.length===0)return 1;f=a[0]}else f=a;return _0(f.mode,f.getLength(),d)};Pn.getEncodedBits=function(a){if(!ks.isValid(a)||a<7)throw new Error("Invalid QR Code version");let s=a<<12;for(;Oi.getBCHDigit(s)-Oa>=0;)s^=Ra<<Oi.getBCHDigit(s)-Oa;return a<<12|s}});var Pa=Se(ka=>{var Ps=En(),La=1335,b0=21522,Ba=Ps.getBCHDigit(La);ka.getEncodedBits=function(a,s){let f=a.bit<<3|s,d=f<<10;for(;Ps.getBCHDigit(d)-Ba>=0;)d^=La<<Ps.getBCHDigit(d)-Ba;return(f<<10|d)^b0}});var Ua=Se((Zd,Fa)=>{var S0=Cn();function ir(r){this.mode=S0.NUMERIC,this.data=r.toString()}ir.getBitsLength=function(a){return 10*Math.floor(a/3)+(a%3?a%3*3+1:0)};ir.prototype.getLength=function(){return this.data.length};ir.prototype.getBitsLength=function(){return ir.getBitsLength(this.data.length)};ir.prototype.write=function(a){let s,f,d;for(s=0;s+3<=this.data.length;s+=3)f=this.data.substr(s,3),d=parseInt(f,10),a.put(d,10);let h=this.data.length-s;h>0&&(f=this.data.substr(s),d=parseInt(f,10),a.put(d,h*3+1))};Fa.exports=ir});var Ha=Se((Qd,za)=>{var T0=Cn(),Fs=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function sr(r){this.mode=T0.ALPHANUMERIC,this.data=r}sr.getBitsLength=function(a){return 11*Math.floor(a/2)+6*(a%2)};sr.prototype.getLength=function(){return this.data.length};sr.prototype.getBitsLength=function(){return sr.getBitsLength(this.data.length)};sr.prototype.write=function(a){let s;for(s=0;s+2<=this.data.length;s+=2){let f=Fs.indexOf(this.data[s])*45;f+=Fs.indexOf(this.data[s+1]),a.put(f,11)}this.data.length%2&&a.put(Fs.indexOf(this.data[s]),6)};za.exports=sr});var Xa=Se((Kd,Va)=>{var N0=Cn();function or(r){this.mode=N0.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}or.getBitsLength=function(a){return a*8};or.prototype.getLength=function(){return this.data.length};or.prototype.getBitsLength=function(){return or.getBitsLength(this.data.length)};or.prototype.write=function(r){for(let a=0,s=this.data.length;a<s;a++)r.put(this.data[a],8)};Va.exports=or});var ja=Se((qd,Ga)=>{var M0=Cn(),O0=En();function ar(r){this.mode=M0.KANJI,this.data=r}ar.getBitsLength=function(a){return a*13};ar.prototype.getLength=function(){return this.data.length};ar.prototype.getBitsLength=function(){return ar.getBitsLength(this.data.length)};ar.prototype.write=function(r){let a;for(a=0;a<this.data.length;a++){let s=O0.toSJIS(this.data[a]);if(s>=33088&&s<=40956)s-=33088;else if(s>=57408&&s<=60351)s-=49472;else throw new Error("Invalid SJIS character: "+this.data[a]+`
|
|
Make sure your charset is UTF-8`);s=(s>>>8&255)*192+(s&255),r.put(s,13)}};Ga.exports=ar});var Ya=Se((Jd,Us)=>{"use strict";var Ur={single_source_shortest_paths:function(r,a,s){var f={},d={};d[a]=0;var h=Ur.PriorityQueue.make();h.push(a,0);for(var p,A,y,x,_,v,R,N,V;!h.empty();){p=h.pop(),A=p.value,x=p.cost,_=r[A]||{};for(y in _)_.hasOwnProperty(y)&&(v=_[y],R=x+v,N=d[y],V=typeof d[y]>"u",(V||N>R)&&(d[y]=R,h.push(y,R),f[y]=A))}if(typeof s<"u"&&typeof d[s]>"u"){var K=["Could not find a path from ",a," to ",s,"."].join("");throw new Error(K)}return f},extract_shortest_path_from_predecessor_list:function(r,a){for(var s=[],f=a,d;f;)s.push(f),d=r[f],f=r[f];return s.reverse(),s},find_path:function(r,a,s){var f=Ur.single_source_shortest_paths(r,a,s);return Ur.extract_shortest_path_from_predecessor_list(f,s)},PriorityQueue:{make:function(r){var a=Ur.PriorityQueue,s={},f;r=r||{};for(f in a)a.hasOwnProperty(f)&&(s[f]=a[f]);return s.queue=[],s.sorter=r.sorter||a.default_sorter,s},default_sorter:function(r,a){return r.cost-a.cost},push:function(r,a){var s={value:r,cost:a};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Us<"u"&&(Us.exports=Ur)});var el=Se(lr=>{var Me=Cn(),Qa=Ua(),Ka=Ha(),qa=Xa(),Ja=ja(),zr=Bs(),Ri=En(),R0=Ya();function Wa(r){return unescape(encodeURIComponent(r)).length}function Hr(r,a,s){let f=[],d;for(;(d=r.exec(s))!==null;)f.push({data:d[0],index:d.index,mode:a,length:d[0].length});return f}function $a(r){let a=Hr(zr.NUMERIC,Me.NUMERIC,r),s=Hr(zr.ALPHANUMERIC,Me.ALPHANUMERIC,r),f,d;return Ri.isKanjiModeEnabled()?(f=Hr(zr.BYTE,Me.BYTE,r),d=Hr(zr.KANJI,Me.KANJI,r)):(f=Hr(zr.BYTE_KANJI,Me.BYTE,r),d=[]),a.concat(s,f,d).sort(function(p,A){return p.index-A.index}).map(function(p){return{data:p.data,mode:p.mode,length:p.length}})}function zs(r,a){switch(a){case Me.NUMERIC:return Qa.getBitsLength(r);case Me.ALPHANUMERIC:return Ka.getBitsLength(r);case Me.KANJI:return Ja.getBitsLength(r);case Me.BYTE:return qa.getBitsLength(r)}}function D0(r){return r.reduce(function(a,s){let f=a.length-1>=0?a[a.length-1]:null;return f&&f.mode===s.mode?(a[a.length-1].data+=s.data,a):(a.push(s),a)},[])}function v0(r){let a=[];for(let s=0;s<r.length;s++){let f=r[s];switch(f.mode){case Me.NUMERIC:a.push([f,{data:f.data,mode:Me.ALPHANUMERIC,length:f.length},{data:f.data,mode:Me.BYTE,length:f.length}]);break;case Me.ALPHANUMERIC:a.push([f,{data:f.data,mode:Me.BYTE,length:f.length}]);break;case Me.KANJI:a.push([f,{data:f.data,mode:Me.BYTE,length:Wa(f.data)}]);break;case Me.BYTE:a.push([{data:f.data,mode:Me.BYTE,length:Wa(f.data)}])}}return a}function B0(r,a){let s={},f={start:{}},d=["start"];for(let h=0;h<r.length;h++){let p=r[h],A=[];for(let y=0;y<p.length;y++){let x=p[y],_=""+h+y;A.push(_),s[_]={node:x,lastCount:0},f[_]={};for(let v=0;v<d.length;v++){let R=d[v];s[R]&&s[R].node.mode===x.mode?(f[R][_]=zs(s[R].lastCount+x.length,x.mode)-zs(s[R].lastCount,x.mode),s[R].lastCount+=x.length):(s[R]&&(s[R].lastCount=x.length),f[R][_]=zs(x.length,x.mode)+4+Me.getCharCountIndicator(x.mode,a))}}d=A}for(let h=0;h<d.length;h++)f[d[h]].end=0;return{map:f,table:s}}function Za(r,a){let s,f=Me.getBestModeForData(r);if(s=Me.from(a,f),s!==Me.BYTE&&s.bit<f.bit)throw new Error('"'+r+'" cannot be encoded with mode '+Me.toString(s)+`.
|
|
Suggested mode is: `+Me.toString(f));switch(s===Me.KANJI&&!Ri.isKanjiModeEnabled()&&(s=Me.BYTE),s){case Me.NUMERIC:return new Qa(r);case Me.ALPHANUMERIC:return new Ka(r);case Me.KANJI:return new Ja(r);case Me.BYTE:return new qa(r)}}lr.fromArray=function(a){return a.reduce(function(s,f){return typeof f=="string"?s.push(Za(f,null)):f.data&&s.push(Za(f.data,f.mode)),s},[])};lr.fromString=function(a,s){let f=$a(a,Ri.isKanjiModeEnabled()),d=v0(f),h=B0(d,s),p=R0.find_path(h.map,"start","end"),A=[];for(let y=1;y<p.length-1;y++)A.push(h.table[p[y]].node);return lr.fromArray(D0(A))};lr.rawSplit=function(a){return lr.fromArray($a(a,Ri.isKanjiModeEnabled()))}});var nl=Se(tl=>{var vi=En(),Hs=Ii(),L0=ga(),k0=wa(),P0=pa(),F0=ma(),Gs=Ca(),js=Os(),U0=Sa(),Di=va(),z0=Pa(),H0=Cn(),Vs=el();function V0(r,a){let s=r.size,f=F0.getPositions(a);for(let d=0;d<f.length;d++){let h=f[d][0],p=f[d][1];for(let A=-1;A<=7;A++)if(!(h+A<=-1||s<=h+A))for(let y=-1;y<=7;y++)p+y<=-1||s<=p+y||(A>=0&&A<=6&&(y===0||y===6)||y>=0&&y<=6&&(A===0||A===6)||A>=2&&A<=4&&y>=2&&y<=4?r.set(h+A,p+y,!0,!0):r.set(h+A,p+y,!1,!0))}}function X0(r){let a=r.size;for(let s=8;s<a-8;s++){let f=s%2===0;r.set(s,6,f,!0),r.set(6,s,f,!0)}}function G0(r,a){let s=P0.getPositions(a);for(let f=0;f<s.length;f++){let d=s[f][0],h=s[f][1];for(let p=-2;p<=2;p++)for(let A=-2;A<=2;A++)p===-2||p===2||A===-2||A===2||p===0&&A===0?r.set(d+p,h+A,!0,!0):r.set(d+p,h+A,!1,!0)}}function j0(r,a){let s=r.size,f=Di.getEncodedBits(a),d,h,p;for(let A=0;A<18;A++)d=Math.floor(A/3),h=A%3+s-8-3,p=(f>>A&1)===1,r.set(d,h,p,!0),r.set(h,d,p,!0)}function Xs(r,a,s){let f=r.size,d=z0.getEncodedBits(a,s),h,p;for(h=0;h<15;h++)p=(d>>h&1)===1,h<6?r.set(h,8,p,!0):h<8?r.set(h+1,8,p,!0):r.set(f-15+h,8,p,!0),h<8?r.set(8,f-h-1,p,!0):h<9?r.set(8,15-h-1+1,p,!0):r.set(8,15-h-1,p,!0);r.set(f-8,8,1,!0)}function Y0(r,a){let s=r.size,f=-1,d=s-1,h=7,p=0;for(let A=s-1;A>0;A-=2)for(A===6&&A--;;){for(let y=0;y<2;y++)if(!r.isReserved(d,A-y)){let x=!1;p<a.length&&(x=(a[p]>>>h&1)===1),r.set(d,A-y,x),h--,h===-1&&(p++,h=7)}if(d+=f,d<0||s<=d){d-=f,f=-f;break}}}function W0(r,a,s){let f=new L0;s.forEach(function(y){f.put(y.mode.bit,4),f.put(y.getLength(),H0.getCharCountIndicator(y.mode,r)),y.write(f)});let d=vi.getSymbolTotalCodewords(r),h=js.getTotalCodewordsCount(r,a),p=(d-h)*8;for(f.getLengthInBits()+4<=p&&f.put(0,4);f.getLengthInBits()%8!==0;)f.putBit(0);let A=(p-f.getLengthInBits())/8;for(let y=0;y<A;y++)f.put(y%2?17:236,8);return Z0(f,r,a)}function Z0(r,a,s){let f=vi.getSymbolTotalCodewords(a),d=js.getTotalCodewordsCount(a,s),h=f-d,p=js.getBlocksCount(a,s),A=f%p,y=p-A,x=Math.floor(f/p),_=Math.floor(h/p),v=_+1,R=x-_,N=new U0(R),V=0,K=new Array(p),H=new Array(p),U=0,W=new Uint8Array(r.buffer);for(let O=0;O<p;O++){let le=O<y?_:v;K[O]=W.slice(V,V+le),H[O]=N.encode(K[O]),V+=le,U=Math.max(U,le)}let te=new Uint8Array(f),z=0,L,Y;for(L=0;L<U;L++)for(Y=0;Y<p;Y++)L<K[Y].length&&(te[z++]=K[Y][L]);for(L=0;L<R;L++)for(Y=0;Y<p;Y++)te[z++]=H[Y][L];return te}function Q0(r,a,s,f){let d;if(Array.isArray(r))d=Vs.fromArray(r);else if(typeof r=="string"){let x=a;if(!x){let _=Vs.rawSplit(r);x=Di.getBestVersionForData(_,s)}d=Vs.fromString(r,x||40)}else throw new Error("Invalid data");let h=Di.getBestVersionForData(d,s);if(!h)throw new Error("The amount of data is too big to be stored in a QR Code");if(!a)a=h;else if(a<h)throw new Error(`
|
|
The chosen QR Code version cannot contain this amount of data.
|
|
Minimum version required to store current data is: `+h+`.
|
|
`);let p=W0(a,s,d),A=vi.getSymbolSize(a),y=new k0(A);return V0(y,a),X0(y),G0(y,a),Xs(y,s,0),a>=7&&j0(y,a),Y0(y,p),isNaN(f)&&(f=Gs.getBestMask(y,Xs.bind(null,y,s))),Gs.applyMask(f,y),Xs(y,s,f),{modules:y,version:a,errorCorrectionLevel:s,maskPattern:f,segments:d}}tl.create=function(a,s){if(typeof a>"u"||a==="")throw new Error("No input text");let f=Hs.M,d,h;return typeof s<"u"&&(f=Hs.from(s.errorCorrectionLevel,Hs.M),d=Di.from(s.version),h=Gs.from(s.maskPattern),s.toSJISFunc&&vi.setToSJISFunction(s.toSJISFunc)),Q0(a,d,f,h)}});var Ys=Se(Fn=>{function rl(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let a=r.slice().replace("#","").split("");if(a.length<3||a.length===5||a.length>8)throw new Error("Invalid hex color: "+r);(a.length===3||a.length===4)&&(a=Array.prototype.concat.apply([],a.map(function(f){return[f,f]}))),a.length===6&&a.push("F","F");let s=parseInt(a.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+a.slice(0,6).join("")}}Fn.getOptions=function(a){a||(a={}),a.color||(a.color={});let s=typeof a.margin>"u"||a.margin===null||a.margin<0?4:a.margin,f=a.width&&a.width>=21?a.width:void 0,d=a.scale||4;return{width:f,scale:f?4:d,margin:s,color:{dark:rl(a.color.dark||"#000000ff"),light:rl(a.color.light||"#ffffffff")},type:a.type,rendererOpts:a.rendererOpts||{}}};Fn.getScale=function(a,s){return s.width&&s.width>=a+s.margin*2?s.width/(a+s.margin*2):s.scale};Fn.getImageWidth=function(a,s){let f=Fn.getScale(a,s);return Math.floor((a+s.margin*2)*f)};Fn.qrToImageData=function(a,s,f){let d=s.modules.size,h=s.modules.data,p=Fn.getScale(d,f),A=Math.floor((d+f.margin*2)*p),y=f.margin*p,x=[f.color.light,f.color.dark];for(let _=0;_<A;_++)for(let v=0;v<A;v++){let R=(_*A+v)*4,N=f.color.light;if(_>=y&&v>=y&&_<A-y&&v<A-y){let V=Math.floor((_-y)/p),K=Math.floor((v-y)/p);N=x[h[V*d+K]?1:0]}a[R++]=N.r,a[R++]=N.g,a[R++]=N.b,a[R]=N.a}}});var il=Se(Bi=>{var Ws=Ys();function K0(r,a,s){r.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=s,a.width=s,a.style.height=s+"px",a.style.width=s+"px"}function q0(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Bi.render=function(a,s,f){let d=f,h=s;typeof d>"u"&&(!s||!s.getContext)&&(d=s,s=void 0),s||(h=q0()),d=Ws.getOptions(d);let p=Ws.getImageWidth(a.modules.size,d),A=h.getContext("2d"),y=A.createImageData(p,p);return Ws.qrToImageData(y.data,a,d),K0(A,h,p),A.putImageData(y,0,0),h};Bi.renderToDataURL=function(a,s,f){let d=f;typeof d>"u"&&(!s||!s.getContext)&&(d=s,s=void 0),d||(d={});let h=Bi.render(a,s,d),p=d.type||"image/png",A=d.rendererOpts||{};return h.toDataURL(p,A.quality)}});var al=Se(ol=>{var J0=Ys();function sl(r,a){let s=r.a/255,f=a+'="'+r.hex+'"';return s<1?f+" "+a+'-opacity="'+s.toFixed(2).slice(1)+'"':f}function Zs(r,a,s){let f=r+a;return typeof s<"u"&&(f+=" "+s),f}function $0(r,a,s){let f="",d=0,h=!1,p=0;for(let A=0;A<r.length;A++){let y=Math.floor(A%a),x=Math.floor(A/a);!y&&!h&&(h=!0),r[A]?(p++,A>0&&y>0&&r[A-1]||(f+=h?Zs("M",y+s,.5+x+s):Zs("m",d,0),d=0,h=!1),y+1<a&&r[A+1]||(f+=Zs("h",p),p=0)):d++}return f}ol.render=function(a,s,f){let d=J0.getOptions(s),h=a.modules.size,p=a.modules.data,A=h+d.margin*2,y=d.color.light.a?"<path "+sl(d.color.light,"fill")+' d="M0 0h'+A+"v"+A+'H0z"/>':"",x="<path "+sl(d.color.dark,"stroke")+' d="'+$0(p,h,d.margin)+'"/>',_='viewBox="0 0 '+A+" "+A+'"',R='<svg xmlns="http://www.w3.org/2000/svg" '+(d.width?'width="'+d.width+'" height="'+d.width+'" ':"")+_+' shape-rendering="crispEdges">'+y+x+`</svg>
|
|
`;return typeof f=="function"&&f(null,R),R}});var cl=Se(Vr=>{var ef=ua(),Qs=nl(),ll=il(),tf=al();function Ks(r,a,s,f,d){let h=[].slice.call(arguments,1),p=h.length,A=typeof h[p-1]=="function";if(!A&&!ef())throw new Error("Callback required as last argument");if(A){if(p<2)throw new Error("Too few arguments provided");p===2?(d=s,s=a,a=f=void 0):p===3&&(a.getContext&&typeof d>"u"?(d=f,f=void 0):(d=f,f=s,s=a,a=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(s=a,a=f=void 0):p===2&&!a.getContext&&(f=s,s=a,a=void 0),new Promise(function(y,x){try{let _=Qs.create(s,f);y(r(_,a,f))}catch(_){x(_)}})}try{let y=Qs.create(s,f);d(null,r(y,a,f))}catch(y){d(y)}}Vr.create=Qs.create;Vr.toCanvas=Ks.bind(null,ll.render);Vr.toDataURL=Ks.bind(null,ll.renderToDataURL);Vr.toString=Ks.bind(null,function(r,a,s){return tf.render(r,s)})});var xl=Se((Fi,gl)=>{(function(r,a){typeof Fi=="object"&&typeof gl<"u"?a(Fi):typeof define=="function"&&define.amd?define(["exports"],a):(r=typeof globalThis<"u"?globalThis:r||self,a(r.ZXing={}))})(Fi,(function(r){"use strict";function a(E){return E==null}var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,e){E.__proto__=e}||function(E,e){for(var t in e)e.hasOwnProperty(t)&&(E[t]=e[t])};function f(E,e){s(E,e);function t(){this.constructor=E}E.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function d(E,e){var t=Object.setPrototypeOf;t?t(E,e):E.__proto__=e}function h(E,e){e===void 0&&(e=E.constructor);var t=Error.captureStackTrace;t&&t(E,e)}var p=(function(E){f(e,E);function e(t){var n=this.constructor,i=E.call(this,t)||this;return Object.defineProperty(i,"name",{value:n.name,enumerable:!1}),d(i,n.prototype),h(i),i}return e})(Error);class A extends p{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}A.kind="Exception";class y extends A{}y.kind="ArgumentException";class x extends A{}x.kind="IllegalArgumentException";class _{constructor(e){if(this.binarizer=e,e===null)throw new x("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,i){let o=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new _(this.binarizer.createBinarizer(o))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new _(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new _(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class v extends A{static getChecksumInstance(){return new v}}v.kind="ChecksumException";class R{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class N{static arraycopy(e,t,n,i,o){for(;o--;)n[i++]=e[t++]}static currentTimeMillis(){return Date.now()}}class V extends A{}V.kind="IndexOutOfBoundsException";class K extends V{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}K.kind="ArrayIndexOutOfBoundsException";class H{static fill(e,t){for(let n=0,i=e.length;n<i;n++)e[n]=t}static fillWithin(e,t,n,i){H.rangeCheck(e.length,t,n);for(let o=t;o<n;o++)e[o]=i}static rangeCheck(e,t,n){if(t>n)throw new x("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new K(t);if(n>e)throw new K(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(o=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(o=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(let n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){let n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){let i=n-t,o=new Int32Array(i);return N.arraycopy(e,t,o,0,i),o}static binarySearch(e,t,n){n===void 0&&(n=H.numberComparator);let i=0,o=e.length-1;for(;i<=o;){let l=o+i>>1,c=n(t,e[l]);if(c>0)i=l+1;else if(c<0)o=l-1;else return l}return-i-1}static numberComparator(e,t){return e-t}}class U{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}U.MIN_VALUE_32_BITS=-2147483648,U.MAX_VALUE=Number.MAX_SAFE_INTEGER;class W{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=W.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){let t=W.makeArray(e);N.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){let t=this.size;if(e>=t)return t;let n=this.bits,i=Math.floor(e/32),o=n[i];o&=~((1<<(e&31))-1);let l=n.length;for(;o===0;){if(++i===l)return t;o=n[i]}let c=i*32+U.numberOfTrailingZeros(o);return c>t?t:c}getNextUnset(e){let t=this.size;if(e>=t)return t;let n=this.bits,i=Math.floor(e/32),o=~n[i];o&=~((1<<(e&31))-1);let l=n.length;for(;o===0;){if(++i===l)return t;o=~n[i]}let c=i*32+U.numberOfTrailingZeros(o);return c>t?t:c}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new x;if(t===e)return;t--;let n=Math.floor(e/32),i=Math.floor(t/32),o=this.bits;for(let l=n;l<=i;l++){let c=l>n?0:e&31,g=(2<<(l<i?31:t&31))-(1<<c);o[l]|=g}}clear(){let e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new x;if(t===e)return!0;t--;let i=Math.floor(e/32),o=Math.floor(t/32),l=this.bits;for(let c=i;c<=o;c++){let u=c>i?0:e&31,w=(2<<(c<o?31:t&31))-(1<<u)&4294967295;if((l[c]&w)!==(n?w:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new x("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){let t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new x("Sizes don't match");let t=this.bits;for(let n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]}toBytes(e,t,n,i){for(let o=0;o<i;o++){let l=0;for(let c=0;c<8;c++)this.get(e)&&(l|=1<<7-c),e++;t[n+o]=l}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits;for(let o=0;o<n;o++){let l=i[o];l=l>>1&1431655765|(l&1431655765)<<1,l=l>>2&858993459|(l&858993459)<<2,l=l>>4&252645135|(l&252645135)<<4,l=l>>8&16711935|(l&16711935)<<8,l=l>>16&65535|(l&65535)<<16,e[t-o]=l}if(this.size!==n*32){let o=n*32-this.size,l=e[0]>>>o;for(let c=1;c<n;c++){let u=e[c];l|=u<<32-o,e[c-1]=l,l=u>>>o}e[n-1]=l}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof W))return!1;let t=e;return this.size===t.size&&H.equals(this.bits,t.bits)}hashCode(){return 31*this.size+H.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new W(this.size,this.bits.slice())}}var te;(function(E){E[E.OTHER=0]="OTHER",E[E.PURE_BARCODE=1]="PURE_BARCODE",E[E.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",E[E.TRY_HARDER=3]="TRY_HARDER",E[E.CHARACTER_SET=4]="CHARACTER_SET",E[E.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",E[E.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",E[E.ASSUME_GS1=7]="ASSUME_GS1",E[E.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",E[E.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",E[E.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(te||(te={}));var z=te;class L extends A{static getFormatInstance(){return new L}}L.kind="FormatException";var Y;(function(E){E[E.Cp437=0]="Cp437",E[E.ISO8859_1=1]="ISO8859_1",E[E.ISO8859_2=2]="ISO8859_2",E[E.ISO8859_3=3]="ISO8859_3",E[E.ISO8859_4=4]="ISO8859_4",E[E.ISO8859_5=5]="ISO8859_5",E[E.ISO8859_6=6]="ISO8859_6",E[E.ISO8859_7=7]="ISO8859_7",E[E.ISO8859_8=8]="ISO8859_8",E[E.ISO8859_9=9]="ISO8859_9",E[E.ISO8859_10=10]="ISO8859_10",E[E.ISO8859_11=11]="ISO8859_11",E[E.ISO8859_13=12]="ISO8859_13",E[E.ISO8859_14=13]="ISO8859_14",E[E.ISO8859_15=14]="ISO8859_15",E[E.ISO8859_16=15]="ISO8859_16",E[E.SJIS=16]="SJIS",E[E.Cp1250=17]="Cp1250",E[E.Cp1251=18]="Cp1251",E[E.Cp1252=19]="Cp1252",E[E.Cp1256=20]="Cp1256",E[E.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",E[E.UTF8=22]="UTF8",E[E.ASCII=23]="ASCII",E[E.Big5=24]="Big5",E[E.GB18030=25]="GB18030",E[E.EUC_KR=26]="EUC_KR"})(Y||(Y={}));class O{constructor(e,t,n,...i){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=i,O.VALUE_IDENTIFIER_TO_ECI.set(e,this),O.NAME_TO_ECI.set(n,this);let o=this.values;for(let l=0,c=o.length;l!==c;l++){let u=o[l];O.VALUES_TO_ECI.set(u,this)}for(let l of i)O.NAME_TO_ECI.set(l,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new L("incorect value");let t=O.VALUES_TO_ECI.get(e);if(t===void 0)throw new L("incorect value");return t}static getCharacterSetECIByName(e){let t=O.NAME_TO_ECI.get(e);if(t===void 0)throw new L("incorect value");return t}equals(e){if(!(e instanceof O))return!1;let t=e;return this.getName()===t.getName()}}O.VALUE_IDENTIFIER_TO_ECI=new Map,O.VALUES_TO_ECI=new Map,O.NAME_TO_ECI=new Map,O.Cp437=new O(Y.Cp437,Int32Array.from([0,2]),"Cp437"),O.ISO8859_1=new O(Y.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),O.ISO8859_2=new O(Y.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),O.ISO8859_3=new O(Y.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),O.ISO8859_4=new O(Y.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),O.ISO8859_5=new O(Y.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),O.ISO8859_6=new O(Y.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),O.ISO8859_7=new O(Y.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),O.ISO8859_8=new O(Y.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),O.ISO8859_9=new O(Y.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),O.ISO8859_10=new O(Y.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),O.ISO8859_11=new O(Y.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),O.ISO8859_13=new O(Y.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),O.ISO8859_14=new O(Y.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),O.ISO8859_15=new O(Y.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),O.ISO8859_16=new O(Y.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),O.SJIS=new O(Y.SJIS,20,"SJIS","Shift_JIS"),O.Cp1250=new O(Y.Cp1250,21,"Cp1250","windows-1250"),O.Cp1251=new O(Y.Cp1251,22,"Cp1251","windows-1251"),O.Cp1252=new O(Y.Cp1252,23,"Cp1252","windows-1252"),O.Cp1256=new O(Y.Cp1256,24,"Cp1256","windows-1256"),O.UnicodeBigUnmarked=new O(Y.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),O.UTF8=new O(Y.UTF8,26,"UTF8","UTF-8"),O.ASCII=new O(Y.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),O.Big5=new O(Y.Big5,28,"Big5"),O.GB18030=new O(Y.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),O.EUC_KR=new O(Y.EUC_KR,30,"EUC_KR","EUC-KR");class le extends A{}le.kind="UnsupportedOperationException";class re{static decode(e,t){let n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!re.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){let n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof O?e:O.getCharacterSetECIByName(e)}static decodeFallback(e,t){let n=this.encodingCharacterSet(t);if(re.isDecodeFallbackSupported(n)){let i="";for(let o=0,l=e.length;o<l;o++){let c=e[o].toString(16);c.length<2&&(c="0"+c),i+="%"+c}return decodeURIComponent(i)}if(n.equals(O.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new le(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(O.UTF8)||e.equals(O.ISO8859_1)||e.equals(O.ASCII)}static encodeFallback(e){let n=btoa(unescape(encodeURIComponent(e))).split(""),i=[];for(let o=0;o<n.length;o++)i.push(n[o].charCodeAt(0));return new Uint8Array(i)}}class k{static castAsNonUtf8Char(e,t=null){let n=t?t.getName():this.ISO88591;return re.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(z.CHARACTER_SET)!==void 0)return t.get(z.CHARACTER_SET).toString();let n=e.length,i=!0,o=!0,l=!0,c=0,u=0,g=0,w=0,m=0,C=0,b=0,S=0,T=0,D=0,F=0,Z=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let Q=0;Q<n&&(i||o||l);Q++){let j=e[Q]&255;l&&(c>0?(j&128)===0?l=!1:c--:(j&128)!==0&&((j&64)===0?l=!1:(c++,(j&32)===0?u++:(c++,(j&16)===0?g++:(c++,(j&8)===0?w++:l=!1))))),i&&(j>127&&j<160?i=!1:j>159&&(j<192||j===215||j===247)&&F++),o&&(m>0?j<64||j===127||j>252?o=!1:m--:j===128||j===160||j>239?o=!1:j>160&&j<224?(C++,S=0,b++,b>T&&(T=b)):j>127?(m++,b=0,S++,S>D&&(D=S)):(b=0,S=0))}return l&&c>0&&(l=!1),o&&m>0&&(o=!1),l&&(Z||u+g+w>0)?k.UTF8:o&&(k.ASSUME_SHIFT_JIS||T>=3||D>=3)?k.SHIFT_JIS:i&&o?T===2&&C===2||F*10>=n?k.SHIFT_JIS:k.ISO88591:i?k.ISO88591:o?k.SHIFT_JIS:l?k.UTF8:k.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function i(l,c,u,g,w,m){if(l==="%%")return"%";if(t[++n]===void 0)return;l=g?parseInt(g.substr(1)):void 0;let C=w?parseInt(w.substr(1)):void 0,b;switch(m){case"s":b=t[n];break;case"c":b=t[n][0];break;case"f":b=parseFloat(t[n]).toFixed(l);break;case"p":b=parseFloat(t[n]).toPrecision(l);break;case"e":b=parseFloat(t[n]).toExponential(l);break;case"x":b=parseInt(t[n]).toString(C||16);break;case"d":b=parseFloat(parseInt(t[n],C||10).toPrecision(l)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(C);let S=parseInt(u),T=u&&u[0]+""=="0"?"0":" ";for(;b.length<S;)b=c!==void 0?b+T:T+b;return b}let o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,i)}static getBytes(e,t){return re.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}k.SHIFT_JIS=O.SJIS.getName(),k.GB2312="GB2312",k.ISO88591=O.ISO8859_1.getName(),k.EUC_JP="EUC_JP",k.UTF8=O.UTF8.getName(),k.PLATFORM_DEFAULT_ENCODING=k.UTF8,k.ASSUME_SHIFT_JIS=!1;class G{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=k.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let i=t;t<t+n;i++)this.append(e[i]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class ${constructor(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new x("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,n=e[0].length,i=new $(n,t);for(let o=0;o<t;o++){let l=e[o];for(let c=0;c<n;c++)l[c]&&i.set(c,o)}return i}static parseFromString(e,t,n){if(e===null)throw new x("stringRepresentation cannot be null");let i=new Array(e.length),o=0,l=0,c=-1,u=0,g=0;for(;g<e.length;)if(e.charAt(g)===`
|
|
`||e.charAt(g)==="\r"){if(o>l){if(c===-1)c=o-l;else if(o-l!==c)throw new x("row lengths do not match");l=o,u++}g++}else if(e.substring(g,g+t.length)===t)g+=t.length,i[o]=!0,o++;else if(e.substring(g,g+n.length)===n)g+=n.length,i[o]=!1,o++;else throw new x("illegal character encountered: "+e.substring(g));if(o>l){if(c===-1)c=o-l;else if(o-l!==c)throw new x("row lengths do not match");u++}let w=new $(c,u);for(let m=0;m<o;m++)i[m]&&w.set(Math.floor(m%c),Math.floor(m/c));return w}get(e,t){let n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){let n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){let n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){let n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new x("input matrix dimensions do not match");let t=new W(Math.floor(this.width/32)+1),n=this.rowSize,i=this.bits;for(let o=0,l=this.height;o<l;o++){let c=o*n,u=e.getRow(o,t).getBitArray();for(let g=0;g<n;g++)i[c+g]^=u[g]}}clear(){let e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,i){if(t<0||e<0)throw new x("Left and top must be nonnegative");if(i<1||n<1)throw new x("Height and width must be at least 1");let o=e+n,l=t+i;if(l>this.height||o>this.width)throw new x("The region must fit inside the matrix");let c=this.rowSize,u=this.bits;for(let g=t;g<l;g++){let w=g*c;for(let m=e;m<o;m++)u[w+Math.floor(m/32)]|=1<<(m&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new W(this.width):t.clear();let n=this.rowSize,i=this.bits,o=e*n;for(let l=0;l<n;l++)t.setBulk(l*32,i[o+l]);return t}setRow(e,t){N.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),n=new W(e),i=new W(e);for(let o=0,l=Math.floor((t+1)/2);o<l;o++)n=this.getRow(o,n),i=this.getRow(t-1-o,i),n.reverse(),i.reverse(),this.setRow(o,i),this.setRow(t-1-o,n)}getEnclosingRectangle(){let e=this.width,t=this.height,n=this.rowSize,i=this.bits,o=e,l=t,c=-1,u=-1;for(let g=0;g<t;g++)for(let w=0;w<n;w++){let m=i[g*n+w];if(m!==0){if(g<l&&(l=g),g>u&&(u=g),w*32<o){let C=0;for(;(m<<31-C&4294967295)===0;)C++;w*32+C<o&&(o=w*32+C)}if(w*32+31>c){let C=31;for(;!(m>>>C);)C--;w*32+C>c&&(c=w*32+C)}}}return c<o||u<l?null:Int32Array.from([o,l,c-o+1,u-l+1])}getTopLeftOnBit(){let e=this.rowSize,t=this.bits,n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;let i=n/e,o=n%e*32,l=t[n],c=0;for(;(l<<31-c&4294967295)===0;)c++;return o+=c,Int32Array.from([o,i])}getBottomRightOnBit(){let e=this.rowSize,t=this.bits,n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;let i=Math.floor(n/e),o=Math.floor(n%e)*32,l=t[n],c=31;for(;!(l>>>c);)c--;return o+=c,Int32Array.from([o,i])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof $))return!1;let t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&H.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+H.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let i=new G;for(let o=0,l=this.height;o<l;o++){for(let c=0,u=this.width;c<u;c++)i.append(this.get(c,o)?e:t);i.append(n)}return i.toString()}clone(){return new $(this.width,this.height,this.rowSize,this.bits.slice())}}class M extends A{static getNotFoundInstance(){return new M}}M.kind="NotFoundException";class ue extends R{constructor(e){super(e),this.luminances=ue.EMPTY,this.buckets=new Int32Array(ue.LUMINANCE_BUCKETS)}getBlackRow(e,t){let n=this.getLuminanceSource(),i=n.getWidth();t==null||t.getSize()<i?t=new W(i):t.clear(),this.initArrays(i);let o=n.getRow(e,this.luminances),l=this.buckets;for(let u=0;u<i;u++)l[(o[u]&255)>>ue.LUMINANCE_SHIFT]++;let c=ue.estimateBlackPoint(l);if(i<3)for(let u=0;u<i;u++)(o[u]&255)<c&&t.set(u);else{let u=o[0]&255,g=o[1]&255;for(let w=1;w<i-1;w++){let m=o[w+1]&255;(g*4-u-m)/2<c&&t.set(w),u=g,g=m}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),i=new $(t,n);this.initArrays(t);let o=this.buckets;for(let u=1;u<5;u++){let g=Math.floor(n*u/5),w=e.getRow(g,this.luminances),m=Math.floor(t*4/5);for(let C=Math.floor(t/5);C<m;C++){let b=w[C]&255;o[b>>ue.LUMINANCE_SHIFT]++}}let l=ue.estimateBlackPoint(o),c=e.getMatrix();for(let u=0;u<n;u++){let g=u*t;for(let w=0;w<t;w++)(c[g+w]&255)<l&&i.set(w,u)}return i}createBinarizer(e){return new ue(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let n=0;n<ue.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){let t=e.length,n=0,i=0,o=0;for(let w=0;w<t;w++)e[w]>o&&(i=w,o=e[w]),e[w]>n&&(n=e[w]);let l=0,c=0;for(let w=0;w<t;w++){let m=w-i,C=e[w]*m*m;C>c&&(l=w,c=C)}if(i>l){let w=i;i=l,l=w}if(l-i<=t/16)throw new M;let u=l-1,g=-1;for(let w=l-1;w>i;w--){let m=w-i,C=m*m*(l-w)*(n-e[w]);C>g&&(u=w,g=C)}return u<<ue.LUMINANCE_SHIFT}}ue.LUMINANCE_BITS=5,ue.LUMINANCE_SHIFT=8-ue.LUMINANCE_BITS,ue.LUMINANCE_BUCKETS=1<<ue.LUMINANCE_BITS,ue.EMPTY=Uint8ClampedArray.from([0]);class q extends ue{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;let e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=q.MINIMUM_DIMENSION&&n>=q.MINIMUM_DIMENSION){let i=e.getMatrix(),o=t>>q.BLOCK_SIZE_POWER;(t&q.BLOCK_SIZE_MASK)!==0&&o++;let l=n>>q.BLOCK_SIZE_POWER;(n&q.BLOCK_SIZE_MASK)!==0&&l++;let c=q.calculateBlackPoints(i,o,l,t,n),u=new $(t,n);q.calculateThresholdForBlock(i,o,l,t,n,c,u),this.matrix=u}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new q(e)}static calculateThresholdForBlock(e,t,n,i,o,l,c){let u=o-q.BLOCK_SIZE,g=i-q.BLOCK_SIZE;for(let w=0;w<n;w++){let m=w<<q.BLOCK_SIZE_POWER;m>u&&(m=u);let C=q.cap(w,2,n-3);for(let b=0;b<t;b++){let S=b<<q.BLOCK_SIZE_POWER;S>g&&(S=g);let T=q.cap(b,2,t-3),D=0;for(let Z=-2;Z<=2;Z++){let Q=l[C+Z];D+=Q[T-2]+Q[T-1]+Q[T]+Q[T+1]+Q[T+2]}let F=D/25;q.thresholdBlock(e,S,m,F,i,c)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,i,o,l){for(let c=0,u=n*o+t;c<q.BLOCK_SIZE;c++,u+=o)for(let g=0;g<q.BLOCK_SIZE;g++)(e[u+g]&255)<=i&&l.set(t+g,n+c)}static calculateBlackPoints(e,t,n,i,o){let l=o-q.BLOCK_SIZE,c=i-q.BLOCK_SIZE,u=new Array(n);for(let g=0;g<n;g++){u[g]=new Int32Array(t);let w=g<<q.BLOCK_SIZE_POWER;w>l&&(w=l);for(let m=0;m<t;m++){let C=m<<q.BLOCK_SIZE_POWER;C>c&&(C=c);let b=0,S=255,T=0;for(let F=0,Z=w*i+C;F<q.BLOCK_SIZE;F++,Z+=i){for(let Q=0;Q<q.BLOCK_SIZE;Q++){let j=e[Z+Q]&255;b+=j,j<S&&(S=j),j>T&&(T=j)}if(T-S>q.MIN_DYNAMIC_RANGE)for(F++,Z+=i;F<q.BLOCK_SIZE;F++,Z+=i)for(let Q=0;Q<q.BLOCK_SIZE;Q++)b+=e[Z+Q]&255}let D=b>>q.BLOCK_SIZE_POWER*2;if(T-S<=q.MIN_DYNAMIC_RANGE&&(D=S/2,g>0&&m>0)){let F=(u[g-1][m]+2*u[g][m-1]+u[g-1][m-1])/4;S<F&&(D=F)}u[g][m]=D}}return u}}q.BLOCK_SIZE_POWER=3,q.BLOCK_SIZE=1<<q.BLOCK_SIZE_POWER,q.BLOCK_SIZE_MASK=q.BLOCK_SIZE-1,q.MINIMUM_DIMENSION=q.BLOCK_SIZE*5,q.MIN_DYNAMIC_RANGE=24;class xe{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,i){throw new le("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new le("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new le("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new G;for(let n=0;n<this.height;n++){let i=this.getRow(n,e);for(let o=0;o<this.width;o++){let l=i[o]&255,c;l<64?c="#":l<128?c="+":l<192?c=".":c=" ",t.append(c)}t.append(`
|
|
`)}return t.toString()}}class st extends xe{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let n=this.delegate.getRow(e,t),i=this.getWidth();for(let o=0;o<i;o++)n[o]=255-(n[o]&255);return n}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let i=0;i<t;i++)n[i]=255-(e[i]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,i){return new st(this.delegate.crop(e,t,n,i))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new st(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new st(this.delegate.rotateCounterClockwise45())}}class zt extends xe{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=zt.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return zt.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){let i=new Uint8ClampedArray(t*n);for(let o=0,l=0,c=e.length;o<c;o+=4,l++){let u;if(e[o+3]===0)u=255;else{let w=e[o],m=e[o+1],C=e[o+2];u=306*w+601*m+117*C+512>>10}i[l]=u}return i}getRow(e,t){if(e<0||e>=this.getHeight())throw new x("Requested row is outside the image: "+e);let n=this.getWidth(),i=e*n;return t===null?t=this.buffer.slice(i,i+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(i,i+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,i){return super.crop(e,t,n,i),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){let e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){let t=this.getTempCanvasElement(),n=t.getContext("2d"),i=e*zt.DEGREE_TO_RADIANS,o=this.canvas.width,l=this.canvas.height,c=Math.ceil(Math.abs(Math.cos(i))*o+Math.abs(Math.sin(i))*l),u=Math.ceil(Math.abs(Math.sin(i))*o+Math.abs(Math.cos(i))*l);return t.width=c,t.height=u,n.translate(c/2,u/2),n.rotate(i),n.drawImage(this.canvas,o/-2,l/-2),this.buffer=zt.makeBufferFromCanvasImageData(t),this}invert(){return new st(this)}}zt.DEGREE_TO_RADIANS=Math.PI/180;class Cr{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var $e=(globalThis||global||self||window||void 0)&&(globalThis||global||self||window||void 0).__awaiter||function(E,e,t,n){function i(o){return o instanceof t?o:new t(function(l){l(o)})}return new(t||(t=Promise))(function(o,l){function c(w){try{g(n.next(w))}catch(m){l(m)}}function u(w){try{g(n.throw(w))}catch(m){l(m)}}function g(w){w.done?o(w.value):i(w.value).then(c,u)}g((n=n.apply(E,e||[])).next())})};class Ht{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return $e(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");let e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(let n of e){let i=n.kind==="video"?"videoinput":n.kind;if(i!=="videoinput")continue;let o=n.deviceId||n.id,l=n.label||`Video device ${t.length+1}`,c=n.groupId,u={deviceId:o,label:l,kind:i,groupId:c};t.push(u)}return t})}getVideoInputDevices(){return $e(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new Cr(t.deviceId,t.label))})}findDeviceById(e){return $e(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return $e(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return $e(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};let i={video:n};return yield this.decodeOnceFromConstraints(i,t)})}decodeOnceFromConstraints(e,t){return $e(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return $e(this,void 0,void 0,function*(){this.reset();let n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return $e(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return $e(this,void 0,void 0,function*(){let i;e?i={deviceId:{exact:e}}:i={facingMode:"environment"};let o={video:i};return yield this.decodeFromConstraints(o,t,n)})}decodeFromConstraints(e,t,n){return $e(this,void 0,void 0,function*(){let i=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(i,t,n)})}decodeFromStream(e,t,n){return $e(this,void 0,void 0,function*(){this.reset();let i=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(i,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return $e(this,void 0,void 0,function*(){let n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return $e(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){let n=document.getElementById(e);if(!n)throw new y(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new y(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new y("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new y("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new y("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new y("An image element must be provided.");this.reset();let t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){let t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){let n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new y("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new y("An URL must be provided.");this.reset();let t=this.prepareImageElement();this.imageElement=t;let n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new y("An URL must be provided.");this.reset();let t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new y("An URL must be provided.");this.reset();let n=this.prepareVideoElement(),i=this.decodeFromVideoElementContinuously(n,t);return n.src=e,i}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return $e(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return $e(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;let i=(o,l)=>{if(this._stopAsyncDecode){l(new M("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let c=this.decode(e);o(c)}catch(c){let u=t&&c instanceof M,w=(c instanceof v||c instanceof L)&&n;if(u||w)return setTimeout(i,this._timeBetweenDecodingAttempts,o,l);l(c)}};return new Promise((o,l)=>i(o,l))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let i=this.decode(e);t(i,null),setTimeout(n,this.timeBetweenScansMillis)}catch(i){t(null,i);let o=i instanceof v||i instanceof L,l=i instanceof M;(o||l)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){let t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return e.videoWidth!==0}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){let t=this.getCaptureCanvasContext(e);this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);let n=this.getCaptureCanvas(e),i=new zt(n),o=new q(i);return new _(o)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){let n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){let t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;let t=document.createElement("canvas"),n,i;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,i=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,i=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=i+"px",t.width=n,t.height=i,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class Ye{constructor(e,t,n=t==null?0:8*t.length,i,o,l=N.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=o,this.timestamp=l,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=o,this.resultMetadata=null,l==null?this.timestamp=N.currentTimeMillis():this.timestamp=l}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){let t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){let n=new Array(t.length+e.length);N.arraycopy(t,0,n,0,t.length),N.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Wn;(function(E){E[E.AZTEC=0]="AZTEC",E[E.CODABAR=1]="CODABAR",E[E.CODE_39=2]="CODE_39",E[E.CODE_93=3]="CODE_93",E[E.CODE_128=4]="CODE_128",E[E.DATA_MATRIX=5]="DATA_MATRIX",E[E.EAN_8=6]="EAN_8",E[E.EAN_13=7]="EAN_13",E[E.ITF=8]="ITF",E[E.MAXICODE=9]="MAXICODE",E[E.PDF_417=10]="PDF_417",E[E.QR_CODE=11]="QR_CODE",E[E.RSS_14=12]="RSS_14",E[E.RSS_EXPANDED=13]="RSS_EXPANDED",E[E.UPC_A=14]="UPC_A",E[E.UPC_E=15]="UPC_E",E[E.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Wn||(Wn={}));var oe=Wn,as;(function(E){E[E.OTHER=0]="OTHER",E[E.ORIENTATION=1]="ORIENTATION",E[E.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",E[E.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",E[E.ISSUE_NUMBER=4]="ISSUE_NUMBER",E[E.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",E[E.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",E[E.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",E[E.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",E[E.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",E[E.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(as||(as={}));var et=as;class _r{constructor(e,t,n,i,o=-1,l=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=o,this.structuredAppendParity=l,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class yr{exp(e){return this.expTable[e]}log(e){if(e===0)throw new x;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class wt{constructor(e,t){if(t.length===0)throw new x;this.field=e;let n=t.length;if(n>1&&t[0]===0){let i=1;for(;i<n&&t[i]===0;)i++;i===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-i),N.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);let t=this.coefficients,n;if(e===1){n=0;for(let l=0,c=t.length;l!==c;l++){let u=t[l];n=yr.addOrSubtract(n,u)}return n}n=t[0];let i=t.length,o=this.field;for(let l=1;l<i;l++)n=yr.addOrSubtract(o.multiply(e,n),t[l]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new x("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let l=t;t=n,n=l}let i=new Int32Array(n.length),o=n.length-t.length;N.arraycopy(n,0,i,0,o);for(let l=o;l<n.length;l++)i[l]=yr.addOrSubtract(t[l-o],n[l]);return new wt(this.field,i)}multiply(e){if(!this.field.equals(e.field))throw new x("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,n=t.length,i=e.coefficients,o=i.length,l=new Int32Array(n+o-1),c=this.field;for(let u=0;u<n;u++){let g=t[u];for(let w=0;w<o;w++)l[u+w]=yr.addOrSubtract(l[u+w],c.multiply(g,i[w]))}return new wt(c,l)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;let t=this.coefficients.length,n=this.field,i=new Int32Array(t),o=this.coefficients;for(let l=0;l<t;l++)i[l]=n.multiply(o[l],e);return new wt(n,i)}multiplyByMonomial(e,t){if(e<0)throw new x;if(t===0)return this.field.getZero();let n=this.coefficients,i=n.length,o=new Int32Array(i+e),l=this.field;for(let c=0;c<i;c++)o[c]=l.multiply(n[c],t);return new wt(l,o)}divide(e){if(!this.field.equals(e.field))throw new x("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new x("Divide by 0");let t=this.field,n=t.getZero(),i=this,o=e.getCoefficient(e.getDegree()),l=t.inverse(o);for(;i.getDegree()>=e.getDegree()&&!i.isZero();){let c=i.getDegree()-e.getDegree(),u=t.multiply(i.getCoefficient(i.getDegree()),l),g=e.multiplyByMonomial(c,u),w=t.buildMonomial(c,u);n=n.addOrSubtract(w),i=i.addOrSubtract(g)}return[n,i]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){let i=this.field.log(n);i===0?e+="1":i===1?e+="a":(e+="a^",e+=i)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class ui extends A{}ui.kind="ArithmeticException";class ye extends yr{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;let i=new Int32Array(t),o=1;for(let c=0;c<t;c++)i[c]=o,o*=2,o>=t&&(o^=e,o&=t-1);this.expTable=i;let l=new Int32Array(t);for(let c=0;c<t-1;c++)l[i[c]]=c;this.logTable=l,this.zero=new wt(this,Int32Array.from([0])),this.one=new wt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new x;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new wt(this,n)}inverse(e){if(e===0)throw new ui;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+U.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ye.AZTEC_DATA_12=new ye(4201,4096,1),ye.AZTEC_DATA_10=new ye(1033,1024,1),ye.AZTEC_DATA_6=new ye(67,64,1),ye.AZTEC_PARAM=new ye(19,16,1),ye.QR_CODE_FIELD_256=new ye(285,256,0),ye.DATA_MATRIX_FIELD_256=new ye(301,256,1),ye.AZTEC_DATA_8=ye.DATA_MATRIX_FIELD_256,ye.MAXICODE_FIELD_64=ye.AZTEC_DATA_6;class Zn extends A{}Zn.kind="ReedSolomonException";class Wt extends A{}Wt.kind="IllegalStateException";class Ir{constructor(e){this.field=e}decode(e,t){let n=this.field,i=new wt(n,e),o=new Int32Array(t),l=!0;for(let b=0;b<t;b++){let S=i.evaluateAt(n.exp(b+n.getGeneratorBase()));o[o.length-1-b]=S,S!==0&&(l=!1)}if(l)return;let c=new wt(n,o),u=this.runEuclideanAlgorithm(n.buildMonomial(t,1),c,t),g=u[0],w=u[1],m=this.findErrorLocations(g),C=this.findErrorMagnitudes(w,m);for(let b=0;b<m.length;b++){let S=e.length-1-n.log(m[b]);if(S<0)throw new Zn("Bad error location");e[S]=ye.addOrSubtract(e[S],C[b])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let b=e;e=t,t=b}let i=this.field,o=e,l=t,c=i.getZero(),u=i.getOne();for(;l.getDegree()>=(n/2|0);){let b=o,S=c;if(o=l,c=u,o.isZero())throw new Zn("r_{i-1} was zero");l=b;let T=i.getZero(),D=o.getCoefficient(o.getDegree()),F=i.inverse(D);for(;l.getDegree()>=o.getDegree()&&!l.isZero();){let Z=l.getDegree()-o.getDegree(),Q=i.multiply(l.getCoefficient(l.getDegree()),F);T=T.addOrSubtract(i.buildMonomial(Z,Q)),l=l.addOrSubtract(o.multiplyByMonomial(Z,Q))}if(u=T.multiply(c).addOrSubtract(S),l.getDegree()>=o.getDegree())throw new Wt("Division algorithm failed to reduce polynomial?")}let g=u.getCoefficient(0);if(g===0)throw new Zn("sigmaTilde(0) was zero");let w=i.inverse(g),m=u.multiplyScalar(w),C=l.multiplyScalar(w);return[m,C]}findErrorLocations(e){let t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);let n=new Int32Array(t),i=0,o=this.field;for(let l=1;l<o.getSize()&&i<t;l++)e.evaluateAt(l)===0&&(n[i]=o.inverse(l),i++);if(i!==t)throw new Zn("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){let n=t.length,i=new Int32Array(n),o=this.field;for(let l=0;l<n;l++){let c=o.inverse(t[l]),u=1;for(let g=0;g<n;g++)if(l!==g){let w=o.multiply(t[g],c),m=(w&1)===0?w|1:w&-2;u=o.multiply(u,m)}i[l]=o.multiply(e.evaluateAt(c),o.inverse(u)),o.getGeneratorBase()!==0&&(i[l]=o.multiply(i[l],c))}return i}}var ot;(function(E){E[E.UPPER=0]="UPPER",E[E.LOWER=1]="LOWER",E[E.MIXED=2]="MIXED",E[E.DIGIT=3]="DIGIT",E[E.PUNCT=4]="PUNCT",E[E.BINARY=5]="BINARY"})(ot||(ot={}));class Le{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),o=Le.convertBoolArrayToByteArray(i),l=Le.getEncodedData(i),c=new _r(o,l,null,null);return c.setNumBits(i.length),c}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,i=ot.UPPER,o="",l=0;for(;l<t;)if(i===ot.BINARY){if(t-l<5)break;let c=Le.readCode(e,l,5);if(l+=5,c===0){if(t-l<11)break;c=Le.readCode(e,l,11)+31,l+=11}for(let u=0;u<c;u++){if(t-l<8){l=t;break}let g=Le.readCode(e,l,8);o+=k.castAsNonUtf8Char(g),l+=8}i=n}else{let c=i===ot.DIGIT?4:5;if(t-l<c)break;let u=Le.readCode(e,l,c);l+=c;let g=Le.getCharacter(i,u);g.startsWith("CTRL_")?(n=i,i=Le.getTable(g.charAt(5)),g.charAt(6)==="L"&&(n=i)):(o+=g,i=n)}return o}static getTable(e){switch(e){case"L":return ot.LOWER;case"P":return ot.PUNCT;case"M":return ot.MIXED;case"D":return ot.DIGIT;case"B":return ot.BINARY;default:return ot.UPPER}}static getCharacter(e,t){switch(e){case ot.UPPER:return Le.UPPER_TABLE[t];case ot.LOWER:return Le.LOWER_TABLE[t];case ot.MIXED:return Le.MIXED_TABLE[t];case ot.PUNCT:return Le.PUNCT_TABLE[t];case ot.DIGIT:return Le.DIGIT_TABLE[t];default:throw new Wt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=ye.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=ye.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=ye.AZTEC_DATA_10):(n=12,t=ye.AZTEC_DATA_12);let i=this.ddata.getNbDatablocks(),o=e.length/n;if(o<i)throw new L;let l=e.length%n,c=new Int32Array(o);for(let C=0;C<o;C++,l+=n)c[C]=Le.readCode(e,l,n);try{new Ir(t).decode(c,o-i)}catch(C){throw new L(C)}let u=(1<<n)-1,g=0;for(let C=0;C<i;C++){let b=c[C];if(b===0||b===u)throw new L;(b===1||b===u-1)&&g++}let w=new Array(i*n-g),m=0;for(let C=0;C<i;C++){let b=c[C];if(b===1||b===u-1)w.fill(b>1,m,m+n-1),m+=n-1;else for(let S=n-1;S>=0;--S)w[m++]=(b&1<<S)!==0}return w}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,o=new Int32Array(i),l=new Array(this.totalBitsInLayer(n,t));if(t)for(let c=0;c<o.length;c++)o[c]=c;else{let c=i+1+2*U.truncDivision(U.truncDivision(i,2)-1,15),u=i/2,g=U.truncDivision(c,2);for(let w=0;w<u;w++){let m=w+U.truncDivision(w,15);o[u-w-1]=g-m-1,o[u+w]=g+m+1}}for(let c=0,u=0;c<n;c++){let g=(n-c)*4+(t?9:12),w=c*2,m=i-1-w;for(let C=0;C<g;C++){let b=C*2;for(let S=0;S<2;S++)l[u+b+S]=e.get(o[w+S],o[w+C]),l[u+2*g+b+S]=e.get(o[w+C],o[m-S]),l[u+4*g+b+S]=e.get(o[m-S],o[m-C]),l[u+6*g+b+S]=e.get(o[m-C],o[w+S])}u+=g*8}return l}static readCode(e,t,n){let i=0;for(let o=t;o<t+n;o++)i<<=1,e[o]&&(i|=1);return i}static readByte(e,t){let n=e.length-t;return n>=8?Le.readCode(e,t,8):Le.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=Le.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Le.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],Le.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],Le.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Le.PUNCT_TABLE=["","\r",`\r
|
|
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Le.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Ce{constructor(){}static round(e){return e===NaN?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,i){let o=e-n,l=t-i;return Math.sqrt(o*o+l*l)}static sum(e){let t=0;for(let n=0,i=e.length;n!==i;n++){let o=e[n];t+=o}return t}}class hi{static floatToIntBits(e){return e}}hi.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ie{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof ie){let t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*hi.floatToIntBits(this.x)+hi.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){let t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]),o,l,c;if(n>=t&&n>=i?(l=e[0],o=e[1],c=e[2]):i>=n&&i>=t?(l=e[1],o=e[0],c=e[2]):(l=e[2],o=e[0],c=e[1]),this.crossProductZ(o,l,c)<0){let u=o;o=c,c=u}e[0]=o,e[1]=l,e[2]=c}static distance(e,t){return Ce.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){let i=t.x,o=t.y;return(n.x-i)*(e.y-o)-(n.y-o)*(e.x-i)}}class di{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Xo extends di{constructor(e,t,n,i,o){super(e,t),this.compact=n,this.nbDatablocks=i,this.nbLayers=o}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class on{constructor(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=on.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);let o=t/2|0;if(this.leftInit=n-o,this.rightInit=n+o,this.upInit=i-o,this.downInit=i+o,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new M}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,o=!1,l=!0,c=!1,u=!1,g=!1,w=!1,m=!1,C=this.width,b=this.height;for(;l;){l=!1;let S=!0;for(;(S||!u)&&t<C;)S=this.containsBlackPoint(n,i,t,!1),S?(t++,l=!0,u=!0):u||t++;if(t>=C){o=!0;break}let T=!0;for(;(T||!g)&&i<b;)T=this.containsBlackPoint(e,t,i,!0),T?(i++,l=!0,g=!0):g||i++;if(i>=b){o=!0;break}let D=!0;for(;(D||!w)&&e>=0;)D=this.containsBlackPoint(n,i,e,!1),D?(e--,l=!0,w=!0):w||e--;if(e<0){o=!0;break}let F=!0;for(;(F||!m)&&n>=0;)F=this.containsBlackPoint(e,t,n,!0),F?(n--,l=!0,m=!0):m||n--;if(n<0){o=!0;break}l&&(c=!0)}if(!o&&c){let S=t-e,T=null;for(let Q=1;T===null&&Q<S;Q++)T=this.getBlackPointOnSegment(e,i-Q,e+Q,i);if(T==null)throw new M;let D=null;for(let Q=1;D===null&&Q<S;Q++)D=this.getBlackPointOnSegment(e,n+Q,e+Q,n);if(D==null)throw new M;let F=null;for(let Q=1;F===null&&Q<S;Q++)F=this.getBlackPointOnSegment(t,n+Q,t-Q,n);if(F==null)throw new M;let Z=null;for(let Q=1;Z===null&&Q<S;Q++)Z=this.getBlackPointOnSegment(t,i-Q,t-Q,i);if(Z==null)throw new M;return this.centerEdges(Z,T,F,D)}else throw new M}getBlackPointOnSegment(e,t,n,i){let o=Ce.round(Ce.distance(e,t,n,i)),l=(n-e)/o,c=(i-t)/o,u=this.image;for(let g=0;g<o;g++){let w=Ce.round(e+g*l),m=Ce.round(t+g*c);if(u.get(w,m))return new ie(w,m)}return null}centerEdges(e,t,n,i){let o=e.getX(),l=e.getY(),c=t.getX(),u=t.getY(),g=n.getX(),w=n.getY(),m=i.getX(),C=i.getY(),b=on.CORR;return o<this.width/2?[new ie(m-b,C+b),new ie(c+b,u+b),new ie(g-b,w-b),new ie(o+b,l-b)]:[new ie(m+b,C+b),new ie(c+b,u-b),new ie(g-b,w+b),new ie(o-b,l-b)]}containsBlackPoint(e,t,n,i){let o=this.image;if(i){for(let l=e;l<=t;l++)if(o.get(l,n))return!0}else for(let l=e;l<=t;l++)if(o.get(n,l))return!0;return!1}}on.INIT_SIZE=10,on.CORR=1;class ls{static checkAndNudgePoints(e,t){let n=e.getWidth(),i=e.getHeight(),o=!0;for(let l=0;l<t.length&&o;l+=2){let c=Math.floor(t[l]),u=Math.floor(t[l+1]);if(c<-1||c>n||u<-1||u>i)throw new M;o=!1,c===-1?(t[l]=0,o=!0):c===n&&(t[l]=n-1,o=!0),u===-1?(t[l+1]=0,o=!0):u===i&&(t[l+1]=i-1,o=!0)}o=!0;for(let l=t.length-2;l>=0&&o;l-=2){let c=Math.floor(t[l]),u=Math.floor(t[l+1]);if(c<-1||c>n||u<-1||u>i)throw new M;o=!1,c===-1?(t[l]=0,o=!0):c===n&&(t[l]=n-1,o=!0),u===-1?(t[l+1]=0,o=!0):u===i&&(t[l+1]=i-1,o=!0)}}}class Vt{constructor(e,t,n,i,o,l,c,u,g){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=o,this.a32=l,this.a13=c,this.a23=u,this.a33=g}static quadrilateralToQuadrilateral(e,t,n,i,o,l,c,u,g,w,m,C,b,S,T,D){let F=Vt.quadrilateralToSquare(e,t,n,i,o,l,c,u);return Vt.squareToQuadrilateral(g,w,m,C,b,S,T,D).times(F)}transformPoints(e){let t=e.length,n=this.a11,i=this.a12,o=this.a13,l=this.a21,c=this.a22,u=this.a23,g=this.a31,w=this.a32,m=this.a33;for(let C=0;C<t;C+=2){let b=e[C],S=e[C+1],T=o*b+u*S+m;e[C]=(n*b+l*S+g)/T,e[C+1]=(i*b+c*S+w)/T}}transformPointsWithValues(e,t){let n=this.a11,i=this.a12,o=this.a13,l=this.a21,c=this.a22,u=this.a23,g=this.a31,w=this.a32,m=this.a33,C=e.length;for(let b=0;b<C;b++){let S=e[b],T=t[b],D=o*S+u*T+m;e[b]=(n*S+l*T+g)/D,t[b]=(i*S+c*T+w)/D}}static squareToQuadrilateral(e,t,n,i,o,l,c,u){let g=e-n+o-c,w=t-i+l-u;if(g===0&&w===0)return new Vt(n-e,o-n,e,i-t,l-i,t,0,0,1);{let m=n-o,C=c-o,b=i-l,S=u-l,T=m*S-C*b,D=(g*S-C*w)/T,F=(m*w-g*b)/T;return new Vt(n-e+D*n,c-e+F*c,e,i-t+D*i,u-t+F*u,t,D,F,1)}}static quadrilateralToSquare(e,t,n,i,o,l,c,u){return Vt.squareToQuadrilateral(e,t,n,i,o,l,c,u).buildAdjoint()}buildAdjoint(){return new Vt(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new Vt(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class Go extends ls{sampleGrid(e,t,n,i,o,l,c,u,g,w,m,C,b,S,T,D,F,Z,Q){let j=Vt.quadrilateralToQuadrilateral(i,o,l,c,u,g,w,m,C,b,S,T,D,F,Z,Q);return this.sampleGridWithTransform(e,t,n,j)}sampleGridWithTransform(e,t,n,i){if(t<=0||n<=0)throw new M;let o=new $(t,n),l=new Float32Array(2*t);for(let c=0;c<n;c++){let u=l.length,g=c+.5;for(let w=0;w<u;w+=2)l[w]=w/2+.5,l[w+1]=g;i.transformPoints(l),ls.checkAndNudgePoints(e,l);try{for(let w=0;w<u;w+=2)e.get(Math.floor(l[w]),Math.floor(l[w+1]))&&o.set(w/2,c)}catch{throw new M}}return o}}class hn{static setGridSampler(e){hn.gridSampler=e}static getInstance(){return hn.gridSampler}}hn.gridSampler=new Go;class dt{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ie(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class jo{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let l=n[0];n[0]=n[2],n[2]=l}this.extractParameters(n);let i=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),o=this.getMatrixCornerPoints(n);return new Xo(i,o,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new M;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let i=0;for(let l=0;l<4;l++){let c=n[(this.shift+l)%4];this.compact?(i<<=7,i+=c>>1&127):(i<<=10,i+=(c>>2&992)+(c>>1&31))}let o=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(o>>6)+1,this.nbDataBlocks=(o&63)+1):(this.nbLayers=(o>>11)+1,this.nbDataBlocks=(o&2047)+1)}getRotation(e,t){let n=0;e.forEach((i,o,l)=>{let c=(i>>t-2<<1)+(i&1);n=(n<<3)+c}),n=((n&1)<<11)+(n>>1);for(let i=0;i<4;i++)if(U.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new M}getCorrectedParameterData(e,t){let n,i;t?(n=7,i=2):(n=10,i=4);let o=n-i,l=new Int32Array(n);for(let u=n-1;u>=0;--u)l[u]=e&15,e>>=4;try{new Ir(ye.AZTEC_PARAM).decode(l,o)}catch{throw new M}let c=0;for(let u=0;u<i;u++)c=(c<<4)+l[u];return c}getBullsEyeCorners(e){let t=e,n=e,i=e,o=e,l=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let m=this.getFirstDifferent(t,l,1,-1),C=this.getFirstDifferent(n,l,1,1),b=this.getFirstDifferent(i,l,-1,1),S=this.getFirstDifferent(o,l,-1,-1);if(this.nbCenterLayers>2){let T=this.distancePoint(S,m)*this.nbCenterLayers/(this.distancePoint(o,t)*(this.nbCenterLayers+2));if(T<.75||T>1.25||!this.isWhiteOrBlackRectangle(m,C,b,S))break}t=m,n=C,i=b,o=S,l=!l}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new M;this.compact=this.nbCenterLayers===5;let c=new ie(t.getX()+.5,t.getY()-.5),u=new ie(n.getX()+.5,n.getY()+.5),g=new ie(i.getX()-.5,i.getY()+.5),w=new ie(o.getX()-.5,o.getY()-.5);return this.expandSquare([c,u,g,w],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,i;try{let c=new on(this.image).detect();e=c[0],t=c[1],n=c[2],i=c[3]}catch{let u=this.image.getWidth()/2,g=this.image.getHeight()/2;e=this.getFirstDifferent(new dt(u+7,g-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new dt(u+7,g+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new dt(u-7,g+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new dt(u-7,g-7),!1,-1,-1).toResultPoint()}let o=Ce.round((e.getX()+i.getX()+t.getX()+n.getX())/4),l=Ce.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{let c=new on(this.image,15,o,l).detect();e=c[0],t=c[1],n=c[2],i=c[3]}catch{e=this.getFirstDifferent(new dt(o+7,l-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new dt(o+7,l+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new dt(o-7,l+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new dt(o-7,l-7),!1,-1,-1).toResultPoint()}return o=Ce.round((e.getX()+i.getX()+t.getX()+n.getX())/4),l=Ce.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new dt(o,l)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,i,o){let l=hn.getInstance(),c=this.getDimension(),u=c/2-this.nbCenterLayers,g=c/2+this.nbCenterLayers;return l.sampleGrid(e,c,c,u,u,g,u,g,g,u,g,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),o.getX(),o.getY())}sampleLine(e,t,n){let i=0,o=this.distanceResultPoint(e,t),l=o/n,c=e.getX(),u=e.getY(),g=l*(t.getX()-e.getX())/o,w=l*(t.getY()-e.getY())/o;for(let m=0;m<n;m++)this.image.get(Ce.round(c+m*g),Ce.round(u+m*w))&&(i|=1<<n-m-1);return i}isWhiteOrBlackRectangle(e,t,n,i){let o=3;e=new dt(e.getX()-o,e.getY()+o),t=new dt(t.getX()-o,t.getY()-o),n=new dt(n.getX()+o,n.getY()-o),i=new dt(i.getX()+o,i.getY()+o);let l=this.getColor(i,e);if(l===0)return!1;let c=this.getColor(e,t);return c!==l||(c=this.getColor(t,n),c!==l)?!1:(c=this.getColor(n,i),c===l)}getColor(e,t){let n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,o=(t.getY()-e.getY())/n,l=0,c=e.getX(),u=e.getY(),g=this.image.get(e.getX(),e.getY()),w=Math.ceil(n);for(let C=0;C<w;C++)c+=i,u+=o,this.image.get(Ce.round(c),Ce.round(u))!==g&&l++;let m=l/n;return m>.1&&m<.9?0:m<=.1===g?1:-1}getFirstDifferent(e,t,n,i){let o=e.getX()+n,l=e.getY()+i;for(;this.isValid(o,l)&&this.image.get(o,l)===t;)o+=n,l+=i;for(o-=n,l-=i;this.isValid(o,l)&&this.image.get(o,l)===t;)o+=n;for(o-=n;this.isValid(o,l)&&this.image.get(o,l)===t;)l+=i;return l-=i,new dt(o,l)}expandSquare(e,t,n){let i=n/(2*t),o=e[0].getX()-e[2].getX(),l=e[0].getY()-e[2].getY(),c=(e[0].getX()+e[2].getX())/2,u=(e[0].getY()+e[2].getY())/2,g=new ie(c+i*o,u+i*l),w=new ie(c-i*o,u-i*l);o=e[1].getX()-e[3].getX(),l=e[1].getY()-e[3].getY(),c=(e[1].getX()+e[3].getX())/2,u=(e[1].getY()+e[3].getY())/2;let m=new ie(c+i*o,u+i*l),C=new ie(c-i*o,u-i*l);return[g,m,w,C]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=Ce.round(e.getX()),n=Ce.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return Ce.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return Ce.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(U.truncDivision(this.nbLayers-4,8)+1)+15}}class gi{decode(e,t=null){let n=null,i=new jo(e.getBlackMatrix()),o=null,l=null;try{let w=i.detectMirror(!1);o=w.getPoints(),this.reportFoundResultPoints(t,o),l=new Le().decode(w)}catch(w){n=w}if(l==null)try{let w=i.detectMirror(!0);o=w.getPoints(),this.reportFoundResultPoints(t,o),l=new Le().decode(w)}catch(w){throw n??w}let c=new Ye(l.getText(),l.getRawBytes(),l.getNumBits(),o,oe.AZTEC,N.currentTimeMillis()),u=l.getByteSegments();u!=null&&c.putMetadata(et.BYTE_SEGMENTS,u);let g=l.getECLevel();return g!=null&&c.putMetadata(et.ERROR_CORRECTION_LEVEL,g),c}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((i,o,l)=>{n.foundPossibleResultPoint(i)})}}reset(){}}class S1 extends Ht{constructor(e=500){super(new gi,e)}}class Ze{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(z.TRY_HARDER)===!0&&e.isRotateSupported()){let o=e.rotateCounterClockwise(),l=this.doDecode(o,t),c=l.getResultMetadata(),u=270;c!==null&&c.get(et.ORIENTATION)===!0&&(u=u+c.get(et.ORIENTATION)%360),l.putMetadata(et.ORIENTATION,u);let g=l.getResultPoints();if(g!==null){let w=o.getHeight();for(let m=0;m<g.length;m++)g[m]=new ie(w-g[m].getY()-1,g[m].getX())}return l}else throw new M}}reset(){}doDecode(e,t){let n=e.getWidth(),i=e.getHeight(),o=new W(n),l=t&&t.get(z.TRY_HARDER)===!0,c=Math.max(1,i>>(l?8:5)),u;l?u=i:u=15;let g=Math.trunc(i/2);for(let w=0;w<u;w++){let m=Math.trunc((w+1)/2),C=(w&1)===0,b=g+c*(C?m:-m);if(b<0||b>=i)break;try{o=e.getBlackRow(b,o)}catch{continue}for(let S=0;S<2;S++){if(S===1&&(o.reverse(),t&&t.get(z.NEED_RESULT_POINT_CALLBACK)===!0)){let T=new Map;t.forEach((D,F)=>T.set(F,D)),T.delete(z.NEED_RESULT_POINT_CALLBACK),t=T}try{let T=this.decodeRow(b,o,t);if(S===1){T.putMetadata(et.ORIENTATION,180);let D=T.getResultPoints();D!==null&&(D[0]=new ie(n-D[0].getX()-1,D[0].getY()),D[1]=new ie(n-D[1].getX()-1,D[1].getY()))}return T}catch{}}}throw new M}static recordPattern(e,t,n){let i=n.length;for(let g=0;g<i;g++)n[g]=0;let o=e.getSize();if(t>=o)throw new M;let l=!e.get(t),c=0,u=t;for(;u<o;){if(e.get(u)!==l)n[c]++;else{if(++c===i)break;n[c]=1,l=!l}u++}if(!(c===i||c===i-1&&u===o))throw new M}static recordPatternInReverse(e,t,n){let i=n.length,o=e.get(t);for(;t>0&&i>=0;)e.get(--t)!==o&&(i--,o=!o);if(i>=0)throw new M;Ze.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){let i=e.length,o=0,l=0;for(let g=0;g<i;g++)o+=e[g],l+=t[g];if(o<l)return Number.POSITIVE_INFINITY;let c=o/l;n*=c;let u=0;for(let g=0;g<i;g++){let w=e[g],m=t[g]*c,C=w>m?w-m:m-w;if(C>n)return Number.POSITIVE_INFINITY;u+=C}return u/o}}class J extends Ze{static findStartPattern(e){let t=e.getSize(),n=e.getNextSet(0),i=0,o=Int32Array.from([0,0,0,0,0,0]),l=n,c=!1,u=6;for(let g=n;g<t;g++)if(e.get(g)!==c)o[i]++;else{if(i===u-1){let w=J.MAX_AVG_VARIANCE,m=-1;for(let C=J.CODE_START_A;C<=J.CODE_START_C;C++){let b=Ze.patternMatchVariance(o,J.CODE_PATTERNS[C],J.MAX_INDIVIDUAL_VARIANCE);b<w&&(w=b,m=C)}if(m>=0&&e.isRange(Math.max(0,l-(g-l)/2),l,!1))return Int32Array.from([l,g,m]);l+=o[0]+o[1],o=o.slice(2,o.length-1),o[i-1]=0,o[i]=0,i--}else i++;o[i]=1,c=!c}throw new M}static decodeCode(e,t,n){Ze.recordPattern(e,n,t);let i=J.MAX_AVG_VARIANCE,o=-1;for(let l=0;l<J.CODE_PATTERNS.length;l++){let c=J.CODE_PATTERNS[l],u=this.patternMatchVariance(t,c,J.MAX_INDIVIDUAL_VARIANCE);u<i&&(i=u,o=l)}if(o>=0)return o;throw new M}decodeRow(e,t,n){let i=n&&n.get(z.ASSUME_GS1)===!0,o=J.findStartPattern(t),l=o[2],c=0,u=new Uint8Array(20);u[c++]=l;let g;switch(l){case J.CODE_START_A:g=J.CODE_CODE_A;break;case J.CODE_START_B:g=J.CODE_CODE_B;break;case J.CODE_START_C:g=J.CODE_CODE_C;break;default:throw new L}let w=!1,m=!1,C="",b=o[0],S=o[1],T=Int32Array.from([0,0,0,0,0,0]),D=0,F=0,Z=l,Q=0,j=!0,we=!1,he=!1;for(;!w;){let rr=m;switch(m=!1,D=F,F=J.decodeCode(t,T,S),u[c++]=F,F!==J.CODE_STOP&&(j=!0),F!==J.CODE_STOP&&(Q++,Z+=Q*F),b=S,S+=T.reduce((t0,n0)=>t0+n0,0),F){case J.CODE_START_A:case J.CODE_START_B:case J.CODE_START_C:throw new L}switch(g){case J.CODE_CODE_A:if(F<64)he===we?C+=String.fromCharCode(32+F):C+=String.fromCharCode(32+F+128),he=!1;else if(F<96)he===we?C+=String.fromCharCode(F-64):C+=String.fromCharCode(F+64),he=!1;else switch(F!==J.CODE_STOP&&(j=!1),F){case J.CODE_FNC_1:i&&(C.length===0?C+="]C1":C+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_A:!we&&he?(we=!0,he=!1):we&&he?(we=!1,he=!1):he=!0;break;case J.CODE_SHIFT:m=!0,g=J.CODE_CODE_B;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_B:if(F<96)he===we?C+=String.fromCharCode(32+F):C+=String.fromCharCode(32+F+128),he=!1;else switch(F!==J.CODE_STOP&&(j=!1),F){case J.CODE_FNC_1:i&&(C.length===0?C+="]C1":C+="");break;case J.CODE_FNC_2:case J.CODE_FNC_3:break;case J.CODE_FNC_4_B:!we&&he?(we=!0,he=!1):we&&he?(we=!1,he=!1):he=!0;break;case J.CODE_SHIFT:m=!0,g=J.CODE_CODE_A;break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_C:g=J.CODE_CODE_C;break;case J.CODE_STOP:w=!0;break}break;case J.CODE_CODE_C:if(F<100)F<10&&(C+="0"),C+=F;else switch(F!==J.CODE_STOP&&(j=!1),F){case J.CODE_FNC_1:i&&(C.length===0?C+="]C1":C+="");break;case J.CODE_CODE_A:g=J.CODE_CODE_A;break;case J.CODE_CODE_B:g=J.CODE_CODE_B;break;case J.CODE_STOP:w=!0;break}break}rr&&(g=g===J.CODE_CODE_A?J.CODE_CODE_B:J.CODE_CODE_A)}let mt=S-b;if(S=t.getNextUnset(S),!t.isRange(S,Math.min(t.getSize(),S+(S-b)/2),!1))throw new M;if(Z-=Q*D,Z%103!==D)throw new v;let Gt=C.length;if(Gt===0)throw new M;Gt>0&&j&&(g===J.CODE_CODE_C?C=C.substring(0,Gt-2):C=C.substring(0,Gt-1));let Ct=(o[1]+o[0])/2,Be=b+mt/2,ct=u.length,bt=new Uint8Array(ct);for(let rr=0;rr<ct;rr++)bt[rr]=u[rr];let nr=[new ie(Ct,e),new ie(Be,e)];return new Ye(C,bt,0,nr,oe.CODE_128,new Date().getTime())}}J.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],J.MAX_AVG_VARIANCE=.25,J.MAX_INDIVIDUAL_VARIANCE=.7,J.CODE_SHIFT=98,J.CODE_CODE_C=99,J.CODE_CODE_B=100,J.CODE_CODE_A=101,J.CODE_FNC_1=102,J.CODE_FNC_2=97,J.CODE_FNC_3=96,J.CODE_FNC_4_A=101,J.CODE_FNC_4_B=100,J.CODE_START_A=103,J.CODE_START_B=104,J.CODE_START_C=105,J.CODE_STOP=106;class Ke extends Ze{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let i=this.counters;i.fill(0),this.decodeRowResult="";let o=Ke.findAsteriskPattern(t,i),l=t.getNextSet(o[1]),c=t.getSize(),u,g;do{Ke.recordPattern(t,l,i);let T=Ke.toNarrowWidePattern(i);if(T<0)throw new M;u=Ke.patternToChar(T),this.decodeRowResult+=u,g=l;for(let D of i)l+=D;l=t.getNextSet(l)}while(u!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let w=0;for(let T of i)w+=T;let m=l-g-w;if(l!==c&&m*2<w)throw new M;if(this.usingCheckDigit){let T=this.decodeRowResult.length-1,D=0;for(let F=0;F<T;F++)D+=Ke.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(F));if(this.decodeRowResult.charAt(T)!==Ke.ALPHABET_STRING.charAt(D%43))throw new v;this.decodeRowResult=this.decodeRowResult.substring(0,T)}if(this.decodeRowResult.length===0)throw new M;let C;this.extendedMode?C=Ke.decodeExtended(this.decodeRowResult):C=this.decodeRowResult;let b=(o[1]+o[0])/2,S=g+w/2;return new Ye(C,null,0,[new ie(b,e),new ie(S,e)],oe.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),i=e.getNextSet(0),o=0,l=i,c=!1,u=t.length;for(let g=i;g<n;g++)if(e.get(g)!==c)t[o]++;else{if(o===u-1){if(this.toNarrowWidePattern(t)===Ke.ASTERISK_ENCODING&&e.isRange(Math.max(0,l-Math.floor((g-l)/2)),l,!1))return[l,g];l+=t[0]+t[1],t.copyWithin(0,2,2+o-1),t[o-1]=0,t[o]=0,o--}else o++;t[o]=1,c=!c}throw new M}static toNarrowWidePattern(e){let t=e.length,n=0,i;do{let o=2147483647;for(let u of e)u<o&&u>n&&(o=u);n=o,i=0;let l=0,c=0;for(let u=0;u<t;u++){let g=e[u];g>n&&(c|=1<<t-1-u,i++,l+=g)}if(i===3){for(let u=0;u<t&&i>0;u++){let g=e[u];if(g>n&&(i--,g*2>=l))return-1}return c}}while(i>3);return-1}static patternToChar(e){for(let t=0;t<Ke.CHARACTER_ENCODINGS.length;t++)if(Ke.CHARACTER_ENCODINGS[t]===e)return Ke.ALPHABET_STRING.charAt(t);if(e===Ke.ASTERISK_ENCODING)return"*";throw new M}static decodeExtended(e){let t=e.length,n="";for(let i=0;i<t;i++){let o=e.charAt(i);if(o==="+"||o==="$"||o==="%"||o==="/"){let l=e.charAt(i+1),c="\0";switch(o){case"+":if(l>="A"&&l<="Z")c=String.fromCharCode(l.charCodeAt(0)+32);else throw new L;break;case"$":if(l>="A"&&l<="Z")c=String.fromCharCode(l.charCodeAt(0)-64);else throw new L;break;case"%":if(l>="A"&&l<="E")c=String.fromCharCode(l.charCodeAt(0)-38);else if(l>="F"&&l<="J")c=String.fromCharCode(l.charCodeAt(0)-11);else if(l>="K"&&l<="O")c=String.fromCharCode(l.charCodeAt(0)+16);else if(l>="P"&&l<="T")c=String.fromCharCode(l.charCodeAt(0)+43);else if(l==="U")c="\0";else if(l==="V")c="@";else if(l==="W")c="`";else if(l==="X"||l==="Y"||l==="Z")c="\x7F";else throw new L;break;case"/":if(l>="A"&&l<="O")c=String.fromCharCode(l.charCodeAt(0)-32);else if(l==="Z")c=":";else throw new L;break}n+=c,i++}else n+=o}return n}}Ke.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Ke.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Ke.ASTERISK_ENCODING=148;class De extends Ze{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let i=this.decodeStart(t),o=this.decodeEnd(t),l=new G;De.decodeMiddle(t,i[1],o[0],l);let c=l.toString(),u=null;n!=null&&(u=n.get(z.ALLOWED_LENGTHS)),u==null&&(u=De.DEFAULT_ALLOWED_LENGTHS);let g=c.length,w=!1,m=0;for(let S of u){if(g===S){w=!0;break}S>m&&(m=S)}if(!w&&g>m&&(w=!0),!w)throw new L;let C=[new ie(i[1],e),new ie(o[0],e)];return new Ye(c,null,0,C,oe.ITF,new Date().getTime())}static decodeMiddle(e,t,n,i){let o=new Int32Array(10),l=new Int32Array(5),c=new Int32Array(5);for(o.fill(0),l.fill(0),c.fill(0);t<n;){Ze.recordPattern(e,t,o);for(let g=0;g<5;g++){let w=2*g;l[g]=o[w],c[g]=o[w+1]}let u=De.decodeDigit(l);i.append(u.toString()),u=this.decodeDigit(c),i.append(u.toString()),o.forEach(function(g){t+=g})}}decodeStart(e){let t=De.skipWhiteSpace(e),n=De.findGuardPattern(e,t,De.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=this.narrowLineWidth*10;n=n<t?n:t;for(let i=t-1;n>0&&i>=0&&!e.get(i);i--)n--;if(n!==0)throw new M}static skipWhiteSpace(e){let t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new M;return n}decodeEnd(e){e.reverse();try{let t=De.skipWhiteSpace(e),n;try{n=De.findGuardPattern(e,t,De.END_PATTERN_REVERSED[0])}catch(o){o instanceof M&&(n=De.findGuardPattern(e,t,De.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let i=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-i,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let i=n.length,o=new Int32Array(i),l=e.getSize(),c=!1,u=0,g=t;o.fill(0);for(let w=t;w<l;w++)if(e.get(w)!==c)o[u]++;else{if(u===i-1){if(Ze.patternMatchVariance(o,n,De.MAX_INDIVIDUAL_VARIANCE)<De.MAX_AVG_VARIANCE)return[g,w];g+=o[0]+o[1],N.arraycopy(o,2,o,0,u-1),o[u-1]=0,o[u]=0,u--}else u++;o[u]=1,c=!c}throw new M}static decodeDigit(e){let t=De.MAX_AVG_VARIANCE,n=-1,i=De.PATTERNS.length;for(let o=0;o<i;o++){let l=De.PATTERNS[o],c=Ze.patternMatchVariance(e,l,De.MAX_INDIVIDUAL_VARIANCE);c<t?(t=c,n=o):c===t&&(n=-1)}if(n>=0)return n%10;throw new M}}De.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],De.MAX_AVG_VARIANCE=.38,De.MAX_INDIVIDUAL_VARIANCE=.5,De.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],De.START_PATTERN=Int32Array.from([1,1,1,1]),De.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Xe extends Ze{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,i=0,o=Int32Array.from([0,0,0]);for(;!t;){o=Int32Array.from([0,0,0]),n=Xe.findGuardPattern(e,i,!1,this.START_END_PATTERN,o);let l=n[0];i=n[1];let c=l-(i-l);c>=0&&(t=e.isRange(c,l,!1))}return n}static checkChecksum(e){return Xe.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Xe.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let i=t-1;i>=0;i-=2){let o=e.charAt(i).charCodeAt(0)-48;if(o<0||o>9)throw new L;n+=o}n*=3;for(let i=t-2;i>=0;i-=2){let o=e.charAt(i).charCodeAt(0)-48;if(o<0||o>9)throw new L;n+=o}return(1e3-n)%10}static decodeEnd(e,t){return Xe.findGuardPattern(e,t,!1,Xe.START_END_PATTERN,new Int32Array(Xe.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,i){return this.findGuardPattern(e,t,n,i,new Int32Array(i.length))}static findGuardPattern(e,t,n,i,o){let l=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let c=0,u=t,g=i.length,w=n;for(let m=t;m<l;m++)if(e.get(m)!==w)o[c]++;else{if(c===g-1){if(Ze.patternMatchVariance(o,i,Xe.MAX_INDIVIDUAL_VARIANCE)<Xe.MAX_AVG_VARIANCE)return Int32Array.from([u,m]);u+=o[0]+o[1];let C=o.slice(2,o.length-1);for(let b=0;b<c-1;b++)o[b]=C[b];o[c-1]=0,o[c]=0,c--}else c++;o[c]=1,w=!w}throw new M}static decodeDigit(e,t,n,i){this.recordPattern(e,n,t);let o=this.MAX_AVG_VARIANCE,l=-1,c=i.length;for(let u=0;u<c;u++){let g=i[u],w=Ze.patternMatchVariance(t,g,Xe.MAX_INDIVIDUAL_VARIANCE);w<o&&(o=w,l=u)}if(l>=0)return l;throw new M}}Xe.MAX_AVG_VARIANCE=.48,Xe.MAX_INDIVIDUAL_VARIANCE=.7,Xe.START_END_PATTERN=Int32Array.from([1,1,1]),Xe.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Xe.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Xe.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class br{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let i=this.decodeRowStringBuffer,o=this.decodeMiddle(t,n,i),l=i.toString(),c=br.parseExtensionString(l),u=[new ie((n[0]+n[1])/2,e),new ie(o,e)],g=new Ye(l,null,0,u,oe.UPC_EAN_EXTENSION,new Date().getTime());return c!=null&&g.putAllMetadata(c),g}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l=t[1],c=0;for(let g=0;g<5&&l<o;g++){let w=Xe.decodeDigit(e,i,l,Xe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let m of i)l+=m;w>=10&&(c|=1<<4-g),g!==4&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==5)throw new M;let u=this.determineCheckDigit(c);if(br.extensionChecksum(n.toString())!==u)throw new M;return l}static extensionChecksum(e){let t=e.length,n=0;for(let i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(let i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new M}static parseExtensionString(e){if(e.length!==5)return null;let t=br.parseExtension5String(e);return t==null?null:new Map([[et.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xA3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}let n=parseInt(e.substring(1)),i=(n/100).toString(),o=n%100,l=o<10?"0"+o:o.toString();return t+i+"."+l}}class cs{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let i=this.decodeRowStringBuffer,o=this.decodeMiddle(t,n,i),l=i.toString(),c=cs.parseExtensionString(l),u=[new ie((n[0]+n[1])/2,e),new ie(o,e)],g=new Ye(l,null,0,u,oe.UPC_EAN_EXTENSION,new Date().getTime());return c!=null&&g.putAllMetadata(c),g}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l=t[1],c=0;for(let u=0;u<2&&l<o;u++){let g=Xe.decodeDigit(e,i,l,Xe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+g%10);for(let w of i)l+=w;g>=10&&(c|=1<<1-u),u!==1&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==2)throw new M;if(parseInt(n.toString())%4!==c)throw new M;return l}static parseExtensionString(e){return e.length!==2?null:new Map([[et.ISSUE_NUMBER,parseInt(e)]])}}class Yo{static decodeRow(e,t,n){let i=Xe.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new br().decodeRow(e,t,i)}catch{return new cs().decodeRow(e,t,i)}}}Yo.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ie extends Xe{constructor(){super(),this.decodeRowStringBuffer="",Ie.L_AND_G_PATTERNS=Ie.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ie.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let i=0;i<t.length;i++)n[i]=t[t.length-i-1];Ie.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let i=Ie.findStartGuardPattern(t),o=n==null?null:n.get(z.NEED_RESULT_POINT_CALLBACK);if(o!=null){let j=new ie((i[0]+i[1])/2,e);o.foundPossibleResultPoint(j)}let l=this.decodeMiddle(t,i,this.decodeRowStringBuffer),c=l.rowOffset,u=l.resultString;if(o!=null){let j=new ie(c,e);o.foundPossibleResultPoint(j)}let g=this.decodeEnd(t,c);if(o!=null){let j=new ie((g[0]+g[1])/2,e);o.foundPossibleResultPoint(j)}let w=g[1],m=w+(w-g[0]);if(m>=t.getSize()||!t.isRange(w,m,!1))throw new M;let C=u.toString();if(C.length<8)throw new L;if(!Ie.checkChecksum(C))throw new v;let b=(i[1]+i[0])/2,S=(g[1]+g[0])/2,T=this.getBarcodeFormat(),D=[new ie(b,e),new ie(S,e)],F=new Ye(C,null,0,D,T,new Date().getTime()),Z=0;try{let j=Yo.decodeRow(e,t,g[1]);F.putMetadata(et.UPC_EAN_EXTENSION,j.getText()),F.putAllMetadata(j.getResultMetadata()),F.addResultPoints(j.getResultPoints()),Z=j.getText().length}catch{}let Q=n==null?null:n.get(z.ALLOWED_EAN_EXTENSIONS);if(Q!=null){let j=!1;for(let we in Q)if(Z.toString()===we){j=!0;break}if(!j)throw new M}return F}decodeEnd(e,t){return Ie.findGuardPattern(e,t,!1,Ie.START_END_PATTERN,new Int32Array(Ie.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ie.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ie.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let i=t-1;i>=0;i-=2){let o=e.charAt(i).charCodeAt(0)-48;if(o<0||o>9)throw new L;n+=o}n*=3;for(let i=t-2;i>=0;i-=2){let o=e.charAt(i).charCodeAt(0)-48;if(o<0||o>9)throw new L;n+=o}return(1e3-n)%10}}class Mn extends Ie{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l=t[1],c=0;for(let g=0;g<6&&l<o;g++){let w=Ie.decodeDigit(e,i,l,Ie.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let m of i)l+=m;w>=10&&(c|=1<<5-g)}n=Mn.determineFirstDigit(n,c),l=Ie.findGuardPattern(e,l,!0,Ie.MIDDLE_PATTERN,new Int32Array(Ie.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<6&&l<o;g++){let w=Ie.decodeDigit(e,i,l,Ie.L_PATTERNS);n+=String.fromCharCode(48+w);for(let m of i)l+=m}return{rowOffset:l,resultString:n}}getBarcodeFormat(){return oe.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode(48+n)+e,e;throw new M}}Mn.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Wo extends Ie{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l=t[1];for(let u=0;u<4&&l<o;u++){let g=Ie.decodeDigit(e,i,l,Ie.L_PATTERNS);n+=String.fromCharCode(48+g);for(let w of i)l+=w}l=Ie.findGuardPattern(e,l,!0,Ie.MIDDLE_PATTERN,new Int32Array(Ie.MIDDLE_PATTERN.length).fill(0))[1];for(let u=0;u<4&&l<o;u++){let g=Ie.decodeDigit(e,i,l,Ie.L_PATTERNS);n+=String.fromCharCode(48+g);for(let w of i)l+=w}return{rowOffset:l,resultString:n}}getBarcodeFormat(){return oe.EAN_8}}class Zo extends Ie{constructor(){super(...arguments),this.ean13Reader=new Mn}getBarcodeFormat(){return oe.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if(t.charAt(0)==="0"){let n=new Ye(t.substring(1),null,null,e.getResultPoints(),oe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new M}reset(){this.ean13Reader.reset()}}class Xt extends Ie{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters.map(g=>g);i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l=t[1],c=0;for(let g=0;g<6&&l<o;g++){let w=Xt.decodeDigit(e,i,l,Xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let m of i)l+=m;w>=10&&(c|=1<<5-g)}let u=Xt.determineNumSysAndCheckDigit(n,c);return{rowOffset:l,resultString:u}}decodeEnd(e,t){return Xt.findGuardPatternWithoutCounters(e,t,!0,Xt.MIDDLE_END_PATTERN)}checkChecksum(e){return Ie.checkChecksum(Xt.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let i=0;i<10;i++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][i]){let o=String.fromCharCode(48+n),l=String.fromCharCode(48+i);return o+e+l}throw M.getNotFoundInstance()}getBarcodeFormat(){return oe.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(o=>o.charCodeAt(0)),n=new G;n.append(e.charAt(0));let i=t[5];switch(i){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(i),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(i);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Xt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Xt.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class fs extends Ze{constructor(e){super();let t=e==null?null:e.get(z.POSSIBLE_FORMATS),n=[];a(t)?(n.push(new Mn),n.push(new Zo),n.push(new Wo),n.push(new Xt)):(t.indexOf(oe.EAN_13)>-1&&n.push(new Mn),t.indexOf(oe.UPC_A)>-1&&n.push(new Zo),t.indexOf(oe.EAN_8)>-1&&n.push(new Wo),t.indexOf(oe.UPC_E)>-1&&n.push(new Xt)),this.readers=n}decodeRow(e,t,n){for(let i of this.readers)try{let o=i.decodeRow(e,t,n),l=o.getBarcodeFormat()===oe.EAN_13&&o.getText().charAt(0)==="0",c=n==null?null:n.get(z.POSSIBLE_FORMATS),u=c==null||c.includes(oe.UPC_A);if(l&&u){let g=o.getRawBytes(),w=new Ye(o.getText().substring(1),g,g?g.length:null,o.getResultPoints(),oe.UPC_A);return w.putAllMetadata(o.getResultMetadata()),w}return o}catch{}throw new M}reset(){for(let e of this.readers)e.reset()}}class ut extends Ze{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(Ze.patternMatchVariance(e,t[n],ut.MAX_INDIVIDUAL_VARIANCE)<ut.MAX_AVG_VARIANCE)return n;throw new M}static count(e){return Ce.sum(new Int32Array(e))}static increment(e,t){let n=0,i=t[0];for(let o=1;o<e.length;o++)t[o]>i&&(i=t[o],n=o);e[n]++}static decrement(e,t){let n=0,i=t[0];for(let o=1;o<e.length;o++)t[o]<i&&(i=t[o],n=o);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],i=t/n;if(i>=ut.MIN_FINDER_PATTERN_RATIO&&i<=ut.MAX_FINDER_PATTERN_RATIO){let o=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;for(let c of e)c>l&&(l=c),c<o&&(o=c);return l<10*o}return!1}}ut.MAX_AVG_VARIANCE=.2,ut.MAX_INDIVIDUAL_VARIANCE=.45,ut.MIN_FINDER_PATTERN_RATIO=9.5/12,ut.MAX_FINDER_PATTERN_RATIO=12.5/14;class Qn{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof Qn))return!1;let t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class xi{constructor(e,t,n,i,o){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ie(n,o)),this.resultPoints.push(new ie(i,o))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof xi))return!1;let t=e;return this.value===t.value}hashCode(){return this.value}}class Zt{constructor(){}static getRSSvalue(e,t,n){let i=0;for(let u of e)i+=u;let o=0,l=0,c=e.length;for(let u=0;u<c-1;u++){let g;for(g=1,l|=1<<u;g<e[u];g++,l&=~(1<<u)){let w=Zt.combins(i-g-1,c-u-2);if(n&&l===0&&i-g-(c-u-1)>=c-u-1&&(w-=Zt.combins(i-g-(c-u),c-u-2)),c-u-1>1){let m=0;for(let C=i-g-(c-u-2);C>t;C--)m+=Zt.combins(i-g-C-1,c-u-3);w-=m*(c-1-u)}else i-g>t&&w--;o+=w}i-=g}return o}static combins(e,t){let n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);let o=1,l=1;for(let c=e;c>n;c--)o*=c,l<=i&&(o/=l,l++);for(;l<=i;)o/=l,l++;return o}}class T1{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,i=new W(n),o=0,c=e[0].getRightChar().getValue();for(let u=11;u>=0;--u)(c&1<<u)!=0&&i.set(o),o++;for(let u=1;u<e.length;++u){let g=e[u],w=g.getLeftChar().getValue();for(let m=11;m>=0;--m)(w&1<<m)!=0&&i.set(o),o++;if(g.getRightChar()!=null){let m=g.getRightChar().getValue();for(let C=11;C>=0;--C)(m&1<<C)!=0&&i.set(o),o++}}return i}}class On{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class us{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class pt extends us{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===pt.FNC1}}pt.FNC1="$";class Rn extends us{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Rt extends us{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new L;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Rt.FNC1}isSecondDigitFNC1(){return this.secondDigit===Rt.FNC1}isAnyFNC1(){return this.firstDigit===Rt.FNC1||this.secondDigit===Rt.FNC1}}Rt.FNC1=10;class ne{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new M;let t=e.substring(0,2);for(let o of ne.TWO_DIGIT_DATA_LENGTH)if(o[0]===t)return o[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(2,o[2],e):ne.processFixedAI(2,o[1],e);if(e.length<3)throw new M;let n=e.substring(0,3);for(let o of ne.THREE_DIGIT_DATA_LENGTH)if(o[0]===n)return o[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(3,o[2],e):ne.processFixedAI(3,o[1],e);for(let o of ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(o[0]===n)return o[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,o[2],e):ne.processFixedAI(4,o[1],e);if(e.length<4)throw new M;let i=e.substring(0,4);for(let o of ne.FOUR_DIGIT_DATA_LENGTH)if(o[0]===i)return o[1]===ne.VARIABLE_LENGTH?ne.processVariableAI(4,o[2],e):ne.processFixedAI(4,o[1],e);throw new M}static processFixedAI(e,t,n){if(n.length<e)throw new M;let i=n.substring(0,e);if(n.length<e+t)throw new M;let o=n.substring(e,e+t),l=n.substring(e+t),c="("+i+")"+o,u=ne.parseFieldsInGeneralPurpose(l);return u==null?c:c+u}static processVariableAI(e,t,n){let i=n.substring(0,e),o;n.length<e+t?o=n.length:o=e+t;let l=n.substring(e,o),c=n.substring(o),u="("+i+")"+l,g=ne.parseFieldsInGeneralPurpose(c);return g==null?u:u+g}}ne.VARIABLE_LENGTH=[],ne.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ne.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ne.VARIABLE_LENGTH,20],["22",ne.VARIABLE_LENGTH,29],["30",ne.VARIABLE_LENGTH,8],["37",ne.VARIABLE_LENGTH,8],["90",ne.VARIABLE_LENGTH,30],["91",ne.VARIABLE_LENGTH,30],["92",ne.VARIABLE_LENGTH,30],["93",ne.VARIABLE_LENGTH,30],["94",ne.VARIABLE_LENGTH,30],["95",ne.VARIABLE_LENGTH,30],["96",ne.VARIABLE_LENGTH,30],["97",ne.VARIABLE_LENGTH,3],["98",ne.VARIABLE_LENGTH,30],["99",ne.VARIABLE_LENGTH,30]],ne.THREE_DIGIT_DATA_LENGTH=[["240",ne.VARIABLE_LENGTH,30],["241",ne.VARIABLE_LENGTH,30],["242",ne.VARIABLE_LENGTH,6],["250",ne.VARIABLE_LENGTH,30],["251",ne.VARIABLE_LENGTH,30],["253",ne.VARIABLE_LENGTH,17],["254",ne.VARIABLE_LENGTH,20],["400",ne.VARIABLE_LENGTH,30],["401",ne.VARIABLE_LENGTH,30],["402",17],["403",ne.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ne.VARIABLE_LENGTH,20],["421",ne.VARIABLE_LENGTH,15],["422",3],["423",ne.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ne.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",ne.VARIABLE_LENGTH,15],["391",ne.VARIABLE_LENGTH,18],["392",ne.VARIABLE_LENGTH,15],["393",ne.VARIABLE_LENGTH,18],["703",ne.VARIABLE_LENGTH,30]],ne.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ne.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ne.VARIABLE_LENGTH,20],["8003",ne.VARIABLE_LENGTH,30],["8004",ne.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ne.VARIABLE_LENGTH,30],["8008",ne.VARIABLE_LENGTH,12],["8018",18],["8020",ne.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ne.VARIABLE_LENGTH,70],["8200",ne.VARIABLE_LENGTH,70]];class Kn{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let n=t,i=null;do{let o=this.decodeGeneralPurposeField(n,i),l=ne.parseFieldsInGeneralPurpose(o.getNewString());if(l!=null&&e.append(l),o.isRemaining()?i=""+o.getRemainingValue():i=null,n===o.getNewPosition())break;n=o.getNewPosition()}while(!0);return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let o=this.extractNumericValueFromBitArray(e,4);return o===0?new Rt(this.information.getSize(),Rt.FNC1,Rt.FNC1):new Rt(this.information.getSize(),o-1,Rt.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,i=(t-8)%11;return new Rt(e+7,n,i)}extractNumericValueFromBitArray(e,t){return Kn.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let i=0;for(let o=0;o<n;++o)e.get(t+o)&&(i|=1<<n-o-1);return i}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return n!=null&&n.isRemaining()?new Rn(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Rn(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),!(n!==this.current.getPosition())&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return e.isSecondDigitFNC1()?t=new Rn(this.current.getPosition(),this.buffer.toString()):t=new Rn(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new On(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new Rn(this.current.getPosition(),this.buffer.toString());return new On(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new On(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new Rn(this.current.getPosition(),this.buffer.toString());return new On(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new On(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new Rn(this.current.getPosition(),this.buffer.toString());return new On(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new On(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new pt(e+5,pt.FNC1);if(t>=5&&t<15)return new pt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new pt(e+7,""+(n+1));if(n>=90&&n<116)return new pt(e+7,""+(n+7));let i=this.extractNumericValueFromBitArray(e,8),o;switch(i){case 232:o="!";break;case 233:o='"';break;case 234:o="%";break;case 235:o="&";break;case 236:o="'";break;case 237:o="(";break;case 238:o=")";break;case 239:o="*";break;case 240:o="+";break;case 241:o=",";break;case 242:o="-";break;case 243:o=".";break;case 244:o="/";break;case 245:o=":";break;case 246:o=";";break;case 247:o="<";break;case 248:o="=";break;case 249:o=">";break;case 250:o="?";break;case 251:o="_";break;case 252:o=" ";break;default:throw new L}return new pt(e+8,o)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new pt(e+5,pt.FNC1);if(t>=5&&t<15)return new pt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new pt(e+6,""+(n+33));let i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new Wt("Decoding invalid alphanumeric value: "+n)}return new pt(e+6,i)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class hs{constructor(e){this.information=e,this.generalDecoder=new Kn(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class At extends hs{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let i=0;i<4;++i){let o=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*i,10);o/100===0&&e.append("0"),o/10===0&&e.append("0"),e.append(o)}At.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let i=0;i<13;i++){let o=e.charAt(i+t).charCodeAt(0)-48;n+=(i&1)===0?3*o:o}n=10-n%10,n===10&&(n=0),e.append(n)}}At.GTIN_SIZE=40;class qn extends At{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(qn.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,qn.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,qn.HEADER_SIZE+44)}}qn.HEADER_SIZE=4;class wi extends hs{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,wi.HEADER_SIZE)}}wi.HEADER_SIZE=5;class pi extends At{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let i=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,i);let o=this.checkWeight(i),l=1e5;for(let c=0;c<5;++c)o/l===0&&e.append("0"),l/=10;e.append(o)}}class Qt extends pi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Qt.HEADER_SIZE+pi.GTIN_SIZE+Qt.WEIGHT_SIZE)throw new M;let e=new G;return this.encodeCompressedGtin(e,Qt.HEADER_SIZE),this.encodeCompressedWeight(e,Qt.HEADER_SIZE+pi.GTIN_SIZE,Qt.WEIGHT_SIZE),e.toString()}}Qt.HEADER_SIZE=5,Qt.WEIGHT_SIZE=15;class N1 extends Qt{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class M1 extends Qt{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Kt extends At{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Kt.HEADER_SIZE+At.GTIN_SIZE)throw new M;let e=new G;this.encodeCompressedGtin(e,Kt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+At.GTIN_SIZE,Kt.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Kt.HEADER_SIZE+At.GTIN_SIZE+Kt.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Kt.HEADER_SIZE=8,Kt.LAST_DIGIT_SIZE=2;class gt extends At{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<gt.HEADER_SIZE+At.GTIN_SIZE)throw new M;let e=new G;this.encodeCompressedGtin(e,gt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(gt.HEADER_SIZE+At.GTIN_SIZE,gt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(gt.HEADER_SIZE+At.GTIN_SIZE+gt.LAST_DIGIT_SIZE,gt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let i=this.getGeneralDecoder().decodeGeneralPurposeField(gt.HEADER_SIZE+At.GTIN_SIZE+gt.LAST_DIGIT_SIZE+gt.FIRST_THREE_DIGITS_SIZE,null);return e.append(i.getNewString()),e.toString()}}gt.HEADER_SIZE=8,gt.LAST_DIGIT_SIZE=2,gt.FIRST_THREE_DIGITS_SIZE=10;class Ue extends pi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=Ue.HEADER_SIZE+Ue.GTIN_SIZE+Ue.WEIGHT_SIZE+Ue.DATE_SIZE)throw new M;let e=new G;return this.encodeCompressedGtin(e,Ue.HEADER_SIZE),this.encodeCompressedWeight(e,Ue.HEADER_SIZE+Ue.GTIN_SIZE,Ue.WEIGHT_SIZE),this.encodeCompressedDate(e,Ue.HEADER_SIZE+Ue.GTIN_SIZE+Ue.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,Ue.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let i=n%32;n/=32;let o=n%12+1;n/=12;let l=n;l/10==0&&e.append("0"),e.append(l),o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}Ue.HEADER_SIZE=8,Ue.WEIGHT_SIZE=20,Ue.DATE_SIZE=16;function Qo(E){try{if(E.get(1))return new qn(E);if(!E.get(2))return new wi(E);switch(Kn.extractNumericValueFromBitArray(E,1,4)){case 4:return new N1(E);case 5:return new M1(E)}switch(Kn.extractNumericValueFromBitArray(E,1,5)){case 12:return new Kt(E);case 13:return new gt(E)}switch(Kn.extractNumericValueFromBitArray(E,1,7)){case 56:return new Ue(E,"310","11");case 57:return new Ue(E,"320","11");case 58:return new Ue(E,"310","13");case 59:return new Ue(E,"320","13");case 60:return new Ue(E,"310","15");case 61:return new Ue(E,"320","15");case 62:return new Ue(E,"310","17");case 63:return new Ue(E,"320","17")}}catch(e){throw console.log(e),new Wt("unknown decoder: "+E)}}class dn{constructor(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof dn?dn.equalsOrNull(e.leftchar,t.leftchar)&&dn.equalsOrNull(e.rightchar,t.rightchar)&&dn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:dn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class ds{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof ds?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((i,o)=>{t.forEach(l=>{i.getLeftChar().getValue()===l.getLeftChar().getValue()&&i.getRightChar().getValue()===l.getRightChar().getValue()&&i.getFinderPatter().getValue()===l.getFinderPatter().getValue()&&(n=!0)})}),n}}class X extends ut{constructor(e){super(...arguments),this.pairs=new Array(X.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=e===!0}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return X.constructResult(this.decodeRow2pairs(e,t))}catch(i){this.verbose&&console.log(i)}return this.pairs.length=0,this.startFromEven=!0,X.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(o){if(o instanceof M){if(!this.pairs.length)throw new M;n=!0}}if(this.checkChecksum())return this.pairs;let i;if(this.rows.length?i=!0:i=!1,this.storeRow(e,!1),i){let o=this.checkRowsBoolean(!1);if(o!=null||(o=this.checkRowsBoolean(!0),o!=null))return o}throw new M}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let i=this.rows[n];this.pairs.length=0;for(let l of e)this.pairs.push(l.getPairs());if(this.pairs.push(i.getPairs()),!X.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let o=new Array(e);o.push(i);try{return this.checkRows(o,n+1)}catch(l){this.verbose&&console.log(l)}}throw new M}static isValidSequence(e){for(let t of X.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let i=0;i<e.length;i++)if(e[i].getFinderPattern().getValue()!=t[i]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,i=!1,o=!1;for(;n<this.rows.length;){let l=this.rows[n];if(l.getRowNumber()>e){o=l.isEquivalent(this.pairs);break}i=l.isEquivalent(this.pairs),n++}o||i||X.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new ds(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length){for(let i of n.getPairs())for(let o of e)if(dn.equals(i,o))break}}static isPartialRow(e,t){for(let n of t){let i=!0;for(let o of e){let l=!1;for(let c of n.getPairs())if(o.equals(c)){l=!0;break}if(!l){i=!1;break}}if(i)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=T1.buildBitArray(e),i=Qo(t).parseInformation(),o=e[0].getFinderPattern().getResultPoints(),l=e[e.length-1].getFinderPattern().getResultPoints(),c=[o[0],o[1],l[0],l[1]];return new Ye(i,null,null,c,oe.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let i=n.getChecksumPortion(),o=2;for(let c=1;c<this.pairs.size();++c){let u=this.pairs.get(c);i+=u.getLeftChar().getChecksumPortion(),o++;let g=u.getRightChar();g!=null&&(i+=g.getChecksumPortion(),o++)}return i%=211,211*(o-4)+i==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let i=t.length%2==0;this.startFromEven&&(i=!i);let o,l=!0,c=-1;do this.findNextPair(e,t,c),o=this.parseFoundFinderPattern(e,n,i),o==null?c=X.getNextSecondBar(e,this.startEnd[0]):l=!1;while(l);let u=this.decodeDataCharacter(e,o,i,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new M;let g;try{g=this.decodeDataCharacter(e,o,i,!1)}catch(w){g=null,this.verbose&&console.log(w)}return new dn(u,g,o,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize(),l;n>=0?l=n:this.isEmptyPair(t)?l=0:l=t[t.length-1].getFinderPattern().getStartEnd()[1];let c=t.length%2!=0;this.startFromEven&&(c=!c);let u=!1;for(;l<o&&(u=!e.get(l),!!u);)l++;let g=0,w=l;for(let m=l;m<o;m++)if(e.get(m)!=u)i[g]++;else{if(g==3){if(c&&X.reverseCounters(i),X.isFinderPattern(i)){this.startEnd[0]=w,this.startEnd[1]=m;return}c&&X.reverseCounters(i),w+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,g--}else g++;i[g]=1,u=!u}throw new M}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let i=e[n];e[n]=e[t-n-1],e[t-n-1]=i}}parseFoundFinderPattern(e,t,n){let i,o,l;if(n){let g=this.startEnd[0]-1;for(;g>=0&&!e.get(g);)g--;g++,i=this.startEnd[0]-g,o=g,l=this.startEnd[1]}else o=this.startEnd[0],l=e.getNextUnset(this.startEnd[1]+1),i=l-this.startEnd[1];let c=this.getDecodeFinderCounters();N.arraycopy(c,0,c,1,c.length-1),c[0]=i;let u;try{u=this.parseFinderValue(c,X.FINDER_PATTERNS)}catch{return null}return new xi(u,[o,l],o,l,t)}decodeDataCharacter(e,t,n,i){let o=this.getDataCharacterCounters();for(let Be=0;Be<o.length;Be++)o[Be]=0;if(i)X.recordPatternInReverse(e,t.getStartEnd()[0],o);else{X.recordPattern(e,t.getStartEnd()[1],o);for(let Be=0,ct=o.length-1;Be<ct;Be++,ct--){let bt=o[Be];o[Be]=o[ct],o[ct]=bt}}let l=17,c=Ce.sum(new Int32Array(o))/l,u=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(c-u)/u>.3)throw new M;let g=this.getOddCounts(),w=this.getEvenCounts(),m=this.getOddRoundingErrors(),C=this.getEvenRoundingErrors();for(let Be=0;Be<o.length;Be++){let ct=1*o[Be]/c,bt=ct+.5;if(bt<1){if(ct<.3)throw new M;bt=1}else if(bt>8){if(ct>8.7)throw new M;bt=8}let nr=Be/2;(Be&1)==0?(g[nr]=bt,m[nr]=ct-bt):(w[nr]=bt,C[nr]=ct-bt)}this.adjustOddEvenCounts(l);let b=4*t.getValue()+(n?0:2)+(i?0:1)-1,S=0,T=0;for(let Be=g.length-1;Be>=0;Be--){if(X.isNotA1left(t,n,i)){let ct=X.WEIGHTS[b][2*Be];T+=g[Be]*ct}S+=g[Be]}let D=0;for(let Be=w.length-1;Be>=0;Be--)if(X.isNotA1left(t,n,i)){let ct=X.WEIGHTS[b][2*Be+1];D+=w[Be]*ct}let F=T+D;if((S&1)!=0||S>13||S<4)throw new M;let Z=(13-S)/2,Q=X.SYMBOL_WIDEST[Z],j=9-Q,we=Zt.getRSSvalue(g,Q,!0),he=Zt.getRSSvalue(w,j,!1),mt=X.EVEN_TOTAL_SUBSET[Z],Gt=X.GSUM[Z],Ct=we*mt+he+Gt;return new Qn(Ct,F)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=Ce.sum(new Int32Array(this.getOddCounts())),n=Ce.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1;t>13?o=!0:t<4&&(i=!0);let l=!1,c=!1;n>13?c=!0:n<4&&(l=!0);let u=t+n-e,g=(t&1)==1,w=(n&1)==0;if(u==1)if(g){if(w)throw new M;o=!0}else{if(!w)throw new M;c=!0}else if(u==-1)if(g){if(w)throw new M;i=!0}else{if(!w)throw new M;l=!0}else if(u==0){if(g){if(!w)throw new M;t<n?(i=!0,c=!0):(o=!0,l=!0)}else if(w)throw new M}else throw new M;if(i){if(o)throw new M;X.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&X.decrement(this.getOddCounts(),this.getOddRoundingErrors()),l){if(c)throw new M;X.increment(this.getEvenCounts(),this.getOddRoundingErrors())}c&&X.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}X.SYMBOL_WIDEST=[7,5,4,3,1],X.EVEN_TOTAL_SUBSET=[4,20,52,104,204],X.GSUM=[0,348,1388,2948,3988],X.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],X.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],X.FINDER_PAT_A=0,X.FINDER_PAT_B=1,X.FINDER_PAT_C=2,X.FINDER_PAT_D=3,X.FINDER_PAT_E=4,X.FINDER_PAT_F=5,X.FINDER_PATTERN_SEQUENCES=[[X.FINDER_PAT_A,X.FINDER_PAT_A],[X.FINDER_PAT_A,X.FINDER_PAT_B,X.FINDER_PAT_B],[X.FINDER_PAT_A,X.FINDER_PAT_C,X.FINDER_PAT_B,X.FINDER_PAT_D],[X.FINDER_PAT_A,X.FINDER_PAT_E,X.FINDER_PAT_B,X.FINDER_PAT_D,X.FINDER_PAT_C],[X.FINDER_PAT_A,X.FINDER_PAT_E,X.FINDER_PAT_B,X.FINDER_PAT_D,X.FINDER_PAT_D,X.FINDER_PAT_F],[X.FINDER_PAT_A,X.FINDER_PAT_E,X.FINDER_PAT_B,X.FINDER_PAT_D,X.FINDER_PAT_E,X.FINDER_PAT_F,X.FINDER_PAT_F],[X.FINDER_PAT_A,X.FINDER_PAT_A,X.FINDER_PAT_B,X.FINDER_PAT_B,X.FINDER_PAT_C,X.FINDER_PAT_C,X.FINDER_PAT_D,X.FINDER_PAT_D],[X.FINDER_PAT_A,X.FINDER_PAT_A,X.FINDER_PAT_B,X.FINDER_PAT_B,X.FINDER_PAT_C,X.FINDER_PAT_C,X.FINDER_PAT_D,X.FINDER_PAT_E,X.FINDER_PAT_E],[X.FINDER_PAT_A,X.FINDER_PAT_A,X.FINDER_PAT_B,X.FINDER_PAT_B,X.FINDER_PAT_C,X.FINDER_PAT_C,X.FINDER_PAT_D,X.FINDER_PAT_E,X.FINDER_PAT_F,X.FINDER_PAT_F],[X.FINDER_PAT_A,X.FINDER_PAT_A,X.FINDER_PAT_B,X.FINDER_PAT_B,X.FINDER_PAT_C,X.FINDER_PAT_D,X.FINDER_PAT_D,X.FINDER_PAT_E,X.FINDER_PAT_E,X.FINDER_PAT_F,X.FINDER_PAT_F]],X.MAX_PAIRS=11;class O1 extends Qn{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class Ge extends ut{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){let i=this.decodePair(t,!1,e,n);Ge.addOrTally(this.possibleLeftPairs,i),t.reverse();let o=this.decodePair(t,!0,e,n);Ge.addOrTally(this.possibleRightPairs,o),t.reverse();for(let l of this.possibleLeftPairs)if(l.getCount()>1){for(let c of this.possibleRightPairs)if(c.getCount()>1&&Ge.checkChecksum(l,c))return Ge.constructResult(l,c)}throw new M}static addOrTally(e,t){if(t==null)return;let n=!1;for(let i of e)if(i.getValue()===t.getValue()){i.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),i=new String(n).toString(),o=new G;for(let g=13-i.length;g>0;g--)o.append("0");o.append(i);let l=0;for(let g=0;g<13;g++){let w=o.charAt(g).charCodeAt(0)-48;l+=(g&1)===0?3*w:w}l=10-l%10,l===10&&(l=0),o.append(l.toString());let c=e.getFinderPattern().getResultPoints(),u=t.getFinderPattern().getResultPoints();return new Ye(o.toString(),null,0,[c[0],c[1],u[0],u[1]],oe.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,i=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return i>72&&i--,i>8&&i--,n===i}decodePair(e,t,n,i){try{let o=this.findFinderPattern(e,t),l=this.parseFoundFinderPattern(e,n,t,o),c=i==null?null:i.get(z.NEED_RESULT_POINT_CALLBACK);if(c!=null){let w=(o[0]+o[1])/2;t&&(w=e.getSize()-1-w),c.foundPossibleResultPoint(new ie(w,n))}let u=this.decodeDataCharacter(e,l,!0),g=this.decodeDataCharacter(e,l,!1);return new O1(1597*u.getValue()+g.getValue(),u.getChecksumPortion()+4*g.getChecksumPortion(),l)}catch{return null}}decodeDataCharacter(e,t,n){let i=this.getDataCharacterCounters();for(let D=0;D<i.length;D++)i[D]=0;if(n)Ze.recordPatternInReverse(e,t.getStartEnd()[0],i);else{Ze.recordPattern(e,t.getStartEnd()[1]+1,i);for(let D=0,F=i.length-1;D<F;D++,F--){let Z=i[D];i[D]=i[F],i[F]=Z}}let o=n?16:15,l=Ce.sum(new Int32Array(i))/o,c=this.getOddCounts(),u=this.getEvenCounts(),g=this.getOddRoundingErrors(),w=this.getEvenRoundingErrors();for(let D=0;D<i.length;D++){let F=i[D]/l,Z=Math.floor(F+.5);Z<1?Z=1:Z>8&&(Z=8);let Q=Math.floor(D/2);(D&1)===0?(c[Q]=Z,g[Q]=F-Z):(u[Q]=Z,w[Q]=F-Z)}this.adjustOddEvenCounts(n,o);let m=0,C=0;for(let D=c.length-1;D>=0;D--)C*=9,C+=c[D],m+=c[D];let b=0,S=0;for(let D=u.length-1;D>=0;D--)b*=9,b+=u[D],S+=u[D];let T=C+3*b;if(n){if((m&1)!==0||m>12||m<4)throw new M;let D=(12-m)/2,F=Ge.OUTSIDE_ODD_WIDEST[D],Z=9-F,Q=Zt.getRSSvalue(c,F,!1),j=Zt.getRSSvalue(u,Z,!0),we=Ge.OUTSIDE_EVEN_TOTAL_SUBSET[D],he=Ge.OUTSIDE_GSUM[D];return new Qn(Q*we+j+he,T)}else{if((S&1)!==0||S>10||S<4)throw new M;let D=(10-S)/2,F=Ge.INSIDE_ODD_WIDEST[D],Z=9-F,Q=Zt.getRSSvalue(c,F,!0),j=Zt.getRSSvalue(u,Z,!1),we=Ge.INSIDE_ODD_TOTAL_SUBSET[D],he=Ge.INSIDE_GSUM[D];return new Qn(j*we+Q+he,T)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=!1,l=0;for(;l<i&&(o=!e.get(l),t!==o);)l++;let c=0,u=l;for(let g=l;g<i;g++)if(e.get(g)!==o)n[c]++;else{if(c===3){if(ut.isFinderPattern(n))return[u,g];u+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,c--}else c++;n[c]=1,o=!o}throw new M}parseFoundFinderPattern(e,t,n,i){let o=e.get(i[0]),l=i[0]-1;for(;l>=0&&o!==e.get(l);)l--;l++;let c=i[0]-l,u=this.getDecodeFinderCounters(),g=new Int32Array(u.length);N.arraycopy(u,0,g,1,u.length-1),g[0]=c;let w=this.parseFinderValue(g,Ge.FINDER_PATTERNS),m=l,C=i[1];return n&&(m=e.getSize()-1-m,C=e.getSize()-1-C),new xi(w,[l,i[1]],m,C,t)}adjustOddEvenCounts(e,t){let n=Ce.sum(new Int32Array(this.getOddCounts())),i=Ce.sum(new Int32Array(this.getEvenCounts())),o=!1,l=!1,c=!1,u=!1;e?(n>12?l=!0:n<4&&(o=!0),i>12?u=!0:i<4&&(c=!0)):(n>11?l=!0:n<5&&(o=!0),i>10?u=!0:i<4&&(c=!0));let g=n+i-t,w=(n&1)===(e?1:0),m=(i&1)===1;if(g===1)if(w){if(m)throw new M;l=!0}else{if(!m)throw new M;u=!0}else if(g===-1)if(w){if(m)throw new M;o=!0}else{if(!m)throw new M;c=!0}else if(g===0){if(w){if(!m)throw new M;n<i?(o=!0,u=!0):(l=!0,c=!0)}else if(m)throw new M}else throw new M;if(o){if(l)throw new M;ut.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&ut.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(u)throw new M;ut.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&&ut.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Ge.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Ge.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Ge.OUTSIDE_GSUM=[0,161,961,2015,2715],Ge.INSIDE_GSUM=[0,336,1036,1516],Ge.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Ge.INSIDE_ODD_WIDEST=[2,4,6,8],Ge.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class Jn extends Ze{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;let n=e?e.get(z.POSSIBLE_FORMATS):null,i=e&&e.get(z.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(oe.EAN_13)||n.includes(oe.UPC_A)||n.includes(oe.EAN_8)||n.includes(oe.UPC_E))&&this.readers.push(new fs(e)),n.includes(oe.CODE_39)&&this.readers.push(new Ke(i)),n.includes(oe.CODE_128)&&this.readers.push(new J),n.includes(oe.ITF)&&this.readers.push(new De),n.includes(oe.RSS_14)&&this.readers.push(new Ge),n.includes(oe.RSS_EXPANDED)&&this.readers.push(new X(this.verbose))):(this.readers.push(new fs(e)),this.readers.push(new Ke),this.readers.push(new fs(e)),this.readers.push(new J),this.readers.push(new De),this.readers.push(new Ge),this.readers.push(new X(this.verbose)))}decodeRow(e,t,n){for(let i=0;i<this.readers.length;i++)try{return this.readers[i].decodeRow(e,t,n)}catch{}throw new M}reset(){this.readers.forEach(e=>e.reset())}}class R1 extends Ht{constructor(e=500,t){super(new Jn(t),e,t)}}class Ne{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class be{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class pe{constructor(e,t,n,i,o,l){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=o,this.ecBlocks=l;let c=0,u=l.getECCodewords(),g=l.getECBlocks();for(let w of g)c+=w.getCount()*(w.getDataCodewords()+u);this.totalCodewords=c}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((e&1)!==0||(t&1)!==0)throw new L;for(let n of pe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new L}toString(){return""+this.versionNumber}static buildVersions(){return[new pe(1,10,10,8,8,new Ne(5,new be(1,3))),new pe(2,12,12,10,10,new Ne(7,new be(1,5))),new pe(3,14,14,12,12,new Ne(10,new be(1,8))),new pe(4,16,16,14,14,new Ne(12,new be(1,12))),new pe(5,18,18,16,16,new Ne(14,new be(1,18))),new pe(6,20,20,18,18,new Ne(18,new be(1,22))),new pe(7,22,22,20,20,new Ne(20,new be(1,30))),new pe(8,24,24,22,22,new Ne(24,new be(1,36))),new pe(9,26,26,24,24,new Ne(28,new be(1,44))),new pe(10,32,32,14,14,new Ne(36,new be(1,62))),new pe(11,36,36,16,16,new Ne(42,new be(1,86))),new pe(12,40,40,18,18,new Ne(48,new be(1,114))),new pe(13,44,44,20,20,new Ne(56,new be(1,144))),new pe(14,48,48,22,22,new Ne(68,new be(1,174))),new pe(15,52,52,24,24,new Ne(42,new be(2,102))),new pe(16,64,64,14,14,new Ne(56,new be(2,140))),new pe(17,72,72,16,16,new Ne(36,new be(4,92))),new pe(18,80,80,18,18,new Ne(48,new be(4,114))),new pe(19,88,88,20,20,new Ne(56,new be(4,144))),new pe(20,96,96,22,22,new Ne(68,new be(4,174))),new pe(21,104,104,24,24,new Ne(56,new be(6,136))),new pe(22,120,120,18,18,new Ne(68,new be(6,175))),new pe(23,132,132,20,20,new Ne(62,new be(8,163))),new pe(24,144,144,22,22,new Ne(62,new be(8,156),new be(2,155))),new pe(25,8,18,6,16,new Ne(7,new be(1,5))),new pe(26,8,32,6,14,new Ne(11,new be(1,10))),new pe(27,12,26,10,24,new Ne(14,new be(1,16))),new pe(28,12,36,10,16,new Ne(18,new be(1,22))),new pe(29,16,36,14,16,new Ne(24,new be(1,32))),new pe(30,16,48,14,22,new Ne(28,new be(1,49)))]}}pe.VERSIONS=pe.buildVersions();class gs{constructor(e){let t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new L;this.version=gs.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new $(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),n=e.getWidth();return pe.getVersionForDimensions(t,n)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,i=0,o=this.mappingBitMatrix.getHeight(),l=this.mappingBitMatrix.getWidth(),c=!1,u=!1,g=!1,w=!1;do if(n===o&&i===0&&!c)e[t++]=this.readCorner1(o,l)&255,n-=2,i+=2,c=!0;else if(n===o-2&&i===0&&(l&3)!==0&&!u)e[t++]=this.readCorner2(o,l)&255,n-=2,i+=2,u=!0;else if(n===o+4&&i===2&&(l&7)===0&&!g)e[t++]=this.readCorner3(o,l)&255,n-=2,i+=2,g=!0;else if(n===o-2&&i===0&&(l&7)===4&&!w)e[t++]=this.readCorner4(o,l)&255,n-=2,i+=2,w=!0;else{do n<o&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,o,l)&255),n-=2,i+=2;while(n>=0&&i<l);n+=1,i+=3;do n>=0&&i<l&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,o,l)&255),n+=2,i-=2;while(n<o&&i>=0);n+=3,i+=1}while(n<o||i<l);if(t!==this.version.getTotalCodewords())throw new L;return e}readModule(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,i){let o=0;return this.readModule(e-2,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e-2,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t,n,i)&&(o|=1),o<<=1,this.readModule(e,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e,t,n,i)&&(o|=1),o}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){let t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new x("Dimension of bitMatrix must match the version size");let i=this.version.getDataRegionSizeRows(),o=this.version.getDataRegionSizeColumns(),l=t/i|0,c=n/o|0,u=l*i,g=c*o,w=new $(g,u);for(let m=0;m<l;++m){let C=m*i;for(let b=0;b<c;++b){let S=b*o;for(let T=0;T<i;++T){let D=m*(i+2)+1+T,F=C+T;for(let Z=0;Z<o;++Z){let Q=b*(o+2)+1+Z;if(e.get(Q,D)){let j=S+Z;w.set(j,F)}}}}}return w}}class xs{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let n=t.getECBlocks(),i=0,o=n.getECBlocks();for(let T of o)i+=T.getCount();let l=new Array(i),c=0;for(let T of o)for(let D=0;D<T.getCount();D++){let F=T.getDataCodewords(),Z=n.getECCodewords()+F;l[c++]=new xs(F,new Uint8Array(Z))}let g=l[0].codewords.length-n.getECCodewords(),w=g-1,m=0;for(let T=0;T<w;T++)for(let D=0;D<c;D++)l[D].codewords[T]=e[m++];let C=t.getVersionNumber()===24,b=C?8:c;for(let T=0;T<b;T++)l[T].codewords[g-1]=e[m++];let S=l[0].codewords.length;for(let T=g;T<S;T++)for(let D=0;D<c;D++){let F=C?(D+8)%c:D,Z=C&&F>7?T-1:T;l[F].codewords[Z]=e[m++]}if(m!==e.length)throw new x;return l}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class ws{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new x(""+e);let t=0,n=this.bitOffset,i=this.byteOffset,o=this.bytes;if(n>0){let l=8-n,c=e<l?e:l,u=l-c,g=255>>8-c<<u;t=(o[i]&g)>>u,e-=c,n+=c,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|o[i]&255,i++,e-=8;if(e>0){let l=8-e,c=255>>l<<l;t=t<<e|(o[i]&c)>>l,n+=e}}return this.bitOffset=n,this.byteOffset=i,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var qe;(function(E){E[E.PAD_ENCODE=0]="PAD_ENCODE",E[E.ASCII_ENCODE=1]="ASCII_ENCODE",E[E.C40_ENCODE=2]="C40_ENCODE",E[E.TEXT_ENCODE=3]="TEXT_ENCODE",E[E.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",E[E.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",E[E.BASE256_ENCODE=6]="BASE256_ENCODE"})(qe||(qe={}));class gn{static decode(e){let t=new ws(e),n=new G,i=new G,o=new Array,l=qe.ASCII_ENCODE;do if(l===qe.ASCII_ENCODE)l=this.decodeAsciiSegment(t,n,i);else{switch(l){case qe.C40_ENCODE:this.decodeC40Segment(t,n);break;case qe.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case qe.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case qe.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case qe.BASE256_ENCODE:this.decodeBase256Segment(t,n,o);break;default:throw new L}l=qe.ASCII_ENCODE}while(l!==qe.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new _r(e,n.toString(),o.length===0?null:o,null)}static decodeAsciiSegment(e,t,n){let i=!1;do{let o=e.readBits(8);if(o===0)throw new L;if(o<=128)return i&&(o+=128),t.append(String.fromCharCode(o-1)),qe.ASCII_ENCODE;if(o===129)return qe.PAD_ENCODE;if(o<=229){let l=o-130;l<10&&t.append("0"),t.append(""+l)}else switch(o){case 230:return qe.C40_ENCODE;case 231:return qe.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return qe.ANSIX12_ENCODE;case 239:return qe.TEXT_ENCODE;case 240:return qe.EDIFACT_ENCODE;case 241:break;default:if(o!==254||e.available()!==0)throw new L;break}}while(e.available()>0);return qe.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1,i=[],o=0;do{if(e.available()===8)return;let l=e.readBits(8);if(l===254)return;this.parseTwoBytes(l,e.readBits(8),i);for(let c=0;c<3;c++){let u=i[c];switch(o){case 0:if(u<3)o=u+1;else if(u<this.C40_BASIC_SET_CHARS.length){let g=this.C40_BASIC_SET_CHARS[u];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else throw new L;break;case 1:n?(t.append(String.fromCharCode(u+128)),n=!1):t.append(String.fromCharCode(u)),o=0;break;case 2:if(u<this.C40_SHIFT2_SET_CHARS.length){let g=this.C40_SHIFT2_SET_CHARS[u];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else switch(u){case 27:t.append("");break;case 30:n=!0;break;default:throw new L}o=0;break;case 3:n?(t.append(String.fromCharCode(u+224)),n=!1):t.append(String.fromCharCode(u+96)),o=0;break;default:throw new L}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,i=[],o=0;do{if(e.available()===8)return;let l=e.readBits(8);if(l===254)return;this.parseTwoBytes(l,e.readBits(8),i);for(let c=0;c<3;c++){let u=i[c];switch(o){case 0:if(u<3)o=u+1;else if(u<this.TEXT_BASIC_SET_CHARS.length){let g=this.TEXT_BASIC_SET_CHARS[u];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else throw new L;break;case 1:n?(t.append(String.fromCharCode(u+128)),n=!1):t.append(String.fromCharCode(u)),o=0;break;case 2:if(u<this.TEXT_SHIFT2_SET_CHARS.length){let g=this.TEXT_SHIFT2_SET_CHARS[u];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else switch(u){case 27:t.append("");break;case 30:n=!0;break;default:throw new L}o=0;break;case 3:if(u<this.TEXT_SHIFT3_SET_CHARS.length){let g=this.TEXT_SHIFT3_SET_CHARS[u];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g),o=0}else throw new L;break;default:throw new L}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let n=[];do{if(e.available()===8)return;let i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(let o=0;o<3;o++){let l=n[o];switch(l){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(l<14)t.append(String.fromCharCode(l+44));else if(l<40)t.append(String.fromCharCode(l+51));else throw new L;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let i=(e<<8)+t-1,o=Math.floor(i/1600);n[0]=o,i-=o*1600,o=Math.floor(i/40),n[1]=o,n[2]=i-o*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let i=e.readBits(6);if(i===31){let o=8-e.getBitOffset();o!==8&&e.readBits(o);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let i=1+e.getByteOffset(),o=this.unrandomize255State(e.readBits(8),i++),l;if(o===0?l=e.available()/8|0:o<250?l=o:l=250*(o-249)+this.unrandomize255State(e.readBits(8),i++),l<0)throw new L;let c=new Uint8Array(l);for(let u=0;u<l;u++){if(e.available()<8)throw new L;c[u]=this.unrandomize255State(e.readBits(8),i++)}n.push(c);try{t.append(re.decode(c,k.ISO88591))}catch(u){throw new Wt("Platform does not support required encoding: "+u.message)}}static unrandomize255State(e,t){let n=149*t%255+1,i=e-n;return i>=0?i:i+256}}gn.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],gn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],gn.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],gn.TEXT_SHIFT2_SET_CHARS=gn.C40_SHIFT2_SET_CHARS,gn.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~","\x7F"];class D1{constructor(){this.rsDecoder=new Ir(ye.DATA_MATRIX_FIELD_256)}decode(e){let t=new gs(e),n=t.getVersion(),i=t.readCodewords(),o=xs.getDataBlocks(i,n),l=0;for(let g of o)l+=g.getNumDataCodewords();let c=new Uint8Array(l),u=o.length;for(let g=0;g<u;g++){let w=o[g],m=w.getCodewords(),C=w.getNumDataCodewords();this.correctErrors(m,C);for(let b=0;b<C;b++)c[b*u+g]=m[b]}return gn.decode(c)}correctErrors(e,t){let n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new v}for(let i=0;i<t;i++)e[i]=n[i]}}class We{constructor(e){this.image=e,this.rectangleDetector=new on(this.image)}detect(){let e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new M;t=this.shiftToModuleCenter(t);let n=t[0],i=t[1],o=t[2],l=t[3],c=this.transitionsBetween(n,l)+1,u=this.transitionsBetween(o,l)+1;(c&1)===1&&(c+=1),(u&1)===1&&(u+=1),4*c<7*u&&4*u<7*c&&(c=u=Math.max(c,u));let g=We.sampleGrid(this.image,n,i,o,l,c,u);return new di(g,[n,i,o,l])}static shiftPoint(e,t,n){let i=(t.getX()-e.getX())/(n+1),o=(t.getY()-e.getY())/(n+1);return new ie(e.getX()+i,e.getY()+o)}static moveAway(e,t,n){let i=e.getX(),o=e.getY();return i<t?i-=1:i+=1,o<n?o-=1:o+=1,new ie(i,o)}detectSolid1(e){let t=e[0],n=e[1],i=e[3],o=e[2],l=this.transitionsBetween(t,n),c=this.transitionsBetween(n,i),u=this.transitionsBetween(i,o),g=this.transitionsBetween(o,t),w=l,m=[o,t,n,i];return w>c&&(w=c,m[0]=t,m[1]=n,m[2]=i,m[3]=o),w>u&&(w=u,m[0]=n,m[1]=i,m[2]=o,m[3]=t),w>g&&(m[0]=i,m[1]=o,m[2]=t,m[3]=n),m}detectSolid2(e){let t=e[0],n=e[1],i=e[2],o=e[3],l=this.transitionsBetween(t,o),c=We.shiftPoint(n,i,(l+1)*4),u=We.shiftPoint(i,n,(l+1)*4),g=this.transitionsBetween(c,t),w=this.transitionsBetween(u,o);return g<w?(e[0]=t,e[1]=n,e[2]=i,e[3]=o):(e[0]=n,e[1]=i,e[2]=o,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],i=e[2],o=e[3],l=this.transitionsBetween(t,o),c=this.transitionsBetween(n,o),u=We.shiftPoint(t,n,(c+1)*4),g=We.shiftPoint(i,n,(l+1)*4);l=this.transitionsBetween(u,o),c=this.transitionsBetween(g,o);let w=new ie(o.getX()+(i.getX()-n.getX())/(l+1),o.getY()+(i.getY()-n.getY())/(l+1)),m=new ie(o.getX()+(t.getX()-n.getX())/(c+1),o.getY()+(t.getY()-n.getY())/(c+1));if(!this.isValid(w))return this.isValid(m)?m:null;if(!this.isValid(m))return w;let C=this.transitionsBetween(u,w)+this.transitionsBetween(g,w),b=this.transitionsBetween(u,m)+this.transitionsBetween(g,m);return C>b?w:m}shiftToModuleCenter(e){let t=e[0],n=e[1],i=e[2],o=e[3],l=this.transitionsBetween(t,o)+1,c=this.transitionsBetween(i,o)+1,u=We.shiftPoint(t,n,c*4),g=We.shiftPoint(i,n,l*4);l=this.transitionsBetween(u,o)+1,c=this.transitionsBetween(g,o)+1,(l&1)===1&&(l+=1),(c&1)===1&&(c+=1);let w=(t.getX()+n.getX()+i.getX()+o.getX())/4,m=(t.getY()+n.getY()+i.getY()+o.getY())/4;t=We.moveAway(t,w,m),n=We.moveAway(n,w,m),i=We.moveAway(i,w,m),o=We.moveAway(o,w,m);let C,b;return u=We.shiftPoint(t,n,c*4),u=We.shiftPoint(u,o,l*4),C=We.shiftPoint(n,t,c*4),C=We.shiftPoint(C,i,l*4),g=We.shiftPoint(i,o,c*4),g=We.shiftPoint(g,n,l*4),b=We.shiftPoint(o,i,c*4),b=We.shiftPoint(b,t,l*4),[u,C,g,b]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,i,o,l,c){return hn.getInstance().sampleGrid(e,l,c,.5,.5,l-.5,.5,l-.5,c-.5,.5,c-.5,t.getX(),t.getY(),o.getX(),o.getY(),i.getX(),i.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),o=Math.trunc(t.getX()),l=Math.trunc(t.getY()),c=Math.abs(l-i)>Math.abs(o-n);if(c){let T=n;n=i,i=T,T=o,o=l,l=T}let u=Math.abs(o-n),g=Math.abs(l-i),w=-u/2,m=i<l?1:-1,C=n<o?1:-1,b=0,S=this.image.get(c?i:n,c?n:i);for(let T=n,D=i;T!==o;T+=C){let F=this.image.get(c?D:T,c?T:D);if(F!==S&&(b++,S=F),w+=g,w>0){if(D===l)break;D+=m,w-=u}}return b}}class xn{constructor(){this.decoder=new D1}decode(e,t=null){let n,i;if(t!=null&&t.has(z.PURE_BARCODE)){let g=xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(g),i=xn.NO_POINTS}else{let g=new We(e.getBlackMatrix()).detect();n=this.decoder.decode(g.getBits()),i=g.getPoints()}let o=n.getRawBytes(),l=new Ye(n.getText(),o,8*o.length,i,oe.DATA_MATRIX,N.currentTimeMillis()),c=n.getByteSegments();c!=null&&l.putMetadata(et.BYTE_SEGMENTS,c);let u=n.getECLevel();return u!=null&&l.putMetadata(et.ERROR_CORRECTION_LEVEL,u),l}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new M;let i=this.moduleSize(t,e),o=t[1],l=n[1],c=t[0],g=(n[0]-c+1)/i,w=(l-o+1)/i;if(g<=0||w<=0)throw new M;let m=i/2;o+=m,c+=m;let C=new $(g,w);for(let b=0;b<w;b++){let S=o+b*i;for(let T=0;T<g;T++)e.get(c+T*i,S)&&C.set(T,b)}return C}static moduleSize(e,t){let n=t.getWidth(),i=e[0],o=e[1];for(;i<n&&t.get(i,o);)i++;if(i===n)throw new M;let l=i-e[0];if(l===0)throw new M;return l}}xn.NO_POINTS=[];class v1 extends Ht{constructor(e=500){super(new xn,e)}}var $n;(function(E){E[E.L=0]="L",E[E.M=1]="M",E[E.Q=2]="Q",E[E.H=3]="H"})($n||($n={}));class ke{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ke.FOR_BITS.set(n,this),ke.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ke.L;case"M":return ke.M;case"Q":return ke.Q;case"H":return ke.H;default:throw new y(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ke))return!1;let t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ke.FOR_BITS.size)throw new x;return ke.FOR_BITS.get(e)}}ke.FOR_BITS=new Map,ke.FOR_VALUE=new Map,ke.L=new ke($n.L,"L",1),ke.M=new ke($n.M,"M",0),ke.Q=new ke($n.Q,"Q",3),ke.H=new ke($n.H,"H",2);class ht{constructor(e){this.errorCorrectionLevel=ke.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return U.bitCount(e^t)}static decodeFormatInformation(e,t){let n=ht.doDecodeFormatInformation(e,t);return n!==null?n:ht.doDecodeFormatInformation(e^ht.FORMAT_INFO_MASK_QR,t^ht.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,i=0;for(let o of ht.FORMAT_INFO_DECODE_LOOKUP){let l=o[0];if(l===e||l===t)return new ht(o[1]);let c=ht.numBitsDiffering(e,l);c<n&&(i=o[1],n=c),e!==t&&(c=ht.numBitsDiffering(t,l),c<n&&(i=o[1],n=c))}return n<=3?new ht(i):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof ht))return!1;let t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}ht.FORMAT_INFO_MASK_QR=21522,ht.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class B{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0,t=this.ecBlocks;for(let n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class I{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class se{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let i=0,o=n[0].getECCodewordsPerBlock(),l=n[0].getECBlocks();for(let c of l)i+=c.getCount()*(c.getDataCodewords()+o);this.totalCodewords=i}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!==1)throw new L;try{return this.getVersionForNumber((e-17)/4)}catch{throw new L}}static getVersionForNumber(e){if(e<1||e>40)throw new x;return se.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let i=0;i<se.VERSION_DECODE_INFO.length;i++){let o=se.VERSION_DECODE_INFO[i];if(o===e)return se.getVersionForNumber(i+7);let l=ht.numBitsDiffering(e,o);l<t&&(n=i+7,t=l)}return t<=3?se.getVersionForNumber(n):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new $(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);let n=this.alignmentPatternCenters.length;for(let i=0;i<n;i++){let o=this.alignmentPatternCenters[i]-2;for(let l=0;l<n;l++)i===0&&(l===0||l===n-1)||i===n-1&&l===0||t.setRegion(this.alignmentPatternCenters[l]-2,o,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}se.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),se.VERSIONS=[new se(1,new Int32Array(0),new B(7,new I(1,19)),new B(10,new I(1,16)),new B(13,new I(1,13)),new B(17,new I(1,9))),new se(2,Int32Array.from([6,18]),new B(10,new I(1,34)),new B(16,new I(1,28)),new B(22,new I(1,22)),new B(28,new I(1,16))),new se(3,Int32Array.from([6,22]),new B(15,new I(1,55)),new B(26,new I(1,44)),new B(18,new I(2,17)),new B(22,new I(2,13))),new se(4,Int32Array.from([6,26]),new B(20,new I(1,80)),new B(18,new I(2,32)),new B(26,new I(2,24)),new B(16,new I(4,9))),new se(5,Int32Array.from([6,30]),new B(26,new I(1,108)),new B(24,new I(2,43)),new B(18,new I(2,15),new I(2,16)),new B(22,new I(2,11),new I(2,12))),new se(6,Int32Array.from([6,34]),new B(18,new I(2,68)),new B(16,new I(4,27)),new B(24,new I(4,19)),new B(28,new I(4,15))),new se(7,Int32Array.from([6,22,38]),new B(20,new I(2,78)),new B(18,new I(4,31)),new B(18,new I(2,14),new I(4,15)),new B(26,new I(4,13),new I(1,14))),new se(8,Int32Array.from([6,24,42]),new B(24,new I(2,97)),new B(22,new I(2,38),new I(2,39)),new B(22,new I(4,18),new I(2,19)),new B(26,new I(4,14),new I(2,15))),new se(9,Int32Array.from([6,26,46]),new B(30,new I(2,116)),new B(22,new I(3,36),new I(2,37)),new B(20,new I(4,16),new I(4,17)),new B(24,new I(4,12),new I(4,13))),new se(10,Int32Array.from([6,28,50]),new B(18,new I(2,68),new I(2,69)),new B(26,new I(4,43),new I(1,44)),new B(24,new I(6,19),new I(2,20)),new B(28,new I(6,15),new I(2,16))),new se(11,Int32Array.from([6,30,54]),new B(20,new I(4,81)),new B(30,new I(1,50),new I(4,51)),new B(28,new I(4,22),new I(4,23)),new B(24,new I(3,12),new I(8,13))),new se(12,Int32Array.from([6,32,58]),new B(24,new I(2,92),new I(2,93)),new B(22,new I(6,36),new I(2,37)),new B(26,new I(4,20),new I(6,21)),new B(28,new I(7,14),new I(4,15))),new se(13,Int32Array.from([6,34,62]),new B(26,new I(4,107)),new B(22,new I(8,37),new I(1,38)),new B(24,new I(8,20),new I(4,21)),new B(22,new I(12,11),new I(4,12))),new se(14,Int32Array.from([6,26,46,66]),new B(30,new I(3,115),new I(1,116)),new B(24,new I(4,40),new I(5,41)),new B(20,new I(11,16),new I(5,17)),new B(24,new I(11,12),new I(5,13))),new se(15,Int32Array.from([6,26,48,70]),new B(22,new I(5,87),new I(1,88)),new B(24,new I(5,41),new I(5,42)),new B(30,new I(5,24),new I(7,25)),new B(24,new I(11,12),new I(7,13))),new se(16,Int32Array.from([6,26,50,74]),new B(24,new I(5,98),new I(1,99)),new B(28,new I(7,45),new I(3,46)),new B(24,new I(15,19),new I(2,20)),new B(30,new I(3,15),new I(13,16))),new se(17,Int32Array.from([6,30,54,78]),new B(28,new I(1,107),new I(5,108)),new B(28,new I(10,46),new I(1,47)),new B(28,new I(1,22),new I(15,23)),new B(28,new I(2,14),new I(17,15))),new se(18,Int32Array.from([6,30,56,82]),new B(30,new I(5,120),new I(1,121)),new B(26,new I(9,43),new I(4,44)),new B(28,new I(17,22),new I(1,23)),new B(28,new I(2,14),new I(19,15))),new se(19,Int32Array.from([6,30,58,86]),new B(28,new I(3,113),new I(4,114)),new B(26,new I(3,44),new I(11,45)),new B(26,new I(17,21),new I(4,22)),new B(26,new I(9,13),new I(16,14))),new se(20,Int32Array.from([6,34,62,90]),new B(28,new I(3,107),new I(5,108)),new B(26,new I(3,41),new I(13,42)),new B(30,new I(15,24),new I(5,25)),new B(28,new I(15,15),new I(10,16))),new se(21,Int32Array.from([6,28,50,72,94]),new B(28,new I(4,116),new I(4,117)),new B(26,new I(17,42)),new B(28,new I(17,22),new I(6,23)),new B(30,new I(19,16),new I(6,17))),new se(22,Int32Array.from([6,26,50,74,98]),new B(28,new I(2,111),new I(7,112)),new B(28,new I(17,46)),new B(30,new I(7,24),new I(16,25)),new B(24,new I(34,13))),new se(23,Int32Array.from([6,30,54,78,102]),new B(30,new I(4,121),new I(5,122)),new B(28,new I(4,47),new I(14,48)),new B(30,new I(11,24),new I(14,25)),new B(30,new I(16,15),new I(14,16))),new se(24,Int32Array.from([6,28,54,80,106]),new B(30,new I(6,117),new I(4,118)),new B(28,new I(6,45),new I(14,46)),new B(30,new I(11,24),new I(16,25)),new B(30,new I(30,16),new I(2,17))),new se(25,Int32Array.from([6,32,58,84,110]),new B(26,new I(8,106),new I(4,107)),new B(28,new I(8,47),new I(13,48)),new B(30,new I(7,24),new I(22,25)),new B(30,new I(22,15),new I(13,16))),new se(26,Int32Array.from([6,30,58,86,114]),new B(28,new I(10,114),new I(2,115)),new B(28,new I(19,46),new I(4,47)),new B(28,new I(28,22),new I(6,23)),new B(30,new I(33,16),new I(4,17))),new se(27,Int32Array.from([6,34,62,90,118]),new B(30,new I(8,122),new I(4,123)),new B(28,new I(22,45),new I(3,46)),new B(30,new I(8,23),new I(26,24)),new B(30,new I(12,15),new I(28,16))),new se(28,Int32Array.from([6,26,50,74,98,122]),new B(30,new I(3,117),new I(10,118)),new B(28,new I(3,45),new I(23,46)),new B(30,new I(4,24),new I(31,25)),new B(30,new I(11,15),new I(31,16))),new se(29,Int32Array.from([6,30,54,78,102,126]),new B(30,new I(7,116),new I(7,117)),new B(28,new I(21,45),new I(7,46)),new B(30,new I(1,23),new I(37,24)),new B(30,new I(19,15),new I(26,16))),new se(30,Int32Array.from([6,26,52,78,104,130]),new B(30,new I(5,115),new I(10,116)),new B(28,new I(19,47),new I(10,48)),new B(30,new I(15,24),new I(25,25)),new B(30,new I(23,15),new I(25,16))),new se(31,Int32Array.from([6,30,56,82,108,134]),new B(30,new I(13,115),new I(3,116)),new B(28,new I(2,46),new I(29,47)),new B(30,new I(42,24),new I(1,25)),new B(30,new I(23,15),new I(28,16))),new se(32,Int32Array.from([6,34,60,86,112,138]),new B(30,new I(17,115)),new B(28,new I(10,46),new I(23,47)),new B(30,new I(10,24),new I(35,25)),new B(30,new I(19,15),new I(35,16))),new se(33,Int32Array.from([6,30,58,86,114,142]),new B(30,new I(17,115),new I(1,116)),new B(28,new I(14,46),new I(21,47)),new B(30,new I(29,24),new I(19,25)),new B(30,new I(11,15),new I(46,16))),new se(34,Int32Array.from([6,34,62,90,118,146]),new B(30,new I(13,115),new I(6,116)),new B(28,new I(14,46),new I(23,47)),new B(30,new I(44,24),new I(7,25)),new B(30,new I(59,16),new I(1,17))),new se(35,Int32Array.from([6,30,54,78,102,126,150]),new B(30,new I(12,121),new I(7,122)),new B(28,new I(12,47),new I(26,48)),new B(30,new I(39,24),new I(14,25)),new B(30,new I(22,15),new I(41,16))),new se(36,Int32Array.from([6,24,50,76,102,128,154]),new B(30,new I(6,121),new I(14,122)),new B(28,new I(6,47),new I(34,48)),new B(30,new I(46,24),new I(10,25)),new B(30,new I(2,15),new I(64,16))),new se(37,Int32Array.from([6,28,54,80,106,132,158]),new B(30,new I(17,122),new I(4,123)),new B(28,new I(29,46),new I(14,47)),new B(30,new I(49,24),new I(10,25)),new B(30,new I(24,15),new I(46,16))),new se(38,Int32Array.from([6,32,58,84,110,136,162]),new B(30,new I(4,122),new I(18,123)),new B(28,new I(13,46),new I(32,47)),new B(30,new I(48,24),new I(14,25)),new B(30,new I(42,15),new I(32,16))),new se(39,Int32Array.from([6,26,54,82,110,138,166]),new B(30,new I(20,117),new I(4,118)),new B(28,new I(40,47),new I(7,48)),new B(30,new I(43,24),new I(22,25)),new B(30,new I(10,15),new I(67,16))),new se(40,Int32Array.from([6,30,58,86,114,142,170]),new B(30,new I(19,118),new I(6,119)),new B(28,new I(18,47),new I(31,48)),new B(30,new I(34,24),new I(34,25)),new B(30,new I(20,15),new I(61,16)))];var tt;(function(E){E[E.DATA_MASK_000=0]="DATA_MASK_000",E[E.DATA_MASK_001=1]="DATA_MASK_001",E[E.DATA_MASK_010=2]="DATA_MASK_010",E[E.DATA_MASK_011=3]="DATA_MASK_011",E[E.DATA_MASK_100=4]="DATA_MASK_100",E[E.DATA_MASK_101=5]="DATA_MASK_101",E[E.DATA_MASK_110=6]="DATA_MASK_110",E[E.DATA_MASK_111=7]="DATA_MASK_111"})(tt||(tt={}));class Dt{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)}}Dt.values=new Map([[tt.DATA_MASK_000,new Dt(tt.DATA_MASK_000,(E,e)=>(E+e&1)===0)],[tt.DATA_MASK_001,new Dt(tt.DATA_MASK_001,(E,e)=>(E&1)===0)],[tt.DATA_MASK_010,new Dt(tt.DATA_MASK_010,(E,e)=>e%3===0)],[tt.DATA_MASK_011,new Dt(tt.DATA_MASK_011,(E,e)=>(E+e)%3===0)],[tt.DATA_MASK_100,new Dt(tt.DATA_MASK_100,(E,e)=>(Math.floor(E/2)+Math.floor(e/3)&1)===0)],[tt.DATA_MASK_101,new Dt(tt.DATA_MASK_101,(E,e)=>E*e%6===0)],[tt.DATA_MASK_110,new Dt(tt.DATA_MASK_110,(E,e)=>E*e%6<3)],[tt.DATA_MASK_111,new Dt(tt.DATA_MASK_111,(E,e)=>(E+e+E*e%3&1)===0)]]);class B1{constructor(e){let t=e.getHeight();if(t<21||(t&3)!==1)throw new L;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let o=0;o<6;o++)e=this.copyBit(o,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let o=5;o>=0;o--)e=this.copyBit(8,o,e);let t=this.bitMatrix.getHeight(),n=0,i=t-7;for(let o=t-1;o>=i;o--)n=this.copyBit(8,o,n);for(let o=t-8;o<t;o++)n=this.copyBit(o,8,n);if(this.parsedFormatInfo=ht.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new L}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;let e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return se.getVersionForNumber(t);let n=0,i=e-11;for(let l=5;l>=0;l--)for(let c=e-9;c>=i;c--)n=this.copyBit(c,l,n);let o=se.decodeVersionInformation(n);if(o!==null&&o.getDimensionForVersion()===e)return this.parsedVersion=o,o;n=0;for(let l=5;l>=0;l--)for(let c=e-9;c>=i;c--)n=this.copyBit(l,c,n);if(o=se.decodeVersionInformation(n),o!==null&&o.getDimensionForVersion()===e)return this.parsedVersion=o,o;throw new L}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){let e=this.readFormatInformation(),t=this.readVersion(),n=Dt.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);let o=t.buildFunctionPattern(),l=!0,c=new Uint8Array(t.getTotalCodewords()),u=0,g=0,w=0;for(let m=i-1;m>0;m-=2){m===6&&m--;for(let C=0;C<i;C++){let b=l?i-1-C:C;for(let S=0;S<2;S++)o.get(m-S,b)||(w++,g<<=1,this.bitMatrix.get(m-S,b)&&(g|=1),w===8&&(c[u++]=g,w=0,g=0))}l=!l}if(u!==t.getTotalCodewords())throw new L;return c}remask(){if(this.parsedFormatInfo===null)return;let e=Dt.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){let e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let i=t+1,o=e.getHeight();i<o;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))}}class ps{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new x;let i=t.getECBlocksForLevel(n),o=0,l=i.getECBlocks();for(let S of l)o+=S.getCount();let c=new Array(o),u=0;for(let S of l)for(let T=0;T<S.getCount();T++){let D=S.getDataCodewords(),F=i.getECCodewordsPerBlock()+D;c[u++]=new ps(D,new Uint8Array(F))}let g=c[0].codewords.length,w=c.length-1;for(;w>=0&&c[w].codewords.length!==g;)w--;w++;let m=g-i.getECCodewordsPerBlock(),C=0;for(let S=0;S<m;S++)for(let T=0;T<u;T++)c[T].codewords[S]=e[C++];for(let S=w;S<u;S++)c[S].codewords[m]=e[C++];let b=c[0].codewords.length;for(let S=m;S<b;S++)for(let T=0;T<u;T++){let D=T<w?S:S+1;c[T].codewords[D]=e[C++]}return c}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var vt;(function(E){E[E.TERMINATOR=0]="TERMINATOR",E[E.NUMERIC=1]="NUMERIC",E[E.ALPHANUMERIC=2]="ALPHANUMERIC",E[E.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",E[E.BYTE=4]="BYTE",E[E.ECI=5]="ECI",E[E.KANJI=6]="KANJI",E[E.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",E[E.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",E[E.HANZI=9]="HANZI"})(vt||(vt={}));class ae{constructor(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,ae.FOR_BITS.set(i,this),ae.FOR_VALUE.set(e,this)}static forBits(e){let t=ae.FOR_BITS.get(e);if(t===void 0)throw new x;return t}getCharacterCountBits(e){let t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof ae))return!1;let t=e;return this.value===t.value}toString(){return this.stringValue}}ae.FOR_BITS=new Map,ae.FOR_VALUE=new Map,ae.TERMINATOR=new ae(vt.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ae.NUMERIC=new ae(vt.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ae.ALPHANUMERIC=new ae(vt.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ae.STRUCTURED_APPEND=new ae(vt.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ae.BYTE=new ae(vt.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ae.ECI=new ae(vt.ECI,"ECI",Int32Array.from([0,0,0]),7),ae.KANJI=new ae(vt.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ae.FNC1_FIRST_POSITION=new ae(vt.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ae.FNC1_SECOND_POSITION=new ae(vt.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ae.HANZI=new ae(vt.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Ve{static decode(e,t,n,i){let o=new ws(e),l=new G,c=new Array,u=-1,g=-1;try{let w=null,m=!1,C;do{if(o.available()<4)C=ae.TERMINATOR;else{let b=o.readBits(4);C=ae.forBits(b)}switch(C){case ae.TERMINATOR:break;case ae.FNC1_FIRST_POSITION:case ae.FNC1_SECOND_POSITION:m=!0;break;case ae.STRUCTURED_APPEND:if(o.available()<16)throw new L;u=o.readBits(8),g=o.readBits(8);break;case ae.ECI:let b=Ve.parseECIValue(o);if(w=O.getCharacterSetECIByValue(b),w===null)throw new L;break;case ae.HANZI:let S=o.readBits(4),T=o.readBits(C.getCharacterCountBits(t));S===Ve.GB2312_SUBSET&&Ve.decodeHanziSegment(o,l,T);break;default:let D=o.readBits(C.getCharacterCountBits(t));switch(C){case ae.NUMERIC:Ve.decodeNumericSegment(o,l,D);break;case ae.ALPHANUMERIC:Ve.decodeAlphanumericSegment(o,l,D,m);break;case ae.BYTE:Ve.decodeByteSegment(o,l,D,w,c,i);break;case ae.KANJI:Ve.decodeKanjiSegment(o,l,D);break;default:throw new L}break}}while(C!==ae.TERMINATOR)}catch{throw new L}return new _r(e,l.toString(),c.length===0?null:c,n===null?null:n.toString(),u,g)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new L;let i=new Uint8Array(2*n),o=0;for(;n>0;){let l=e.readBits(13),c=l/96<<8&4294967295|l%96;c<959?c+=41377:c+=42657,i[o]=c>>8&255,i[o+1]=c&255,o+=2,n--}try{t.append(re.decode(i,k.GB2312))}catch(l){throw new L(l)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new L;let i=new Uint8Array(2*n),o=0;for(;n>0;){let l=e.readBits(13),c=l/192<<8&4294967295|l%192;c<7936?c+=33088:c+=49472,i[o]=c>>8,i[o+1]=c,o+=2,n--}try{t.append(re.decode(i,k.SHIFT_JIS))}catch(l){throw new L(l)}}static decodeByteSegment(e,t,n,i,o,l){if(8*n>e.available())throw new L;let c=new Uint8Array(n);for(let g=0;g<n;g++)c[g]=e.readBits(8);let u;i===null?u=k.guessEncoding(c,l):u=i.getName();try{t.append(re.decode(c,u))}catch(g){throw new L(g)}o.push(c)}static toAlphaNumericChar(e){if(e>=Ve.ALPHANUMERIC_CHARS.length)throw new L;return Ve.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,i){let o=t.length();for(;n>1;){if(e.available()<11)throw new L;let l=e.readBits(11);t.append(Ve.toAlphaNumericChar(Math.floor(l/45))),t.append(Ve.toAlphaNumericChar(l%45)),n-=2}if(n===1){if(e.available()<6)throw new L;t.append(Ve.toAlphaNumericChar(e.readBits(6)))}if(i)for(let l=o;l<t.length();l++)t.charAt(l)==="%"&&(l<t.length()-1&&t.charAt(l+1)==="%"?t.deleteCharAt(l+1):t.setCharAt(l,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new L;let i=e.readBits(10);if(i>=1e3)throw new L;t.append(Ve.toAlphaNumericChar(Math.floor(i/100))),t.append(Ve.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(Ve.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new L;let i=e.readBits(7);if(i>=100)throw new L;t.append(Ve.toAlphaNumericChar(Math.floor(i/10))),t.append(Ve.toAlphaNumericChar(i%10))}else if(n===1){if(e.available()<4)throw new L;let i=e.readBits(4);if(i>=10)throw new L;t.append(Ve.toAlphaNumericChar(i))}}static parseECIValue(e){let t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){let n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){let n=e.readBits(16);return(t&31)<<16&4294967295|n}throw new L}}Ve.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ve.GB2312_SUBSET=1;class Ko{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||e===null||e.length<3)return;let t=e[0];e[0]=e[2],e[2]=t}}class L1{constructor(){this.rsDecoder=new Ir(ye.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix($.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let n=new B1(e),i=null;try{return this.decodeBitMatrixParser(n,t)}catch(o){i=o}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();let o=this.decodeBitMatrixParser(n,t);return o.setOther(new Ko(!0)),o}catch(o){throw i!==null?i:o}}decodeBitMatrixParser(e,t){let n=e.readVersion(),i=e.readFormatInformation().getErrorCorrectionLevel(),o=e.readCodewords(),l=ps.getDataBlocks(o,n,i),c=0;for(let w of l)c+=w.getNumDataCodewords();let u=new Uint8Array(c),g=0;for(let w of l){let m=w.getCodewords(),C=w.getNumDataCodewords();this.correctErrors(m,C);for(let b=0;b<C;b++)u[g++]=m[b]}return Ve.decode(u,n,i,t)}correctErrors(e,t){let n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new v}for(let i=0;i<t;i++)e[i]=n[i]}}class As extends ie{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){let i=Math.abs(e-this.estimatedModuleSize);return i<=1||i<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){let i=(this.getX()+t)/2,o=(this.getY()+e)/2,l=(this.estimatedModuleSize+n)/2;return new As(i,o,l)}}class Ai{constructor(e,t,n,i,o,l,c){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=o,this.moduleSize=l,this.resultPointCallback=c,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,n=this.width,i=e+n,o=this.startY+t/2,l=new Int32Array(3),c=this.image;for(let u=0;u<t;u++){let g=o+((u&1)===0?Math.floor((u+1)/2):-Math.floor((u+1)/2));l[0]=0,l[1]=0,l[2]=0;let w=e;for(;w<i&&!c.get(w,g);)w++;let m=0;for(;w<i;){if(c.get(w,g))if(m===1)l[1]++;else if(m===2){if(this.foundPatternCross(l)){let C=this.handlePossibleCenter(l,g,w);if(C!==null)return C}l[0]=l[2],l[1]=1,l[2]=0,m=1}else l[++m]++;else m===1&&m++,l[m]++;w++}if(this.foundPatternCross(l)){let C=this.handlePossibleCenter(l,g,i);if(C!==null)return C}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new M}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,n=t/2;for(let i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0}crossCheckVertical(e,t,n,i){let o=this.image,l=o.getHeight(),c=this.crossCheckStateCount;c[0]=0,c[1]=0,c[2]=0;let u=e;for(;u>=0&&o.get(t,u)&&c[1]<=n;)c[1]++,u--;if(u<0||c[1]>n)return NaN;for(;u>=0&&!o.get(t,u)&&c[0]<=n;)c[0]++,u--;if(c[0]>n)return NaN;for(u=e+1;u<l&&o.get(t,u)&&c[1]<=n;)c[1]++,u++;if(u===l||c[1]>n)return NaN;for(;u<l&&!o.get(t,u)&&c[2]<=n;)c[2]++,u++;if(c[2]>n)return NaN;let g=c[0]+c[1]+c[2];return 5*Math.abs(g-i)>=2*i?NaN:this.foundPatternCross(c)?Ai.centerFromEnd(c,u):NaN}handlePossibleCenter(e,t,n){let i=e[0]+e[1]+e[2],o=Ai.centerFromEnd(e,n),l=this.crossCheckVertical(t,o,2*e[1],i);if(!isNaN(l)){let c=(e[0]+e[1]+e[2])/3;for(let g of this.possibleCenters)if(g.aboutEquals(c,l,o))return g.combineEstimate(l,o,c);let u=new As(o,l,c);this.possibleCenters.push(u),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(u)}return null}}class Es extends ie{constructor(e,t,n,i){super(e,t),this.estimatedModuleSize=n,this.count=i,i===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){let i=Math.abs(e-this.estimatedModuleSize);return i<=1||i<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){let i=this.count+1,o=(this.count*this.getX()+t)/i,l=(this.count*this.getY()+e)/i,c=(this.count*this.estimatedModuleSize+n)/i;return new Es(o,l,c,i)}}class k1{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class nt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){let t=e!=null&&e.get(z.TRY_HARDER)!==void 0,n=e!=null&&e.get(z.PURE_BARCODE)!==void 0,i=this.image,o=i.getHeight(),l=i.getWidth(),c=Math.floor(3*o/(4*nt.MAX_MODULES));(c<nt.MIN_SKIP||t)&&(c=nt.MIN_SKIP);let u=!1,g=new Int32Array(5);for(let m=c-1;m<o&&!u;m+=c){g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0;let C=0;for(let b=0;b<l;b++)if(i.get(b,m))(C&1)===1&&C++,g[C]++;else if((C&1)===0)if(C===4)if(nt.foundPatternCross(g)){if(this.handlePossibleCenter(g,m,b,n)===!0)if(c=2,this.hasSkipped===!0)u=this.haveMultiplyConfirmedCenters();else{let T=this.findRowSkip();T>g[2]&&(m+=T-g[2]-c,b=l-1)}else{g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,C=3;continue}C=0,g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0}else g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,C=3;else g[++C]++;else g[C]++;nt.foundPatternCross(g)&&this.handlePossibleCenter(g,m,l,n)===!0&&(c=g[0],this.hasSkipped&&(u=this.haveMultiplyConfirmedCenters()))}let w=this.selectBestPatterns();return ie.orderBestPatterns(w),new k1(w)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let o=0;o<5;o++){let l=e[o];if(l===0)return!1;t+=l}if(t<7)return!1;let n=t/7,i=n/2;return Math.abs(n-e[0])<i&&Math.abs(n-e[1])<i&&Math.abs(3*n-e[2])<3*i&&Math.abs(n-e[3])<i&&Math.abs(n-e[4])<i}getCrossCheckStateCount(){let e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,i){let o=this.getCrossCheckStateCount(),l=0,c=this.image;for(;e>=l&&t>=l&&c.get(t-l,e-l);)o[2]++,l++;if(e<l||t<l)return!1;for(;e>=l&&t>=l&&!c.get(t-l,e-l)&&o[1]<=n;)o[1]++,l++;if(e<l||t<l||o[1]>n)return!1;for(;e>=l&&t>=l&&c.get(t-l,e-l)&&o[0]<=n;)o[0]++,l++;if(o[0]>n)return!1;let u=c.getHeight(),g=c.getWidth();for(l=1;e+l<u&&t+l<g&&c.get(t+l,e+l);)o[2]++,l++;if(e+l>=u||t+l>=g)return!1;for(;e+l<u&&t+l<g&&!c.get(t+l,e+l)&&o[3]<n;)o[3]++,l++;if(e+l>=u||t+l>=g||o[3]>=n)return!1;for(;e+l<u&&t+l<g&&c.get(t+l,e+l)&&o[4]<n;)o[4]++,l++;if(o[4]>=n)return!1;let w=o[0]+o[1]+o[2]+o[3]+o[4];return Math.abs(w-i)<2*i&&nt.foundPatternCross(o)}crossCheckVertical(e,t,n,i){let o=this.image,l=o.getHeight(),c=this.getCrossCheckStateCount(),u=e;for(;u>=0&&o.get(t,u);)c[2]++,u--;if(u<0)return NaN;for(;u>=0&&!o.get(t,u)&&c[1]<=n;)c[1]++,u--;if(u<0||c[1]>n)return NaN;for(;u>=0&&o.get(t,u)&&c[0]<=n;)c[0]++,u--;if(c[0]>n)return NaN;for(u=e+1;u<l&&o.get(t,u);)c[2]++,u++;if(u===l)return NaN;for(;u<l&&!o.get(t,u)&&c[3]<n;)c[3]++,u++;if(u===l||c[3]>=n)return NaN;for(;u<l&&o.get(t,u)&&c[4]<n;)c[4]++,u++;if(c[4]>=n)return NaN;let g=c[0]+c[1]+c[2]+c[3]+c[4];return 5*Math.abs(g-i)>=2*i?NaN:nt.foundPatternCross(c)?nt.centerFromEnd(c,u):NaN}crossCheckHorizontal(e,t,n,i){let o=this.image,l=o.getWidth(),c=this.getCrossCheckStateCount(),u=e;for(;u>=0&&o.get(u,t);)c[2]++,u--;if(u<0)return NaN;for(;u>=0&&!o.get(u,t)&&c[1]<=n;)c[1]++,u--;if(u<0||c[1]>n)return NaN;for(;u>=0&&o.get(u,t)&&c[0]<=n;)c[0]++,u--;if(c[0]>n)return NaN;for(u=e+1;u<l&&o.get(u,t);)c[2]++,u++;if(u===l)return NaN;for(;u<l&&!o.get(u,t)&&c[3]<n;)c[3]++,u++;if(u===l||c[3]>=n)return NaN;for(;u<l&&o.get(u,t)&&c[4]<n;)c[4]++,u++;if(c[4]>=n)return NaN;let g=c[0]+c[1]+c[2]+c[3]+c[4];return 5*Math.abs(g-i)>=i?NaN:nt.foundPatternCross(c)?nt.centerFromEnd(c,u):NaN}handlePossibleCenter(e,t,n,i){let o=e[0]+e[1]+e[2]+e[3]+e[4],l=nt.centerFromEnd(e,n),c=this.crossCheckVertical(t,Math.floor(l),e[2],o);if(!isNaN(c)&&(l=this.crossCheckHorizontal(Math.floor(l),Math.floor(c),e[2],o),!isNaN(l)&&(!i||this.crossCheckDiagonal(Math.floor(c),Math.floor(l),e[2],o)))){let u=o/7,g=!1,w=this.possibleCenters;for(let m=0,C=w.length;m<C;m++){let b=w[m];if(b.aboutEquals(u,c,l)){w[m]=b.combineEstimate(c,l,u),g=!0;break}}if(!g){let m=new Es(l,c,u);w.push(m),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(m)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(let n of this.possibleCenters)if(n.getCount()>=nt.CENTER_QUORUM)if(t==null)t=n;else return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-n.getX())-Math.abs(t.getY()-n.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let e=0,t=0,n=this.possibleCenters.length;for(let l of this.possibleCenters)l.getCount()>=nt.CENTER_QUORUM&&(e++,t+=l.getEstimatedModuleSize());if(e<3)return!1;let i=t/n,o=0;for(let l of this.possibleCenters)o+=Math.abs(l.getEstimatedModuleSize()-i);return o<=.05*t}selectBestPatterns(){let e=this.possibleCenters.length;if(e<3)throw new M;let t=this.possibleCenters,n;if(e>3){let i=0,o=0;for(let u of this.possibleCenters){let g=u.getEstimatedModuleSize();i+=g,o+=g*g}n=i/e;let l=Math.sqrt(o/e-n*n);t.sort((u,g)=>{let w=Math.abs(g.getEstimatedModuleSize()-n),m=Math.abs(u.getEstimatedModuleSize()-n);return w<m?-1:w>m?1:0});let c=Math.max(.2*n,l);for(let u=0;u<t.length&&t.length>3;u++){let g=t[u];Math.abs(g.getEstimatedModuleSize()-n)>c&&(t.splice(u,1),u--)}}if(t.length>3){let i=0;for(let o of t)i+=o.getEstimatedModuleSize();n=i/t.length,t.sort((o,l)=>{if(l.getCount()===o.getCount()){let c=Math.abs(l.getEstimatedModuleSize()-n),u=Math.abs(o.getEstimatedModuleSize()-n);return c<u?1:c>u?-1:0}else return l.getCount()-o.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}nt.CENTER_QUORUM=2,nt.MIN_SKIP=3,nt.MAX_MODULES=57;class Sr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(z.NEED_RESULT_POINT_CALLBACK);let n=new nt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){let t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),o=this.calculateModuleSize(t,n,i);if(o<1)throw new M("No pattern found in proccess finder.");let l=Sr.computeDimension(t,n,i,o),c=se.getProvisionalVersionForDimension(l),u=c.getDimensionForVersion()-7,g=null;if(c.getAlignmentPatternCenters().length>0){let b=n.getX()-t.getX()+i.getX(),S=n.getY()-t.getY()+i.getY(),T=1-3/u,D=Math.floor(t.getX()+T*(b-t.getX())),F=Math.floor(t.getY()+T*(S-t.getY()));for(let Z=4;Z<=16;Z<<=1)try{g=this.findAlignmentInRegion(o,D,F,Z);break}catch(Q){if(!(Q instanceof M))throw Q}}let w=Sr.createTransform(t,n,i,g,l),m=Sr.sampleGrid(this.image,w,l),C;return g===null?C=[i,t,n]:C=[i,t,n,g],new di(m,C)}static createTransform(e,t,n,i,o){let l=o-3.5,c,u,g,w;return i!==null?(c=i.getX(),u=i.getY(),g=l-3,w=g):(c=t.getX()-e.getX()+n.getX(),u=t.getY()-e.getY()+n.getY(),g=l,w=l),Vt.quadrilateralToQuadrilateral(3.5,3.5,l,3.5,g,w,3.5,l,e.getX(),e.getY(),t.getX(),t.getY(),c,u,n.getX(),n.getY())}static sampleGrid(e,t,n){return hn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,i){let o=Ce.round(ie.distance(e,t)/i),l=Ce.round(ie.distance(e,n)/i),c=Math.floor((o+l)/2)+7;switch(c&3){case 0:c++;break;case 2:c--;break;case 3:throw new M("Dimensions could be not found.")}return c}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){let n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,i){let o=this.sizeOfBlackWhiteBlackRun(e,t,n,i),l=1,c=e-(n-e);c<0?(l=e/(e-c),c=0):c>=this.image.getWidth()&&(l=(this.image.getWidth()-1-e)/(c-e),c=this.image.getWidth()-1);let u=Math.floor(t-(i-t)*l);return l=1,u<0?(l=t/(t-u),u=0):u>=this.image.getHeight()&&(l=(this.image.getHeight()-1-t)/(u-t),u=this.image.getHeight()-1),c=Math.floor(e+(c-e)*l),o+=this.sizeOfBlackWhiteBlackRun(e,t,c,u),o-1}sizeOfBlackWhiteBlackRun(e,t,n,i){let o=Math.abs(i-t)>Math.abs(n-e);if(o){let b=e;e=t,t=b,b=n,n=i,i=b}let l=Math.abs(n-e),c=Math.abs(i-t),u=-l/2,g=e<n?1:-1,w=t<i?1:-1,m=0,C=n+g;for(let b=e,S=t;b!==C;b+=g){let T=o?S:b,D=o?b:S;if(m===1===this.image.get(T,D)){if(m===2)return Ce.distance(b,S,e,t);m++}if(u+=c,u>0){if(S===i)break;S+=w,u-=l}}return m===2?Ce.distance(n+g,i,e,t):NaN}findAlignmentInRegion(e,t,n,i){let o=Math.floor(i*e),l=Math.max(0,t-o),c=Math.min(this.image.getWidth()-1,t+o);if(c-l<e*3)throw new M("Alignment top exceeds estimated module size.");let u=Math.max(0,n-o),g=Math.min(this.image.getHeight()-1,n+o);if(g-u<e*3)throw new M("Alignment bottom exceeds estimated module size.");return new Ai(this.image,l,u,c-l,g-u,e,this.resultPointCallback).find()}}class wn{constructor(){this.decoder=new L1}getDecoder(){return this.decoder}decode(e,t){let n,i;if(t!=null&&t.get(z.PURE_BARCODE)!==void 0){let u=wn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(u,t),i=wn.NO_POINTS}else{let u=new Sr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(u.getBits(),t),i=u.getPoints()}n.getOther()instanceof Ko&&n.getOther().applyMirroredCorrection(i);let o=new Ye(n.getText(),n.getRawBytes(),void 0,i,oe.QR_CODE,void 0),l=n.getByteSegments();l!==null&&o.putMetadata(et.BYTE_SEGMENTS,l);let c=n.getECLevel();return c!==null&&o.putMetadata(et.ERROR_CORRECTION_LEVEL,c),n.hasStructuredAppend()&&(o.putMetadata(et.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),o.putMetadata(et.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),o}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new M;let i=this.moduleSize(t,e),o=t[1],l=n[1],c=t[0],u=n[0];if(c>=u||o>=l)throw new M;if(l-o!==u-c&&(u=c+(l-o),u>=e.getWidth()))throw new M;let g=Math.round((u-c+1)/i),w=Math.round((l-o+1)/i);if(g<=0||w<=0)throw new M;if(w!==g)throw new M;let m=Math.floor(i/2);o+=m,c+=m;let C=c+Math.floor((g-1)*i)-u;if(C>0){if(C>m)throw new M;c-=C}let b=o+Math.floor((w-1)*i)-l;if(b>0){if(b>m)throw new M;o-=b}let S=new $(g,w);for(let T=0;T<w;T++){let D=o+Math.floor(T*i);for(let F=0;F<g;F++)e.get(c+Math.floor(F*i),D)&&S.set(F,T)}return S}static moduleSize(e,t){let n=t.getHeight(),i=t.getWidth(),o=e[0],l=e[1],c=!0,u=0;for(;o<i&&l<n;){if(c!==t.get(o,l)){if(++u===5)break;c=!c}o++,l++}if(o===i||l===n)throw new M;return(o-e[0])/7}}wn.NO_POINTS=new Array;class fe{PDF417Common(){}static getBitCountSum(e){return Ce.sum(e)}static toIntArray(e){if(e==null||!e.length)return fe.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),n=0;for(let i of e)t[n++]=i;return t}static getCodeword(e){let t=H.binarySearch(fe.SYMBOL_TABLE,e&262143);return t<0?-1:(fe.CODEWORD_TABLE[t]-1)%fe.NUMBER_OF_CODEWORDS}}fe.NUMBER_OF_CODEWORDS=929,fe.MAX_CODEWORDS_IN_BARCODE=fe.NUMBER_OF_CODEWORDS-1,fe.MIN_ROWS_IN_BARCODE=3,fe.MAX_ROWS_IN_BARCODE=90,fe.MODULES_IN_CODEWORD=17,fe.MODULES_IN_STOP_PATTERN=18,fe.BARS_IN_MODULE=8,fe.EMPTY_INT_ARRAY=new Int32Array([]),fe.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),fe.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class P1{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class de{static detectMultiple(e,t,n){let i=e.getBlackMatrix(),o=de.detect(n,i);return o.length||(i=i.clone(),i.rotate180(),o=de.detect(n,i)),new P1(i,o)}static detect(e,t){let n=new Array,i=0,o=0,l=!1;for(;i<t.getHeight();){let c=de.findVertices(t,i,o);if(c[0]==null&&c[3]==null){if(!l)break;l=!1,o=0;for(let u of n)u[1]!=null&&(i=Math.trunc(Math.max(i,u[1].getY()))),u[3]!=null&&(i=Math.max(i,Math.trunc(u[3].getY())));i+=de.ROW_STEP;continue}if(l=!0,n.push(c),!e)break;c[2]!=null?(o=Math.trunc(c[2].getX()),i=Math.trunc(c[2].getY())):(o=Math.trunc(c[4].getX()),i=Math.trunc(c[4].getY()))}return n}static findVertices(e,t,n){let i=e.getHeight(),o=e.getWidth(),l=new Array(8);return de.copyToResult(l,de.findRowsWithPattern(e,i,o,t,n,de.START_PATTERN),de.INDEXES_START_PATTERN),l[4]!=null&&(n=Math.trunc(l[4].getX()),t=Math.trunc(l[4].getY())),de.copyToResult(l,de.findRowsWithPattern(e,i,o,t,n,de.STOP_PATTERN),de.INDEXES_STOP_PATTERN),l}static copyToResult(e,t,n){for(let i=0;i<n.length;i++)e[n[i]]=t[i]}static findRowsWithPattern(e,t,n,i,o,l){let c=new Array(4),u=!1,g=new Int32Array(l.length);for(;i<t;i+=de.ROW_STEP){let m=de.findGuardPattern(e,o,i,n,!1,l,g);if(m!=null){for(;i>0;){let C=de.findGuardPattern(e,o,--i,n,!1,l,g);if(C!=null)m=C;else{i++;break}}c[0]=new ie(m[0],i),c[1]=new ie(m[1],i),u=!0;break}}let w=i+1;if(u){let m=0,C=Int32Array.from([Math.trunc(c[0].getX()),Math.trunc(c[1].getX())]);for(;w<t;w++){let b=de.findGuardPattern(e,C[0],w,n,!1,l,g);if(b!=null&&Math.abs(C[0]-b[0])<de.MAX_PATTERN_DRIFT&&Math.abs(C[1]-b[1])<de.MAX_PATTERN_DRIFT)C=b,m=0;else{if(m>de.SKIPPED_ROW_COUNT_MAX)break;m++}}w-=m+1,c[2]=new ie(C[0],w),c[3]=new ie(C[1],w)}return w-i<de.BARCODE_MIN_HEIGHT&&H.fill(c,null),c}static findGuardPattern(e,t,n,i,o,l,c){H.fillWithin(c,0,c.length,0);let u=t,g=0;for(;e.get(u,n)&&u>0&&g++<de.MAX_PIXEL_DRIFT;)u--;let w=u,m=0,C=l.length;for(let b=o;w<i;w++)if(e.get(w,n)!==b)c[m]++;else{if(m===C-1){if(de.patternMatchVariance(c,l,de.MAX_INDIVIDUAL_VARIANCE)<de.MAX_AVG_VARIANCE)return new Int32Array([u,w]);u+=c[0]+c[1],N.arraycopy(c,2,c,0,m-1),c[m-1]=0,c[m]=0,m--}else m++;c[m]=1,b=!b}return m===C-1&&de.patternMatchVariance(c,l,de.MAX_INDIVIDUAL_VARIANCE)<de.MAX_AVG_VARIANCE?new Int32Array([u,w-1]):null}static patternMatchVariance(e,t,n){let i=e.length,o=0,l=0;for(let g=0;g<i;g++)o+=e[g],l+=t[g];if(o<l)return 1/0;let c=o/l;n*=c;let u=0;for(let g=0;g<i;g++){let w=e[g],m=t[g]*c,C=w>m?w-m:m-w;if(C>n)return 1/0;u+=C}return u/o}}de.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),de.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),de.MAX_AVG_VARIANCE=.42,de.MAX_INDIVIDUAL_VARIANCE=.8,de.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),de.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),de.MAX_PIXEL_DRIFT=3,de.MAX_PATTERN_DRIFT=5,de.SKIPPED_ROW_COUNT_MAX=25,de.ROW_STEP=5,de.BARCODE_MIN_HEIGHT=10;class at{constructor(e,t){if(t.length===0)throw new x;this.field=e;let n=t.length;if(n>1&&t[0]===0){let i=1;for(;i<n&&t[i]===0;)i++;i===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-i),N.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);if(e===1){let i=0;for(let o of this.coefficients)i=this.field.add(i,o);return i}let t=this.coefficients[0],n=this.coefficients.length;for(let i=1;i<n;i++)t=this.field.add(this.field.multiply(e,t),this.coefficients[i]);return t}add(e){if(!this.field.equals(e.field))throw new x("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let l=t;t=n,n=l}let i=new Int32Array(n.length),o=n.length-t.length;N.arraycopy(n,0,i,0,o);for(let l=o;l<n.length;l++)i[l]=this.field.add(t[l-o],n[l]);return new at(this.field,i)}subtract(e){if(!this.field.equals(e.field))throw new x("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof at?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new x("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new at(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,i=e.coefficients,o=i.length,l=new Int32Array(n+o-1);for(let c=0;c<n;c++){let u=t[c];for(let g=0;g<o;g++)l[c+g]=this.field.add(l[c+g],this.field.multiply(u,i[g]))}return new at(this.field,l)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new at(this.field,t)}multiplyScalar(e){if(e===0)return new at(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new at(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new x;if(t===0)return new at(this.field,new Int32Array([0]));let n=this.coefficients.length,i=new Int32Array(n+e);for(let o=0;o<n;o++)i[o]=this.field.multiply(this.coefficients[o],t);return new at(this.field,i)}toString(){let e=new G;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class F1{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new x;return this.logTable[e]}inverse(e){if(e===0)throw new ui;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class ms extends F1{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let i=0;i<e;i++)this.expTable[i]=n,n=n*t%e;for(let i=0;i<e-1;i++)this.logTable[this.expTable[i]]=i;this.zero=new at(this,new Int32Array([0])),this.one=new at(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new x;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new at(this,n)}}ms.PDF417_GF=new ms(fe.NUMBER_OF_CODEWORDS,3);class qo{constructor(){this.field=ms.PDF417_GF}decode(e,t,n){let i=new at(this.field,e),o=new Int32Array(t),l=!1;for(let S=t;S>0;S--){let T=i.evaluateAt(this.field.exp(S));o[t-S]=T,T!==0&&(l=!0)}if(!l)return 0;let c=this.field.getOne();if(n!=null)for(let S of n){let T=this.field.exp(e.length-1-S),D=new at(this.field,new Int32Array([this.field.subtract(0,T),1]));c=c.multiply(D)}let u=new at(this.field,o),g=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),u,t),w=g[0],m=g[1],C=this.findErrorLocations(w),b=this.findErrorMagnitudes(m,w,C);for(let S=0;S<C.length;S++){let T=e.length-1-this.field.log(C[S]);if(T<0)throw v.getChecksumInstance();e[T]=this.field.subtract(e[T],b[S])}return C.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let C=e;e=t,t=C}let i=e,o=t,l=this.field.getZero(),c=this.field.getOne();for(;o.getDegree()>=Math.round(n/2);){let C=i,b=l;if(i=o,l=c,i.isZero())throw v.getChecksumInstance();o=C;let S=this.field.getZero(),T=i.getCoefficient(i.getDegree()),D=this.field.inverse(T);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){let F=o.getDegree()-i.getDegree(),Z=this.field.multiply(o.getCoefficient(o.getDegree()),D);S=S.add(this.field.buildMonomial(F,Z)),o=o.subtract(i.multiplyByMonomial(F,Z))}c=S.multiply(l).subtract(b).negative()}let u=c.getCoefficient(0);if(u===0)throw v.getChecksumInstance();let g=this.field.inverse(u),w=c.multiply(g),m=o.multiply(g);return[w,m]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),i=0;for(let o=1;o<this.field.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=this.field.inverse(o),i++);if(i!==t)throw v.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let i=t.getDegree(),o=new Int32Array(i);for(let g=1;g<=i;g++)o[i-g]=this.field.multiply(g,t.getCoefficient(g));let l=new at(this.field,o),c=n.length,u=new Int32Array(c);for(let g=0;g<c;g++){let w=this.field.inverse(n[g]),m=this.field.subtract(0,e.evaluateAt(w)),C=this.field.inverse(l.evaluateAt(w));u[g]=this.field.multiply(m,C)}return u}}class Dn{constructor(e,t,n,i,o){e instanceof Dn?this.constructor_2(e):this.constructor_1(e,t,n,i,o)}constructor_1(e,t,n,i,o){let l=t==null||n==null,c=i==null||o==null;if(l&&c)throw new M;l?(t=new ie(0,i.getY()),n=new ie(0,o.getY())):c&&(i=new ie(e.getWidth()-1,t.getY()),o=new ie(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=o,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),o.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),o.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return e==null?t:t==null?e:new Dn(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let i=this.topLeft,o=this.bottomLeft,l=this.topRight,c=this.bottomRight;if(e>0){let u=n?this.topLeft:this.topRight,g=Math.trunc(u.getY()-e);g<0&&(g=0);let w=new ie(u.getX(),g);n?i=w:l=w}if(t>0){let u=n?this.bottomLeft:this.bottomRight,g=Math.trunc(u.getY()+t);g>=this.image.getHeight()&&(g=this.image.getHeight()-1);let w=new ie(u.getX(),g);n?o=w:c=w}return new Dn(this.image,i,o,l,c)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class U1{constructor(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Tr{constructor(){this.buffer=""}static form(e,t){let n=-1;function i(l,c,u,g,w,m){if(l==="%%")return"%";if(t[++n]===void 0)return;l=g?parseInt(g.substr(1)):void 0;let C=w?parseInt(w.substr(1)):void 0,b;switch(m){case"s":b=t[n];break;case"c":b=t[n][0];break;case"f":b=parseFloat(t[n]).toFixed(l);break;case"p":b=parseFloat(t[n]).toPrecision(l);break;case"e":b=parseFloat(t[n]).toExponential(l);break;case"x":b=parseInt(t[n]).toString(C||16);break;case"d":b=parseFloat(parseInt(t[n],C||10).toPrecision(l)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(C);let S=parseInt(u),T=u&&u[0]+""=="0"?"0":" ";for(;b.length<S;)b=c!==void 0?b+T:T+b;return b}let o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,i)}format(e,...t){this.buffer+=Tr.form(e,t)}toString(){return this.buffer}}class Nr{constructor(e){this.boundingBox=new Dn(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(t!=null)return t;for(let n=1;n<Nr.MAX_NEARBY_DISTANCE;n++){let i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let e=new Tr,t=0;for(let n of this.codewords){if(n==null){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue())}return e.toString()}}Nr.MAX_NEARBY_DISTANCE=5;class Mr{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(let[n,i]of this.values.entries()){let o={getKey:()=>n,getValue:()=>i};o.getValue()>e?(e=o.getValue(),t=[],t.push(o.getKey())):o.getValue()===e&&t.push(o.getKey())}return fe.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Jo extends Nr{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())e?.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),o=this._isLeft?n.getBottomLeft():n.getBottomRight(),l=this.imageRowToCodewordIndex(Math.trunc(i.getY())),c=this.imageRowToCodewordIndex(Math.trunc(o.getY())),u=-1,g=1,w=0;for(let m=l;m<c;m++){if(t[m]==null)continue;let C=t[m],b=C.getRowNumber()-u;if(b===0)w++;else if(b===1)g=Math.max(g,w),w=1,u=C.getRowNumber();else if(b<0||C.getRowNumber()>=e.getRowCount()||b>m)t[m]=null;else{let S;g>2?S=(g-2)*b:S=b;let T=S>=m;for(let D=1;D<=S&&!T;D++)T=t[m-D]!=null;T?t[m]=null:(u=C.getRowNumber(),w=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(e==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let n of this.getCodewords())if(n!=null){let i=n.getRowNumber();if(i>=t.length)continue;t[i]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),i=this._isLeft?t.getBottomLeft():t.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),l=this.imageRowToCodewordIndex(Math.trunc(i.getY())),c=this.getCodewords(),u=-1;for(let g=o;g<l;g++){if(c[g]==null)continue;let w=c[g];w.setRowNumberAsRowIndicatorColumn();let m=w.getRowNumber()-u;m===0||(m===1?u=w.getRowNumber():w.getRowNumber()>=e.getRowCount()?c[g]=null:u=w.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Mr,n=new Mr,i=new Mr,o=new Mr;for(let c of e){if(c==null)continue;c.setRowNumberAsRowIndicatorColumn();let u=c.getValue()%30,g=c.getRowNumber();switch(this._isLeft||(g+=2),g%3){case 0:n.setValue(u*3+1);break;case 1:o.setValue(u/3),i.setValue(u%3);break;case 2:t.setValue(u+1);break}}if(t.getValue().length===0||n.getValue().length===0||i.getValue().length===0||o.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+i.getValue()[0]<fe.MIN_ROWS_IN_BARCODE||n.getValue()[0]+i.getValue()[0]>fe.MAX_ROWS_IN_BARCODE)return null;let l=new U1(t.getValue()[0],n.getValue()[0],i.getValue()[0],o.getValue()[0]);return this.removeIncorrectCodewords(e,l),l}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(e[n]==null)continue;let o=i.getValue()%30,l=i.getRowNumber();if(l>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(l+=2),l%3){case 0:o*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(o/3)!==t.getErrorCorrectionLevel()||o%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:o+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
|
`+super.toString()}}class Or{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e=fe.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){e?.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(e===0)return 0;for(let t=1;t<this.barcodeColumnCount+1;t++){let n=this.detectionResultColumns[t].getCodewords();for(let i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(let i=1;i<=this.barcodeColumnCount;i++){let o=this.detectionResultColumns[i].getCodewords()[n];o!=null&&(o.setRowNumber(e[n].getRowNumber()),o.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let i=t[n].getRowNumber(),o=0;for(let l=this.barcodeColumnCount+1;l>0&&o<this.ADJUST_ROW_NUMBER_SKIP;l--){let c=this.detectionResultColumns[l].getCodewords()[n];c!=null&&(o=Or.adjustRowNumberIfValid(i,o,c),c.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let i=t[n].getRowNumber(),o=0;for(let l=1;l<this.barcodeColumnCount+1&&o<this.ADJUST_ROW_NUMBER_SKIP;l++){let c=this.detectionResultColumns[l].getCodewords()[n];c!=null&&(o=Or.adjustRowNumberIfValid(i,o,c),c.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let i=n[t],o=this.detectionResultColumns[e-1].getCodewords(),l=o;this.detectionResultColumns[e+1]!=null&&(l=this.detectionResultColumns[e+1].getCodewords());let c=new Array(14);c[2]=o[t],c[3]=l[t],t>0&&(c[0]=n[t-1],c[4]=o[t-1],c[5]=l[t-1]),t>1&&(c[8]=n[t-2],c[10]=o[t-2],c[11]=l[t-2]),t<n.length-1&&(c[1]=n[t+1],c[6]=o[t+1],c[7]=l[t+1]),t<n.length-2&&(c[9]=n[t+2],c[12]=o[t+2],c[13]=l[t+2]);for(let u of c)if(Or.adjustRowNumber(i,u))return}static adjustRowNumber(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new Tr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format(" | ");continue}let o=this.detectionResultColumns[i].getCodewords()[n];if(o==null){t.format(" | ");continue}t.format(" %3d|%3d",o.getRowNumber(),o.getValue())}t.format("%n")}return t.toString()}}class Rr{constructor(e,t,n,i){this.rowNumber=Rr.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Rr.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}Rr.BARCODE_ROW_UNKNOWN=-1;class Et{static initialize(){for(let e=0;e<fe.SYMBOL_TABLE.length;e++){let t=fe.SYMBOL_TABLE[e],n=t&1;for(let i=0;i<fe.BARS_IN_MODULE;i++){let o=0;for(;(t&1)===n;)o+=1,t>>=1;n=t&1,Et.RATIOS_TABLE[e]||(Et.RATIOS_TABLE[e]=new Array(fe.BARS_IN_MODULE)),Et.RATIOS_TABLE[e][fe.BARS_IN_MODULE-i-1]=Math.fround(o/fe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=Et.getDecodedCodewordValue(Et.sampleBitCounts(e));return t!==-1?t:Et.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=Ce.sum(e),n=new Int32Array(fe.BARS_IN_MODULE),i=0,o=0;for(let l=0;l<fe.MODULES_IN_CODEWORD;l++){let c=t/(2*fe.MODULES_IN_CODEWORD)+l*t/fe.MODULES_IN_CODEWORD;o+e[i]<=c&&(o+=e[i],i++),n[i]++}return n}static getDecodedCodewordValue(e){let t=Et.getBitValue(e);return fe.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=Ce.sum(e),n=new Array(fe.BARS_IN_MODULE);if(t>1)for(let l=0;l<n.length;l++)n[l]=Math.fround(e[l]/t);let i=hi.MAX_VALUE,o=-1;this.bSymbolTableReady||Et.initialize();for(let l=0;l<Et.RATIOS_TABLE.length;l++){let c=0,u=Et.RATIOS_TABLE[l];for(let g=0;g<fe.BARS_IN_MODULE;g++){let w=Math.fround(u[g]-n[g]);if(c+=Math.fround(w*w),c>=i)break}c<i&&(i=c,o=fe.SYMBOL_TABLE[l])}return o}}Et.bSymbolTableReady=!1,Et.RATIOS_TABLE=new Array(fe.SYMBOL_TABLE.length).map(E=>E=new Array(fe.BARS_IN_MODULE));class $o{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class ea{static parseLong(e,t=void 0){return parseInt(e,t)}}class ta extends A{}ta.kind="NullPointerException";class z1{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new ta;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new V;if(n===0)return;for(let i=0;i<n;i++)this.write(e[t+i])}flush(){}close(){}}class H1 extends A{}class V1 extends z1{constructor(e=32){if(super(),this.count=0,e<0)throw new x("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let n=this.buf.length<<1;if(n-e<0&&(n=e),n<0){if(e<0)throw new H1;n=U.MAX_VALUE}this.buf=H.copyOfUint8Array(this.buf,n)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new V;this.ensureCapacity(this.count+n),N.arraycopy(e,t,this.buf,this.count,n),this.count+=n}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return H.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?typeof e=="string"?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}var Re;(function(E){E[E.ALPHA=0]="ALPHA",E[E.LOWER=1]="LOWER",E[E.MIXED=2]="MIXED",E[E.PUNCT=3]="PUNCT",E[E.ALPHA_SHIFT=4]="ALPHA_SHIFT",E[E.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Re||(Re={}));function na(){if(typeof window<"u")return window.BigInt||null;if(typeof global<"u")return global.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Ei;function pn(E){if(typeof Ei>"u"&&(Ei=na()),Ei===null)throw new Error("BigInt is not supported!");return Ei(E)}function X1(){let E=[];E[0]=pn(1);let e=pn(900);E[1]=e;for(let t=2;t<16;t++)E[t]=E[t-1]*e;return E}class P{static decode(e,t){let n=new G(""),i=O.ISO8859_1;n.enableDecoding(i);let o=1,l=e[o++],c=new $o;for(;o<e[0];){switch(l){case P.TEXT_COMPACTION_MODE_LATCH:o=P.textCompaction(e,o,n);break;case P.BYTE_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH_6:o=P.byteCompaction(l,e,i,o,n);break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[o++]);break;case P.NUMERIC_COMPACTION_MODE_LATCH:o=P.numericCompaction(e,o,n);break;case P.ECI_CHARSET:let g=O.getCharacterSetECIByValue(e[o++]);break;case P.ECI_GENERAL_PURPOSE:o+=2;break;case P.ECI_USER_DEFINED:o++;break;case P.BEGIN_MACRO_PDF417_CONTROL_BLOCK:o=P.decodeMacroBlock(e,o,c);break;case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case P.MACRO_PDF417_TERMINATOR:throw new L;default:o--,o=P.textCompaction(e,o,n);break}if(o<e.length)l=e[o++];else throw L.getFormatInstance()}if(n.length()===0)throw L.getFormatInstance();let u=new _r(null,n.toString(),null,t);return u.setOther(c),u}static decodeMacroBlock(e,t,n){if(t+P.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw L.getFormatInstance();let i=new Int32Array(P.NUMBER_OF_SEQUENCE_CODEWORDS);for(let c=0;c<P.NUMBER_OF_SEQUENCE_CODEWORDS;c++,t++)i[c]=e[t];n.setSegmentIndex(U.parseInt(P.decodeBase900toBase10(i,P.NUMBER_OF_SEQUENCE_CODEWORDS)));let o=new G;t=P.textCompaction(e,t,o),n.setFileId(o.toString());let l=-1;for(e[t]===P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(l=t+1);t<e[0];)switch(e[t]){case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case P.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let c=new G;t=P.textCompaction(e,t+1,c),n.setFileName(c.toString());break;case P.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let u=new G;t=P.textCompaction(e,t+1,u),n.setSender(u.toString());break;case P.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let g=new G;t=P.textCompaction(e,t+1,g),n.setAddressee(g.toString());break;case P.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let w=new G;t=P.numericCompaction(e,t+1,w),n.setSegmentCount(U.parseInt(w.toString()));break;case P.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let m=new G;t=P.numericCompaction(e,t+1,m),n.setTimestamp(ea.parseLong(m.toString()));break;case P.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let C=new G;t=P.numericCompaction(e,t+1,C),n.setChecksum(U.parseInt(C.toString()));break;case P.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let b=new G;t=P.numericCompaction(e,t+1,b),n.setFileSize(ea.parseLong(b.toString()));break;default:throw L.getFormatInstance()}break;case P.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw L.getFormatInstance()}if(l!==-1){let c=t-l;n.isLastSegment()&&c--,n.setOptionalData(H.copyOfRange(e,l,l+c))}return t}static textCompaction(e,t,n){let i=new Int32Array((e[0]-t)*2),o=new Int32Array((e[0]-t)*2),l=0,c=!1;for(;t<e[0]&&!c;){let u=e[t++];if(u<P.TEXT_COMPACTION_MODE_LATCH)i[l]=u/30,i[l+1]=u%30,l+=2;else switch(u){case P.TEXT_COMPACTION_MODE_LATCH:i[l++]=P.TEXT_COMPACTION_MODE_LATCH;break;case P.BYTE_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH_6:case P.NUMERIC_COMPACTION_MODE_LATCH:case P.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case P.MACRO_PDF417_TERMINATOR:t--,c=!0;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[l]=P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,u=e[t++],o[l]=u,l++;break}}return P.decodeTextCompaction(i,o,l,n),t}static decodeTextCompaction(e,t,n,i){let o=Re.ALPHA,l=Re.ALPHA,c=0;for(;c<n;){let u=e[c],g="";switch(o){case Re.ALPHA:if(u<26)g=String.fromCharCode(65+u);else switch(u){case 26:g=" ";break;case P.LL:o=Re.LOWER;break;case P.ML:o=Re.MIXED;break;case P.PS:l=o,o=Re.PUNCT_SHIFT;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[c]);break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break;case Re.LOWER:if(u<26)g=String.fromCharCode(97+u);else switch(u){case 26:g=" ";break;case P.AS:l=o,o=Re.ALPHA_SHIFT;break;case P.ML:o=Re.MIXED;break;case P.PS:l=o,o=Re.PUNCT_SHIFT;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[c]);break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break;case Re.MIXED:if(u<P.PL)g=P.MIXED_CHARS[u];else switch(u){case P.PL:o=Re.PUNCT;break;case 26:g=" ";break;case P.LL:o=Re.LOWER;break;case P.AL:o=Re.ALPHA;break;case P.PS:l=o,o=Re.PUNCT_SHIFT;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[c]);break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break;case Re.PUNCT:if(u<P.PAL)g=P.PUNCT_CHARS[u];else switch(u){case P.PAL:o=Re.ALPHA;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[c]);break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break;case Re.ALPHA_SHIFT:if(o=l,u<26)g=String.fromCharCode(65+u);else switch(u){case 26:g=" ";break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break;case Re.PUNCT_SHIFT:if(o=l,u<P.PAL)g=P.PUNCT_CHARS[u];else switch(u){case P.PAL:o=Re.ALPHA;break;case P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[c]);break;case P.TEXT_COMPACTION_MODE_LATCH:o=Re.ALPHA;break}break}g!==""&&i.append(g),c++}}static byteCompaction(e,t,n,i,o){let l=new V1,c=0,u=0,g=!1;switch(e){case P.BYTE_COMPACTION_MODE_LATCH:let w=new Int32Array(6),m=t[i++];for(;i<t[0]&&!g;)switch(w[c++]=m,u=900*u+m,m=t[i++],m){case P.TEXT_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH:case P.NUMERIC_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH_6:case P.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case P.MACRO_PDF417_TERMINATOR:i--,g=!0;break;default:if(c%5===0&&c>0){for(let C=0;C<6;++C)l.write(Number(pn(u)>>pn(8*(5-C))));u=0,c=0}break}i===t[0]&&m<P.TEXT_COMPACTION_MODE_LATCH&&(w[c++]=m);for(let C=0;C<c;C++)l.write(w[C]);break;case P.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!g;){let C=t[i++];if(C<P.TEXT_COMPACTION_MODE_LATCH)c++,u=900*u+C;else switch(C){case P.TEXT_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH:case P.NUMERIC_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH_6:case P.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case P.MACRO_PDF417_TERMINATOR:i--,g=!0;break}if(c%5===0&&c>0){for(let b=0;b<6;++b)l.write(Number(pn(u)>>pn(8*(5-b))));u=0,c=0}}break}return o.append(re.decode(l.toByteArray(),n)),i}static numericCompaction(e,t,n){let i=0,o=!1,l=new Int32Array(P.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!o;){let c=e[t++];if(t===e[0]&&(o=!0),c<P.TEXT_COMPACTION_MODE_LATCH)l[i]=c,i++;else switch(c){case P.TEXT_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH:case P.BYTE_COMPACTION_MODE_LATCH_6:case P.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case P.MACRO_PDF417_TERMINATOR:t--,o=!0;break}(i%P.MAX_NUMERIC_CODEWORDS===0||c===P.NUMERIC_COMPACTION_MODE_LATCH||o)&&i>0&&(n.append(P.decodeBase900toBase10(l,i)),i=0)}return t}static decodeBase900toBase10(e,t){let n=pn(0);for(let o=0;o<t;o++)n+=P.EXP900[t-o-1]*pn(e[o]);let i=n.toString();if(i.charAt(0)!=="1")throw new L;return i.substring(1)}}P.TEXT_COMPACTION_MODE_LATCH=900,P.BYTE_COMPACTION_MODE_LATCH=901,P.NUMERIC_COMPACTION_MODE_LATCH=902,P.BYTE_COMPACTION_MODE_LATCH_6=924,P.ECI_USER_DEFINED=925,P.ECI_GENERAL_PURPOSE=926,P.ECI_CHARSET=927,P.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,P.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,P.MACRO_PDF417_TERMINATOR=922,P.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,P.MAX_NUMERIC_CODEWORDS=15,P.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,P.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,P.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,P.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,P.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,P.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,P.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,P.PL=25,P.LL=27,P.AS=27,P.ML=28,P.AL=28,P.PS=29,P.PAL=29,P.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
-.$/"|*()?{}'`,P.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",P.EXP900=na()?X1():[],P.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ge{constructor(){}static decode(e,t,n,i,o,l,c){let u=new Dn(e,t,n,i,o),g=null,w=null,m;for(let S=!0;;S=!1){if(t!=null&&(g=ge.getRowIndicatorColumn(e,u,t,!0,l,c)),i!=null&&(w=ge.getRowIndicatorColumn(e,u,i,!1,l,c)),m=ge.merge(g,w),m==null)throw M.getNotFoundInstance();let T=m.getBoundingBox();if(S&&T!=null&&(T.getMinY()<u.getMinY()||T.getMaxY()>u.getMaxY()))u=T;else break}m.setBoundingBox(u);let C=m.getBarcodeColumnCount()+1;m.setDetectionResultColumn(0,g),m.setDetectionResultColumn(C,w);let b=g!=null;for(let S=1;S<=C;S++){let T=b?S:C-S;if(m.getDetectionResultColumn(T)!==void 0)continue;let D;T===0||T===C?D=new Jo(u,T===0):D=new Nr(u),m.setDetectionResultColumn(T,D);let F=-1,Z=F;for(let Q=u.getMinY();Q<=u.getMaxY();Q++){if(F=ge.getStartColumn(m,T,Q,b),F<0||F>u.getMaxX()){if(Z===-1)continue;F=Z}let j=ge.detectCodeword(e,u.getMinX(),u.getMaxX(),b,F,Q,l,c);j!=null&&(D.setCodeword(Q,j),Z=F,l=Math.min(l,j.getWidth()),c=Math.max(c,j.getWidth()))}}return ge.createDecoderResult(m)}static merge(e,t){if(e==null&&t==null)return null;let n=ge.getBarcodeMetadata(e,t);if(n==null)return null;let i=Dn.merge(ge.adjustBoundingBox(e),ge.adjustBoundingBox(t));return new Or(n,i)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=ge.getMax(t),i=0;for(let c of t)if(i+=n-c,c>0)break;let o=e.getCodewords();for(let c=0;i>0&&o[c]==null;c++)i--;let l=0;for(let c=t.length-1;c>=0&&(l+=n-t[c],!(t[c]>0));c--);for(let c=o.length-1;l>0&&o[c]==null;c--)l--;return e.getBoundingBox().addMissingRows(i,l,e.isLeft())}static getMax(e){let t=-1;for(let n of e)t=Math.max(t,n);return t}static getBarcodeMetadata(e,t){let n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();let i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,i,o,l){let c=new Jo(t,i);for(let u=0;u<2;u++){let g=u===0?1:-1,w=Math.trunc(Math.trunc(n.getX()));for(let m=Math.trunc(Math.trunc(n.getY()));m<=t.getMaxY()&&m>=t.getMinY();m+=g){let C=ge.detectCodeword(e,0,e.getWidth(),i,w,m,o,l);C!=null&&(c.setCodeword(m,C),i?w=C.getStartX():w=C.getEndX())}}return c}static adjustCodewordCount(e,t){let n=t[0][1],i=n.getValue(),o=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-ge.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(o<1||o>fe.MAX_CODEWORDS_IN_BARCODE)throw M.getNotFoundInstance();n.setValue(o)}else i[0]!==o&&n.setValue(o)}static createDecoderResult(e){let t=ge.createBarcodeMatrix(e);ge.adjustCodewordCount(e,t);let n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),o=[],l=new Array;for(let u=0;u<e.getBarcodeRowCount();u++)for(let g=0;g<e.getBarcodeColumnCount();g++){let w=t[u][g+1].getValue(),m=u*e.getBarcodeColumnCount()+g;w.length===0?n.push(m):w.length===1?i[m]=w[0]:(l.push(m),o.push(w))}let c=new Array(o.length);for(let u=0;u<c.length;u++)c[u]=o[u];return ge.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,fe.toIntArray(n),fe.toIntArray(l),c)}static createDecoderResultFromAmbiguousValues(e,t,n,i,o){let l=new Int32Array(i.length),c=100;for(;c-- >0;){for(let u=0;u<l.length;u++)t[i[u]]=o[u][l[u]];try{return ge.decodeCodewords(t,e,n)}catch(u){if(!(u instanceof v))throw u}if(l.length===0)throw v.getChecksumInstance();for(let u=0;u<l.length;u++)if(l[u]<o[u].length-1){l[u]++;break}else if(l[u]=0,u===l.length-1)throw v.getChecksumInstance()}throw v.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let i=0;i<t.length;i++)for(let o=0;o<t[i].length;o++)t[i][o]=new Mr;let n=0;for(let i of e.getDetectionResultColumns()){if(i!=null){for(let o of i.getCodewords())if(o!=null){let l=o.getRowNumber();if(l>=0){if(l>=t.length)continue;t[l][n].setValue(o.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,i){let o=i?1:-1,l=null;if(ge.isValidBarcodeColumn(e,t-o)&&(l=e.getDetectionResultColumn(t-o).getCodeword(n)),l!=null)return i?l.getEndX():l.getStartX();if(l=e.getDetectionResultColumn(t).getCodewordNearby(n),l!=null)return i?l.getStartX():l.getEndX();if(ge.isValidBarcodeColumn(e,t-o)&&(l=e.getDetectionResultColumn(t-o).getCodewordNearby(n)),l!=null)return i?l.getEndX():l.getStartX();let c=0;for(;ge.isValidBarcodeColumn(e,t-o);){t-=o;for(let u of e.getDetectionResultColumn(t).getCodewords())if(u!=null)return(i?u.getEndX():u.getStartX())+o*c*(u.getEndX()-u.getStartX());c++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,i,o,l,c,u){o=ge.adjustCodewordStartColumn(e,t,n,i,o,l);let g=ge.getModuleBitCount(e,t,n,i,o,l);if(g==null)return null;let w,m=Ce.sum(g);if(i)w=o+m;else{for(let S=0;S<g.length/2;S++){let T=g[S];g[S]=g[g.length-1-S],g[g.length-1-S]=T}w=o,o=w-m}if(!ge.checkCodewordSkew(m,c,u))return null;let C=Et.getDecodedValue(g),b=fe.getCodeword(C);return b===-1?null:new Rr(o,w,ge.getCodewordBucketNumber(C),b)}static getModuleBitCount(e,t,n,i,o,l){let c=o,u=new Int32Array(8),g=0,w=i?1:-1,m=i;for(;(i?c<n:c>=t)&&g<u.length;)e.get(c,l)===m?(u[g]++,c+=w):(g++,m=!m);return g===u.length||c===(i?n:t)&&g===u.length-1?u:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,i,o,l){let c=o,u=i?-1:1;for(let g=0;g<2;g++){for(;(i?c>=t:c<n)&&i===e.get(c,l);){if(Math.abs(o-c)>ge.CODEWORD_SKEW_SIZE)return o;c+=u}u=-u,i=!i}return c}static checkCodewordSkew(e,t,n){return t-ge.CODEWORD_SKEW_SIZE<=e&&e<=n+ge.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw L.getFormatInstance();let i=1<<t+1,o=ge.correctErrors(e,n,i);ge.verifyCodewordCount(e,i);let l=P.decode(e,""+t);return l.setErrorsCorrected(o),l.setErasures(n.length),l}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+ge.MAX_ERRORS||n<0||n>ge.MAX_EC_CODEWORDS)throw v.getChecksumInstance();return ge.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw L.getFormatInstance();let n=e[0];if(n>e.length)throw L.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw L.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,i=t.length-1;for(;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return ge.getCodewordBucketNumber(ge.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Tr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let i=0;i<e[n].length;i++){let o=e[n][i];o.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",o.getValue()[0],o.getConfidence(o.getValue()[0]))}t.format("%n")}return t.toString()}}ge.CODEWORD_SKEW_SIZE=2,ge.MAX_ERRORS=3,ge.MAX_EC_CODEWORDS=512,ge.errorCorrection=new qo;class lt{decode(e,t=null){let n=lt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw M.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return lt.decode(e,t,!0)}catch(n){throw n instanceof L||n instanceof v?M.getNotFoundInstance():n}}static decode(e,t,n){let i=new Array,o=de.detectMultiple(e,t,n);for(let l of o.getPoints()){let c=ge.decode(o.getBits(),l[4],l[5],l[6],l[7],lt.getMinCodewordWidth(l),lt.getMaxCodewordWidth(l)),u=new Ye(c.getText(),c.getRawBytes(),void 0,l,oe.PDF_417);u.putMetadata(et.ERROR_CORRECTION_LEVEL,c.getECLevel());let g=c.getOther();g!=null&&u.putMetadata(et.PDF417_EXTRA_METADATA,g),i.push(u)}return i.map(l=>l)}static getMaxWidth(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return e==null||t==null?U.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(lt.getMaxWidth(e[0],e[4]),lt.getMaxWidth(e[6],e[2])*fe.MODULES_IN_CODEWORD/fe.MODULES_IN_STOP_PATTERN),Math.max(lt.getMaxWidth(e[1],e[5]),lt.getMaxWidth(e[7],e[3])*fe.MODULES_IN_CODEWORD/fe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(lt.getMinWidth(e[0],e[4]),lt.getMinWidth(e[6],e[2])*fe.MODULES_IN_CODEWORD/fe.MODULES_IN_STOP_PATTERN),Math.min(lt.getMinWidth(e[1],e[5]),lt.getMinWidth(e[7],e[3])*fe.MODULES_IN_CODEWORD/fe.MODULES_IN_STOP_PATTERN)))}reset(){}}class mi extends A{}mi.kind="ReaderException";class ra{constructor(e,t){this.verbose=e===!0,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;let t=!a(e)&&e.get(z.TRY_HARDER)===!0,n=a(e)?null:e.get(z.POSSIBLE_FORMATS),i=new Array;if(!a(n)){let o=n.some(l=>l===oe.UPC_A||l===oe.UPC_E||l===oe.EAN_13||l===oe.EAN_8||l===oe.CODABAR||l===oe.CODE_39||l===oe.CODE_93||l===oe.CODE_128||l===oe.ITF||l===oe.RSS_14||l===oe.RSS_EXPANDED);o&&!t&&i.push(new Jn(e,this.verbose)),n.includes(oe.QR_CODE)&&i.push(new wn),n.includes(oe.DATA_MATRIX)&&i.push(new xn),n.includes(oe.AZTEC)&&i.push(new gi),n.includes(oe.PDF_417)&&i.push(new lt),o&&t&&i.push(new Jn(e,this.verbose))}i.length===0&&(t||i.push(new Jn(e,this.verbose)),i.push(new wn),i.push(new xn),i.push(new gi),i.push(new lt),t&&i.push(new Jn(e,this.verbose))),this.readers=i}reset(){if(this.readers!==null)for(let e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new mi("No readers where selected, nothing can be read.");for(let t of this.readers)try{return t.decode(e,this.hints)}catch(n){if(n instanceof mi)continue}throw new M("No MultiFormat Readers were able to detect the code.")}}class G1 extends Ht{constructor(e=null,t=500){let n=new ra;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class j1 extends Ht{constructor(e=500){super(new lt,e)}}class Y1 extends Ht{constructor(e=500){super(new wn,e)}}var Cs;(function(E){E[E.ERROR_CORRECTION=0]="ERROR_CORRECTION",E[E.CHARACTER_SET=1]="CHARACTER_SET",E[E.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",E[E.MIN_SIZE=3]="MIN_SIZE",E[E.MAX_SIZE=4]="MAX_SIZE",E[E.MARGIN=5]="MARGIN",E[E.PDF417_COMPACT=6]="PDF417_COMPACT",E[E.PDF417_COMPACTION=7]="PDF417_COMPACTION",E[E.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",E[E.AZTEC_LAYERS=9]="AZTEC_LAYERS",E[E.QR_VERSION=10]="QR_VERSION"})(Cs||(Cs={}));var Je=Cs;class _s{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new wt(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1],i=this.field;for(let o=t.length;o<=e;o++){let l=n.multiply(new wt(i,Int32Array.from([1,i.exp(o-1+i.getGeneratorBase())])));t.push(l),n=l}}return t[e]}encode(e,t){if(t===0)throw new x("No error correction bytes");let n=e.length-t;if(n<=0)throw new x("No data bytes provided");let i=this.buildGenerator(t),o=new Int32Array(n);N.arraycopy(e,0,o,0,n);let l=new wt(this.field,o);l=l.multiplyByMonomial(t,1);let u=l.divide(i)[1].getCoefficients(),g=t-u.length;for(let w=0;w<g;w++)e[n+w]=0;N.arraycopy(u,0,e,n+g,u.length)}}class je{constructor(){}static applyMaskPenaltyRule1(e){return je.applyMaskPenaltyRule1Internal(e,!0)+je.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight();for(let l=0;l<o-1;l++){let c=n[l];for(let u=0;u<i-1;u++){let g=c[u];g===c[u+1]&&g===n[l+1][u]&&g===n[l+1][u+1]&&t++}}return je.N2*t}static applyMaskPenaltyRule3(e){let t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight();for(let l=0;l<o;l++)for(let c=0;c<i;c++){let u=n[l];c+6<i&&u[c]===1&&u[c+1]===0&&u[c+2]===1&&u[c+3]===1&&u[c+4]===1&&u[c+5]===0&&u[c+6]===1&&(je.isWhiteHorizontal(u,c-4,c)||je.isWhiteHorizontal(u,c+7,c+11))&&t++,l+6<o&&n[l][c]===1&&n[l+1][c]===0&&n[l+2][c]===1&&n[l+3][c]===1&&n[l+4][c]===1&&n[l+5][c]===0&&n[l+6][c]===1&&(je.isWhiteVertical(n,c,l-4,l)||je.isWhiteVertical(n,c,l+7,l+11))&&t++}return t*je.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let i=t;i<n;i++)if(e[i]===1)return!1;return!0}static isWhiteVertical(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(let o=n;o<i;o++)if(e[o][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight();for(let u=0;u<o;u++){let g=n[u];for(let w=0;w<i;w++)g[w]===1&&t++}let l=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-l)*10/l)*je.N4}static getDataMaskBit(e,t,n){let i,o;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:o=n*t,i=(o&1)+o%3;break;case 6:o=n*t,i=(o&1)+o%3&1;break;case 7:o=n*t,i=o%3+(n+t&1)&1;break;default:throw new x("Invalid mask pattern: "+e)}return i===0}static applyMaskPenaltyRule1Internal(e,t){let n=0,i=t?e.getHeight():e.getWidth(),o=t?e.getWidth():e.getHeight(),l=e.getArray();for(let c=0;c<i;c++){let u=0,g=-1;for(let w=0;w<o;w++){let m=t?l[c][w]:l[w][c];m===g?u++:(u>=5&&(n+=je.N1+(u-5)),u=1,g=m)}u>=5&&(n+=je.N1+(u-5))}return n}}je.N1=3,je.N2=3,je.N3=40,je.N4=10;class Ci{constructor(e,t){this.width=e,this.height=t;let n=new Array(t);for(let i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(let t of this.bytes)H.fill(t,e)}equals(e){if(!(e instanceof Ci))return!1;let t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,i=this.height;n<i;++n){let o=this.bytes[n],l=t.bytes[n];for(let c=0,u=this.width;c<u;++c)if(o[c]!==l[c])return!1}return!0}toString(){let e=new G;for(let t=0,n=this.height;t<n;++t){let i=this.bytes[t];for(let o=0,l=this.width;o<l;++o)switch(i[o]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
`)}return e.toString()}}class vn{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){let e=new G;return e.append(`<<
|
|
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
|
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
|
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
|
maskPattern: `),e.append(this.maskPattern.toString()),this.matrix?(e.append(`
|
|
matrix:
|
|
`),e.append(this.matrix.toString())):e.append(`
|
|
matrix: null
|
|
`),e.append(`>>
|
|
`),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<vn.NUM_MASK_PATTERNS}}vn.NUM_MASK_PATTERNS=8;class ve extends A{}ve.kind="WriterException";class ce{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,i,o){ce.clearMatrix(o),ce.embedBasicPatterns(n,o),ce.embedTypeInfo(t,i,o),ce.maybeEmbedVersionInfo(n,o),ce.embedDataBits(e,i,o)}static embedBasicPatterns(e,t){ce.embedPositionDetectionPatternsAndSeparators(t),ce.embedDarkDotAtLeftBottomCorner(t),ce.maybeEmbedPositionAdjustmentPatterns(e,t),ce.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){let i=new W;ce.makeTypeInfoBits(e,t,i);for(let o=0,l=i.getSize();o<l;++o){let c=i.get(i.getSize()-1-o),u=ce.TYPE_INFO_COORDINATES[o],g=u[0],w=u[1];if(n.setBoolean(g,w,c),o<8){let m=n.getWidth()-o-1;n.setBoolean(m,8,c)}else{let C=n.getHeight()-7+(o-8);n.setBoolean(8,C,c)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;let n=new W;ce.makeVersionInfoBits(e,n);let i=17;for(let o=0;o<6;++o)for(let l=0;l<3;++l){let c=n.get(i);i--,t.setBoolean(o,t.getHeight()-11+l,c),t.setBoolean(t.getHeight()-11+l,o,c)}}static embedDataBits(e,t,n){let i=0,o=-1,l=n.getWidth()-1,c=n.getHeight()-1;for(;l>0;){for(l===6&&(l-=1);c>=0&&c<n.getHeight();){for(let u=0;u<2;++u){let g=l-u;if(!ce.isEmpty(n.get(g,c)))continue;let w;i<e.getSize()?(w=e.get(i),++i):w=!1,t!==255&&je.getDataMaskBit(t,g,c)&&(w=!w),n.setBoolean(g,c,w)}c+=o}o=-o,c+=o,l-=2}if(i!==e.getSize())throw new ve("Not all bits consumed: "+i+"/"+e.getSize())}static findMSBSet(e){return 32-U.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new x("0 polynomial");let n=ce.findMSBSet(t);for(e<<=n-1;ce.findMSBSet(e)>=n;)e^=t<<ce.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!vn.isValidMaskPattern(t))throw new ve("Invalid mask pattern");let i=e.getBits()<<3|t;n.appendBits(i,5);let o=ce.calculateBCHCode(i,ce.TYPE_INFO_POLY);n.appendBits(o,10);let l=new W;if(l.appendBits(ce.TYPE_INFO_MASK_PATTERN,15),n.xor(l),n.getSize()!==15)throw new ve("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let n=ce.calculateBCHCode(e.getVersionNumber(),ce.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ve("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){let n=(t+1)%2;ce.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),ce.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new ve;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let i=0;i<8;++i){if(!ce.isEmpty(n.get(e+i,t)))throw new ve;n.setNumber(e+i,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let i=0;i<7;++i){if(!ce.isEmpty(n.get(e,t+i)))throw new ve;n.setNumber(e,t+i,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let i=0;i<5;++i){let o=ce.POSITION_ADJUSTMENT_PATTERN[i];for(let l=0;l<5;++l)n.setNumber(e+l,t+i,o[l])}}static embedPositionDetectionPattern(e,t,n){for(let i=0;i<7;++i){let o=ce.POSITION_DETECTION_PATTERN[i];for(let l=0;l<7;++l)n.setNumber(e+l,t+i,o[l])}}static embedPositionDetectionPatternsAndSeparators(e){let t=ce.POSITION_DETECTION_PATTERN[0].length;ce.embedPositionDetectionPattern(0,0,e),ce.embedPositionDetectionPattern(e.getWidth()-t,0,e),ce.embedPositionDetectionPattern(0,e.getWidth()-t,e);let n=8;ce.embedHorizontalSeparationPattern(0,n-1,e),ce.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),ce.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);let i=7;ce.embedVerticalSeparationPattern(i,0,e),ce.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),ce.embedVerticalSeparationPattern(i,e.getHeight()-i,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;let n=e.getVersionNumber()-1,i=ce.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let o=0,l=i.length;o!==l;o++){let c=i[o];if(c>=0)for(let u=0;u!==l;u++){let g=i[u];g>=0&&ce.isEmpty(t.get(g,c))&&ce.embedPositionAdjustmentPattern(g-2,c-2,t)}}}}ce.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),ce.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),ce.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),ce.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),ce.VERSION_INFO_POLY=7973,ce.TYPE_INFO_POLY=1335,ce.TYPE_INFO_MASK_PATTERN=21522;class W1{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Fe{constructor(){}static calculateMaskPenalty(e){return je.applyMaskPenaltyRule1(e)+je.applyMaskPenaltyRule2(e)+je.applyMaskPenaltyRule3(e)+je.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let i=Fe.DEFAULT_BYTE_MODE_ENCODING,o=n!==null&&n.get(Je.CHARACTER_SET)!==void 0;o&&(i=n.get(Je.CHARACTER_SET).toString());let l=this.chooseMode(e,i),c=new W;if(l===ae.BYTE&&(o||Fe.DEFAULT_BYTE_MODE_ENCODING!==i)){let Q=O.getCharacterSetECIByName(i);Q!==void 0&&this.appendECI(Q,c)}this.appendModeInfo(l,c);let u=new W;this.appendBytes(e,l,u,i);let g;if(n!==null&&n.get(Je.QR_VERSION)!==void 0){let Q=Number.parseInt(n.get(Je.QR_VERSION).toString(),10);g=se.getVersionForNumber(Q);let j=this.calculateBitsNeeded(l,c,u,g);if(!this.willFit(j,g,t))throw new ve("Data too big for requested version")}else g=this.recommendVersion(t,l,c,u);let w=new W;w.appendBitArray(c);let m=l===ae.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(m,g,l,w),w.appendBitArray(u);let C=g.getECBlocksForLevel(t),b=g.getTotalCodewords()-C.getTotalECCodewords();this.terminateBits(b,w);let S=this.interleaveWithECBytes(w,g.getTotalCodewords(),b,C.getNumBlocks()),T=new vn;T.setECLevel(t),T.setMode(l),T.setVersion(g);let D=g.getDimensionForVersion(),F=new Ci(D,D),Z=this.chooseMaskPattern(S,t,g,F);return T.setMaskPattern(Z),ce.buildMatrix(S,t,g,Z,F),T.setMatrix(F),T}static recommendVersion(e,t,n,i){let o=this.calculateBitsNeeded(t,n,i,se.getVersionForNumber(1)),l=this.chooseVersion(o,e),c=this.calculateBitsNeeded(t,n,i,l);return this.chooseVersion(c,e)}static calculateBitsNeeded(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()}static getAlphanumericCode(e){return e<Fe.ALPHANUMERIC_TABLE.length?Fe.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(O.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return ae.KANJI;let n=!1,i=!1;for(let o=0,l=e.length;o<l;++o){let c=e.charAt(o);if(Fe.isDigit(c))n=!0;else if(this.getAlphanumericCode(c.charCodeAt(0))!==-1)i=!0;else return ae.BYTE}return i?ae.ALPHANUMERIC:n?ae.NUMERIC:ae.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=re.encode(e,O.SJIS)}catch{return!1}let n=t.length;if(n%2!==0)return!1;for(let i=0;i<n;i+=2){let o=t[i]&255;if((o<129||o>159)&&(o<224||o>235))return!1}return!0}static chooseMaskPattern(e,t,n,i){let o=Number.MAX_SAFE_INTEGER,l=-1;for(let c=0;c<vn.NUM_MASK_PATTERNS;c++){ce.buildMatrix(e,t,n,c,i);let u=this.calculateMaskPenalty(i);u<o&&(o=u,l=c)}return l}static chooseVersion(e,t){for(let n=1;n<=40;n++){let i=se.getVersionForNumber(n);if(Fe.willFit(e,i,t))return i}throw new ve("Data too big")}static willFit(e,t,n){let i=t.getTotalCodewords(),l=t.getECBlocksForLevel(n).getTotalECCodewords(),c=i-l,u=(e+7)/8;return c>=u}static terminateBits(e,t){let n=e*8;if(t.getSize()>n)throw new ve("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let l=0;l<4&&t.getSize()<n;++l)t.appendBit(!1);let i=t.getSize()&7;if(i>0)for(let l=i;l<8;l++)t.appendBit(!1);let o=e-t.getSizeInBytes();for(let l=0;l<o;++l)t.appendBits((l&1)===0?236:17,8);if(t.getSize()!==n)throw new ve("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,i,o,l){if(i>=n)throw new ve("Block ID too large");let c=e%n,u=n-c,g=Math.floor(e/n),w=g+1,m=Math.floor(t/n),C=m+1,b=g-m,S=w-C;if(b!==S)throw new ve("EC bytes mismatch");if(n!==u+c)throw new ve("RS blocks mismatch");if(e!==(m+b)*u+(C+S)*c)throw new ve("Total bytes mismatch");i<u?(o[0]=m,l[0]=b):(o[0]=C,l[0]=S)}static interleaveWithECBytes(e,t,n,i){if(e.getSizeInBytes()!==n)throw new ve("Number of bits and data bytes does not match");let o=0,l=0,c=0,u=new Array;for(let w=0;w<i;++w){let m=new Int32Array(1),C=new Int32Array(1);Fe.getNumDataBytesAndNumECBytesForBlockID(t,n,i,w,m,C);let b=m[0],S=new Uint8Array(b);e.toBytes(8*o,S,0,b);let T=Fe.generateECBytes(S,C[0]);u.push(new W1(S,T)),l=Math.max(l,b),c=Math.max(c,T.length),o+=m[0]}if(n!==o)throw new ve("Data bytes does not match offset");let g=new W;for(let w=0;w<l;++w)for(let m of u){let C=m.getDataBytes();w<C.length&&g.appendBits(C[w],8)}for(let w=0;w<c;++w)for(let m of u){let C=m.getErrorCorrectionBytes();w<C.length&&g.appendBits(C[w],8)}if(t!==g.getSizeInBytes())throw new ve("Interleaving error: "+t+" and "+g.getSizeInBytes()+" differ.");return g}static generateECBytes(e,t){let n=e.length,i=new Int32Array(n+t);for(let l=0;l<n;l++)i[l]=e[l]&255;new _s(ye.QR_CODE_FIELD_256).encode(i,t);let o=new Uint8Array(t);for(let l=0;l<t;l++)o[l]=i[n+l];return o}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,i){let o=n.getCharacterCountBits(t);if(e>=1<<o)throw new ve(e+" is bigger than "+((1<<o)-1));i.appendBits(e,o)}static appendBytes(e,t,n,i){switch(t){case ae.NUMERIC:Fe.appendNumericBytes(e,n);break;case ae.ALPHANUMERIC:Fe.appendAlphanumericBytes(e,n);break;case ae.BYTE:Fe.append8BitBytes(e,n,i);break;case ae.KANJI:Fe.appendKanjiBytes(e,n);break;default:throw new ve("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=Fe.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let n=e.length,i=0;for(;i<n;){let o=Fe.getDigit(e.charAt(i));if(i+2<n){let l=Fe.getDigit(e.charAt(i+1)),c=Fe.getDigit(e.charAt(i+2));t.appendBits(o*100+l*10+c,10),i+=3}else if(i+1<n){let l=Fe.getDigit(e.charAt(i+1));t.appendBits(o*10+l,7),i+=2}else t.appendBits(o,4),i++}}static appendAlphanumericBytes(e,t){let n=e.length,i=0;for(;i<n;){let o=Fe.getAlphanumericCode(e.charCodeAt(i));if(o===-1)throw new ve;if(i+1<n){let l=Fe.getAlphanumericCode(e.charCodeAt(i+1));if(l===-1)throw new ve;t.appendBits(o*45+l,11),i+=2}else t.appendBits(o,6),i++}}static append8BitBytes(e,t,n){let i;try{i=re.encode(e,n)}catch(o){throw new ve(o)}for(let o=0,l=i.length;o!==l;o++){let c=i[o];t.appendBits(c,8)}}static appendKanjiBytes(e,t){let n;try{n=re.encode(e,O.SJIS)}catch(o){throw new ve(o)}let i=n.length;for(let o=0;o<i;o+=2){let l=n[o]&255,c=n[o+1]&255,u=l<<8&4294967295|c,g=-1;if(u>=33088&&u<=40956?g=u-33088:u>=57408&&u<=60351&&(g=u-49472),g===-1)throw new ve("Invalid byte sequence");let w=(g>>8)*192+(g&255);t.appendBits(w,13)}}static appendECI(e,t){t.appendBits(ae.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Fe.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Fe.DEFAULT_BYTE_MODE_ENCODING=O.UTF8.getName();class Bn{write(e,t,n,i=null){if(e.length===0)throw new x("Found empty contents");if(t<0||n<0)throw new x("Requested dimensions are too small: "+t+"x"+n);let o=ke.L,l=Bn.QUIET_ZONE_SIZE;i!==null&&(i.get(Je.ERROR_CORRECTION)!==void 0&&(o=ke.fromString(i.get(Je.ERROR_CORRECTION).toString())),i.get(Je.MARGIN)!==void 0&&(l=Number.parseInt(i.get(Je.MARGIN).toString(),10)));let c=Fe.encode(e,o,i);return this.renderResult(c,t,n,l)}writeToDom(e,t,n,i,o=null){typeof e=="string"&&(e=document.querySelector(e));let l=this.write(t,n,i,o);e&&e.appendChild(l)}renderResult(e,t,n,i){let o=e.getMatrix();if(o===null)throw new Wt;let l=o.getWidth(),c=o.getHeight(),u=l+i*2,g=c+i*2,w=Math.max(t,u),m=Math.max(n,g),C=Math.min(Math.floor(w/u),Math.floor(m/g)),b=Math.floor((w-l*C)/2),S=Math.floor((m-c*C)/2),T=this.createSVGElement(w,m);for(let D=0,F=S;D<c;D++,F+=C)for(let Z=0,Q=b;Z<l;Z++,Q+=C)if(o.get(Z,D)===1){let j=this.createSvgRectElement(Q,F,C,C);T.appendChild(j)}return T}createSVGElement(e,t){let n=document.createElementNS(Bn.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,i){let o=document.createElementNS(Bn.SVG_NS,"rect");return o.setAttributeNS(null,"x",e.toString()),o.setAttributeNS(null,"y",t.toString()),o.setAttributeNS(null,"height",n.toString()),o.setAttributeNS(null,"width",i.toString()),o.setAttributeNS(null,"fill","#000000"),o}}Bn.QUIET_ZONE_SIZE=4,Bn.SVG_NS="http://www.w3.org/2000/svg";class er{encode(e,t,n,i,o){if(e.length===0)throw new x("Found empty contents");if(t!==oe.QR_CODE)throw new x("Can only encode QR_CODE, but got "+t);if(n<0||i<0)throw new x(`Requested dimensions are too small: ${n}x${i}`);let l=ke.L,c=er.QUIET_ZONE_SIZE;o!==null&&(o.get(Je.ERROR_CORRECTION)!==void 0&&(l=ke.fromString(o.get(Je.ERROR_CORRECTION).toString())),o.get(Je.MARGIN)!==void 0&&(c=Number.parseInt(o.get(Je.MARGIN).toString(),10)));let u=Fe.encode(e,l,o);return er.renderResult(u,n,i,c)}static renderResult(e,t,n,i){let o=e.getMatrix();if(o===null)throw new Wt;let l=o.getWidth(),c=o.getHeight(),u=l+i*2,g=c+i*2,w=Math.max(t,u),m=Math.max(n,g),C=Math.min(Math.floor(w/u),Math.floor(m/g)),b=Math.floor((w-l*C)/2),S=Math.floor((m-c*C)/2),T=new $(w,m);for(let D=0,F=S;D<c;D++,F+=C)for(let Z=0,Q=b;Z<l;Z++,Q+=C)o.get(Z,D)===1&&T.setRegion(Q,F,C,C);return T}}er.QUIET_ZONE_SIZE=4;class Z1{encode(e,t,n,i,o){let l;if(t===oe.QR_CODE)l=new er;else throw new x("No encoder available for format "+t);return l.encode(e,t,n,i,o)}}class qt extends xe{constructor(e,t,n,i,o,l,c,u){if(super(l,c),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=i,this.top=o,i+l>t||o+c>n)throw new x("Crop rectangle does not fit within image data.");u&&this.reverseHorizontal(l,c)}getRow(e,t){if(e<0||e>=this.getHeight())throw new x("Requested row is outside the image: "+e);let n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));let i=(e+this.top)*this.dataWidth+this.left;return N.arraycopy(this.yuvData,i,t,0,n),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;let n=e*t,i=new Uint8ClampedArray(n),o=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return N.arraycopy(this.yuvData,o,i,0,n),i;for(let l=0;l<t;l++){let c=l*e;N.arraycopy(this.yuvData,o,i,c,e),o+=this.dataWidth}return i}isCropSupported(){return!0}crop(e,t,n,i){return new qt(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,i,!1)}renderThumbnail(){let e=this.getWidth()/qt.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/qt.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),i=this.yuvData,o=this.top*this.dataWidth+this.left;for(let l=0;l<t;l++){let c=l*e;for(let u=0;u<e;u++){let g=i[o+u*qt.THUMBNAIL_SCALE_FACTOR]&255;n[c+u]=4278190080|g*65793}o+=this.dataWidth*qt.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/qt.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/qt.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){let n=this.yuvData;for(let i=0,o=this.top*this.dataWidth+this.left;i<t;i++,o+=this.dataWidth){let l=o+e/2;for(let c=o,u=o+e-1;c<l;c++,u--){let g=n[c];n[c]=n[u],n[u]=g}}}invert(){return new st(this)}}qt.THUMBNAIL_SCALE_FACTOR=2;class ys extends xe{constructor(e,t,n,i,o,l,c){if(super(t,n),this.dataWidth=i,this.dataHeight=o,this.left=l,this.top=c,e.BYTES_PER_ELEMENT===4){let u=t*n,g=new Uint8ClampedArray(u);for(let w=0;w<u;w++){let m=e[w],C=m>>16&255,b=m>>7&510,S=m&255;g[w]=(C+b+S)/4&255}this.luminances=g}else this.luminances=e;if(i===void 0&&(this.dataWidth=t),o===void 0&&(this.dataHeight=n),l===void 0&&(this.left=0),c===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new x("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new x("Requested row is outside the image: "+e);let n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));let i=(e+this.top)*this.dataWidth+this.left;return N.arraycopy(this.luminances,i,t,0,n),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;let n=e*t,i=new Uint8ClampedArray(n),o=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return N.arraycopy(this.luminances,o,i,0,n),i;for(let l=0;l<t;l++){let c=l*e;N.arraycopy(this.luminances,o,i,c,e),o+=this.dataWidth}return i}isCropSupported(){return!0}crop(e,t,n,i){return new ys(this.luminances,n,i,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new st(this)}}class ia extends O{static forName(e){return this.getCharacterSetECIByName(e)}}class Is{}Is.ISO_8859_1=O.ISO8859_1;class sa{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class oa{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Q1{constructor(e){this.previous=e}getPrevious(){return this.previous}}class tr extends Q1{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new tr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new tr(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+U.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class bs extends tr{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new bs(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function K1(E,e,t){return new bs(E,e,t)}function Dr(E,e,t){return new tr(E,e,t)}let q1=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],An=0,_i=1,Bt=2,aa=3,Jt=4,J1=new tr(null,0,0),Ss=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function $1(E){for(let e of E)H.fill(e,-1);return E[An][Jt]=0,E[_i][Jt]=0,E[_i][An]=28,E[aa][Jt]=0,E[Bt][Jt]=0,E[Bt][An]=15,E}let la=$1(H.createInt32Array(6,6));class $t{constructor(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,i=this.token;if(e!==this.mode){let l=Ss[this.mode][e];i=Dr(i,l&65535,l>>16),n+=l>>16}let o=e===Bt?4:5;return i=Dr(i,t,o),new $t(i,e,0,n+o)}shiftAndAppend(e,t){let n=this.token,i=this.mode===Bt?4:5;return n=Dr(n,la[this.mode][e],i),n=Dr(n,t,5),new $t(n,this.mode,0,this.bitCount+i+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,i=this.bitCount;if(this.mode===Jt||this.mode===Bt){let c=Ss[n][An];t=Dr(t,c&65535,c>>16),i+=c>>16,n=An}let o=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,l=new $t(t,n,this.binaryShiftByteCount+1,i+o);return l.binaryShiftByteCount===2078&&(l=l.endBinaryShift(e+1)),l}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=K1(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new $t(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Ss[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=$t.calculateBinaryShiftCost(e)-$t.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let i=this.endBinaryShift(e.length).token;i!==null;i=i.getPrevious())t.unshift(i);let n=new W;for(let i of t)i.appendTo(n,e);return n}toString(){return k.format("%s bits=%d bytes=%d",q1[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}$t.INITIAL_STATE=new $t(J1,An,0,0);function e0(E){let e=k.getCharCode(" "),t=k.getCharCode("."),n=k.getCharCode(",");E[An][e]=1;let i=k.getCharCode("Z"),o=k.getCharCode("A");for(let C=o;C<=i;C++)E[An][C]=C-o+2;E[_i][e]=1;let l=k.getCharCode("z"),c=k.getCharCode("a");for(let C=c;C<=l;C++)E[_i][C]=C-c+2;E[Bt][e]=1;let u=k.getCharCode("9"),g=k.getCharCode("0");for(let C=g;C<=u;C++)E[Bt][C]=C-g+2;E[Bt][n]=12,E[Bt][t]=13;let w=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~","\x7F"];for(let C=0;C<w.length;C++)E[aa][k.getCharCode(w[C])]=C;let m=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let C=0;C<m.length;C++)k.getCharCode(m[C])>0&&(E[Jt][k.getCharCode(m[C])]=C);return E}let Ts=e0(H.createInt32Array(5,256));class vr{constructor(e){this.text=e}encode(){let e=k.getCharCode(" "),t=k.getCharCode(`
|
|
`),n=oa.singletonList($t.INITIAL_STATE);for(let o=0;o<this.text.length;o++){let l,c=o+1<this.text.length?this.text[o+1]:0;switch(this.text[o]){case k.getCharCode("\r"):l=c===t?2:0;break;case k.getCharCode("."):l=c===e?3:0;break;case k.getCharCode(","):l=c===e?4:0;break;case k.getCharCode(":"):l=c===e?5:0;break;default:l=0}l>0?(n=vr.updateStateListForPair(n,o,l),o++):n=this.updateStateListForChar(n,o)}return oa.min(n,(o,l)=>o.getBitCount()-l.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let n=[];for(let i of e)this.updateStateForChar(i,t,n);return vr.simplifyStates(n)}updateStateForChar(e,t,n){let i=this.text[t]&255,o=Ts[e.getMode()][i]>0,l=null;for(let c=0;c<=Jt;c++){let u=Ts[c][i];if(u>0){if(l==null&&(l=e.endBinaryShift(t)),!o||c===e.getMode()||c===Bt){let g=l.latchAndAppend(c,u);n.push(g)}if(!o&&la[e.getMode()][c]>=0){let g=l.shiftAndAppend(c,u);n.push(g)}}}if(e.getBinaryShiftByteCount()>0||Ts[e.getMode()][i]===0){let c=e.addBinaryShiftChar(t);n.push(c)}}static updateStateListForPair(e,t,n){let i=[];for(let o of e)this.updateStateForPair(o,t,n,i);return this.simplifyStates(i)}static updateStateForPair(e,t,n,i){let o=e.endBinaryShift(t);if(i.push(o.latchAndAppend(Jt,n)),e.getMode()!==Jt&&i.push(o.shiftAndAppend(Jt,n)),n===3||n===4){let l=o.latchAndAppend(Bt,16-n).latchAndAppend(Bt,1);i.push(l)}if(e.getBinaryShiftByteCount()>0){let l=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(l)}}static simplifyStates(e){let t=[];for(let n of e){let i=!0;for(let o of t){if(o.isBetterThanOrEqualTo(n)){i=!1;break}n.isBetterThanOrEqualTo(o)&&(t=t.filter(l=>l!==o))}i&&t.push(n)}return t}}class _e{constructor(){}static encodeBytes(e){return _e.encode(e,_e.DEFAULT_EC_PERCENT,_e.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let i=new vr(e).encode(),o=U.truncDivision(i.getSize()*t,100)+11,l=i.getSize()+o,c,u,g,w,m;if(n!==_e.DEFAULT_AZTEC_LAYERS){if(c=n<0,u=Math.abs(n),u>(c?_e.MAX_NB_BITS_COMPACT:_e.MAX_NB_BITS))throw new x(k.format("Illegal value %s for layers",n));g=_e.totalBitsInLayer(u,c),w=_e.WORD_SIZE[u];let j=g-g%w;if(m=_e.stuffBits(i,w),m.getSize()+o>j)throw new x("Data to large for user specified layer");if(c&&m.getSize()>w*64)throw new x("Data to large for user specified layer")}else{w=0,m=null;for(let j=0;;j++){if(j>_e.MAX_NB_BITS)throw new x("Data too large for an Aztec code");if(c=j<=3,u=c?j+1:j,g=_e.totalBitsInLayer(u,c),l>g)continue;(m==null||w!==_e.WORD_SIZE[u])&&(w=_e.WORD_SIZE[u],m=_e.stuffBits(i,w));let we=g-g%w;if(!(c&&m.getSize()>w*64)&&m.getSize()+o<=we)break}}let C=_e.generateCheckWords(m,g,w),b=m.getSize()/w,S=_e.generateModeMessage(c,u,b),T=(c?11:14)+u*4,D=new Int32Array(T),F;if(c){F=T;for(let j=0;j<D.length;j++)D[j]=j}else{F=T+1+2*U.truncDivision(U.truncDivision(T,2)-1,15);let j=U.truncDivision(T,2),we=U.truncDivision(F,2);for(let he=0;he<j;he++){let mt=he+U.truncDivision(he,15);D[j-he-1]=we-mt-1,D[j+he]=we+mt+1}}let Z=new $(F);for(let j=0,we=0;j<u;j++){let he=(u-j)*4+(c?9:12);for(let mt=0;mt<he;mt++){let Gt=mt*2;for(let Ct=0;Ct<2;Ct++)C.get(we+Gt+Ct)&&Z.set(D[j*2+Ct],D[j*2+mt]),C.get(we+he*2+Gt+Ct)&&Z.set(D[j*2+mt],D[T-1-j*2-Ct]),C.get(we+he*4+Gt+Ct)&&Z.set(D[T-1-j*2-Ct],D[T-1-j*2-mt]),C.get(we+he*6+Gt+Ct)&&Z.set(D[T-1-j*2-mt],D[j*2+Ct])}we+=he*8}if(_e.drawModeMessage(Z,c,F,S),c)_e.drawBullsEye(Z,U.truncDivision(F,2),5);else{_e.drawBullsEye(Z,U.truncDivision(F,2),7);for(let j=0,we=0;j<U.truncDivision(T,2)-1;j+=15,we+=16)for(let he=U.truncDivision(F,2)&1;he<F;he+=2)Z.set(U.truncDivision(F,2)-we,he),Z.set(U.truncDivision(F,2)+we,he),Z.set(he,U.truncDivision(F,2)-we),Z.set(he,U.truncDivision(F,2)+we)}let Q=new sa;return Q.setCompact(c),Q.setSize(F),Q.setLayers(u),Q.setCodeWords(b),Q.setMatrix(Z),Q}static drawBullsEye(e,t,n){for(let i=0;i<n;i+=2)for(let o=t-i;o<=t+i;o++)e.set(o,t-i),e.set(o,t+i),e.set(t-i,o),e.set(t+i,o);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let i=new W;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=_e.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=_e.generateCheckWords(i,40,4)),i}static drawModeMessage(e,t,n,i){let o=U.truncDivision(n,2);if(t)for(let l=0;l<7;l++){let c=o-3+l;i.get(l)&&e.set(c,o-5),i.get(l+7)&&e.set(o+5,c),i.get(20-l)&&e.set(c,o+5),i.get(27-l)&&e.set(o-5,c)}else for(let l=0;l<10;l++){let c=o-5+l+U.truncDivision(l,5);i.get(l)&&e.set(c,o-7),i.get(l+10)&&e.set(o+7,c),i.get(29-l)&&e.set(c,o+7),i.get(39-l)&&e.set(o-7,c)}}static generateCheckWords(e,t,n){let i=e.getSize()/n,o=new _s(_e.getGF(n)),l=U.truncDivision(t,n),c=_e.bitsToWords(e,n,l);o.encode(c,l-i);let u=t%n,g=new W;g.appendBits(0,u);for(let w of Array.from(c))g.appendBits(w,n);return g}static bitsToWords(e,t,n){let i=new Int32Array(n),o,l;for(o=0,l=e.getSize()/t;o<l;o++){let c=0;for(let u=0;u<t;u++)c|=e.get(o*t+u)?1<<t-u-1:0;i[o]=c}return i}static getGF(e){switch(e){case 4:return ye.AZTEC_PARAM;case 6:return ye.AZTEC_DATA_6;case 8:return ye.AZTEC_DATA_8;case 10:return ye.AZTEC_DATA_10;case 12:return ye.AZTEC_DATA_12;default:throw new x("Unsupported word size "+e)}}static stuffBits(e,t){let n=new W,i=e.getSize(),o=(1<<t)-2;for(let l=0;l<i;l+=t){let c=0;for(let u=0;u<t;u++)(l+u>=i||e.get(l+u))&&(c|=1<<t-1-u);(c&o)===o?(n.appendBits(c&o,t),l--):(c&o)===0?(n.appendBits(c|1,t),l--):n.appendBits(c,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}_e.DEFAULT_EC_PERCENT=33,_e.DEFAULT_AZTEC_LAYERS=0,_e.MAX_NB_BITS=32,_e.MAX_NB_BITS_COMPACT=4,_e.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class yi{encode(e,t,n,i){return this.encodeWithHints(e,t,n,i,null)}encodeWithHints(e,t,n,i,o){let l=Is.ISO_8859_1,c=_e.DEFAULT_EC_PERCENT,u=_e.DEFAULT_AZTEC_LAYERS;return o!=null&&(o.has(Je.CHARACTER_SET)&&(l=ia.forName(o.get(Je.CHARACTER_SET).toString())),o.has(Je.ERROR_CORRECTION)&&(c=U.parseInt(o.get(Je.ERROR_CORRECTION).toString())),o.has(Je.AZTEC_LAYERS)&&(u=U.parseInt(o.get(Je.AZTEC_LAYERS).toString()))),yi.encodeLayers(e,t,n,i,l,c,u)}static encodeLayers(e,t,n,i,o,l,c){if(t!==oe.AZTEC)throw new x("Can only encode AZTEC, but got "+t);let u=_e.encode(k.getBytes(e,o),l,c);return yi.renderResult(u,n,i)}static renderResult(e,t,n){let i=e.getMatrix();if(i==null)throw new Wt;let o=i.getWidth(),l=i.getHeight(),c=Math.max(t,o),u=Math.max(n,l),g=Math.min(c/o,u/l),w=(c-o*g)/2,m=(u-l*g)/2,C=new $(c,u);for(let b=0,S=m;b<l;b++,S+=g)for(let T=0,D=w;T<o;T++,D+=g)i.get(T,b)&&C.setRegion(D,S,g,g);return C}}r.AbstractExpandedDecoder=hs,r.ArgumentException=y,r.ArithmeticException=ui,r.AztecCode=sa,r.AztecCodeReader=gi,r.AztecCodeWriter=yi,r.AztecDecoder=Le,r.AztecDetector=jo,r.AztecDetectorResult=Xo,r.AztecEncoder=_e,r.AztecHighLevelEncoder=vr,r.AztecPoint=dt,r.BarcodeFormat=oe,r.Binarizer=R,r.BinaryBitmap=_,r.BitArray=W,r.BitMatrix=$,r.BitSource=ws,r.BrowserAztecCodeReader=S1,r.BrowserBarcodeReader=R1,r.BrowserCodeReader=Ht,r.BrowserDatamatrixCodeReader=v1,r.BrowserMultiFormatReader=G1,r.BrowserPDF417Reader=j1,r.BrowserQRCodeReader=Y1,r.BrowserQRCodeSvgWriter=Bn,r.CharacterSetECI=O,r.ChecksumException=v,r.Code128Reader=J,r.Code39Reader=Ke,r.DataMatrixDecodedBitStreamParser=gn,r.DataMatrixReader=xn,r.DecodeHintType=z,r.DecoderResult=_r,r.DefaultGridSampler=Go,r.DetectorResult=di,r.EAN13Reader=Mn,r.EncodeHintType=Je,r.Exception=A,r.FormatException=L,r.GenericGF=ye,r.GenericGFPoly=wt,r.GlobalHistogramBinarizer=ue,r.GridSampler=ls,r.GridSamplerInstance=hn,r.HTMLCanvasElementLuminanceSource=zt,r.HybridBinarizer=q,r.ITFReader=De,r.IllegalArgumentException=x,r.IllegalStateException=Wt,r.InvertedLuminanceSource=st,r.LuminanceSource=xe,r.MathUtils=Ce,r.MultiFormatOneDReader=Jn,r.MultiFormatReader=ra,r.MultiFormatWriter=Z1,r.NotFoundException=M,r.OneDReader=Ze,r.PDF417DecodedBitStreamParser=P,r.PDF417DecoderErrorCorrection=qo,r.PDF417Reader=lt,r.PDF417ResultMetadata=$o,r.PerspectiveTransform=Vt,r.PlanarYUVLuminanceSource=qt,r.QRCodeByteMatrix=Ci,r.QRCodeDataMask=Dt,r.QRCodeDecodedBitStreamParser=Ve,r.QRCodeDecoderErrorCorrectionLevel=ke,r.QRCodeDecoderFormatInformation=ht,r.QRCodeEncoder=Fe,r.QRCodeEncoderQRCode=vn,r.QRCodeMaskUtil=je,r.QRCodeMatrixUtil=ce,r.QRCodeMode=ae,r.QRCodeReader=wn,r.QRCodeVersion=se,r.QRCodeWriter=er,r.RGBLuminanceSource=ys,r.RSS14Reader=Ge,r.RSSExpandedReader=X,r.ReaderException=mi,r.ReedSolomonDecoder=Ir,r.ReedSolomonEncoder=_s,r.ReedSolomonException=Zn,r.Result=Ye,r.ResultMetadataType=et,r.ResultPoint=ie,r.StringUtils=k,r.UnsupportedOperationException=le,r.VideoInputDevice=Cr,r.WhiteRectangleDetector=on,r.WriterException=ve,r.ZXingArrays=H,r.ZXingCharset=ia,r.ZXingInteger=U,r.ZXingStandardCharsets=Is,r.ZXingStringBuilder=G,r.ZXingStringEncoding=re,r.ZXingSystem=N,r.createAbstractExpandedDecoder=Qo,Object.defineProperty(r,"__esModule",{value:!0})}))});var Fo=Se((l1,es)=>{(function(r,a){"use strict";var s=Math.pow(2,-24),f=Math.pow(2,32),d=Math.pow(2,53);function h(y){var x=new ArrayBuffer(256),_=new DataView(x),v,R=0;function N(k){for(var G=x.byteLength,$=R+k;G<$;)G*=2;if(G!==x.byteLength){var M=_;x=new ArrayBuffer(G),_=new DataView(x);for(var ue=R+3>>2,q=0;q<ue;++q)_.setUint32(q*4,M.getUint32(q*4))}return v=k,_}function V(){R+=v}function K(k){V(N(8).setFloat64(R,k))}function H(k){V(N(1).setUint8(R,k))}function U(k){for(var G=N(k.length),$=0;$<k.length;++$)G.setUint8(R+$,k[$]);V()}function W(k){V(N(2).setUint16(R,k))}function te(k){V(N(4).setUint32(R,k))}function z(k){var G=k%f,$=(k-G)/f,M=N(8);M.setUint32(R,$),M.setUint32(R+4,G),V()}function L(k,G){G<24?H(k<<5|G):G<256?(H(k<<5|24),H(G)):G<65536?(H(k<<5|25),W(G)):G<4294967296?(H(k<<5|26),te(G)):(H(k<<5|27),z(G))}function Y(k){var G;if(k===!1)return H(244);if(k===!0)return H(245);if(k===null)return H(246);if(k===a)return H(247);switch(typeof k){case"number":if(Math.floor(k)===k){if(0<=k&&k<=d)return L(0,k);if(-d<=k&&k<0)return L(1,-(k+1))}return H(251),K(k);case"string":var $=[];for(G=0;G<k.length;++G){var M=k.charCodeAt(G);M<128?$.push(M):M<2048?($.push(192|M>>6),$.push(128|M&63)):M<55296?($.push(224|M>>12),$.push(128|M>>6&63),$.push(128|M&63)):(M=(M&1023)<<10,M|=k.charCodeAt(++G)&1023,M+=65536,$.push(240|M>>18),$.push(128|M>>12&63),$.push(128|M>>6&63),$.push(128|M&63))}return L(3,$.length),U($);default:var ue;if(Array.isArray(k))for(ue=k.length,L(4,ue),G=0;G<ue;++G)Y(k[G]);else if(k instanceof Uint8Array)L(2,k.length),U(k);else{var q=Object.keys(k);for(ue=q.length,L(5,ue),G=0;G<ue;++G){var xe=q[G];Y(xe),Y(k[xe])}}}}if(Y(y),"slice"in x)return x.slice(0,R);for(var O=new ArrayBuffer(R),le=new DataView(O),re=0;re<R;++re)le.setUint8(re,_.getUint8(re));return O}function p(y,x,_){var v=new DataView(y),R=0;typeof x!="function"&&(x=function($){return $}),typeof _!="function"&&(_=function(){return a});function N($,M){return R+=M,$}function V($){return N(new Uint8Array(y,R,$),$)}function K(){var $=new ArrayBuffer(4),M=new DataView($),ue=te(),q=ue&32768,xe=ue&31744,st=ue&1023;if(xe===31744)xe=261120;else if(xe!==0)xe+=114688;else if(st!==0)return st*s;return M.setUint32(0,q<<16|xe<<13|st<<13),M.getFloat32(0)}function H(){return N(v.getFloat32(R),4)}function U(){return N(v.getFloat64(R),8)}function W(){return N(v.getUint8(R),1)}function te(){return N(v.getUint16(R),2)}function z(){return N(v.getUint32(R),4)}function L(){return z()*f+z()}function Y(){return v.getUint8(R)!==255?!1:(R+=1,!0)}function O($){if($<24)return $;if($===24)return W();if($===25)return te();if($===26)return z();if($===27)return L();if($===31)return-1;throw"Invalid length encoding"}function le($){var M=W();if(M===255)return-1;var ue=O(M&31);if(ue<0||M>>5!==$)throw"Invalid indefinite length element";return ue}function re($,M){for(var ue=0;ue<M;++ue){var q=W();q&128&&(q<224?(q=(q&31)<<6|W()&63,M-=1):q<240?(q=(q&15)<<12|(W()&63)<<6|W()&63,M-=2):(q=(q&15)<<18|(W()&63)<<12|(W()&63)<<6|W()&63,M-=3)),q<65536?$.push(q):(q-=65536,$.push(55296|q>>10),$.push(56320|q&1023))}}function k(){var $=W(),M=$>>5,ue=$&31,q,xe;if(M===7)switch(ue){case 25:return K();case 26:return H();case 27:return U()}if(xe=O(ue),xe<0&&(M<2||6<M))throw"Invalid length";switch(M){case 0:return xe;case 1:return-1-xe;case 2:if(xe<0){for(var st=[],zt=0;(xe=le(M))>=0;)zt+=xe,st.push(V(xe));var Cr=new Uint8Array(zt),$e=0;for(q=0;q<st.length;++q)Cr.set(st[q],$e),$e+=st[q].length;return Cr}return V(xe);case 3:var Ht=[];if(xe<0)for(;(xe=le(M))>=0;)re(Ht,xe);else re(Ht,xe);return String.fromCharCode.apply(null,Ht);case 4:var Ye;if(xe<0)for(Ye=[];!Y();)Ye.push(k());else for(Ye=new Array(xe),q=0;q<xe;++q)Ye[q]=k();return Ye;case 5:var Wn={};for(q=0;q<xe||xe<0&&!Y();++q){var oe=k();Wn[oe]=k()}return Wn;case 6:return x(k(),xe);case 7:switch(xe){case 20:return!1;case 21:return!0;case 22:return null;case 23:return a;default:return _(xe)}}}var G=k();if(R!==y.byteLength)throw"Remaining bytes";return G}var A={encode:h,decode:p};typeof define=="function"&&define.amd?define("cbor/cbor",A):typeof es<"u"&&es.exports?es.exports=A:r.CBOR||(r.CBOR=A)})(l1)});var u1=Se(ts=>{"use strict";ts.byteLength=ld;ts.toByteArray=fd;ts.fromByteArray=dd;var sn=[],Ut=[],ad=typeof Uint8Array<"u"?Uint8Array:Array,Uo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Yn=0,c1=Uo.length;Yn<c1;++Yn)sn[Yn]=Uo[Yn],Ut[Uo.charCodeAt(Yn)]=Yn;var Yn,c1;Ut[45]=62;Ut[95]=63;function f1(r){var a=r.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var s=r.indexOf("=");s===-1&&(s=a);var f=s===a?0:4-s%4;return[s,f]}function ld(r){var a=f1(r),s=a[0],f=a[1];return(s+f)*3/4-f}function cd(r,a,s){return(a+s)*3/4-s}function fd(r){var a,s=f1(r),f=s[0],d=s[1],h=new ad(cd(r,f,d)),p=0,A=d>0?f-4:f,y;for(y=0;y<A;y+=4)a=Ut[r.charCodeAt(y)]<<18|Ut[r.charCodeAt(y+1)]<<12|Ut[r.charCodeAt(y+2)]<<6|Ut[r.charCodeAt(y+3)],h[p++]=a>>16&255,h[p++]=a>>8&255,h[p++]=a&255;return d===2&&(a=Ut[r.charCodeAt(y)]<<2|Ut[r.charCodeAt(y+1)]>>4,h[p++]=a&255),d===1&&(a=Ut[r.charCodeAt(y)]<<10|Ut[r.charCodeAt(y+1)]<<4|Ut[r.charCodeAt(y+2)]>>2,h[p++]=a>>8&255,h[p++]=a&255),h}function ud(r){return sn[r>>18&63]+sn[r>>12&63]+sn[r>>6&63]+sn[r&63]}function hd(r,a,s){for(var f,d=[],h=a;h<s;h+=3)f=(r[h]<<16&16711680)+(r[h+1]<<8&65280)+(r[h+2]&255),d.push(ud(f));return d.join("")}function dd(r){for(var a,s=r.length,f=s%3,d=[],h=16383,p=0,A=s-f;p<A;p+=h)d.push(hd(r,p,p+h>A?A:p+h));return f===1?(a=r[s-1],d.push(sn[a>>2]+sn[a<<4&63]+"==")):f===2&&(a=(r[s-2]<<8)+r[s-1],d.push(sn[a>>10]+sn[a>>4&63]+sn[a<<2&63]+"=")),d.join("")}});var m1=Br(cl());var ee;(function(r){r[r.QR_CODE=0]="QR_CODE",r[r.AZTEC=1]="AZTEC",r[r.CODABAR=2]="CODABAR",r[r.CODE_39=3]="CODE_39",r[r.CODE_93=4]="CODE_93",r[r.CODE_128=5]="CODE_128",r[r.DATA_MATRIX=6]="DATA_MATRIX",r[r.MAXICODE=7]="MAXICODE",r[r.ITF=8]="ITF",r[r.EAN_13=9]="EAN_13",r[r.EAN_8=10]="EAN_8",r[r.PDF_417=11]="PDF_417",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(ee||(ee={}));var fl=new Map([[ee.QR_CODE,"QR_CODE"],[ee.AZTEC,"AZTEC"],[ee.CODABAR,"CODABAR"],[ee.CODE_39,"CODE_39"],[ee.CODE_93,"CODE_93"],[ee.CODE_128,"CODE_128"],[ee.DATA_MATRIX,"DATA_MATRIX"],[ee.MAXICODE,"MAXICODE"],[ee.ITF,"ITF"],[ee.EAN_13,"EAN_13"],[ee.EAN_8,"EAN_8"],[ee.PDF_417,"PDF_417"],[ee.RSS_14,"RSS_14"],[ee.RSS_EXPANDED,"RSS_EXPANDED"],[ee.UPC_A,"UPC_A"],[ee.UPC_E,"UPC_E"],[ee.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),ul;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.URL=1]="URL"})(ul||(ul={}));function hl(r){return Object.values(ee).includes(r)}var jt;(function(r){r[r.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",r[r.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(jt||(jt={}));var _t=(function(){function r(){}return r.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",r.SCAN_DEFAULT_FPS=2,r.DEFAULT_DISABLE_FLIP=!1,r.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,r.DEFAULT_SUPPORTED_SCAN_TYPE=[jt.SCAN_TYPE_CAMERA,jt.SCAN_TYPE_FILE],r})();var Li=(function(){function r(a,s){this.format=a,this.formatName=s}return r.prototype.toString=function(){return this.formatName},r.create=function(a){if(!fl.has(a))throw"".concat(a," not in html5QrcodeSupportedFormatsTextMap");return new r(a,fl.get(a))},r})();var Js=(function(){function r(){}return r.createFromText=function(a){var s={text:a};return{decodedText:a,result:s}},r.createFromQrcodeResult=function(a){return{decodedText:a.text,result:a}},r})();var qs;(function(r){r[r.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",r[r.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",r[r.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(qs||(qs={}));var ki=(function(){function r(){}return r.createFrom=function(a){return{errorMessage:a,type:qs.UNKWOWN_ERROR}},r})();var Pi=(function(){function r(a){this.verbose=a}return r.prototype.log=function(a){this.verbose&&console.log(a)},r.prototype.warn=function(a){this.verbose&&console.warn(a)},r.prototype.logError=function(a,s){(this.verbose||s===!0)&&console.error(a)},r.prototype.logErrors=function(a){if(a.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(a)},r})();function kt(r){return typeof r>"u"||r===null}function dl(r,a,s){return r>s?s:r<a?a:r}var yn=(function(){function r(){}return r.codeParseError=function(a){return"QR code parse error, error = ".concat(a)},r.errorGettingUserMedia=function(a){return"Error getting userMedia, error = ".concat(a)},r.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},r.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},r.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},r.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},r.scannerPaused=function(){return"Scanner paused"},r})();var Ee=(function(){function r(){}return r.scanningStatus=function(){return"Scanning"},r.idleStatus=function(){return"Idle"},r.errorStatus=function(){return"Error"},r.permissionStatus=function(){return"Permission"},r.noCameraFoundErrorStatus=function(){return"No Cameras"},r.lastMatch=function(a){return"Last Match: ".concat(a)},r.codeScannerTitle=function(){return"Code Scanner"},r.cameraPermissionTitle=function(){return"Request Camera Permissions"},r.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},r.noCameraFound=function(){return"No camera found"},r.scanButtonStopScanningText=function(){return"Stop Scanning"},r.scanButtonStartScanningText=function(){return"Start Scanning"},r.torchOnButton=function(){return"Switch On Torch"},r.torchOffButton=function(){return"Switch Off Torch"},r.torchOnFailedMessage=function(){return"Failed to turn on torch"},r.torchOffFailedMessage=function(){return"Failed to turn off torch"},r.scanButtonScanningStarting=function(){return"Launching Camera..."},r.textIfCameraScanSelected=function(){return"Scan an Image File"},r.textIfFileScanSelected=function(){return"Scan using camera directly"},r.selectCamera=function(){return"Select Camera"},r.fileSelectionChooseImage=function(){return"Choose Image"},r.fileSelectionChooseAnother=function(){return"Choose Another"},r.fileSelectionNoImageSelected=function(){return"No image choosen"},r.anonymousCameraPrefix=function(){return"Anonymous Camera"},r.dragAndDropMessage=function(){return"Or drop an image to scan"},r.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},r.zoom=function(){return"zoom"},r.loadingImage=function(){return"Loading image..."},r.cameraScanAltText=function(){return"Camera based scan"},r.fileScanAltText=function(){return"Fule based scan"},r})();var $s=(function(){function r(){}return r.poweredBy=function(){return"Powered by "},r.reportIssues=function(){return"Report issues"},r})();var eo=(function(){function r(){}return r.isMediaStreamConstraintsValid=function(a,s){if(typeof a!="object"){var f=typeof a;return s.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(f,"."),!0),!1}for(var d=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],h=new Set(d),p=Object.keys(a),A=0,y=p;A<y.length;A++){var x=y[A];if(h.has(x))return s.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},r})();var Oe=Br(xl());var to=(function(){function r(a,s,f){if(this.formatMap=new Map([[ee.QR_CODE,Oe.BarcodeFormat.QR_CODE],[ee.AZTEC,Oe.BarcodeFormat.AZTEC],[ee.CODABAR,Oe.BarcodeFormat.CODABAR],[ee.CODE_39,Oe.BarcodeFormat.CODE_39],[ee.CODE_93,Oe.BarcodeFormat.CODE_93],[ee.CODE_128,Oe.BarcodeFormat.CODE_128],[ee.DATA_MATRIX,Oe.BarcodeFormat.DATA_MATRIX],[ee.MAXICODE,Oe.BarcodeFormat.MAXICODE],[ee.ITF,Oe.BarcodeFormat.ITF],[ee.EAN_13,Oe.BarcodeFormat.EAN_13],[ee.EAN_8,Oe.BarcodeFormat.EAN_8],[ee.PDF_417,Oe.BarcodeFormat.PDF_417],[ee.RSS_14,Oe.BarcodeFormat.RSS_14],[ee.RSS_EXPANDED,Oe.BarcodeFormat.RSS_EXPANDED],[ee.UPC_A,Oe.BarcodeFormat.UPC_A],[ee.UPC_E,Oe.BarcodeFormat.UPC_E],[ee.UPC_EAN_EXTENSION,Oe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Oe)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=s,this.logger=f;var d=this.createZXingFormats(a),h=new Map;h.set(Oe.DecodeHintType.POSSIBLE_FORMATS,d),h.set(Oe.DecodeHintType.TRY_HARDER,!1),this.hints=h}return r.prototype.decodeAsync=function(a){var s=this;return new Promise(function(f,d){try{f(s.decode(a))}catch(h){d(h)}})},r.prototype.decode=function(a){var s=new Oe.MultiFormatReader(this.verbose,this.hints),f=new Oe.HTMLCanvasElementLuminanceSource(a),d=new Oe.BinaryBitmap(new Oe.HybridBinarizer(f)),h=s.decode(d);return{text:h.text,format:Li.create(this.toHtml5QrcodeSupportedFormats(h.format)),debugData:this.createDebugData()}},r.prototype.createReverseFormatMap=function(){var a=new Map;return this.formatMap.forEach(function(s,f,d){a.set(s,f)}),a},r.prototype.toHtml5QrcodeSupportedFormats=function(a){if(!this.reverseFormatMap.has(a))throw"reverseFormatMap doesn't have ".concat(a);return this.reverseFormatMap.get(a)},r.prototype.createZXingFormats=function(a){for(var s=[],f=0,d=a;f<d.length;f++){var h=d[f];this.formatMap.has(h)?s.push(this.formatMap.get(h)):this.logger.logError("".concat(h," is not supported by")+"ZXingHtml5QrcodeShim")}return s},r.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},r})();var nf=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},rf=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},no=(function(){function r(a,s,f){if(this.formatMap=new Map([[ee.QR_CODE,"qr_code"],[ee.AZTEC,"aztec"],[ee.CODABAR,"codabar"],[ee.CODE_39,"code_39"],[ee.CODE_93,"code_93"],[ee.CODE_128,"code_128"],[ee.DATA_MATRIX,"data_matrix"],[ee.ITF,"itf"],[ee.EAN_13,"ean_13"],[ee.EAN_8,"ean_8"],[ee.PDF_417,"pdf417"],[ee.UPC_A,"upc_a"],[ee.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!r.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=s,this.logger=f;var d=this.createBarcodeDetectorFormats(a);if(this.detector=new BarcodeDetector(d),!this.detector)throw"BarcodeDetector detector not supported"}return r.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var a=new BarcodeDetector({formats:["qr_code"]});return typeof a<"u"},r.prototype.decodeAsync=function(a){return nf(this,void 0,void 0,function(){var s,f;return rf(this,function(d){switch(d.label){case 0:return[4,this.detector.detect(a)];case 1:if(s=d.sent(),!s||s.length===0)throw"No barcode or QR code detected.";return f=this.selectLargestBarcode(s),[2,{text:f.rawValue,format:Li.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}]}})})},r.prototype.selectLargestBarcode=function(a){for(var s=null,f=0,d=0,h=a;d<h.length;d++){var p=h[d],A=p.boundingBox.width*p.boundingBox.height;A>f&&(f=A,s=p)}if(!s)throw"No largest barcode found";return s},r.prototype.createBarcodeDetectorFormats=function(a){for(var s=[],f=0,d=a;f<d.length;f++){var h=d[f];this.formatMap.has(h)?s.push(this.formatMap.get(h)):this.logger.warn("".concat(h," is not supported by")+"BarcodeDetectorDelegate")}return{formats:s}},r.prototype.toHtml5QrcodeSupportedFormats=function(a){if(!this.reverseFormatMap.has(a))throw"reverseFormatMap doesn't have ".concat(a);return this.reverseFormatMap.get(a)},r.prototype.createReverseFormatMap=function(){var a=new Map;return this.formatMap.forEach(function(s,f,d){a.set(s,f)}),a},r.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},r})();var wl=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},pl=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Al=(function(){function r(a,s,f,d){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=f,s&&no.isSupported()?(this.primaryDecoder=new no(a,f,d),this.secondaryDecoder=new to(a,f,d)):this.primaryDecoder=new to(a,f,d)}return r.prototype.decodeAsync=function(a){return wl(this,void 0,void 0,function(){var s;return pl(this,function(f){switch(f.label){case 0:s=performance.now(),f.label=1;case 1:return f.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(a)];case 2:return[2,f.sent()];case 3:return this.possiblyLogPerformance(s),[7];case 4:return[2]}})})},r.prototype.decodeRobustlyAsync=function(a){return wl(this,void 0,void 0,function(){var s,f;return pl(this,function(d){switch(d.label){case 0:s=performance.now(),d.label=1;case 1:return d.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(a)];case 2:return[2,d.sent()];case 3:if(f=d.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(a)];throw f;case 4:return this.possiblyLogPerformance(s),[7];case 5:return[2]}})})},r.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},r.prototype.possiblyLogPerformance=function(a){if(this.verbose){var s=performance.now()-a;this.executionResults.push(s),this.executions++,this.possiblyFlushPerformanceReport()}},r.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var a=0,s=0,f=this.executionResults;s<f.length;s++){var d=f[s];a+=d}var h=a/this.executionResults.length;console.log("".concat(h," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},r})();var ro=(function(){var r=function(a,s){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,d){f.__proto__=d}||function(f,d){for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(f[h]=d[h])},r(a,s)};return function(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");r(a,s);function f(){this.constructor=a}a.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}})(),Ui=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},zi=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},El=(function(){function r(a,s){this.name=a,this.track=s}return r.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},r.prototype.apply=function(a){var s={};s[this.name]=a;var f={advanced:[s]};return this.track.applyConstraints(f)},r.prototype.value=function(){var a=this.track.getSettings();if(this.name in a){var s=a[this.name];return s}return null},r})(),sf=(function(r){ro(a,r);function a(s,f){return r.call(this,s,f)||this}return a.prototype.min=function(){return this.getCapabilities().min},a.prototype.max=function(){return this.getCapabilities().max},a.prototype.step=function(){return this.getCapabilities().step},a.prototype.apply=function(s){var f={};f[this.name]=s;var d={advanced:[f]};return this.track.applyConstraints(d)},a.prototype.getCapabilities=function(){this.failIfNotSupported();var s=this.track.getCapabilities(),f=s[this.name];return{min:f.min,max:f.max,step:f.step}},a.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},a})(El),of=(function(r){ro(a,r);function a(s){return r.call(this,"zoom",s)||this}return a})(sf),af=(function(r){ro(a,r);function a(s){return r.call(this,"torch",s)||this}return a})(El),lf=(function(){function r(a){this.track=a}return r.prototype.zoomFeature=function(){return new of(this.track)},r.prototype.torchFeature=function(){return new af(this.track)},r})(),cf=(function(){function r(a,s,f){this.isClosed=!1,this.parentElement=a,this.mediaStream=s,this.callbacks=f,this.surface=this.createVideoElement(this.parentElement.clientWidth),a.append(this.surface)}return r.prototype.createVideoElement=function(a){var s=document.createElement("video");return s.style.width="".concat(a,"px"),s.style.display="block",s.muted=!0,s.setAttribute("muted","true"),s.playsInline=!0,s},r.prototype.setupSurface=function(){var a=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var s=function(){var f=a.surface.clientWidth,d=a.surface.clientHeight;a.callbacks.onRenderSurfaceReady(f,d),a.surface.removeEventListener("playing",s)};this.surface.addEventListener("playing",s),this.surface.srcObject=this.mediaStream,this.surface.play()},r.create=function(a,s,f,d){return Ui(this,void 0,void 0,function(){var h,p;return zi(this,function(A){switch(A.label){case 0:return h=new r(a,s,d),f.aspectRatio?(p={aspectRatio:f.aspectRatio},[4,h.getFirstTrackOrFail().applyConstraints(p)]):[3,2];case 1:A.sent(),A.label=2;case 2:return h.setupSurface(),[2,h]}})})},r.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},r.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},r.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},r.prototype.resume=function(a){this.failIfClosed();var s=this,f=function(){setTimeout(a,200),s.surface.removeEventListener("playing",f)};this.surface.addEventListener("playing",f),this.surface.play()},r.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},r.prototype.getSurface=function(){return this.failIfClosed(),this.surface},r.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},r.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},r.prototype.applyVideoConstraints=function(a){return Ui(this,void 0,void 0,function(){return zi(this,function(s){if("aspectRatio"in a)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(a)]})})},r.prototype.close=function(){if(this.isClosed)return Promise.resolve();var a=this;return new Promise(function(s,f){var d=a.mediaStream.getVideoTracks(),h=d.length,p=0;a.mediaStream.getVideoTracks().forEach(function(A){a.mediaStream.removeTrack(A),A.stop(),++p,p>=h&&(a.isClosed=!0,a.parentElement.removeChild(a.surface),s())})})},r.prototype.getCapabilities=function(){return new lf(this.getFirstTrackOrFail())},r})(),ml=(function(){function r(a){this.mediaStream=a}return r.prototype.render=function(a,s,f){return Ui(this,void 0,void 0,function(){return zi(this,function(d){return[2,cf.create(a,this.mediaStream,s,f)]})})},r.create=function(a){return Ui(this,void 0,void 0,function(){var s,f;return zi(this,function(d){switch(d.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return s={audio:!1,video:a},[4,navigator.mediaDevices.getUserMedia(s)];case 1:return f=d.sent(),[2,new r(f)]}})})},r})();var Cl=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},_l=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},yl=(function(){function r(){}return r.failIfNotSupported=function(){return Cl(this,void 0,void 0,function(){return _l(this,function(a){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new r]})})},r.prototype.create=function(a){return Cl(this,void 0,void 0,function(){return _l(this,function(s){return[2,ml.create(a)]})})},r})();var ff=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},uf=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Il=(function(){function r(){}return r.retrieve=function(){if(navigator.mediaDevices)return r.getCamerasFromMediaDevices();var a=MediaStreamTrack;return MediaStreamTrack&&a.getSources?r.getCamerasFromMediaStreamTrack():r.rejectWithError()},r.rejectWithError=function(){var a=yn.unableToQuerySupportedDevices();return r.isHttpsOrLocalhost()||(a=yn.insecureContextCameraQueryError()),Promise.reject(a)},r.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var a=location.host.split(":")[0];return a==="127.0.0.1"||a==="localhost"},r.getCamerasFromMediaDevices=function(){return ff(this,void 0,void 0,function(){var a,s,f,d,h,p,A;return uf(this,function(y){switch(y.label){case 0:return a=function(x){for(var _=x.getVideoTracks(),v=0,R=_;v<R.length;v++){var N=R[v];N.enabled=!1,N.stop(),x.removeTrack(N)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return s=y.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(f=y.sent(),d=[],h=0,p=f;h<p.length;h++)A=p[h],A.kind==="videoinput"&&d.push({id:A.deviceId,label:A.label});return a(s),[2,d]}})})},r.getCamerasFromMediaStreamTrack=function(){return new Promise(function(a,s){var f=function(h){for(var p=[],A=0,y=h;A<y.length;A++){var x=y[A];x.kind==="video"&&p.push({id:x.id,label:x.label})}a(p)},d=MediaStreamTrack;d.getSources(f)})},r})();var ze;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.NOT_STARTED=1]="NOT_STARTED",r[r.SCANNING=2]="SCANNING",r[r.PAUSED=3]="PAUSED"})(ze||(ze={}));var hf=(function(){function r(){this.state=ze.NOT_STARTED,this.onGoingTransactionNewState=ze.UNKNOWN}return r.prototype.directTransition=function(a){this.failIfTransitionOngoing(),this.validateTransition(a),this.state=a},r.prototype.startTransition=function(a){return this.failIfTransitionOngoing(),this.validateTransition(a),this.onGoingTransactionNewState=a,this},r.prototype.execute=function(){if(this.onGoingTransactionNewState===ze.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var a=this.onGoingTransactionNewState;this.onGoingTransactionNewState=ze.UNKNOWN,this.directTransition(a)},r.prototype.cancel=function(){if(this.onGoingTransactionNewState===ze.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=ze.UNKNOWN},r.prototype.getState=function(){return this.state},r.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==ze.UNKNOWN)throw"Cannot transition to a new state, already under transition"},r.prototype.validateTransition=function(a){switch(this.state){case ze.UNKNOWN:throw"Transition from unknown is not allowed";case ze.NOT_STARTED:this.failIfNewStateIs(a,[ze.PAUSED]);break;case ze.SCANNING:break;case ze.PAUSED:break}},r.prototype.failIfNewStateIs=function(a,s){for(var f=0,d=s;f<d.length;f++){var h=d[f];if(a===h)throw"Cannot transition from ".concat(this.state," to ").concat(a)}},r})(),df=(function(){function r(a){this.stateManager=a}return r.prototype.startTransition=function(a){return this.stateManager.startTransition(a)},r.prototype.directTransition=function(a){this.stateManager.directTransition(a)},r.prototype.getState=function(){return this.stateManager.getState()},r.prototype.canScanFile=function(){return this.stateManager.getState()===ze.NOT_STARTED},r.prototype.isScanning=function(){return this.stateManager.getState()!==ze.NOT_STARTED},r.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===ze.SCANNING},r.prototype.isPaused=function(){return this.stateManager.getState()===ze.PAUSED},r})();var bl=(function(){function r(){}return r.create=function(){return new df(new hf)},r})();var gf=(function(){var r=function(a,s){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,d){f.__proto__=d}||function(f,d){for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(f[h]=d[h])},r(a,s)};return function(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");r(a,s);function f(){this.constructor=a}a.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}})(),St=(function(r){gf(a,r);function a(){return r!==null&&r.apply(this,arguments)||this}return a.DEFAULT_WIDTH=300,a.DEFAULT_WIDTH_OFFSET=2,a.FILE_SCAN_MIN_HEIGHT=300,a.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,a.MIN_QR_BOX_SIZE=50,a.SHADED_LEFT=1,a.SHADED_RIGHT=2,a.SHADED_TOP=3,a.SHADED_BOTTOM=4,a.SHADED_REGION_ELEMENT_ID="qr-shaded-region",a.VERBOSE=!1,a.BORDER_SHADER_DEFAULT_COLOR="#ffffff",a.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",a})(_t),xf=(function(){function r(a,s){this.logger=s,this.fps=St.SCAN_DEFAULT_FPS,a?(a.fps&&(this.fps=a.fps),this.disableFlip=a.disableFlip===!0,this.qrbox=a.qrbox,this.aspectRatio=a.aspectRatio,this.videoConstraints=a.videoConstraints):this.disableFlip=St.DEFAULT_DISABLE_FLIP}return r.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?eo.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},r.prototype.isShadedBoxEnabled=function(){return!kt(this.qrbox)},r.create=function(a,s){return new r(a,s)},r})(),cr=(function(){function r(a,s){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(a))throw"HTML Element with id=".concat(a," not found");this.elementId=a,this.verbose=!1;var f,d;typeof s=="boolean"?this.verbose=s===!0:s&&(d=s,this.verbose=d.verbose===!0,f=d.experimentalFeatures),this.logger=new Pi(this.verbose),this.qrcode=new Al(this.getSupportedFormats(s),this.getUseBarCodeDetectorIfSupported(d),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=bl.create()}return r.prototype.start=function(a,s,f,d){var h=this;if(!a)throw"cameraIdOrConfig is required";if(!f||typeof f!="function")throw"qrCodeSuccessCallback is required and should be a function.";var p;d?p=d:p=this.verbose?this.logger.log:function(){};var A=xf.create(s,this.logger);this.clearElement();var y=!1;A.videoConstraints&&(A.isMediaStreamConstraintsValid()?y=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=y,_=document.getElementById(this.elementId),v=_.clientWidth?_.clientWidth:St.DEFAULT_WIDTH;_.style.position="relative",this.shouldScan=!0,this.element=_;var R=this,N=this.stateManagerProxy.startTransition(ze.SCANNING);return new Promise(function(V,K){var H=x?A.videoConstraints:R.createVideoConstraints(a);if(!H){N.cancel(),K("videoConstraints should be defined");return}var U={};(!x||A.aspectRatio)&&(U.aspectRatio=A.aspectRatio);var W={onRenderSurfaceReady:function(te,z){R.setupUi(te,z,A),R.isScanning=!0,R.foreverScan(A,f,p)}};yl.failIfNotSupported().then(function(te){te.create(H).then(function(z){return z.render(h.element,U,W).then(function(L){R.renderedCamera=L,N.execute(),V(null)}).catch(function(L){N.cancel(),K(L)})}).catch(function(z){N.cancel(),K(yn.errorGettingUserMedia(z))})}).catch(function(te){N.cancel(),K(yn.cameraStreamingNotSupported())})})},r.prototype.pause=function(a){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(ze.PAUSED),this.showPausedState(),(kt(a)||a!==!0)&&(a=!1),a&&this.renderedCamera&&this.renderedCamera.pause()},r.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var a=this,s=function(){a.stateManagerProxy.directTransition(ze.SCANNING),a.hidePausedState()};if(!this.renderedCamera.isPaused()){s();return}this.renderedCamera.resume(function(){s()})},r.prototype.getState=function(){return this.stateManagerProxy.getState()},r.prototype.stop=function(){var a=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var s=this.stateManagerProxy.startTransition(ze.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var f=function(){if(a.element){var h=document.getElementById(St.SHADED_REGION_ELEMENT_ID);h&&a.element.removeChild(h)}},d=this;return this.renderedCamera.close().then(function(){return d.renderedCamera=null,d.element&&(d.element.removeChild(d.canvasElement),d.canvasElement=null),f(),d.qrRegion&&(d.qrRegion=null),d.context&&(d.context=null),s.execute(),d.hidePausedState(),d.isScanning=!1,Promise.resolve()})},r.prototype.scanFile=function(a,s){return this.scanFileV2(a,s).then(function(f){return f.decodedText})},r.prototype.scanFileV2=function(a,s){var f=this;if(!a||!(a instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(kt(s)&&(s=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(d,h){f.possiblyCloseLastScanImageFile(),f.clearElement(),f.lastScanImageFile=URL.createObjectURL(a);var p=new Image;p.onload=function(){var A=p.width,y=p.height,x=document.getElementById(f.elementId),_=x.clientWidth?x.clientWidth:St.DEFAULT_WIDTH,v=Math.max(x.clientHeight?x.clientHeight:y,St.FILE_SCAN_MIN_HEIGHT),R=f.computeCanvasDrawConfig(A,y,_,v);if(s){var N=f.createCanvasElement(_,v,"qr-canvas-visible");N.style.display="inline-block",x.appendChild(N);var V=N.getContext("2d");if(!V)throw"Unable to get 2d context from canvas";V.canvas.width=_,V.canvas.height=v,V.drawImage(p,0,0,A,y,R.x,R.y,R.width,R.height)}var K=St.FILE_SCAN_HIDDEN_CANVAS_PADDING,H=Math.max(p.width,R.width),U=Math.max(p.height,R.height),W=H+2*K,te=U+2*K,z=f.createCanvasElement(W,te);x.appendChild(z);var L=z.getContext("2d");if(!L)throw"Unable to get 2d context from canvas";L.canvas.width=W,L.canvas.height=te,L.drawImage(p,0,0,A,y,K,K,H,U);try{f.qrcode.decodeRobustlyAsync(z).then(function(Y){d(Js.createFromQrcodeResult(Y))}).catch(h)}catch(Y){h("QR code parse error, error = ".concat(Y))}},p.onerror=h,p.onabort=h,p.onstalled=h,p.onsuspend=h,p.src=URL.createObjectURL(a)})},r.prototype.clear=function(){this.clearElement()},r.getCameras=function(){return Il.retrieve()},r.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},r.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},r.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},r.prototype.applyVideoConstraints=function(a){if(a){if(!eo.isMediaStreamConstraintsValid(a,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(a)},r.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},r.prototype.getSupportedFormats=function(a){var s=[ee.QR_CODE,ee.AZTEC,ee.CODABAR,ee.CODE_39,ee.CODE_93,ee.CODE_128,ee.DATA_MATRIX,ee.MAXICODE,ee.ITF,ee.EAN_13,ee.EAN_8,ee.PDF_417,ee.RSS_14,ee.RSS_EXPANDED,ee.UPC_A,ee.UPC_E,ee.UPC_EAN_EXTENSION];if(!a||typeof a=="boolean"||!a.formatsToSupport)return s;if(!Array.isArray(a.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(a.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var f=[],d=0,h=a.formatsToSupport;d<h.length;d++){var p=h[d];hl(p)?f.push(p):this.logger.warn("Invalid format: ".concat(p," passed in config, ignoring."))}if(f.length===0)throw"None of formatsToSupport match supported values.";return f},r.prototype.getUseBarCodeDetectorIfSupported=function(a){if(kt(a))return!0;if(!kt(a.useBarCodeDetectorIfSupported))return a.useBarCodeDetectorIfSupported!==!1;if(kt(a.experimentalFeatures))return!0;var s=a.experimentalFeatures;return kt(s.useBarCodeDetectorIfSupported)?!0:s.useBarCodeDetectorIfSupported!==!1},r.prototype.validateQrboxSize=function(a,s,f){var d=this,h=f.qrbox;this.validateQrboxConfig(h);var p=this.toQrdimensions(a,s,h),A=function(x){if(x<St.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(St.MIN_QR_BOX_SIZE,"px.")},y=function(x){return x>a&&(d.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),x=a),x};A(p.width),A(p.height),p.width=y(p.width)},r.prototype.validateQrboxConfig=function(a){if(typeof a!="number"&&typeof a!="function"&&(a.width===void 0||a.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},r.prototype.toQrdimensions=function(a,s,f){if(typeof f=="number")return{width:f,height:f};if(typeof f=="function")try{return f(a,s)}catch(d){throw new Error("qrbox config was passed as a function but it failed with unknown error"+d)}return f},r.prototype.setupUi=function(a,s,f){f.isShadedBoxEnabled()&&this.validateQrboxSize(a,s,f);var d=kt(f.qrbox)?{width:a,height:s}:f.qrbox;this.validateQrboxConfig(d);var h=this.toQrdimensions(a,s,d);h.height>s&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var p=f.isShadedBoxEnabled()&&h.height<=s,A={x:0,y:0,width:a,height:s},y=p?this.getShadedRegionBounds(a,s,h):A,x=this.createCanvasElement(y.width,y.height),_={willReadFrequently:!0},v=x.getContext("2d",_);v.canvas.width=y.width,v.canvas.height=y.height,this.element.append(x),p&&this.possiblyInsertShadingElement(this.element,a,s,h),this.createScannerPausedUiElement(this.element),this.qrRegion=y,this.context=v,this.canvasElement=x},r.prototype.createScannerPausedUiElement=function(a){var s=document.createElement("div");s.innerText=yn.scannerPaused(),s.style.display="none",s.style.position="absolute",s.style.top="0px",s.style.zIndex="1",s.style.background="rgba(9, 9, 9, 0.46)",s.style.color="#FFECEC",s.style.textAlign="center",s.style.width="100%",a.appendChild(s),this.scannerPausedUiElement=s},r.prototype.scanContext=function(a,s){var f=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(d){return a(d.text,Js.createFromQrcodeResult(d)),f.possiblyUpdateShaders(!0),!0}).catch(function(d){f.possiblyUpdateShaders(!1);var h=yn.codeParseError(d);return s(h,ki.createFrom(h)),!1})},r.prototype.foreverScan=function(a,s,f){var d=this;if(this.shouldScan&&this.renderedCamera){var h=this.renderedCamera.getSurface(),p=h.videoWidth/h.clientWidth,A=h.videoHeight/h.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var y=this.qrRegion.width*p,x=this.qrRegion.height*A,_=this.qrRegion.x*p,v=this.qrRegion.y*A;this.context.drawImage(h,_,v,y,x,0,0,this.qrRegion.width,this.qrRegion.height);var R=function(){d.foreverScanTimeout=setTimeout(function(){d.foreverScan(a,s,f)},d.getTimeoutFps(a.fps))};this.scanContext(s,f).then(function(N){!N&&a.disableFlip!==!0?(d.context.translate(d.context.canvas.width,0),d.context.scale(-1,1),d.scanContext(s,f).finally(function(){R()})):R()}).catch(function(N){d.logger.logError("Error happend while scanning context",N),R()})}},r.prototype.createVideoConstraints=function(a){if(typeof a=="string")return{deviceId:{exact:a}};if(typeof a=="object"){var s="facingMode",f="deviceId",d={user:!0,environment:!0},h="exact",p=function(V){if(V in d)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(V,"'")},A=Object.keys(a);if(A.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(A.length," keys");var y=Object.keys(a)[0];if(y!==s&&y!==f)throw"Only '".concat(s,"' and '").concat(f,"' ")+" are supported for 'cameraIdOrConfig'";if(y===s){var x=a.facingMode;if(typeof x=="string"){if(p(x))return{facingMode:x}}else if(typeof x=="object")if(h in x){if(p(x["".concat(h)]))return{facingMode:{exact:x["".concat(h)]}}}else throw"'facingMode' should be string or object with"+" ".concat(h," as key.");else{var _=typeof x;throw"Invalid type of 'facingMode' = ".concat(_)}}else{var v=a.deviceId;if(typeof v=="string")return{deviceId:v};if(typeof v=="object"){if(h in v)return{deviceId:{exact:v["".concat(h)]}};throw"'deviceId' should be string or object with"+" ".concat(h," as key.")}else{var R=typeof v;throw"Invalid type of 'deviceId' = ".concat(R)}}}var N=typeof a;throw"Invalid type of 'cameraIdOrConfig' = ".concat(N)},r.prototype.computeCanvasDrawConfig=function(a,s,f,d){if(a<=f&&s<=d){var h=(f-a)/2,p=(d-s)/2;return{x:h,y:p,width:a,height:s}}else{var A=a,y=s;return a>f&&(s=f/a*s,a=f),s>d&&(a=d/s*a,s=d),this.logger.log("Image downsampled from "+"".concat(A,"X").concat(y)+" to ".concat(a,"X").concat(s,".")),this.computeCanvasDrawConfig(a,s,f,d)}},r.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var a=document.getElementById(this.elementId);a&&(a.innerHTML="")},r.prototype.possiblyUpdateShaders=function(a){this.qrMatch!==a&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(s){s.style.backgroundColor=a?St.BORDER_SHADER_MATCH_COLOR:St.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=a)},r.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},r.prototype.createCanvasElement=function(a,s,f){var d=a,h=s,p=document.createElement("canvas");return p.style.width="".concat(d,"px"),p.style.height="".concat(h,"px"),p.style.display="none",p.id=kt(f)?"qr-canvas":f,p},r.prototype.getShadedRegionBounds=function(a,s,f){if(f.width>a||f.height>s)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(a-f.width)/2,y:(s-f.height)/2,width:f.width,height:f.height}},r.prototype.possiblyInsertShadingElement=function(a,s,f,d){if(!(s-d.width<1||f-d.height<1)){var h=document.createElement("div");h.style.position="absolute";var p=(s-d.width)/2,A=(f-d.height)/2;if(h.style.borderLeft="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderRight="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderTop="".concat(A,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderBottom="".concat(A,"px solid rgba(0, 0, 0, 0.48)"),h.style.boxSizing="border-box",h.style.top="0px",h.style.bottom="0px",h.style.left="0px",h.style.right="0px",h.id="".concat(St.SHADED_REGION_ELEMENT_ID),s-d.width<11||f-d.height<11)this.hasBorderShaders=!1;else{var y=5,x=40;this.insertShaderBorders(h,x,y,-y,null,0,!0),this.insertShaderBorders(h,x,y,-y,null,0,!1),this.insertShaderBorders(h,x,y,null,-y,0,!0),this.insertShaderBorders(h,x,y,null,-y,0,!1),this.insertShaderBorders(h,y,x+y,-y,null,-y,!0),this.insertShaderBorders(h,y,x+y,null,-y,-y,!0),this.insertShaderBorders(h,y,x+y,-y,null,-y,!1),this.insertShaderBorders(h,y,x+y,null,-y,-y,!1),this.hasBorderShaders=!0}a.append(h)}},r.prototype.insertShaderBorders=function(a,s,f,d,h,p,A){var y=document.createElement("div");y.style.position="absolute",y.style.backgroundColor=St.BORDER_SHADER_DEFAULT_COLOR,y.style.width="".concat(s,"px"),y.style.height="".concat(f,"px"),d!==null&&(y.style.top="".concat(d,"px")),h!==null&&(y.style.bottom="".concat(h,"px")),A?y.style.left="".concat(p,"px"):y.style.right="".concat(p,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(y),a.appendChild(y)},r.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},r.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},r.prototype.getTimeoutFps=function(a){return 1e3/a},r})();var io="data:image/svg+xml;base64,",Sl=io+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",Tl=io+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",so=io+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",Nl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=";var Ml=(function(){function r(){}return r.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},r})(),Ol=(function(){function r(){this.data=Ml.createDefault();var a=localStorage.getItem(r.LOCAL_STORAGE_KEY);a?this.data=JSON.parse(a):this.reset()}return r.prototype.hasCameraPermissions=function(){return this.data.hasPermission},r.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},r.prototype.setHasPermission=function(a){this.data.hasPermission=a,this.flush()},r.prototype.setLastUsedCameraId=function(a){this.data.lastUsedCameraId=a,this.flush()},r.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},r.prototype.reset=function(){this.data=Ml.createDefault(),this.flush()},r.prototype.flush=function(){localStorage.setItem(r.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},r.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",r})();var wf=(function(){function r(){this.infoDiv=document.createElement("div")}return r.prototype.renderInto=function(a){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=$s.poweredBy();var s=document.createElement("a");s.innerText="ScanApp",s.href="https://scanapp.org",s.target="new",s.style.color="white",this.infoDiv.appendChild(s);var f=document.createElement("br"),d=document.createElement("br");this.infoDiv.appendChild(f),this.infoDiv.appendChild(d);var h=document.createElement("a");h.innerText=$s.reportIssues(),h.href="https://github.com/mebjas/html5-qrcode/issues",h.target="new",h.style.color="white",this.infoDiv.appendChild(h),a.appendChild(this.infoDiv)},r.prototype.show=function(){this.infoDiv.style.display="block"},r.prototype.hide=function(){this.infoDiv.style.display="none"},r})(),pf=(function(){function r(a,s){this.isShowingInfoIcon=!0,this.onTapIn=a,this.onTapOut=s,this.infoIcon=document.createElement("img")}return r.prototype.renderInto=function(a){var s=this;this.infoIcon.alt="Info icon",this.infoIcon.src=so,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(f){return s.onHoverIn()},this.infoIcon.onmouseout=function(f){return s.onHoverOut()},this.infoIcon.onclick=function(f){return s.onClick()},a.appendChild(this.infoIcon)},r.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},r.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},r.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=Nl,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=so,this.infoIcon.style.opacity="0.6")},r})(),Rl=(function(){function r(){var a=this;this.infoDiv=new wf,this.infoIcon=new pf(function(){a.infoDiv.show()},function(){a.infoDiv.hide()})}return r.prototype.renderInto=function(a){this.infoDiv.renderInto(a),this.infoIcon.renderInto(a)},r})();var Af=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},Ef=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},oo=(function(){function r(){}return r.hasPermissions=function(){return Af(this,void 0,void 0,function(){var a,s,f,d;return Ef(this,function(h){switch(h.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(a=h.sent(),s=0,f=a;s<f.length;s++)if(d=f[s],d.kind==="videoinput"&&d.label)return[2,!0];return[2,!1]}})})},r})();var ln=(function(){function r(a){this.supportedScanTypes=this.validateAndReturnScanTypes(a)}return r.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},r.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},r.prototype.isCameraScanRequired=function(){for(var a=0,s=this.supportedScanTypes;a<s.length;a++){var f=s[a];if(r.isCameraScanType(f))return!0}return!1},r.isCameraScanType=function(a){return a===jt.SCAN_TYPE_CAMERA},r.isFileScanType=function(a){return a===jt.SCAN_TYPE_FILE},r.prototype.validateAndReturnScanTypes=function(a){if(!a||a.length===0)return _t.DEFAULT_SUPPORTED_SCAN_TYPE;var s=_t.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(a.length>s)throw"Max ".concat(s," values expected for ")+"supportedScanTypes";for(var f=0,d=a;f<d.length;f++){var h=d[f];if(!_t.DEFAULT_SUPPORTED_SCAN_TYPE.includes(h))throw"Unsupported scan type ".concat(h)}return a},r})();var rt=(function(){function r(){}return r.ALL_ELEMENT_CLASS="html5-qrcode-element",r.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",r.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",r.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",r.TORCH_BUTTON_ID="html5-qrcode-button-torch",r.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",r.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",r.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",r.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",r.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",r.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",r})();var yt=(function(){function r(){}return r.createElement=function(a,s){var f=document.createElement(a);return f.id=s,f.classList.add(rt.ALL_ELEMENT_CLASS),a==="button"&&f.setAttribute("type","button"),f},r})();var vl=function(r,a,s,f){function d(h){return h instanceof s?h:new s(function(p){p(h)})}return new(s||(s=Promise))(function(h,p){function A(_){try{x(f.next(_))}catch(v){p(v)}}function y(_){try{x(f.throw(_))}catch(v){p(v)}}function x(_){_.done?h(_.value):d(_.value).then(A,y)}x((f=f.apply(r,a||[])).next())})},Bl=function(r,a){var s={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},f,d,h,p;return p={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function A(x){return function(_){return y([x,_])}}function y(x){if(f)throw new TypeError("Generator is already executing.");for(;p&&(p=0,x[0]&&(s=0)),s;)try{if(f=1,d&&(h=x[0]&2?d.return:x[0]?d.throw||((h=d.return)&&h.call(d),0):d.next)&&!(h=h.call(d,x[1])).done)return h;switch(d=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return s.label++,{value:x[1],done:!1};case 5:s.label++,d=x[1],x=[0];continue;case 7:x=s.ops.pop(),s.trys.pop();continue;default:if(h=s.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){s=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){s.label=x[1];break}if(x[0]===6&&s.label<h[1]){s.label=h[1],h=x;break}if(h&&s.label<h[2]){s.label=h[2],s.ops.push(x);break}h[2]&&s.ops.pop(),s.trys.pop();continue}x=a.call(r,s)}catch(_){x=[6,_],d=0}finally{f=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Dl=(function(){function r(a,s,f){this.isTorchOn=!1,this.torchCapability=a,this.buttonController=s,this.onTorchActionFailureCallback=f}return r.prototype.isTorchEnabled=function(){return this.isTorchOn},r.prototype.flipState=function(){return vl(this,void 0,void 0,function(){var a,s;return Bl(this,function(f){switch(f.label){case 0:this.buttonController.disable(),a=!this.isTorchOn,f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.torchCapability.apply(a)];case 2:return f.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),a),[3,4];case 3:return s=f.sent(),this.propagateFailure(a,s),this.buttonController.enable(),[3,4];case 4:return[2]}})})},r.prototype.updateUiBasedOnLatestSettings=function(a,s){a===s?(this.buttonController.setText(s?Ee.torchOffButton():Ee.torchOnButton()),this.isTorchOn=s):this.propagateFailure(s),this.buttonController.enable()},r.prototype.propagateFailure=function(a,s){var f=a?Ee.torchOnFailedMessage():Ee.torchOffFailedMessage();s&&(f+="; Error = "+s),this.onTorchActionFailureCallback(f)},r.prototype.reset=function(){this.isTorchOn=!1},r})(),Ll=(function(){function r(a,s){this.onTorchActionFailureCallback=s,this.torchButton=yt.createElement("button",rt.TORCH_BUTTON_ID),this.torchController=new Dl(a,this,s)}return r.prototype.render=function(a,s){var f=this;this.torchButton.innerText=Ee.torchOnButton(),this.torchButton.style.display=s.display,this.torchButton.style.marginLeft=s.marginLeft;var d=this;this.torchButton.addEventListener("click",function(h){return vl(f,void 0,void 0,function(){return Bl(this,function(p){switch(p.label){case 0:return[4,d.torchController.flipState()];case 1:return p.sent(),d.torchController.isTorchEnabled()?(d.torchButton.classList.remove(rt.TORCH_BUTTON_CLASS_TORCH_OFF),d.torchButton.classList.add(rt.TORCH_BUTTON_CLASS_TORCH_ON)):(d.torchButton.classList.remove(rt.TORCH_BUTTON_CLASS_TORCH_ON),d.torchButton.classList.add(rt.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),a.appendChild(this.torchButton)},r.prototype.updateTorchCapability=function(a){this.torchController=new Dl(a,this,this.onTorchActionFailureCallback)},r.prototype.getTorchButton=function(){return this.torchButton},r.prototype.hide=function(){this.torchButton.style.display="none"},r.prototype.show=function(){this.torchButton.style.display="inline-block"},r.prototype.disable=function(){this.torchButton.disabled=!0},r.prototype.enable=function(){this.torchButton.disabled=!1},r.prototype.setText=function(a){this.torchButton.innerText=a},r.prototype.reset=function(){this.torchButton.innerText=Ee.torchOnButton(),this.torchController.reset()},r.create=function(a,s,f,d){var h=new r(s,d);return h.render(a,f),h},r})();var kl=(function(){function r(a,s,f){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=s?"block":"none",a.appendChild(this.fileBasedScanRegion);var d=document.createElement("label");d.setAttribute("for",this.getFileScanInputId()),d.style.display="inline-block",this.fileBasedScanRegion.appendChild(d),this.fileSelectionButton=yt.createElement("button",rt.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(A){d.click()}),d.append(this.fileSelectionButton),this.fileScanInput=yt.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",d.appendChild(this.fileScanInput);var h=this;this.fileScanInput.addEventListener("change",function(A){if(!(A==null||A.target==null)){var y=A.target;if(!(y.files&&y.files.length===0)){var x=y.files,_=x[0],v=_.name;h.setImageNameToButton(v),f(_)}}});var p=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(p),this.fileBasedScanRegion.addEventListener("dragenter",function(A){h.fileBasedScanRegion.style.border=h.fileBasedScanRegionActiveBorder(),A.stopPropagation(),A.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(A){h.fileBasedScanRegion.style.border=h.fileBasedScanRegionDefaultBorder(),A.stopPropagation(),A.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(A){h.fileBasedScanRegion.style.border=h.fileBasedScanRegionActiveBorder(),A.stopPropagation(),A.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(A){A.stopPropagation(),A.preventDefault(),h.fileBasedScanRegion.style.border=h.fileBasedScanRegionDefaultBorder();var y=A.dataTransfer;if(y){var x=y.files;if(!x||x.length===0)return;for(var _=!1,v=0;v<x.length;++v){var R=x.item(v);if(R){var N=/image.*/;if(R.type.match(N)){_=!0;var V=R.name;h.setImageNameToButton(V),f(R),p.innerText=Ee.dragAndDropMessage();break}}}_||(p.innerText=Ee.dragAndDropMessageOnlyImages())}})}return r.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},r.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},r.prototype.isShowing=function(){return this.fileBasedScanRegion.style.display==="block"},r.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},r.prototype.createFileBasedScanRegion=function(){var a=document.createElement("div");return a.style.textAlign="center",a.style.margin="auto",a.style.width="80%",a.style.maxWidth="600px",a.style.border=this.fileBasedScanRegionDefaultBorder(),a.style.padding="10px",a.style.marginBottom="10px",a},r.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},r.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},r.prototype.createDragAndDropMessage=function(){var a=document.createElement("div");return a.innerText=Ee.dragAndDropMessage(),a.style.fontWeight="400",a},r.prototype.setImageNameToButton=function(a){var s=20;if(a.length>s){var f=a.substring(0,8),d=a.length,h=a.substring(d-8,d);a="".concat(f,"....").concat(h)}var p=Ee.fileSelectionChooseAnother()+" - "+a;this.fileSelectionButton.innerText=p},r.prototype.setInitialValueToButton=function(){var a=Ee.fileSelectionChooseImage()+" - "+Ee.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=a},r.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},r.create=function(a,s,f){var d=new r(a,s,f);return d},r})();var Pl=(function(){function r(a){this.selectElement=yt.createElement("select",rt.CAMERA_SELECTION_SELECT_ID),this.cameras=a,this.options=[]}return r.prototype.render=function(a){var s=document.createElement("span");s.style.marginRight="10px";var f=this.cameras.length;if(f===0)throw new Error("No cameras found");if(f===1)s.style.display="none";else{var d=Ee.selectCamera();s.innerText="".concat(d," (").concat(this.cameras.length,") ")}for(var h=1,p=0,A=this.cameras;p<A.length;p++){var y=A[p],x=y.id,_=y.label==null?x:y.label;(!_||_==="")&&(_=[Ee.anonymousCameraPrefix(),h++].join(" "));var v=document.createElement("option");v.value=x,v.innerText=_,this.options.push(v),this.selectElement.appendChild(v)}s.appendChild(this.selectElement),a.appendChild(s)},r.prototype.disable=function(){this.selectElement.disabled=!0},r.prototype.isDisabled=function(){return this.selectElement.disabled===!0},r.prototype.enable=function(){this.selectElement.disabled=!1},r.prototype.getValue=function(){return this.selectElement.value},r.prototype.hasValue=function(a){for(var s=0,f=this.options;s<f.length;s++){var d=f[s];if(d.value===a)return!0}return!1},r.prototype.setValue=function(a){if(!this.hasValue(a))throw new Error("".concat(a," is not present in the camera list."));this.selectElement.value=a},r.prototype.hasSingleItem=function(){return this.cameras.length===1},r.prototype.numCameras=function(){return this.cameras.length},r.create=function(a,s){var f=new r(s);return f.render(a),f},r})();var Fl=(function(){function r(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=yt.createElement("input",rt.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return r.prototype.render=function(a,s){this.zoomElementContainer.style.display=s?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",a.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var f=Ee.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(f),this.rangeText.style.marginRight="10px";var d=this;this.rangeInput.addEventListener("input",function(){return d.onValueChange()}),this.rangeInput.addEventListener("change",function(){return d.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},r.prototype.onValueChange=function(){var a=Ee.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(a),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},r.prototype.setValues=function(a,s,f,d){this.rangeInput.min=a.toString(),this.rangeInput.max=s.toString(),this.rangeInput.step=d.toString(),this.rangeInput.value=f.toString(),this.onValueChange()},r.prototype.show=function(){this.zoomElementContainer.style.display="block"},r.prototype.hide=function(){this.zoomElementContainer.style.display="none"},r.prototype.setOnCameraZoomValueChangeCallback=function(a){this.onChangeCallback=a},r.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},r.create=function(a,s){var f=new r;return f.render(a,s),f},r})();var Tt;(function(r){r[r.STATUS_DEFAULT=0]="STATUS_DEFAULT",r[r.STATUS_SUCCESS=1]="STATUS_SUCCESS",r[r.STATUS_WARNING=2]="STATUS_WARNING",r[r.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Tt||(Tt={}));function mf(r){return{fps:r.fps,qrbox:r.qrbox,aspectRatio:r.aspectRatio,disableFlip:r.disableFlip,videoConstraints:r.videoConstraints}}function Cf(r,a){return{formatsToSupport:r.formatsToSupport,useBarCodeDetectorIfSupported:r.useBarCodeDetectorIfSupported,experimentalFeatures:r.experimentalFeatures,verbose:a}}var _f=(function(){function r(a,s,f){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=a,this.config=this.createConfig(s),this.verbose=f===!0,!document.getElementById(a))throw"HTML Element with id=".concat(a," not found");this.scanTypeSelector=new ln(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new Pi(this.verbose),this.persistedDataManager=new Ol,s.rememberLastUsedCamera!==!0&&this.persistedDataManager.reset()}return r.prototype.render=function(a,s){var f=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(h,p){if(a)a(h,p);else{if(f.lastMatchFound===h)return;f.lastMatchFound=h,f.setHeaderMessage(Ee.lastMatch(h),Tt.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(h,p){s&&s(h,p)};var d=document.getElementById(this.elementId);if(!d)throw"HTML Element with id=".concat(this.elementId," not found");d.innerHTML="",this.createBasicLayout(d),this.html5Qrcode=new cr(this.getScanRegionId(),Cf(this.config,this.verbose))},r.prototype.pause=function(a){(kt(a)||a!==!0)&&(a=!1),this.getHtml5QrcodeOrFail().pause(a)},r.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},r.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},r.prototype.clear=function(){var a=this,s=function(){var f=document.getElementById(a.elementId);f&&(f.innerHTML="",a.resetBasicLayout(f))};return this.html5Qrcode?new Promise(function(f,d){if(!a.html5Qrcode){f();return}a.html5Qrcode.isScanning?a.html5Qrcode.stop().then(function(h){if(!a.html5Qrcode){f();return}a.html5Qrcode.clear(),s(),f()}).catch(function(h){a.verbose&&a.logger.logError("Unable to stop qrcode scanner",h),d(h)}):(a.html5Qrcode.clear(),s(),f())}):Promise.resolve()},r.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},r.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},r.prototype.applyVideoConstraints=function(a){return this.getHtml5QrcodeOrFail().applyVideoConstraints(a)},r.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},r.prototype.createConfig=function(a){return a?(a.fps||(a.fps=_t.SCAN_DEFAULT_FPS),a.rememberLastUsedCamera!==!_t.DEFAULT_REMEMBER_LAST_CAMERA_USED&&(a.rememberLastUsedCamera=_t.DEFAULT_REMEMBER_LAST_CAMERA_USED),a.supportedScanTypes||(a.supportedScanTypes=_t.DEFAULT_SUPPORTED_SCAN_TYPE),a):{fps:_t.SCAN_DEFAULT_FPS,rememberLastUsedCamera:_t.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:_t.DEFAULT_SUPPORTED_SCAN_TYPE}},r.prototype.createBasicLayout=function(a){a.style.position="relative",a.style.padding="0px",a.style.border="1px solid silver",this.createHeader(a);var s=document.createElement("div"),f=this.getScanRegionId();s.id=f,s.style.width="100%",s.style.minHeight="100px",s.style.textAlign="center",a.appendChild(s),ln.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var d=document.createElement("div"),h=this.getDashboardId();d.id=h,d.style.width="100%",a.appendChild(d),this.setupInitialDashboard(d)},r.prototype.resetBasicLayout=function(a){a.style.border="none"},r.prototype.setupInitialDashboard=function(a){this.createSection(a),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},r.prototype.createHeader=function(a){var s=document.createElement("div");s.style.textAlign="left",s.style.margin="0px",a.appendChild(s);var f=new Rl;f.renderInto(s);var d=document.createElement("div");d.id=this.getHeaderMessageContainerId(),d.style.display="none",d.style.textAlign="center",d.style.fontSize="14px",d.style.padding="2px 10px",d.style.margin="4px",d.style.borderTop="1px solid #f6f6f6",s.appendChild(d)},r.prototype.createSection=function(a){var s=document.createElement("div");s.id=this.getDashboardSectionId(),s.style.width="100%",s.style.padding="10px 0px 10px 0px",s.style.textAlign="left",a.appendChild(s)},r.prototype.createCameraListUi=function(a,s,f){var d=this;d.showHideScanTypeSwapLink(!1),d.setHeaderMessage(Ee.cameraPermissionRequesting());var h=function(){f||d.createPermissionButton(a,s)};cr.getCameras().then(function(p){d.persistedDataManager.setHasPermission(!0),d.showHideScanTypeSwapLink(!0),d.resetHeaderMessage(),p&&p.length>0?(a.removeChild(s),d.renderCameraSelection(p)):(d.setHeaderMessage(Ee.noCameraFound(),Tt.STATUS_WARNING),h())}).catch(function(p){d.persistedDataManager.setHasPermission(!1),f?f.disabled=!1:h(),d.setHeaderMessage(p,Tt.STATUS_WARNING),d.showHideScanTypeSwapLink(!0)})},r.prototype.createPermissionButton=function(a,s){var f=this,d=yt.createElement("button",this.getCameraPermissionButtonId());d.innerText=Ee.cameraPermissionTitle(),d.addEventListener("click",function(){d.disabled=!0,f.createCameraListUi(a,s,d)}),s.appendChild(d)},r.prototype.createPermissionsUi=function(a,s){var f=this;if(ln.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){oo.hasPermissions().then(function(d){d?f.createCameraListUi(a,s):(f.persistedDataManager.setHasPermission(!1),f.createPermissionButton(a,s))}).catch(function(d){f.persistedDataManager.setHasPermission(!1),f.createPermissionButton(a,s)});return}this.createPermissionButton(a,s)},r.prototype.createSectionControlPanel=function(){var a=document.getElementById(this.getDashboardSectionId()),s=document.createElement("div");a.appendChild(s);var f=document.createElement("div");f.id=this.getDashboardSectionCameraScanRegionId(),f.style.display=ln.isCameraScanType(this.currentScanType)?"block":"none",s.appendChild(f);var d=document.createElement("div");d.style.textAlign="center",f.appendChild(d),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(f,d),this.renderFileScanUi(s)},r.prototype.renderFileScanUi=function(a){var s=ln.isFileScanType(this.currentScanType),f=this,d=function(h){if(!f.html5Qrcode)throw"html5Qrcode not defined";ln.isFileScanType(f.currentScanType)&&(f.setHeaderMessage(Ee.loadingImage()),f.html5Qrcode.scanFileV2(h,!0).then(function(p){f.resetHeaderMessage(),f.qrCodeSuccessCallback(p.decodedText,p)}).catch(function(p){f.setHeaderMessage(p,Tt.STATUS_WARNING),f.qrCodeErrorCallback(p,ki.createFrom(p))}))};this.fileSelectionUi=kl.create(a,s,d)},r.prototype.renderCameraSelection=function(a){var s=this,f=this,d=document.getElementById(this.getDashboardSectionCameraScanRegionId());d.style.textAlign="center";var h=Fl.create(d,!1),p=function(K){var H=K.zoomFeature();if(H.isSupported()){h.setOnCameraZoomValueChangeCallback(function(W){H.apply(W)});var U=1;s.config.defaultZoomValueIfSupported&&(U=s.config.defaultZoomValueIfSupported),U=dl(U,H.min(),H.max()),h.setValues(H.min(),H.max(),U,H.step()),h.show()}},A=Pl.create(d,a),y=document.createElement("span"),x=yt.createElement("button",rt.CAMERA_START_BUTTON_ID);x.innerText=Ee.scanButtonStartScanningText(),y.appendChild(x);var _=yt.createElement("button",rt.CAMERA_STOP_BUTTON_ID);_.innerText=Ee.scanButtonStopScanningText(),_.style.display="none",_.disabled=!0,y.appendChild(_);var v,R=function(K){if(!K.torchFeature().isSupported()){v&&v.hide();return}v?v.updateTorchCapability(K.torchFeature()):v=Ll.create(y,K.torchFeature(),{display:"none",marginLeft:"5px"},function(H){f.setHeaderMessage(H,Tt.STATUS_WARNING)}),v.show()};d.appendChild(y);var N=function(K){K||(x.style.display="none"),x.innerText=Ee.scanButtonStartScanningText(),x.style.opacity="1",x.disabled=!1,K&&(x.style.display="inline-block")};if(x.addEventListener("click",function(K){x.innerText=Ee.scanButtonScanningStarting(),A.disable(),x.disabled=!0,x.style.opacity="0.5",s.scanTypeSelector.hasMoreThanOneScanType()&&f.showHideScanTypeSwapLink(!1),f.resetHeaderMessage();var H=A.getValue();f.persistedDataManager.setLastUsedCameraId(H),f.html5Qrcode.start(H,mf(f.config),f.qrCodeSuccessCallback,f.qrCodeErrorCallback).then(function(U){_.disabled=!1,_.style.display="inline-block",N(!1);var W=f.html5Qrcode.getRunningTrackCameraCapabilities();s.config.showTorchButtonIfSupported===!0&&R(W),s.config.showZoomSliderIfSupported===!0&&p(W)}).catch(function(U){f.showHideScanTypeSwapLink(!0),A.enable(),N(!0),f.setHeaderMessage(U,Tt.STATUS_WARNING)})}),A.hasSingleItem()&&x.click(),_.addEventListener("click",function(K){if(!f.html5Qrcode)throw"html5Qrcode not defined";_.disabled=!0,f.html5Qrcode.stop().then(function(H){s.scanTypeSelector.hasMoreThanOneScanType()&&f.showHideScanTypeSwapLink(!0),A.enable(),x.disabled=!1,_.style.display="none",x.style.display="inline-block",v&&(v.reset(),v.hide()),h.removeOnCameraZoomValueChangeCallback(),h.hide(),f.insertCameraScanImageToScanRegion()}).catch(function(H){_.disabled=!1,f.setHeaderMessage(H,Tt.STATUS_WARNING)})}),f.persistedDataManager.getLastUsedCameraId()){var V=f.persistedDataManager.getLastUsedCameraId();A.hasValue(V)?(A.setValue(V),x.click()):f.persistedDataManager.resetLastUsedCameraId()}},r.prototype.createSectionSwap=function(){var a=this,s=Ee.textIfCameraScanSelected(),f=Ee.textIfFileScanSelected(),d=document.getElementById(this.getDashboardSectionId()),h=document.createElement("div");h.style.textAlign="center";var p=yt.createElement("span",this.getDashboardSectionSwapLinkId());p.style.textDecoration="underline",p.style.cursor="pointer",p.innerText=ln.isCameraScanType(this.currentScanType)?s:f,p.addEventListener("click",function(){if(!a.sectionSwapAllowed){a.verbose&&a.logger.logError("Section swap called when not allowed");return}a.resetHeaderMessage(),a.fileSelectionUi.resetValue(),a.sectionSwapAllowed=!1,ln.isCameraScanType(a.currentScanType)?(a.clearScanRegion(),a.getCameraScanRegion().style.display="none",a.fileSelectionUi.show(),p.innerText=f,a.currentScanType=jt.SCAN_TYPE_FILE,a.insertFileScanImageToScanRegion()):(a.clearScanRegion(),a.getCameraScanRegion().style.display="block",a.fileSelectionUi.hide(),p.innerText=s,a.currentScanType=jt.SCAN_TYPE_CAMERA,a.insertCameraScanImageToScanRegion(),a.startCameraScanIfPermissionExistsOnSwap()),a.sectionSwapAllowed=!0}),h.appendChild(p),d.appendChild(h)},r.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var a=this,s=this;if(this.persistedDataManager.hasCameraPermissions()){oo.hasPermissions().then(function(f){if(f){var d=document.getElementById(s.getCameraPermissionButtonId());if(!d)throw a.logger.logError("Permission button not found, fail;"),"Permission button not found";d.click()}else s.persistedDataManager.setHasPermission(!1)}).catch(function(f){s.persistedDataManager.setHasPermission(!1)});return}},r.prototype.resetHeaderMessage=function(){var a=document.getElementById(this.getHeaderMessageContainerId());a.style.display="none"},r.prototype.setHeaderMessage=function(a,s){s||(s=Tt.STATUS_DEFAULT);var f=this.getHeaderMessageDiv();switch(f.innerText=a,f.style.display="block",s){case Tt.STATUS_SUCCESS:f.style.background="rgba(106, 175, 80, 0.26)",f.style.color="#477735";break;case Tt.STATUS_WARNING:f.style.background="rgba(203, 36, 49, 0.14)",f.style.color="#cb2431";break;case Tt.STATUS_DEFAULT:default:f.style.background="rgba(0, 0, 0, 0)",f.style.color="rgb(17, 17, 17)";break}},r.prototype.showHideScanTypeSwapLink=function(a){this.scanTypeSelector.hasMoreThanOneScanType()&&(a!==!0&&(a=!1),this.sectionSwapAllowed=a,this.getDashboardSectionSwapLink().style.display=a?"inline-block":"none")},r.prototype.insertCameraScanImageToScanRegion=function(){var a=this,s=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){s.innerHTML="<br>",s.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(f){s.innerHTML="<br>",s.appendChild(a.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=Sl,this.cameraScanImage.alt=Ee.cameraScanAltText()},r.prototype.insertFileScanImageToScanRegion=function(){var a=this,s=document.getElementById(this.getScanRegionId());if(this.fileScanImage){s.innerHTML="<br>",s.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(f){s.innerHTML="<br>",s.appendChild(a.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=Tl,this.fileScanImage.alt=Ee.fileScanAltText()},r.prototype.clearScanRegion=function(){var a=document.getElementById(this.getScanRegionId());a.innerHTML=""},r.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},r.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},r.prototype.getDashboardSectionSwapLinkId=function(){return rt.SCAN_TYPE_CHANGE_ANCHOR_ID},r.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},r.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},r.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},r.prototype.getCameraPermissionButtonId=function(){return rt.CAMERA_PERMISSION_BUTTON_ID},r.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},r.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},r.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},r})();function xr(r){let a=r.length;for(;--a>=0;)r[a]=0}var yf=0,yc=1,If=2,bf=3,Sf=258,Ro=29,ri=256,Qr=ri+1+Ro,hr=30,Do=19,Ic=2*Qr+1,Un=15,ao=16,Tf=7,vo=256,bc=16,Sc=17,Tc=18,_o=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Yi=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Nf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Nc=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mf=512,fn=new Array((Qr+2)*2);xr(fn);var Yr=new Array(hr*2);xr(Yr);var Kr=new Array(Mf);xr(Kr);var qr=new Array(Sf-bf+1);xr(qr);var Bo=new Array(Ro);xr(Bo);var Wi=new Array(hr);xr(Wi);function lo(r,a,s,f,d){this.static_tree=r,this.extra_bits=a,this.extra_base=s,this.elems=f,this.max_length=d,this.has_stree=r&&r.length}var Mc,Oc,Rc;function co(r,a){this.dyn_tree=r,this.max_code=0,this.stat_desc=a}var Dc=r=>r<256?Kr[r]:Kr[256+(r>>>7)],Jr=(r,a)=>{r.pending_buf[r.pending++]=a&255,r.pending_buf[r.pending++]=a>>>8&255},It=(r,a,s)=>{r.bi_valid>ao-s?(r.bi_buf|=a<<r.bi_valid&65535,Jr(r,r.bi_buf),r.bi_buf=a>>ao-r.bi_valid,r.bi_valid+=s-ao):(r.bi_buf|=a<<r.bi_valid&65535,r.bi_valid+=s)},tn=(r,a,s)=>{It(r,s[a*2],s[a*2+1])},vc=(r,a)=>{let s=0;do s|=r&1,r>>>=1,s<<=1;while(--a>0);return s>>>1},Of=r=>{r.bi_valid===16?(Jr(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},Rf=(r,a)=>{let s=a.dyn_tree,f=a.max_code,d=a.stat_desc.static_tree,h=a.stat_desc.has_stree,p=a.stat_desc.extra_bits,A=a.stat_desc.extra_base,y=a.stat_desc.max_length,x,_,v,R,N,V,K=0;for(R=0;R<=Un;R++)r.bl_count[R]=0;for(s[r.heap[r.heap_max]*2+1]=0,x=r.heap_max+1;x<Ic;x++)_=r.heap[x],R=s[s[_*2+1]*2+1]+1,R>y&&(R=y,K++),s[_*2+1]=R,!(_>f)&&(r.bl_count[R]++,N=0,_>=A&&(N=p[_-A]),V=s[_*2],r.opt_len+=V*(R+N),h&&(r.static_len+=V*(d[_*2+1]+N)));if(K!==0){do{for(R=y-1;r.bl_count[R]===0;)R--;r.bl_count[R]--,r.bl_count[R+1]+=2,r.bl_count[y]--,K-=2}while(K>0);for(R=y;R!==0;R--)for(_=r.bl_count[R];_!==0;)v=r.heap[--x],!(v>f)&&(s[v*2+1]!==R&&(r.opt_len+=(R-s[v*2+1])*s[v*2],s[v*2+1]=R),_--)}},Bc=(r,a,s)=>{let f=new Array(Un+1),d=0,h,p;for(h=1;h<=Un;h++)d=d+s[h-1]<<1,f[h]=d;for(p=0;p<=a;p++){let A=r[p*2+1];A!==0&&(r[p*2]=vc(f[A]++,A))}},Df=()=>{let r,a,s,f,d,h=new Array(Un+1);for(s=0,f=0;f<Ro-1;f++)for(Bo[f]=s,r=0;r<1<<_o[f];r++)qr[s++]=f;for(qr[s-1]=f,d=0,f=0;f<16;f++)for(Wi[f]=d,r=0;r<1<<Yi[f];r++)Kr[d++]=f;for(d>>=7;f<hr;f++)for(Wi[f]=d<<7,r=0;r<1<<Yi[f]-7;r++)Kr[256+d++]=f;for(a=0;a<=Un;a++)h[a]=0;for(r=0;r<=143;)fn[r*2+1]=8,r++,h[8]++;for(;r<=255;)fn[r*2+1]=9,r++,h[9]++;for(;r<=279;)fn[r*2+1]=7,r++,h[7]++;for(;r<=287;)fn[r*2+1]=8,r++,h[8]++;for(Bc(fn,Qr+1,h),r=0;r<hr;r++)Yr[r*2+1]=5,Yr[r*2]=vc(r,5);Mc=new lo(fn,_o,ri+1,Qr,Un),Oc=new lo(Yr,Yi,0,hr,Un),Rc=new lo(new Array(0),Nf,0,Do,Tf)},Lc=r=>{let a;for(a=0;a<Qr;a++)r.dyn_ltree[a*2]=0;for(a=0;a<hr;a++)r.dyn_dtree[a*2]=0;for(a=0;a<Do;a++)r.bl_tree[a*2]=0;r.dyn_ltree[vo*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},kc=r=>{r.bi_valid>8?Jr(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Ul=(r,a,s,f)=>{let d=a*2,h=s*2;return r[d]<r[h]||r[d]===r[h]&&f[a]<=f[s]},fo=(r,a,s)=>{let f=r.heap[s],d=s<<1;for(;d<=r.heap_len&&(d<r.heap_len&&Ul(a,r.heap[d+1],r.heap[d],r.depth)&&d++,!Ul(a,f,r.heap[d],r.depth));)r.heap[s]=r.heap[d],s=d,d<<=1;r.heap[s]=f},zl=(r,a,s)=>{let f,d,h=0,p,A;if(r.sym_next!==0)do f=r.pending_buf[r.sym_buf+h++]&255,f+=(r.pending_buf[r.sym_buf+h++]&255)<<8,d=r.pending_buf[r.sym_buf+h++],f===0?tn(r,d,a):(p=qr[d],tn(r,p+ri+1,a),A=_o[p],A!==0&&(d-=Bo[p],It(r,d,A)),f--,p=Dc(f),tn(r,p,s),A=Yi[p],A!==0&&(f-=Wi[p],It(r,f,A)));while(h<r.sym_next);tn(r,vo,a)},yo=(r,a)=>{let s=a.dyn_tree,f=a.stat_desc.static_tree,d=a.stat_desc.has_stree,h=a.stat_desc.elems,p,A,y=-1,x;for(r.heap_len=0,r.heap_max=Ic,p=0;p<h;p++)s[p*2]!==0?(r.heap[++r.heap_len]=y=p,r.depth[p]=0):s[p*2+1]=0;for(;r.heap_len<2;)x=r.heap[++r.heap_len]=y<2?++y:0,s[x*2]=1,r.depth[x]=0,r.opt_len--,d&&(r.static_len-=f[x*2+1]);for(a.max_code=y,p=r.heap_len>>1;p>=1;p--)fo(r,s,p);x=h;do p=r.heap[1],r.heap[1]=r.heap[r.heap_len--],fo(r,s,1),A=r.heap[1],r.heap[--r.heap_max]=p,r.heap[--r.heap_max]=A,s[x*2]=s[p*2]+s[A*2],r.depth[x]=(r.depth[p]>=r.depth[A]?r.depth[p]:r.depth[A])+1,s[p*2+1]=s[A*2+1]=x,r.heap[1]=x++,fo(r,s,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Rf(r,a),Bc(s,y,r.bl_count)},Hl=(r,a,s)=>{let f,d=-1,h,p=a[1],A=0,y=7,x=4;for(p===0&&(y=138,x=3),a[(s+1)*2+1]=65535,f=0;f<=s;f++)h=p,p=a[(f+1)*2+1],!(++A<y&&h===p)&&(A<x?r.bl_tree[h*2]+=A:h!==0?(h!==d&&r.bl_tree[h*2]++,r.bl_tree[bc*2]++):A<=10?r.bl_tree[Sc*2]++:r.bl_tree[Tc*2]++,A=0,d=h,p===0?(y=138,x=3):h===p?(y=6,x=3):(y=7,x=4))},Vl=(r,a,s)=>{let f,d=-1,h,p=a[1],A=0,y=7,x=4;for(p===0&&(y=138,x=3),f=0;f<=s;f++)if(h=p,p=a[(f+1)*2+1],!(++A<y&&h===p)){if(A<x)do tn(r,h,r.bl_tree);while(--A!==0);else h!==0?(h!==d&&(tn(r,h,r.bl_tree),A--),tn(r,bc,r.bl_tree),It(r,A-3,2)):A<=10?(tn(r,Sc,r.bl_tree),It(r,A-3,3)):(tn(r,Tc,r.bl_tree),It(r,A-11,7));A=0,d=h,p===0?(y=138,x=3):h===p?(y=6,x=3):(y=7,x=4)}},vf=r=>{let a;for(Hl(r,r.dyn_ltree,r.l_desc.max_code),Hl(r,r.dyn_dtree,r.d_desc.max_code),yo(r,r.bl_desc),a=Do-1;a>=3&&r.bl_tree[Nc[a]*2+1]===0;a--);return r.opt_len+=3*(a+1)+5+5+4,a},Bf=(r,a,s,f)=>{let d;for(It(r,a-257,5),It(r,s-1,5),It(r,f-4,4),d=0;d<f;d++)It(r,r.bl_tree[Nc[d]*2+1],3);Vl(r,r.dyn_ltree,a-1),Vl(r,r.dyn_dtree,s-1)},Lf=r=>{let a=4093624447,s;for(s=0;s<=31;s++,a>>>=1)if(a&1&&r.dyn_ltree[s*2]!==0)return 0;if(r.dyn_ltree[18]!==0||r.dyn_ltree[20]!==0||r.dyn_ltree[26]!==0)return 1;for(s=32;s<ri;s++)if(r.dyn_ltree[s*2]!==0)return 1;return 0},Xl=!1,kf=r=>{Xl||(Df(),Xl=!0),r.l_desc=new co(r.dyn_ltree,Mc),r.d_desc=new co(r.dyn_dtree,Oc),r.bl_desc=new co(r.bl_tree,Rc),r.bi_buf=0,r.bi_valid=0,Lc(r)},Pc=(r,a,s,f)=>{It(r,(yf<<1)+(f?1:0),3),kc(r),Jr(r,s),Jr(r,~s),s&&r.pending_buf.set(r.window.subarray(a,a+s),r.pending),r.pending+=s},Pf=r=>{It(r,yc<<1,3),tn(r,vo,fn),Of(r)},Ff=(r,a,s,f)=>{let d,h,p=0;r.level>0?(r.strm.data_type===2&&(r.strm.data_type=Lf(r)),yo(r,r.l_desc),yo(r,r.d_desc),p=vf(r),d=r.opt_len+3+7>>>3,h=r.static_len+3+7>>>3,h<=d&&(d=h)):d=h=s+5,s+4<=d&&a!==-1?Pc(r,a,s,f):r.strategy===4||h===d?(It(r,(yc<<1)+(f?1:0),3),zl(r,fn,Yr)):(It(r,(If<<1)+(f?1:0),3),Bf(r,r.l_desc.max_code+1,r.d_desc.max_code+1,p+1),zl(r,r.dyn_ltree,r.dyn_dtree)),Lc(r),f&&kc(r)},Uf=(r,a,s)=>(r.pending_buf[r.sym_buf+r.sym_next++]=a,r.pending_buf[r.sym_buf+r.sym_next++]=a>>8,r.pending_buf[r.sym_buf+r.sym_next++]=s,a===0?r.dyn_ltree[s*2]++:(r.matches++,a--,r.dyn_ltree[(qr[s]+ri+1)*2]++,r.dyn_dtree[Dc(a)*2]++),r.sym_next===r.sym_end),zf=kf,Hf=Pc,Vf=Ff,Xf=Uf,Gf=Pf,jf={_tr_init:zf,_tr_stored_block:Hf,_tr_flush_block:Vf,_tr_tally:Xf,_tr_align:Gf},Yf=(r,a,s,f)=>{let d=r&65535|0,h=r>>>16&65535|0,p=0;for(;s!==0;){p=s>2e3?2e3:s,s-=p;do d=d+a[f++]|0,h=h+d|0;while(--p);d%=65521,h%=65521}return d|h<<16|0},$r=Yf,Wf=()=>{let r,a=[];for(var s=0;s<256;s++){r=s;for(var f=0;f<8;f++)r=r&1?3988292384^r>>>1:r>>>1;a[s]=r}return a},Zf=new Uint32Array(Wf()),Qf=(r,a,s,f)=>{let d=Zf,h=f+s;r^=-1;for(let p=f;p<h;p++)r=r>>>8^d[(r^a[p])&255];return r^-1},it=Qf,Vn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},wr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Kf,_tr_stored_block:Io,_tr_flush_block:qf,_tr_tally:Sn,_tr_align:Jf}=jf,{Z_NO_FLUSH:Tn,Z_PARTIAL_FLUSH:$f,Z_FULL_FLUSH:eu,Z_FINISH:Pt,Z_BLOCK:Gl,Z_OK:ft,Z_STREAM_END:jl,Z_STREAM_ERROR:nn,Z_DATA_ERROR:tu,Z_BUF_ERROR:uo,Z_DEFAULT_COMPRESSION:nu,Z_FILTERED:ru,Z_HUFFMAN_ONLY:Hi,Z_RLE:iu,Z_FIXED:su,Z_DEFAULT_STRATEGY:ou,Z_UNKNOWN:au,Z_DEFLATED:Ki}=wr,lu=9,cu=15,fu=8,uu=29,hu=256,bo=hu+1+uu,du=30,gu=19,xu=2*bo+1,wu=15,Ae=3,bn=258,rn=bn+Ae+1,pu=32,dr=42,Lo=57,So=69,To=73,No=91,Mo=103,zn=113,Gr=666,xt=1,pr=2,Xn=3,Ar=4,Au=3,Hn=(r,a)=>(r.msg=Vn[a],a),Yl=r=>r*2-(r>4?9:0),In=r=>{let a=r.length;for(;--a>=0;)r[a]=0},Eu=r=>{let a,s,f,d=r.w_size;a=r.hash_size,f=a;do s=r.head[--f],r.head[f]=s>=d?s-d:0;while(--a);a=d,f=a;do s=r.prev[--f],r.prev[f]=s>=d?s-d:0;while(--a)},mu=(r,a,s)=>(a<<r.hash_shift^s)&r.hash_mask,Nn=mu,Nt=r=>{let a=r.state,s=a.pending;s>r.avail_out&&(s=r.avail_out),s!==0&&(r.output.set(a.pending_buf.subarray(a.pending_out,a.pending_out+s),r.next_out),r.next_out+=s,a.pending_out+=s,r.total_out+=s,r.avail_out-=s,a.pending-=s,a.pending===0&&(a.pending_out=0))},Mt=(r,a)=>{qf(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,a),r.block_start=r.strstart,Nt(r.strm)},Te=(r,a)=>{r.pending_buf[r.pending++]=a},Xr=(r,a)=>{r.pending_buf[r.pending++]=a>>>8&255,r.pending_buf[r.pending++]=a&255},Oo=(r,a,s,f)=>{let d=r.avail_in;return d>f&&(d=f),d===0?0:(r.avail_in-=d,a.set(r.input.subarray(r.next_in,r.next_in+d),s),r.state.wrap===1?r.adler=$r(r.adler,a,d,s):r.state.wrap===2&&(r.adler=it(r.adler,a,d,s)),r.next_in+=d,r.total_in+=d,d)},Fc=(r,a)=>{let s=r.max_chain_length,f=r.strstart,d,h,p=r.prev_length,A=r.nice_match,y=r.strstart>r.w_size-rn?r.strstart-(r.w_size-rn):0,x=r.window,_=r.w_mask,v=r.prev,R=r.strstart+bn,N=x[f+p-1],V=x[f+p];r.prev_length>=r.good_match&&(s>>=2),A>r.lookahead&&(A=r.lookahead);do if(d=a,!(x[d+p]!==V||x[d+p-1]!==N||x[d]!==x[f]||x[++d]!==x[f+1])){f+=2,d++;do;while(x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&x[++f]===x[++d]&&f<R);if(h=bn-(R-f),f=R-bn,h>p){if(r.match_start=a,p=h,h>=A)break;N=x[f+p-1],V=x[f+p]}}while((a=v[a&_])>y&&--s!==0);return p<=r.lookahead?p:r.lookahead},gr=r=>{let a=r.w_size,s,f,d;do{if(f=r.window_size-r.lookahead-r.strstart,r.strstart>=a+(a-rn)&&(r.window.set(r.window.subarray(a,a+a-f),0),r.match_start-=a,r.strstart-=a,r.block_start-=a,r.insert>r.strstart&&(r.insert=r.strstart),Eu(r),f+=a),r.strm.avail_in===0)break;if(s=Oo(r.strm,r.window,r.strstart+r.lookahead,f),r.lookahead+=s,r.lookahead+r.insert>=Ae)for(d=r.strstart-r.insert,r.ins_h=r.window[d],r.ins_h=Nn(r,r.ins_h,r.window[d+1]);r.insert&&(r.ins_h=Nn(r,r.ins_h,r.window[d+Ae-1]),r.prev[d&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=d,d++,r.insert--,!(r.lookahead+r.insert<Ae)););}while(r.lookahead<rn&&r.strm.avail_in!==0)},Uc=(r,a)=>{let s=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,f,d,h,p=0,A=r.strm.avail_in;do{if(f=65535,h=r.bi_valid+42>>3,r.strm.avail_out<h||(h=r.strm.avail_out-h,d=r.strstart-r.block_start,f>d+r.strm.avail_in&&(f=d+r.strm.avail_in),f>h&&(f=h),f<s&&(f===0&&a!==Pt||a===Tn||f!==d+r.strm.avail_in)))break;p=a===Pt&&f===d+r.strm.avail_in?1:0,Io(r,0,0,p),r.pending_buf[r.pending-4]=f,r.pending_buf[r.pending-3]=f>>8,r.pending_buf[r.pending-2]=~f,r.pending_buf[r.pending-1]=~f>>8,Nt(r.strm),d&&(d>f&&(d=f),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+d),r.strm.next_out),r.strm.next_out+=d,r.strm.avail_out-=d,r.strm.total_out+=d,r.block_start+=d,f-=d),f&&(Oo(r.strm,r.strm.output,r.strm.next_out,f),r.strm.next_out+=f,r.strm.avail_out-=f,r.strm.total_out+=f)}while(p===0);return A-=r.strm.avail_in,A&&(A>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=A&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-A,r.strm.next_in),r.strstart),r.strstart+=A,r.insert+=A>r.w_size-r.insert?r.w_size-r.insert:A),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),p?Ar:a!==Tn&&a!==Pt&&r.strm.avail_in===0&&r.strstart===r.block_start?pr:(h=r.window_size-r.strstart,r.strm.avail_in>h&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,h+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),h>r.strm.avail_in&&(h=r.strm.avail_in),h&&(Oo(r.strm,r.window,r.strstart,h),r.strstart+=h,r.insert+=h>r.w_size-r.insert?r.w_size-r.insert:h),r.high_water<r.strstart&&(r.high_water=r.strstart),h=r.bi_valid+42>>3,h=r.pending_buf_size-h>65535?65535:r.pending_buf_size-h,s=h>r.w_size?r.w_size:h,d=r.strstart-r.block_start,(d>=s||(d||a===Pt)&&a!==Tn&&r.strm.avail_in===0&&d<=h)&&(f=d>h?h:d,p=a===Pt&&r.strm.avail_in===0&&f===d?1:0,Io(r,r.block_start,f,p),r.block_start+=f,Nt(r.strm)),p?Xn:xt)},ho=(r,a)=>{let s,f;for(;;){if(r.lookahead<rn){if(gr(r),r.lookahead<rn&&a===Tn)return xt;if(r.lookahead===0)break}if(s=0,r.lookahead>=Ae&&(r.ins_h=Nn(r,r.ins_h,r.window[r.strstart+Ae-1]),s=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),s!==0&&r.strstart-s<=r.w_size-rn&&(r.match_length=Fc(r,s)),r.match_length>=Ae)if(f=Sn(r,r.strstart-r.match_start,r.match_length-Ae),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=Ae){r.match_length--;do r.strstart++,r.ins_h=Nn(r,r.ins_h,r.window[r.strstart+Ae-1]),s=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Nn(r,r.ins_h,r.window[r.strstart+1]);else f=Sn(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(f&&(Mt(r,!1),r.strm.avail_out===0))return xt}return r.insert=r.strstart<Ae-1?r.strstart:Ae-1,a===Pt?(Mt(r,!0),r.strm.avail_out===0?Xn:Ar):r.sym_next&&(Mt(r,!1),r.strm.avail_out===0)?xt:pr},fr=(r,a)=>{let s,f,d;for(;;){if(r.lookahead<rn){if(gr(r),r.lookahead<rn&&a===Tn)return xt;if(r.lookahead===0)break}if(s=0,r.lookahead>=Ae&&(r.ins_h=Nn(r,r.ins_h,r.window[r.strstart+Ae-1]),s=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=Ae-1,s!==0&&r.prev_length<r.max_lazy_match&&r.strstart-s<=r.w_size-rn&&(r.match_length=Fc(r,s),r.match_length<=5&&(r.strategy===ru||r.match_length===Ae&&r.strstart-r.match_start>4096)&&(r.match_length=Ae-1)),r.prev_length>=Ae&&r.match_length<=r.prev_length){d=r.strstart+r.lookahead-Ae,f=Sn(r,r.strstart-1-r.prev_match,r.prev_length-Ae),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=d&&(r.ins_h=Nn(r,r.ins_h,r.window[r.strstart+Ae-1]),s=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=Ae-1,r.strstart++,f&&(Mt(r,!1),r.strm.avail_out===0))return xt}else if(r.match_available){if(f=Sn(r,0,r.window[r.strstart-1]),f&&Mt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return xt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(f=Sn(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<Ae-1?r.strstart:Ae-1,a===Pt?(Mt(r,!0),r.strm.avail_out===0?Xn:Ar):r.sym_next&&(Mt(r,!1),r.strm.avail_out===0)?xt:pr},Cu=(r,a)=>{let s,f,d,h,p=r.window;for(;;){if(r.lookahead<=bn){if(gr(r),r.lookahead<=bn&&a===Tn)return xt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=Ae&&r.strstart>0&&(d=r.strstart-1,f=p[d],f===p[++d]&&f===p[++d]&&f===p[++d])){h=r.strstart+bn;do;while(f===p[++d]&&f===p[++d]&&f===p[++d]&&f===p[++d]&&f===p[++d]&&f===p[++d]&&f===p[++d]&&f===p[++d]&&d<h);r.match_length=bn-(h-d),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=Ae?(s=Sn(r,1,r.match_length-Ae),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(s=Sn(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),s&&(Mt(r,!1),r.strm.avail_out===0))return xt}return r.insert=0,a===Pt?(Mt(r,!0),r.strm.avail_out===0?Xn:Ar):r.sym_next&&(Mt(r,!1),r.strm.avail_out===0)?xt:pr},_u=(r,a)=>{let s;for(;;){if(r.lookahead===0&&(gr(r),r.lookahead===0)){if(a===Tn)return xt;break}if(r.match_length=0,s=Sn(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,s&&(Mt(r,!1),r.strm.avail_out===0))return xt}return r.insert=0,a===Pt?(Mt(r,!0),r.strm.avail_out===0?Xn:Ar):r.sym_next&&(Mt(r,!1),r.strm.avail_out===0)?xt:pr};function en(r,a,s,f,d){this.good_length=r,this.max_lazy=a,this.nice_length=s,this.max_chain=f,this.func=d}var jr=[new en(0,0,0,0,Uc),new en(4,4,8,4,ho),new en(4,5,16,8,ho),new en(4,6,32,32,ho),new en(4,4,16,16,fr),new en(8,16,32,32,fr),new en(8,16,128,128,fr),new en(8,32,128,256,fr),new en(32,128,258,1024,fr),new en(32,258,258,4096,fr)],yu=r=>{r.window_size=2*r.w_size,In(r.head),r.max_lazy_match=jr[r.level].max_lazy,r.good_match=jr[r.level].good_length,r.nice_match=jr[r.level].nice_length,r.max_chain_length=jr[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Ae-1,r.match_available=0,r.ins_h=0};function Iu(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ki,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(xu*2),this.dyn_dtree=new Uint16Array((2*du+1)*2),this.bl_tree=new Uint16Array((2*gu+1)*2),In(this.dyn_ltree),In(this.dyn_dtree),In(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(wu+1),this.heap=new Uint16Array(2*bo+1),In(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*bo+1),In(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var ii=r=>{if(!r)return 1;let a=r.state;return!a||a.strm!==r||a.status!==dr&&a.status!==Lo&&a.status!==So&&a.status!==To&&a.status!==No&&a.status!==Mo&&a.status!==zn&&a.status!==Gr?1:0},zc=r=>{if(ii(r))return Hn(r,nn);r.total_in=r.total_out=0,r.data_type=au;let a=r.state;return a.pending=0,a.pending_out=0,a.wrap<0&&(a.wrap=-a.wrap),a.status=a.wrap===2?Lo:a.wrap?dr:zn,r.adler=a.wrap===2?0:1,a.last_flush=-2,Kf(a),ft},Hc=r=>{let a=zc(r);return a===ft&&yu(r.state),a},bu=(r,a)=>ii(r)||r.state.wrap!==2?nn:(r.state.gzhead=a,ft),Vc=(r,a,s,f,d,h)=>{if(!r)return nn;let p=1;if(a===nu&&(a=6),f<0?(p=0,f=-f):f>15&&(p=2,f-=16),d<1||d>lu||s!==Ki||f<8||f>15||a<0||a>9||h<0||h>su||f===8&&p!==1)return Hn(r,nn);f===8&&(f=9);let A=new Iu;return r.state=A,A.strm=r,A.status=dr,A.wrap=p,A.gzhead=null,A.w_bits=f,A.w_size=1<<A.w_bits,A.w_mask=A.w_size-1,A.hash_bits=d+7,A.hash_size=1<<A.hash_bits,A.hash_mask=A.hash_size-1,A.hash_shift=~~((A.hash_bits+Ae-1)/Ae),A.window=new Uint8Array(A.w_size*2),A.head=new Uint16Array(A.hash_size),A.prev=new Uint16Array(A.w_size),A.lit_bufsize=1<<d+6,A.pending_buf_size=A.lit_bufsize*4,A.pending_buf=new Uint8Array(A.pending_buf_size),A.sym_buf=A.lit_bufsize,A.sym_end=(A.lit_bufsize-1)*3,A.level=a,A.strategy=h,A.method=s,Hc(r)},Su=(r,a)=>Vc(r,a,Ki,cu,fu,ou),Tu=(r,a)=>{if(ii(r)||a>Gl||a<0)return r?Hn(r,nn):nn;let s=r.state;if(!r.output||r.avail_in!==0&&!r.input||s.status===Gr&&a!==Pt)return Hn(r,r.avail_out===0?uo:nn);let f=s.last_flush;if(s.last_flush=a,s.pending!==0){if(Nt(r),r.avail_out===0)return s.last_flush=-1,ft}else if(r.avail_in===0&&Yl(a)<=Yl(f)&&a!==Pt)return Hn(r,uo);if(s.status===Gr&&r.avail_in!==0)return Hn(r,uo);if(s.status===dr&&s.wrap===0&&(s.status=zn),s.status===dr){let d=Ki+(s.w_bits-8<<4)<<8,h=-1;if(s.strategy>=Hi||s.level<2?h=0:s.level<6?h=1:s.level===6?h=2:h=3,d|=h<<6,s.strstart!==0&&(d|=pu),d+=31-d%31,Xr(s,d),s.strstart!==0&&(Xr(s,r.adler>>>16),Xr(s,r.adler&65535)),r.adler=1,s.status=zn,Nt(r),s.pending!==0)return s.last_flush=-1,ft}if(s.status===Lo){if(r.adler=0,Te(s,31),Te(s,139),Te(s,8),s.gzhead)Te(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),Te(s,s.gzhead.time&255),Te(s,s.gzhead.time>>8&255),Te(s,s.gzhead.time>>16&255),Te(s,s.gzhead.time>>24&255),Te(s,s.level===9?2:s.strategy>=Hi||s.level<2?4:0),Te(s,s.gzhead.os&255),s.gzhead.extra&&s.gzhead.extra.length&&(Te(s,s.gzhead.extra.length&255),Te(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(r.adler=it(r.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=So;else if(Te(s,0),Te(s,0),Te(s,0),Te(s,0),Te(s,0),Te(s,s.level===9?2:s.strategy>=Hi||s.level<2?4:0),Te(s,Au),s.status=zn,Nt(r),s.pending!==0)return s.last_flush=-1,ft}if(s.status===So){if(s.gzhead.extra){let d=s.pending,h=(s.gzhead.extra.length&65535)-s.gzindex;for(;s.pending+h>s.pending_buf_size;){let A=s.pending_buf_size-s.pending;if(s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex,s.gzindex+A),s.pending),s.pending=s.pending_buf_size,s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d)),s.gzindex+=A,Nt(r),s.pending!==0)return s.last_flush=-1,ft;d=0,h-=A}let p=new Uint8Array(s.gzhead.extra);s.pending_buf.set(p.subarray(s.gzindex,s.gzindex+h),s.pending),s.pending+=h,s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d)),s.gzindex=0}s.status=To}if(s.status===To){if(s.gzhead.name){let d=s.pending,h;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d)),Nt(r),s.pending!==0)return s.last_flush=-1,ft;d=0}s.gzindex<s.gzhead.name.length?h=s.gzhead.name.charCodeAt(s.gzindex++)&255:h=0,Te(s,h)}while(h!==0);s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d)),s.gzindex=0}s.status=No}if(s.status===No){if(s.gzhead.comment){let d=s.pending,h;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d)),Nt(r),s.pending!==0)return s.last_flush=-1,ft;d=0}s.gzindex<s.gzhead.comment.length?h=s.gzhead.comment.charCodeAt(s.gzindex++)&255:h=0,Te(s,h)}while(h!==0);s.gzhead.hcrc&&s.pending>d&&(r.adler=it(r.adler,s.pending_buf,s.pending-d,d))}s.status=Mo}if(s.status===Mo){if(s.gzhead.hcrc){if(s.pending+2>s.pending_buf_size&&(Nt(r),s.pending!==0))return s.last_flush=-1,ft;Te(s,r.adler&255),Te(s,r.adler>>8&255),r.adler=0}if(s.status=zn,Nt(r),s.pending!==0)return s.last_flush=-1,ft}if(r.avail_in!==0||s.lookahead!==0||a!==Tn&&s.status!==Gr){let d=s.level===0?Uc(s,a):s.strategy===Hi?_u(s,a):s.strategy===iu?Cu(s,a):jr[s.level].func(s,a);if((d===Xn||d===Ar)&&(s.status=Gr),d===xt||d===Xn)return r.avail_out===0&&(s.last_flush=-1),ft;if(d===pr&&(a===$f?Jf(s):a!==Gl&&(Io(s,0,0,!1),a===eu&&(In(s.head),s.lookahead===0&&(s.strstart=0,s.block_start=0,s.insert=0))),Nt(r),r.avail_out===0))return s.last_flush=-1,ft}return a!==Pt?ft:s.wrap<=0?jl:(s.wrap===2?(Te(s,r.adler&255),Te(s,r.adler>>8&255),Te(s,r.adler>>16&255),Te(s,r.adler>>24&255),Te(s,r.total_in&255),Te(s,r.total_in>>8&255),Te(s,r.total_in>>16&255),Te(s,r.total_in>>24&255)):(Xr(s,r.adler>>>16),Xr(s,r.adler&65535)),Nt(r),s.wrap>0&&(s.wrap=-s.wrap),s.pending!==0?ft:jl)},Nu=r=>{if(ii(r))return nn;let a=r.state.status;return r.state=null,a===zn?Hn(r,tu):ft},Mu=(r,a)=>{let s=a.length;if(ii(r))return nn;let f=r.state,d=f.wrap;if(d===2||d===1&&f.status!==dr||f.lookahead)return nn;if(d===1&&(r.adler=$r(r.adler,a,s,0)),f.wrap=0,s>=f.w_size){d===0&&(In(f.head),f.strstart=0,f.block_start=0,f.insert=0);let y=new Uint8Array(f.w_size);y.set(a.subarray(s-f.w_size,s),0),a=y,s=f.w_size}let h=r.avail_in,p=r.next_in,A=r.input;for(r.avail_in=s,r.next_in=0,r.input=a,gr(f);f.lookahead>=Ae;){let y=f.strstart,x=f.lookahead-(Ae-1);do f.ins_h=Nn(f,f.ins_h,f.window[y+Ae-1]),f.prev[y&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=y,y++;while(--x);f.strstart=y,f.lookahead=Ae-1,gr(f)}return f.strstart+=f.lookahead,f.block_start=f.strstart,f.insert=f.lookahead,f.lookahead=0,f.match_length=f.prev_length=Ae-1,f.match_available=0,r.next_in=p,r.input=A,r.avail_in=h,f.wrap=d,ft},Ou=Su,Ru=Vc,Du=Hc,vu=zc,Bu=bu,Lu=Tu,ku=Nu,Pu=Mu,Fu="pako deflate (from Nodeca project)",Wr={deflateInit:Ou,deflateInit2:Ru,deflateReset:Du,deflateResetKeep:vu,deflateSetHeader:Bu,deflate:Lu,deflateEnd:ku,deflateSetDictionary:Pu,deflateInfo:Fu},Uu=(r,a)=>Object.prototype.hasOwnProperty.call(r,a),zu=function(r){let a=Array.prototype.slice.call(arguments,1);for(;a.length;){let s=a.shift();if(s){if(typeof s!="object")throw new TypeError(s+"must be non-object");for(let f in s)Uu(s,f)&&(r[f]=s[f])}}return r},Hu=r=>{let a=0;for(let f=0,d=r.length;f<d;f++)a+=r[f].length;let s=new Uint8Array(a);for(let f=0,d=0,h=r.length;f<h;f++){let p=r[f];s.set(p,d),d+=p.length}return s},qi={assign:zu,flattenChunks:Hu},Xc=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Xc=!1}var ei=new Uint8Array(256);for(let r=0;r<256;r++)ei[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;ei[254]=ei[254]=1;var Vu=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let a,s,f,d,h,p=r.length,A=0;for(d=0;d<p;d++)s=r.charCodeAt(d),(s&64512)===55296&&d+1<p&&(f=r.charCodeAt(d+1),(f&64512)===56320&&(s=65536+(s-55296<<10)+(f-56320),d++)),A+=s<128?1:s<2048?2:s<65536?3:4;for(a=new Uint8Array(A),h=0,d=0;h<A;d++)s=r.charCodeAt(d),(s&64512)===55296&&d+1<p&&(f=r.charCodeAt(d+1),(f&64512)===56320&&(s=65536+(s-55296<<10)+(f-56320),d++)),s<128?a[h++]=s:s<2048?(a[h++]=192|s>>>6,a[h++]=128|s&63):s<65536?(a[h++]=224|s>>>12,a[h++]=128|s>>>6&63,a[h++]=128|s&63):(a[h++]=240|s>>>18,a[h++]=128|s>>>12&63,a[h++]=128|s>>>6&63,a[h++]=128|s&63);return a},Xu=(r,a)=>{if(a<65534&&r.subarray&&Xc)return String.fromCharCode.apply(null,r.length===a?r:r.subarray(0,a));let s="";for(let f=0;f<a;f++)s+=String.fromCharCode(r[f]);return s},Gu=(r,a)=>{let s=a||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,a));let f,d,h=new Array(s*2);for(d=0,f=0;f<s;){let p=r[f++];if(p<128){h[d++]=p;continue}let A=ei[p];if(A>4){h[d++]=65533,f+=A-1;continue}for(p&=A===2?31:A===3?15:7;A>1&&f<s;)p=p<<6|r[f++]&63,A--;if(A>1){h[d++]=65533;continue}p<65536?h[d++]=p:(p-=65536,h[d++]=55296|p>>10&1023,h[d++]=56320|p&1023)}return Xu(h,d)},ju=(r,a)=>{a=a||r.length,a>r.length&&(a=r.length);let s=a-1;for(;s>=0&&(r[s]&192)===128;)s--;return s<0||s===0?a:s+ei[r[s]]>a?s:a},ti={string2buf:Vu,buf2string:Gu,utf8border:ju};function Yu(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Gc=Yu,jc=Object.prototype.toString,{Z_NO_FLUSH:Wu,Z_SYNC_FLUSH:Zu,Z_FULL_FLUSH:Qu,Z_FINISH:Ku,Z_OK:Zi,Z_STREAM_END:qu,Z_DEFAULT_COMPRESSION:Ju,Z_DEFAULT_STRATEGY:$u,Z_DEFLATED:eh}=wr;function si(r){this.options=qi.assign({level:Ju,method:eh,chunkSize:16384,windowBits:15,memLevel:8,strategy:$u},r||{});let a=this.options;a.raw&&a.windowBits>0?a.windowBits=-a.windowBits:a.gzip&&a.windowBits>0&&a.windowBits<16&&(a.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gc,this.strm.avail_out=0;let s=Wr.deflateInit2(this.strm,a.level,a.method,a.windowBits,a.memLevel,a.strategy);if(s!==Zi)throw new Error(Vn[s]);if(a.header&&Wr.deflateSetHeader(this.strm,a.header),a.dictionary){let f;if(typeof a.dictionary=="string"?f=ti.string2buf(a.dictionary):jc.call(a.dictionary)==="[object ArrayBuffer]"?f=new Uint8Array(a.dictionary):f=a.dictionary,s=Wr.deflateSetDictionary(this.strm,f),s!==Zi)throw new Error(Vn[s]);this._dict_set=!0}}si.prototype.push=function(r,a){let s=this.strm,f=this.options.chunkSize,d,h;if(this.ended)return!1;for(a===~~a?h=a:h=a===!0?Ku:Wu,typeof r=="string"?s.input=ti.string2buf(r):jc.call(r)==="[object ArrayBuffer]"?s.input=new Uint8Array(r):s.input=r,s.next_in=0,s.avail_in=s.input.length;;){if(s.avail_out===0&&(s.output=new Uint8Array(f),s.next_out=0,s.avail_out=f),(h===Zu||h===Qu)&&s.avail_out<=6){this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;continue}if(d=Wr.deflate(s,h),d===qu)return s.next_out>0&&this.onData(s.output.subarray(0,s.next_out)),d=Wr.deflateEnd(this.strm),this.onEnd(d),this.ended=!0,d===Zi;if(s.avail_out===0){this.onData(s.output);continue}if(h>0&&s.next_out>0){this.onData(s.output.subarray(0,s.next_out)),s.avail_out=0;continue}if(s.avail_in===0)break}return!0};si.prototype.onData=function(r){this.chunks.push(r)};si.prototype.onEnd=function(r){r===Zi&&(this.result=qi.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ko(r,a){let s=new si(a);if(s.push(r,!0),s.err)throw s.msg||Vn[s.err];return s.result}function th(r,a){return a=a||{},a.raw=!0,ko(r,a)}function nh(r,a){return a=a||{},a.gzip=!0,ko(r,a)}var rh=si,ih=ko,sh=th,oh=nh,ah=wr,lh={Deflate:rh,deflate:ih,deflateRaw:sh,gzip:oh,constants:ah},Vi=16209,ch=16191,fh=function(a,s){let f,d,h,p,A,y,x,_,v,R,N,V,K,H,U,W,te,z,L,Y,O,le,re,k,G=a.state;f=a.next_in,re=a.input,d=f+(a.avail_in-5),h=a.next_out,k=a.output,p=h-(s-a.avail_out),A=h+(a.avail_out-257),y=G.dmax,x=G.wsize,_=G.whave,v=G.wnext,R=G.window,N=G.hold,V=G.bits,K=G.lencode,H=G.distcode,U=(1<<G.lenbits)-1,W=(1<<G.distbits)-1;e:do{V<15&&(N+=re[f++]<<V,V+=8,N+=re[f++]<<V,V+=8),te=K[N&U];t:for(;;){if(z=te>>>24,N>>>=z,V-=z,z=te>>>16&255,z===0)k[h++]=te&65535;else if(z&16){L=te&65535,z&=15,z&&(V<z&&(N+=re[f++]<<V,V+=8),L+=N&(1<<z)-1,N>>>=z,V-=z),V<15&&(N+=re[f++]<<V,V+=8,N+=re[f++]<<V,V+=8),te=H[N&W];n:for(;;){if(z=te>>>24,N>>>=z,V-=z,z=te>>>16&255,z&16){if(Y=te&65535,z&=15,V<z&&(N+=re[f++]<<V,V+=8,V<z&&(N+=re[f++]<<V,V+=8)),Y+=N&(1<<z)-1,Y>y){a.msg="invalid distance too far back",G.mode=Vi;break e}if(N>>>=z,V-=z,z=h-p,Y>z){if(z=Y-z,z>_&&G.sane){a.msg="invalid distance too far back",G.mode=Vi;break e}if(O=0,le=R,v===0){if(O+=x-z,z<L){L-=z;do k[h++]=R[O++];while(--z);O=h-Y,le=k}}else if(v<z){if(O+=x+v-z,z-=v,z<L){L-=z;do k[h++]=R[O++];while(--z);if(O=0,v<L){z=v,L-=z;do k[h++]=R[O++];while(--z);O=h-Y,le=k}}}else if(O+=v-z,z<L){L-=z;do k[h++]=R[O++];while(--z);O=h-Y,le=k}for(;L>2;)k[h++]=le[O++],k[h++]=le[O++],k[h++]=le[O++],L-=3;L&&(k[h++]=le[O++],L>1&&(k[h++]=le[O++]))}else{O=h-Y;do k[h++]=k[O++],k[h++]=k[O++],k[h++]=k[O++],L-=3;while(L>2);L&&(k[h++]=k[O++],L>1&&(k[h++]=k[O++]))}}else if((z&64)===0){te=H[(te&65535)+(N&(1<<z)-1)];continue n}else{a.msg="invalid distance code",G.mode=Vi;break e}break}}else if((z&64)===0){te=K[(te&65535)+(N&(1<<z)-1)];continue t}else if(z&32){G.mode=ch;break e}else{a.msg="invalid literal/length code",G.mode=Vi;break e}break}}while(f<d&&h<A);L=V>>3,f-=L,V-=L<<3,N&=(1<<V)-1,a.next_in=f,a.next_out=h,a.avail_in=f<d?5+(d-f):5-(f-d),a.avail_out=h<A?257+(A-h):257-(h-A),G.hold=N,G.bits=V},ur=15,Wl=852,Zl=592,Ql=0,go=1,Kl=2,uh=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),hh=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),dh=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),gh=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),xh=(r,a,s,f,d,h,p,A)=>{let y=A.bits,x=0,_=0,v=0,R=0,N=0,V=0,K=0,H=0,U=0,W=0,te,z,L,Y,O,le=null,re,k=new Uint16Array(ur+1),G=new Uint16Array(ur+1),$=null,M,ue,q;for(x=0;x<=ur;x++)k[x]=0;for(_=0;_<f;_++)k[a[s+_]]++;for(N=y,R=ur;R>=1&&k[R]===0;R--);if(N>R&&(N=R),R===0)return d[h++]=1<<24|64<<16|0,d[h++]=1<<24|64<<16|0,A.bits=1,0;for(v=1;v<R&&k[v]===0;v++);for(N<v&&(N=v),H=1,x=1;x<=ur;x++)if(H<<=1,H-=k[x],H<0)return-1;if(H>0&&(r===Ql||R!==1))return-1;for(G[1]=0,x=1;x<ur;x++)G[x+1]=G[x]+k[x];for(_=0;_<f;_++)a[s+_]!==0&&(p[G[a[s+_]]++]=_);if(r===Ql?(le=$=p,re=20):r===go?(le=uh,$=hh,re=257):(le=dh,$=gh,re=0),W=0,_=0,x=v,O=h,V=N,K=0,L=-1,U=1<<N,Y=U-1,r===go&&U>Wl||r===Kl&&U>Zl)return 1;for(;;){M=x-K,p[_]+1<re?(ue=0,q=p[_]):p[_]>=re?(ue=$[p[_]-re],q=le[p[_]-re]):(ue=96,q=0),te=1<<x-K,z=1<<V,v=z;do z-=te,d[O+(W>>K)+z]=M<<24|ue<<16|q|0;while(z!==0);for(te=1<<x-1;W&te;)te>>=1;if(te!==0?(W&=te-1,W+=te):W=0,_++,--k[x]===0){if(x===R)break;x=a[s+p[_]]}if(x>N&&(W&Y)!==L){for(K===0&&(K=N),O+=v,V=x-K,H=1<<V;V+K<R&&(H-=k[V+K],!(H<=0));)V++,H<<=1;if(U+=1<<V,r===go&&U>Wl||r===Kl&&U>Zl)return 1;L=W&Y,d[L]=N<<24|V<<16|O-h|0}}return W!==0&&(d[O+W]=x-K<<24|64<<16|0),A.bits=N,0},Zr=xh,wh=0,Yc=1,Wc=2,{Z_FINISH:ql,Z_BLOCK:ph,Z_TREES:Xi,Z_OK:Gn,Z_STREAM_END:Ah,Z_NEED_DICT:Eh,Z_STREAM_ERROR:Ft,Z_DATA_ERROR:Zc,Z_MEM_ERROR:Qc,Z_BUF_ERROR:mh,Z_DEFLATED:Jl}=wr,Ji=16180,$l=16181,ec=16182,tc=16183,nc=16184,rc=16185,ic=16186,sc=16187,oc=16188,ac=16189,Qi=16190,cn=16191,xo=16192,lc=16193,wo=16194,cc=16195,fc=16196,uc=16197,hc=16198,Gi=16199,ji=16200,dc=16201,gc=16202,xc=16203,wc=16204,pc=16205,po=16206,Ac=16207,Ec=16208,He=16209,Kc=16210,qc=16211,Ch=852,_h=592,yh=15,Ih=yh,mc=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function bh(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var jn=r=>{if(!r)return 1;let a=r.state;return!a||a.strm!==r||a.mode<Ji||a.mode>qc?1:0},Jc=r=>{if(jn(r))return Ft;let a=r.state;return r.total_in=r.total_out=a.total=0,r.msg="",a.wrap&&(r.adler=a.wrap&1),a.mode=Ji,a.last=0,a.havedict=0,a.flags=-1,a.dmax=32768,a.head=null,a.hold=0,a.bits=0,a.lencode=a.lendyn=new Int32Array(Ch),a.distcode=a.distdyn=new Int32Array(_h),a.sane=1,a.back=-1,Gn},$c=r=>{if(jn(r))return Ft;let a=r.state;return a.wsize=0,a.whave=0,a.wnext=0,Jc(r)},e1=(r,a)=>{let s;if(jn(r))return Ft;let f=r.state;return a<0?(s=0,a=-a):(s=(a>>4)+5,a<48&&(a&=15)),a&&(a<8||a>15)?Ft:(f.window!==null&&f.wbits!==a&&(f.window=null),f.wrap=s,f.wbits=a,$c(r))},t1=(r,a)=>{if(!r)return Ft;let s=new bh;r.state=s,s.strm=r,s.window=null,s.mode=Ji;let f=e1(r,a);return f!==Gn&&(r.state=null),f},Sh=r=>t1(r,Ih),Cc=!0,Ao,Eo,Th=r=>{if(Cc){Ao=new Int32Array(512),Eo=new Int32Array(32);let a=0;for(;a<144;)r.lens[a++]=8;for(;a<256;)r.lens[a++]=9;for(;a<280;)r.lens[a++]=7;for(;a<288;)r.lens[a++]=8;for(Zr(Yc,r.lens,0,288,Ao,0,r.work,{bits:9}),a=0;a<32;)r.lens[a++]=5;Zr(Wc,r.lens,0,32,Eo,0,r.work,{bits:5}),Cc=!1}r.lencode=Ao,r.lenbits=9,r.distcode=Eo,r.distbits=5},n1=(r,a,s,f)=>{let d,h=r.state;return h.window===null&&(h.wsize=1<<h.wbits,h.wnext=0,h.whave=0,h.window=new Uint8Array(h.wsize)),f>=h.wsize?(h.window.set(a.subarray(s-h.wsize,s),0),h.wnext=0,h.whave=h.wsize):(d=h.wsize-h.wnext,d>f&&(d=f),h.window.set(a.subarray(s-f,s-f+d),h.wnext),f-=d,f?(h.window.set(a.subarray(s-f,s),0),h.wnext=f,h.whave=h.wsize):(h.wnext+=d,h.wnext===h.wsize&&(h.wnext=0),h.whave<h.wsize&&(h.whave+=d))),0},Nh=(r,a)=>{let s,f,d,h,p,A,y,x,_,v,R,N,V,K,H=0,U,W,te,z,L,Y,O,le,re=new Uint8Array(4),k,G,$=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(jn(r)||!r.output||!r.input&&r.avail_in!==0)return Ft;s=r.state,s.mode===cn&&(s.mode=xo),p=r.next_out,d=r.output,y=r.avail_out,h=r.next_in,f=r.input,A=r.avail_in,x=s.hold,_=s.bits,v=A,R=y,le=Gn;e:for(;;)switch(s.mode){case Ji:if(s.wrap===0){s.mode=xo;break}for(;_<16;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(s.wrap&2&&x===35615){s.wbits===0&&(s.wbits=15),s.check=0,re[0]=x&255,re[1]=x>>>8&255,s.check=it(s.check,re,2,0),x=0,_=0,s.mode=$l;break}if(s.head&&(s.head.done=!1),!(s.wrap&1)||(((x&255)<<8)+(x>>8))%31){r.msg="incorrect header check",s.mode=He;break}if((x&15)!==Jl){r.msg="unknown compression method",s.mode=He;break}if(x>>>=4,_-=4,O=(x&15)+8,s.wbits===0&&(s.wbits=O),O>15||O>s.wbits){r.msg="invalid window size",s.mode=He;break}s.dmax=1<<s.wbits,s.flags=0,r.adler=s.check=1,s.mode=x&512?ac:cn,x=0,_=0;break;case $l:for(;_<16;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(s.flags=x,(s.flags&255)!==Jl){r.msg="unknown compression method",s.mode=He;break}if(s.flags&57344){r.msg="unknown header flags set",s.mode=He;break}s.head&&(s.head.text=x>>8&1),s.flags&512&&s.wrap&4&&(re[0]=x&255,re[1]=x>>>8&255,s.check=it(s.check,re,2,0)),x=0,_=0,s.mode=ec;case ec:for(;_<32;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.head&&(s.head.time=x),s.flags&512&&s.wrap&4&&(re[0]=x&255,re[1]=x>>>8&255,re[2]=x>>>16&255,re[3]=x>>>24&255,s.check=it(s.check,re,4,0)),x=0,_=0,s.mode=tc;case tc:for(;_<16;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.head&&(s.head.xflags=x&255,s.head.os=x>>8),s.flags&512&&s.wrap&4&&(re[0]=x&255,re[1]=x>>>8&255,s.check=it(s.check,re,2,0)),x=0,_=0,s.mode=nc;case nc:if(s.flags&1024){for(;_<16;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.length=x,s.head&&(s.head.extra_len=x),s.flags&512&&s.wrap&4&&(re[0]=x&255,re[1]=x>>>8&255,s.check=it(s.check,re,2,0)),x=0,_=0}else s.head&&(s.head.extra=null);s.mode=rc;case rc:if(s.flags&1024&&(N=s.length,N>A&&(N=A),N&&(s.head&&(O=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Uint8Array(s.head.extra_len)),s.head.extra.set(f.subarray(h,h+N),O)),s.flags&512&&s.wrap&4&&(s.check=it(s.check,f,N,h)),A-=N,h+=N,s.length-=N),s.length))break e;s.length=0,s.mode=ic;case ic:if(s.flags&2048){if(A===0)break e;N=0;do O=f[h+N++],s.head&&O&&s.length<65536&&(s.head.name+=String.fromCharCode(O));while(O&&N<A);if(s.flags&512&&s.wrap&4&&(s.check=it(s.check,f,N,h)),A-=N,h+=N,O)break e}else s.head&&(s.head.name=null);s.length=0,s.mode=sc;case sc:if(s.flags&4096){if(A===0)break e;N=0;do O=f[h+N++],s.head&&O&&s.length<65536&&(s.head.comment+=String.fromCharCode(O));while(O&&N<A);if(s.flags&512&&s.wrap&4&&(s.check=it(s.check,f,N,h)),A-=N,h+=N,O)break e}else s.head&&(s.head.comment=null);s.mode=oc;case oc:if(s.flags&512){for(;_<16;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(s.wrap&4&&x!==(s.check&65535)){r.msg="header crc mismatch",s.mode=He;break}x=0,_=0}s.head&&(s.head.hcrc=s.flags>>9&1,s.head.done=!0),r.adler=s.check=0,s.mode=cn;break;case ac:for(;_<32;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}r.adler=s.check=mc(x),x=0,_=0,s.mode=Qi;case Qi:if(s.havedict===0)return r.next_out=p,r.avail_out=y,r.next_in=h,r.avail_in=A,s.hold=x,s.bits=_,Eh;r.adler=s.check=1,s.mode=cn;case cn:if(a===ph||a===Xi)break e;case xo:if(s.last){x>>>=_&7,_-=_&7,s.mode=po;break}for(;_<3;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}switch(s.last=x&1,x>>>=1,_-=1,x&3){case 0:s.mode=lc;break;case 1:if(Th(s),s.mode=Gi,a===Xi){x>>>=2,_-=2;break e}break;case 2:s.mode=fc;break;case 3:r.msg="invalid block type",s.mode=He}x>>>=2,_-=2;break;case lc:for(x>>>=_&7,_-=_&7;_<32;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if((x&65535)!==(x>>>16^65535)){r.msg="invalid stored block lengths",s.mode=He;break}if(s.length=x&65535,x=0,_=0,s.mode=wo,a===Xi)break e;case wo:s.mode=cc;case cc:if(N=s.length,N){if(N>A&&(N=A),N>y&&(N=y),N===0)break e;d.set(f.subarray(h,h+N),p),A-=N,h+=N,y-=N,p+=N,s.length-=N;break}s.mode=cn;break;case fc:for(;_<14;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(s.nlen=(x&31)+257,x>>>=5,_-=5,s.ndist=(x&31)+1,x>>>=5,_-=5,s.ncode=(x&15)+4,x>>>=4,_-=4,s.nlen>286||s.ndist>30){r.msg="too many length or distance symbols",s.mode=He;break}s.have=0,s.mode=uc;case uc:for(;s.have<s.ncode;){for(;_<3;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.lens[$[s.have++]]=x&7,x>>>=3,_-=3}for(;s.have<19;)s.lens[$[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,k={bits:s.lenbits},le=Zr(wh,s.lens,0,19,s.lencode,0,s.work,k),s.lenbits=k.bits,le){r.msg="invalid code lengths set",s.mode=He;break}s.have=0,s.mode=hc;case hc:for(;s.have<s.nlen+s.ndist;){for(;H=s.lencode[x&(1<<s.lenbits)-1],U=H>>>24,W=H>>>16&255,te=H&65535,!(U<=_);){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(te<16)x>>>=U,_-=U,s.lens[s.have++]=te;else{if(te===16){for(G=U+2;_<G;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(x>>>=U,_-=U,s.have===0){r.msg="invalid bit length repeat",s.mode=He;break}O=s.lens[s.have-1],N=3+(x&3),x>>>=2,_-=2}else if(te===17){for(G=U+3;_<G;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}x>>>=U,_-=U,O=0,N=3+(x&7),x>>>=3,_-=3}else{for(G=U+7;_<G;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}x>>>=U,_-=U,O=0,N=11+(x&127),x>>>=7,_-=7}if(s.have+N>s.nlen+s.ndist){r.msg="invalid bit length repeat",s.mode=He;break}for(;N--;)s.lens[s.have++]=O}}if(s.mode===He)break;if(s.lens[256]===0){r.msg="invalid code -- missing end-of-block",s.mode=He;break}if(s.lenbits=9,k={bits:s.lenbits},le=Zr(Yc,s.lens,0,s.nlen,s.lencode,0,s.work,k),s.lenbits=k.bits,le){r.msg="invalid literal/lengths set",s.mode=He;break}if(s.distbits=6,s.distcode=s.distdyn,k={bits:s.distbits},le=Zr(Wc,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,k),s.distbits=k.bits,le){r.msg="invalid distances set",s.mode=He;break}if(s.mode=Gi,a===Xi)break e;case Gi:s.mode=ji;case ji:if(A>=6&&y>=258){r.next_out=p,r.avail_out=y,r.next_in=h,r.avail_in=A,s.hold=x,s.bits=_,fh(r,R),p=r.next_out,d=r.output,y=r.avail_out,h=r.next_in,f=r.input,A=r.avail_in,x=s.hold,_=s.bits,s.mode===cn&&(s.back=-1);break}for(s.back=0;H=s.lencode[x&(1<<s.lenbits)-1],U=H>>>24,W=H>>>16&255,te=H&65535,!(U<=_);){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(W&&(W&240)===0){for(z=U,L=W,Y=te;H=s.lencode[Y+((x&(1<<z+L)-1)>>z)],U=H>>>24,W=H>>>16&255,te=H&65535,!(z+U<=_);){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}x>>>=z,_-=z,s.back+=z}if(x>>>=U,_-=U,s.back+=U,s.length=te,W===0){s.mode=pc;break}if(W&32){s.back=-1,s.mode=cn;break}if(W&64){r.msg="invalid literal/length code",s.mode=He;break}s.extra=W&15,s.mode=dc;case dc:if(s.extra){for(G=s.extra;_<G;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.length+=x&(1<<s.extra)-1,x>>>=s.extra,_-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=gc;case gc:for(;H=s.distcode[x&(1<<s.distbits)-1],U=H>>>24,W=H>>>16&255,te=H&65535,!(U<=_);){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if((W&240)===0){for(z=U,L=W,Y=te;H=s.distcode[Y+((x&(1<<z+L)-1)>>z)],U=H>>>24,W=H>>>16&255,te=H&65535,!(z+U<=_);){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}x>>>=z,_-=z,s.back+=z}if(x>>>=U,_-=U,s.back+=U,W&64){r.msg="invalid distance code",s.mode=He;break}s.offset=te,s.extra=W&15,s.mode=xc;case xc:if(s.extra){for(G=s.extra;_<G;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}s.offset+=x&(1<<s.extra)-1,x>>>=s.extra,_-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){r.msg="invalid distance too far back",s.mode=He;break}s.mode=wc;case wc:if(y===0)break e;if(N=R-y,s.offset>N){if(N=s.offset-N,N>s.whave&&s.sane){r.msg="invalid distance too far back",s.mode=He;break}N>s.wnext?(N-=s.wnext,V=s.wsize-N):V=s.wnext-N,N>s.length&&(N=s.length),K=s.window}else K=d,V=p-s.offset,N=s.length;N>y&&(N=y),y-=N,s.length-=N;do d[p++]=K[V++];while(--N);s.length===0&&(s.mode=ji);break;case pc:if(y===0)break e;d[p++]=s.length,y--,s.mode=ji;break;case po:if(s.wrap){for(;_<32;){if(A===0)break e;A--,x|=f[h++]<<_,_+=8}if(R-=y,r.total_out+=R,s.total+=R,s.wrap&4&&R&&(r.adler=s.check=s.flags?it(s.check,d,R,p-R):$r(s.check,d,R,p-R)),R=y,s.wrap&4&&(s.flags?x:mc(x))!==s.check){r.msg="incorrect data check",s.mode=He;break}x=0,_=0}s.mode=Ac;case Ac:if(s.wrap&&s.flags){for(;_<32;){if(A===0)break e;A--,x+=f[h++]<<_,_+=8}if(s.wrap&4&&x!==(s.total&4294967295)){r.msg="incorrect length check",s.mode=He;break}x=0,_=0}s.mode=Ec;case Ec:le=Ah;break e;case He:le=Zc;break e;case Kc:return Qc;case qc:default:return Ft}return r.next_out=p,r.avail_out=y,r.next_in=h,r.avail_in=A,s.hold=x,s.bits=_,(s.wsize||R!==r.avail_out&&s.mode<He&&(s.mode<po||a!==ql))&&n1(r,r.output,r.next_out,R-r.avail_out),v-=r.avail_in,R-=r.avail_out,r.total_in+=v,r.total_out+=R,s.total+=R,s.wrap&4&&R&&(r.adler=s.check=s.flags?it(s.check,d,R,r.next_out-R):$r(s.check,d,R,r.next_out-R)),r.data_type=s.bits+(s.last?64:0)+(s.mode===cn?128:0)+(s.mode===Gi||s.mode===wo?256:0),(v===0&&R===0||a===ql)&&le===Gn&&(le=mh),le},Mh=r=>{if(jn(r))return Ft;let a=r.state;return a.window&&(a.window=null),r.state=null,Gn},Oh=(r,a)=>{if(jn(r))return Ft;let s=r.state;return(s.wrap&2)===0?Ft:(s.head=a,a.done=!1,Gn)},Rh=(r,a)=>{let s=a.length,f,d,h;return jn(r)||(f=r.state,f.wrap!==0&&f.mode!==Qi)?Ft:f.mode===Qi&&(d=1,d=$r(d,a,s,0),d!==f.check)?Zc:(h=n1(r,a,s,s),h?(f.mode=Kc,Qc):(f.havedict=1,Gn))},Dh=$c,vh=e1,Bh=Jc,Lh=Sh,kh=t1,Ph=Nh,Fh=Mh,Uh=Oh,zh=Rh,Hh="pako inflate (from Nodeca project)",un={inflateReset:Dh,inflateReset2:vh,inflateResetKeep:Bh,inflateInit:Lh,inflateInit2:kh,inflate:Ph,inflateEnd:Fh,inflateGetHeader:Uh,inflateSetDictionary:zh,inflateInfo:Hh};function Vh(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Xh=Vh,r1=Object.prototype.toString,{Z_NO_FLUSH:Gh,Z_FINISH:jh,Z_OK:ni,Z_STREAM_END:mo,Z_NEED_DICT:Co,Z_STREAM_ERROR:Yh,Z_DATA_ERROR:_c,Z_MEM_ERROR:Wh}=wr;function oi(r){this.options=qi.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let a=this.options;a.raw&&a.windowBits>=0&&a.windowBits<16&&(a.windowBits=-a.windowBits,a.windowBits===0&&(a.windowBits=-15)),a.windowBits>=0&&a.windowBits<16&&!(r&&r.windowBits)&&(a.windowBits+=32),a.windowBits>15&&a.windowBits<48&&(a.windowBits&15)===0&&(a.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gc,this.strm.avail_out=0;let s=un.inflateInit2(this.strm,a.windowBits);if(s!==ni)throw new Error(Vn[s]);if(this.header=new Xh,un.inflateGetHeader(this.strm,this.header),a.dictionary&&(typeof a.dictionary=="string"?a.dictionary=ti.string2buf(a.dictionary):r1.call(a.dictionary)==="[object ArrayBuffer]"&&(a.dictionary=new Uint8Array(a.dictionary)),a.raw&&(s=un.inflateSetDictionary(this.strm,a.dictionary),s!==ni)))throw new Error(Vn[s])}oi.prototype.push=function(r,a){let s=this.strm,f=this.options.chunkSize,d=this.options.dictionary,h,p,A;if(this.ended)return!1;for(a===~~a?p=a:p=a===!0?jh:Gh,r1.call(r)==="[object ArrayBuffer]"?s.input=new Uint8Array(r):s.input=r,s.next_in=0,s.avail_in=s.input.length;;){for(s.avail_out===0&&(s.output=new Uint8Array(f),s.next_out=0,s.avail_out=f),h=un.inflate(s,p),h===Co&&d&&(h=un.inflateSetDictionary(s,d),h===ni?h=un.inflate(s,p):h===_c&&(h=Co));s.avail_in>0&&h===mo&&s.state.wrap>0&&r[s.next_in]!==0;)un.inflateReset(s),h=un.inflate(s,p);switch(h){case Yh:case _c:case Co:case Wh:return this.onEnd(h),this.ended=!0,!1}if(A=s.avail_out,s.next_out&&(s.avail_out===0||h===mo))if(this.options.to==="string"){let y=ti.utf8border(s.output,s.next_out),x=s.next_out-y,_=ti.buf2string(s.output,y);s.next_out=x,s.avail_out=f-x,x&&s.output.set(s.output.subarray(y,y+x),0),this.onData(_)}else this.onData(s.output.length===s.next_out?s.output:s.output.subarray(0,s.next_out));if(!(h===ni&&A===0)){if(h===mo)return h=un.inflateEnd(this.strm),this.onEnd(h),this.ended=!0,!0;if(s.avail_in===0)break}}return!0};oi.prototype.onData=function(r){this.chunks.push(r)};oi.prototype.onEnd=function(r){r===ni&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qi.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Po(r,a){let s=new oi(a);if(s.push(r),s.err)throw s.msg||Vn[s.err];return s.result}function Zh(r,a){return a=a||{},a.raw=!0,Po(r,a)}var Qh=oi,Kh=Po,qh=Zh,Jh=Po,$h=wr,ed={Inflate:Qh,inflate:Kh,inflateRaw:qh,ungzip:Jh,constants:$h},{Deflate:wg,deflate:td,deflateRaw:pg,gzip:nd}=lh,{Inflate:rd,inflate:id,inflateRaw:Ag,ungzip:sd}=ed;var $i=td;var i1=nd,s1=rd,o1=id;var a1=sd;var os=Br(Fo());var Yt=Br(Fo());var ns=Br(u1());function gd(r){return ns.fromByteArray(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function h1(r){for(r=r.replace(/-/g,"+").replace(/_/g,"/");r.length%4;)r+="=";return ns.toByteArray(r)}var d1=256*1024,xd=16*1024;function g1(r,a){let s=new s1({chunkSize:xd}),f=[],d=0;if(s.onData=A=>{if(d+=A.length,d>d1)throw new Error(`QR payload expands beyond the ${d1/1024} KB limit (${a})`);f.push(A)},s.push(r,!0),s.err)throw new Error(`QR payload could not be decompressed (${a}): ${s.msg||s.err}`);let h=new Uint8Array(d),p=0;for(let A of f)h.set(A,p),p+=A.length;return h}function x1(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let a=Math.random()*16|0;return(r==="x"?a:a&3|8).toString(16)})}async function rs(r,a=null,s=null){try{console.log("\u{1F510} Starting COSE packing...");let f=JSON.stringify(r);console.log(`\u{1F4CA} Original payload size: ${f.length} characters`);let d,h=null;if(s){console.log("\u{1F510} Encrypting for specific recipient...");let V=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-384"},!0,["deriveKey","deriveBits"]);h=new Uint8Array(await crypto.subtle.exportKey("raw",V.publicKey));let K=await crypto.subtle.deriveBits({name:"ECDH",public:s},V.privateKey,384),H=await crypto.subtle.importKey("raw",K,"HKDF",!1,["deriveKey"]),U=await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-384",salt:new Uint8Array(0),info:new TextEncoder().encode("SecureBit QR ECDH AES key")},H,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),W=crypto.getRandomValues(new Uint8Array(12)),te=await crypto.subtle.encrypt({name:"AES-GCM",iv:W},U,new TextEncoder().encode(f));d={protected:{alg:"A256GCM"},unprotected:{epk:h},ciphertext:new Uint8Array(te),iv:W}}else console.log("\u{1F510} Using broadcast mode (no encryption)..."),h=crypto.getRandomValues(new Uint8Array(97)),d={plaintext:new TextEncoder().encode(f),epk:h};let p,A=Yt.encode(d);if(a){console.log("\u{1F510} Signing payload...");let V=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-384"},a,A));p=[Yt.encode({alg:"ES384"}),{kid:"securebit-sender"},A,V]}else console.log("\u{1F510} No signing key provided, using unsigned structure..."),p=[Yt.encode({alg:"none"}),{},A,new Uint8Array(0)];let y=Yt.encode(p),x=$i(y),_=gd(x);console.log(`\u{1F4CA} Compressed size: ${_.length} characters (${Math.round((1-_.length/f.length)*100)}% reduction)`);let R=Math.max(200,Math.floor(_.length/10)),N=[];if(_.length<=R)N.push(JSON.stringify({hdr:{v:1,id:x1(),seq:1,total:1},body:_}));else{let V=x1(),K=Math.ceil(_.length/R);console.log(`\u{1F4CA} COSE: Splitting ${_.length} chars into ${K} chunks (max ${R} chars per chunk)`);for(let H=0,U=1;H<_.length;H+=R,U++){let W=_.slice(H,H+R);N.push(JSON.stringify({hdr:{v:1,id:V,seq:U,total:K},body:W}))}}return console.log(`\u{1F4CA} Generated ${N.length} QR chunk(s)`),N}catch(f){throw console.error("\u274C Error in packSecurePayload:",f),f}}async function zo(r,a=null,s=null){try{console.log("\u{1F513} Starting COSE processing..."),console.log(`\u{1F4CA} Processing ${r.length} QR string(s)`);let f=await wd(r);if(!f.length)throw console.error("\u274C No complete packets found after assembly"),new Error("No complete packets found");console.log(`\u{1F4CA} Assembled ${f.length} complete packet(s)`),console.log("\u{1F4CA} First assembled packet:",f[0]);let d=[];for(let h of f)try{let p=h.jsonObj,A=h1(p.body||p),y=g1(A,"primary");console.log("\u{1F513} Decompressed CBOR bytes length:",y.length),console.log("\u{1F513} CBOR bytes type:",typeof y,y.constructor.name);let x=y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength);console.log("\u{1F513} Converted to ArrayBuffer, length:",x.byteLength);let _=Yt.decode(x);console.log("\u{1F513} Decoded COSE structure");let v,R,N,V;if(Array.isArray(_)?([v,R,N,V]=_,console.log("\u{1F513} COSE structure is array format")):(v=_.protected,R=_.unprotected,N=_.payload,V=_.signature,console.log("\u{1F513} COSE structure is object format (legacy)")),s&&V&&V.length>0){let U=Yt.encode([v,R,N]);if(!await crypto.subtle.verify({name:"ECDSA",hash:"SHA-384"},s,V,U)){console.warn("\u26A0\uFE0F Signature verification failed");continue}console.log("\u2705 Signature verified")}let K;if(N instanceof Uint8Array){let U=N.buffer.slice(N.byteOffset,N.byteOffset+N.byteLength);K=Yt.decode(U)}else K=N;console.log("\u{1F513} Inner payload type:",typeof K,K.constructor.name),console.log("\u{1F513} Inner payload keys:",Object.keys(K)),console.log("\u{1F513} Inner payload full object:",K);let H;if(K.ciphertext&&a){console.log("\u{1F513} Decrypting encrypted payload...");let U=K.unprotected?.epk||K.epk,W=await crypto.subtle.importKey("raw",U,{name:"ECDH",namedCurve:"P-384"},!0,[]),te=await crypto.subtle.deriveBits({name:"ECDH",public:W},a,384),z=await crypto.subtle.importKey("raw",te,"HKDF",!1,["deriveKey"]),L=await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-384",salt:new Uint8Array(0),info:new TextEncoder().encode("SecureBit QR ECDH AES key")},z,{name:"AES-GCM",length:256},!0,["decrypt"]),Y=await crypto.subtle.decrypt({name:"AES-GCM",iv:K.iv},L,K.ciphertext),O=new TextDecoder().decode(Y);H=JSON.parse(O)}else if(K.plaintext)console.log("\u{1F513} Processing plaintext payload..."),H=JSON.parse(new TextDecoder().decode(K.plaintext));else if(Object.keys(K).length===0){console.log("\u{1F513} Empty inner payload, using alternative approach...");try{let U=p.body||p;console.log("\u{1F513} Trying to decode original body:",U.substring(0,50)+"...");let W=h1(U),te=g1(W,"fallback");console.log("\u{1F513} Decompressed length:",te.length);let z=te.buffer.slice(te.byteOffset,te.byteOffset+te.byteLength),L=Yt.decode(z);console.log("\u{1F513} CBOR decoded structure:",L);let Y;if(Array.isArray(L)?(console.log("\u{1F513} Alternative: COSE structure is array format"),console.log("\u{1F513} Array length:",L.length),console.log("\u{1F513} Array elements:",L.map((O,le)=>`${le}: ${typeof O} ${O.constructor.name}`)),Y=L[2],console.log("\u{1F513} Payload at index 2:",Y)):(Y=L.payload,console.log("\u{1F513} Alternative: COSE structure is object format (legacy)")),Y&&Y instanceof Uint8Array){let O=Y.buffer.slice(Y.byteOffset,Y.byteOffset+Y.byteLength),le=Yt.decode(O);if(console.log("\u{1F513} Inner CBOR structure:",le),le.plaintext){let re=new TextDecoder().decode(le.plaintext);H=JSON.parse(re),console.log("\u{1F513} Successfully decoded via alternative approach"),console.log("\u{1F513} Alternative payloadObj:",H)}else{console.error("\u274C No plaintext found in inner CBOR structure");continue}}else if(Y&&typeof Y=="object"&&Object.keys(Y).length>0)if(console.log("\u{1F513} Payload is already decoded object:",Y),Y.plaintext){let O=new TextDecoder().decode(Y.plaintext);H=JSON.parse(O),console.log("\u{1F513} Successfully decoded from payload object"),console.log("\u{1F513} Alternative payloadObj:",H)}else{console.error("\u274C No plaintext found in payload object");continue}else{console.error("\u274C No payload found in CBOR structure"),console.log("\u{1F513} CBOR structure keys:",Object.keys(L)),console.log("\u{1F513} Payload type:",typeof Y),console.log("\u{1F513} Payload value:",Y);continue}}catch(U){console.error("\u274C Alternative approach failed:",U);continue}}else{console.warn("\u26A0\uFE0F Unknown payload format:",K);continue}d.push({payloadObj:H,senderVerified:!!s,encrypted:!!K.ciphertext})}catch(p){console.error("\u274C Error processing packet:",p);continue}return console.log(`\u2705 Successfully processed ${d.length} payload(s)`),d}catch(f){throw console.error("\u274C Error in receiveAndProcess:",f),f}}async function wd(r){let a=new Map;console.log("\u{1F527} Starting assembly of QR strings...");for(let f of r)try{console.log("\u{1F527} Parsing QR string:",f.substring(0,100)+"...");let d=JSON.parse(f);if(console.log("\u{1F527} Parsed structure:",d),d.hdr&&d.body){let h=d.hdr.id;console.log(`\u{1F527} Processing packet ID: ${h}, seq: ${d.hdr.seq}, total: ${d.hdr.total}`),a.has(h)||(a.set(h,{id:h,chunks:new Map,total:d.hdr.total}),console.log(`\u{1F527} Created new packet for ID: ${h}`));let p=a.get(h);if(p.chunks.set(d.hdr.seq,d.body),console.log(`\u{1F527} Added chunk ${d.hdr.seq} to packet ${h}. Current chunks: ${p.chunks.size}/${p.total}`),p.chunks.size===p.total){console.log(`\u{1F527} Packet ${h} is complete! Assembling body...`);let A="";for(let y=1;y<=p.total;y++)A+=p.chunks.get(y);p.jsonObj={body:A},p.complete=!0,console.log(`\u{1F527} Assembled body length: ${A.length} characters`)}}else console.warn("\u26A0\uFE0F QR string missing hdr or body:",d)}catch(d){console.warn("\u26A0\uFE0F Failed to parse QR string:",d);continue}let s=Array.from(a.values()).filter(f=>f.complete);return console.log(`\u{1F527} Assembly complete. Found ${s.length} complete packets`),s}window.packSecurePayload=rs;window.receiveAndProcess=zo;var Ot=Object.freeze({MAX_PAYLOAD_BYTES:512,MAX_CANDIDATES:8,MIN_UFRAG:4,MAX_UFRAG:64,MIN_PWD:22,MAX_PWD:64,FINGERPRINT_BYTES:32,COMMITMENT_BYTES:16,BINDING_BYTES:8,MAX_LIFETIME_MINUTES:60,MAX_EXT_BYTES:255,SURPLUS_CANDIDATE_BYTES:48,CLOCK_SKEW_MS:12e4}),pd=Date.UTC(2024,0,1);var Er=Object.freeze({OFFER:0,ANSWER:1}),Cg=Object.freeze(["actpass","active","passive"]),p1=Object.freeze([262144,1073741823,65536,null]),Ad=3,is=Object.freeze({MAX_MESSAGE_SIZE:1}),_g=Object.freeze({HOST_V4:0,HOST_MDNS:1,SRFLX_V4:2,RELAY_V4:3,HOST_V6:4,SRFLX_V6:5,RELAY_V6:6}),Ed=Object.freeze({0:4,1:16,2:4,3:4,4:16,5:16,6:16}),yg=Object.freeze({0:"host",1:"host",2:"srflx",3:"relay",4:"host",5:"srflx",6:"relay"}),Ig=Object.freeze({0:"v4",1:"mdns",2:"v4",3:"v4",4:"v6",5:"v6",6:"v6"}),md=Object.freeze([null,"passive","active","so"]),bg=Object.freeze({host:126,srflx:100,relay:0}),w1=/^[A-Za-z0-9+/]+$/,Ho=class extends Error{constructor(a,s="malformed"){super(a),this.name="DescriptorError",this.code=s}},me=(r,a)=>{throw new Ho(r,a)};var li=class{constructor(a){this.buf=a,this.i=0}need(a){this.i+a>this.buf.length&&me("descriptor is truncated")}u8(){return this.need(1),this.buf[this.i++]}u16(){this.need(2);let a=this.buf[this.i]<<8|this.buf[this.i+1];return this.i+=2,a}u24(){this.need(3);let a=this.buf[this.i]<<16|this.buf[this.i+1]<<8|this.buf[this.i+2];return this.i+=3,a}u32(){this.need(4);let a=(this.buf[this.i]<<24>>>0)+(this.buf[this.i+1]<<16)+(this.buf[this.i+2]<<8)+this.buf[this.i+3];return this.i+=4,a>>>0}bytes(a){return this.need(a),this.buf.slice(this.i,this.i+=a)}ascii(a){this.need(a);let s="";for(let f=0;f<a;f++){let d=this.buf[this.i+f];(d<32||d>126)&&me("non-printable byte in a text field"),s+=String.fromCharCode(d)}return this.i+=a,s}get rest(){return this.buf.length-this.i}};function Cd(r){let a=new li(r),s=new Map,f=-1;for(;a.rest>0;){let d=a.u8(),h=a.u8(),p=a.bytes(h);if(d<=f&&me("extension records must be in ascending type order without duplicates"),f=d,d===is.MAX_MESSAGE_SIZE){h!==4&&me("extension 0x01 must be 4 bytes");let A=new li(p).u32();(A<1024||A>2147483647)&&me("extension 0x01 value is out of range"),p1.includes(A)&&me("extension 0x01 duplicates a value the flags already encode"),s.set(d,A)}else me(`unknown extension type 0x${d.toString(16).padStart(2,"0")}`,"unknown_extension")}return s}function Vo(r,{nowMs:a=Date.now()}={}){r instanceof Uint8Array||me("descriptor must be a Uint8Array"),r.length===0&&me("descriptor is empty"),r.length>Ot.MAX_PAYLOAD_BYTES&&me("descriptor exceeds the payload limit");let s=new li(r),f=s.u8();f!==2&&me(`unsupported descriptor version 0x${f.toString(16)}`,"version");let d=s.u8(),h=d&3;h!==Er.OFFER&&h!==Er.ANSWER&&me("reserved descriptor type");let p=d>>2&3;p>2&&me("reserved DTLS setup role");let A=d>>4&3,y=(d&64)!==0,x=(d&128)!==0,_=s.u24(),v=pd+_*6e4;if(a-Ot.CLOCK_SKEW_MS>v){let O=Math.round((a-v)/6e4);me(`this code expired ${O} minute(s) ago. If it was just created, this device's clock or time zone is probably wrong \u2014 check the date and time settings.`,"expired")}v-a>Ot.MAX_LIFETIME_MINUTES*6e4+Ot.CLOCK_SKEW_MS&&me("descriptor lifetime is implausibly long","lifetime");let R=h===Er.ANSWER?s.bytes(Ot.BINDING_BYTES):null,N=s.bytes(Ot.FINGERPRINT_BYTES),V=s.u8();(V<Ot.MIN_UFRAG||V>Ot.MAX_UFRAG)&&me("ice-ufrag length out of range");let K=s.ascii(V);w1.test(K)||me("ice-ufrag contains characters outside the ICE alphabet");let H=s.u8();(H<Ot.MIN_PWD||H>Ot.MAX_PWD)&&me("ice-pwd length out of range");let U=s.ascii(H);w1.test(U)||me("ice-pwd contains characters outside the ICE alphabet");let W=s.u8();W>Ot.MAX_CANDIDATES&&me("too many candidates");let te=[];for(let O=0;O<W;O++){let le=s.u8(),re=le>>4&15,k=le&15,G=Ed[re];G===void 0&&me(`reserved candidate kind ${re}`),k>=md.length&&me("reserved TCP candidate type");let $=s.bytes(G),M=s.u16();M<1&&me("candidate port must be non-zero"),te.push({kind:re,tcptype:k,addr:$,port:M})}let z=null;y&&(z=s.bytes(Ot.COMMITMENT_BYTES));let L=new Map;if(x){let O=s.u8();O===0&&me("extension area is flagged but empty"),L=Cd(s.bytes(O))}s.rest!==0&&me(`${s.rest} trailing byte(s) after the descriptor`);let Y;return A===Ad?(L.has(is.MAX_MESSAGE_SIZE)||me("flags promise an explicit max-message-size but no extension carries it"),Y=L.get(is.MAX_MESSAGE_SIZE)):(L.has(is.MAX_MESSAGE_SIZE)&&me("extension 0x01 present but the flags do not select it"),Y=p1[A]),{version:f,type:h,setup:p,maxMessageSize:Y,expiresAtMs:v,bindingTag:R,fingerprint:N,ufrag:K,pwd:U,candidates:te,commitment:z,extensions:L}}var Sg=new TextEncoder;var ai="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function _d(r){let a="";for(let s=0;s<r.length;s+=3){let f=r[s],d=r[s+1],h=r[s+2];if(a+=ai[f>>2],a+=ai[(f&3)<<4|(d??0)>>4],d===void 0||(a+=ai[(d&15)<<2|(h??0)>>6],h===void 0))break;a+=ai[h&63]}return a}function yd(r){typeof r!="string"&&me("payload must be a string");let a=r.replace(/\s+/g,"");a.length>Math.ceil(Ot.MAX_PAYLOAD_BYTES*4/3)+4&&me("payload is too long"),/^[A-Za-z0-9_-]*$/.test(a)||me("payload contains characters outside base64url"),a.length%4===1&&me("payload has an impossible length");let s=new Uint8Array(Math.floor(a.length*3/4)),f=0,d=0,h=0;for(let p of a)d=d<<6|ai.indexOf(p),h+=6,h>=8&&(h-=8,s[f++]=d>>h&255);return d&(1<<h)-1&&me("payload has non-zero padding bits"),s.subarray(0,f)}var mr="SB2:";function A1(r){return mr+_d(r)}function E1(r){typeof r!="string"&&me("payload must be a string");let a=r.trim();return a.startsWith(mr)||me("not an SB2 descriptor"),yd(a.slice(mr.length))}var ci="SB1:gz:",ss="SB1:bin:";function C1(r){let a="";for(let f=0;f<r.length;f+=32768){let d=r.subarray(f,f+32768);a+=String.fromCharCode.apply(null,d)}return btoa(a)}function _1(r){let a=atob(r),s=a.length,f=new Uint8Array(s);for(let d=0;d<s;d++)f[d]=a.charCodeAt(d);return f}function y1(r){let a=new TextEncoder().encode(r),s=i1(a);return C1(s)}function Id(r){let a=_1(r),s=a1(a);return new TextDecoder().decode(s)}async function fi(r,a={}){let s=a.size||512,f=a.margin??2,d=a.errorCorrectionLevel||"M";return await m1.toDataURL(r,{width:s,margin:f,errorCorrectionLevel:d})}async function I1(r,a={}){try{let s=y1(r),f=ci+s;return await fi(f,a)}catch(s){return console.warn("generateCompressedQRCode failed, falling back to plain:",s?.message||s),await fi(r,a)}}function bd(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Sd(r){let a=r.replace(/-/g,"+").replace(/_/g,"/"),s=a.length%4;return s&&(a+="=".repeat(4-s)),a}function b1(r){let a=os.encode(r),s=$i(new Uint8Array(a)),f=C1(s);return bd(f)}function Td(r){let a=Sd(r),s=_1(a),f=o1(s),d=f.buffer.slice(f.byteOffset,f.byteOffset+f.byteLength);return os.decode(d)}async function Nd(r,a={}){try{let s=b1(r),f=ss+s;return await fi(f,a)}catch(s){console.warn("generateBinaryQRCodeFromObject failed, falling back to JSON compressed:",s?.message||s);let f=JSON.stringify(r);return await I1(f,a)}}async function Md(r,a=null,s=null){try{console.log("\u{1F510} Generating COSE-based QR code...");let f=await rs(r,a,s);if(f.length===1)return await fi(f[0]);throw console.warn(`\u{1F4CA} COSE packing produced ${f.length} chunks; falling back to non-COSE strategy`),new Error("COSE QR would require multiple chunks")}catch(f){throw console.error("Error generating COSE QR code:",f),f}}window.generateQRCode=fi;window.generateCompressedQRCode=I1;window.generateBinaryQRCodeFromObject=Nd;window.generateCOSEQRCode=Md;window.Html5Qrcode=cr;window.packSecurePayload=rs;window.receiveAndProcess=zo;window.decompressIfNeeded=function(r){try{if(typeof r=="string"&&r.startsWith(ci)){let a=r.slice(ci.length);return Id(a)}}catch(a){console.warn("decompressIfNeeded failed:",a?.message||a)}return r};window.compressToPrefixedGzip=function(r){try{let a=String(r||""),s=y1(a);return ci+s}catch(a){return console.warn("compressToPrefixedGzip failed:",a?.message||a),String(r||"")}};window.encodeBinaryToPrefixed=function(r){try{let a=typeof r=="string"?JSON.parse(r):r;if(a&&typeof a.sbq2=="string")return a.sbq2;let s=b1(a);return ss+s}catch(a){return console.warn("encodeBinaryToPrefixed failed:",a?.message||a),typeof r=="string"?r:JSON.stringify(r)}};window.decodeAnyPayload=function(r){try{if(typeof r=="string"){if(r.startsWith(mr)){let s=E1(r);return{t:Vo(s).type===Er.OFFER?"offer":"answer",sbq2:r}}if(r.charCodeAt(0)===2){let s=Uint8Array.from(r,d=>d.charCodeAt(0)&255);return{t:Vo(s).type===Er.OFFER?"offer":"answer",sbq2:A1(s)}}let a=/^SB(\d+):/.exec(r);if(a&&a[1]!=="1"&&a[1]!=="2")throw new Error("This invitation was created by a newer version of SecureBit. Please update the app to connect.");if(r.startsWith(ss)){let s=r.slice(ss.length);return Td(s)}return r.startsWith(ci)?window.decompressIfNeeded(r):r}}catch(a){if(typeof r=="string"&&(r.startsWith(mr)||r.charCodeAt(0)===2||/^SB(\d+):/.test(r)))throw a;console.warn("decodeAnyPayload failed:",a?.message||a)}return r};console.log("QR libraries loaded: generateQRCode, generateCompressedQRCode, generateBinaryQRCodeFromObject, Html5Qrcode, COSE functions");
|
|
/*! Bundled license information:
|
|
|
|
pako/dist/pako.esm.mjs:
|
|
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
*/
|
|
//# sourceMappingURL=qr-local.js.map
|