1import{a as ei,b as ti}from"./chunk-ARAVZAZA.js";import{$ as Vt,$a as Wr,Ab as et,Eb as Rn,Hb as jt,Ib as pt,Ka as xt,Mb as Yr,Nb as Zr,Ob as Qr,Qb as Kr,T as Xr,Tb as Ze,Ub as qr,Vb as vn,Xc as $r,Z as Ut,_ as Ht,aa as $t,ob as zt,pb as Gt,vc as Jr,yb as ie,zb as ye}from"./chunk-XVP4QDIS.js";import{e as As,f as Cs,g as On}from"./chunk-JSSFPNKJ.js";var ai=As((Fn,oi)=>{"use strict";(function(u,h){typeof Fn=="object"&&typeof oi<"u"?h(Fn):typeof define=="function"&&define.amd?define(["exports"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u.ZXing={}))})(Fn,function(u){"use strict";function h(l){return l==null}var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,e){l.__proto__=e}||function(l,e){for(var t in e)e.hasOwnProperty(t)&&(l[t]=e[t])};function m(l,e){d(l,e);function t(){this.constructor=l}l.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function C(l,e){var t=Object.setPrototypeOf;t?t(l,e):l.__proto__=e}function x(l,e){e===void 0&&(e=l.constructor);var t=Error.captureStackTrace;t&&t(l,e)}var y=(function(l){m(e,l);function e(t){var n=this.constructor,r=l.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),C(r,n.prototype),x(r),r}return e})(Error);let M=(()=>{class l extends y{constructor(t=void 0){super(t),this.message=t}getKind(){return this.constructor.kind}}return l.kind="Exception",l})(),O=(()=>{class l extends M{}return l.kind="ArgumentException",l})(),w=(()=>{class l extends M{}return l.kind="IllegalArgumentException",l})();class D{constructor(e){if(this.binarizer=e,e===null)throw new w("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,r){let i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new D(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new D(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new D(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}let P=(()=>{class l extends M{static getChecksumInstance(){return new l}}return l.kind="ChecksumException",l})();class fe{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class Y{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}let ve=(()=>{class l extends M{}return l.kind="IndexOutOfBoundsException",l})(),be=(()=>{class l extends ve{constructor(t=void 0,n=void 0){super(n),this.index=t,this.message=n}}return l.kind="ArrayIndexOutOfBoundsException",l})();class ${static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){$.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new w("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new be(t);if(n>e)throw new be(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>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,r=e.length;n<r;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 r=n-t,i=new Int32Array(r);return Y.arraycopy(e,t,i,0,r),i}
1static binarySearch(e,t,n){n===void 0&&(n=$.numberComparator);let r=0,i=e.length-1;for(;r<=i;){let s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class X{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)}}X.MIN_VALUE_32_BITS=-2147483648,X.MAX_VALUE=Number.MAX_SAFE_INTEGER;class oe{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=oe.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=oe.makeArray(e);Y.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,r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);let s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}let o=r*32+X.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){let t=this.size;if(e>=t)return t;let n=this.bits,r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);let s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}let o=r*32+X.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new w;if(t===e)return;t--;let n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){let o=s>n?0:e&31,c=(2<<(s<r?31:t&31))-(1<<o);i[s]|=c}}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 w;if(t===e)return!0;t--;let r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){let a=o>r?0:e&31,f=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&f)!==(n?f: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 w("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 w("Sizes don't match");let t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){let i=n*32-this.size,s=e[0]>>>i;for(let o=1;o<n;o++){let a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof oe))return!1;let t=e;return this.size===t.size&&$.equals(this.bits,t.bits)}hashCode(){return 31*this.size+$.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 oe(this.size,this.bits.slice())}}var mt=(function(l){return l[l.OTHER=0]="OTHER",l[l.PURE_BARCODE=1]="PURE_BARCODE",l[l.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",l[l.TRY_HARDER=3]="TRY_HARDER",l[l.CHARACTER_SET=4]="CHARACTER_SET",l[l.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",l[l.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",l[l.ASSUME_GS1=7]="ASSUME_GS1",l[l.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",l[l.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",l[l.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS",l})(mt||{}),ae=mt;let F=(()=>{class l extends M{static getFormatInstance(){return new l}}return l.kind="FormatException",l})();var he=(function(l){return l[l.Cp437=0]="Cp437",l[l.ISO8859_1=1]="ISO8859_1",l[l.ISO8859_2=2]="ISO8859_2",l[l.ISO8859_3=3]="ISO8859_3",l[l.ISO8859_4
1=4]="ISO8859_4",l[l.ISO8859_5=5]="ISO8859_5",l[l.ISO8859_6=6]="ISO8859_6",l[l.ISO8859_7=7]="ISO8859_7",l[l.ISO8859_8=8]="ISO8859_8",l[l.ISO8859_9=9]="ISO8859_9",l[l.ISO8859_10=10]="ISO8859_10",l[l.ISO8859_11=11]="ISO8859_11",l[l.ISO8859_13=12]="ISO8859_13",l[l.ISO8859_14=13]="ISO8859_14",l[l.ISO8859_15=14]="ISO8859_15",l[l.ISO8859_16=15]="ISO8859_16",l[l.SJIS=16]="SJIS",l[l.Cp1250=17]="Cp1250",l[l.Cp1251=18]="Cp1251",l[l.Cp1252=19]="Cp1252",l[l.Cp1256=20]="Cp1256",l[l.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",l[l.UTF8=22]="UTF8",l[l.ASCII=23]="ASCII",l[l.Big5=24]="Big5",l[l.GB18030=25]="GB18030",l[l.EUC_KR=26]="EUC_KR",l})(he||{});class k{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,k.VALUE_IDENTIFIER_TO_ECI.set(e,this),k.NAME_TO_ECI.set(n,this);let i=this.values;for(let s=0,o=i.length;s!==o;s++){let a=i[s];k.VALUES_TO_ECI.set(a,this)}for(let s of r)k.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new F("incorect value");let t=k.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}static getCharacterSetECIByName(e){let t=k.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}equals(e){if(!(e instanceof k))return!1;let t=e;return this.getName()===t.getName()}}k.VALUE_IDENTIFIER_TO_ECI=new Map,k.VALUES_TO_ECI=new Map,k.NAME_TO_ECI=new Map,k.Cp437=new k(he.Cp437,Int32Array.from([0,2]),"Cp437"),k.ISO8859_1=new k(he.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),k.ISO8859_2=new k(he.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),k.ISO8859_3=new k(he.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),k.ISO8859_4=new k(he.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),k.ISO8859_5=new k(he.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),k.ISO8859_6=new k(he.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),k.ISO8859_7=new k(he.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),k.ISO8859_8=new k(he.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),k.ISO8859_9=new k(he.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),k.ISO8859_10=new k(he.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),k.ISO8859_11=new k(he.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),k.ISO8859_13=new k(he.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),k.ISO8859_14=new k(he.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),k.ISO8859_15=new k(he.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),k.ISO8859_16=new k(he.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),k.SJIS=new k(he.SJIS,20,"SJIS","Shift_JIS"),k.Cp1250=new k(he.Cp1250,21,"Cp1250","windows-1250"),k.Cp1251=new k(he.Cp1251,22,"Cp1251","windows-1251"),k.Cp1252=new k(he.Cp1252,23,"Cp1252","windows-1252"),k.Cp1256=new k(he.Cp1256,24,"Cp1256","windows-1256"),k.UnicodeBigUnmarked=new k(he.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),k.UTF8=new k(he.
1UTF8,26,"UTF8","UTF-8"),k.ASCII=new k(he.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),k.Big5=new k(he.Big5,28,"Big5"),k.GB18030=new k(he.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),k.EUC_KR=new k(he.EUC_KR,30,"EUC_KR","EUC-KR");let nn=(()=>{class l extends M{}return l.kind="UnsupportedOperationException",l})();class Qe{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!Qe.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 k?e:k.getCharacterSetECIByName(e)}static decodeFallback(e,t){let n=this.encodingCharacterSet(t);if(Qe.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(k.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new nn(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(k.UTF8)||e.equals(k.ISO8859_1)||e.equals(k.ASCII)}static encodeFallback(e){let n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class q{static castAsNonUtf8Char(e,t=null){let n=t?t.getName():this.ISO88591;return Qe.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(ae.CHARACTER_SET)!==void 0)return t.get(ae.CHARACTER_SET).toString();let n=e.length,r=!0,i=!0,s=!0,o=0,a=0,c=0,f=0,g=0,A=0,E=0,I=0,S=0,T=0,N=0,B=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let H=0;H<n&&(r||i||s);H++){let R=e[H]&255;s&&(o>0?(R&128)===0?s=!1:o--:(R&128)!==0&&((R&64)===0?s=!1:(o++,(R&32)===0?a++:(o++,(R&16)===0?c++:(o++,(R&8)===0?f++:s=!1))))),r&&(R>127&&R<160?r=!1:R>159&&(R<192||R===215||R===247)&&N++),i&&(g>0?R<64||R===127||R>252?i=!1:g--:R===128||R===160||R>239?i=!1:R>160&&R<224?(A++,I=0,E++,E>S&&(S=E)):R>127?(g++,E=0,I++,I>T&&(T=I)):(E=0,I=0))}return s&&o>0&&(s=!1),i&&g>0&&(i=!1),s&&(B||a+c+f>0)?q.UTF8:i&&(q.ASSUME_SHIFT_JIS||S>=3||T>=3)?q.SHIFT_JIS:r&&i?S===2&&A===2||N*10>=n?q.SHIFT_JIS:q.ISO88591:r?q.ISO88591:i?q.SHIFT_JIS:s?q.UTF8:q.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,c,f,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=f?parseInt(f.substr(1)):void 0,E;switch(g){case"s":E=t[n];break;case"c":E=t[n][0];break;case"f":E=parseFloat(t[n]).toFixed(s);break;case"p":E=parseFloat(t[n]).toPrecision(s);break;case"e":E=parseFloat(t[n]).toExponential(s);break;case"x":E=parseInt(t[n]).toString(A||16);break;case"d":E=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}E=typeof E=="object"?JSON.stringify(E):(+E).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;E.length<I;)E=o!==void 0?E+S:S+E;return E}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return Qe.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}q.SHIFT_JIS=k.SJIS.getName(),q.GB2312="GB2312",q.ISO88591=k.ISO8859_1.getName(),q.EUC_JP="EUC_JP",q.UTF8=k.UTF8.getName(),q.PLATFORM_DEFAULT_ENCODING=q.UTF8,q.ASSUME_SHIFT_JIS=!1;class Ae{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+=q.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);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 Le{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new w("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,n=e[0].length,r=new Le(n,t);for(let i=0;i<t;i++){let s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}
1static parseFromString(e,t,n){if(e===null)throw new w("stringRepresentation cannot be null");let r=new Array(e.length),i=0,s=0,o=-1,a=0,c=0;for(;c<e.length;)if(e.charAt(c)===` 2`||e.charAt(c)==="\r"){if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new w("row lengths do not match");s=i,a++}c++}else if(e.substring(c,c+t.length)===t)c+=t.length,r[i]=!0,i++;else if(e.substring(c,c+n.length)===n)c+=n.length,r[i]=!1,i++;else throw new w("illegal character encountered: "+e.substring(c));if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new w("row lengths do not match");a++}let f=new Le(o,a);for(let g=0;g<i;g++)r[g]&&f.set(Math.floor(g%o),Math.floor(g/o));return f}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 w("input matrix dimensions do not match");let t=new oe(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,s=this.height;i<s;i++){let o=i*n,a=e.getRow(i,t).getBitArray();for(let c=0;c<n;c++)r[o+c]^=a[c]}}clear(){let e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,r){if(t<0||e<0)throw new w("Left and top must be nonnegative");if(r<1||n<1)throw new w("Height and width must be at least 1");let i=e+n,s=t+r;if(s>this.height||i>this.width)throw new w("The region must fit inside the matrix");let o=this.rowSize,a=this.bits;for(let c=t;c<s;c++){let f=c*o;for(let g=e;g<i;g++)a[f+Math.floor(g/32)]|=1<<(g&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new oe(this.width):t.clear();let n=this.rowSize,r=this.bits,i=e*n;for(let s=0;s<n;s++)t.setBulk(s*32,r[i+s]);return t}setRow(e,t){Y.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),n=new oe(e),r=new oe(e);for(let i=0,s=Math.floor((t+1)/2);i<s;i++)n=this.getRow(i,n),r=this.getRow(t-1-i,r),n.reverse(),r.reverse(),this.setRow(i,r),this.setRow(t-1-i,n)}getEnclosingRectangle(){let e=this.width,t=this.height,n=this.rowSize,r=this.bits,i=e,s=t,o=-1,a=-1;for(let c=0;c<t;c++)for(let f=0;f<n;f++){let g=r[c*n+f];if(g!==0){if(c<s&&(s=c),c>a&&(a=c),f*32<i){let A=0;for(;(g<<31-A&4294967295)===0;)A++;f*32+A<i&&(i=f*32+A)}if(f*32+31>o){let A=31;for(;!(g>>>A);)A--;f*32+A>o&&(o=f*32+A)}}}return o<i||a<s?null:Int32Array.from([i,s,o-i+1,a-s+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 r=n/e,i=n%e*32,s=t[n],o=0;for(;(s<<31-o&4294967295)===0;)o++;return i+=o,Int32Array.from([i,r])}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 r=Math.floor(n/e),i=Math.floor(n%e)*32,s=t[n],o=31;for(;!(s>>>o);)o--;return i+=o,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof Le))return!1;let t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&$.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+$.hashCode(this.bits),e}toString(e="X ",t=" ",n=` 3`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new Ae;for(let i=0,s=this.height;i<s;i++){for(let o=0,a=this.width;o<a;o++)r.append(this.get(o,i)?e:t);r.append(n)}return r.toString()}clone(){return new Le(this.width,this.height,this.rowSize,this.bits.slice())}}let v=(()=>{class l extends M{static getNotFoundInstance(){return new l}}return l.kind="NotFoundException",l})();class Be extends fe{constructor(e){super(e),this.luminances=Be.EMPTY,this.buckets=new Int32Array(Be.LUMINANCE_BUCKETS)}getBlackRow(e,t){let n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new oe(r):t.clear(),this.initArrays(r);let i=n.getRow(e,this.luminances),s=this.buckets;for(let a=0;a<r;a++)s[(i[a]&255)>>Be.LUMINANCE_SHIFT]++;let o=Be.estimateBlackPoint(s);if(r<3)for(let a=0;a<r;a++)(i[a]&255)<o&&t.set(a);else{let a=i[0]&255,c=i[1]&255;for(let f=1;f<r-1;f++){let g=i[f+1]&255;(c*4-a-g)/2<o&&t.set(f),a=c,c=g}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new Le(t,n);this.initArrays(t);let i=this.buckets;for(let a=1;a<5;a++){let c=Math.floor(n*a/5),f=e.getRow(c,this.luminances),g=Math.floor(t*4/5);for(let A=Math.floor(t/5);A<g;A++){let E=f[A]&255;i[E>>Be.LUMINANCE_SHIFT]++}}let s=Be.estimateBlackPoint(i),o=e.getMatrix();for(let a=0;a<n;a++){let c=a*t;for(let f=0;f<t;f++)(o[c+f]&255)<s&&r.set(f,a)}return r}createBinarizer(e){return new Be(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let n=0;n<Be.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){let t=e.length,n=0,r=0,i=0;for(let f=0;f<t;f++)e[f]>i&&(r=f,i=e[f]),e[f]>n&&(n=e[f]);let s=0,o=0;for(let f=0;f<t;f++){let g=f-r,A=e[f]*g*g;A>o&&(s=f,o=A)}if(r>s){let f=r;r=s,s=f}if(s-r<=t/16)throw new v;let a=s-1,c=-1;for(let f=s-1;f>r;f--){let g=f-r,A=g*g*(s-f)*(n-e[f]);A>c&&(a=f,c=A)}return a<<Be.LUMINANCE_SHIFT}}Be.LUMINANCE_BITS=5,Be.LUMINANCE_SHIFT=8-Be.LUMINANCE_BITS,Be.LUMINANCE_BUCKETS=1<<Be.LUMINANCE_BITS,Be.EMPTY=Uint8ClampedArray.from([0]);class ee extends Be{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>=ee.MINIMUM_DIMENSION&&n>=ee.MINIMUM_DIMENSION){let r=e.getMatrix(),i=t>>ee.BLOCK_SIZE_POWER;(t&ee.BLOCK_SIZE_MASK)!==0&&i++;let s=n>>ee.BLOCK_SIZE_POWER;(n&ee.BLOCK_SIZE_MASK)!==0&&s++;let o=ee.calculateBlackPoints(r,i,s,t,n),a=new Le(t,n);ee.calculateThresholdForBlock(r,i,s,t,n,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new ee(e)}static calculateThresholdForBlock(e,t,n,r,i,s,o){let a=i-ee.BLOCK_SIZE,c=r-ee.BLOCK_SIZE;for(let f=0;f<n;f++){let g=f<<ee.BLOCK_SIZE_POWER;g>a&&(g=a);let A=ee.cap(f,2,n-3);for(let E=0;E<t;E++){let I=E<<ee.BLOCK_SIZE_POWER;I>c&&(I=c);let S=ee.cap(E,2,t-3),T=0;for(let B=-2;B<=2;B++){let H=s[A+B];T+=H[S-2]+H[S-1]+H[S]+H[S+1]+H[S+2]}let N=T/25;ee.thresholdBlock(e,I,g,N,r,o)}}}
3static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,s){for(let o=0,a=n*i+t;o<ee.BLOCK_SIZE;o++,a+=i)for(let c=0;c<ee.BLOCK_SIZE;c++)(e[a+c]&255)<=r&&s.set(t+c,n+o)}static calculateBlackPoints(e,t,n,r,i){let s=i-ee.BLOCK_SIZE,o=r-ee.BLOCK_SIZE,a=new Array(n);for(let c=0;c<n;c++){a[c]=new Int32Array(t);let f=c<<ee.BLOCK_SIZE_POWER;f>s&&(f=s);for(let g=0;g<t;g++){let A=g<<ee.BLOCK_SIZE_POWER;A>o&&(A=o);let E=0,I=255,S=0;for(let N=0,B=f*r+A;N<ee.BLOCK_SIZE;N++,B+=r){for(let H=0;H<ee.BLOCK_SIZE;H++){let R=e[B+H]&255;E+=R,R<I&&(I=R),R>S&&(S=R)}if(S-I>ee.MIN_DYNAMIC_RANGE)for(N++,B+=r;N<ee.BLOCK_SIZE;N++,B+=r)for(let H=0;H<ee.BLOCK_SIZE;H++)E+=e[B+H]&255}let T=E>>ee.BLOCK_SIZE_POWER*2;if(S-I<=ee.MIN_DYNAMIC_RANGE&&(T=I/2,c>0&&g>0)){let N=(a[c-1][g]+2*a[c][g-1]+a[c-1][g-1])/4;I<N&&(T=N)}a[c][g]=T}}return a}}ee.BLOCK_SIZE_POWER=3,ee.BLOCK_SIZE=1<<ee.BLOCK_SIZE_POWER,ee.BLOCK_SIZE_MASK=ee.BLOCK_SIZE-1,ee.MINIMUM_DIMENSION=ee.BLOCK_SIZE*5,ee.MIN_DYNAMIC_RANGE=24;class rn{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,r){throw new nn("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new nn("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new nn("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new Ae;for(let n=0;n<this.height;n++){let r=this.getRow(n,e);for(let i=0;i<this.width;i++){let s=r[i]&255,o;s<64?o="#":s<128?o="+":s<192?o=".":o=" ",t.append(o)}t.append(` 4`)}return t.toString()}}class yt extends rn{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let n=this.delegate.getRow(e,t),r=this.getWidth();for(let i=0;i<r;i++)n[i]=255-(n[i]&255);return n}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new yt(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new yt(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new yt(this.delegate.rotateCounterClockwise45())}}class Tt extends rn{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=Tt.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return Tt.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){let r=new Uint8ClampedArray(t*n);for(let i=0,s=0,o=e.length;i<o;i+=4,s++){let a;if(e[i+3]===0)a=255;else{let f=e[i],g=e[i+1],A=e[i+2];a=306*f+601*g+117*A+512>>10}r[s]=a}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new w("Requested row is outside the image: "+e);let n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),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"),r=e*Tt.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*s),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*s);return t.width=o,t.height=a,n.translate(o/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,s/-2),this.buffer=Tt.makeBufferFromCanvasImageData(t),this}invert(){return new yt(this)}}Tt.DEGREE_TO_RADIANS=Math.PI/180;class Ar{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 Xe=(globalThis||global||self||window||void 0)&&(globalThis||global||self||window||void 0).__awaiter||function(l,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(f){try{c(n.next(f))}catch(g){s(g)}}function a(f){try{c(n.throw(f))}catch(g){s(g)}}function c(f){f.done?i(f.value):r(f.value).then(o,a)}c((n=n.apply(l,e||[])).next())})};class Lt{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 Xe(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 r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;let i=n.deviceId||n.id,s=n.label||`Video device ${t.length+1}`,o=n.groupId,a={deviceId:i,label:s,kind:r,groupId:o};t.push(a)}return t})}getVideoInputDevices(){return Xe(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new Ar(t.deviceId,t.label))})}findDeviceById(e){return Xe(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return Xe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return Xe(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};let r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return Xe(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return Xe(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 Xe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return Xe(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};let i={video:r};return yield this.decodeFromConstraints(i,t,n)})}
4decodeFromConstraints(e,t,n){return Xe(this,void 0,void 0,function*(){let r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return Xe(this,void 0,void 0,function*(){this.reset();let r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return Xe(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 Xe(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 O(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new O(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new O("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 O("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 O("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 O("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 O("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new O("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 O("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 O("An URL must be provided.");this.reset();let n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_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 Xe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return Xe(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 r=(i,s)=>{if(this._stopAsyncDecode){s(new v("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let o=this.decode(e);i(o)}catch(o){let a=t&&o instanceof v,f=(o instanceof P||o instanceof F)&&n;if(a||f)return setTimeout(r,this._timeBetweenDecodingAttempts,i,s);s(o)}};return new Promise((i,s)=>r(i,s))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let n=()=>
4{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);let i=r instanceof P||r instanceof F,s=r instanceof v;(i||s)&&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),r=new Tt(n),i=new ee(r);return new D(i)}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,r;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,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 We{constructor(e,t,n=t==null?0:8*t.length,r,i,s=Y.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=s,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=i,this.resultMetadata=null,s==null?this.timestamp=Y.currentTimeMillis():this.timestamp=s}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);Y.arraycopy(t,0,n,0,t.length),Y.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}
4var Cr=(function(l){return l[l.AZTEC=0]="AZTEC",l[l.CODABAR=1]="CODABAR",l[l.CODE_39=2]="CODE_39",l[l.CODE_93=3]="CODE_93",l[l.CODE_128=4]="CODE_128",l[l.DATA_MATRIX=5]="DATA_MATRIX",l[l.EAN_8=6]="EAN_8",l[l.EAN_13=7]="EAN_13",l[l.ITF=8]="ITF",l[l.MAXICODE=9]="MAXICODE",l[l.PDF_417=10]="PDF_417",l[l.QR_CODE=11]="QR_CODE",l[l.RSS_14=12]="RSS_14",l[l.RSS_EXPANDED=13]="RSS_EXPANDED",l[l.UPC_A=14]="UPC_A",l[l.UPC_E=15]="UPC_E",l[l.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION",l})(Cr||{}),Z=Cr,pr=(function(l){return l[l.OTHER=0]="OTHER",l[l.ORIENTATION=1]="ORIENTATION",l[l.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",l[l.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",l[l.ISSUE_NUMBER=4]="ISSUE_NUMBER",l[l.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",l[l.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",l[l.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",l[l.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",l[l.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",l[l.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY",l})(pr||{}),Pe=pr;class sn{constructor(e,t,n,r,i=-1,s=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,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 on{exp(e){return this.expTable[e]}log(e){if(e===0)throw new w;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class Ke{constructor(e,t){if(t.length===0)throw new w;this.field=e;let n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),Y.arraycopy(t,r,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 s=0,o=t.length;s!==o;s++){let a=t[s];n=on.addOrSubtract(n,a)}return n}n=t[0];let r=t.length,i=this.field;for(let s=1;s<r;s++)n=on.addOrSubtract(i.multiply(e,n),t[s]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new w("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 s=t;t=n,n=s}let r=new Int32Array(n.length),i=n.length-t.length;Y.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=on.addOrSubtract(t[s-i],n[s]);return new Ke(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new w("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1),o=this.field;for(let a=0;a<n;a++){let c=t[a];for(let f=0;f<i;f++)s[a+f]=on.addOrSubtract(s[a+f],o.multiply(c,r[f]))}return new Ke(o,s)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;let t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let s=0;s<t;s++)r[s]=n.multiply(i[s],e);return new Ke(n,r)}multiplyByMonomial(e,t){if(e<0)throw new w;if(t===0)return this.field.getZero();let n=this.coefficients,r=n.length,i=new Int32Array(r+e),s=this.field;for(let o=0;o<r;o++)i[o]=s.multiply(n[o],t);return new Ke(s,i)}divide(e){if(!this.field.equals(e.field))throw new w("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new w("Divide by 0");let t=this.field,n=t.getZero(),r=this,i=e.getCoefficient(e.getDegree()),s=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){let o=r.getDegree()-e.getDegree(),a=t.multiply(r.getCoefficient(r.getDegree()),s),c=e.multiplyByMonomial(o,a),f=t.buildMonomial(o,a);n=n.addOrSubtract(f),r=r.addOrSubtract(c)}return[n,r]}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 r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}let Hn=(()=>{class l extends M{}return l.kind="ArithmeticException",l})();class de extends on{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;let r=new Int32Array(t),i=1;for(let o=0;o<t;o++)r[o]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;let s=new Int32Array(t);for(let o=0;o<t-1;o++)s[r[o]]=o;this.logTable=s,this.zero=new Ke(this,Int32Array.from([0])),this.one=new Ke(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new w;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ke(this,n)}inverse(e){if(e===0)throw new Hn;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"+X.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}de.AZTEC_DATA_12=new de(4201,4096,1),de.AZTEC_DATA_10=new de(1033,1024,1),de.AZTEC_DATA_6=new de(67,64,1),de.AZTEC_PARAM=new de(19,16,1),de.QR_CODE_FIELD_256=new de(285,256,0),de.DATA_MATRIX_FIELD_256=new de(301,256,1),de.AZTEC_DATA_8=de.DATA_MATRIX_FIELD_256,de.MAXICODE_FIELD_64=de.AZTEC_DATA_6;let an=(()=>{class l extends M{}return l.kind="ReedSolomonException",l})(),It=(()=>{class l extends M{}return l.kind="IllegalStateException",l})();class cn{constructor(e){this.field=e}decode(e,t){let n=this.field,r=new Ke(n,e),i=new Int32Array(t),s=!0;for(let E=0;E<t;E++){let I=r.evaluateAt(n.exp(E+n.getGeneratorBase()));i[i.length-1-E]=I,I!==0&&(s=!1)}if(s)return;let o=new Ke(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),o,t),c=a[0],f=a[1],g=this.findErrorLocations(c),A=this.findErrorMagnitudes(f,g);for(let E=0;E<g.length;E++){let I=e.length-1-n.log(g[E]);if(I<0)throw new an("Bad error location");e[I]=de.addOrSubtract(e[I],A[E])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let E=e;e=t,t=E}let r=this.field,i=e,s=t,o=r.getZero(),a=r.getOne();for(;s.getDegree()>=(n/2|0);){let E=i,I=o;if(i=s,o=a,i.isZero())throw new an("r_{i-1} was zero");s=E;let S=r.getZero(),T=i.getCoefficient(i.getDegree()),N=r.inverse(T);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){let B=s.getDegree()-i.getDegree(),H=r.multiply(s.getCoefficient(s.getDegree()),N);S=S.addOrSubtract(r.buildMonomial(B,H)),s=s.addOrSubtract(i.multiplyByMonomial(B,H))}if(a=S.multiply(o).addOrSubtract(I),s.getDegree()>=i.getDegree())throw new It("Division algorithm failed to reduce polynomial?")}let c=a.getCoefficient(0);if(c===0)throw new an("sigmaTilde(0) was zero");let f=r.inverse(c),g=a.multiplyScalar(f),A=s.multiplyScalar(f);return[g,A]}findErrorLocations(e){let t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);let n=new Int32Array(t),r=0,i=this.field;for(let s=1;
4s<i.getSize()&&r<t;s++)e.evaluateAt(s)===0&&(n[r]=i.inverse(s),r++);if(r!==t)throw new an("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){let n=t.length,r=new Int32Array(n),i=this.field;for(let s=0;s<n;s++){let o=i.inverse(t[s]),a=1;for(let c=0;c<n;c++)if(s!==c){let f=i.multiply(t[c],o),g=(f&1)===0?f|1:f&-2;a=i.multiply(a,g)}r[s]=i.multiply(e.evaluateAt(o),i.inverse(a)),i.getGeneratorBase()!==0&&(r[s]=i.multiply(r[s],o))}return r}}var Ge=(function(l){return l[l.UPPER=0]="UPPER",l[l.LOWER=1]="LOWER",l[l.MIXED=2]="MIXED",l[l.DIGIT=3]="DIGIT",l[l.PUNCT=4]="PUNCT",l[l.BINARY=5]="BINARY",l})(Ge||{});let Vn=(()=>{class l{decode(t){this.ddata=t;let n=t.getBits(),r=this.extractBits(n),i=this.correctBits(r),s=l.convertBoolArrayToByteArray(i),o=l.getEncodedData(i),a=new sn(s,o,null,null);return a.setNumBits(i.length),a}static highLevelDecode(t){return this.getEncodedData(t)}static getEncodedData(t){let n=t.length,r=Ge.UPPER,i=Ge.UPPER,s="",o=0;for(;o<n;)if(i===Ge.BINARY){if(n-o<5)break;let a=l.readCode(t,o,5);if(o+=5,a===0){if(n-o<11)break;a=l.readCode(t,o,11)+31,o+=11}for(let c=0;c<a;c++){if(n-o<8){o=n;break}let f=l.readCode(t,o,8);s+=q.castAsNonUtf8Char(f),o+=8}i=r}else{let a=i===Ge.DIGIT?4:5;if(n-o<a)break;let c=l.readCode(t,o,a);o+=a;let f=l.getCharacter(i,c);f.startsWith("CTRL_")?(r=i,i=l.getTable(f.charAt(5)),f.charAt(6)==="L"&&(r=i)):(s+=f,i=r)}return s}static getTable(t){switch(t){case"L":return Ge.LOWER;case"P":return Ge.PUNCT;case"M":return Ge.MIXED;case"D":return Ge.DIGIT;case"B":return Ge.BINARY;default:return Ge.UPPER}}static getCharacter(t,n){switch(t){case Ge.UPPER:return l.UPPER_TABLE[n];case Ge.LOWER:return l.LOWER_TABLE[n];case Ge.MIXED:return l.MIXED_TABLE[n];case Ge.PUNCT:return l.PUNCT_TABLE[n];case Ge.DIGIT:return l.DIGIT_TABLE[n];default:throw new It("Bad table")}}correctBits(t){let n,r;this.ddata.getNbLayers()<=2?(r=6,n=de.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(r=8,n=de.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(r=10,n=de.AZTEC_DATA_10):(r=12,n=de.AZTEC_DATA_12);let i=this.ddata.getNbDatablocks(),s=t.length/r;if(s<i)throw new F;let o=t.length%r,a=new Int32Array(s);for(let E=0;E<s;E++,o+=r)a[E]=l.readCode(t,o,r);try{new cn(n).decode(a,s-i)}catch(E){throw new F(E)}let c=(1<<r)-1,f=0;for(let E=0;E<i;E++){let I=a[E];if(I===0||I===c)throw new F;(I===1||I===c-1)&&f++}let g=new Array(i*r-f),A=0;for(let E=0;E<i;E++){let I=a[E];if(I===1||I===c-1)g.fill(I>1,A,A+r-1),A+=r-1;else for(let S=r-1;S>=0;--S)g[A++]=(I&1<<S)!==0}return g}extractBits(t){let n=this.ddata.isCompact(),r=this.ddata.getNbLayers(),i=(n?11:14)+r*4,s=new Int32Array(i),o=new Array(this.totalBitsInLayer(r,n));if(n)for(let a=0;a<s.length;a++)s[a]=a;else{let a=i+1+2*X.truncDivision(X.truncDivision(i,2)-1,15),c=i/2,f=X.truncDivision(a,2);for(let g=0;g<c;g++){let A=g+X.truncDivision(g,15);s[c-g-1]=f-A-1,s[c+g]=f+A+1}}for(let a=0,c=0;a<r;a++){let f=(r-a)*4+(n?9:12),g=a*2,A=i-1-g;for(let E=0;E<f;E++){let I=E*2;for(let S=0;S<2;S++)o[c+I+S]=t.get(s[g+S],s[g+E]),o[c+2*f+I+S]=t.get(s[g+E],s[A-S]),o[c+4*f+I+S]=t.get(s[A-S],s[A-E]),o[c+6*f+I+S]=t.get(s[A-E],s[g+S])}c+=f*8}return o}static readCode(t,n,r){let i=0;for(let s=n;s<n+r;s++)i<<=1,t[s]&&(i|=1);return i}static readByte(t,n){let r=t.length-n;return r>=8?l.readCode(t,n,8):l.readCode(t,n,r)<<8-r}static convertBoolArrayToByteArray(t){let n=new Uint8Array((t.length+7)/8);for(let r=0;r<n.length;r++)n[r]=l.readByte(t,8*r);return n}totalBitsInLayer(t,n){return((n?88:112)+16*t)*t}}return l.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"],l.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"],l.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",` 5`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],l.PUNCT_TABLE=["","\r",`\r 6`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],l.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],l})();class le{constructor(){}
6static 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,r){let i=e-n,s=t-r;return Math.sqrt(i*i+s*s)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){let i=e[n];t+=i}return t}}class wn{static floatToIntBits(e){return e}}wn.MAX_VALUE=Number.MAX_SAFE_INTEGER;class G{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof G){let t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*wn.floatToIntBits(this.x)+wn.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]),r=this.distance(e[0],e[2]),i,s,o;if(n>=t&&n>=r?(s=e[0],i=e[1],o=e[2]):r>=n&&r>=t?(s=e[1],i=e[0],o=e[2]):(s=e[2],i=e[0],o=e[1]),this.crossProductZ(i,s,o)<0){let a=i;i=o,o=a}e[0]=i,e[1]=s,e[2]=o}static distance(e,t){return le.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){let r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class An{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Er extends An{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}let Cn=(()=>{class l{constructor(t,n,r,i){this.image=t,this.height=t.getHeight(),this.width=t.getWidth(),n==null&&(n=l.INIT_SIZE),r==null&&(r=t.getWidth()/2|0),i==null&&(i=t.getHeight()/2|0);let s=n/2|0;if(this.leftInit=r-s,this.rightInit=r+s,this.upInit=i-s,this.downInit=i+s,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new v}detect(){let t=this.leftInit,n=this.rightInit,r=this.upInit,i=this.downInit,s=!1,o=!0,a=!1,c=!1,f=!1,g=!1,A=!1,E=this.width,I=this.height;for(;o;){o=!1;let S=!0;for(;(S||!c)&&n<E;)S=this.containsBlackPoint(r,i,n,!1),S?(n++,o=!0,c=!0):c||n++;if(n>=E){s=!0;break}let T=!0;for(;(T||!f)&&i<I;)T=this.containsBlackPoint(t,n,i,!0),T?(i++,o=!0,f=!0):f||i++;if(i>=I){s=!0;break}let N=!0;for(;(N||!g)&&t>=0;)N=this.containsBlackPoint(r,i,t,!1),N?(t--,o=!0,g=!0):g||t--;if(t<0){s=!0;break}let B=!0;for(;(B||!A)&&r>=0;)B=this.containsBlackPoint(t,n,r,!0),B?(r--,o=!0,A=!0):A||r--;if(r<0){s=!0;break}
6o&&(a=!0)}if(!s&&a){let S=n-t,T=null;for(let R=1;T===null&&R<S;R++)T=this.getBlackPointOnSegment(t,i-R,t+R,i);if(T==null)throw new v;let N=null;for(let R=1;N===null&&R<S;R++)N=this.getBlackPointOnSegment(t,r+R,t+R,r);if(N==null)throw new v;let B=null;for(let R=1;B===null&&R<S;R++)B=this.getBlackPointOnSegment(n,r+R,n-R,r);if(B==null)throw new v;let H=null;for(let R=1;H===null&&R<S;R++)H=this.getBlackPointOnSegment(n,i-R,n-R,i);if(H==null)throw new v;return this.centerEdges(H,T,B,N)}else throw new v}getBlackPointOnSegment(t,n,r,i){let s=le.round(le.distance(t,n,r,i)),o=(r-t)/s,a=(i-n)/s,c=this.image;for(let f=0;f<s;f++){let g=le.round(t+f*o),A=le.round(n+f*a);if(c.get(g,A))return new G(g,A)}return null}centerEdges(t,n,r,i){let s=t.getX(),o=t.getY(),a=n.getX(),c=n.getY(),f=r.getX(),g=r.getY(),A=i.getX(),E=i.getY(),I=l.CORR;return s<this.width/2?[new G(A-I,E+I),new G(a+I,c+I),new G(f-I,g-I),new G(s+I,o-I)]:[new G(A+I,E+I),new G(a+I,c-I),new G(f-I,g+I),new G(s-I,o-I)]}containsBlackPoint(t,n,r,i){let s=this.image;if(i){for(let o=t;o<=n;o++)if(s.get(o,r))return!0}else for(let o=t;o<=n;o++)if(s.get(r,o))return!0;return!1}}return l.INIT_SIZE=10,l.CORR=1,l})();class zn{static checkAndNudgePoints(e,t){let n=e.getWidth(),r=e.getHeight(),i=!0;for(let s=0;s<t.length&&i;s+=2){let o=Math.floor(t[s]),a=Math.floor(t[s+1]);if(o<-1||o>n||a<-1||a>r)throw new v;i=!1,o===-1?(t[s]=0,i=!0):o===n&&(t[s]=n-1,i=!0),a===-1?(t[s+1]=0,i=!0):a===r&&(t[s+1]=r-1,i=!0)}i=!0;for(let s=t.length-2;s>=0&&i;s-=2){let o=Math.floor(t[s]),a=Math.floor(t[s+1]);if(o<-1||o>n||a<-1||a>r)throw new v;i=!1,o===-1?(t[s]=0,i=!0):o===n&&(t[s]=n-1,i=!0),a===-1?(t[s+1]=0,i=!0):a===r&&(t[s+1]=r-1,i=!0)}}}class lt{constructor(e,t,n,r,i,s,o,a,c){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=i,this.a32=s,this.a13=o,this.a23=a,this.a33=c}static quadrilateralToQuadrilateral(e,t,n,r,i,s,o,a,c,f,g,A,E,I,S,T){let N=lt.quadrilateralToSquare(e,t,n,r,i,s,o,a);return lt.squareToQuadrilateral(c,f,g,A,E,I,S,T).times(N)}transformPoints(e){let t=e.length,n=this.a11,r=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,c=this.a31,f=this.a32,g=this.a33;for(let A=0;A<t;A+=2){let E=e[A],I=e[A+1],S=i*E+a*I+g;e[A]=(n*E+s*I+c)/S,e[A+1]=(r*E+o*I+f)/S}}transformPointsWithValues(e,t){let n=this.a11,r=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,c=this.a31,f=this.a32,g=this.a33,A=e.length;for(let E=0;E<A;E++){let I=e[E],S=t[E],T=i*I+a*S+g;e[E]=(n*I+s*S+c)/T,t[E]=(r*I+o*S+f)/T}}static squareToQuadrilateral(e,t,n,r,i,s,o,a){let c=e-n+i-o,f=t-r+s-a;if(c===0&&f===0)return new lt(n-e,i-n,e,r-t,s-r,t,0,0,1);{let g=n-i,A=o-i,E=r-s,I=a-s,S=g*I-A*E,T=(c*I-A*f)/S,N=(g*f-c*E)/S;return new lt(n-e+T*n,o-e+N*o,e,r-t+T*r,a-t+N*a,t,T,N,1)}}static quadrilateralToSquare(e,t,n,r,i,s,o,a){return lt.squareToQuadrilateral(e,t,n,r,i,s,o,a).buildAdjoint()}buildAdjoint(){return new lt(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 lt(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 Ir extends zn{sampleGrid(e,t,n,r,i,s,o,a,c,f,g,A,E,I,S,T,N,B,H){let R=lt.quadrilateralToQuadrilateral(r,i,s,o,a,c,f,g,A,E,I,S,T,N,B,H);return this.sampleGridWithTransform(e,t,n,R)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new v;let i=new Le(t,n),s=new Float32Array(2*t);for(let o=0;o<n;o++){let a=s.length,c=o+.5;for(let f=0;f<a;f+=2)s[f]=f/2+.5,s[f+1]=c;r.transformPoints(s),zn.checkAndNudgePoints(e,s);try{for(let f=0;f<a;f+=2)e.get(Math.floor(s[f]),Math.floor(s[f+1]))&&i.set(f/2,o)}catch{throw new v}}return i}}class bt{static setGridSampler(e){bt.gridSampler=e}static getInstance(){return bt.gridSampler}}bt.gridSampler=new Ir;class Ye{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new G(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Sr{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 s=n[0];n[0]=n[2],n[2]=s}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[
6(this.shift+2)%4],n[(this.shift+3)%4]),i=this.getMatrixCornerPoints(n);return new Er(r,i,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 v;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 r=0;for(let s=0;s<4;s++){let o=n[(this.shift+s)%4];this.compact?(r<<=7,r+=o>>1&127):(r<<=10,r+=(o>>2&992)+(o>>1&31))}let i=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(i&63)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(i&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,i,s)=>{let o=(r>>t-2<<1)+(r&1);n=(n<<3)+o}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(X.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new v}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let i=n-r,s=new Int32Array(n);for(let a=n-1;a>=0;--a)s[a]=e&15,e>>=4;try{new cn(de.AZTEC_PARAM).decode(s,i)}catch{throw new v}let o=0;for(let a=0;a<r;a++)o=(o<<4)+s[a];return o}getBullsEyeCorners(e){let t=e,n=e,r=e,i=e,s=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let g=this.getFirstDifferent(t,s,1,-1),A=this.getFirstDifferent(n,s,1,1),E=this.getFirstDifferent(r,s,-1,1),I=this.getFirstDifferent(i,s,-1,-1);if(this.nbCenterLayers>2){let S=this.distancePoint(I,g)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(S<.75||S>1.25||!this.isWhiteOrBlackRectangle(g,A,E,I))break}t=g,n=A,r=E,i=I,s=!s}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new v;this.compact=this.nbCenterLayers===5;let o=new G(t.getX()+.5,t.getY()-.5),a=new G(n.getX()+.5,n.getY()+.5),c=new G(r.getX()-.5,r.getY()+.5),f=new G(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,a,c,f],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let o=new Cn(this.image).detect();e=o[0],t=o[1],n=o[2],r=o[3]}catch{let a=this.image.getWidth()/2,c=this.image.getHeight()/2;e=this.getFirstDifferent(new Ye(a+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ye(a+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ye(a-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ye(a-7,c-7),!1,-1,-1).toResultPoint()}let i=le.round((e.getX()+r.getX()+t.getX()+n.getX())/4),s=le.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let o=new Cn(this.image,15,i,s).detect();e=o[0],t=o[1],n=o[2],r=o[3]}catch{e=this.getFirstDifferent(new Ye(i+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ye(i+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ye(i-7,s+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ye(i-7,s-7),!1,-1,-1).toResultPoint()}return i=le.round((e.getX()+r.getX()+t.getX()+n.getX())/4),s=le.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new Ye(i,s)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,i){let s=bt.getInstance(),o=this.getDimension(),a=o/2-this.nbCenterLayers,c=o/2+this.nbCenterLayers;return s.sampleGrid(e,o,o,a,a,c,a,c,c,a,c,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}sampleLine(e,t,n){let r=0,i=this.distanceResultPoint(e,t),s=i/n,o=e.getX(),a=e.getY(),c=s*(t.getX()-e.getX())/i,f=s*(t.getY()-e.getY())/i;for(let g=0;g<n;g++)this.image.get(le.round(o+g*c),le.round(a+g*f))&&(r|=1<<n-g-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let i=3;e=new Ye(e.getX()-i,e.getY()+i),t=new Ye(t.getX()-i,t.getY()-i),n=new Ye(n.getX()+i,n.getY()-i),r=new Ye(r.getX()+i,r.getY()+i);let s=this.getColor(r,e);if(s===0)return!1;let o=this.getColor(e,t);return o!==s||(o=this.getColor(t,n),o!==s)?!1:(o=this.getColor(n,r),o===s)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,i=(t.getY()-e.getY())/n,s=0,o=e.getX(),a=e.getY(),c=this.image.get(e.getX(),e.getY()),f=Math.ceil(n);for(let A=0;A<f;A++)o+=r,a+=i,this.image.get(le.round(o),le.round(a))!==c&&s++;let g=s/n;return g>.1&&g<.9?0:g<=.1===c?1:-1}getFirstDifferent(e,t,n,r){let i=e.getX()+n,s=e.getY()+r;for(;this.isValid(i,s)&&this.image.get(i,s)===t;)i+=n,s+=r;for(i-=n,s-=r;this.isValid(i,s)&&this.image.get(i,s)===t;)i+=n;for(i-=n;this.isValid(i,s)&&this.image.get(i,s)===t;)s+=r;return s-=r,new Ye(i,s)}
6expandSquare(e,t,n){let r=n/(2*t),i=e[0].getX()-e[2].getX(),s=e[0].getY()-e[2].getY(),o=(e[0].getX()+e[2].getX())/2,a=(e[0].getY()+e[2].getY())/2,c=new G(o+r*i,a+r*s),f=new G(o-r*i,a-r*s);i=e[1].getX()-e[3].getX(),s=e[1].getY()-e[3].getY(),o=(e[1].getX()+e[3].getX())/2,a=(e[1].getY()+e[3].getY())/2;let g=new G(o+r*i,a+r*s),A=new G(o-r*i,a-r*s);return[c,g,f,A]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=le.round(e.getX()),n=le.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return le.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return le.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*(X.truncDivision(this.nbLayers-4,8)+1)+15}}class pn{decode(e,t=null){let n=null,r=new Sr(e.getBlackMatrix()),i=null,s=null;try{let f=r.detectMirror(!1);i=f.getPoints(),this.reportFoundResultPoints(t,i),s=new Vn().decode(f)}catch(f){n=f}if(s==null)try{let f=r.detectMirror(!0);i=f.getPoints(),this.reportFoundResultPoints(t,i),s=new Vn().decode(f)}catch(f){throw n??f}let o=new We(s.getText(),s.getRawBytes(),s.getNumBits(),i,Z.AZTEC,Y.currentTimeMillis()),a=s.getByteSegments();a!=null&&o.putMetadata(Pe.BYTE_SEGMENTS,a);let c=s.getECLevel();return c!=null&&o.putMetadata(Pe.ERROR_CORRECTION_LEVEL,c),o}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(ae.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,i,s)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class Ri extends Lt{constructor(e=500){super(new pn,e)}}class Oe{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(ae.TRY_HARDER)===!0&&e.isRotateSupported()){let i=e.rotateCounterClockwise(),s=this.doDecode(i,t),o=s.getResultMetadata(),a=270;o!==null&&o.get(Pe.ORIENTATION)===!0&&(a=a+o.get(Pe.ORIENTATION)%360),s.putMetadata(Pe.ORIENTATION,a);let c=s.getResultPoints();if(c!==null){let f=i.getHeight();for(let g=0;g<c.length;g++)c[g]=new G(f-c[g].getY()-1,c[g].getX())}return s}else throw new v}}reset(){}doDecode(e,t){let n=e.getWidth(),r=e.getHeight(),i=new oe(n),s=t&&t.get(ae.TRY_HARDER)===!0,o=Math.max(1,r>>(s?8:5)),a;s?a=r:a=15;let c=Math.trunc(r/2);for(let f=0;f<a;f++){let g=Math.trunc((f+1)/2),A=(f&1)===0,E=c+o*(A?g:-g);if(E<0||E>=r)break;try{i=e.getBlackRow(E,i)}catch{continue}for(let I=0;I<2;I++){if(I===1&&(i.reverse(),t&&t.get(ae.NEED_RESULT_POINT_CALLBACK)===!0)){let S=new Map;t.forEach((T,N)=>S.set(N,T)),S.delete(ae.NEED_RESULT_POINT_CALLBACK),t=S}try{let S=this.decodeRow(E,i,t);
6if(I===1){S.putMetadata(Pe.ORIENTATION,180);let T=S.getResultPoints();T!==null&&(T[0]=new G(n-T[0].getX()-1,T[0].getY()),T[1]=new G(n-T[1].getX()-1,T[1].getY()))}return S}catch{}}}throw new v}static recordPattern(e,t,n){let r=n.length;for(let c=0;c<r;c++)n[c]=0;let i=e.getSize();if(t>=i)throw new v;let s=!e.get(t),o=0,a=t;for(;a<i;){if(e.get(a)!==s)n[o]++;else{if(++o===r)break;n[o]=1,s=!s}a++}if(!(o===r||o===r-1&&a===i))throw new v}static recordPatternInReverse(e,t,n){let r=n.length,i=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==i&&(r--,i=!i);if(r>=0)throw new v;Oe.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){let r=e.length,i=0,s=0;for(let c=0;c<r;c++)i+=e[c],s+=t[c];if(i<s)return Number.POSITIVE_INFINITY;let o=i/s;n*=o;let a=0;for(let c=0;c<r;c++){let f=e[c],g=t[c]*o,A=f>g?f-g:g-f;if(A>n)return Number.POSITIVE_INFINITY;a+=A}return a/i}}class U extends Oe{static findStartPattern(e){let t=e.getSize(),n=e.getNextSet(0),r=0,i=Int32Array.from([0,0,0,0,0,0]),s=n,o=!1,a=6;for(let c=n;c<t;c++)if(e.get(c)!==o)i[r]++;else{if(r===a-1){let f=U.MAX_AVG_VARIANCE,g=-1;for(let A=U.CODE_START_A;A<=U.CODE_START_C;A++){let E=Oe.patternMatchVariance(i,U.CODE_PATTERNS[A],U.MAX_INDIVIDUAL_VARIANCE);E<f&&(f=E,g=A)}if(g>=0&&e.isRange(Math.max(0,s-(c-s)/2),s,!1))return Int32Array.from([s,c,g]);s+=i[0]+i[1],i=i.slice(2,i.length-1),i[r-1]=0,i[r]=0,r--}else r++;i[r]=1,o=!o}throw new v}static decodeCode(e,t,n){Oe.recordPattern(e,n,t);let r=U.MAX_AVG_VARIANCE,i=-1;for(let s=0;s<U.CODE_PATTERNS.length;s++){let o=U.CODE_PATTERNS[s],a=this.patternMatchVariance(t,o,U.MAX_INDIVIDUAL_VARIANCE);a<r&&(r=a,i=s)}if(i>=0)return i;throw new v}decodeRow(e,t,n){let r=n&&n.get(ae.ASSUME_GS1)===!0,i=U.findStartPattern(t),s=i[2],o=0,a=new Uint8Array(20);a[o++]=s;let c;switch(s){case U.CODE_START_A:c=U.CODE_CODE_A;break;case U.CODE_START_B:c=U.CODE_CODE_B;break;case U.CODE_START_C:c=U.CODE_CODE_C;break;default:throw new F}let f=!1,g=!1,A="",E=i[0],I=i[1],S=Int32Array.from([0,0,0,0,0,0]),T=0,N=0,B=s,H=0,R=!0,re=!1,J=!1;for(;!f;){let Jt=g;switch(g=!1,T=N,N=U.decodeCode(t,S,I),a[o++]=N,N!==U.CODE_STOP&&(R=!0),N!==U.CODE_STOP&&(H++,B+=H*N),E=I,I+=S.reduce((ms,ws)=>ms+ws,0),N){case U.CODE_START_A:case U.CODE_START_B:case U.CODE_START_C:throw new F}switch(c){case U.CODE_CODE_A:if(N<64)J===re?A+=String.fromCharCode(32+N):A+=String.fromCharCode(32+N+128),J=!1;else if(N<96)J===re?A+=String.fromCharCode(N-64):A+=String.fromCharCode(N+64),J=!1;else switch(N!==U.CODE_STOP&&(R=!1),N){case U.CODE_FNC_1:r&&(A.length===0?A+="]C1":A+="�");break;case U.CODE_FNC_2:case U.CODE_FNC_3:break;case U.CODE_FNC_4_A:!re&&J?(re=!0,J=!1):re&&J?(re=!1,J=!1):J=!0;break;case U.CODE_SHIFT:g=!0,c=U.CODE_CODE_B;break;case U.CODE_CODE_B:c=U.CODE_CODE_B;break;case U.CODE_CODE_C:c=U.CODE_CODE_C;break;case U.CODE_STOP:f=!0;break}break;case U.CODE_CODE_B:if(N<96)J===re?A+=String.fromCharCode(32+N):A+=String.fromCharCode(32+N+128),J=!1;else switch(N!==U.CODE_STOP&&(R=!1),N){case U.CODE_FNC_1:r&&(A.length===0?A+="]C1":A+="�");break;case U.CODE_FNC_2:case U.CODE_FNC_3:break;case U.CODE_FNC_4_B:!re&&J?(re=!0,J=!1):re&&J?(re=!1,J=!1):J=!0;break;case U.CODE_SHIFT:g=!0,c=U.CODE_CODE_A;break;case U.CODE_CODE_A:c=U.CODE_CODE_A;break;case U.CODE_CODE_C:c=U.CODE_CODE_C;break;case U.CODE_STOP:f=!0;break}break;case U.CODE_CODE_C:if(N<100)N<10&&(A+="0"),A+=N;else switch(N!==U.CODE_STOP&&(R=!1),N){case U.CODE_FNC_1:r&&(A.length===0?A+="]C1":A+="�");break;case U.CODE_CODE_A:c=U.CODE_CODE_A;break;case U.CODE_CODE_B:c=U.CODE_CODE_B;break;case U.CODE_STOP:f=!0;break}break}Jt&&(c=c===U.CODE_CODE_A?U.CODE_CODE_B:U.CODE_CODE_A)}let Je=I-E;if(I=t.getNextUnset(I),!t.isRange(I,Math.min(t.getSize(),I+(I-E)/2),!1))throw new v;if(B-=H*T,B%103!==T)throw new P;let gt=A.length;if(gt===0)throw new v;gt>0&&R&&(c===U.CODE_CODE_C?A=A.substring(0,gt-2):A=A.substring(0,gt-1));let $e=(i[1]+i[0])/2,Ee=E+Je/2,ze=a.length,rt=new Uint8Array(ze);for(let Jt=0;Jt<ze;Jt++)rt[Jt]=a[Jt];let qt=[new G($e,e),new G(Ee,e)];return new We(A,rt,0,qt,Z.CODE_128,new Date().getTime())}}U.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])],U.MAX_AVG_VARIANCE=.25,U.MAX_INDIVIDUAL_VARIA
6NCE=.7,U.CODE_SHIFT=98,U.CODE_CODE_C=99,U.CODE_CODE_B=100,U.CODE_CODE_A=101,U.CODE_FNC_1=102,U.CODE_FNC_2=97,U.CODE_FNC_3=96,U.CODE_FNC_4_A=101,U.CODE_FNC_4_B=100,U.CODE_START_A=103,U.CODE_START_B=104,U.CODE_START_C=105,U.CODE_STOP=106;let Gn=(()=>{class l extends Oe{constructor(t=!1,n=!1){super(),this.usingCheckDigit=t,this.extendedMode=n,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(t,n,r){let i=this.counters;i.fill(0),this.decodeRowResult="";let s=l.findAsteriskPattern(n,i),o=n.getNextSet(s[1]),a=n.getSize(),c,f;do{l.recordPattern(n,o,i);let T=l.toNarrowWidePattern(i);if(T<0)throw new v;c=l.patternToChar(T),this.decodeRowResult+=c,f=o;for(let N of i)o+=N;o=n.getNextSet(o)}while(c!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let g=0;for(let T of i)g+=T;let A=o-f-g;if(o!==a&&A*2<g)throw new v;if(this.usingCheckDigit){let T=this.decodeRowResult.length-1,N=0;for(let B=0;B<T;B++)N+=l.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(B));if(this.decodeRowResult.charAt(T)!==l.ALPHABET_STRING.charAt(N%43))throw new P;this.decodeRowResult=this.decodeRowResult.substring(0,T)}if(this.decodeRowResult.length===0)throw new v;let E;this.extendedMode?E=l.decodeExtended(this.decodeRowResult):E=this.decodeRowResult;let I=(s[1]+s[0])/2,S=f+g/2;return new We(E,null,0,[new G(I,t),new G(S,t)],Z.CODE_39,new Date().getTime())}static findAsteriskPattern(t,n){let r=t.getSize(),i=t.getNextSet(0),s=0,o=i,a=!1,c=n.length;for(let f=i;f<r;f++)if(t.get(f)!==a)n[s]++;else{if(s===c-1){if(this.toNarrowWidePattern(n)===l.ASTERISK_ENCODING&&t.isRange(Math.max(0,o-Math.floor((f-o)/2)),o,!1))return[o,f];o+=n[0]+n[1],n.copyWithin(0,2,2+s-1),n[s-1]=0,n[s]=0,s--}else s++;n[s]=1,a=!a}throw new v}static toNarrowWidePattern(t){let n=t.length,r=0,i;do{let s=2147483647;for(let c of t)c<s&&c>r&&(s=c);r=s,i=0;let o=0,a=0;for(let c=0;c<n;c++){let f=t[c];f>r&&(a|=1<<n-1-c,i++,o+=f)}if(i===3){for(let c=0;c<n&&i>0;c++){let f=t[c];if(f>r&&(i--,f*2>=o))return-1}return a}}while(i>3);return-1}static patternToChar(t){for(let n=0;n<l.CHARACTER_ENCODINGS.length;n++)if(l.CHARACTER_ENCODINGS[n]===t)return l.ALPHABET_STRING.charAt(n);if(t===l.ASTERISK_ENCODING)return"*";throw new v}static decodeExtended(t){let n=t.length,r="";for(let i=0;i<n;i++){let s=t.charAt(i);if(s==="+"||s==="$"||s==="%"||s==="/"){let o=t.charAt(i+1),a="\0";switch(s){case"+":if(o>="A"&&o<="Z")a=String.fromCharCode(o.charCodeAt(0)+32);else throw new F;break;case"$":if(o>="A"&&o<="Z")a=String.fromCharCode(o.charCodeAt(0)-64);else throw new F;break;case"%":if(o>="A"&&o<="E")a=String.fromCharCode(o.charCodeAt(0)-38);else if(o>="F"&&o<="J")a=String.fromCharCode(o.charCodeAt(0)-11);else if(o>="K"&&o<="O")a=String.fromCharCode(o.charCodeAt(0)+16);else if(o>="P"&&o<="T")a=String.fromCharCode(o.charCodeAt(0)+43);else if(o==="U")a="\0";else if(o==="V")a="@";else if(o==="W")a="`";else if(o==="X"||o==="Y"||o==="Z")a="\x7F";else throw new F;break;case"/":if(o>="A"&&o<="O")a=String.fromCharCode(o.charCodeAt(0)-32);else if(o==="Z")a=":";else throw new F;break}r+=a,i++}else r+=s}return r}}return l.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",l.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],l.ASTERISK_ENCODING=148,l})();class Ce extends Oe{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),i=this.decodeEnd(t),s=new Ae;Ce.decodeMiddle(t,r[1],i[0],s);let o=s.toString(),a=null;n!=null&&(a=n.get(ae.ALLOWED_LENGTHS)),a==null&&(a=Ce.DEFAULT_ALLOWED_LENGTHS);let c=o.length,f=!1,g=0;for(let I of a){if(c===I){f=!0;break}I>g&&(g=I)}if(!f&&c>g&&(f=!0),!f)throw new F;let A=[new G(r[1],e),new G(i[0],e)];return new We(o,null,0,A,Z.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let i=new Int32Array(10),s=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),s.fill(0),o.fill(0);t<n;){Oe.recordPattern(e,t,i);for(let c=0;c<5;c++){let f=2*c;s[c]=i[f],o[c]=i[f+1]}let a=Ce.decodeDigit(s);r.append(a.toString()),a=this.decodeDigit(o),r.append(a.toString()),i.forEac
6h(function(c){t+=c})}}decodeStart(e){let t=Ce.skipWhiteSpace(e),n=Ce.findGuardPattern(e,t,Ce.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 r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(n!==0)throw new v}static skipWhiteSpace(e){let t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new v;return n}decodeEnd(e){e.reverse();try{let t=Ce.skipWhiteSpace(e),n;try{n=Ce.findGuardPattern(e,t,Ce.END_PATTERN_REVERSED[0])}catch(i){i instanceof v&&(n=Ce.findGuardPattern(e,t,Ce.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let r=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-r,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,i=new Int32Array(r),s=e.getSize(),o=!1,a=0,c=t;i.fill(0);for(let f=t;f<s;f++)if(e.get(f)!==o)i[a]++;else{if(a===r-1){if(Oe.patternMatchVariance(i,n,Ce.MAX_INDIVIDUAL_VARIANCE)<Ce.MAX_AVG_VARIANCE)return[c,f];c+=i[0]+i[1],Y.arraycopy(i,2,i,0,a-1),i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,o=!o}throw new v}static decodeDigit(e){let t=Ce.MAX_AVG_VARIANCE,n=-1,r=Ce.PATTERNS.length;for(let i=0;i<r;i++){let s=Ce.PATTERNS[i],o=Oe.patternMatchVariance(e,s,Ce.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,n=i):o===t&&(n=-1)}if(n>=0)return n%10;throw new v}}Ce.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])],Ce.MAX_AVG_VARIANCE=.38,Ce.MAX_INDIVIDUAL_VARIANCE=.5,Ce.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ce.START_PATTERN=Int32Array.from([1,1,1,1]),Ce.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class _e extends Oe{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,i=Int32Array.from([0,0,0]);for(;!t;){i=Int32Array.from([0,0,0]),n=_e.findGuardPattern(e,r,!1,this.START_END_PATTERN,i);let s=n[0];r=n[1];let o=s-(r-s);o>=0&&(t=e.isRange(o,s,!1))}return n}static checkChecksum(e){return _e.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return _e.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-48;if(i<0||i>9)throw new F;n+=i}n*=3;for(let r=t-2;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-48;if(i<0||i>9)throw new F;n+=i}return(1e3-n)%10}static decodeEnd(e,t){return _e.findGuardPattern(e,t,!1,_e.START_END_PATTERN,new Int32Array(_e.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,i){let s=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let o=0,a=t,c=r.length,f=n;for(let g=t;g<s;g++)if(e.get(g)!==f)i[o]++;else{if(o===c-1){if(Oe.patternMatchVariance(i,r,_e.MAX_INDIVIDUAL_VARIANCE)<_e.MAX_AVG_VARIANCE)return Int32Array.from([a,g]);a+=i[0]+i[1];let A=i.slice(2,i.length-1);for(let E=0;E<o-1;E++)i[E]=A[E];i[o-1]=0,i[o]=0,o--}else o++;i[o]=1,f=!f}throw new v}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let i=this.MAX_AVG_VARIANCE,s=-1,o=r.length;for(let a=0;a<o;a++){let c=r[a],f=Oe.patternMatchVariance(t,c,_e.MAX_INDIVIDUAL_VARIANCE);f<i&&(i=f,s=a)}if(s>=0)return s;throw new v}}_e.MAX_AVG_VARIANCE=.48,_e.MAX_INDIVIDUAL_VARIANCE=.7,_e.START_END_PATTERN=Int32Array.from([1,1,1]),_e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),_e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_e.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 ln{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 r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),s=r.toString(),o=ln.parseExtensionString(s),a=[new G((n[0]+n[1])/2,e),new G(i,e)],c=new We(s,null,0,a,Z.UPC_EAN_EXTENSION,new Date().getTime());return o!=null&&c.putAllMetadata(o),c}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let c=0;c<5&&s<i;c++){let f=_e.decodeDigit(e,r,s,_e.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);for(let g of r)s+=g;f>=10&&(o|=1<<4-c),c!==4&&(s=e.getNextSet(s),s=e.getNextUnset(s))}if(n.length!==5)throw new v;let a=this.determineCheckDigit(o);if(ln.extensionChecksum(n.toString())!==a)throw new v;return s}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).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 v}static parseExtensionString(e){if(e.length!==5)return null;let t=ln.parseExtension5String(e);return t==null?null:new Map([[Pe.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)),r=(n/100).toString(),i=n%100,s=i<10?"0"+i:i.toString();return t+r+"."+s}}class jn{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),s=r.toString(),o=jn.parseExtensionString(s),a=[new G((n[0]+n[1])/2,e),new G(i,e)],c=new We(s,null,0,a,Z.UPC_EAN_EXTENSION,new Date().getTime());return o!=null&&c.putAllMetadata(o),c}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let a=0;a<2&&s<i;a++){let c=_e.decodeDigit(e,r,s,_e.L_AND_G_PATTERNS);n+=String.fromCharCode(48+c%10);for(let f of r)s+=f;c>=10&&(o|=1<<1-a),a!==1&&(s=e.getNextSet(s),s=e.getNextUnset(s))}if(n.length!==2)throw new v;if(parseInt(n.toString())%4!==o)throw new v;return s}static parseExtensionString(e){return e.length!==2?null:new Map([[Pe.ISSUE_NUMBER,parseInt(e)]])}}class yr{static decodeRow(e,t,n){let r=_e.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ln().decodeRow(e,t,r)}catch{return new jn().decodeRow(e,t,r)}}}yr.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);
6class ge extends _e{constructor(){super(),this.decodeRowStringBuffer="",ge.L_AND_G_PATTERNS=ge.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=ge.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];ge.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=ge.findStartGuardPattern(t),i=n==null?null:n.get(ae.NEED_RESULT_POINT_CALLBACK);if(i!=null){let R=new G((r[0]+r[1])/2,e);i.foundPossibleResultPoint(R)}let s=this.decodeMiddle(t,r,this.decodeRowStringBuffer),o=s.rowOffset,a=s.resultString;if(i!=null){let R=new G(o,e);i.foundPossibleResultPoint(R)}let c=this.decodeEnd(t,o);if(i!=null){let R=new G((c[0]+c[1])/2,e);i.foundPossibleResultPoint(R)}let f=c[1],g=f+(f-c[0]);if(g>=t.getSize()||!t.isRange(f,g,!1))throw new v;let A=a.toString();if(A.length<8)throw new F;if(!ge.checkChecksum(A))throw new P;let E=(r[1]+r[0])/2,I=(c[1]+c[0])/2,S=this.getBarcodeFormat(),T=[new G(E,e),new G(I,e)],N=new We(A,null,0,T,S,new Date().getTime()),B=0;try{let R=yr.decodeRow(e,t,c[1]);N.putMetadata(Pe.UPC_EAN_EXTENSION,R.getText()),N.putAllMetadata(R.getResultMetadata()),N.addResultPoints(R.getResultPoints()),B=R.getText().length}catch{}let H=n==null?null:n.get(ae.ALLOWED_EAN_EXTENSIONS);if(H!=null){let R=!1;for(let re in H)if(B.toString()===re){R=!0;break}if(!R)throw new v}return N}decodeEnd(e,t){return ge.findGuardPattern(e,t,!1,ge.START_END_PATTERN,new Int32Array(ge.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return ge.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return ge.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-48;if(i<0||i>9)throw new F;n+=i}n*=3;for(let r=t-2;r>=0;r-=2){let i=e.charAt(r).charCodeAt(0)-48;if(i<0||i>9)throw new F;n+=i}return(1e3-n)%10}}let En=(()=>{class l extends ge{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(t,n,r){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=t.getSize(),o=n[1],a=0;for(let f=0;f<6&&o<s;f++){let g=ge.decodeDigit(t,i,o,ge.L_AND_G_PATTERNS);r+=String.fromCharCode(48+g%10);for(let A of i)o+=A;g>=10&&(a|=1<<5-f)}r=l.determineFirstDigit(r,a),o=ge.findGuardPattern(t,o,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0))[1];for(let f=0;f<6&&o<s;f++){let g=ge.decodeDigit(t,i,o,ge.L_PATTERNS);r+=String.fromCharCode(48+g);for(let A of i)o+=A}return{rowOffset:o,resultString:r}}getBarcodeFormat(){return Z.EAN_13}static determineFirstDigit(t,n){for(let r=0;r<10;r++)if(n===this.FIRST_DIGIT_ENCODINGS[r])return t=String.fromCharCode(48+r)+t,t;throw new v}}return l.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],l})();class Tr extends ge{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1];for(let a=0;a<4&&s<i;a++){let c=ge.decodeDigit(e,r,s,ge.L_PATTERNS);n+=String.fromCharCode(48+c);for(let f of r)s+=f}s=ge.findGuardPattern(e,s,!0,ge.MIDDLE_PATTERN,new Int32Array(ge.MIDDLE_PATTERN.length).fill(0))[1];for(let a=0;a<4&&s<i;a++){let c=ge.decodeDigit(e,r,s,ge.L_PATTERNS);n+=String.fromCharCode(48+c);for(let f of r)s+=f}return{rowOffset:s,resultString:n}}getBarcodeFormat(){return Z.EAN_8}}class br extends ge{constructor(){super(...arguments),this.ean13Reader=new En}getBarcodeFormat(){return Z.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 We(t.substring(1),null,null,e.getResultPoints(),Z.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new v}reset(){this.ean13Reader.reset()}}class ut extends ge{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters.map(c=>c);r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s=t[1],o=0;for(let c=0;c<6&&s<i;c++){let f=ut.decodeDigit(e,r,s,ut.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);for(let g of r)s+=g;f>=10&&(o|=1<<5-c)}let a=ut.determineNumSysAndCheckDigit(n,o);return{rowOffset:s,resultString:a}}decodeEnd(e,t){return ut.findGuardPatternWithoutCounters(e,t,!0,ut.MIDDLE_END_PATTERN)}checkChecksum(e){return ge.checkChecksum(ut.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r]){let i=String.fromCharCode(48+n),s=String.fromCharCode(48+r);return i+e+s}throw v.getNotFoundInstance()}getBarcodeFormat(){return Z.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(i=>i.charCodeAt(0)),n=new Ae;n.append(e.charAt(0));let r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),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(r);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}ut.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),ut.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 Xn extends Oe{constructor(e){super();let t=e==null?null:e.get(ae.POSSIBLE_FORMATS),n=[];h(t)?(n.push(new En),n.push(new br),n.push(new Tr),n.push(new ut)):(t.indexOf(Z.EAN_13)>-1&&n.push(new En),t.indexOf(Z.UPC_A)>-1&&n.push(new br),t.indexOf(Z.EAN_8)>-1&&n.push(new Tr),t.indexOf(Z.UPC_E)>-1&&n.push(new ut)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{let i=r.decodeRow(e,t,n),s=i.getBarcodeFormat()===Z.EAN_13&&i.getText().charAt(0)==="0",o=n==null?null:n.get(ae.POSSIBLE_FORMATS),a=o==null||o.includes(Z.UPC_A);if(s&&a){let c=i.getRawBytes(),f=new We(i.getText().substring(1),c,c?c.length:null,i.getResultPoints(),Z.UPC_A);return f.putAllMetadata(i.getResultMetadata()),f}return i}catch{}throw new v}reset(){for(let e of this.readers)e.reset()}}let Bt=(()=>{class l extends Oe{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(t,n){for(let r=0;r<n.length;
6r++)if(Oe.patternMatchVariance(t,n[r],l.MAX_INDIVIDUAL_VARIANCE)<l.MAX_AVG_VARIANCE)return r;throw new v}static count(t){return le.sum(new Int32Array(t))}static increment(t,n){let r=0,i=n[0];for(let s=1;s<t.length;s++)n[s]>i&&(i=n[s],r=s);t[r]++}static decrement(t,n){let r=0,i=n[0];for(let s=1;s<t.length;s++)n[s]<i&&(i=n[s],r=s);t[r]--}static isFinderPattern(t){let n=t[0]+t[1],r=n+t[2]+t[3],i=n/r;if(i>=l.MIN_FINDER_PATTERN_RATIO&&i<=l.MAX_FINDER_PATTERN_RATIO){let s=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(let a of t)a>o&&(o=a),a<s&&(s=a);return o<10*s}return!1}}return l.MAX_AVG_VARIANCE=.2,l.MAX_INDIVIDUAL_VARIANCE=.45,l.MIN_FINDER_PATTERN_RATIO=9.5/12,l.MAX_FINDER_PATTERN_RATIO=12.5/14,l})();class Xt{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 Xt))return!1;let t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class In{constructor(e,t,n,r,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new G(n,i)),this.resultPoints.push(new G(r,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof In))return!1;let t=e;return this.value===t.value}hashCode(){return this.value}}class wt{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let a of e)r+=a;let i=0,s=0,o=e.length;for(let a=0;a<o-1;a++){let c;for(c=1,s|=1<<a;c<e[a];c++,s&=~(1<<a)){let f=wt.combins(r-c-1,o-a-2);if(n&&s===0&&r-c-(o-a-1)>=o-a-1&&(f-=wt.combins(r-c-(o-a),o-a-2)),o-a-1>1){let g=0;for(let A=r-c-(o-a-2);A>t;A--)g+=wt.combins(r-c-A-1,o-a-3);f-=g*(o-1-a)}else r-c>t&&f--;i+=f}r-=c}return i}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let i=1,s=1;for(let o=e;o>n;o--)i*=o,s<=r&&(i/=s,s++);for(;s<=r;)i/=s,s++;return i}}class vi{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new oe(n),i=0,o=e[0].getRightChar().getValue();for(let a=11;a>=0;--a)(o&1<<a)!=0&&r.set(i),i++;for(let a=1;a<e.length;++a){let c=e[a],f=c.getLeftChar().getValue();for(let g=11;g>=0;--g)(f&1<<g)!=0&&r.set(i),i++;if(c.getRightChar()!=null){let g=c.getRightChar().getValue();for(let A=11;A>=0;--A)(g&1<<A)!=0&&r.set(i),i++}}return r}}class Pt{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Wn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}let ht=(()=>{class l extends Wn{constructor(t,n){super(t),this.value=n}getValue(){return this.value}isFNC1(){return this.value===l.FNC1}}return l.FNC1="$",l})();class Ft extends Wn{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}}let Wt=(()=>{class l extends Wn{constructor(t,n,r){if(super(t),n<0||n>10||r<0||r>10)throw new F;this.firstDigit=n,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===l.FNC1}isSecondDigitFNC1(){return this.secondDigit===l.FNC1}isAnyFNC1(){return this.firstDigit===l.FNC1||this.secondDigit===l.FNC1}}return l.FNC1=10,l})();class z{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new v;let t=e.substring(0,2);for(let i of z.TWO_DIGIT_DATA_LENGTH)if(i[0]===t)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(2,i[2],e):z.processFixedAI(2,i[1],e);if(e.length<3)throw new v;let n=e.substring(0,3);for(let i of z.THREE_DIGIT_DATA_LENGTH)if(i[0]===n)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(3,i[2],e):z.processFixedAI(3,i[1],e);for(let i of z.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(i[0]===n)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(4,i[2],e):z.process
6FixedAI(4,i[1],e);if(e.length<4)throw new v;let r=e.substring(0,4);for(let i of z.FOUR_DIGIT_DATA_LENGTH)if(i[0]===r)return i[1]===z.VARIABLE_LENGTH?z.processVariableAI(4,i[2],e):z.processFixedAI(4,i[1],e);throw new v}static processFixedAI(e,t,n){if(n.length<e)throw new v;let r=n.substring(0,e);if(n.length<e+t)throw new v;let i=n.substring(e,e+t),s=n.substring(e+t),o="("+r+")"+i,a=z.parseFieldsInGeneralPurpose(s);return a==null?o:o+a}static processVariableAI(e,t,n){let r=n.substring(0,e),i;n.length<e+t?i=n.length:i=e+t;let s=n.substring(e,i),o=n.substring(i),a="("+r+")"+s,c=z.parseFieldsInGeneralPurpose(o);return c==null?a:a+c}}z.VARIABLE_LENGTH=[],z.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",z.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",z.VARIABLE_LENGTH,20],["22",z.VARIABLE_LENGTH,29],["30",z.VARIABLE_LENGTH,8],["37",z.VARIABLE_LENGTH,8],["90",z.VARIABLE_LENGTH,30],["91",z.VARIABLE_LENGTH,30],["92",z.VARIABLE_LENGTH,30],["93",z.VARIABLE_LENGTH,30],["94",z.VARIABLE_LENGTH,30],["95",z.VARIABLE_LENGTH,30],["96",z.VARIABLE_LENGTH,30],["97",z.VARIABLE_LENGTH,3],["98",z.VARIABLE_LENGTH,30],["99",z.VARIABLE_LENGTH,30]],z.THREE_DIGIT_DATA_LENGTH=[["240",z.VARIABLE_LENGTH,30],["241",z.VARIABLE_LENGTH,30],["242",z.VARIABLE_LENGTH,6],["250",z.VARIABLE_LENGTH,30],["251",z.VARIABLE_LENGTH,30],["253",z.VARIABLE_LENGTH,17],["254",z.VARIABLE_LENGTH,20],["400",z.VARIABLE_LENGTH,30],["401",z.VARIABLE_LENGTH,30],["402",17],["403",z.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",z.VARIABLE_LENGTH,20],["421",z.VARIABLE_LENGTH,15],["422",3],["423",z.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],z.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",z.VARIABLE_LENGTH,15],["391",z.VARIABLE_LENGTH,18],["392",z.VARIABLE_LENGTH,15],["393",z.VARIABLE_LENGTH,18],["703",z.VARIABLE_LENGTH,30]],z.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",z.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",z.VARIABLE_LENGTH,20],["8003",z.VARIABLE_LENGTH,30],["8004",z.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",z.VARIABLE_LENGTH,30],["8008",z.VARIABLE_LENGTH,12],["8018",18],["8020",z.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",z.VARIABLE_LENGTH,70],["8200",z.VARIABLE_LENGTH,70]];class Yt{constructor(e){this.buffer=new Ae,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let i=this.decodeGeneralPurposeField(n,r),s=z.parseFieldsInGeneralPurpose(i.getNewString());if(s!=null&&e.append(s),i.isRemaining()?r=""+i.getRemainingValue():r=null,n===i.getNewPosition())break;n=i.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 i=this.extractNumericValueFromBitArray(e,4);return i===0?new Wt(this.information.getSize(),Wt.FNC1,Wt.FNC1):new Wt(this.information.getSize(),i-1,Wt.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new Wt(e+7,n,r)}extractNumericValueFromBitArray(e,t){return Yt.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let i=0;i<n;++i)e.get(t+i)&&(r|=1<<n-i-1);return r}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 Ft(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ft(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();
6if(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 Ft(this.current.getPosition(),this.buffer.toString()):t=new Ft(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Pt(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new Ft(this.current.getPosition(),this.buffer.toString());return new Pt(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Pt(!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 Ft(this.current.getPosition(),this.buffer.toString());return new Pt(!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 Pt(!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 Ft(this.current.getPosition(),this.buffer.toString());return new Pt(!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 Pt(!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 r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new ht(e+5,ht.FNC1);if(t>=5&&t<15)return new ht(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new ht(e+7,""+(n+1));if(n>=90&&n<116)return new ht(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),i;switch(r){case 232:i="!";break;case 233:i='"';break;case 234:i="%";break;case 235:i="&";break;case 236:i="'";break;case 237:i="(";break;case 238:i=")";break;case 239:i="*";break;case 240:i="+";break;case 241:i=",";break;case 242:i="-";break;case 243:i=".";break;case 244:i="/";break;case 245:i=":";break;case 246:i=";";break;case 247:i="<";break;case 248:i="=";break;case 249:i=">";break;case 250:i="?";break;case 251:i="_";break;case 252:i=" ";break;default:throw new F}return new ht(e+8,i)}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 ht(e+5,ht.FNC1);if(t>=5&&t<15)return new ht(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new ht(e+6,""+(n+33));let r;switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new It("Decoding invalid alphanumeric value: "+n)}return new ht(e+6,r)}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 Yn{constructor(e){this.information=e,this.generalDecoder=new Yt(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}let ft=(()=>{class l extends Yn{constructor(t){super(t)}encodeCompressedGtin(t,n){t.append("(01)");let r=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,r)}encodeCompressedGtinWithoutAI(t,n,r){for(let i=0;i<4;++i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*i,10);s/100===0&&t.append("0"),s/10===0&&t.append("0"),t.append(s)}l.appendCheckDigit(t,r)}static appendCheckDigit(t,n){let r=0;for(let i=0;i<13;
6i++){let s=t.charAt(i+n).charCodeAt(0)-48;r+=(i&1)===0?3*s:s}r=10-r%10,r===10&&(r=0),t.append(r)}}return l.GTIN_SIZE=40,l})(),Li=(()=>{class l extends ft{constructor(t){super(t)}parseInformation(){let t=new Ae;t.append("(01)");let n=t.length(),r=this.getGeneralDecoder().extractNumericValueFromBitArray(l.HEADER_SIZE,4);return t.append(r),this.encodeCompressedGtinWithoutAI(t,l.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,l.HEADER_SIZE+44)}}return l.HEADER_SIZE=4,l})(),Bi=(()=>{class l extends Yn{constructor(t){super(t)}parseInformation(){let t=new Ae;return this.getGeneralDecoder().decodeAllCodes(t,l.HEADER_SIZE)}}return l.HEADER_SIZE=5,l})();class Sn extends ft{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let i=this.checkWeight(r),s=1e5;for(let o=0;o<5;++o)i/s===0&&e.append("0"),s/=10;e.append(i)}}let Nr=(()=>{class l extends Sn{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()!=l.HEADER_SIZE+Sn.GTIN_SIZE+l.WEIGHT_SIZE)throw new v;let t=new Ae;return this.encodeCompressedGtin(t,l.HEADER_SIZE),this.encodeCompressedWeight(t,l.HEADER_SIZE+Sn.GTIN_SIZE,l.WEIGHT_SIZE),t.toString()}}return l.HEADER_SIZE=5,l.WEIGHT_SIZE=15,l})();class Pi extends Nr{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Fi extends Nr{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}let ki=(()=>{class l extends ft{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()<l.HEADER_SIZE+ft.GTIN_SIZE)throw new v;let t=new Ae;this.encodeCompressedGtin(t,l.HEADER_SIZE);let n=this.getGeneralDecoder().extractNumericValueFromBitArray(l.HEADER_SIZE+ft.GTIN_SIZE,l.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");let r=this.getGeneralDecoder().decodeGeneralPurposeField(l.HEADER_SIZE+ft.GTIN_SIZE+l.LAST_DIGIT_SIZE,null);return t.append(r.getNewString()),t.toString()}}return l.HEADER_SIZE=8,l.LAST_DIGIT_SIZE=2,l})(),Ui=(()=>{class l extends ft{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()<l.HEADER_SIZE+ft.GTIN_SIZE)throw new v;let t=new Ae;this.encodeCompressedGtin(t,l.HEADER_SIZE);let n=this.getGeneralDecoder().extractNumericValueFromBitArray(l.HEADER_SIZE+ft.GTIN_SIZE,l.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");let r=this.getGeneralDecoder().extractNumericValueFromBitArray(l.HEADER_SIZE+ft.GTIN_SIZE+l.LAST_DIGIT_SIZE,l.FIRST_THREE_DIGITS_SIZE);r/100==0&&t.append("0"),r/10==0&&t.append("0"),t.append(r);let i=this.getGeneralDecoder().decodeGeneralPurposeField(l.HEADER_SIZE+ft.GTIN_SIZE+l.LAST_DIGIT_SIZE+l.FIRST_THREE_DIGITS_SIZE,null);return t.append(i.getNewString()),t.toString()}}return l.HEADER_SIZE=8,l.LAST_DIGIT_SIZE=2,l.FIRST_THREE_DIGITS_SIZE=10,l})(),Nt=(()=>{class l extends Sn{constructor(t,n,r){super(t),this.dateCode=r,this.firstAIdigits=n}parseInformation(){if(this.getInformation().getSize()!=l.HEADER_SIZE+l.GTIN_SIZE+l.WEIGHT_SIZE+l.DATE_SIZE)throw new v;let t=new Ae;return this.encodeCompressedGtin(t,l.HEADER_SIZE),this.encodeCompressedWeight(t,l.HEADER_SIZE+l.GTIN_SIZE,l.WEIGHT_SIZE),this.encodeCompressedDate(t,l.HEADER_SIZE+l.GTIN_SIZE+l.WEIGHT_SIZE),t.toString()}encodeCompressedDate(t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(n,l.DATE_SIZE);if(r==38400)return;t.append("("),t.append(this.dateCode),t.append(")");let i=r%32;r/=32;let s=r%12+1;r/=12;let o=r;o/10==0&&t.append("0"),t.append(o),s/10==0&&t.append("0"),t.append(s),i/10==0&&t.append("0"),t.append(i)}addWeightCode(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")}checkWeight(t){return t%1e5}}return l.HEADER_SIZE=8,l.WEIGHT_SIZE=20,l.DATE_SIZE=16,l})();function _r(l){try{if(l.get(1))return new Li(l);if(!l.get(2))return new Bi(l);switch(Yt.extractNumericValueFromBitArray(l,1,4)){case 4:return new Pi(l);case 5:return new Fi(l)}switch(Yt.extractNumericValueFromBitArray(l,1,5)){case 12:return new ki(l);case 13:return new Ui(l)}switch(Yt.extractNumericValueFromBitArray(l,1,7)){case 56:return new Nt(l,"310","11");case 57:return new Nt(l,"320","11");case 58:return new Nt(l,"310","13");case 59:return new Nt(l,"320","13");case 60:return new Nt(l,"310","15");case 61:return new Nt(l,"320","15");case 62:return new Nt(l,"310","17");case 63:return new Nt(l,"320","17")}
6}catch(e){throw console.log(e),new It("unknown decoder: "+l)}}class _t{constructor(e,t,n,r){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=r}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 _t?_t.equalsOrNull(e.leftchar,t.leftchar)&&_t.equalsOrNull(e.rightchar,t.rightchar)&&_t.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:_t.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Zn{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 Zn?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,i)=>{t.forEach(s=>{r.getLeftChar().getValue()===s.getLeftChar().getValue()&&r.getRightChar().getValue()===s.getRightChar().getValue()&&r.getFinderPatter().getValue()===s.getFinderPatter().getValue()&&(n=!0)})}),n}}class L extends Bt{constructor(e){super(...arguments),this.pairs=new Array(L.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 L.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,L.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(i){if(i instanceof v){if(!this.pairs.length)throw new v;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let i=this.checkRowsBoolean(!1);if(i!=null||(i=this.checkRowsBoolean(!0),i!=null))return i}throw new v}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 r=this.rows[n];this.pairs.length=0;for(let s of e)this.pairs.push(s.getPairs());if(this.pairs.push(r.getPairs()),!L.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let i=new Array(e);i.push(r);try{return this.checkRows(i,n+1)}catch(s){this.verbose&&console.log(s)}}throw new v}static isValidSequence(e){for(let t of L.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,i=!1;for(;n<this.rows.length;){let s=this.rows[n];if(s.getRowNumber()>e){i=s.isEquivalent(this.pairs);break}r=s.isEquivalent(this.pairs),n++}i||r||L.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Zn(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 r of n.getPairs())for(let i of e)if(_t.equals(r,i))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let i of e){let s=!1;for(let o of n.getPairs())if(i.equals(o)){s=!0;break}if(!s){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=vi.buildBitArray(e),r=_r(t).parseInformation(),i=e[0].getFinderPattern().getResultPoints(),s=e[e.length-1].getFinderPattern().getResultPoints(),o=[i[0],i[1],s[0],s[1]];return new We(r,null,null,o,Z.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let r=n.getChecksumPortion(),i=2;
6for(let o=1;o<this.pairs.size();++o){let a=this.pairs.get(o);r+=a.getLeftChar().getChecksumPortion(),i++;let c=a.getRightChar();c!=null&&(r+=c.getChecksumPortion(),i++)}return r%=211,211*(i-4)+r==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 r=t.length%2==0;this.startFromEven&&(r=!r);let i,s=!0,o=-1;do this.findNextPair(e,t,o),i=this.parseFoundFinderPattern(e,n,r),i==null?o=L.getNextSecondBar(e,this.startEnd[0]):s=!1;while(s);let a=this.decodeDataCharacter(e,i,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new v;let c;try{c=this.decodeDataCharacter(e,i,r,!1)}catch(f){c=null,this.verbose&&console.log(f)}return new _t(a,c,i,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),s;n>=0?s=n:this.isEmptyPair(t)?s=0:s=t[t.length-1].getFinderPattern().getStartEnd()[1];let o=t.length%2!=0;this.startFromEven&&(o=!o);let a=!1;for(;s<i&&(a=!e.get(s),!!a);)s++;let c=0,f=s;for(let g=s;g<i;g++)if(e.get(g)!=a)r[c]++;else{if(c==3){if(o&&L.reverseCounters(r),L.isFinderPattern(r)){this.startEnd[0]=f,this.startEnd[1]=g;return}o&&L.reverseCounters(r),f+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,c--}else c++;r[c]=1,a=!a}throw new v}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,i,s;if(n){let c=this.startEnd[0]-1;for(;c>=0&&!e.get(c);)c--;c++,r=this.startEnd[0]-c,i=c,s=this.startEnd[1]}else i=this.startEnd[0],s=e.getNextUnset(this.startEnd[1]+1),r=s-this.startEnd[1];let o=this.getDecodeFinderCounters();Y.arraycopy(o,0,o,1,o.length-1),o[0]=r;let a;try{a=this.parseFinderValue(o,L.FINDER_PATTERNS)}catch{return null}return new In(a,[i,s],i,s,t)}decodeDataCharacter(e,t,n,r){let i=this.getDataCharacterCounters();for(let Ee=0;Ee<i.length;Ee++)i[Ee]=0;if(r)L.recordPatternInReverse(e,t.getStartEnd()[0],i);else{L.recordPattern(e,t.getStartEnd()[1],i);for(let Ee=0,ze=i.length-1;Ee<ze;Ee++,ze--){let rt=i[Ee];i[Ee]=i[ze],i[ze]=rt}}let s=17,o=le.sum(new Int32Array(i))/s,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(o-a)/a>.3)throw new v;let c=this.getOddCounts(),f=this.getEvenCounts(),g=this.getOddRoundingErrors(),A=this.getEvenRoundingErrors();for(let Ee=0;Ee<i.length;Ee++){let ze=1*i[Ee]/o,rt=ze+.5;if(rt<1){if(ze<.3)throw new v;rt=1}else if(rt>8){if(ze>8.7)throw new v;rt=8}let qt=Ee/2;(Ee&1)==0?(c[qt]=rt,g[qt]=ze-rt):(f[qt]=rt,A[qt]=ze-rt)}this.adjustOddEvenCounts(s);let E=4*t.getValue()+(n?0:2)+(r?0:1)-1,I=0,S=0;for(let Ee=c.length-1;Ee>=0;Ee--){if(L.isNotA1left(t,n,r)){let ze=L.WEIGHTS[E][2*Ee];S+=c[Ee]*ze}I+=c[Ee]}let T=0;for(let Ee=f.length-1;Ee>=0;Ee--)if(L.isNotA1left(t,n,r)){let ze=L.WEIGHTS[E][2*Ee+1];T+=f[Ee]*ze}let N=S+T;if((I&1)!=0||I>13||I<4)throw new v;let B=(13-I)/2,H=L.SYMBOL_WIDEST[B],R=9-H,re=wt.getRSSvalue(c,H,!0),J=wt.getRSSvalue(f,R,!1),Je=L.EVEN_TOTAL_SUBSET[B],gt=L.GSUM[B],$e=re*Je+J+gt;return new Xt($e,N)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=le.sum(new Int32Array(this.getOddCounts())),n=le.sum(new Int32Array(this.getEvenCounts())),r=!1,i=!1;t>13?i=!0:t<4&&(r=!0);let s=!1,o=!1;n>13?o=!0:n<4&&(s=!0);let a=t+n-e,c=(t&1)==1,f=(n&1)==0;if(a==1)if(c){if(f)throw new v;i=!0}else{if(!f)throw new v;o=!0}else if(a==-1)if(c){if(f)throw new v;r=!0}else{if(!f)throw new v;s=!0}else if(a==0){if(c){if(!f)throw new v;t<n?(r=!0,o=!0):(i=!0,s=!0)}else if(f)throw new v}else throw new v;if(r){if(i)throw new v;L.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&L.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(o)throw new v;L.increment(this.getEvenCounts(),this.getOddRoundingErrors())}o&&L.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}L.SYMBOL_WIDEST=[7,5,4,3,1],L.EVEN_TOTAL_SUBSET=[4,20,52,104,204],L.GSUM=[0,348,1388,2948,3988],L.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])],L.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,9
61],[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]],L.FINDER_PAT_A=0,L.FINDER_PAT_B=1,L.FINDER_PAT_C=2,L.FINDER_PAT_D=3,L.FINDER_PAT_E=4,L.FINDER_PAT_F=5,L.FINDER_PATTERN_SEQUENCES=[[L.FINDER_PAT_A,L.FINDER_PAT_A],[L.FINDER_PAT_A,L.FINDER_PAT_B,L.FINDER_PAT_B],[L.FINDER_PAT_A,L.FINDER_PAT_C,L.FINDER_PAT_B,L.FINDER_PAT_D],[L.FINDER_PAT_A,L.FINDER_PAT_E,L.FINDER_PAT_B,L.FINDER_PAT_D,L.FINDER_PAT_C],[L.FINDER_PAT_A,L.FINDER_PAT_E,L.FINDER_PAT_B,L.FINDER_PAT_D,L.FINDER_PAT_D,L.FINDER_PAT_F],[L.FINDER_PAT_A,L.FINDER_PAT_E,L.FINDER_PAT_B,L.FINDER_PAT_D,L.FINDER_PAT_E,L.FINDER_PAT_F,L.FINDER_PAT_F],[L.FINDER_PAT_A,L.FINDER_PAT_A,L.FINDER_PAT_B,L.FINDER_PAT_B,L.FINDER_PAT_C,L.FINDER_PAT_C,L.FINDER_PAT_D,L.FINDER_PAT_D],[L.FINDER_PAT_A,L.FINDER_PAT_A,L.FINDER_PAT_B,L.FINDER_PAT_B,L.FINDER_PAT_C,L.FINDER_PAT_C,L.FINDER_PAT_D,L.FINDER_PAT_E,L.FINDER_PAT_E],[L.FINDER_PAT_A,L.FINDER_PAT_A,L.FINDER_PAT_B,L.FINDER_PAT_B,L.FINDER_PAT_C,L.FINDER_PAT_C,L.FINDER_PAT_D,L.FINDER_PAT_E,L.FINDER_PAT_F,L.FINDER_PAT_F],[L.FINDER_PAT_A,L.FINDER_PAT_A,L.FINDER_PAT_B,L.FINDER_PAT_B,L.FINDER_PAT_C,L.FINDER_PAT_D,L.FINDER_PAT_D,L.FINDER_PAT_E,L.FINDER_PAT_E,L.FINDER_PAT_F,L.FINDER_PAT_F]],L.MAX_PAIRS=11;class Hi extends Xt{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 Me extends Bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){let r=this.decodePair(t,!1,e,n);Me.addOrTally(this.possibleLeftPairs,r),t.reverse();let i=this.decodePair(t,!0,e,n);Me.addOrTally(this.possibleRightPairs,i),t.reverse();for(let s of this.possibleLeftPairs)if(s.getCount()>1){for(let o of this.possibleRightPairs)if(o.getCount()>1&&Me.checkChecksum(s,o))return Me.constructResult(s,o)}throw new v}static addOrTally(e,t){if(t==null)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.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(),r=new String(n).toString(),i=new Ae;for(let c=13-r.length;c>0;c--)i.append("0");i.append(r);let s=0;for(let c=0;c<13;c++){let f=i.charAt(c).charCodeAt(0)-48;s+=(c&1)===0?3*f:f}s=10-s%10,s===10&&(s=0),i.append(s.toString());let o=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new We(i.toString(),null,0,[o[0],o[1],a[0],a[1]],Z.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let i=this.findFinderPattern(e,t),s=this.parseFoundFinderPattern(e,n,t,i),o=r==null?null:r.get(ae.NEED_RESULT_POINT_CALLBACK);if(o!=null){let f=(i[0]+i[1])/2;t&&(f=e.getSize()-1-f),o.foundPossibleResultPoint(new G(f,n))}let a=this.decodeDataCharacter(e,s,!0),c=this.decodeDataCharacter(e,s,!1);return new Hi(1597*a.getValue()+c.getValue(),a.getChecksumPortion()+4*c.getChecksumPortion(),s)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let T=0;T<r.length;T++)r[T]=0;if(n)Oe.recordPatternInReverse(e,t.getStartEnd()[0],r);else{Oe.recordPattern(e,t.getStartEnd()[1]+1,r);for(let T=0,N=r.length-1;T<N;T++,N--){let B=r[T];r[T]=r[N],r[N]=B}}let i=n?16:15,s=le.sum(new Int32Array(r))/i,o=this.getOddCounts(),a=this.getEvenCounts(),c=this.getOddRoundingErrors(),f=this.getEvenRoundingErrors();for(let T=0;T<r.length;T++){let N=r[T]/s,B=Math.floor(N+.5);B<1?B=1:B>8&&(B=8);let H=Math.floor(T/2);(T&1)===0?(o[H]=B,c[H]=N-B):(a[H]=B,f[H]=N-B)}this.adjustOddEvenCounts(n,i);let g=0,A=0;for(let T=o.length-1;T>=0;T--)A*=9,A+=o[T],g+=o[T];let E=0,I=0;for(let T=a.length-1;T>=0;T--)E*=9,E+=a[T],I+=a[T];let S=A+3*E;if(n){if((g&1)!==0||g>12||g<4)throw new v;let T=(12-g)/2,N=Me.OUTSIDE_ODD_WIDEST[T],B=9-N,H=wt.getRSSvalue(o,N,!1),R=wt.getRSSvalue(
6a,B,!0),re=Me.OUTSIDE_EVEN_TOTAL_SUBSET[T],J=Me.OUTSIDE_GSUM[T];return new Xt(H*re+R+J,S)}else{if((I&1)!==0||I>10||I<4)throw new v;let T=(10-I)/2,N=Me.INSIDE_ODD_WIDEST[T],B=9-N,H=wt.getRSSvalue(o,N,!0),R=wt.getRSSvalue(a,B,!1),re=Me.INSIDE_ODD_TOTAL_SUBSET[T],J=Me.INSIDE_GSUM[T];return new Xt(R*re+H+J,S)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),i=!1,s=0;for(;s<r&&(i=!e.get(s),t!==i);)s++;let o=0,a=s;for(let c=s;c<r;c++)if(e.get(c)!==i)n[o]++;else{if(o===3){if(Bt.isFinderPattern(n))return[a,c];a+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,o--}else o++;n[o]=1,i=!i}throw new v}parseFoundFinderPattern(e,t,n,r){let i=e.get(r[0]),s=r[0]-1;for(;s>=0&&i!==e.get(s);)s--;s++;let o=r[0]-s,a=this.getDecodeFinderCounters(),c=new Int32Array(a.length);Y.arraycopy(a,0,c,1,a.length-1),c[0]=o;let f=this.parseFinderValue(c,Me.FINDER_PATTERNS),g=s,A=r[1];return n&&(g=e.getSize()-1-g,A=e.getSize()-1-A),new In(f,[s,r[1]],g,A,t)}adjustOddEvenCounts(e,t){let n=le.sum(new Int32Array(this.getOddCounts())),r=le.sum(new Int32Array(this.getEvenCounts())),i=!1,s=!1,o=!1,a=!1;e?(n>12?s=!0:n<4&&(i=!0),r>12?a=!0:r<4&&(o=!0)):(n>11?s=!0:n<5&&(i=!0),r>10?a=!0:r<4&&(o=!0));let c=n+r-t,f=(n&1)===(e?1:0),g=(r&1)===1;if(c===1)if(f){if(g)throw new v;s=!0}else{if(!g)throw new v;a=!0}else if(c===-1)if(f){if(g)throw new v;i=!0}else{if(!g)throw new v;o=!0}else if(c===0){if(f){if(!g)throw new v;n<r?(i=!0,a=!0):(s=!0,o=!0)}else if(g)throw new v}else throw new v;if(i){if(s)throw new v;Bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&Bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(a)throw new v;Bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&Bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Me.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Me.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Me.OUTSIDE_GSUM=[0,161,961,2015,2715],Me.INSIDE_GSUM=[0,336,1036,1516],Me.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Me.INSIDE_ODD_WIDEST=[2,4,6,8],Me.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 Zt extends Oe{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;let n=e?e.get(ae.POSSIBLE_FORMATS):null,r=e&&e.get(ae.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(Z.EAN_13)||n.includes(Z.UPC_A)||n.includes(Z.EAN_8)||n.includes(Z.UPC_E))&&this.readers.push(new Xn(e)),n.includes(Z.CODE_39)&&this.readers.push(new Gn(r)),n.includes(Z.CODE_128)&&this.readers.push(new U),n.includes(Z.ITF)&&this.readers.push(new Ce),n.includes(Z.RSS_14)&&this.readers.push(new Me),n.includes(Z.RSS_EXPANDED)&&this.readers.push(new L(this.verbose))):(this.readers.push(new Xn(e)),this.readers.push(new Gn),this.readers.push(new Xn(e)),this.readers.push(new U),this.readers.push(new Ce),this.readers.push(new Me),this.readers.push(new L(this.verbose)))}decodeRow(e,t,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(e,t,n)}catch{}throw new v}reset(){this.readers.forEach(e=>e.reset())}}class Vi extends Lt{constructor(e=500,t){super(new Zt(t),e,t)}}class me{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class xe{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class se{constructor(e,t,n,r,i,s){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=i,this.ecBlocks=s;let o=0,a=s.getECCodewords(),c=s.getECBlocks();for(let f of c)o+=f.getCount()*(f.getDataCodewords()+a);this.totalCodewords=o}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}
6static getVersionForDimensions(e,t){if((e&1)!==0||(t&1)!==0)throw new F;for(let n of se.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new F}toString(){return""+this.versionNumber}static buildVersions(){return[new se(1,10,10,8,8,new me(5,new xe(1,3))),new se(2,12,12,10,10,new me(7,new xe(1,5))),new se(3,14,14,12,12,new me(10,new xe(1,8))),new se(4,16,16,14,14,new me(12,new xe(1,12))),new se(5,18,18,16,16,new me(14,new xe(1,18))),new se(6,20,20,18,18,new me(18,new xe(1,22))),new se(7,22,22,20,20,new me(20,new xe(1,30))),new se(8,24,24,22,22,new me(24,new xe(1,36))),new se(9,26,26,24,24,new me(28,new xe(1,44))),new se(10,32,32,14,14,new me(36,new xe(1,62))),new se(11,36,36,16,16,new me(42,new xe(1,86))),new se(12,40,40,18,18,new me(48,new xe(1,114))),new se(13,44,44,20,20,new me(56,new xe(1,144))),new se(14,48,48,22,22,new me(68,new xe(1,174))),new se(15,52,52,24,24,new me(42,new xe(2,102))),new se(16,64,64,14,14,new me(56,new xe(2,140))),new se(17,72,72,16,16,new me(36,new xe(4,92))),new se(18,80,80,18,18,new me(48,new xe(4,114))),new se(19,88,88,20,20,new me(56,new xe(4,144))),new se(20,96,96,22,22,new me(68,new xe(4,174))),new se(21,104,104,24,24,new me(56,new xe(6,136))),new se(22,120,120,18,18,new me(68,new xe(6,175))),new se(23,132,132,20,20,new me(62,new xe(8,163))),new se(24,144,144,22,22,new me(62,new xe(8,156),new xe(2,155))),new se(25,8,18,6,16,new me(7,new xe(1,5))),new se(26,8,32,6,14,new me(11,new xe(1,10))),new se(27,12,26,10,24,new me(14,new xe(1,16))),new se(28,12,36,10,16,new me(18,new xe(1,22))),new se(29,16,36,14,16,new me(24,new xe(1,32))),new se(30,16,48,14,22,new me(28,new xe(1,49)))]}}se.VERSIONS=se.buildVersions();class Qn{constructor(e){let t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new F;this.version=Qn.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new Le(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),n=e.getWidth();return se.getVersionForDimensions(t,n)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,r=0,i=this.mappingBitMatrix.getHeight(),s=this.mappingBitMatrix.getWidth(),o=!1,a=!1,c=!1,f=!1;do if(n===i&&r===0&&!o)e[t++]=this.readCorner1(i,s)&255,n-=2,r+=2,o=!0;else if(n===i-2&&r===0&&(s&3)!==0&&!a)e[t++]=this.readCorner2(i,s)&255,n-=2,r+=2,a=!0;else if(n===i+4&&r===2&&(s&7)===0&&!c)e[t++]=this.readCorner3(i,s)&255,n-=2,r+=2,c=!0;else if(n===i-2&&r===0&&(s&7)===4&&!f)e[t++]=this.readCorner4(i,s)&255,n-=2,r+=2,f=!0;else{do n<i&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,i,s)&255),n-=2,r+=2;while(n>=0&&r<s);n+=1,r+=3;do n>=0&&r<s&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,i,s)&255),n+=2,r-=2;while(n<i&&r>=0);n+=3,r+=1}while(n<i||r<s);if(t!==this.version.getTotalCodewords())throw new F;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let i=0;return this.readModule(e-2,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-2,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t,n,r)&&(i|=1),i<<=1,this.readModule(e,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e,t,n,r)&&(i|=1),i}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 w("Dimension of bitMatrix must match the version size");let r=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),s=t/r|0,o=n/i|0,a=s*r,c=o*i,f=new Le(c,a);for(let g=0;g<s;++g){let A=g*r;for(let E=0;E<o;++E){let I=E*i;for(let S=0;S<r;++S){let T=g*(r+2)+1+S,N=A+S;for(let B=0;B<i;++B){let H=E*(i+2)+1+B;if(e.get(H,T)){let R=I+B;f.set(R,N)}}}}}return f}}
6class Kn{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let n=t.getECBlocks(),r=0,i=n.getECBlocks();for(let S of i)r+=S.getCount();let s=new Array(r),o=0;for(let S of i)for(let T=0;T<S.getCount();T++){let N=S.getDataCodewords(),B=n.getECCodewords()+N;s[o++]=new Kn(N,new Uint8Array(B))}let c=s[0].codewords.length-n.getECCodewords(),f=c-1,g=0;for(let S=0;S<f;S++)for(let T=0;T<o;T++)s[T].codewords[S]=e[g++];let A=t.getVersionNumber()===24,E=A?8:o;for(let S=0;S<E;S++)s[S].codewords[c-1]=e[g++];let I=s[0].codewords.length;for(let S=c;S<I;S++)for(let T=0;T<o;T++){let N=A?(T+8)%o:T,B=A&&N>7?S-1:S;s[N].codewords[B]=e[g++]}if(g!==e.length)throw new w;return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class qn{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 w(""+e);let t=0,n=this.bitOffset,r=this.byteOffset,i=this.bytes;if(n>0){let s=8-n,o=e<s?e:s,a=s-o,c=255>>8-o<<a;t=(i[r]&c)>>a,e-=o,n+=o,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|i[r]&255,r++,e-=8;if(e>0){let s=8-e,o=255>>s<<s;t=t<<e|(i[r]&o)>>s,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Fe=(function(l){return l[l.PAD_ENCODE=0]="PAD_ENCODE",l[l.ASCII_ENCODE=1]="ASCII_ENCODE",l[l.C40_ENCODE=2]="C40_ENCODE",l[l.TEXT_ENCODE=3]="TEXT_ENCODE",l[l.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",l[l.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",l[l.BASE256_ENCODE=6]="BASE256_ENCODE",l})(Fe||{});class Mt{static decode(e){let t=new qn(e),n=new Ae,r=new Ae,i=new Array,s=Fe.ASCII_ENCODE;do if(s===Fe.ASCII_ENCODE)s=this.decodeAsciiSegment(t,n,r);else{switch(s){case Fe.C40_ENCODE:this.decodeC40Segment(t,n);break;case Fe.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Fe.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Fe.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Fe.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new F}s=Fe.ASCII_ENCODE}while(s!==Fe.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new sn(e,n.toString(),i.length===0?null:i,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let i=e.readBits(8);if(i===0)throw new F;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),Fe.ASCII_ENCODE;if(i===129)return Fe.PAD_ENCODE;if(i<=229){let s=i-130;s<10&&t.append("0"),t.append(""+s)}else switch(i){case 230:return Fe.C40_ENCODE;case 231:return Fe.BASE256_ENCODE;case 232:t.append("�");break;case 233:case 234:break;case 235:r=!0;break;case 236:t.append("[)>�05�"),n.insert(0,"��");break;case 237:t.append("[)>�06�"),n.insert(0,"��");break;case 238:return Fe.ANSIX12_ENCODE;case 239:return Fe.TEXT_ENCODE;case 240:return Fe.EDIFACT_ENCODE;case 241:break;default:if(i!==254||e.available()!==0)throw new F;break}}while(e.available()>0);return Fe.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1,r=[],i=0;do{if(e.available()===8)return;let s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),r);for(let o=0;o<3;o++){let a=r[o];switch(i){case 0:if(a<3)i=a+1;else if(a<this.C40_BASIC_SET_CHARS.length){let c=this.C40_BASIC_SET_CHARS[a];n?(t.append(String.fromCharCode(c.charCodeAt(0)+128)),n=!1):t.append(c)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(a+128)),n=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.C40_SHIFT2_SET_CHARS.length){let c=this.C40_SHIFT2_SET_CHARS[a];n?(t.append(String.fromCharCode(c.charCodeAt(0)+128)),n=!1):t.append(c)}else switch(a){case 27:t.append("�");break;case 30:n=!0;break;default:throw new F}i=0;break;case 3:n?(t.append(String.fromCharCode(a+224)),n=!1):t.append(String.fromCharCode(a+96)),i=0;break;default:throw new F}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],i=0;do{if(e.available()===8)return;let s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),r);for(let o=0;o<3;o++){let a=r[o];switch(i){case 0:if(a<3)i=a+1;else if(a<this.TEXT_BASIC_SET_CHARS.length){let c=this.TEXT_BASIC_SET_CHARS[a];n?(t.append(String.fromCharCode(c.charCodeAt(0)+128)),n=!1):t.append(c)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(a+128)),n=!1):t.append(String.fromCharCode(a)),i=0;break;case 2:if(a<this.TEXT_SHIFT2_SET_CHARS.length){let c=this.TEXT_SHIFT2_SET_CHARS[a];n?(t.append(String.fromCharCode(c.charCodeAt(0)+128)),n=!1):t.append(c)}
6else switch(a){case 27:t.append("�");break;case 30:n=!0;break;default:throw new F}i=0;break;case 3:if(a<this.TEXT_SHIFT3_SET_CHARS.length){let c=this.TEXT_SHIFT3_SET_CHARS[a];n?(t.append(String.fromCharCode(c.charCodeAt(0)+128)),n=!1):t.append(c),i=0}else throw new F;break;default:throw new F}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let n=[];do{if(e.available()===8)return;let r=e.readBits(8);if(r===254)return;this.parseTwoBytes(r,e.readBits(8),n);for(let i=0;i<3;i++){let s=n[i];switch(s){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(s<14)t.append(String.fromCharCode(s+44));else if(s<40)t.append(String.fromCharCode(s+51));else throw new F;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=i*1600,i=Math.floor(r/40),n[1]=i,n[2]=r-i*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let r=e.readBits(6);if(r===31){let i=8-e.getBitOffset();i!==8&&e.readBits(i);return}(r&32)===0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset(),i=this.unrandomize255State(e.readBits(8),r++),s;if(i===0?s=e.available()/8|0:i<250?s=i:s=250*(i-249)+this.unrandomize255State(e.readBits(8),r++),s<0)throw new F;let o=new Uint8Array(s);for(let a=0;a<s;a++){if(e.available()<8)throw new F;o[a]=this.unrandomize255State(e.readBits(8),r++)}n.push(o);try{t.append(Qe.decode(o,q.ISO88591))}catch(a){throw new It("Platform does not support required encoding: "+a.message)}}static unrandomize255State(e,t){let n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Mt.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"],Mt.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Mt.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"],Mt.TEXT_SHIFT2_SET_CHARS=Mt.C40_SHIFT2_SET_CHARS,Mt.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 zi{constructor(){this.rsDecoder=new cn(de.DATA_MATRIX_FIELD_256)}decode(e){let t=new Qn(e),n=t.getVersion(),r=t.readCodewords(),i=Kn.getDataBlocks(r,n),s=0;for(let c of i)s+=c.getNumDataCodewords();let o=new Uint8Array(s),a=i.length;for(let c=0;c<a;c++){let f=i[c],g=f.getCodewords(),A=f.getNumDataCodewords();this.correctErrors(g,A);for(let E=0;E<A;E++)o[E*a+c]=g[E]}return Mt.decode(o)}correctErrors(e,t){let n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new P}for(let r=0;r<t;r++)e[r]=n[r]}}class De{constructor(e){this.image=e,this.rectangleDetector=new Cn(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 v;t=this.shiftToModuleCenter(t);let n=t[0],r=t[1],i=t[2],s=t[3],o=this.transitionsBetween(n,s)+1,a=this.transitionsBetween(i,s)+1;(o&1)===1&&(o+=1),(a&1)===1&&(a+=1),4*o<7*a&&4*a<7*o&&(o=a=Math.max(o,a));
6let c=De.sampleGrid(this.image,n,r,i,s,o,a);return new An(c,[n,r,i,s])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new G(e.getX()+r,e.getY()+i)}static moveAway(e,t,n){let r=e.getX(),i=e.getY();return r<t?r-=1:r+=1,i<n?i-=1:i+=1,new G(r,i)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],i=e[2],s=this.transitionsBetween(t,n),o=this.transitionsBetween(n,r),a=this.transitionsBetween(r,i),c=this.transitionsBetween(i,t),f=s,g=[i,t,n,r];return f>o&&(f=o,g[0]=t,g[1]=n,g[2]=r,g[3]=i),f>a&&(f=a,g[0]=n,g[1]=r,g[2]=i,g[3]=t),f>c&&(g[0]=r,g[1]=i,g[2]=t,g[3]=n),g}detectSolid2(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i),o=De.shiftPoint(n,r,(s+1)*4),a=De.shiftPoint(r,n,(s+1)*4),c=this.transitionsBetween(o,t),f=this.transitionsBetween(a,i);return c<f?(e[0]=t,e[1]=n,e[2]=r,e[3]=i):(e[0]=n,e[1]=r,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i),o=this.transitionsBetween(n,i),a=De.shiftPoint(t,n,(o+1)*4),c=De.shiftPoint(r,n,(s+1)*4);s=this.transitionsBetween(a,i),o=this.transitionsBetween(c,i);let f=new G(i.getX()+(r.getX()-n.getX())/(s+1),i.getY()+(r.getY()-n.getY())/(s+1)),g=new G(i.getX()+(t.getX()-n.getX())/(o+1),i.getY()+(t.getY()-n.getY())/(o+1));if(!this.isValid(f))return this.isValid(g)?g:null;if(!this.isValid(g))return f;let A=this.transitionsBetween(a,f)+this.transitionsBetween(c,f),E=this.transitionsBetween(a,g)+this.transitionsBetween(c,g);return A>E?f:g}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],i=e[3],s=this.transitionsBetween(t,i)+1,o=this.transitionsBetween(r,i)+1,a=De.shiftPoint(t,n,o*4),c=De.shiftPoint(r,n,s*4);s=this.transitionsBetween(a,i)+1,o=this.transitionsBetween(c,i)+1,(s&1)===1&&(s+=1),(o&1)===1&&(o+=1);let f=(t.getX()+n.getX()+r.getX()+i.getX())/4,g=(t.getY()+n.getY()+r.getY()+i.getY())/4;t=De.moveAway(t,f,g),n=De.moveAway(n,f,g),r=De.moveAway(r,f,g),i=De.moveAway(i,f,g);let A,E;return a=De.shiftPoint(t,n,o*4),a=De.shiftPoint(a,i,s*4),A=De.shiftPoint(n,t,o*4),A=De.shiftPoint(A,r,s*4),c=De.shiftPoint(r,i,o*4),c=De.shiftPoint(c,n,s*4),E=De.shiftPoint(i,r,o*4),E=De.shiftPoint(E,t,s*4),[a,A,c,E]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,i,s,o){return bt.getInstance().sampleGrid(e,s,o,.5,.5,s-.5,.5,s-.5,o-.5,.5,o-.5,t.getX(),t.getY(),i.getX(),i.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),i=Math.trunc(t.getX()),s=Math.trunc(t.getY()),o=Math.abs(s-r)>Math.abs(i-n);if(o){let S=n;n=r,r=S,S=i,i=s,s=S}let a=Math.abs(i-n),c=Math.abs(s-r),f=-a/2,g=r<s?1:-1,A=n<i?1:-1,E=0,I=this.image.get(o?r:n,o?n:r);for(let S=n,T=r;S!==i;S+=A){let N=this.image.get(o?T:S,o?S:T);if(N!==I&&(E++,I=N),f+=c,f>0){if(T===s)break;T+=g,f-=a}}return E}}let yn=(()=>{class l{constructor(){this.decoder=new zi}decode(t,n=null){let r,i;if(n!=null&&n.has(ae.PURE_BARCODE)){let f=l.extractPureBits(t.getBlackMatrix());r=this.decoder.decode(f),i=l.NO_POINTS}else{let f=new De(t.getBlackMatrix()).detect();r=this.decoder.decode(f.getBits()),i=f.getPoints()}let s=r.getRawBytes(),o=new We(r.getText(),s,8*s.length,i,Z.DATA_MATRIX,Y.currentTimeMillis()),a=r.getByteSegments();a!=null&&o.putMetadata(Pe.BYTE_SEGMENTS,a);let c=r.getECLevel();return c!=null&&o.putMetadata(Pe.ERROR_CORRECTION_LEVEL,c),o}reset(){}static extractPureBits(t){let n=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(n==null||r==null)throw new v;let i=this.moduleSize(n,t),s=n[1],o=r[1],a=n[0],f=(r[0]-a+1)/i,g=(o-s+1)/i;if(f<=0||g<=0)throw new v;let A=i/2;s+=A,a+=A;let E=new Le(f,g);for(let I=0;I<g;I++){let S=s+I*i;for(let T=0;T<f;T++)t.get(a+T*i,S)&&E.set(T,I)}return E}static moduleSize(t,n){let r=n.getWidth(),i=t[0],s=t[1];for(;i<r&&n.get(i,s);)i++;if(i===r)throw new v;let o=i-t[0];if(o===0)throw new v;return o}}return l.NO_POINTS=[],l})();class Gi extends Lt{constructor(e=500){super(new yn,e)}}var un=(function(l){return l[l.L=0]="L",l[l.M=1]="M",l[l.Q=2]="Q",l[l.H=3]="H",l})(un||{});class Ie{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,Ie.FOR_BITS.set(n,this),Ie.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return Ie.L;case"M":return Ie.M;case"Q":return Ie.Q;case"H":return Ie.H;default:throw new O(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof Ie))return!1;let t=e;return this.value===t.value}static forBits(e){if(e<0||e>=Ie.FOR_BITS.size)throw new w;return Ie.FOR_BITS.get(e)}}Ie.FOR_BITS=new Map,Ie.FOR_VALUE=new Map,Ie.L=new Ie(un.L,"L",1),Ie.M=new Ie(un.M,"M",0),Ie.Q=new Ie(un.Q,"Q",3),Ie.H=new Ie(un.H,"H",2);class je{constructor(e){this.errorCorrectionLevel=Ie.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return X.bitCount(e^t)}static decodeFormatInformation(e,t){let n=je.doDecodeFormatInformation(e,t);return n!==null?n:je.doDecodeFormatInformation(e^je.FORMAT_INFO_MASK_QR,t^je.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(let i of je.FORMAT_INFO_DECODE_LOOKUP){let s=i[0];if(s===e||s===t)return new je(i[1]);let o=je.numBitsDiffering(e,s);o<n&&(r=i[1],n=o),e!==t&&(o=je.numBitsDiffering(t,s),o<n&&(r=i[1],n=o))}return n<=3?new je(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof je))return!1;let t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}je.FORMAT_INFO_MASK_QR=21522,je.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 p{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class j{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0,i=n[0].getECCodewordsPerBlock(),s=n[0].getECBlocks();for(let o of s)r+=o.getCount()*(o.getDataCodewords()+i);this.totalCodewords=r}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 F;try{return this.getVersionForNumber((e-17)/4)}catch{throw new F}}static getVersionForNumber(e){if(e<1||e>40)throw new w;return j.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<j.VERSION_DECODE_INFO.length;r++){let i=j.VERSION_DECODE_INFO[r];if(i===e)return j.getVersionForNumber(r+7);let s=je.numBitsDiffering(e,i);s<t&&(n=r+7,t=s)}return t<=3?j.getVersionForNumber(n):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new Le(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 r=0;r<n;r++){let i=this.alignmentPatternCenters[r]-2;for(let s=0;s<n;s++)r===0&&(s===0||s===n-1)||r===n-1&&s===0||t.setRegion(this.alignmentPatternCenters[s]-2,i,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}}j.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]),j.VERSIONS=[new j(1,new Int32Array(0),new b(7,new p(1,19)),new b(10,new p(1,16)),new b(13,new p(1,13)),new b(17,new p(1,9))),new j(2,Int32Array.from([6,18]),new b(10,new p(1,34)),new b(16,new p(1,28)),new b(22,new p(1,22)),new b(28,new p(1,16))),new j(3,Int32Array.from([6,22]),new b(15,new p(1,55)),new b(26,new p(1,44)),new b(18,new p(2,17)),new b(22,new p(2,13))),new j(4,Int32Array.from([6,26]),new b(20,new p(1,80)),new b(18,new p(2,32)),new b(26,new p(2,24)),new b(16,new p(4,9))),new j(5,Int32Array.from([6,30]),new b(26,new p(1,108)),new b(24,new p(2,43)),new b(18,new p(2,15),new p(2,16)),new b(22,new p(2,11),new p(2,12))),new j(6,Int32Array.from([6,34]),new b(18,new p(2,68)),new b(16,new p(4,27)),new b(24,new p(4,19)),new b(28,new p(4,15))),new j(7,Int32Array.from([6,22,38]),new b(20,new p(2,78)),new b(18,new p(4,31)),new b(18,new p(2,14),new p(4,15)),new b(26,new p(4,13),new p(1,14))),new j(8,Int32Array.from([6,24,42]),new b(24,new p(2,97)),new b(22,new p(2,38),new p(2,39)),new b(22,new p(4,18),new p(2,19)),new b(26,new p(4,14),new p(2,15))),new j(9,Int32Array.from([6,26,46]),new b(30,new p(2,116)),new b(22,new p(3,36),new p(2,37)),new b(20,new p(4,16),new p(4,17)),new b(24,new p(4,12),new p(4,13))),new j(10,Int32Array.from([6,28,50]),new b(18,new p(2,68),new p(2,69)),new b(26,new p(4,43),new p(1,44)),new b(24,new p(6,19),new p(2,20)),new b(28,new p(6,15),new p(2,16))),new j(11,Int32Array.from([6,30,54]),new b(20,new p(4,81)),new b(30,new p(1,50),new p(4,51)),new b(28,new p(4,22),new p(4,23)),new b(24,new p(3,12),new p(8,13))),new j(12,Int32Array.from([6,32,58]),new b(24,new p(2,92),new p(2,93)),new b(22,new p(6,36),new p(2,37)),new b(26,new p(4,20),new p(6,21)),new b(28,new p(7,14),new p(4,15))),new j(13,Int32Array.from([6,34,62]),new b(26,new p(4,107)),new b(22,new p(8,37),new p(1,38)),new b(24,new p(8,20),new p(4,21)),new b(22,new p(12,11),new p(4,12))),new j(14,Int32Array.from([6,26,46,66]),new b(30,new p(3,115),new p(1,116)),new b(24,new p(4,40),new p(5,41)),new b(20,new p(11,16),new p(5,17)),new b(24,new p(11,12),new p(5,13))),new j(15,Int32Array.from([6,26,48,70]),new b(22,new p(5,87),new p(1,88)),new b(24,new p(5,41),new p(5,42)),new b(30,new p(5,24),new p(7,25)),new b(24,new p(11,12),new p(7,13))),new j(16,Int32Array.from([6,26,50,74]),new b(24,new p(5,98),new p(1,99)),new b(28,new p(7,45),new p(3,46)),new b(24,new p(15,19),new p(2,20)),new b(30,new p(3,15),new p(13,16))),new j(17,Int32Array.from([6,30,54,78]),new b(28,new p(1,107),new p(5,108)),new b(28,new p(10,46),new p(1,47)),new b(28,new p(1,22),new p(15,23)),new b(28,new p(2,14),new p(17,15))),new j(18,Int32Array.from([6,30,56,82]),new b(30,new p(5,120),new p(1,121)),new b(26,new p(9,43),new p(4,44)),new b(28,new p(17,22),new p(1,23)),new b(28,new p(2,14),new p(19,15))),new j(19,Int32Array.from([6,30,58,86]),new b(28,new p(3,113),new p(4,114)),new b(26,new p(3,44),new p(11,45)),new b(26,new p(17,21),new p(4,22)),new b(26,new p(9,13),new p(16,14))),new j(20,Int32Array.from([6,34,62,90]),new b(28,new p(3,107),new p(5,108)),new b(26,new p(3,41),new p(13,42)),new b(30,new p(15,24),new p(5,25)),new b(28,new p(15,15),new p(10,16))),new j(21,Int32Array.from([6,28,50,72,94]),new b(28,new p(4,116),new p(4,117)),new b(26,new p(17,42)),new b(28,new p(17,22),new p(6,23)),new b(30,new p(19,16),new p(6,17))),new j(22,Int32Array.from([6,26,50,74,98]),new b(28,new p(2,111),new p(7,112)),new b(28,new p(17,46)),new b(30,new p(7,24),new p(16,25)),new b(24,new p(34,13))),new j(23,Int32Array.from([6,30,54,78,102]),new b(30,new p(4,121),new p(5,122)),new b(28,new p(4,47),new p(14,48)),new b(30,new p(11,24),new p(14,25)),new b(30,new p(16,15),new p(14,16))),new j(24,Int32Array.from([6,28,54,80,106]),new b(30,new p(6,117),new p(4,118)),new b(28,new p(6,45),new p(14,46)),new b(30,new p(11,24),new p(16,25)),new b(30,new p(30,16),new p(2,17))),new j(25,Int32Array.from([6,32,58,84,110]),new b(26,new p(8,106),new p(4,107)),new b(28,new p(8,47),new p(13,48)),new b(30,new p(7,24),new p(22,25)),new b(30,new p(22,15),new p(13,16))),new j(26,Int32Array.from([6,30,58,86,114]),new b(28,new p(10,114),new p(2,115)),new b(28,new p(19,46),new p(4,47)),new b(28,new p(28,22),new p(6,23)),new b(30,new p(33,16),new p(4,17))),new j(27,Int32Array.from([6,34,62,90,118]),new b(30,new p(8,122),new p(4,123)),new b(28,new p(22,45),new p(3,46)),new b(30,new p(8,23),new p(26,24)),new b(30,new p(12,15),new p(28,16))),new j(28,Int32Array.from([6,26,50,74,98,122]),new b(30,new p(3,117),new p(10,118)),new b(28,new p(3,45),new p(23,46)),new b(30,new p(4,24),new p(31,25)),new b(30,new p(11,15),new p(31,16))),new j(29,Int32Array.from([6,30,54,78,102,126]),new b(30,new p(7,116),new p(7,117)),new b(28,new p(21,45),new p(7,46)),new b(30,new p(1,23),new p(37,24)),new b(30,new p(19,15),new p(26,16))),new j(30,Int32Array.from([6,26,52,78,104,130]),new b(30,new p(5,115),new p(10,116)),new b(28,new p(19,47),new p(10,48)),new b(30,new p(15,24),new p(25,25)),new b(30,new p(23,15),new p(25,16))),new j(31,Int32Array.from([6,30,56,82,108,134]),new b(30,new p(13,115),new p(3,116)),new b(28,new p(2,46),new p(29,47)),new b(30,new p(42,24),new p(1,25)),new b(30,new p(23,15),new p(28,16))),new j(32,Int32Array.from([6,34,60,86,112,138]),new b(30,new p(17,115)),new b(28,new p(10,46),new p(23,47)),new b(30,new p(10,24),new p(35,25)),new b(30,new p(19,15),new p(35,16))),new j(33,Int32Array.from([6,30,58,86,114,142]),new b(30,new p(17,115),new p(1,116)),new b(28,new p(14,46),new p(21,47)),new b(30,new p(29,24),new p(19,25)),new b(30,new p(11,15),new p(46,16))),new j(34,Int32Array.from([6,34,62,90,118,146]),new b(30,new p(13,115),new p(6,116)),new b(28,new p(14,46),new p(23,47)),new b(30,new p(44,24),new p(7,25)),new b(30,new p(59,16),new p(1,17))),new j(35,Int32Array.from([6,30,54,78,102,126,150]),new b(30,new p(12,121),new p(7,122)),new b(28,new p(12,47),new p(26,48)),new b(30,new p(39,24),new p(14,25)),new b(30,new p(22,15),new p(41,16))),new j(36,Int32Array.from([6,24,50,76,102,128,154]),new b(30,new p(6,121),new p(14,122)),new b(28,new p(6,47),new p(34,48)),new b(30,new p(46,24),new p(10,25)),new b(30,new p(2,15),new p(64,16))),new j(37,Int32Array.from([6,28,54,80,106,132,158]),new b(30,new p(17,122),new p(4,123)),new b(28,new p(29,46),new p(14,47)),new b(30,new p(49,24),new p(10,25)),new b(30,new p(24,15),new p(46,16))),new j(38,Int32Array.from([6,32,58,84,110,136,162]),new b(30,new p(4,122),new p(18,123)),new b(28,new p(13,46),new p(32,47)),new b(30,new p(48,24),new p(14,25)),new b(30,new p(42,15),new p(32,16))),new j(39,Int32Array.from([6,26,54,82,110,138,166]),new b(30,new p(20,117),new p(4,118)),new b(28,new p(40,47),new p(7,48)),new b(30,new p(43,24),new p(22,25)),new b(30,new p(10,15),new p(67,16))),new j(40,Int32Array.from([6,30,58,86,114,142,170]),new b(30,new p(19,118),new p(6,119)),new b(28,new p(18,47),new p(31,48)),new b(30,new p(34,24),new p(34,25)),new b(30,new p(20,15),new p(61,16)))];var Ue=(function(l){return l[l.DATA_MASK_000=0]="DATA_MASK_000",l[l.DATA_MASK_001=1]="DATA_MASK_001",l[l.DATA_MASK_010=2]="DATA_MASK_010",l[l.DATA_MASK_011=3]="DATA_MASK_011",l[l.DATA_MASK_100=4]="DATA_MASK_100",l[l.DATA_MASK_101=5]="DATA_MASK_101",l[l.DATA_MASK_110=6]="DATA_MASK_110",l[l.DATA_MASK_111=7]="DATA_MASK_111",l})(Ue||{});class st{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)this.isMasked(n,r)&&e.flip(r,n)}}st.values=new Map([[Ue.DATA_MASK_000,new st(Ue.DATA_MASK_000,(l,e)=>(l+e&1)===0)],[Ue.DATA_MASK_001,new st(Ue.DATA_MASK_001,(l,e)=>(l&1)===0)],[Ue.DATA_MASK_010,new st(Ue.DATA_MASK_
6010,(l,e)=>e%3===0)],[Ue.DATA_MASK_011,new st(Ue.DATA_MASK_011,(l,e)=>(l+e)%3===0)],[Ue.DATA_MASK_100,new st(Ue.DATA_MASK_100,(l,e)=>(Math.floor(l/2)+Math.floor(e/3)&1)===0)],[Ue.DATA_MASK_101,new st(Ue.DATA_MASK_101,(l,e)=>l*e%6===0)],[Ue.DATA_MASK_110,new st(Ue.DATA_MASK_110,(l,e)=>l*e%6<3)],[Ue.DATA_MASK_111,new st(Ue.DATA_MASK_111,(l,e)=>(l+e+l*e%3&1)===0)]]);class ji{constructor(e){let t=e.getHeight();if(t<21||(t&3)!==1)throw new F;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let i=0;i<6;i++)e=this.copyBit(i,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let i=5;i>=0;i--)e=this.copyBit(8,i,e);let t=this.bitMatrix.getHeight(),n=0,r=t-7;for(let i=t-1;i>=r;i--)n=this.copyBit(8,i,n);for(let i=t-8;i<t;i++)n=this.copyBit(i,8,n);if(this.parsedFormatInfo=je.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F}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 j.getVersionForNumber(t);let n=0,r=e-11;for(let s=5;s>=0;s--)for(let o=e-9;o>=r;o--)n=this.copyBit(o,s,n);let i=j.decodeVersionInformation(n);if(i!==null&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;n=0;for(let s=5;s>=0;s--)for(let o=e-9;o>=r;o--)n=this.copyBit(s,o,n);if(i=j.decodeVersionInformation(n),i!==null&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new F}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=st.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);let i=t.buildFunctionPattern(),s=!0,o=new Uint8Array(t.getTotalCodewords()),a=0,c=0,f=0;for(let g=r-1;g>0;g-=2){g===6&&g--;for(let A=0;A<r;A++){let E=s?r-1-A:A;for(let I=0;I<2;I++)i.get(g-I,E)||(f++,c<<=1,this.bitMatrix.get(g-I,E)&&(c|=1),f===8&&(o[a++]=c,f=0,c=0))}s=!s}if(a!==t.getTotalCodewords())throw new F;return o}remask(){if(this.parsedFormatInfo===null)return;let e=st.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 r=t+1,i=e.getHeight();r<i;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class Jn{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new w;let r=t.getECBlocksForLevel(n),i=0,s=r.getECBlocks();for(let I of s)i+=I.getCount();let o=new Array(i),a=0;for(let I of s)for(let S=0;S<I.getCount();S++){let T=I.getDataCodewords(),N=r.getECCodewordsPerBlock()+T;o[a++]=new Jn(T,new Uint8Array(N))}let c=o[0].codewords.length,f=o.length-1;for(;f>=0&&o[f].codewords.length!==c;)f--;f++;let g=c-r.getECCodewordsPerBlock(),A=0;for(let I=0;I<g;I++)for(let S=0;S<a;S++)o[S].codewords[I]=e[A++];for(let I=f;I<a;I++)o[I].codewords[g]=e[A++];let E=o[0].codewords.length;for(let I=g;I<E;I++)for(let S=0;S<a;S++){let T=S<f?I:I+1;o[S].codewords[T]=e[A++]}return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var dt=(function(l){return l[l.TERMINATOR=0]="TERMINATOR",l[l.NUMERIC=1]="NUMERIC",l[l.ALPHANUMERIC=2]="ALPHANUMERIC",l[l.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",l[l.BYTE=4]="BYTE",l[l.ECI=5]="ECI",l[l.KANJI=6]="KANJI",l[l.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",l[l.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",l[l.HANZI=9]="HANZI",l})(dt||{});class W{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,W.FOR_BITS.set(r,this),W.FOR_VALUE.set(e,this)}static forBits(e){let t=W.FOR_BITS.get(e);if(t===void 0)throw new w;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 W))return!1;let t=e;return this.value===t.value}toString(){return this.stringValue}}W.FOR_BITS=new Map,W.FOR_VALUE=new Map,W.TERMINATOR=new W(dt.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),W.NUMERIC=new W(dt.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),W.ALPHANUMERIC=new W(dt.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),W.STRUCTURED_APPEND=new W(dt.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),W.BYTE=new W(dt.BYTE,"BYTE",Int32Array.from([8,16,16]),4),W.ECI=new W(dt.ECI,"ECI",Int32Array.from([0,0,0]),7),W.KANJI=new W(dt.KANJI,"KANJI",Int32Array.from([8,10,12]),8),W.FNC1_FIRST_POSITION=new W(dt.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),W.FNC1_SECOND_POSITION=new W(dt.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),W.HANZI=new W(dt.HANZI,"HANZI",Int32Array.from([8,10,12]),13);let Mr=(()=>{class l{static decode(t,n,r,i){let s=new qn(t),o=new Ae,a=new Array,c=-1,f=-1;try{let g=null,A=!1,E;do{if(s.available()<4)E=W.TERMINATOR;else{let I=s.readBits(4);E=W.forBits(I)}switch(E){case W.TERMINATOR:break;case W.FNC1_FIRST_POSITION:case W.FNC1_SECOND_POSITION:A=!0;break;case W.STRUCTURED_APPEND:if(s.available()<16)throw new F;c=s.readBits(8),f=s.readBits(8);break;case W.ECI:let I=l.parseECIValue(s);if(g=k.getCharacterSetECIByValue(I),g===null)throw new F;break;case W.HANZI:let S=s.readBits(4),T=s.readBits(E.getCharacterCountBits(n));S===l.GB2312_SUBSET&&l.decodeHanziSegment(s,o,T);break;default:let N=s.readBits(E.getCharacterCountBits(n));switch(E){case W.NUMERIC:l.decodeNumericSegment(s,o,N);break;case W.ALPHANUMERIC:l.decodeAlphanumericSegment(s,o,N,A);break;case W.BYTE:l.decodeByteSegment(s,o,N,g,a,i);break;case W.KANJI:l.decodeKanjiSegment(s,o,N);break;default:throw new F}break}}while(E!==W.TERMINATOR)}catch{throw new F}return new sn(t,o.toString(),a.length===0?null:a,r===null?null:r.toString(),c,f)}static decodeHanziSegment(t,n,r){if(r*13>t.available())throw new F;let i=new Uint8Array(2*r),s=0;for(;r>0;){let o=t.readBits(13),a=o/96<<8&4294967295|o%96;a<959?a+=41377:a+=42657,i[s]=a>>8&255,i[s+1]=a&255,s+=2,r--}try{n.append(Qe.decode(i,q.GB2312))}catch(o){throw new F(o)}}static decodeKanjiSegment(t,n,r){if(r*13>t.available())throw new F;let i=new Uint8Array(2*r),s=0;for(;r>0;){let o=t.readBits(13),a=o/192<<8&4294967295|o%192;a<7936?a+=33088:a+=49472,i[s]=a>>8,i[s+1]=a,s+=2,r--}try{n.append(Qe.decode(i,q.SHIFT_JIS))}catch(o){throw new F(o)}}static decodeByteSegment(t,n,r,i,s,o){if(8*r>t.available())throw new F;let a=new Uint8Array(r);for(let f=0;f<r;f++)a[f]=t.readBits(8);let c;i===null?c=q.guessEncoding(a,o):c=i.getName();try{n.append(Qe.decode(a,c))}catch(f){throw new F(f)}s.push(a)}static toAlphaNumericChar(t){if(t>=l.ALPHANUMERIC_CHARS.length)throw new F;return l.ALPHANUMERIC_CHARS[t]}static decodeAlphanumericSegment(t,n,r,i){let s=n.length();for(;r>1;){if(t.available()<11)throw new F;let o=t.readBits(11);n.append(l.toAlphaNumericChar(Math.floor(o/45))),n.append(l.toAlphaNumericChar(o%45)),r-=2}if(r===1){if(t.available()<6)throw new F;n.append(l.toAlphaNumericChar(t.readBits(6)))}if(i)for(let o=s;o<n.length();o++)n.charAt(o)==="%"&&(o<n.length()-1&&n.charAt(o+1)==="%"?n.deleteCharAt(o+1):n.setCharAt(o,"�"))}static decodeNumericSegment(t,n,r){for(;r>=3;){if(t.available()<10)throw new F;let i=t.readBits(10);if(i>=1e3)throw new F;n.append(l.toAlphaNumericChar(Math.floor(i/100))),n.append(l.toAlphaNumericChar(Math.floor(i/10)%10)),n.append(l.toAlphaNumericChar(i%10)),r-=3}if(r===2){if(t.available()<7)throw new F;let i=t.readBits(7);if(i>=100)throw new F;n.append(l.toAlphaNumericChar(Math.floor(i/10))),n.append(l.toAlphaNumericChar(i%10))}else if(r===1){if(t.available()<4)throw new F;let i=t.readBits(4);if(i>=10)throw new F;n.append(l.toAlphaNumericChar(i))}}static parseECIValue(t){let n=t.readBits(8);if((n&128)===0)return n&127;if((n&192)===128){let r=t.readBits(8);return(n&63)<<8&4294967295|r}if((n&224)===192){let r=t.readBits(16);return(n&31)<<16&4294967295|r}throw new F}}return l.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",l.GB2312_SUBSET=1,l})();class Dr{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 Xi{constructor(){this.rsDecoder=new cn(de.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(Le.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let n=new ji(e),r=null;try{return this.decodeBitMatrixParser(n,t)}catch(i){r=i}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();let i=this.decodeBitMatrixParser(n,t);return i.setOther(new Dr(!0)),i}catch(i){throw r!==null?r:i}}decodeBitMatrixParser(e,t){let n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),s=Jn.getDataBlocks(i,n,r),o=0;for(let f of s)o+=f.getNumDataCodewords();let a=new Uint8Array(o),c=0;for(let f of s){let g=f.getCodewords(),A=f.getNumDataCodewords();this.correctErrors(g,A);for(let E=0;E<A;E++)a[c++]=g[E]}return Mr.decode(a,n,r,t)}correctErrors(e,t){let n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new P}for(let r=0;r<t;r++)e[r]=n[r]}}class $n extends G{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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){let r=(this.getX()+t)/2,i=(this.getY()+e)/2,s=(this.estimatedModuleSize+n)/2;return new $n(r,i,s)}}class Tn{constructor(e,t,n,r,i,s,o){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=i,this.moduleSize=s,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,n=this.width,r=e+n,i=this.startY+t/2,s=new Int32Array(3),o=this.image;for(let a=0;a<t;a++){let c=i+((a&1)===0?Math.floor((a+1)/2):-Math.floor((a+1)/2));s[0]=0,s[1]=0,s[2]=0;let f=e;for(;f<r&&!o.get(f,c);)f++;let g=0;for(;f<r;){if(o.get(f,c))if(g===1)s[1]++;else if(g===2){if(this.foundPatternCross(s)){let A=this.handlePossibleCenter(s,c,f);if(A!==null)return A}s[0]=s[2],s[1]=1,s[2]=0,g=1}else s[++g]++;else g===1&&g++,s[g]++;f++}if(this.foundPatternCross(s)){let A=this.handlePossibleCenter(s,c,r);if(A!==null)return A}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new v}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,n=t/2;
6for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){let i=this.image,s=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let a=e;for(;a>=0&&i.get(t,a)&&o[1]<=n;)o[1]++,a--;if(a<0||o[1]>n)return NaN;for(;a>=0&&!i.get(t,a)&&o[0]<=n;)o[0]++,a--;if(o[0]>n)return NaN;for(a=e+1;a<s&&i.get(t,a)&&o[1]<=n;)o[1]++,a++;if(a===s||o[1]>n)return NaN;for(;a<s&&!i.get(t,a)&&o[2]<=n;)o[2]++,a++;if(o[2]>n)return NaN;let c=o[0]+o[1]+o[2];return 5*Math.abs(c-r)>=2*r?NaN:this.foundPatternCross(o)?Tn.centerFromEnd(o,a):NaN}handlePossibleCenter(e,t,n){let r=e[0]+e[1]+e[2],i=Tn.centerFromEnd(e,n),s=this.crossCheckVertical(t,i,2*e[1],r);if(!isNaN(s)){let o=(e[0]+e[1]+e[2])/3;for(let c of this.possibleCenters)if(c.aboutEquals(o,s,i))return c.combineEstimate(s,i,o);let a=new $n(i,s,o);this.possibleCenters.push(a),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(a)}return null}}class er extends G{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,r===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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){let r=this.count+1,i=(this.count*this.getX()+t)/r,s=(this.count*this.getY()+e)/r,o=(this.count*this.estimatedModuleSize+n)/r;return new er(i,s,o,r)}}class Wi{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}}let Yi=(()=>{class l{constructor(t,n){this.image=t,this.resultPointCallback=n,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=n}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(t){let n=t!=null&&t.get(ae.TRY_HARDER)!==void 0,r=t!=null&&t.get(ae.PURE_BARCODE)!==void 0,i=this.image,s=i.getHeight(),o=i.getWidth(),a=Math.floor(3*s/(4*l.MAX_MODULES));(a<l.MIN_SKIP||n)&&(a=l.MIN_SKIP);let c=!1,f=new Int32Array(5);for(let A=a-1;A<s&&!c;A+=a){f[0]=0,f[1]=0,f[2]=0,f[3]=0,f[4]=0;let E=0;for(let I=0;I<o;I++)if(i.get(I,A))(E&1)===1&&E++,f[E]++;else if((E&1)===0)if(E===4)if(l.foundPatternCross(f)){if(this.handlePossibleCenter(f,A,I,r)===!0)if(a=2,this.hasSkipped===!0)c=this.haveMultiplyConfirmedCenters();else{let T=this.findRowSkip();T>f[2]&&(A+=T-f[2]-a,I=o-1)}else{f[0]=f[2],f[1]=f[3],f[2]=f[4],f[3]=1,f[4]=0,E=3;continue}E=0,f[0]=0,f[1]=0,f[2]=0,f[3]=0,f[4]=0}else f[0]=f[2],f[1]=f[3],f[2]=f[4],f[3]=1,f[4]=0,E=3;else f[++E]++;else f[E]++;l.foundPatternCross(f)&&this.handlePossibleCenter(f,A,o,r)===!0&&(a=f[0],this.hasSkipped&&(c=this.haveMultiplyConfirmedCenters()))}let g=this.selectBestPatterns();return G.orderBestPatterns(g),new Wi(g)}static centerFromEnd(t,n){return n-t[4]-t[3]-t[2]/2}static foundPatternCross(t){let n=0;for(let s=0;s<5;s++){let o=t[s];if(o===0)return!1;n+=o}if(n<7)return!1;let r=n/7,i=r/2;return Math.abs(r-t[0])<i&&Math.abs(r-t[1])<i&&Math.abs(3*r-t[2])<3*i&&Math.abs(r-t[3])<i&&Math.abs(r-t[4])<i}getCrossCheckStateCount(){let t=this.crossCheckStateCount;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t}crossCheckDiagonal(t,n,r,i){let s=this.getCrossCheckStateCount(),o=0,a=this.image;for(;t>=o&&n>=o&&a.get(n-o,t-o);)s[2]++,o++;if(t<o||n<o)return!1;for(;t>=o&&n>=o&&!a.get(n-o,t-o)&&s[1]<=r;)s[1]++,o++;if(t<o||n<o||s[1]>r)return!1;for(;t>=o&&n>=o&&a.get(n-o,t-o)&&s[0]<=r;)s[0]++,o++;if(s[0]>r)return!1;let c=a.getHeight(),f=a.getWidth();for(o=1;t+o<c&&n+o<f&&a.get(n+o,t+o);)s[2]++,o++;if(t+o>=c||n+o>=f)return!1;for(;t+o<c&&n+o<f&&!a.get(n+o,t+o)&&s[3]<r;)s[3]++,o++;if(t+o>=c||n+o>=f||s[3]>=r)return!1;for(;t+o<c&&n+o<f&&a.get(n+o,t+o)&&s[4]<r;)s[4]++,o++;if(s[4]>=r)return!1;let g=s[0]+s[1]+s[2]+s[3]+s[4];return Math.abs(g-i)<2*i&&l.foundPatternCross(s)}crossCheckVertical(t,n,r,i){let s=this.image,o=s.getHeight(),a=this.getCrossCheckStateCount(),c=t;for(;c>=0&&s.get(n,c);)a[2]++,c--;if(c<0)return NaN;for(;c>=0&&!s.get(n,c)&&a[1]<=r;)a[1]++,c--;if(c<0||a[1]>r)return NaN;for(;c>=0&&s.get(n,c)&&a[0]<=r;)a[0]++,c--;if(a[0]>r)return NaN;for(c=t+1;c<o&&s.get(n,c);)a[2]++,c++;if(c===o)return NaN;for(;c<o&&!s.get(n,c)&&a[3]<r;)a[3]++,c++;if(c===o||a[3]>=r)return NaN;for(;c<o&&s.get(n,c)&&a[4]<r;
6)a[4]++,c++;if(a[4]>=r)return NaN;let f=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(f-i)>=2*i?NaN:l.foundPatternCross(a)?l.centerFromEnd(a,c):NaN}crossCheckHorizontal(t,n,r,i){let s=this.image,o=s.getWidth(),a=this.getCrossCheckStateCount(),c=t;for(;c>=0&&s.get(c,n);)a[2]++,c--;if(c<0)return NaN;for(;c>=0&&!s.get(c,n)&&a[1]<=r;)a[1]++,c--;if(c<0||a[1]>r)return NaN;for(;c>=0&&s.get(c,n)&&a[0]<=r;)a[0]++,c--;if(a[0]>r)return NaN;for(c=t+1;c<o&&s.get(c,n);)a[2]++,c++;if(c===o)return NaN;for(;c<o&&!s.get(c,n)&&a[3]<r;)a[3]++,c++;if(c===o||a[3]>=r)return NaN;for(;c<o&&s.get(c,n)&&a[4]<r;)a[4]++,c++;if(a[4]>=r)return NaN;let f=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(f-i)>=i?NaN:l.foundPatternCross(a)?l.centerFromEnd(a,c):NaN}handlePossibleCenter(t,n,r,i){let s=t[0]+t[1]+t[2]+t[3]+t[4],o=l.centerFromEnd(t,r),a=this.crossCheckVertical(n,Math.floor(o),t[2],s);if(!isNaN(a)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),t[2],s),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(a),Math.floor(o),t[2],s)))){let c=s/7,f=!1,g=this.possibleCenters;for(let A=0,E=g.length;A<E;A++){let I=g[A];if(I.aboutEquals(c,a,o)){g[A]=I.combineEstimate(a,o,c),f=!0;break}}if(!f){let A=new er(o,a,c);g.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let n=null;for(let r of this.possibleCenters)if(r.getCount()>=l.CENTER_QUORUM)if(n==null)n=r;else return this.hasSkipped=!0,Math.floor((Math.abs(n.getX()-r.getX())-Math.abs(n.getY()-r.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let t=0,n=0,r=this.possibleCenters.length;for(let o of this.possibleCenters)o.getCount()>=l.CENTER_QUORUM&&(t++,n+=o.getEstimatedModuleSize());if(t<3)return!1;let i=n/r,s=0;for(let o of this.possibleCenters)s+=Math.abs(o.getEstimatedModuleSize()-i);return s<=.05*n}selectBestPatterns(){let t=this.possibleCenters.length;if(t<3)throw new v;let n=this.possibleCenters,r;if(t>3){let i=0,s=0;for(let c of this.possibleCenters){let f=c.getEstimatedModuleSize();i+=f,s+=f*f}r=i/t;let o=Math.sqrt(s/t-r*r);n.sort((c,f)=>{let g=Math.abs(f.getEstimatedModuleSize()-r),A=Math.abs(c.getEstimatedModuleSize()-r);return g<A?-1:g>A?1:0});let a=Math.max(.2*r,o);for(let c=0;c<n.length&&n.length>3;c++){let f=n[c];Math.abs(f.getEstimatedModuleSize()-r)>a&&(n.splice(c,1),c--)}}if(n.length>3){let i=0;for(let s of n)i+=s.getEstimatedModuleSize();r=i/n.length,n.sort((s,o)=>{if(o.getCount()===s.getCount()){let a=Math.abs(o.getEstimatedModuleSize()-r),c=Math.abs(s.getEstimatedModuleSize()-r);return a<c?1:a>c?-1:0}else return o.getCount()-s.getCount()}),n.splice(3)}return[n[0],n[1],n[2]]}}return l.CENTER_QUORUM=2,l.MIN_SKIP=3,l.MAX_MODULES=57,l})();class hn{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(ae.NEED_RESULT_POINT_CALLBACK);let n=new Yi(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){let t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),i=this.calculateModuleSize(t,n,r);if(i<1)throw new v("No pattern found in proccess finder.");let s=hn.computeDimension(t,n,r,i),o=j.getProvisionalVersionForDimension(s),a=o.getDimensionForVersion()-7,c=null;if(o.getAlignmentPatternCenters().length>0){let E=n.getX()-t.getX()+r.getX(),I=n.getY()-t.getY()+r.getY(),S=1-3/a,T=Math.floor(t.getX()+S*(E-t.getX())),N=Math.floor(t.getY()+S*(I-t.getY()));for(let B=4;B<=16;B<<=1)try{c=this.findAlignmentInRegion(i,T,N,B);break}catch(H){if(!(H instanceof v))throw H}}let f=hn.createTransform(t,n,r,c,s),g=hn.sampleGrid(this.image,f,s),A;return c===null?A=[r,t,n]:A=[r,t,n,c],new An(g,A)}static createTransform(e,t,n,r,i){let s=i-3.5,o,a,c,f;return r!==null?(o=r.getX(),a=r.getY(),c=s-3,f=c):(o=t.getX()-e.getX()+n.getX(),a=t.getY()-e.getY()+n.getY(),c=s,f=s),lt.quadrilateralToQuadrilateral(3.5,3.5,s,3.5,c,f,3.5,s,e.getX(),e.getY(),t.getX(),t.getY(),o,a,n.getX(),n.getY())}static sampleGrid(e,t,n){return bt.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){let i=le.round(G.distance(e,t)/r),s=le.round(G.distance(e,n)/r),o=Math.floor((i+s)/2)+7;switch(o&3){case 0:o++;break;case 2:o--;break;case 3:throw new v("Dimensions could be not found.")}return o}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())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),s=1,o=e-(n-e);o<0?(s=e/(e-o),o=0):o>=this.image.getWidth()&&(s=(this.image.getWidth()-1-e)/(o-e),o=this.image.getWidth()-1);let a=Math.floor(t-(r-t)*s);return s=1,a<0?(s=t/(t-a),a=0):a>=this.image.getHeight()&&(s=(this.image.getHeight()-1-t)/(a-t),a=this.image.getHeight()-1),o=Math.floor(e+(o-e)*s),i+=this.sizeOfBlackWhiteBlackRun(e,t,o,a),i-1}sizeOfBlackWhiteBlackRun(e,t,n,r){let i=Math.abs(r-t)>Math.abs(n-e);if(i){let E=e;e=t,t=E,E=n,n=r,r=E}let s=Math.abs(n-e),o=Math.abs(r-t),a=-s/2,c=e<n?1:-1,f=t<r?1:-1,g=0,A=n+c;for(let E=e,I=t;E!==A;E+=c){let S=i?I:E,T=i?E:I;if(g===1===this.image.get(S,T)){if(g===2)return le.distance(E,I,e,t);g++}if(a+=o,a>
60){if(I===r)break;I+=f,a-=s}}return g===2?le.distance(n+c,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){let i=Math.floor(r*e),s=Math.max(0,t-i),o=Math.min(this.image.getWidth()-1,t+i);if(o-s<e*3)throw new v("Alignment top exceeds estimated module size.");let a=Math.max(0,n-i),c=Math.min(this.image.getHeight()-1,n+i);if(c-a<e*3)throw new v("Alignment bottom exceeds estimated module size.");return new Tn(this.image,s,a,o-s,c-a,e,this.resultPointCallback).find()}}class Dt{constructor(){this.decoder=new Xi}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(ae.PURE_BARCODE)!==void 0){let a=Dt.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(a,t),r=Dt.NO_POINTS}else{let a=new hn(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(a.getBits(),t),r=a.getPoints()}n.getOther()instanceof Dr&&n.getOther().applyMirroredCorrection(r);let i=new We(n.getText(),n.getRawBytes(),void 0,r,Z.QR_CODE,void 0),s=n.getByteSegments();s!==null&&i.putMetadata(Pe.BYTE_SEGMENTS,s);let o=n.getECLevel();return o!==null&&i.putMetadata(Pe.ERROR_CORRECTION_LEVEL,o),n.hasStructuredAppend()&&(i.putMetadata(Pe.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),i.putMetadata(Pe.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new v;let r=this.moduleSize(t,e),i=t[1],s=n[1],o=t[0],a=n[0];if(o>=a||i>=s)throw new v;if(s-i!==a-o&&(a=o+(s-i),a>=e.getWidth()))throw new v;let c=Math.round((a-o+1)/r),f=Math.round((s-i+1)/r);if(c<=0||f<=0)throw new v;if(f!==c)throw new v;let g=Math.floor(r/2);i+=g,o+=g;let A=o+Math.floor((c-1)*r)-a;if(A>0){if(A>g)throw new v;o-=A}let E=i+Math.floor((f-1)*r)-s;if(E>0){if(E>g)throw new v;i-=E}let I=new Le(c,f);for(let S=0;S<f;S++){let T=i+Math.floor(S*r);for(let N=0;N<c;N++)e.get(o+Math.floor(N*r),T)&&I.set(N,S)}return I}static moduleSize(e,t){let n=t.getHeight(),r=t.getWidth(),i=e[0],s=e[1],o=!0,a=0;for(;i<r&&s<n;){if(o!==t.get(i,s)){if(++a===5)break;o=!o}i++,s++}if(i===r||s===n)throw new v;return(i-e[0])/7}}Dt.NO_POINTS=new Array;class K{PDF417Common(){}static getBitCountSum(e){return le.sum(e)}static toIntArray(e){if(e==null||!e.length)return K.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),n=0;for(let r of e)t[n++]=r;return t}static getCodeword(e){let t=$.binarySearch(K.SYMBOL_TABLE,e&262143);return t<0?-1:(K.CODEWORD_TABLE[t]-1)%K.NUMBER_OF_CODEWORDS}}K.NUMBER_OF_CODEWORDS=929,K.MAX_CODEWORDS_IN_BARCODE=K.NUMBER_OF_CODEWORDS-1,K.MIN_ROWS_IN_BARCODE=3,K.MAX_ROWS_IN_BARCODE=90,K.MODULES_IN_CODEWORD=17,K.MODULES_IN_STOP_PATTERN=18,K.BARS_IN_MODULE=8,K.EMPTY_INT_ARRAY=new Int32Array([]),K
vendor: 18,272 bytes, line 6
6.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]),
6K
vendor: 12,860 bytes, line 6
6.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])
6;class Zi{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class te{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),i=te.detect(n,r);return i.length||(r=r.clone(),r.rotate180(),i=te.detect(n,r)),new Zi(r,i)}static detect(e,t){let n=new Array,r=0,i=0,s=!1;for(;r<t.getHeight();){let o=te.findVertices(t,r,i);if(o[0]==null&&o[3]==null){if(!s)break;s=!1,i=0;
6for(let a of n)a[1]!=null&&(r=Math.trunc(Math.max(r,a[1].getY()))),a[3]!=null&&(r=Math.max(r,Math.trunc(a[3].getY())));r+=te.ROW_STEP;continue}if(s=!0,n.push(o),!e)break;o[2]!=null?(i=Math.trunc(o[2].getX()),r=Math.trunc(o[2].getY())):(i=Math.trunc(o[4].getX()),r=Math.trunc(o[4].getY()))}return n}static findVertices(e,t,n){let r=e.getHeight(),i=e.getWidth(),s=new Array(8);return te.copyToResult(s,te.findRowsWithPattern(e,r,i,t,n,te.START_PATTERN),te.INDEXES_START_PATTERN),s[4]!=null&&(n=Math.trunc(s[4].getX()),t=Math.trunc(s[4].getY())),te.copyToResult(s,te.findRowsWithPattern(e,r,i,t,n,te.STOP_PATTERN),te.INDEXES_STOP_PATTERN),s}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,i,s){let o=new Array(4),a=!1,c=new Int32Array(s.length);for(;r<t;r+=te.ROW_STEP){let g=te.findGuardPattern(e,i,r,n,!1,s,c);if(g!=null){for(;r>0;){let A=te.findGuardPattern(e,i,--r,n,!1,s,c);if(A!=null)g=A;else{r++;break}}o[0]=new G(g[0],r),o[1]=new G(g[1],r),a=!0;break}}let f=r+1;if(a){let g=0,A=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;f<t;f++){let E=te.findGuardPattern(e,A[0],f,n,!1,s,c);if(E!=null&&Math.abs(A[0]-E[0])<te.MAX_PATTERN_DRIFT&&Math.abs(A[1]-E[1])<te.MAX_PATTERN_DRIFT)A=E,g=0;else{if(g>te.SKIPPED_ROW_COUNT_MAX)break;g++}}f-=g+1,o[2]=new G(A[0],f),o[3]=new G(A[1],f)}return f-r<te.BARCODE_MIN_HEIGHT&&$.fill(o,null),o}static findGuardPattern(e,t,n,r,i,s,o){$.fillWithin(o,0,o.length,0);let a=t,c=0;for(;e.get(a,n)&&a>0&&c++<te.MAX_PIXEL_DRIFT;)a--;let f=a,g=0,A=s.length;for(let E=i;f<r;f++)if(e.get(f,n)!==E)o[g]++;else{if(g===A-1){if(te.patternMatchVariance(o,s,te.MAX_INDIVIDUAL_VARIANCE)<te.MAX_AVG_VARIANCE)return new Int32Array([a,f]);a+=o[0]+o[1],Y.arraycopy(o,2,o,0,g-1),o[g-1]=0,o[g]=0,g--}else g++;o[g]=1,E=!E}return g===A-1&&te.patternMatchVariance(o,s,te.MAX_INDIVIDUAL_VARIANCE)<te.MAX_AVG_VARIANCE?new Int32Array([a,f-1]):null}static patternMatchVariance(e,t,n){let r=e.length,i=0,s=0;for(let c=0;c<r;c++)i+=e[c],s+=t[c];if(i<s)return 1/0;let o=i/s;n*=o;let a=0;for(let c=0;c<r;c++){let f=e[c],g=t[c]*o,A=f>g?f-g:g-f;if(A>n)return 1/0;a+=A}return a/i}}te.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),te.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),te.MAX_AVG_VARIANCE=.42,te.MAX_INDIVIDUAL_VARIANCE=.8,te.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),te.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),te.MAX_PIXEL_DRIFT=3,te.MAX_PATTERN_DRIFT=5,te.SKIPPED_ROW_COUNT_MAX=25,te.ROW_STEP=5,te.BARCODE_MIN_HEIGHT=10;class He{constructor(e,t){if(t.length===0)throw new w;this.field=e;let n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-r),Y.arraycopy(t,r,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 r=0;for(let i of this.coefficients)r=this.field.add(r,i);return r}let t=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)t=this.field.add(this.field.multiply(e,t),this.coefficients[r]);return t}add(e){if(!this.field.equals(e.field))throw new w("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 s=t;t=n,n=s}let r=new Int32Array(n.length),i=n.length-t.length;Y.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=this.field.add(t[s-i],n[s]);return new He(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new w("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof He?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new w("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new He(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1);for(let o=0;o<n;o++){let a=t[o];for(let c=0;c<i;c++)s[o+c]=this.field.add(s[o+c],this.field.multiply(a,r[c]))}return new He(this.field,s)}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 He(this.field,t)}multiplyScalar(e){if(e===0)return new He(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=this.field.multiply(this.coefficients[r],e);return new He(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new w;if(t===0)return new He(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let i=0;i<n;i++)r[i]=this.field.multiply(this.coefficients[i],t);return new He(this.field,r)}toString(){let e=new Ae;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 Qi{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 w;return this.logTable[e]}inverse(e){if(e===0)throw new Hn;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 tr extends Qi{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let r=0;r<e;r++)this.expTable[r]=n,n=n*t%e;for(let r=0;r<e-1;r++)this.logTable[this.expTable[r]]=r;this.zero=new He(this,new Int32Array([0])),this.one=new He(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new w;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new He(this,n)}}tr.PDF417_GF=new tr(K.NUMBER_OF_CODEWORDS,3);class Or{constructor(){this.field=tr.PDF417_GF}decode(e,t,n){let r=new He(this.field,e),i=new Int32Array(t),s=!1;for(let I=t;I>0;I--){let S=r.evaluateAt(this.field.exp(I));i[t-I]=S,S!==0&&(s=!0)}if(!s)return 0;let o=this.field.getOne();if(n!=null)for(let I of n){let S=this.field.exp(e.length-1-I),T=new He(this.field,new Int32Array([this.field.subtract(0,S),1]));o=o.multiply(T)}let a=new He(this.field,i),c=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),f=c[0],g=c[1],A=this.findErrorLocations(f),E=this.findErrorMagnitudes(g,f,A);for(let I=0;I<A.length;I++){let S=e.length-1-this.field.log(A[I]);if(S<0)throw P.getChecksumInstance();e[S]=this.field.subtract(e[S],E[I])}return A.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let A=e;e=t,t=A}let r=e,i=t,s=this.field.getZero(),o=this.field.getOne();for(;i.getDegree()>=Math.round(n/2);){let A=r,E=s;if(r=i,s=o,r.isZero())throw P.getChecksumInstance();i=A;let I=this.field.getZero(),S=r.getCoefficient(r.getDegree()),T=this.field.inverse(S);for(;i.getDegree()>=r.getDegree()&&!i.isZero();){let N=i.getDegree()-r.getDegree(),B=this.field.multiply(i.getCoefficient(i.getDegree()),T);I=I.add(this.field.buildMonomial(N,B)),i=i.subtract(r.multiplyByMonomial(N,B))}o=I.multiply(s).subtract(E).negative()}let a=o.getCoefficient(0);if(a===0)throw P.getChecksumInstance();let c=this.field.inverse(a),f=o.multiply(c),g=i.multiply(c);return[f,g]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let i=1;i<this.field.getSize()&&r<t;i++)e.evaluateAt(i)===0&&(n[r]=this.field.inverse(i),r++);if(r!==t)throw P.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),i=new Int32Array(r);for(let c=1;c<=r;c++)i[r-c]=this.field.multiply(c,t.getCoefficient(c));let s=new He(this.field,i),o=n.length,a=new Int32Array(o);for(let c=0;c<o;c++){let f=this.field.inverse(n[c]),g=this.field.subtract(0,e.evaluateAt(f)),A=this.field.inverse(s.evaluateAt(f));a[c]=this.field.multiply(g,A)}return a}}class kt{constructor(e,t,n,r,i){e instanceof kt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){let s=t==null||n==null,o=r==null||i==null;if(s&&o)throw new v;
6s?(t=new G(0,r.getY()),n=new G(0,i.getY())):o&&(r=new G(e.getWidth()-1,t.getY()),i=new G(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),i.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 kt(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,i=this.bottomLeft,s=this.topRight,o=this.bottomRight;if(e>0){let a=n?this.topLeft:this.topRight,c=Math.trunc(a.getY()-e);c<0&&(c=0);let f=new G(a.getX(),c);n?r=f:s=f}if(t>0){let a=n?this.bottomLeft:this.bottomRight,c=Math.trunc(a.getY()+t);c>=this.image.getHeight()&&(c=this.image.getHeight()-1);let f=new G(a.getX(),c);n?i=f:o=f}return new kt(this.image,r,i,s,o)}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 Ki{constructor(e,t,n,r){this.columnCount=e,this.errorCorrectionLevel=r,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 fn{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(s,o,a,c,f,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=f?parseInt(f.substr(1)):void 0,E;switch(g){case"s":E=t[n];break;case"c":E=t[n][0];break;case"f":E=parseFloat(t[n]).toFixed(s);break;case"p":E=parseFloat(t[n]).toPrecision(s);break;case"e":E=parseFloat(t[n]).toExponential(s);break;case"x":E=parseInt(t[n]).toString(A||16);break;case"d":E=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}E=typeof E=="object"?JSON.stringify(E):(+E).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;E.length<I;)E=o!==void 0?E+S:S+E;return E}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}format(e,...t){this.buffer+=fn.form(e,t)}toString(){return this.buffer}}let Rr=(()=>{class l{constructor(t){this.boundingBox=new kt(t),this.codewords=new Array(t.getMaxY()-t.getMinY()+1)}getCodewordNearby(t){let n=this.getCodeword(t);if(n!=null)return n;for(let r=1;r<l.MAX_NEARBY_DISTANCE;r++){let i=this.imageRowToCodewordIndex(t)-r;if(i>=0&&(n=this.codewords[i],n!=null)||(i=this.imageRowToCodewordIndex(t)+r,i<this.codewords.length&&(n=this.codewords[i],n!=null)))return n}return null}imageRowToCodewordIndex(t){return t-this.boundingBox.getMinY()}
6setCodeword(t,n){this.codewords[this.imageRowToCodewordIndex(t)]=n}getCodeword(t){return this.codewords[this.imageRowToCodewordIndex(t)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let t=new fn,n=0;for(let r of this.codewords){if(r==null){t.format("%3d: | %n",n++);continue}t.format("%3d: %3d|%3d%n",n++,r.getRowNumber(),r.getValue())}return t.toString()}}return l.MAX_NEARBY_DISTANCE=5,l})();class dn{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,r]of this.values.entries()){let i={getKey:()=>n,getValue:()=>r};i.getValue()>e?(e=i.getValue(),t=[],t.push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return K.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class vr extends Rr{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(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,c=1,f=0;for(let g=s;g<o;g++){if(t[g]==null)continue;let A=t[g],E=A.getRowNumber()-a;if(E===0)f++;else if(E===1)c=Math.max(c,f),f=1,a=A.getRowNumber();else if(E<0||A.getRowNumber()>=e.getRowCount()||E>g)t[g]=null;else{let I;c>2?I=(c-2)*E:I=E;let S=I>=g;for(let T=1;T<=I&&!S;T++)S=t[g-T]!=null;S?t[g]=null:(a=A.getRowNumber(),f=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 r=n.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),s=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.getCodewords(),a=-1;for(let c=i;c<s;c++){if(o[c]==null)continue;let f=o[c];f.setRowNumberAsRowIndicatorColumn();let g=f.getRowNumber()-a;g===0||(g===1?a=f.getRowNumber():f.getRowNumber()>=e.getRowCount()?o[c]=null:a=f.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new dn,n=new dn,r=new dn,i=new dn;for(let o of e){if(o==null)continue;o.setRowNumberAsRowIndicatorColumn();let a=o.getValue()%30,c=o.getRowNumber();switch(this._isLeft||(c+=2),c%3){case 0:n.setValue(a*3+1);break;case 1:i.setValue(a/3),r.setValue(a%3);break;case 2:t.setValue(a+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||i.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<K.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>K.MAX_ROWS_IN_BARCODE)return null;let s=new Ki(t.getValue()[0],n.getValue()[0],r.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,s),s}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let i=r.getValue()%30,s=r.getRowNumber();if(s>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:i*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+` 7`+super.toString()}}class gn{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=K.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 r=0;r<n.length;r++)n[r]!=null&&(n[r].hasValidRowNumber()||this.adjustRowNumbers(t,r,n))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}
7adjustRowNumbersFromBothRI(){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 r=1;r<=this.barcodeColumnCount;r++){let i=this.detectionResultColumns[r].getCodewords()[n];i!=null&&(i.setRowNumber(e[n].getRowNumber()),i.hasValidRowNumber()||(this.detectionResultColumns[r].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 r=t[n].getRowNumber(),i=0;for(let s=this.barcodeColumnCount+1;s>0&&i<this.ADJUST_ROW_NUMBER_SKIP;s--){let o=this.detectionResultColumns[s].getCodewords()[n];o!=null&&(i=gn.adjustRowNumberIfValid(r,i,o),o.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 r=t[n].getRowNumber(),i=0;for(let s=1;s<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;s++){let o=this.detectionResultColumns[s].getCodewords()[n];o!=null&&(i=gn.adjustRowNumberIfValid(r,i,o),o.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 r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),s=i;this.detectionResultColumns[e+1]!=null&&(s=this.detectionResultColumns[e+1].getCodewords());let o=new Array(14);o[2]=i[t],o[3]=s[t],t>0&&(o[0]=n[t-1],o[4]=i[t-1],o[5]=s[t-1]),t>1&&(o[8]=n[t-2],o[10]=i[t-2],o[11]=s[t-2]),t<n.length-1&&(o[1]=n[t+1],o[6]=i[t+1],o[7]=s[t+1]),t<n.length-2&&(o[9]=n[t+2],o[12]=i[t+2],o[13]=s[t+2]);for(let a of o)if(gn.adjustRowNumber(r,a))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 fn;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let r=0;r<this.barcodeColumnCount+2;r++){if(this.detectionResultColumns[r]==null){t.format(" | ");continue}let i=this.detectionResultColumns[r].getCodewords()[n];if(i==null){t.format(" | ");continue}t.format(" %3d|%3d",i.getRowNumber(),i.getValue())}t.format("%n")}return t.toString()}}let qi=(()=>{class l{constructor(t,n,r,i){this.rowNumber=l.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(t),this.endX=Math.trunc(n),this.bucket=Math.trunc(r),this.value=Math.trunc(i)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(t){return t!==l.BARCODE_ROW_UNKNOWN&&this.bucket===t%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(t){this.rowNumber=t}toString(){return this.rowNumber+"|"+this.value}}return l.BARCODE_ROW_UNKNOWN=-1,l})();class qe{static initialize(){for(let e=0;e<K.SYMBOL_TABLE.length;e++){let t=K.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<K.BARS_IN_MODULE;r++){let i=0;for(;(t&1)===n;)i+=1,t>>=1;n=t&1,qe.RATIOS_TABLE[e]||(qe.RATIOS_TABLE[e]=new Array(K.BARS_IN_MODULE)),qe.RATIOS_TABLE[e][K.BARS_IN_MODULE-r-1]=Math.fround(i/K.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=qe.getDecodedCodewordValue(qe.sampleBitCounts(e));return t!==-1?t:qe.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=le.sum(e),n=new Int32Array(K.BARS_IN_MODULE),r=0,i=0;for(let s=0;s<K.MODULES_IN_CODEWORD;s++){let o=t/(2*K.MODULES_IN_CODEWORD)+s*t/K.MODULES_IN_CODEWORD;i+e[r]<=o&&(i+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=qe.getBitValue(e);return K.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let r=0;r<e[n];r++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=le.sum(e),n=new Array(K.BARS_IN_MODULE);if(t>1)for(let s=0;s<n.length;s++)n[s]=Math.fround(e[s]/t);let r=wn.MAX_VALUE,i=-1;this.bSymbolTableReady||qe.initialize();for(let s=0;s<qe.RATIOS_TABLE.length;s++){let o=0,a=qe.RATIOS_TABLE[s];for(let c=0;c<K.BARS_IN_MODULE;c++){let f=Math.fround(a[c]-n[c]);if(o+=Math.fround(f*f),o>=r)break}o<r&&(r=o,i=K.SYMBOL_TABLE[s])}return i}}qe.bSymbolTableReady=!1,qe.RATIOS_TABLE=new Array(K.SYMBOL_TABLE.length).map(l
7=>l=new Array(K.BARS_IN_MODULE));class Lr{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 Br{static parseLong(e,t=void 0){return parseInt(e,t)}}let Ji=(()=>{class l extends M{}return l.kind="NullPointerException",l})();class $i{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Ji;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new ve;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class es extends M{}class ts extends $i{constructor(e=32){if(super(),this.count=0,e<0)throw new w("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 es;n=X.MAX_VALUE}this.buf=$.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 ve;this.ensureCapacity(this.count+n),Y.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 $.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 pe=(function(l){return l[l.ALPHA=0]="ALPHA",l[l.LOWER=1]="LOWER",l[l.MIXED=2]="MIXED",l[l.PUNCT=3]="PUNCT",l[l.ALPHA_SHIFT=4]="ALPHA_SHIFT",l[l.PUNCT_SHIFT=5]="PUNCT_SHIFT",l})(pe||{});function Pr(){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 bn;function Ot(l){if(typeof bn>"u"&&(bn=Pr()),bn===null)throw new Error("BigInt is not supported!");return bn(l)}function ns(){let l=[];l[0]=Ot(1);let e=Ot(900);l[1]=e;for(let t=2;t<16;t++)l[t]=l[t-1]*e;return l}class _{static decode(e,t){let n=new Ae(""),r=k.ISO8859_1;n.enableDecoding(r);let i=1,s=e[i++],o=new Lr;for(;i<e[0];){switch(s){case _.TEXT_COMPACTION_MODE_LATCH:i=_.textCompaction(e,i,n);break;case _.BYTE_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH_6:i=_.byteCompaction(s,e,r,i,n);break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case _.NUMERIC_COMPACTION_MODE_LATCH:i=_.numericCompaction(e,i,n);break;case _.ECI_CHARSET:let c=k.getCharacterSetECIByValue(e[i++]);break;case _.ECI_GENERAL_PURPOSE:i+=2;break;case _.ECI_USER_DEFINED:i++;break;case _.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=_.decodeMacroBlock(e,i,o);break;case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case _.MACRO_PDF417_TERMINATOR:throw new F;default:i--,i=_.textCompaction(e,i,n);break}if(i<e.length)s=e[i++];else throw F.getFormatInstance()}if(n.length()===0)throw F.getFormatInstance();let a=new sn(null,n.toString(),null,t);return a.setOther(o),a}static decodeMacroBlock(e,t,n){if(t+_.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw F.getFormatInstance();let r=new Int32Array(_.NUMBER_OF_SEQUENCE_CODEWORDS);for(let o=0;o<_.NUMBER_OF_SEQUENCE_CODEWORDS;o++,t++)r[o]=e[t];n.setSegmentIndex(X.parseInt(_.decodeBase900toBase10(r,_.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new Ae;t=_.textCompaction(e,t,i),n.setFileId(i.toString());let s=-1;for(e[t]===_.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case _.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let o=new Ae;t=_.textCompaction(e,t+1,o),n.setFileName(o.toString());break;case _.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let a=new Ae;t=_.textCompaction(e,t+1,a),n.setSender(a.toString());break;case _.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let c=new Ae;t=_.textCompaction(e,t+1,c),n.setAddressee(c.toString());break;case _.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let f=new Ae;t=_.numericCompaction(e,t+1,f),n.setSegmentCount(X.parseInt(f.toString()));break;case _.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let g=new Ae;t=_.numericCompaction(e,t+1,g),n.setTimestamp(Br.parseLong(g.toString()));break;case _.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let A=new Ae;t=_.numericCompaction(e,t+1,A),n.setChecksum(X.parseInt(A.toString()));break;case _.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let E=new Ae;t=_.numericCompaction(e,t+1,E),n.setFileSize(Br.parseLong(E.toString()));break;default:throw F.getFormatInstance()}break;case _.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(s!==-1){let o=t-s;n.isLastSegment()&&o--,n.setOptionalData($.copyOfRange(e,s,s+o))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),s=0,o=!1;for(;t<e[0]&&!o;){let a=e[t++];if(a<_.TEXT_COMPACTION_MODE_LATCH)r[s]=a/30,r[s+1]=a%30,s+=2;else switch(a){case _.TEXT_COMPACTION_MODE_LATCH:r[s++]=_.TEXT_COMPACTION_MODE_LATCH;break;case _.BYTE_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH_6:case _.NUMERIC_COMPACTION_MODE_LATCH:case _.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case _.MACRO_PDF417_TERMINATOR:t--,o=!0;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[s]=_.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,a=e[t++],i[s]=a,s++;break}}return _.decodeTextCompaction(r,i,s,n),t}static decodeTextCompaction(e,t,n,r){let i=pe.ALPHA,s=pe.ALPHA,o=0;for(;o<n;){let a=e[o],c="";switch(i){case pe.ALPHA:if(a<26)c=String.fromCharCode(65+a);else switch(a){case 26:c=" ";break;case _.LL:i=pe.LOWER;break;case _.ML:i=pe.MIXED;break;case _.PS:s=i,i=pe.PUNCT_SHIFT;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break;case pe.LOWER:if(a<26)c=String.fromCharCode(97+a);else switch(a){case 26:c=" ";break;case _.AS:s=i,i=pe.ALPHA_SHIFT;break;case _.ML:i=pe.MIXED;break;case _.PS:s=i,i=pe.PUNCT_SHIFT;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break;case pe.MIXED:if(a<_.PL)c=_.MIXED_CHARS[a];else switch(a){case _.PL:i=pe.PUNCT;break;case 26:c=" ";break;case _.LL:i=pe.LOWER;break;case _.AL:i=pe.ALPHA;break;case _.PS:s=i,i=pe.PUNCT_SHIFT;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break;case pe.PUNCT:if(a<_.PAL)c=_.PUNCT_CHARS[a];else switch(a){case _.PAL:i=pe.ALPHA;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break;case pe.ALPHA_SHIFT:if(i=s,a<26)c=String.fromCharCode(65+a);else switch(a){case 26:c=" ";break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break;case pe.PUNCT_SHIFT:if(i=s,a<_.PAL)c=_.PUNCT_CHARS[a];else switch(a){case _.PAL:i=pe.ALPHA;break;case _.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[o]);break;case _.TEXT_COMPACTION_MODE_LATCH:i=pe.ALPHA;break}break}c!==""&&r.append(c),o++}}static byteCompaction(e,t,n,r,i){let s=new ts,o=0,a=0,c=!1;switch(e){case _.BYTE_COMPACTION_MODE_LATCH:let f=new Int32Array(6),g=t[r++];for(;r<t[0]&&!c;)switch(f[o++]=g,a=900*a+g,g=t[r++],g){case _.TEXT_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH:case _.NUMERIC_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH_6:case _.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case _.MACRO_PDF417_TERMINATOR:r--,c=!0;break;default:if(o%5===0&&o>0){for(let A=0;A<6;++A)s.write(Number(Ot(a)>>Ot(8*(5-A))));a=0,o=0}break}r===t[0]&&g<_.TEXT_COMPACTION_MODE_LATCH&&(f[o++]=g);for(let A=0;A<o;A++)s.write(f[A]);break;case _.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!c;){let A=t[r++];if(A<_.TEXT_COMPACTION_MODE_LATCH)o++,a=900*a+A;else switch(A){case _.TEXT_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH:case _.NUMERIC_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH_6:case _.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case _.MACRO_PDF417_TERMINATOR:r--,c=!0;break}if(o%5===0&&o>0){for(let E=0;E<6;++E)s.write(Number(Ot(a)>>Ot(8*(5-E))));a=0,o=0}}break}return i.append(Qe.decode(s.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,i=!1,s=new Int32Array(_.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let o=e[t++];if(t===e[0]&&(i=!0),o<_.TEXT_COMPACTION_MODE_LATCH)s[r]=o,r++;else switch(o){case _.TEXT_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH:case _.BYTE_COMPACTION_MODE_LATCH_6:case _.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case _.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case _.MACRO_PDF417_TERMINATOR:t--,i=!0;break}(r%_.MAX_NUMERIC_CODEWORDS===0||o===_.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(_.decodeBase900toBase10(s,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=Ot(0);for(let i=0;i<t;i++)n+=_.EXP900[t-i-1]*Ot(e[i]);let r=n.toString();if(r.charAt(0)!=="1")throw new F;return r.substring(1)}}_.TEXT_COMPACTION_MODE_LATCH=900,_.BYTE_COMPACTION_MODE_LATCH=901,_.NUMERIC_COMPACTION_MODE_LATCH=902,_.BYTE_COMPACTION_MODE_LATCH_6=924,_.ECI_USER_DEFINED=925,_.ECI_GENERAL_PURPOSE=926,_.ECI_CHARSET=927,_.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,_.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,_.MACRO_PDF417_TERMINATOR=922,_.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,_.MAX_NUMERIC_CODEWORDS=15,_.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,_.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,_.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,_.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,_.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,_.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,_.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,_.PL=25,_.LL=27,_.AS=27,_.ML=28,_.AL=28,_.PS=29,_.PAL=29,_.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,: 8-.$/"|*()?{}'`,_.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",_.EXP900=Pr()?ns():[],_.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ne{constructor(){}static decode(e,t,n,r,i,s,o){let a=new kt(e,t,n,r,i),c=null,f=null,g;for(let I=!0;;I=!1){if(t!=null&&(c=ne.getRowIndicatorColumn(e,a,t,!0,s,o)),r!=null&&(f=ne.getRowIndicatorColumn(e,a,r,!1,s,o)),g=ne.merge(c,f),g==null)throw v.getNotFoundInstance();let S=g.getBoundingBox();if(I&&S!=null&&(S.getMinY()<a.getMinY()||S.getMaxY()>a.getMaxY()))a=S;else break}g.setBoundingBox(a);let A=g.getBarcodeColumnCount()+1;g.setDetectionResultColumn(0,c),g.setDetectionResultColumn(A,f);let E=c!=null;for(let I=1;I<=A;I++){let S=E?I:A-I;if(g.getDetectionResultColumn(S)!==void 0)continue;let T;S===0||S===A?T=new vr(a,S===0):T=new Rr(a),g.setDetectionResultColumn(S,T);let N=-1,B=N;for(let H=a.getMinY();H<=a.getMaxY();H++){if(N=ne.getStartColumn(g,S,H,E),N<0||N>a.getMaxX()){if(B===-1)continue;N=B}let R=ne.detectCodeword(e,a.getMinX(),a.getMaxX(),E,N,H,s,o);R!=null&&(T.setCodeword(H,R),B=N,s=Math.min(s,R.getWidth()),o=Math.max(o,R.getWidth()))}}return ne.createDecoderResult(g)}static merge(e,t){if(e==null&&t==null)return null;let n=ne.getBarcodeMetadata(e,t);if(n==null)return null;let r=kt.merge(ne.adjustBoundingBox(e),ne.adjustBoundingBox(t));return new gn(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=ne.getMax(t),r=0;for(let o of t)if(r+=n-o,o>0)break;let i=e.getCodewords();for(let o=0;r>0&&i[o]==null;o++)r--;let s=0;for(let o=t.length-1;o>=0&&(s+=n-t[o],!(t[o]>0));o--);for(let o=i.length-1;s>0&&i[o]==null;o--)s--;return e.getBoundingBox().addMissingRows(r,s,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 r;return t==null||(r=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,i,s){let o=new vr(t,r);for(let a=0;a<2;a++){let c=a===0?1:-1,f=Math.trunc(Math.trunc(n.getX()));for(let g=Math.trunc(Math.trunc(n.getY()));g<=t.getMaxY()&&g>=t.getMinY();g+=c){let A=ne.detectCodeword(e,0,e.getWidth(),r,f,g,i,s);A!=null&&(o.setCodeword(g,A),r?f=A.getStartX():f=A.getEndX())}}return o}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-ne.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(i<1||i>K.MAX_CODEWORDS_IN_BARCODE)throw v.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=ne.createBarcodeMatrix(e);ne.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],s=new Array;for(let a=0;a<e.getBarcodeRowCount();a++)for(let c=0;c<e.getBarcodeColumnCount();c++){let f=t[a][c+1].getValue(),g=a*e.getBarcodeColumnCount()+c;f.length===0?n.push(g):f.length===1?r[g]=f[0]:(s.push(g),i.push(f))}let o=new Array(i.length);for(let a=0;a<o.length;a++)o[a]=i[a];return ne.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,K.toIntArray(n),K.toIntArray(s),o)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let s=new Int32Array(r.length),o=100;for(;o-- >0;){for(let a=0;a<s.length;a++)t[r[a]]=i[a][s[a]];try{return ne.decodeCodewords(t,e,n)}catch(a){if(!(a instanceof P))throw a}if(s.length===0)throw P.getChecksumInstance();for(let a=0;a<s.length;a++)if(s[a]<i[a].length-1){s[a]++;break}else if(s[a]=0,a===s.length-1)throw P.getChecksumInstance()}throw P.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let r=0;r<t.length;r++)for(let i=0;i<t[r].length;i++)t[r][i]=new dn;let n=0;
8for(let r of e.getDetectionResultColumns()){if(r!=null){for(let i of r.getCodewords())if(i!=null){let s=i.getRowNumber();if(s>=0){if(s>=t.length)continue;t[s][n].setValue(i.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let i=r?1:-1,s=null;if(ne.isValidBarcodeColumn(e,t-i)&&(s=e.getDetectionResultColumn(t-i).getCodeword(n)),s!=null)return r?s.getEndX():s.getStartX();if(s=e.getDetectionResultColumn(t).getCodewordNearby(n),s!=null)return r?s.getStartX():s.getEndX();if(ne.isValidBarcodeColumn(e,t-i)&&(s=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),s!=null)return r?s.getEndX():s.getStartX();let o=0;for(;ne.isValidBarcodeColumn(e,t-i);){t-=i;for(let a of e.getDetectionResultColumn(t).getCodewords())if(a!=null)return(r?a.getEndX():a.getStartX())+i*o*(a.getEndX()-a.getStartX());o++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,i,s,o,a){i=ne.adjustCodewordStartColumn(e,t,n,r,i,s);let c=ne.getModuleBitCount(e,t,n,r,i,s);if(c==null)return null;let f,g=le.sum(c);if(r)f=i+g;else{for(let I=0;I<c.length/2;I++){let S=c[I];c[I]=c[c.length-1-I],c[c.length-1-I]=S}f=i,i=f-g}if(!ne.checkCodewordSkew(g,o,a))return null;let A=qe.getDecodedValue(c),E=K.getCodeword(A);return E===-1?null:new qi(i,f,ne.getCodewordBucketNumber(A),E)}static getModuleBitCount(e,t,n,r,i,s){let o=i,a=new Int32Array(8),c=0,f=r?1:-1,g=r;for(;(r?o<n:o>=t)&&c<a.length;)e.get(o,s)===g?(a[c]++,o+=f):(c++,g=!g);return c===a.length||o===(r?n:t)&&c===a.length-1?a:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,i,s){let o=i,a=r?-1:1;for(let c=0;c<2;c++){for(;(r?o>=t:o<n)&&r===e.get(o,s);){if(Math.abs(i-o)>ne.CODEWORD_SKEW_SIZE)return i;o+=a}a=-a,r=!r}return o}static checkCodewordSkew(e,t,n){return t-ne.CODEWORD_SKEW_SIZE<=e&&e<=n+ne.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw F.getFormatInstance();let r=1<<t+1,i=ne.correctErrors(e,n,r);ne.verifyCodewordCount(e,r);let s=_.decode(e,""+t);return s.setErrorsCorrected(i),s.setErasures(n.length),s}
8static correctErrors(e,t,n){if(t!=null&&t.length>n/2+ne.MAX_ERRORS||n<0||n>ne.MAX_EC_CODEWORDS)throw P.getChecksumInstance();return ne.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw F.getFormatInstance();let n=e[0];if(n>e.length)throw F.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw F.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((e&1)!==n&&(n=e&1,r--,r<0));)t[r]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return ne.getCodewordBucketNumber(ne.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new fn;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let i=e[n][r];i.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}ne.CODEWORD_SKEW_SIZE=2,ne.MAX_ERRORS=3,ne.MAX_EC_CODEWORDS=512,ne.errorCorrection=new Or;class Ve{decode(e,t=null){let n=Ve.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw v.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Ve.decode(e,t,!0)}catch(n){throw n instanceof F||n instanceof P?v.getNotFoundInstance():n}}static decode(e,t,n){let r=new Array,i=te.detectMultiple(e,t,n);for(let s of i.getPoints()){let o=ne.decode(i.getBits(),s[4],s[5],s[6],s[7],Ve.getMinCodewordWidth(s),Ve.getMaxCodewordWidth(s)),a=new We(o.getText(),o.getRawBytes(),void 0,s,Z.PDF_417);a.putMetadata(Pe.ERROR_CORRECTION_LEVEL,o.getECLevel());let c=o.getOther();c!=null&&a.putMetadata(Pe.PDF417_EXTRA_METADATA,c),r.push(a)}return r.map(s=>s)}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?X.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Ve.getMaxWidth(e[0],e[4]),Ve.getMaxWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.max(Ve.getMaxWidth(e[1],e[5]),Ve.getMaxWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Ve.getMinWidth(e[0],e[4]),Ve.getMinWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.min(Ve.getMinWidth(e[1],e[5]),Ve.getMinWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))}reset(){}}let nr=(()=>{class l extends M{}return l.kind="ReaderException",l})();class Fr{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=!h(e)&&e.get(ae.TRY_HARDER)===!0,n=h(e)?null:e.get(ae.POSSIBLE_FORMATS),r=new Array;if(!h(n)){let i=n.some(s=>s===Z.UPC_A||s===Z.UPC_E||s===Z.EAN_13||s===Z.EAN_8||s===Z.CODABAR||s===Z.CODE_39||s===Z.CODE_93||s===Z.CODE_128||s===Z.ITF||s===Z.RSS_14||s===Z.RSS_EXPANDED);i&&!t&&r.push(new Zt(e,this.verbose)),n.includes(Z.QR_CODE)&&r.push(new Dt),n.includes(Z.DATA_MATRIX)&&r.push(new yn),n.includes(Z.AZTEC)&&r.push(new pn),n.includes(Z.PDF_417)&&r.push(new Ve),i&&t&&r.push(new Zt(e,this.verbose))}r.length===0&&(t||r.push(new Zt(e,this.verbose)),r.push(new Dt),r.push(new yn),r.push(new pn),r.push(new Ve),t&&r.push(new Zt(e,this.verbose))),this.readers=r}reset(){if(this.readers!==null)for(let e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new nr("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 nr)continue}throw new v("No MultiFormat Readers were able to detect the code.")}}class rs extends Lt{constructor(e=null,t=500){let n=new Fr;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class is extends Lt{constructor(e=500){super(new Ve,e)}}class ss extends Lt{constructor(e=500){super(new Dt,e)}}var kr=(function(l){return l[l.ERROR_CORRECTION=0]="ERROR_CORRECTION",l[l.CHARACTER_SET=1]="CHARACTER_SET",l[l.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",l[l.MIN_SIZE=3]="MIN_SIZE",l[l.MAX_SIZE=4]="MAX_SIZE",l[l.MARGIN=5]="MARGIN",l[l.PDF417_COMPACT=6]="PDF417_COMPACT",l[l.PDF417_COMPACTION=7]="PDF417_COMPACTION",l[l.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",l[l.AZTEC_LAYERS=9]="AZTEC_LAYERS",l[l.QR_VERSION=10]="QR_VERSION",l})(kr||{}),Re=kr;class rr{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Ke(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1],r=this.field;for(let i=t.length;i<=e;i++){let s=n.multiply(new Ke(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(s),n=s}}return t[e]}encode(e,t){if(t===0)throw new w("No error correction bytes");let n=e.length-t;if(n<=0)throw new w("No data bytes provided");let r=this.buildGenerator(t),i=new Int32Array(n);Y.arraycopy(e,0,i,0,n);let s=new Ke(this.field,i);s=s.multiplyByMonomial(t,1);let a=s.divide(r)[1].getCoefficients(),c=t-a.length;for(let f=0;f<c;f++)e[n+f]=0;Y.arraycopy(a,0,e,n+c,a.length)}}let Qt=(()=>{class l{constructor(){}static applyMaskPenaltyRule1(t){return l.applyMaskPenaltyRule1Internal(t,!0)+l.applyM
8askPenaltyRule1Internal(t,!1)}static applyMaskPenaltyRule2(t){let n=0,r=t.getArray(),i=t.getWidth(),s=t.getHeight();for(let o=0;o<s-1;o++){let a=r[o];for(let c=0;c<i-1;c++){let f=a[c];f===a[c+1]&&f===r[o+1][c]&&f===r[o+1][c+1]&&n++}}return l.N2*n}static applyMaskPenaltyRule3(t){let n=0,r=t.getArray(),i=t.getWidth(),s=t.getHeight();for(let o=0;o<s;o++)for(let a=0;a<i;a++){let c=r[o];a+6<i&&c[a]===1&&c[a+1]===0&&c[a+2]===1&&c[a+3]===1&&c[a+4]===1&&c[a+5]===0&&c[a+6]===1&&(l.isWhiteHorizontal(c,a-4,a)||l.isWhiteHorizontal(c,a+7,a+11))&&n++,o+6<s&&r[o][a]===1&&r[o+1][a]===0&&r[o+2][a]===1&&r[o+3][a]===1&&r[o+4][a]===1&&r[o+5][a]===0&&r[o+6][a]===1&&(l.isWhiteVertical(r,a,o-4,o)||l.isWhiteVertical(r,a,o+7,o+11))&&n++}return n*l.N3}static isWhiteHorizontal(t,n,r){n=Math.max(n,0),r=Math.min(r,t.length);for(let i=n;i<r;i++)if(t[i]===1)return!1;return!0}static isWhiteVertical(t,n,r,i){r=Math.max(r,0),i=Math.min(i,t.length);for(let s=r;s<i;s++)if(t[s][n]===1)return!1;return!0}static applyMaskPenaltyRule4(t){let n=0,r=t.getArray(),i=t.getWidth(),s=t.getHeight();for(let c=0;c<s;c++){let f=r[c];for(let g=0;g<i;g++)f[g]===1&&n++}let o=t.getHeight()*t.getWidth();return Math.floor(Math.abs(n*2-o)*10/o)*l.N4}static getDataMaskBit(t,n,r){let i,s;switch(t){case 0:i=r+n&1;break;case 1:i=r&1;break;case 2:i=n%3;break;case 3:i=(r+n)%3;break;case 4:i=Math.floor(r/2)+Math.floor(n/3)&1;break;case 5:s=r*n,i=(s&1)+s%3;break;case 6:s=r*n,i=(s&1)+s%3&1;break;case 7:s=r*n,i=s%3+(r+n&1)&1;break;default:throw new w("Invalid mask pattern: "+t)}return i===0}static applyMaskPenaltyRule1Internal(t,n){let r=0,i=n?t.getHeight():t.getWidth(),s=n?t.getWidth():t.getHeight(),o=t.getArray();for(let a=0;a<i;a++){let c=0,f=-1;for(let g=0;g<s;g++){let A=n?o[a][g]:o[g][a];A===f?c++:(c>=5&&(r+=l.N1+(c-5)),c=1,f=A)}c>=5&&(r+=l.N1+(c-5))}return r}}return l.N1=3,l.N2=3,l.N3=40,l.N4=10,l})();class Nn{constructor(e,t){this.width=e,this.height=t;let n=new Array(t);for(let r=0;r!==t;r++)n[r]=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)$.fill(t,e)}equals(e){if(!(e instanceof Nn))return!1;let t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,r=this.height;n<r;++n){let i=this.bytes[n],s=t.bytes[n];for(let o=0,a=this.width;o<a;++o)if(i[o]!==s[o])return!1}return!0}toString(){let e=new Ae;for(let t=0,n=this.height;t<n;++t){let r=this.bytes[t];for(let i=0,s=this.width;i<s;++i)switch(r[i]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(` 9`)}return e.toString()}}let _n=(()=>{class l{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 t=new Ae;return t.append(`<< 10`),t.append(" mode: "),t.append(this.mode?this.mode.toString():"null"),t.append(` 11 ecLevel: `),t.append(this.ecLevel?this.ecLevel.toString():"null"),t.append(` 12 version: `),t.append(this.version?this.version.toString():"null"),t.append(` 13 maskPattern: `),t.append(this.maskPattern.toString()),this.matrix?(t.append(` 14 matrix: 15`),t.append(this.matrix.toString())):t.append(` 16 matrix: null 17`),t.append(`>> 18`),t.toString()}setMode(t){this.mode=t}setECLevel(t){this.ecLevel=t}setVersion(t){this.version=t}setMaskPattern(t){this.maskPattern=t}setMatrix(t){this.matrix=t}static isValidMaskPattern(t){return t>=0&&t<l.NUM_MASK_PATTERNS}}return l.NUM_MASK_PATTERNS=8,l})(),Se=(()=>{class l extends M{}return l.kind="WriterException",l})();class Q{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){Q.clearMatrix(i),Q.embedBasicPatterns(n,i),Q.embedTypeInfo(t,r,i),Q.maybeEmbedVersionInfo(n,i),Q.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){Q.embedPositionDetectionPatternsAndSeparators(t),Q.embedDarkD
18otAtLeftBottomCorner(t),Q.maybeEmbedPositionAdjustmentPatterns(e,t),Q.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){let r=new oe;Q.makeTypeInfoBits(e,t,r);for(let i=0,s=r.getSize();i<s;++i){let o=r.get(r.getSize()-1-i),a=Q.TYPE_INFO_COORDINATES[i],c=a[0],f=a[1];if(n.setBoolean(c,f,o),i<8){let g=n.getWidth()-i-1;n.setBoolean(g,8,o)}else{let A=n.getHeight()-7+(i-8);n.setBoolean(8,A,o)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;let n=new oe;Q.makeVersionInfoBits(e,n);let r=17;for(let i=0;i<6;++i)for(let s=0;s<3;++s){let o=n.get(r);r--,t.setBoolean(i,t.getHeight()-11+s,o),t.setBoolean(t.getHeight()-11+s,i,o)}}static embedDataBits(e,t,n){let r=0,i=-1,s=n.getWidth()-1,o=n.getHeight()-1;for(;s>0;){for(s===6&&(s-=1);o>=0&&o<n.getHeight();){for(let a=0;a<2;++a){let c=s-a;if(!Q.isEmpty(n.get(c,o)))continue;let f;r<e.getSize()?(f=e.get(r),++r):f=!1,t!==255&&Qt.getDataMaskBit(t,c,o)&&(f=!f),n.setBoolean(c,o,f)}o+=i}i=-i,o+=i,s-=2}if(r!==e.getSize())throw new Se("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-X.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new w("0 polynomial");let n=Q.findMSBSet(t);for(e<<=n-1;Q.findMSBSet(e)>=n;)e^=t<<Q.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!_n.isValidMaskPattern(t))throw new Se("Invalid mask pattern");let r=e.getBits()<<3|t;n.appendBits(r,5);let i=Q.calculateBCHCode(r,Q.TYPE_INFO_POLY);n.appendBits(i,10);let s=new oe;if(s.appendBits(Q.TYPE_INFO_MASK_PATTERN,15),n.xor(s),n.getSize()!==15)throw new Se("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let n=Q.calculateBCHCode(e.getVersionNumber(),Q.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new Se("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;Q.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Q.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new Se;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Q.isEmpty(n.get(e+r,t)))throw new Se;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Q.isEmpty(n.get(e,t+r)))throw new Se;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){let i=Q.POSITION_ADJUSTMENT_PATTERN[r];for(let s=0;s<5;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){let i=Q.POSITION_DETECTION_PATTERN[r];for(let s=0;s<7;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPatternsAndSeparators(e){let t=Q.POSITION_DETECTION_PATTERN[0].length;Q.embedPositionDetectionPattern(0,0,e),Q.embedPositionDetectionPattern(e.getWidth()-t,0,e),Q.embedPositionDetectionPattern(0,e.getWidth()-t,e);let n=8;Q.embedHorizontalSeparationPattern(0,n-1,e),Q.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Q.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);let r=7;Q.embedVerticalSeparationPattern(r,0,e),Q.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Q.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;let n=e.getVersionNumber()-1,r=Q.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let i=0,s=r.length;i!==s;i++){let o=r[i];if(o>=0)for(let a=0;a!==s;a++){let c=r[a];c>=0&&Q.isEmpty(t.get(c,o))&&Q.embedPositionAdjustmentPattern(c-2,o-2,t)}}}}Q.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])]),Q.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])]),Q.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])]),Q.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])]),Q.VERSION_INFO_POLY=7973,Q.TYPE_INFO_POLY=1335,Q.TYPE_INFO_MASK_PATTERN=21522;class os{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Te{constructor(){}static calculateMaskPenalty(e){return Qt.applyMaskPenaltyRule1(e)+Qt.applyMaskPenaltyRule2(e)+Qt.applyMaskPenaltyRule3(e)+Qt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Te.DEFAULT_BYTE_MODE_ENCODING,i=n!==null&&n.get(Re.CHARACTER_SET)!==void 0;i&&(r=n.get(Re.CHARACTER_SET).toString());let s=this.chooseMode(e,r),o=new oe;if(s===W.BYTE&&(i||Te.DEFAULT_BYTE_MODE_ENCODING!==r)){let H=k.getCharacterSetECIByName(r);H!==void 0&&this.appendECI(H,o)}this.appendModeInfo(s,o);let a=new oe;this.appendBytes(e,s,a,r);let c;if(n!==null&&n.get(Re.QR_VERSION)!==void 0){let H=Number.parseInt(n.get(Re.QR_VERSION).toString(),10);c=j.getVersionForNumber(H);let R=this.calculateBitsNeeded(s,o,a,c);if(!this.willFit(R,c,t))throw new Se("Data too big for requested version")}else c=this.recommendVersion(t,s,o,a);let f=new oe;f.appendBitArray(o);let g=s===W.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(g,c,s,f),f.appendBitArray(a);let A=c.getECBlocksForLevel(t),E=c.getTotalCodewords()-A.getTotalECCodewords();this.terminateBits(E,f);let I=this.interleaveWithECBytes(f,c.getTotalCodewords(),E,A.getNumBlocks()),S=new _n;S.setECLevel(t),S.setMode(s),S.setVersion(c);let T=c.getDimensionForVersion(),N=new Nn(T,T),B=this.chooseMaskPattern(I,t,c,N);return S.setMaskPattern(B),Q.buildMatrix(I,t,c,B,N),S.setMatrix(N),S}static recommendVersion(e,t,n,r){let i=this.calculateBitsNeeded(t,n,r,j.getVersionForNumber(1)),s=this.chooseVersion(i,e),o=this.calculateBitsNeeded(t,n,r,s);return this.chooseVersion(o,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<Te.ALPHANUMERIC_TABLE.length?Te.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(k.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return W.KANJI;let n=!1,r=!1;for(let i=0,s=e.length;i<s;++i){let o=e.charAt(i);if(Te.isDigit(o))n=!0;
18else if(this.getAlphanumericCode(o.charCodeAt(0))!==-1)r=!0;else return W.BYTE}return r?W.ALPHANUMERIC:n?W.NUMERIC:W.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Qe.encode(e,k.SJIS)}catch{return!1}let n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){let i=t[r]&255;if((i<129||i>159)&&(i<224||i>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let o=0;o<_n.NUM_MASK_PATTERNS;o++){Q.buildMatrix(e,t,n,o,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,s=o)}return s}static chooseVersion(e,t){for(let n=1;n<=40;n++){let r=j.getVersionForNumber(n);if(Te.willFit(e,r,t))return r}throw new Se("Data too big")}static willFit(e,t,n){let r=t.getTotalCodewords(),s=t.getECBlocksForLevel(n).getTotalECCodewords(),o=r-s,a=(e+7)/8;return o>=a}static terminateBits(e,t){let n=e*8;if(t.getSize()>n)throw new Se("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let s=0;s<4&&t.getSize()<n;++s)t.appendBit(!1);let r=t.getSize()&7;if(r>0)for(let s=r;s<8;s++)t.appendBit(!1);let i=e-t.getSizeInBytes();for(let s=0;s<i;++s)t.appendBits((s&1)===0?236:17,8);if(t.getSize()!==n)throw new Se("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,s){if(r>=n)throw new Se("Block ID too large");let o=e%n,a=n-o,c=Math.floor(e/n),f=c+1,g=Math.floor(t/n),A=g+1,E=c-g,I=f-A;if(E!==I)throw new Se("EC bytes mismatch");if(n!==a+o)throw new Se("RS blocks mismatch");if(e!==(g+E)*a+(A+I)*o)throw new Se("Total bytes mismatch");r<a?(i[0]=g,s[0]=E):(i[0]=A,s[0]=I)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new Se("Number of bits and data bytes does not match");let i=0,s=0,o=0,a=new Array;for(let f=0;f<r;++f){let g=new Int32Array(1),A=new Int32Array(1);Te.getNumDataBytesAndNumECBytesForBlockID(t,n,r,f,g,A);let E=g[0],I=new Uint8Array(E);e.toBytes(8*i,I,0,E);let S=Te.generateECBytes(I,A[0]);a.push(new os(I,S)),s=Math.max(s,E),o=Math.max(o,S.length),i+=g[0]}if(n!==i)throw new Se("Data bytes does not match offset");let c=new oe;for(let f=0;f<s;++f)for(let g of a){let A=g.getDataBytes();f<A.length&&c.appendBits(A[f],8)}for(let f=0;f<o;++f)for(let g of a){let A=g.getErrorCorrectionBytes();f<A.length&&c.appendBits(A[f],8)}if(t!==c.getSizeInBytes())throw new Se("Interleaving error: "+t+" and "+c.getSizeInBytes()+" differ.");return c}static generateECBytes(e,t){let n=e.length,r=new Int32Array(n+t);for(let s=0;s<n;s++)r[s]=e[s]&255;new rr(de.QR_CODE_FIELD_256).encode(r,t);let i=new Uint8Array(t);for(let s=0;s<t;s++)i[s]=r[n+s];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){let i=n.getCharacterCountBits(t);if(e>=1<<i)throw new Se(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case W.NUMERIC:Te.appendNumericBytes(e,n);break;case W.ALPHANUMERIC:Te.appendAlphanumericBytes(e,n);break;case W.BYTE:Te.append8BitBytes(e,n,r);break;case W.KANJI:Te.appendKanjiBytes(e,n);break;default:throw new Se("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=Te.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let n=e.length,r=0;for(;r<n;){let i=Te.getDigit(e.charAt(r));if(r+2<n){let s=Te.getDigit(e.charAt(r+1)),o=Te.getDigit(e.charAt(r+2));t.appendBits(i*100+s*10+o,10),r+=3}else if(r+1<n){let s=Te.getDigit(e.charAt(r+1));t.appendBits(i*10+s,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){let n=e.length,r=0;for(;r<n;){let i=Te.getAlphanumericCode(e.charCodeAt(r));if(i===-1)throw new Se;if(r+1<n){let s=Te.getAlphanumericCode(e.charCodeAt(r+1));if(s===-1)throw new Se;t.appendBits(i*45+s,11),r+=2}else t.appendBits(i,6),r++}}static append8BitBytes(e,t,n){let r;try{r=Qe.encode(e,n)}catch(i){throw new Se(i)}for(let i=0,s=r.length;i!==s;i++){let o=r[i];t.appendBits(o,8)}}static appendKanjiBytes(e,t){let n;try{n=Qe.encode(e,k.SJIS)}catch(i){throw new Se(i)}let r=n.length;for(let i=0;i<r;i+=2){let s=n[i]&255,o=n[i+1]&255,a=s<<8&4294967295|o,c=-1;if(a>=33088&&a<=40956?c=a-33088:a>=57408&&a<=60351&&(c=a-49472),c===-1)throw new Se("Invalid byte sequence");let f=(c>>8)*192+(c&255);t.appendBits(f,13)}}static appendECI(e,t){t.appendBits(W.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Te.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]),Te.DEFAULT_BYTE_MODE_ENCODING=k.UTF8.getName();let as=(()=>{class l{write(t,n,r,i=null){if(t.length===0)throw new w("Found empty contents");if(n<0||r<0)throw new w("Requested dimensions are too small: "+n+"x"+r);let s=Ie.L,o=l.QUIET_ZONE_SIZE;i!==null&&(i.get(Re.ERROR_CORRECTION)!==void 0&&(s=Ie.fromString(i.get(Re.ERROR_CORRECTION).toString())),i.get(Re.MARGIN)!==void 0&&(o=Number.parseInt(i.get(Re.MARGIN).toString(),10)));let a=Te.encode(t,s,i);return this.renderResult(a,n,r,o)}writeToDom(t,n,r,i,s=null){typeof t=="string"&&(t=document.querySelector(t));let o=this.write(n,r,i,s);t&&t.appendChild(o)}renderResult(t,n,r,i){let s=t.getMatrix();if(s===null)throw new It;
18let o=s.getWidth(),a=s.getHeight(),c=o+i*2,f=a+i*2,g=Math.max(n,c),A=Math.max(r,f),E=Math.min(Math.floor(g/c),Math.floor(A/f)),I=Math.floor((g-o*E)/2),S=Math.floor((A-a*E)/2),T=this.createSVGElement(g,A);for(let N=0,B=S;N<a;N++,B+=E)for(let H=0,R=I;H<o;H++,R+=E)if(s.get(H,N)===1){let re=this.createSvgRectElement(R,B,E,E);T.appendChild(re)}return T}createSVGElement(t,n){let r=document.createElementNS(l.SVG_NS,"svg");return r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"width",n.toString()),r}createSvgRectElement(t,n,r,i){let s=document.createElementNS(l.SVG_NS,"rect");return s.setAttributeNS(null,"x",t.toString()),s.setAttributeNS(null,"y",n.toString()),s.setAttributeNS(null,"height",r.toString()),s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"fill","#000000"),s}}return l.QUIET_ZONE_SIZE=4,l.SVG_NS="http://www.w3.org/2000/svg",l})(),Ur=(()=>{class l{encode(t,n,r,i,s){if(t.length===0)throw new w("Found empty contents");if(n!==Z.QR_CODE)throw new w("Can only encode QR_CODE, but got "+n);if(r<0||i<0)throw new w(`Requested dimensions are too small: ${r}x${i}`);let o=Ie.L,a=l.QUIET_ZONE_SIZE;s!==null&&(s.get(Re.ERROR_CORRECTION)!==void 0&&(o=Ie.fromString(s.get(Re.ERROR_CORRECTION).toString())),s.get(Re.MARGIN)!==void 0&&(a=Number.parseInt(s.get(Re.MARGIN).toString(),10)));let c=Te.encode(t,o,s);return l.renderResult(c,r,i,a)}static renderResult(t,n,r,i){let s=t.getMatrix();if(s===null)throw new It;let o=s.getWidth(),a=s.getHeight(),c=o+i*2,f=a+i*2,g=Math.max(n,c),A=Math.max(r,f),E=Math.min(Math.floor(g/c),Math.floor(A/f)),I=Math.floor((g-o*E)/2),S=Math.floor((A-a*E)/2),T=new Le(g,A);for(let N=0,B=S;N<a;N++,B+=E)for(let H=0,R=I;H<o;H++,R+=E)s.get(H,N)===1&&T.setRegion(R,B,E,E);return T}}return l.QUIET_ZONE_SIZE=4,l})();class cs{encode(e,t,n,r,i){let s;if(t===Z.QR_CODE)s=new Ur;else throw new w("No encoder available for format "+t);return s.encode(e,t,n,r,i)}}let ls=(()=>{class l extends rn{constructor(t,n,r,i,s,o,a,c){if(super(o,a),this.yuvData=t,this.dataWidth=n,this.dataHeight=r,this.left=i,this.top=s,i+o>n||s+a>r)throw new w("Crop rectangle does not fit within image data.");c&&this.reverseHorizontal(o,a)}getRow(t,n){if(t<0||t>=this.getHeight())throw new w("Requested row is outside the image: "+t);let r=this.getWidth();(n==null||n.length<r)&&(n=new Uint8ClampedArray(r));let i=(t+this.top)*this.dataWidth+this.left;return Y.arraycopy(this.yuvData,i,n,0,r),n}getMatrix(){let t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;let r=t*n,i=new Uint8ClampedArray(r),s=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return Y.arraycopy(this.yuvData,s,i,0,r),i;for(let o=0;o<n;o++){let a=o*t;Y.arraycopy(this.yuvData,s,i,a,t),s+=this.dataWidth}return i}isCropSupported(){return!0}crop(t,n,r,i){return new l(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,r,i,!1)}renderThumbnail(){let t=this.getWidth()/l.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/l.THUMBNAIL_SCALE_FACTOR,r=new Int32Array(t*n),i=this.yuvData,s=this.top*this.dataWidth+this.left;for(let o=0;o<n;o++){let a=o*t;for(let c=0;c<t;c++){let f=i[s+c*l.THUMBNAIL_SCALE_FACTOR]&255;r[a+c]=4278190080|f*65793}s+=this.dataWidth*l.THUMBNAIL_SCALE_FACTOR}return r}getThumbnailWidth(){return this.getWidth()/l.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/l.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(t,n){let r=this.yuvData;for(let i=0,s=this.top*this.dataWidth+this.left;i<n;i++,s+=this.dataWidth){let o=s+t/2;for(let a=s,c=s+t-1;a<o;a++,c--){let f=r[a];r[a]=r[c],r[c]=f}}}invert(){return new yt(this)}}return l.THUMBNAIL_SCALE_FACTOR=2,l})();class ir extends rn{constructor(e,t,n,r,i,s,o){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=s,this.top=o,e.BYTES_PER_ELEMENT===4){let a=t*n,c=new Uint8ClampedArray(a);for(let f=0;f<a;f++){let g=e[f],A=g>>16&255,E=g>>7&510,I=g&255;c[f]=(A+E+I)/4&255}this.luminances=c}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),i===void 0&&(this.dataHeight=n),s===void 0&&(this.left=0),o===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new w("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new w("Requested row is outside the image: "+e);let n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));let r=(e+this.top)*this.dataWidth+this.left;return Y.arraycopy(this.luminances,r,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,r=new Uint8ClampedArray(n),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return Y.arraycopy(this.luminances,i,r,0,n),r;for(let s=0;s<t;s++){let o=s*e;Y.arraycopy(this.luminances,i,r,o,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new ir(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new yt(this)}}class Hr extends k{static forName(e){return this.getCharacterSetECIByName(e)}}class sr{}sr.ISO_8859_1=k.ISO8859_1;class Vr{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}
18getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class zr{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class us{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Kt extends us{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 Kt(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Kt(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+X.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class or extends Kt{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 or(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function hs(l,e,t){return new or(l,e,t)}function xn(l,e,t){return new Kt(l,e,t)}let fs=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Rt=0,Mn=1,ot=2,Gr=3,At=4,ds=new Kt(null,0,0),ar=[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 gs(l){for(let e of l)$.fill(e,-1);return l[Rt][At]=0,l[Mn][At]=0,l[Mn][Rt]=28,l[Gr][At]=0,l[ot][At]=0,l[ot][Rt]=15,l}let jr=gs($.createInt32Array(6,6));class Ct{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let s=ar[this.mode][e];r=xn(r,s&65535,s>>16),n+=s>>16}let i=e===ot?4:5;return r=xn(r,t,i),new Ct(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===ot?4:5;return n=xn(n,jr[this.mode][e],r),n=xn(n,t,5),new Ct(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===At||this.mode===ot){let o=ar[n][Rt];t=xn(t,o&65535,o>>16),r+=o>>16,n=Rt}let i=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new Ct(t,n,this.binaryShiftByteCount+1,r+i);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=hs(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Ct(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(ar[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Ct.calculateBinaryShiftCost(e)-Ct.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new oe;for(let r of t)r.appendTo(n,e);return n}toString(){return q.format("%s bits=%d bytes=%d",fs[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Ct.INITIAL_STATE=new Ct(ds,Rt,0,0);function xs(l){let e=q.getCharCode(" "),t=q.getCharCode("."),n=q.getCharCode(",");l[Rt][e]=1;let r=q.getCharCode("Z"),i=q.getCharCode("A");for(let A=i;A<=r;A++)l[Rt][A]=A-i+2;l[Mn][e]=1;let s=q.getCharCode("z"),o=q.getCharCode("a");for(let A=o;A<=s;A++)l[Mn][A]=A-o+2;l[ot][e]=1;let a=q.getCharCode("9"),c=q.getCharCode("0");for(let A=c;A<=a;A++)l[ot][A]=A-c+2;l[ot][n]=12,l[ot][t]=13;let f=["\0"," ","�","�","�","�","�","�","\x07","\b"," ",` 19`,"\v","\f","\r","\x1B","�","�","�","�","@","\\","^","_","`","|","~","\x7F"];for(let A=0;A<f.length;A++)l[Gr][q.getCharCode(f[A])]=A;let g=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let A=0;A<g.length;A++)q.getCharCode(g[A])>0&&(l[At][q.getCharCode(g[A])]=A);return l}let cr=xs($.createInt32Array(5,256));class mn{constructor(e){this.text=e}encode(){let e=q.getCharCode(" "),t=q.getCharCode(` 20`),n=zr.singletonList(Ct.INITIAL_STATE);for(let i=0;i<this.text.length;i++){let s,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case q.getCharCode("\r"):s=o===t?2:0;break;case q.getCharCode("."):s=o===e?3:0;break;case q.getCharCode(","):s=o===e?4:0;break;case q.getCharCode(":"):s=o===e?5:0;break;default:s=0}s>0?(n=mn.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}
20return zr.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let n=[];for(let r of e)this.updateStateForChar(r,t,n);return mn.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=cr[e.getMode()][r]>0,s=null;for(let o=0;o<=At;o++){let a=cr[o][r];if(a>0){if(s==null&&(s=e.endBinaryShift(t)),!i||o===e.getMode()||o===ot){let c=s.latchAndAppend(o,a);n.push(c)}if(!i&&jr[e.getMode()][o]>=0){let c=s.shiftAndAppend(o,a);n.push(c)}}}if(e.getBinaryShiftByteCount()>0||cr[e.getMode()][r]===0){let o=e.addBinaryShiftChar(t);n.push(o)}}static updateStateListForPair(e,t,n){let r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(At,n)),e.getMode()!==At&&r.push(i.shiftAndAppend(At,n)),n===3||n===4){let s=i.latchAndAppend(ot,16-n).latchAndAppend(ot,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(let n of e){let r=!0;for(let i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class ue{constructor(){}static encodeBytes(e){return ue.encode(e,ue.DEFAULT_EC_PERCENT,ue.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new mn(e).encode(),i=X.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,o,a,c,f,g;if(n!==ue.DEFAULT_AZTEC_LAYERS){if(o=n<0,a=Math.abs(n),a>(o?ue.MAX_NB_BITS_COMPACT:ue.MAX_NB_BITS))throw new w(q.format("Illegal value %s for layers",n));c=ue.totalBitsInLayer(a,o),f=ue.WORD_SIZE[a];let R=c-c%f;if(g=ue.stuffBits(r,f),g.getSize()+i>R)throw new w("Data to large for user specified layer");if(o&&g.getSize()>f*64)throw new w("Data to large for user specified layer")}else{f=0,g=null;for(let R=0;;R++){if(R>ue.MAX_NB_BITS)throw new w("Data too large for an Aztec code");if(o=R<=3,a=o?R+1:R,c=ue.totalBitsInLayer(a,o),s>c)continue;(g==null||f!==ue.WORD_SIZE[a])&&(f=ue.WORD_SIZE[a],g=ue.stuffBits(r,f));let re=c-c%f;if(!(o&&g.getSize()>f*64)&&g.getSize()+i<=re)break}}let A=ue.generateCheckWords(g,c,f),E=g.getSize()/f,I=ue.generateModeMessage(o,a,E),S=(o?11:14)+a*4,T=new Int32Array(S),N;if(o){N=S;for(let R=0;R<T.length;R++)T[R]=R}else{N=S+1+2*X.truncDivision(X.truncDivision(S,2)-1,15);let R=X.truncDivision(S,2),re=X.truncDivision(N,2);for(let J=0;J<R;J++){let Je=J+X.truncDivision(J,15);T[R-J-1]=re-Je-1,T[R+J]=re+Je+1}}let B=new Le(N);for(let R=0,re=0;R<a;R++){let J=(a-R)*4+(o?9:12);for(let Je=0;Je<J;Je++){let gt=Je*2;for(let $e=0;$e<2;$e++)A.get(re+gt+$e)&&B.set(T[R*2+$e],T[R*2+Je]),A.get(re+J*2+gt+$e)&&B.set(T[R*2+Je],T[S-1-R*2-$e]),A.get(re+J*4+gt+$e)&&B.set(T[S-1-R*2-$e],T[S-1-R*2-Je]),A.get(re+J*6+gt+$e)&&B.set(T[S-1-R*2-Je],T[R*2+$e])}re+=J*8}if(ue.drawModeMessage(B,o,N,I),o)ue.drawBullsEye(B,X.truncDivision(N,2),5);else{ue.drawBullsEye(B,X.truncDivision(N,2),7);for(let R=0,re=0;R<X.truncDivision(S,2)-1;R+=15,re+=16)for(let J=X.truncDivision(N,2)&1;J<N;J+=2)B.set(X.truncDivision(N,2)-re,J),B.set(X.truncDivision(N,2)+re,J),B.set(J,X.truncDivision(N,2)-re),B.set(J,X.truncDivision(N,2)+re)}let H=new Vr;return H.setCompact(o),H.setSize(N),H.setLayers(a),H.setCodeWords(E),H.setMatrix(B),H}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let i=t-r;i<=t+r;i++)e.set(i,t-r),e.set(i,t+r),e.set(t-r,i),e.set(t+r,i);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 r=new oe;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ue.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ue.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=X.truncDivision(n,2);if(t)for(let s=0;s<7;s++){let o=i-3+s;r.get(s)&&e.set(o,i-5),r.get(s+7)&&e.set(i+5,o),r.get(20-s)&&e.set(o,i+5),r.get(27-s)&&e.set(i-5,o)}else for(let s=0;s<10;s++){let o=i-5+s+X.truncDivision(s,5);r.get(s)&&e.set(o,i-7),r.get(s+10)&&e.set(i+7,o),r.get(29-s)&&e.set(o,i+7),r.get(39-s)&&e.set(i-7,o)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new rr(ue.getGF(n)),s=X.truncDivision(t,n),o=ue.bitsToWords(e,n,s);i.encode(o,s-r);let a=t%n,c=new oe;c.appendBits(0,a);for(let f of Array.from(o))c.appendBits(f,n);return c}static bitsToWords(e,t,n){let r=new Int32Array(n),i,s;for(i=0,s=e.getSize()/t;i<s;i++){let o=0;for(let a=0;a<t;a++)o|=e.get(i*t+a)?1<<t-a-1:0;r[i]=o}return r}static getGF(e){switch(e){case 4:return de.AZTEC_PARAM;case 6:return de.AZTEC_DATA_6;case 8:return de.AZTEC_DATA_8;case 10:return de.AZTEC_DATA_10;case 12:return de.AZTEC_DATA_12;default:throw new w("Unsupported word size "+e)}}static stuffBits(e,t){let n=new oe,r=e.getSize(),i=(1<<t)-2;for(let s=0;s<r;s+=t){let o=0;for(let a=0;a<t;a++)(s+a>=r||e.get(s+a))&&(o|=1<<t-1-a);(o&i)===i?(n.appendBits(o&i,t),s--):(o&i)===0?(n.appendBits(o|1,t),s--):n.appendBits(o,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ue.DEFAULT_EC_PERCENT=33,ue.DEFAULT_AZTEC_LAYERS=0,ue.MAX_NB_BITS=32,ue.MAX_NB_BITS_COMPACT=4,ue.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 Dn{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let s=sr.ISO_8859_1,o=ue.DEFAULT_EC_PERCENT,a=ue.DEFAULT_AZTEC_LAYERS;return i!=null&&(i.has(Re.CHARACTER_SET)&&(s=Hr.forName(i.get(Re.CHARACTER_SET).toString())),i.has(Re.ERROR_CORRECTION)&&(o=X.parseInt(i.get(Re.ERROR_CORRECTION).toString())),i.has(Re.AZTEC_LAYERS)&&(a=X.parseInt(i.get(Re.AZTEC_LAYERS).toString()))),Dn.encodeLayers(e,t,n,r,s,o,a)}static encodeLayers(e,t,n,r,i,s,o){if(t!==Z.AZTEC)throw new w("Can only encode AZTEC, but got "+t);let a=ue.encode(q.getBytes(e,i),s,o);return Dn.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new It;
20let i=r.getWidth(),s=r.getHeight(),o=Math.max(t,i),a=Math.max(n,s),c=Math.min(o/i,a/s),f=(o-i*c)/2,g=(a-s*c)/2,A=new Le(o,a);for(let E=0,I=g;E<s;E++,I+=c)for(let S=0,T=f;S<i;S++,T+=c)r.get(S,E)&&A.setRegion(T,I,c,c);return A}}u.AbstractExpandedDecoder=Yn,u.ArgumentException=O,u.ArithmeticException=Hn,u.AztecCode=Vr,u.AztecCodeReader=pn,u.AztecCodeWriter=Dn,u.AztecDecoder=Vn,u.AztecDetector=Sr,u.AztecDetectorResult=Er,u.AztecEncoder=ue,u.AztecHighLevelEncoder=mn,u.AztecPoint=Ye,u.BarcodeFormat=Z,u.Binarizer=fe,u.BinaryBitmap=D,u.BitArray=oe,u.BitMatrix=Le,u.BitSource=qn,u.BrowserAztecCodeReader=Ri,u.BrowserBarcodeReader=Vi,u.BrowserCodeReader=Lt,u.BrowserDatamatrixCodeReader=Gi,u.BrowserMultiFormatReader=rs,u.BrowserPDF417Reader=is,u.BrowserQRCodeReader=ss,u.BrowserQRCodeSvgWriter=as,u.CharacterSetECI=k,u.ChecksumException=P,u.Code128Reader=U,u.Code39Reader=Gn,u.DataMatrixDecodedBitStreamParser=Mt,u.DataMatrixReader=yn,u.DecodeHintType=ae,u.DecoderResult=sn,u.DefaultGridSampler=Ir,u.DetectorResult=An,u.EAN13Reader=En,u.EncodeHintType=Re,u.Exception=M,u.FormatException=F,u.GenericGF=de,u.GenericGFPoly=Ke,u.GlobalHistogramBinarizer=Be,u.GridSampler=zn,u.GridSamplerInstance=bt,u.HTMLCanvasElementLuminanceSource=Tt,u.HybridBinarizer=ee,u.ITFReader=Ce,u.IllegalArgumentException=w,u.IllegalStateException=It,u.InvertedLuminanceSource=yt,u.LuminanceSource=rn,u.MathUtils=le,u.MultiFormatOneDReader=Zt,u.MultiFormatReader=Fr,u.MultiFormatWriter=cs,u.NotFoundException=v,u.OneDReader=Oe,u.PDF417DecodedBitStreamParser=_,u.PDF417DecoderErrorCorrection=Or,u.PDF417Reader=Ve,u.PDF417ResultMetadata=Lr,u.PerspectiveTransform=lt,u.PlanarYUVLuminanceSource=ls,u.QRCodeByteMatrix=Nn,u.QRCodeDataMask=st,u.QRCodeDecodedBitStreamParser=Mr,u.QRCodeDecoderErrorCorrectionLevel=Ie,u.QRCodeDecoderFormatInformation=je,u.QRCodeEncoder=Te,u.QRCodeEncoderQRCode=_n,u.QRCodeMaskUtil=Qt,u.QRCodeMatrixUtil=Q,u.QRCodeMode=W,u.QRCodeReader=Dt,u.QRCodeVersion=j,u.QRCodeWriter=Ur,u.RGBLuminanceSource=ir,u.RSS14Reader=Me,u.RSSExpandedReader=L,u.ReaderException=nr,u.ReedSolomonDecoder=cn,u.ReedSolomonEncoder=rr,u.ReedSolomonException=an,u.Result=We,u.ResultMetadataType=Pe,u.ResultPoint=G,u.StringUtils=q,u.UnsupportedOperationException=nn,u.VideoInputDevice=Ar,u.WhiteRectangleDetector=Cn,u.WriterException=Se,u.ZXingArrays=$,u.ZXingCharset=Hr,u.ZXingInteger=X,u.ZXingStandardCharsets=sr,u.ZXingStringBuilder=Ae,u.ZXingStringEncoding=Qe,u.ZXingSystem=Y,u.createAbstractExpandedDecoder=_r,Object.defineProperty(u,"__esModule",{value:!0})})});var V=(function(u){return u[u.QR_CODE=0]="QR_CODE",u[u.AZTEC=1]="AZTEC",u[u.CODABAR=2]="CODABAR",u[u.CODE_39=3]="CODE_39",u[u.CODE_93=4]="CODE_93",u[u.CODE_128=5]="CODE_128",u[u.DATA_MATRIX=6]="DATA_MATRIX",u[u.MAXICODE=7]="MAXICODE",u[u.ITF=8]="ITF",u[u.EAN_13=9]="EAN_13",u[u.EAN_8=10]="EAN_8",u[u.PDF_417=11]="PDF_417",u[u.RSS_14=12]="RSS_14",u[u.RSS_EXPANDED=13]="RSS_EXPANDED",u[u.UPC_A=14]="UPC_A",u[u.UPC_E=15]="UPC_E",u[u.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION",u})(V||{}),ni=new Map([[V.QR_CODE,"QR_CODE"],[V.AZTEC,"AZTEC"],[V.CODABAR,"CODABAR"],[V.CODE_39,"CODE_39"],[V.CODE_93,"CODE_93"],[V.CODE_128,"CODE_128"],[V.DATA_MATRIX,"DATA_MATRIX"],[V.MAXICODE,"MAXICODE"],[V.ITF,"ITF"],[V.EAN_13,"EAN_13"],[V.EAN_8,"EAN_8"],[V.PDF_417,"PDF_417"],[V.RSS_14,"RSS_14"],[V.RSS_EXPANDED,"RSS_EXPANDED"],[V.UPC_A,"UPC_A"],[V.UPC_E,"UPC_E"],[V.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function ri(u){return Object.values(V).includes(u)}var Et=(function(u){return u[u.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",u[u.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE",u})(Et||{}),tt=(function(){function u(){}return u.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",u.SCAN_DEFAULT_FPS=2,u.DEFAULT_DISABLE_FLIP=!1,u.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,u.DEFAULT_SUPPORTED_SCAN_TYPE=[Et.SCAN_TYPE_CAMERA,Et.SCAN_TYPE_FILE],u})();var Ln=(function(){function u(h,d){this.format=h,this.formatName=d}return u.prototype.toString=function(){return this.formatName},u.create=function(h){if(!ni.has(h))throw"".concat(h," not in html5QrcodeSupportedFormatsTextMap");return new u(h,ni.get(h))},u})();var lr=(function(){function u(){}return u.createFromText=function(h){var d={text:h};return{decodedText:h,result:d}},u.createFromQrcodeResult=function(h){return{decodedText:h.text,result:h}},u})();var ii=(function(u){return u[u.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",u[u.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",u[u.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR",u})(ii||{}),Bn=(function(){function u(){}return u.createFrom=function(h){return{errorMessage:h,type:ii.UNKWOWN_ERROR}},u})();var Pn=(function(){function u(h){this.verbose=h}return u.prototype.log=function(h){this.verbose&&console.log(h)},u.prototype.warn=function(h){this.verbose&&console.warn(h)},u.prototype.logError=function(h,d){(this.verbose||d===!0)&&console.error(h)},u.prototype.logErrors=function(h){if(h.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(h)},u})();function at(u){return typeof u>"u"||u===null}function si(u,h,d){return u>d?d:u<h?h:u}var vt=(function(){function u(){}return u.codeParseError=function(h){return"QR code parse error, error = ".concat(h)},u.errorGettingUserMedia=function(h){return"Error getting userMedia, error = ".concat(h)},u.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},u.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},u.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},u.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},u.scannerPaused=function(){return"Scanner paused"},u})();var ce=(function(){function u(){}return u.scanningStatus=function(){return"Scanning"},u.idleStatus=function(){return"Idle"},u.errorStatus=function(){return"Error"},u.permissionStatus=function(){return"Permission"},u.noCameraFoundErrorStatus=function(){return"No Cameras"},u.lastMatch=function(h){return"Last Match: ".concat(h)},u.codeScannerTitle=function(){return"Code Scanner"},u.cameraPermissionTitle=function(){return"Request Camera Permissions"},u.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},u.noCameraFound=function(){return"No camera found"},u.scanButtonStopScanningText=function(){return"Stop Scanning"}
20,u.scanButtonStartScanningText=function(){return"Start Scanning"},u.torchOnButton=function(){return"Switch On Torch"},u.torchOffButton=function(){return"Switch Off Torch"},u.torchOnFailedMessage=function(){return"Failed to turn on torch"},u.torchOffFailedMessage=function(){return"Failed to turn off torch"},u.scanButtonScanningStarting=function(){return"Launching Camera..."},u.textIfCameraScanSelected=function(){return"Scan an Image File"},u.textIfFileScanSelected=function(){return"Scan using camera directly"},u.selectCamera=function(){return"Select Camera"},u.fileSelectionChooseImage=function(){return"Choose Image"},u.fileSelectionChooseAnother=function(){return"Choose Another"},u.fileSelectionNoImageSelected=function(){return"No image choosen"},u.anonymousCameraPrefix=function(){return"Anonymous Camera"},u.dragAndDropMessage=function(){return"Or drop an image to scan"},u.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},u.zoom=function(){return"zoom"},u.loadingImage=function(){return"Loading image..."},u.cameraScanAltText=function(){return"Camera based scan"},u.fileScanAltText=function(){return"Fule based scan"},u})();var ur=(function(){function u(){}return u.poweredBy=function(){return"Powered by "},u.reportIssues=function(){return"Report issues"},u})();var hr=(function(){function u(){}return u.isMediaStreamConstraintsValid=function(h,d){if(typeof h!="object"){var m=typeof h;return d.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(m,"."),!0),!1}for(var C=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],x=new Set(C),y=Object.keys(h),M=0,O=y;M<O.length;M++){var w=O[M];if(x.has(w))return d.logError("".concat(w," is not supported videoConstaints."),!0),!1}return!0},u})();var we=Cs(ai());var fr=(function(){function u(h,d,m){if(this.formatMap=new Map([[V.QR_CODE,we.BarcodeFormat.QR_CODE],[V.AZTEC,we.BarcodeFormat.AZTEC],[V.CODABAR,we.BarcodeFormat.CODABAR],[V.CODE_39,we.BarcodeFormat.CODE_39],[V.CODE_93,we.BarcodeFormat.CODE_93],[V.CODE_128,we.BarcodeFormat.CODE_128],[V.DATA_MATRIX,we.BarcodeFormat.DATA_MATRIX],[V.MAXICODE,we.BarcodeFormat.MAXICODE],[V.ITF,we.BarcodeFormat.ITF],[V.EAN_13,we.BarcodeFormat.EAN_13],[V.EAN_8,we.BarcodeFormat.EAN_8],[V.PDF_417,we.BarcodeFormat.PDF_417],[V.RSS_14,we.BarcodeFormat.RSS_14],[V.RSS_EXPANDED,we.BarcodeFormat.RSS_EXPANDED],[V.UPC_A,we.BarcodeFormat.UPC_A],[V.UPC_E,we.BarcodeFormat.UPC_E],[V.UPC_EAN_EXTENSION,we.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!we)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=d,this.logger=m;var C=this.createZXingFormats(h),x=new Map;x.set(we.DecodeHintType.POSSIBLE_FORMATS,C),x.set(we.DecodeHintType.TRY_HARDER,!1),this.hints=x}return u.prototype.decodeAsync=function(h){var d=this;return new Promise(function(m,C){try{m(d.decode(h))}catch(x){C(x)}})},u.prototype.decode=function(h){var d=new we.MultiFormatReader(this.verbose,this.hints),m=new we.HTMLCanvasElementLuminanceSource(h),C=new we.BinaryBitmap(new we.HybridBinarizer(m)),x=d.decode(C);return{text:x.text,format:Ln.create(this.toHtml5QrcodeSupportedFormats(x.format)),debugData:this.createDebugData()}},u.prototype.createReverseFormatMap=function(){var h=new Map;return this.formatMap.forEach(function(d,m,C){h.set(d,m)}),h},u.prototype.toHtml5QrcodeSupportedFormats=function(h){if(!this.reverseFormatMap.has(h))throw"reverseFormatMap doesn't have ".concat(h);return this.reverseFormatMap.get(h)},u.prototype.createZXingFormats=function(h){for(var d=[],m=0,C=h;m<C.length;m++){var x=C[m];this.formatMap.has(x)?d.push(this.formatMap.get(x)):this.logger.logError("".concat(x," is not supported by")+"ZXingHtml5QrcodeShim")}return d},u.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},u})();var ps=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},Es=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];
20return{value:w[0]?w[1]:void 0,done:!0}}},dr=(function(){function u(h,d,m){if(this.formatMap=new Map([[V.QR_CODE,"qr_code"],[V.AZTEC,"aztec"],[V.CODABAR,"codabar"],[V.CODE_39,"code_39"],[V.CODE_93,"code_93"],[V.CODE_128,"code_128"],[V.DATA_MATRIX,"data_matrix"],[V.ITF,"itf"],[V.EAN_13,"ean_13"],[V.EAN_8,"ean_8"],[V.PDF_417,"pdf417"],[V.UPC_A,"upc_a"],[V.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!u.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=d,this.logger=m;var C=this.createBarcodeDetectorFormats(h);if(this.detector=new BarcodeDetector(C),!this.detector)throw"BarcodeDetector detector not supported"}return u.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var h=new BarcodeDetector({formats:["qr_code"]});return typeof h<"u"},u.prototype.decodeAsync=function(h){return ps(this,void 0,void 0,function(){var d,m;return Es(this,function(C){switch(C.label){case 0:return[4,this.detector.detect(h)];case 1:if(d=C.sent(),!d||d.length===0)throw"No barcode or QR code detected.";return m=this.selectLargestBarcode(d),[2,{text:m.rawValue,format:Ln.create(this.toHtml5QrcodeSupportedFormats(m.format)),debugData:this.createDebugData()}]}})})},u.prototype.selectLargestBarcode=function(h){for(var d=null,m=0,C=0,x=h;C<x.length;C++){var y=x[C],M=y.boundingBox.width*y.boundingBox.height;M>m&&(m=M,d=y)}if(!d)throw"No largest barcode found";return d},u.prototype.createBarcodeDetectorFormats=function(h){for(var d=[],m=0,C=h;m<C.length;m++){var x=C[m];this.formatMap.has(x)?d.push(this.formatMap.get(x)):this.logger.warn("".concat(x," is not supported by")+"BarcodeDetectorDelegate")}return{formats:d}},u.prototype.toHtml5QrcodeSupportedFormats=function(h){if(!this.reverseFormatMap.has(h))throw"reverseFormatMap doesn't have ".concat(h);return this.reverseFormatMap.get(h)},u.prototype.createReverseFormatMap=function(){var h=new Map;return this.formatMap.forEach(function(d,m,C){h.set(d,m)}),h},u.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},u})();var ci=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},li=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},ui=(function(){function u(h,d,m,C){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=m,d&&dr.isSupported()?(this.primaryDecoder=new dr(h,m,C),this.secondaryDecoder=new fr(h,m,C)):this.primaryDecoder=new fr(h,m,C)}return u.prototype.decodeAsync=function(h){return ci(this,void 0,void 0,function(){var d;return li(this,function(m){switch(m.label){case 0:d=performance.now(),m.label=1;case 1:return m.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(h)];case 2:return[2,m.sent()];case 3:return this.possiblyLogPerformance(d),[7];case 4:return[2]}})})},u.prototype.decodeRobustlyAsync=function(h){return ci(this,void 0,void 0,function(){var d,m;return li(this,function(C){switch(C.label){case 0:d=performance.now(),C.label=1;case 1:return C.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(h)];case 2:return[2,C.sent()];
20case 3:if(m=C.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(h)];throw m;case 4:return this.possiblyLogPerformance(d),[7];case 5:return[2]}})})},u.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},u.prototype.possiblyLogPerformance=function(h){if(this.verbose){var d=performance.now()-h;this.executionResults.push(d),this.executions++,this.possiblyFlushPerformanceReport()}},u.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var h=0,d=0,m=this.executionResults;d<m.length;d++){var C=m[d];h+=C}var x=h/this.executionResults.length;console.log("".concat(x," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},u})();var gr=(function(){var u=function(h,d){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,C){m.__proto__=C}||function(m,C){for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(m[x]=C[x])},u(h,d)};return function(h,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");u(h,d);function m(){this.constructor=h}h.prototype=d===null?Object.create(d):(m.prototype=d.prototype,new m)}})(),kn=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},Un=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},hi=(function(){function u(h,d){this.name=h,this.track=d}return u.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},u.prototype.apply=function(h){var d={};d[this.name]=h;var m={advanced:[d]};return this.track.applyConstraints(m)},u.prototype.value=function(){var h=this.track.getSettings();if(this.name in h){var d=h[this.name];return d}return null},u})(),Is=(function(u){gr(h,u);function h(d,m){return u.call(this,d,m)||this}return h.prototype.min=function(){return this.getCapabilities().min},h.prototype.max=function(){return this.getCapabilities().max},h.prototype.step=function(){return this.getCapabilities().step},h.prototype.apply=function(d){var m={};m[this.name]=d;var C={advanced:[m]};return this.track.applyConstraints(C)},h.prototype.getCapabilities=function(){this.failIfNotSupported();var d=this.track.getCapabilities(),m=d[this.name];return{min:m.min,max:m.max,step:m.step}},h.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},h})(hi),Ss=(function(u){gr(h,u);function h(d){return u.call(this,"zoom",d)||this}return h})(Is),ys=(function(u){gr(h,u);function h(d){return u.call(this,"torch",d)||this}return h})(hi),Ts=(function(){function u(h){this.track=h}return u.prototype.zoomFeature=function(){return new Ss(this.track)},u.prototype.torchFeature=function(){return new ys(this.track)},u})(),bs=(function(){function u(h,d,m){this.isClosed=!1,this.parentElement=h,this.mediaStream=d,this.callbacks=m,this.surface=this.createVideoElement(this.parentElement.clientWidth),h.append(this.surface)}return u.prototype.createVideoElement=function(h){var d=document.createElement("video");return d.style.width="".concat(h,"px"),d.style.display="block",d.muted=!0,d.setAttribute("muted","true"),d.playsInl
20ine=!0,d},u.prototype.setupSurface=function(){var h=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var d=function(){var m=h.surface.clientWidth,C=h.surface.clientHeight;h.callbacks.onRenderSurfaceReady(m,C),h.surface.removeEventListener("playing",d)};this.surface.addEventListener("playing",d),this.surface.srcObject=this.mediaStream,this.surface.play()},u.create=function(h,d,m,C){return kn(this,void 0,void 0,function(){var x,y;return Un(this,function(M){switch(M.label){case 0:return x=new u(h,d,C),m.aspectRatio?(y={aspectRatio:m.aspectRatio},[4,x.getFirstTrackOrFail().applyConstraints(y)]):[3,2];case 1:M.sent(),M.label=2;case 2:return x.setupSurface(),[2,x]}})})},u.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},u.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},u.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},u.prototype.resume=function(h){this.failIfClosed();var d=this,m=function(){setTimeout(h,200),d.surface.removeEventListener("playing",m)};this.surface.addEventListener("playing",m),this.surface.play()},u.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},u.prototype.getSurface=function(){return this.failIfClosed(),this.surface},u.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},u.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},u.prototype.applyVideoConstraints=function(h){return kn(this,void 0,void 0,function(){return Un(this,function(d){if("aspectRatio"in h)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(h)]})})},u.prototype.close=function(){if(this.isClosed)return Promise.resolve();var h=this;return new Promise(function(d,m){var C=h.mediaStream.getVideoTracks(),x=C.length,y=0;h.mediaStream.getVideoTracks().forEach(function(M){h.mediaStream.removeTrack(M),M.stop(),++y,y>=x&&(h.isClosed=!0,h.parentElement.removeChild(h.surface),d())})})},u.prototype.getCapabilities=function(){return new Ts(this.getFirstTrackOrFail())},u})(),fi=(function(){function u(h){this.mediaStream=h}return u.prototype.render=function(h,d,m){return kn(this,void 0,void 0,function(){return Un(this,function(C){return[2,bs.create(h,this.mediaStream,d,m)]})})},u.create=function(h){return kn(this,void 0,void 0,function(){var d,m;return Un(this,function(C){switch(C.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return d={audio:!1,video:h},[4,navigator.mediaDevices.getUserMedia(d)];case 1:return m=C.sent(),[2,new u(m)]}})})},u})();var di=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},gi=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];
20return{value:w[0]?w[1]:void 0,done:!0}}},xi=(function(){function u(){}return u.failIfNotSupported=function(){return di(this,void 0,void 0,function(){return gi(this,function(h){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new u]})})},u.prototype.create=function(h){return di(this,void 0,void 0,function(){return gi(this,function(d){return[2,fi.create(h)]})})},u})();var Ns=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},_s=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},mi=(function(){function u(){}return u.retrieve=function(){if(navigator.mediaDevices)return u.getCamerasFromMediaDevices();var h=MediaStreamTrack;return MediaStreamTrack&&h.getSources?u.getCamerasFromMediaStreamTrack():u.rejectWithError()},u.rejectWithError=function(){var h=vt.unableToQuerySupportedDevices();return u.isHttpsOrLocalhost()||(h=vt.insecureContextCameraQueryError()),Promise.reject(h)},u.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var h=location.host.split(":")[0];return h==="127.0.0.1"||h==="localhost"},u.getCamerasFromMediaDevices=function(){return Ns(this,void 0,void 0,function(){var h,d,m,C,x,y,M;return _s(this,function(O){switch(O.label){case 0:return h=function(w){for(var D=w.getVideoTracks(),P=0,fe=D;P<fe.length;P++){var Y=fe[P];Y.enabled=!1,Y.stop(),w.removeTrack(Y)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return d=O.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(m=O.sent(),C=[],x=0,y=m;x<y.length;x++)M=y[x],M.kind==="videoinput"&&C.push({id:M.deviceId,label:M.label});return h(d),[2,C]}})})},u.getCamerasFromMediaStreamTrack=function(){return new Promise(function(h,d){var m=function(x){for(var y=[],M=0,O=x;M<O.length;M++){var w=O[M];w.kind==="video"&&y.push({id:w.id,label:w.label})}h(y)},C=MediaStreamTrack;C.getSources(m)})},u})();var Ne=(function(u){return u[u.UNKNOWN=0]="UNKNOWN",u[u.NOT_STARTED=1]="NOT_STARTED",u[u.SCANNING=2]="SCANNING",u[u.PAUSED=3]="PAUSED",u})(Ne||{}),Ms=(function(){function u(){this.state=Ne.NOT_STARTED,this.onGoingTransactionNewState=Ne.UNKNOWN}return u.prototype.directTransition=function(h){this.failIfTransitionOngoing(),this.validateTransition(h),this.state=h},u.prototype.startTransition=function(h){return this.failIfTransitionOngoing(),this.validateTransition(h),this.onGoingTransactionNewState=h,this},u.prototype.execute=function(){if(this.onGoingTransactionNewState===Ne.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var h=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Ne.UNKNOWN,this.directTransition(h)},u.prototype.cancel=function(){if(this.onGoingTransactionNewState===Ne.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Ne.UNKNOWN},u.prototype.getState=function(){return this.state},u.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Ne.UNKNOWN)throw"Cannot transition to a new state, already under transition"},u.prototype.validateTransition=function(h){switch(this.state){case Ne.UNKNOWN:throw"Transition from unknown is not allowed";case Ne.NOT_STARTED:this.failIfNewStateIs(h,[Ne.PAUSED]);break;case Ne.SCANNING:break;case Ne.PAUSED:break}},u.prototype.failIfNewStateIs=function(h,d){for(var m=0,C=d;m<C.length;m++){var x=C[m];if(h===x)throw"Cannot transition from ".concat(this.state," to ").concat(h)}},u})(),Ds=(function(){function u(h){this.stateManager=h}return u.prototype.startTransition=function(h){return this.stateManager.startTransition(h)},u.prototype.directTransition=function(h){this.stateManager.directTransition(h)},u.prototype.getState=function(){return this.stateManager.getState()},u.prototype.canScanFile=function(){return this.stateManager.getState()===Ne.NOT_STARTED},u.prototype.isScanning=function(){return this.stateManager.getState()!==Ne.NOT_STARTED},u.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Ne.SCANNING},u.prototype.isPaused=function(){return this.stateManager.getState()===Ne.PAUSED},u})();var wi=(function(){function u(){}return u.create=function(){return new Ds(new Ms)},u})();var Os=(function(){var u=function(h,d){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,C){m.__proto__=C}||function(m,C){for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(m[x]=C[x])},u(h,d)};return function(h,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");u(h,d);function m(){this.constructor=h}
20h.prototype=d===null?Object.create(d):(m.prototype=d.prototype,new m)}})(),it=(function(u){Os(h,u);function h(){return u!==null&&u.apply(this,arguments)||this}return h.DEFAULT_WIDTH=300,h.DEFAULT_WIDTH_OFFSET=2,h.FILE_SCAN_MIN_HEIGHT=300,h.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,h.MIN_QR_BOX_SIZE=50,h.SHADED_LEFT=1,h.SHADED_RIGHT=2,h.SHADED_TOP=3,h.SHADED_BOTTOM=4,h.SHADED_REGION_ELEMENT_ID="qr-shaded-region",h.VERBOSE=!1,h.BORDER_SHADER_DEFAULT_COLOR="#ffffff",h.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",h})(tt),Rs=(function(){function u(h,d){this.logger=d,this.fps=it.SCAN_DEFAULT_FPS,h?(h.fps&&(this.fps=h.fps),this.disableFlip=h.disableFlip===!0,this.qrbox=h.qrbox,this.aspectRatio=h.aspectRatio,this.videoConstraints=h.videoConstraints):this.disableFlip=it.DEFAULT_DISABLE_FLIP}return u.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?hr.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},u.prototype.isShadedBoxEnabled=function(){return!at(this.qrbox)},u.create=function(h,d){return new u(h,d)},u})(),en=(function(){function u(h,d){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(h))throw"HTML Element with id=".concat(h," not found");this.elementId=h,this.verbose=!1;var m,C;typeof d=="boolean"?this.verbose=d===!0:d&&(C=d,this.verbose=C.verbose===!0,m=C.experimentalFeatures),this.logger=new Pn(this.verbose),this.qrcode=new ui(this.getSupportedFormats(d),this.getUseBarCodeDetectorIfSupported(C),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=wi.create()}return u.prototype.start=function(h,d,m,C){var x=this;if(!h)throw"cameraIdOrConfig is required";if(!m||typeof m!="function")throw"qrCodeSuccessCallback is required and should be a function.";var y;C?y=C:y=this.verbose?this.logger.log:function(){};var M=Rs.create(d,this.logger);this.clearElement();var O=!1;M.videoConstraints&&(M.isMediaStreamConstraintsValid()?O=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var w=O,D=document.getElementById(this.elementId),P=D.clientWidth?D.clientWidth:it.DEFAULT_WIDTH;D.style.position="relative",this.shouldScan=!0,this.element=D;var fe=this,Y=this.stateManagerProxy.startTransition(Ne.SCANNING);return new Promise(function(ve,be){var $=w?M.videoConstraints:fe.createVideoConstraints(h);if(!$){Y.cancel(),be("videoConstraints should be defined");return}var X={};(!w||M.aspectRatio)&&(X.aspectRatio=M.aspectRatio);var oe={onRenderSurfaceReady:function(mt,ae){fe.setupUi(mt,ae,M),fe.isScanning=!0,fe.foreverScan(M,m,y)}};xi.failIfNotSupported().then(function(mt){mt.create($).then(function(ae){return ae.render(x.element,X,oe).then(function(F){fe.renderedCamera=F,Y.execute(),ve(null)}).catch(function(F){Y.cancel(),be(F)})}).catch(function(ae){Y.cancel(),be(vt.errorGettingUserMedia(ae))})}).catch(function(mt){Y.cancel(),be(vt.cameraStreamingNotSupported())})})},u.prototype.pause=function(h){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Ne.PAUSED),this.showPausedState(),(at(h)||h!==!0)&&(h=!1),h&&this.renderedCamera&&this.renderedCamera.pause()},u.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 h=this,d=function(){h.stateManagerProxy.directTransition(Ne.SCANNING),h.hidePausedState()};if(!this.renderedCamera.isPaused()){d();return}this.renderedCamera.resume(function(){d()})},u.prototype.getState=function(){return this.stateManagerProxy.getState()},u.prototype.stop=function(){var h=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var d=this.stateManagerProxy.startTransition(Ne.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var m=function(){if(h.element){var x=document.getElementById(it.SHADED_REGION_ELEMENT_ID);x&&h.element.removeChild(x)}},C=this;return this.renderedCamera.close().then(function(){return C.renderedCamera=null,C.element&&(C.element.removeChild(C.canvasElement),C.canvasElement=null),m(),C.qrRegion&&(C.qrRegion=null),C.context&&(C.context=null),d.execute(),C.hidePausedState(),C.isScanning=!1,Promise.resolve()})},u.prototype.scanFile=function(h,d){return this.scanFileV2(h,d).then(function(m){return m.decodedText})},u.prototype.scanFileV2=function(h,d){var m=this;if(!h||!(h instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";
20if(at(d)&&(d=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(C,x){m.possiblyCloseLastScanImageFile(),m.clearElement(),m.lastScanImageFile=URL.createObjectURL(h);var y=new Image;y.onload=function(){var M=y.width,O=y.height,w=document.getElementById(m.elementId),D=w.clientWidth?w.clientWidth:it.DEFAULT_WIDTH,P=Math.max(w.clientHeight?w.clientHeight:O,it.FILE_SCAN_MIN_HEIGHT),fe=m.computeCanvasDrawConfig(M,O,D,P);if(d){var Y=m.createCanvasElement(D,P,"qr-canvas-visible");Y.style.display="inline-block",w.appendChild(Y);var ve=Y.getContext("2d");if(!ve)throw"Unable to get 2d context from canvas";ve.canvas.width=D,ve.canvas.height=P,ve.drawImage(y,0,0,M,O,fe.x,fe.y,fe.width,fe.height)}var be=it.FILE_SCAN_HIDDEN_CANVAS_PADDING,$=Math.max(y.width,fe.width),X=Math.max(y.height,fe.height),oe=$+2*be,mt=X+2*be,ae=m.createCanvasElement(oe,mt);w.appendChild(ae);var F=ae.getContext("2d");if(!F)throw"Unable to get 2d context from canvas";F.canvas.width=oe,F.canvas.height=mt,F.drawImage(y,0,0,M,O,be,be,$,X);try{m.qrcode.decodeRobustlyAsync(ae).then(function(he){C(lr.createFromQrcodeResult(he))}).catch(x)}catch(he){x("QR code parse error, error = ".concat(he))}},y.onerror=x,y.onabort=x,y.onstalled=x,y.onsuspend=x,y.src=URL.createObjectURL(h)})},u.prototype.clear=function(){this.clearElement()},u.getCameras=function(){return mi.retrieve()},u.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},u.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},u.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},u.prototype.applyVideoConstraints=function(h){if(h){if(!hr.isMediaStreamConstraintsValid(h,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(h)},u.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},u.prototype.getSupportedFormats=function(h){var d=[V.QR_CODE,V.AZTEC,V.CODABAR,V.CODE_39,V.CODE_93,V.CODE_128,V.DATA_MATRIX,V.MAXICODE,V.ITF,V.EAN_13,V.EAN_8,V.PDF_417,V.RSS_14,V.RSS_EXPANDED,V.UPC_A,V.UPC_E,V.UPC_EAN_EXTENSION];if(!h||typeof h=="boolean"||!h.formatsToSupport)return d;if(!Array.isArray(h.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(h.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var m=[],C=0,x=h.formatsToSupport;C<x.length;C++){var y=x[C];ri(y)?m.push(y):this.logger.warn("Invalid format: ".concat(y," passed in config, ignoring."))}if(m.length===0)throw"None of formatsToSupport match supported values.";return m},u.prototype.getUseBarCodeDetectorIfSupported=function(h){if(at(h))return!0;if(!at(h.useBarCodeDetectorIfSupported))return h.useBarCodeDetectorIfSupported!==!1;if(at(h.experimentalFeatures))return!0;var d=h.experimentalFeatures;return at(d.useBarCodeDetectorIfSupported)?!0:d.useBarCodeDetectorIfSupported!==!1},u.prototype.validateQrboxSize=function(h,d,m){var C=this,x=m.qrbox;this.validateQrboxConfig(x);var y=this.toQrdimensions(h,d,x),M=function(w){if(w<it.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(it.MIN_QR_BOX_SIZE,"px.")},O=function(w){return w>h&&(C.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."),w=h),w};M(y.width),M(y.height),y.width=O(y.width)},u.prototype.validateQrboxConfig=function(h){if(typeof h!="number"&&typeof h!="function"&&(h.width===void 0||h.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},u.prototype.toQrdimensions=function(h,d,m){if(typeof m=="number")return{width:m,height:m};if(typeof m=="function")try{return m(h,d)}catch(C){throw new Error("qrbox config was passed as a function but it failed with unknown error"+C)}return m},u.prototype.setupUi=function(h,d,m){m.isShadedBoxEnabled()&&this.validateQrboxSize(h,d,m);var C=at(m.qrbox)?{width:h,height:d}:m.qrbox;this.validateQrboxConfig(C);var x=this.toQrdimensions(h,d,C);x.height>d&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var y=m.isShadedBoxEnabled()&&x.height<=d,M={x:0,y:0,width:h,height:d}
20,O=y?this.getShadedRegionBounds(h,d,x):M,w=this.createCanvasElement(O.width,O.height),D={willReadFrequently:!0},P=w.getContext("2d",D);P.canvas.width=O.width,P.canvas.height=O.height,this.element.append(w),y&&this.possiblyInsertShadingElement(this.element,h,d,x),this.createScannerPausedUiElement(this.element),this.qrRegion=O,this.context=P,this.canvasElement=w},u.prototype.createScannerPausedUiElement=function(h){var d=document.createElement("div");d.innerText=vt.scannerPaused(),d.style.display="none",d.style.position="absolute",d.style.top="0px",d.style.zIndex="1",d.style.background="rgba(9, 9, 9, 0.46)",d.style.color="#FFECEC",d.style.textAlign="center",d.style.width="100%",h.appendChild(d),this.scannerPausedUiElement=d},u.prototype.scanContext=function(h,d){var m=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(C){return h(C.text,lr.createFromQrcodeResult(C)),m.possiblyUpdateShaders(!0),!0}).catch(function(C){m.possiblyUpdateShaders(!1);var x=vt.codeParseError(C);return d(x,Bn.createFrom(x)),!1})},u.prototype.foreverScan=function(h,d,m){var C=this;if(this.shouldScan&&this.renderedCamera){var x=this.renderedCamera.getSurface(),y=x.videoWidth/x.clientWidth,M=x.videoHeight/x.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var O=this.qrRegion.width*y,w=this.qrRegion.height*M,D=this.qrRegion.x*y,P=this.qrRegion.y*M;this.context.drawImage(x,D,P,O,w,0,0,this.qrRegion.width,this.qrRegion.height);var fe=function(){C.foreverScanTimeout=setTimeout(function(){C.foreverScan(h,d,m)},C.getTimeoutFps(h.fps))};this.scanContext(d,m).then(function(Y){!Y&&h.disableFlip!==!0?(C.context.translate(C.context.canvas.width,0),C.context.scale(-1,1),C.scanContext(d,m).finally(function(){fe()})):fe()}).catch(function(Y){C.logger.logError("Error happend while scanning context",Y),fe()})}},u.prototype.createVideoConstraints=function(h){if(typeof h=="string")return{deviceId:{exact:h}};if(typeof h=="object"){var d="facingMode",m="deviceId",C={user:!0,environment:!0},x="exact",y=function(ve){if(ve in C)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(ve,"'")},M=Object.keys(h);if(M.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(M.length," keys");var O=Object.keys(h)[0];if(O!==d&&O!==m)throw"Only '".concat(d,"' and '").concat(m,"' ")+" are supported for 'cameraIdOrConfig'";if(O===d){var w=h.facingMode;if(typeof w=="string"){if(y(w))return{facingMode:w}}else if(typeof w=="object")if(x in w){if(y(w["".concat(x)]))return{facingMode:{exact:w["".concat(x)]}}}else throw"'facingMode' should be string or object with"+" ".concat(x," as key.");else{var D=typeof w;throw"Invalid type of 'facingMode' = ".concat(D)}}else{var P=h.deviceId;if(typeof P=="string")return{deviceId:P};if(typeof P=="object"){if(x in P)return{deviceId:{exact:P["".concat(x)]}};throw"'deviceId' should be string or object with"+" ".concat(x," as key.")}else{var fe=typeof P;throw"Invalid type of 'deviceId' = ".concat(fe)}}}var Y=typeof h;throw"Invalid type of 'cameraIdOrConfig' = ".concat(Y)},u.prototype.computeCanvasDrawConfig=function(h,d,m,C){if(h<=m&&d<=C){var x=(m-h)/2,y=(C-d)/2;return{x,y,width:h,height:d}}else{var M=h,O=d;return h>m&&(d=m/h*d,h=m),d>C&&(h=C/d*h,d=C),this.logger.log("Image downsampled from "+"".concat(M,"X").concat(O)+" to ".concat(h,"X").concat(d,".")),this.computeCanvasDrawConfig(h,d,m,C)}},u.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var h=document.getElementById(this.elementId);h&&(h.innerHTML="")},u.prototype.possiblyUpdateShaders=function(h){this.qrMatch!==h&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(d){d.style.backgroundColor=h?it.BORDER_SHADER_MATCH_COLOR:it.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=h)},u.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},u.prototype.createCanvasElement=function(h,d,m){var C=h,x=d,y=document.createElement("canvas");return y.style.width="".concat(C,"px"),y.style.height="".concat(x,"px"),y.style.display="none",y.id=at(m)?"qr-canvas":m,y},u.prototype.getShadedRegionBounds=function(h,d,m){if(m.width>h||m.height>d)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(h-m.width)/2,y:(d-m.height)/2,width:m.width,height:m.height}}
20,u.prototype.possiblyInsertShadingElement=function(h,d,m,C){if(!(d-C.width<1||m-C.height<1)){var x=document.createElement("div");x.style.position="absolute";var y=(d-C.width)/2,M=(m-C.height)/2;if(x.style.borderLeft="".concat(y,"px solid rgba(0, 0, 0, 0.48)"),x.style.borderRight="".concat(y,"px solid rgba(0, 0, 0, 0.48)"),x.style.borderTop="".concat(M,"px solid rgba(0, 0, 0, 0.48)"),x.style.borderBottom="".concat(M,"px solid rgba(0, 0, 0, 0.48)"),x.style.boxSizing="border-box",x.style.top="0px",x.style.bottom="0px",x.style.left="0px",x.style.right="0px",x.id="".concat(it.SHADED_REGION_ELEMENT_ID),d-C.width<11||m-C.height<11)this.hasBorderShaders=!1;else{var O=5,w=40;this.insertShaderBorders(x,w,O,-O,null,0,!0),this.insertShaderBorders(x,w,O,-O,null,0,!1),this.insertShaderBorders(x,w,O,null,-O,0,!0),this.insertShaderBorders(x,w,O,null,-O,0,!1),this.insertShaderBorders(x,O,w+O,-O,null,-O,!0),this.insertShaderBorders(x,O,w+O,null,-O,-O,!0),this.insertShaderBorders(x,O,w+O,-O,null,-O,!1),this.insertShaderBorders(x,O,w+O,null,-O,-O,!1),this.hasBorderShaders=!0}h.append(x)}},u.prototype.insertShaderBorders=function(h,d,m,C,x,y,M){var O=document.createElement("div");O.style.position="absolute",O.style.backgroundColor=it.BORDER_SHADER_DEFAULT_COLOR,O.style.width="".concat(d,"px"),O.style.height="".concat(m,"px"),C!==null&&(O.style.top="".concat(C,"px")),x!==null&&(O.style.bottom="".concat(x,"px")),M?O.style.left="".concat(y,"px"):O.style.right="".concat(y,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(O),h.appendChild(O)},u.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},u.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},u.prototype.getTimeoutFps=function(h){return 1e3/h},u})();var xr="data:image/svg+xml;base64,",Ai=xr+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIu
20Njg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",Ci=xr+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",mr=xr+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",pi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=";var Ei=(function(){function u(){}return u.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},u})(),Ii=(function(){function u(){this.data=Ei.createDefault();var h=localStorage.getItem(u.LOCAL_STORAGE_KEY);h?this.data=JSON.parse(h):this.reset()}return u.prototype.hasCameraPermissions=function(){return this.data.hasPermission},u.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},u.prototype.setHasPermission=function(h){this.data.hasPermission=h,this.flush()},u.prototype.setLastUsedCameraId=function(h){this.data.lastUsedCameraId=h,this.flush()},u.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},u.prototype.reset=function(){this.data=Ei.createDefault(),this.flush()},u.prototype.flush=function(){localStorage.setItem(u.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},u.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",u})();var vs=(function(){function u(){this.infoDiv=document.createElement("div")}return u.prototype.renderInto=function(h){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=ur.poweredBy();var d=document.createElement("a");d.innerText="ScanApp",d.href="https://scanapp.org",d.target="new",d.style.color="white",this.infoDiv.appendChild(d);var m=document.createElement("br"),C=document.createElement("br");this.infoDiv.appendChild(m),this.infoDiv.appendChild(C);var x=document.createElement("a");x.innerText=ur.reportIssues(),x.href="https://github.com/mebjas/html5-qrcode/issues",x.target="new",x.style.color="white",this.infoDiv.appendChild(x),h.appendChild(this.infoDiv)},u.prototype.show=function(){this.infoDiv.style.display="block"},u.prototype.hide=function(){this.infoDiv.style.display="none"},u})(),Ls=(function(){function u(h,d){this.isShowingInfoIcon=!0,this.onTapIn=h,this.onTapOut=d,this.infoIcon=document.createElement("img")}return u.prototype.renderInto=function(h){var d=this;this.infoIcon.alt="Info icon",this.infoIcon.src=mr,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(m){return d.onHoverIn()},this.infoIcon.onmouseout=function(m){return d.onHoverOut()},this.infoIcon.onclick=function(m){return d.onClick()},h.appendChild(this.infoIcon)},u.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},u.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},u.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=pi,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=mr,this.infoIcon.style.opacity="0.6")},u})(),Si=(function(){function u(){var h=this;this.infoDiv=new vs,this.infoIcon=new Ls(function(){h.infoDiv.show()},function(){h.infoDiv.hide()})}return u.prototype.renderInto=function(h){this.infoDiv.renderInto(h),this.infoIcon.renderInto(h)},u})();var Bs=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},Ps=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];
20return{value:w[0]?w[1]:void 0,done:!0}}},wr=(function(){function u(){}return u.hasPermissions=function(){return Bs(this,void 0,void 0,function(){var h,d,m,C;return Ps(this,function(x){switch(x.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(h=x.sent(),d=0,m=h;d<m.length;d++)if(C=m[d],C.kind==="videoinput"&&C.label)return[2,!0];return[2,!1]}})})},u})();var St=(function(){function u(h){this.supportedScanTypes=this.validateAndReturnScanTypes(h)}return u.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},u.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},u.prototype.isCameraScanRequired=function(){for(var h=0,d=this.supportedScanTypes;h<d.length;h++){var m=d[h];if(u.isCameraScanType(m))return!0}return!1},u.isCameraScanType=function(h){return h===Et.SCAN_TYPE_CAMERA},u.isFileScanType=function(h){return h===Et.SCAN_TYPE_FILE},u.prototype.validateAndReturnScanTypes=function(h){if(!h||h.length===0)return tt.DEFAULT_SUPPORTED_SCAN_TYPE;var d=tt.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(h.length>d)throw"Max ".concat(d," values expected for ")+"supportedScanTypes";for(var m=0,C=h;m<C.length;m++){var x=C[m];if(!tt.DEFAULT_SUPPORTED_SCAN_TYPE.includes(x))throw"Unsupported scan type ".concat(x)}return h},u})();var ke=(function(){function u(){}return u.ALL_ELEMENT_CLASS="html5-qrcode-element",u.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",u.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",u.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",u.TORCH_BUTTON_ID="html5-qrcode-button-torch",u.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",u.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",u.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",u.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",u.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",u.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",u})();var nt=(function(){function u(){}return u.createElement=function(h,d){var m=document.createElement(h);return m.id=d,m.classList.add(ke.ALL_ELEMENT_CLASS),h==="button"&&m.setAttribute("type","button"),m},u})();var Ti=function(u,h,d,m){function C(x){return x instanceof d?x:new d(function(y){y(x)})}return new(d||(d=Promise))(function(x,y){function M(D){try{w(m.next(D))}catch(P){y(P)}}function O(D){try{w(m.throw(D))}catch(P){y(P)}}function w(D){D.done?x(D.value):C(D.value).then(M,O)}w((m=m.apply(u,h||[])).next())})},bi=function(u,h){var d={label:0,sent:function(){if(x[0]&1)throw x[1];return x[1]},trys:[],ops:[]},m,C,x,y;return y={next:M(0),throw:M(1),return:M(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function M(w){return function(D){return O([w,D])}}function O(w){if(m)throw new TypeError("Generator is already executing.");for(;y&&(y=0,w[0]&&(d=0)),d;)try{if(m=1,C&&(x=w[0]&2?C.return:w[0]?C.throw||((x=C.return)&&x.call(C),0):C.next)&&!(x=x.call(C,w[1])).done)return x;switch(C=0,x&&(w=[w[0]&2,x.value]),w[0]){case 0:case 1:x=w;break;case 4:return d.label++,{value:w[1],done:!1};case 5:d.label++,C=w[1],w=[0];continue;case 7:w=d.ops.pop(),d.trys.pop();continue;default:if(x=d.trys,!(x=x.length>0&&x[x.length-1])&&(w[0]===6||w[0]===2)){d=0;continue}if(w[0]===3&&(!x||w[1]>x[0]&&w[1]<x[3])){d.label=w[1];break}if(w[0]===6&&d.label<x[1]){d.label=x[1],x=w;break}if(x&&d.label<x[2]){d.label=x[2],d.ops.push(w);break}x[2]&&d.ops.pop(),d.trys.pop();continue}w=h.call(u,d)}catch(D){w=[6,D],C=0}finally{m=x=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},yi=(function(){function u(h,d,m){this.isTorchOn=!1,this.torchCapability=h,this.buttonController=d,this.onTorchActionFailureCallback=m}return u.prototype.isTorchEnabled=function(){return this.isTorchOn},u.prototype.flipState=function(){return Ti(this,void 0,void 0,function(){var h,d;return bi(this,function(m){switch(m.label){case 0:this.buttonController.disable(),h=!this.isTorchOn,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,this.torchCapability.apply(h)];case 2:return m.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(
20),h),[3,4];case 3:return d=m.sent(),this.propagateFailure(h,d),this.buttonController.enable(),[3,4];case 4:return[2]}})})},u.prototype.updateUiBasedOnLatestSettings=function(h,d){h===d?(this.buttonController.setText(d?ce.torchOffButton():ce.torchOnButton()),this.isTorchOn=d):this.propagateFailure(d),this.buttonController.enable()},u.prototype.propagateFailure=function(h,d){var m=h?ce.torchOnFailedMessage():ce.torchOffFailedMessage();d&&(m+="; Error = "+d),this.onTorchActionFailureCallback(m)},u.prototype.reset=function(){this.isTorchOn=!1},u})(),Ni=(function(){function u(h,d){this.onTorchActionFailureCallback=d,this.torchButton=nt.createElement("button",ke.TORCH_BUTTON_ID),this.torchController=new yi(h,this,d)}return u.prototype.render=function(h,d){var m=this;this.torchButton.innerText=ce.torchOnButton(),this.torchButton.style.display=d.display,this.torchButton.style.marginLeft=d.marginLeft;var C=this;this.torchButton.addEventListener("click",function(x){return Ti(m,void 0,void 0,function(){return bi(this,function(y){switch(y.label){case 0:return[4,C.torchController.flipState()];case 1:return y.sent(),C.torchController.isTorchEnabled()?(C.torchButton.classList.remove(ke.TORCH_BUTTON_CLASS_TORCH_OFF),C.torchButton.classList.add(ke.TORCH_BUTTON_CLASS_TORCH_ON)):(C.torchButton.classList.remove(ke.TORCH_BUTTON_CLASS_TORCH_ON),C.torchButton.classList.add(ke.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),h.appendChild(this.torchButton)},u.prototype.updateTorchCapability=function(h){this.torchController=new yi(h,this,this.onTorchActionFailureCallback)},u.prototype.getTorchButton=function(){return this.torchButton},u.prototype.hide=function(){this.torchButton.style.display="none"},u.prototype.show=function(){this.torchButton.style.display="inline-block"},u.prototype.disable=function(){this.torchButton.disabled=!0},u.prototype.enable=function(){this.torchButton.disabled=!1},u.prototype.setText=function(h){this.torchButton.innerText=h},u.prototype.reset=function(){this.torchButton.innerText=ce.torchOnButton(),this.torchController.reset()},u.create=function(h,d,m,C){var x=new u(d,C);return x.render(h,m),x},u})();var _i=(function(){function u(h,d,m){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=d?"block":"none",h.appendChild(this.fileBasedScanRegion);var C=document.createElement("label");C.setAttribute("for",this.getFileScanInputId()),C.style.display="inline-block",this.fileBasedScanRegion.appendChild(C),this.fileSelectionButton=nt.createElement("button",ke.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(M){C.click()}),C.append(this.fileSelectionButton),this.fileScanInput=nt.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",C.appendChild(this.fileScanInput);var x=this;this.fileScanInput.addEventListener("change",function(M){if(!(M==null||M.target==null)){var O=M.target;if(!(O.files&&O.files.length===0)){var w=O.files,D=w[0],P=D.name;x.setImageNameToButton(P),m(D)}}});var y=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(y),this.fileBasedScanRegion.addEventListener("dragenter",function(M){x.fileBasedScanRegion.style.border=x.fileBasedScanRegionActiveBorder(),M.stopPropagation(),M.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(M){x.fileBasedScanRegion.style.border=x.fileBasedScanRegionDefaultBorder(),M.stopPropagation(),M.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(M){x.fileBasedScanRegion.style.border=x.fileBasedScanRegionActiveBorder(),M.stopPropagation(),M.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(M){M.stopPropagation(),M.preventDefault(),x.fileBasedScanRegion.style.border=x.fileBasedScanRegionDefaultBorder();var O=M.dataTransfer;if(O){var w=O.files;if(!w||w.length===0)return;for(var D=!1,P=0;P<w.length;++P){var fe=w.item(P);if(fe){var Y=/image.*/;if(fe.type.match(Y)){D=!0;var ve=fe.name;x.setImageNameToButton(ve),m(fe),y.innerText=ce.dragAndDropMessage();break}}}D||(y.innerText=ce.dragAndDropMessageOnlyImages())}})}return u.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},u.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},u.prototype.isShowing=function(){return this.fileBasedScanRegion.style.display==="block"},u.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},u.prototype.createFileBasedScanRegion=function(){var h=document.createElement("div");return h.style.textAlign="center",h.style.margin="auto",h.style.width="80%",h.style.maxWidth="600px",h.style.border=this.fileBasedScanRegionDefaultBorder(),h.style.padding="10px",h.style.marginBottom="10px",h},u.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},u.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},u.prototype.createDragAndDropMessage=function(){var h=document.createElement("div");return h.innerText=ce.dragAndDropMessage(),h.style.fontWeight="400",h},u.prototype.setImageNameToButton=function(h){var d=20;if(h.length>d){var m=h.substring(0,8),C=h.length,x=h.substring(C-8,C);h="".concat(m,"....").concat(x)}var y=ce.fileSelectionChooseAnother()+" - "+h;this.fileSelectionButton.innerText=y},u.prototype.setInitialValueToButton=function(){var h=ce.fileSelectionChooseImage()+" - "+ce.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=h},u.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},u.create=function(h,d,m){var C=new u(h,d,m);return C},u})();var Mi=(function(){function u(h){this.selectElement=nt.createElement("select",ke.CAMERA_SELECTION_SELECT_ID),this.cameras=h,this.options=[]}return u.prototype.render=function(h){var d=document.createElement("span");d.style.marginRight="10px";var m=this.cameras.length;if(m===0)throw new Error("No cameras found");if(m===1)d.style.display="none";else{var C=ce.selectCamera();d.innerText="".concat(C," (").concat(this.cameras.length,") ")}for(var x=1,y=0,M=this.cameras;y<M.length;y++){var O=M[y],w=O.id,D=O.label==null?w:O.label;(!D||D==="")&&(D=[ce.anonymousCameraPrefix(),x++].join(" "));var P=document.createElement("option");P.value=w,P.innerText=D,this.options.push(P),this.selectElement.appendChild(P)}d.appendChild(this.selectElement),h.appendChild(d)},u.prototype.disable=function(){this.selectElement.disabled=!0},u.prototype.isDisabled=function(){return this.selectElement.disabled===!0},u.prototype.enable=function(){this.selectElement.disabled=!1},u.prototype.getValue=function(){return this.selectElement.value},u.prototype.hasValue=function(h){for(var d=0,m=this.options;d<m.length;d++){var C=m[d];if(C.value===h)return!0}return!1},u.prototype.setValue=function(h){if(!this.hasValue(h))throw new Error("".concat(h," is not present in the camera list."));this.selectElement.value=h},u.prototype.hasSingleItem=function(){return this.cameras.length===1},u.prototype.numCameras=function(){return this.cameras.length},u.create=function(h,d){var m=new u(d);return m.render(h),m},u})();var Di=(function(){function u(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=nt.createElement("input",ke.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 u.prototype.render=function(h,d){this.zoomElementContainer.style.display=d?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",h.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5
20px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var m=ce.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(m),this.rangeText.style.marginRight="10px";var C=this;this.rangeInput.addEventListener("input",function(){return C.onValueChange()}),this.rangeInput.addEventListener("change",function(){return C.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},u.prototype.onValueChange=function(){var h=ce.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(h),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},u.prototype.setValues=function(h,d,m,C){this.rangeInput.min=h.toString(),this.rangeInput.max=d.toString(),this.rangeInput.step=C.toString(),this.rangeInput.value=m.toString(),this.onValueChange()},u.prototype.show=function(){this.zoomElementContainer.style.display="block"},u.prototype.hide=function(){this.zoomElementContainer.style.display="none"},u.prototype.setOnCameraZoomValueChangeCallback=function(h){this.onChangeCallback=h},u.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},u.create=function(h,d){var m=new u;return m.render(h,d),m},u})();var ct=(function(u){return u[u.STATUS_DEFAULT=0]="STATUS_DEFAULT",u[u.STATUS_SUCCESS=1]="STATUS_SUCCESS",u[u.STATUS_WARNING=2]="STATUS_WARNING",u[u.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION",u})(ct||{});function Fs(u){return{fps:u.fps,qrbox:u.qrbox,aspectRatio:u.aspectRatio,disableFlip:u.disableFlip,videoConstraints:u.videoConstraints}}function ks(u,h){return{formatsToSupport:u.formatsToSupport,useBarCodeDetectorIfSupported:u.useBarCodeDetectorIfSupported,experimentalFeatures:u.experimentalFeatures,verbose:h}}var Us=(function(){function u(h,d,m){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=h,this.config=this.createConfig(d),this.verbose=m===!0,!
20document.getElementById(h))throw"HTML Element with id=".concat(h," not found");this.scanTypeSelector=new St(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new Pn(this.verbose),this.persistedDataManager=new Ii,d.rememberLastUsedCamera!==!0&&this.persistedDataManager.reset()}return u.prototype.render=function(h,d){var m=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(x,y){if(h)h(x,y);else{if(m.lastMatchFound===x)return;m.lastMatchFound=x,m.setHeaderMessage(ce.lastMatch(x),ct.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(x,y){d&&d(x,y)};var C=document.getElementById(this.elementId);if(!C)throw"HTML Element with id=".concat(this.elementId," not found");C.innerHTML="",this.createBasicLayout(C),this.html5Qrcode=new en(this.getScanRegionId(),ks(this.config,this.verbose))},u.prototype.pause=function(h){(at(h)||h!==!0)&&(h=!1),this.getHtml5QrcodeOrFail().pause(h)},u.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},u.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},u.prototype.clear=function(){var h=this,d=function(){var m=document.getElementById(h.elementId);m&&(m.innerHTML="",h.resetBasicLayout(m))};return this.html5Qrcode?new Promise(function(m,C){if(!h.html5Qrcode){m();return}h.html5Qrcode.isScanning?h.html5Qrcode.stop().then(function(x){if(!h.html5Qrcode){m();return}h.html5Qrcode.clear(),d(),m()}).catch(function(x){h.verbose&&h.logger.logError("Unable to stop qrcode scanner",x),C(x)}):(h.html5Qrcode.clear(),d(),m())}):Promise.resolve()},u.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},u.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},u.prototype.applyVideoConstraints=function(h){return this.getHtml5QrcodeOrFail().applyVideoConstraints(h)},u.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},u.prototype.createConfig=function(h){return h?(h.fps||(h.fps=tt.SCAN_DEFAULT_FPS),h.rememberLastUsedCamera!==!tt.DEFAULT_REMEMBER_LAST_CAMERA_USED&&(h.rememberLastUsedCamera=tt.DEFAULT_REMEMBER_LAST_CAMERA_USED),h.supportedScanTypes||(h.supportedScanTypes=tt.DEFAULT_SUPPORTED_SCAN_TYPE),h):{fps:tt.SCAN_DEFAULT_FPS,rememberLastUsedCamera:tt.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:tt.DEFAULT_SUPPORTED_SCAN_TYPE}},u.prototype.createBasicLayout=function(h){h.style.position="relative",h.style.padding="0px",h.style.border="1px solid silver",this.createHeader(h);var d=document.createElement("div"),m=this.getScanRegionId();d.id=m,d.style.width="100%",d.style.minHeight="100px",d.style.textAlign="center",h.appendChild(d),St.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var C=document.createElement("div"),x=this.getDashboardId();C.id=x,C.style.width="100%",h.appendChild(C),this.setupInitialDashboard(C)},u.prototype.resetBasicLayout=function(h){h.style.border="none"},u.prototype.setupInitialDashboard=function(h){this.createSection(h),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},u.prototype.createHeader=function(h){var d=document.createElement("div");d.style.textAlign="left",d.style.margin="0px",h.appendChild(d);var m=new Si;m.renderInto(d);var C=document.createElement("div");C.id=this.getHeaderMessageContainerId(),C.style.display="none",C.style.textAlign="center",C.style.fontSize="14px",C.style.padding="2px 10px",C.style.margin="4px",C.style.borderTop="1px solid #f6f6f6",d.appendChild(C)},u.prototype.createSection=function(h){var d=document.createElement("div");d.id=this.getDashboardSectionId(),d.style.width="100%",d.style.padding="10px 0px 10px 0px",d.style.textAlign="left",h.appendChild(d)},u.prototype.createCameraListUi=function(h,d,m){var C=this;C.showHideScanTypeSwapLink(!1),C.setHeaderMessage(ce.cameraPermissionRequesting());var x=function(){m||C.createPermissionButton(h,d)};en.getCameras().then(function(y){C.persistedDataManager.setHasPermission(!0),C.showHideScanTypeSwapLink(!0),C.resetHeaderMessage(),y&&y.length>0?(h.removeChild(d),C.renderCameraSelection(y)):(C.setHeaderMessage(ce.noCameraFound(),ct.STATUS_WARNING),x())}).catch(function(y){C.persistedDataManager.setHasPermission(!1),m?m.disabled=!1:x(),C.setHeaderMessage(y,ct.STATUS_WARNING),C.showHideScanTypeSwapLink(!0)})},u.prototype.createPermissionButton=function(h,d){var m=this,C=nt.createElement("button",this.getCameraPermissionButtonId());C.innerText=ce.cameraPermissionTitle(),C.addEventListener("click",function(){C.disabled=!0,m.createCameraListUi(h,d,C)}),d.appendChild(C)},u.prototype.createPermissionsUi=function(h,d){var m=this;if(St.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){wr.hasPermissions().then(function(C){C?m.createCameraListUi(h,d):(m.persistedDataManager.setHasPermission(!1),m.createPermissionButton(h,d))}).catch(function(C){m.persistedDataManager.setHasPermission(!1),m.createPermissionButton(h,d)});return}this.createPermissionButton(h,d)},u.prototype.createSectionControlPanel=function(){var h=document.getElementById(this.getDashboardSectionId()),d=document.createElement("div");h.appendChild(d);var m=document.createElement("div");m.id=this.getDashboardSectionCameraScanRegionId(),m.style.display=St.isCameraScanType(this.currentScanType)?"block":"none",d.appendChild(m);var C=document.createElement("div");C.style.textAlign="center",m.appendChild(C),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(m,C),this.renderFileScanUi(d)},u.prototype.renderFileScanUi=function(h){var d=St.isFileScanType(this.currentScanType),m=this,C=function(x){if(!m.html5Qrcode)throw"html5Qrcode not defined";St.isFileScanType(m.currentScanType)&&(m.setHeaderMessage(ce.loadingImage()),m.html5Qrcode.scanFileV2(x,!0).then(function(y){m.resetHeaderMessage(),m.qrCodeSuccessCallback(y.decodedText,y
20)}).catch(function(y){m.setHeaderMessage(y,ct.STATUS_WARNING),m.qrCodeErrorCallback(y,Bn.createFrom(y))}))};this.fileSelectionUi=_i.create(h,d,C)},u.prototype.renderCameraSelection=function(h){var d=this,m=this,C=document.getElementById(this.getDashboardSectionCameraScanRegionId());C.style.textAlign="center";var x=Di.create(C,!1),y=function(be){var $=be.zoomFeature();if($.isSupported()){x.setOnCameraZoomValueChangeCallback(function(oe){$.apply(oe)});var X=1;d.config.defaultZoomValueIfSupported&&(X=d.config.defaultZoomValueIfSupported),X=si(X,$.min(),$.max()),x.setValues($.min(),$.max(),X,$.step()),x.show()}},M=Mi.create(C,h),O=document.createElement("span"),w=nt.createElement("button",ke.CAMERA_START_BUTTON_ID);w.innerText=ce.scanButtonStartScanningText(),O.appendChild(w);var D=nt.createElement("button",ke.CAMERA_STOP_BUTTON_ID);D.innerText=ce.scanButtonStopScanningText(),D.style.display="none",D.disabled=!0,O.appendChild(D);var P,fe=function(be){if(!be.torchFeature().isSupported()){P&&P.hide();return}P?P.updateTorchCapability(be.torchFeature()):P=Ni.create(O,be.torchFeature(),{display:"none",marginLeft:"5px"},function($){m.setHeaderMessage($,ct.STATUS_WARNING)}),P.show()};C.appendChild(O);var Y=function(be){be||(w.style.display="none"),w.innerText=ce.scanButtonStartScanningText(),w.style.opacity="1",w.disabled=!1,be&&(w.style.display="inline-block")};if(w.addEventListener("click",function(be){w.innerText=ce.scanButtonScanningStarting(),M.disable(),w.disabled=!0,w.style.opacity="0.5",d.scanTypeSelector.hasMoreThanOneScanType()&&m.showHideScanTypeSwapLink(!1),m.resetHeaderMessage();var $=M.getValue();m.persistedDataManager.setLastUsedCameraId($),m.html5Qrcode.start($,Fs(m.config),m.qrCodeSuccessCallback,m.qrCodeErrorCallback).then(function(X){D.disabled=!1,D.style.display="inline-block",Y(!1);var oe=m.html5Qrcode.getRunningTrackCameraCapabilities();d.config.showTorchButtonIfSupported===!0&&fe(oe),d.config.showZoomSliderIfSupported===!0&&y(oe)}).catch(function(X){m.showHideScanTypeSwapLink(!0),M.enable(),Y(!0),m.setHeaderMessage(X,ct.STATUS_WARNING)})}),M.hasSingleItem()&&w.click(),D.addEventListener("click",function(be){if(!m.html5Qrcode)throw"html5Qrcode not defined";D.disabled=!0,m.html5Qrcode.stop().then(function($){d.scanTypeSelector.hasMoreThanOneScanType()&&m.showHideScanTypeSwapLink(!0),M.enable(),w.disabled=!1,D.style.display="none",w.style.display="inline-block",P&&(P.reset(),P.hide()),x.removeOnCameraZoomValueChangeCallback(),x.hide(),m.insertCameraScanImageToScanRegion()}).catch(function($){D.disabled=!1,m.setHeaderMessage($,ct.STATUS_WARNING)})}),m.persistedDataManager.getLastUsedCameraId()){var ve=m.persistedDataManager.getLastUsedCameraId();M.hasValue(ve)?(M.setValue(ve),w.click()):m.persistedDataManager.resetLastUsedCameraId()}},u.prototype.createSectionSwap=function(){var h=this,d=ce.textIfCameraScanSelected(),m=ce.textIfFileScanSelected(),C=document.getElementById(this.getDashboardSectionId()),x=document.createElement("div");x.style.textAlign="center";var y=nt.createElement("span",this.getDashboardSectionSwapLinkId());y.style.textDecoration="underline",y.style.cursor="pointer",y.innerText=St.isCameraScanType(this.currentScanType)?d:m,y.addEventListener("click",function(){if(!h.sectionSwapAllowed){h.verbose&&h.logger.logError("Section swap called when not allowed");return}h.resetHeaderMessage(),h.fileSelectionUi.resetValue(),h.sectionSwapAllowed=!1,St.isCameraScanType(h.currentScanType)?(h.clearScanRegion(),h.getCameraScanRegion().style.display="none",h.fileSelectionUi.show(),y.innerText=m,h.currentScanType=Et.SCAN_TYPE_FILE,h.insertFileScanImageToScanRegion()):(h.clearScanRegion(),h.getCameraScanRegion().style.display="block",h.fileSelectionUi.hide(),y.innerText=d,h.currentScanType=Et.SCAN_TYPE_CAMERA,h.insertCameraScanImageToScanRegion(),h.startCameraScanIfPermissionExistsOnSwap()),h.sectionSwapAllowed=!0}),x.appendChild(y),C.appendChild(x)},u.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var h=this,d=this;if(this.persistedDataManager.hasCameraPermissions()){wr.hasPermissions().then(function(m){if(m){var C=document.getElementById(d.getCameraPermissionButtonId());if(!C)throw h.logger.logError("Permission button not found, fail;"),"Permission button not found";C.click()}else d.persistedDataManager.setHasPermission(!1)}).catch(function(m){d.persistedDataManager.setHasPermission(!1)});return}},u.prototype.resetHeaderMessage=function(){var h=document.getElementById(this.getHeaderMessageContainerId());h.style.display="none"},u.prototype.setHeaderMessage=function(h,d){d||(d=ct.STATUS_DEFAULT);var m=this.getHeaderMessageDiv();switch(m.innerText=h,m.style.display="block",d){case ct.STATUS_SUCCESS:m.style.background="rgba(106, 175, 80, 0.26)",m.style.color="#477735";break;case ct.STATUS_WARNING:m.style.background="rgba(203, 36, 49, 0.14)",m.style.color="#cb2431";break;case ct.STATUS_DEFAULT:default:m.style.background="rgba(0, 0, 0, 0)",m.style.color="rgb(17, 17, 17)";break}},u.prototype.showHideScanTypeSwapLink=function(h){this.scanTypeSelector.hasMoreThanOneScanType()&&(h!==!0&&(h=!1),this.sectionSwapAllowed=h,this.getDashboardSectionSwapLink().style.display=h?"inline-block":"none")},u.prototype.insertCameraScanImageToScanRegion=function(){var h=this,d=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){d.innerHTML="<br>",d.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(m){d.innerHTML="<br>",d.appendChild(h.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=Ai,this.cameraScanImage.alt=ce.cameraScanAltText()},u.prototype.insertFileScanImageToScanRegion=function(){var h=this,d=document.getElementById(this.getScanRegionId());if(this.fileScanImage){d.innerHTML="<br>",d.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(m){d.innerHTML="<br>",d.appendChild(h.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=Ci,this.fileScanImage.alt=ce.fileScanAltText()},u.prototype.clearScanRegion=function(){var h=document.getElementById(this.getScanRegionId());h.innerHTML=""},u.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},u.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},u.prototype.getDashboardSectionSwapLinkId=function(){return ke.SCAN_TYPE_CHANGE_ANCHOR_ID},u.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_regi
20on")},u.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},u.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},u.prototype.getCameraPermissionButtonId=function(){return ke.CAMERA_PERMISSION_BUTTON_ID},u.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},u.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},u.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},u})();var Hs=["videoElement"];function Vs(u,h){if(u&1){let d=Rn();ie(0,"button",25),jt("click",function(){Ut(d);let C=pt(2);return Ht(C.switchCamera())}),Vt(),ie(1,"svg",7),et(2,"path",26),ye()()}}function zs(u,h){u&1&&(ie(0,"div",38),et(1,"div",39),ie(2,"p",40),Ze(3,"Opening device camera..."),ye()())}function Gs(u,h){if(u&1&&(ie(0,"div",18),et(1,"video",27,0)(3,"div",28),ie(4,"div",29)(5,"div",30),et(6,"span",31)(7,"span",32)(8,"span",33)(9,"span",34)(10,"div",35),ye(),ie(11,"div",36),et(12,"span",37),ie(13,"span"),Ze(14,"Position the document barcode inside the frame."),ye()()(),zt(15,zs,4,0,"div",38),ye()),u&2){let d=pt(2);xt(15),Gt(d.scannerState()===d.ScannerState.STARTING_CAMERA?15:-1)}}function js(u,h){if(u&1&&(ie(0,"div",19)(1,"div",41)(2,"div",42),Vt(),ie(3,"svg",43),et(4,"path",44),ye()(),$t(),ie(5,"span",45),et(6,"span",46)(7,"span",47),ye()(),ie(8,"div",48)(9,"h4",49),Ze(10," Document Checked "),ye(),ie(11,"p",50),Ze(12," Your document barcode has been successfully scanned and verified. "),ye()(),ie(13,"div",51)(14,"div",52),et(15,"div",53),ye(),ie(16,"div",54)(17,"span"),Ze(18),ye(),ie(19,"span",55),Ze(20),ye()()()()),u&2){let d=pt(2);xt(15),Kr("width",d.progressPercent(),"%"),xt(3),qr(d.progressStatusText()),xt(2),vn("",d.progressPercent(),"%")}}function Xs(u,h){if(u&1){let d=Rn();ie(0,"div",20)(1,"div",56),Vt(),ie(2,"svg",57),et(3,"path",58),ye()(),$t(),ie(4,"div",48)(5,"h4",59),Ze(6),ye(),ie(7,"p",60),Ze(8),ye()(),ie(9,"div",61)(10,"button",62),jt("click",function(){Ut(d);let C=pt(2);return Ht(C.retryScan())}),Vt(),ie(11,"svg",7),et(12,"path",26),ye(),$t(),ie(13,"span"),Ze(14,"Try Again"),ye()(),ie(15,"button",63),jt("click",function(){Ut(d);let C=pt(2);return Ht(C.closeScanner())}),Ze(16," Close "),ye()()()}if(u&2){let d=pt(2);xt(6),vn(" ",d.scannerService.errorTitle()," "),xt(2),vn(" ",d.scannerService.errorMessage()," ")}}function Ws(u,h){if(u&1){let d=Rn();ie(0,"div",2),jt("click",function(C){Ut(d);let x=pt();return Ht(x.onBackdropClick(C))}),ie(1,"div",3),jt("click",function(C){return Ut(d),Ht(C.stopPropagation())}),ie(2,"div",4)(3,"div",5)(4,"div",6),Vt(),ie(5,"svg",7),et(6,"path",8)(7,"path",9),ye()(),$t(),ie(8,"div")(9,"h3",10),Ze(10,"Document Scanner"),ye(),ie(11,"p",11),Ze(12,"Barcode & Official Verification"),ye()()(),ie(13,"div",12),zt(14,Vs,3,0,"button",13),ie(15,"button",14),jt("click",function(){Ut(d);let C=pt();return Ht(C.closeScanner())}),Vt(),ie(16,"svg",15),et(17,"path",16),ye()()()(),$t(),ie(18,"div",17),zt(19,Gs,16,1,"div",18),zt(20,js,21,4,"div",19),zt(21,Xs,17,2,"div",20),ye(),ie(22,"div",21)(23,"span",22),et(24,"span",23),Ze(25," Secure Browser Scanner "),ye(),ie(26,"span",24),Ze(27,"JAHJK Central Registry"),ye()()()()}if(u&2){let d=pt();xt(14),Gt(d.availableDevices.length>1&&d.scannerState()===d.ScannerState.SCANNING?14:-1),xt(5),Gt(d.scannerState()===d.ScannerState.STARTING_CAMERA||d.scannerState()===d.ScannerState.SCANNING?19:-1),xt(),Gt(d.scannerState()===d.ScannerState.BARCODE_DETECTED||d.scannerState()===d.ScannerState.CHECKING_DOCUMENT||d.scannerState()===d.ScannerState.LOADING_DESTINATION||d.scannerState()===d.ScannerState.REDIRECTING?20:-1),xt(),Gt(d.scannerState()===d.ScannerState.ERROR?21:-1)}}var tn=class tn{constructor(){this.scannerService=Xr(ti);this.ScannerState=ei;this.scannerState=this.scannerService.state;this.progressPercent=this.scannerService.progress;this.progressStatusText=this.scannerService.progressStatusText;this.availableDevices=[];this.selectedDeviceId=null;this.mediaStream=null;this.animFrameId=null;this.nativeDetector=null;this.html5QrcodeInstance=null;this.isScanningLoopActive=!1;Jr(()=>{let h=this.scannerState(),d=this.scannerService.isOpen();d&&h==="STARTING_CAMERA"?setTimeout(()=>this.startCamera(),100):(!d||h==="BARCODE_DETECTED"||h==="ERROR")&&this.stopCameraStream()})}ngOnInit(){}ngOnDestroy(){this.stopCameraStream()}onBackdropClick(h){this.closeScanner()}closeScanner(){this.stopCameraStream(),this.scannerService.closeScanner()}
20retryScan(){this.stopCameraStream(),this.scannerService.openScanner()}startCamera(){return On(this,null,function*(){if(this.stopCameraStream(),typeof navigator<"u"&&!navigator.mediaDevices){let h=navigator,d=h.getUserMedia||h.webkitGetUserMedia||h.mozGetUserMedia||h.msGetUserMedia;d&&(h.mediaDevices={getUserMedia:m=>new Promise((C,x)=>{d.call(h,m,C,x)}),enumerateDevices:()=>On(this,null,function*(){return[]})})}if(typeof window<"u"&&window.isSecureContext===!1){this.scannerService.handleError("HTTPS Connection Required","Camera access is blocked because the site is loaded over HTTP. Please access this website using a secure HTTPS URL (https://).");return}if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){this.scannerService.handleError("Camera Unavailable","Camera access is not supported by your browser or environment. Please check your browser permissions.");return}try{try{let C=yield navigator.mediaDevices.enumerateDevices();this.availableDevices=C.filter(x=>x.kind==="videoinput")}catch{this.availableDevices=[]}let h={audio:!1,video:this.selectedDeviceId?{deviceId:{exact:this.selectedDeviceId}}:{facingMode:{ideal:"environment"},width:{ideal:1280},height:{ideal:720}}},d=yield navigator.mediaDevices.getUserMedia(h);this.mediaStream=d;let m=this.videoElementRef?.nativeElement;m&&(m.srcObject=d,yield m.play()),this.scannerService.state.set("SCANNING"),this.initBarcodeDetectionEngine()}catch(h){this.stopCameraStream(),h?.name==="NotAllowedError"||h?.name==="PermissionDeniedError"?this.scannerService.handleError("Camera Permission Denied","Camera access is required to scan the document. Please enable camera permission in your browser settings."):this.scannerService.handleError("Camera Unavailable",h?.message||"We could not access your device camera.")}})}initBarcodeDetectionEngine(){if(this.isScanningLoopActive=!0,typeof window<"u"&&"BarcodeDetector"in window)try{let h=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","pdf417","aztec","data_matrix"];this.nativeDetector=new window.BarcodeDetector({formats:h}),this.runNativeDetectionLoop();return}catch{}this.runHtml5QrcodeFallback()}runNativeDetectionLoop(){if(!this.isScanningLoopActive||this.scannerState()!=="SCANNING")return;let h=this.videoElementRef?.nativeElement;h&&h.readyState>=2&&this.nativeDetector?this.nativeDetector.detect(h).then(d=>{if(this.isScanningLoopActive){if(d&&d.length>0){let m=d[0].rawValue||d[0].rawValueText;if(m){this.onBarcodeDetected(m);return}}this.isScanningLoopActive&&(this.animFrameId=requestAnimationFrame(()=>this.runNativeDetectionLoop()))}}).catch(()=>{this.isScanningLoopActive&&(this.animFrameId=requestAnimationFrame(()=>this.runNativeDetectionLoop()))}):this.isScanningLoopActive&&(this.animFrameId=requestAnimationFrame(()=>this.runNativeDetectionLoop()))}runHtml5QrcodeFallback(){return On(this,null,function*(){try{this.html5QrcodeInstance=new en("html5-qr-reader",{formatsToSupport:[V.QR_CODE,V.CODE_128,V.CODE_39,V.EAN_13,V.PDF_417],verbose
20:!1});let h=this.selectedDeviceId||{facingMode:"environment"};yield this.html5QrcodeInstance.start(h,{fps:15,qrbox:{width:260,height:260},aspectRatio:1},d=>{this.onBarcodeDetected(d)},()=>{})}catch{this.runCanvasFramePollingFallback()}})}runCanvasFramePollingFallback(){!this.isScanningLoopActive||this.scannerState()!=="SCANNING"||(this.animFrameId=requestAnimationFrame(()=>this.runCanvasFramePollingFallback()))}onBarcodeDetected(h){this.isScanningLoopActive&&(this.isScanningLoopActive=!1,this.stopCameraStream(),this.scannerService.handleBarcodeScanned(h))}switchCamera(){if(this.availableDevices.length<=1)return;let d=(this.availableDevices.findIndex(m=>m.deviceId===this.selectedDeviceId)+1)%this.availableDevices.length;this.selectedDeviceId=this.availableDevices[d].deviceId,this.startCamera()}stopCameraStream(){if(this.isScanningLoopActive=!1,this.animFrameId!==null&&(cancelAnimationFrame(this.animFrameId),this.animFrameId=null),this.html5QrcodeInstance){try{this.html5QrcodeInstance.isScanning&&this.html5QrcodeInstance.stop().catch(()=>{})}catch{}this.html5QrcodeInstance=null}if(this.mediaStream&&(this.mediaStream.getTracks().forEach(h=>{try{h.stop(),h.enabled=!1}catch{}}),this.mediaStream=null),this.videoElementRef?.nativeElement){let h=this.videoElementRef.nativeElement;h.pause(),h.srcObject=null}this.nativeDetector=null}};tn.\u0275fac=function(d){return new(d||tn)},tn.\u0275cmp=Wr({type:tn,selectors:[["app-document-scanner"]],viewQuery:function(d,m){if(d&1&&Yr(Hs,5),d&2){let C;Zr(C=Qr())&&(m.videoElementRef=C.first)}},decls:1,vars:1,consts:[["videoElement",""],["role","dialog","aria-modal","true","aria-label","Document Barcode Scanner",1,"fixed","inset-0","z-[100]","flex","items-center","justify-center","bg-black/85","backdrop-blur-md","p-3","sm:p-6","transition-all","duration-300","animate-fade-in"],["role","dialog","aria-modal","true","aria-label","Document Barcode Scanner",1,"fixed","inset-0","z-[100]","flex","items-center","justify-center","bg-black/85","backdrop-blur-md","p-3","sm:p-6","transition-all","duration-300","animate-fade-in",3,"click"],[1,"relative","w-full","max-w-lg","overflow-hidden","rounded-3xl","bg-neutral-900","text-white","border","border-neutral-800","shadow-2xl","transition-all","duration-300",3,"click"],[1,"flex","items-center","justify-between","px-5","py-4","border-b","border-neutral-800/80","bg-neutral-900/90","backdrop-blur-sm","z-20","relative"],[1,"flex","items-center","gap-2.5"],[1,"w-8","h-8","rounded-xl","bg-[var(--brand-primary)]/15","border","border-[var(--brand-primary)]/40","flex","items-center","justify-center","text-[var(--brand-primary)]"],["fill","none","stroke","currentColor","stroke-width","2","viewBox","0 0 24 24",1,"w-4","h-4"],["stroke-linecap","round","stroke-linejoin","round","d","M6.827 6.175A2.31 2.31 0 015.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 00-1.134-.175 2.31 2.31 0 01-1.64-1.055l-.822-1.316a2.192 2.192 0 00-1.736-1.039 48.774 48.774 0 00-5.232 0 2.192 2.192 0 00-1.736 1.039l-.821 1.316z"],["stroke-linecap","round","stroke-linejoin","round","d","M16.5 12.75a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z"],[1,"text-sm","font-bold","tracking-tight","text-white"],[1,"text-[11px]","text-neutral-400"],[1,"flex","items-center","gap-2"],["type","button","title","Switch Camera","aria-label","Switch Camera",1,"p-2","rounded-xl","text-neutral-400","hover:text-white","hover:bg-neutral-800","transition","cursor-pointer"],["type","button","title","Close Scanner","aria-label","Close Scanner",1,"p-2","rounded-xl","text-neutral-400","hover:text-white","hover:bg-neutral-800","transition","cursor-pointer",3,"click"],["fill","none","stroke","currentColor","stroke-width","2","viewBox","0 0 24 24",1,"w-5","h-5"],["stroke-linecap","round","stroke-linejoin","round","d","M6 18L18 6M6 6l12 12"],[1,"relative","min-h-[360px]","sm:min-h-[420px]","flex","flex-col","items-center","justify-center","overflow-hidden","bg-black"],[1,"relative","w-full","h-full","min-h-[360px]","sm:min-h-[420px]","flex","items-center","justify-center","overflow-hidden"],[1,"w-full","py-12","px-6","flex","flex-col","items-center","justify-center","text-center","space-y-6","animate-fade-in","bg-neutral-900"],[1,"w-full","py-12","px-6","flex","flex-col","items-center","justify-center","text-center","space-y-5","animate-fade-in","bg-neutral-900"],[1,"px-5","py-3","border-t","border-neutral-800/80","bg-neutral-900/90","text-center","text-[11px]","text-neutral-400","font-medium","flex","items-center","justify-between"],[1,"flex","items-center","gap-1.5"],[1,"w-1.5","h-1.5","rounded-full","bg-emerald-500"],[1,"font-mono","text-[10px]","text-neutral-500"],["type","button","title","Switch Camera","aria-label","Switch Camera",1,"p-2","rounded-xl","text-neutral-400","hover:text-white","hover:bg-neutral-800","transition","cursor-pointer",3,"click"],["stroke-linecap","round","stroke-linejoin","round","d","M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"],["playsinline","","muted","","autoplay","",1,"absolute","
20inset-0","w-full","h-full","object-cover","z-0"],["id","html5-qr-reader",1,"hidden"],[1,"absolute","inset-0","z-10","bg-black/55","backdrop-blur-[1px]","flex","flex-col","items-center","justify-center","p-6"],[1,"relative","w-64","h-64","sm:w-72","sm:h-72","rounded-3xl","border-2","border-white/20","shadow-[0_0_0_9999px_rgba(0,0,0,0.55)]","overflow-hidden","flex","items-center","justify-center"],[1,"absolute","top-0","left-0","w-7","h-7","border-t-4","border-l-4","border-[var(--brand-primary)]","rounded-tl-2xl"],[1,"absolute","top-0","right-0","w-7","h-7","border-t-4","border-r-4","border-[var(--brand-primary)]","rounded-tr-2xl"],[1,"absolute","bottom-0","left-0","w-7","h-7","border-b-4","border-l-4","border-[var(--brand-primary)]","rounded-bl-2xl"],[1,"absolute","bottom-0","right-0","w-7","h-7","border-b-4","border-r-4","border-[var(--brand-primary)]","rounded-br-2xl"],[1,"scanner-laser-line"],[1,"mt-6","px-4","py-2","rounded-full","bg-neutral-900/90","border","border-neutral-700/80","text-xs","font-semibold","text-neutral-200","shadow-lg","text-center","backdrop-blur-md","flex","items-center","gap-2"],[1,"w-2","h-2","rounded-full","bg-emerald-500","animate-ping"],[1,"absolute","inset-0","z-20","bg-neutral-950","flex","flex-col","items-center","justify-center","p-6","space-y-3"],[1,"w-10","h-10","border-3","border-[var(--brand-primary)]","border-t-transparent","rounded-full","animate-spin"],[1,"text-xs","font-bold","text-neutral-300"],[1,"relative"],[1,"w-20","h-20","rounded-full","bg-emerald-500/15","border-2","border-emerald-500/40","flex","items-center","justify-center","text-emerald-400","shadow-xl","animate-bounce-short"],["fill","none","stroke","currentColor","stroke-width","3","viewBox","0 0 24 24",1,"w-10","h-10"],["stroke-linecap","round","stroke-linejoin","round","d","M4.5 12.75l6 6 9-13.5"],[1,"absolute","-top-1","-right-1","flex","h-4","w-4"],[1,"animate-ping","absolute","inline-flex","h-full","w-full","rounded-full","bg-emerald-400","opacity-75"],[1,"relative","inline-flex","rounded-full","h-4","w-4","bg-emerald-500"],[1,"space-y-1.5","max-w-sm"],[1,"text-xl","sm:text-2xl","font-black","text-white","tracking-tight"],[1,"text-xs","text-neutral-400","leading-relaxed","font-normal"],[1,"w-full","max-w-xs","space-y-2","pt-2"],[1,"h-2.5","w-full","bg-neutral-800","rounded-full","overflow-hidden","p-0.5","border","border-neutral-700/60"],[1,"h-full","bg-gradient-to-r","from-emerald-500","to-[var(--brand-primary)]","rounded-full","transition-all","duration-300","ease-out"],[1,"flex","items-center","justify-between","text-[11px]","font-bold","font-mono","text-neutral-400"],[1,"text-emerald-400","font-extrabold"],[1,"w-16","h-16","rounded-2xl","bg-rose-500/15","border","border-rose-500/30","text-rose-500","flex","items-center","justify-center","shadow-lg"],["fill","none","stroke","currentColor","stroke-width","2","viewBox","0 0 24 24",1,"w-8","h-8"],["stroke-linecap","round","stroke-linejoin","round","d","M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"],[1,"text-lg","font-bold","text-white"],[1,"text-xs","text-neutral-400","leading-relaxed"],[1,"pt-2","flex","items-center","gap-3"],["type","button",1,"px-5","py-2.5","rounded-xl","text-xs","font-bold","bg-[var(--brand-primary)]","text-white","hover:bg-[var(--brand-primary-hover)]","transition","shadow-md","cursor-pointer","flex","items-center","gap-2",3,"click"],["type","button",1,"px-4","py-2.5","rounded-xl","text-xs","font-semibold","bg-neutral-800","text-neutral-300","hover:text-white","hover:bg-neutral-700","transition","cursor-pointer",3,"click"]],template:function(d,m){d&1&&zt(0,Ws,28,4,"div",1),d&2&&Gt(m.scannerService.isOpen()?0:-1)},dependencies:[$r],styles:[".scanner-laser-line[_ngcontent-%COMP%]{position:absolute;left:0;right:0;height:3px;background:linear-gradient(90deg,transparent 0%,#10b981 50%,transparent 100%);box-shadow:0 0 15px #10b981;animation:_ngcontent-%COMP%_scanLaser 2s linear infinite}@keyframes _ngcontent-%COMP%_scanLaser{0%{top:5%}50%{top:90%}to{top:5%}}@keyframes _ngcontent-%COMP%_bounceShort{0%,to{transform:translateY(0)}50%{transform:translateY(-8px)}}.animate-bounce-short[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_bounceShort 1.5s ease-in-out infinite}"]});var Oi=tn;export{Oi as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.