40 lines
723 KiB
JavaScript
40 lines
723 KiB
JavaScript
import{_ as vi,i as si,c as Nr,o as fr,b as ci,a as tn,n as $i,x as ea,y as Za,m as Xi,F as V1,r as H1,j as ta,z as zo,A as ti,B as G1,e as Qt,d as Xt,C as X1,D as ja,p as Vn,t as Ka,w as W1,f as z1,g as Y1,k as qa,T as Z1,s as j1}from"./main-D6qyxymd.js";function K1(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in r)){const s=Object.getOwnPropertyDescriptor(n,a);s&&Object.defineProperty(r,a,s.get?s:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const q1={props:{content:{type:Object,required:!0}},emits:["trigger-event","update:content"],watch:{"content.useCustomPagination"(r){r&&this.$emit("update:content",{collectionId:null})}},computed:{isEditing(){return!1},paginationOptions(){return this.content.useCustomPagination?{limit:this.content.paginatorLimit,offset:this.content.paginatorOffset,total:this.content.paginatorTotal}:this.content.collectionId?wwLib.wwCollection.getPaginationOptions(this.content.collectionId):null},nbPage(){if(!this.paginationOptions)return 10;const r=Math.ceil(this.paginationOptions.total/this.paginationOptions.limit);return isNaN(r)?1:r},currentPage(){if(!this.paginationOptions)return 1;const r=Math.floor(this.paginationOptions.offset/this.paginationOptions.limit);return isNaN(r)?0:r},navigation(){const r=this.nbPage-1,e=this.currentPage-1,t=this.currentPage+1;let n=0,a=[];return a.push({label:"1",index:0,states:this.currentPage===0?["active"]:[]}),e>n&&(e>n+1&&a.push({label:"...",index:-1}),a.push({label:`${e+1}`,index:e}),n=e),this.currentPage!==0&&this.currentPage!==r&&(a.push({label:`${this.currentPage+1}`,index:this.currentPage,states:["active"]}),n=this.currentPage),t<r&&t>n&&(a.push({label:`${t+1}`,index:t}),n=t,t<r-1&&a.push({label:"...",index:-1})),r>n&&a.push({label:`${r+1}`,index:r,states:r===this.currentPage?["active"]:[]}),a}},methods:{goTo(r){this.paginationOptions&&r!==-1&&r!==this.currentPage&&(this.content.useCustomPagination||wwLib.wwCollection.setOffset(this.content.collectionId,r*this.paginationOptions.limit),this.$emit("trigger-event",{name:"change",event:{context:{offset:r*this.paginationOptions.limit,page:r+1,total:this.paginationOptions.total,limit:this.paginationOptions.limit}}}))},prev(){this.currentPage>0&&this.goTo(this.currentPage-1)},next(){this.currentPage<this.nbPage-1&&this.goTo(this.currentPage+1)}}},Q1={role:"navigation"},J1=["aria-current","onClick"];function $1(r,e,t,n,a,s){const f=si("wwObject"),h=si("wwElement",!0),x=si("wwLayoutItemContext");return fr(),Nr("nav",Q1,[ci("ul",null,[ci("li",{class:$i({"hide-icon":!s.isEditing&&s.currentPage===0}),onClick:e[0]||(e[0]=(...g)=>s.prev&&s.prev(...g))},[t.content.paginatorPrev?(fr(),ea(f,Za(Xi({key:0},t.content.paginatorPrev)),null,16)):tn("",!0)],2),t.content.paginatorText?(fr(!0),Nr(V1,{key:0},H1(s.navigation,(g,w)=>(fr(),Nr("li",{key:w,"aria-current":g.index===s.currentPage,onClick:A=>s.goTo(g.index)},[ta(x,{"is-repeat":"",index:w},{default:zo(()=>[ta(h,Xi({ref_for:!0},t.content.paginatorText,{"ww-props":{text:g.label},states:g.states}),null,16,["ww-props","states"])]),_:2},1032,["index"])],8,J1))),128)):tn("",!0),ci("li",{class:$i({"hide-icon":!s.isEditing&&s.currentPage===s.nbPage-1}),onClick:e[1]||(e[1]=(...g)=>s.next&&s.next(...g))},[t.content.paginatorNext?(fr(),ea(f,Za(Xi({key:0},t.content.paginatorNext)),null,16)):tn("",!0)],2)])])}const _u=vi(q1,[["render",$1],["__scopeId","data-v-d4cb42c6"]]);var oe;(function(r){r[r.QR_CODE=0]="QR_CODE",r[r.AZTEC=1]="AZTEC",r[r.CODABAR=2]="CODABAR",r[r.CODE_39=3]="CODE_39",r[r.CODE_93=4]="CODE_93",r[r.CODE_128=5]="CODE_128",r[r.DATA_MATRIX=6]="DATA_MATRIX",r[r.MAXICODE=7]="MAXICODE",r[r.ITF=8]="ITF",r[r.EAN_13=9]="EAN_13",r[r.EAN_8=10]="EAN_8",r[r.PDF_417=11]="PDF_417",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(oe||(oe={}));var Qa=new Map([[oe.QR_CODE,"QR_CODE"],[oe.AZTEC,"AZTEC"],[oe.CODABAR,"CODABAR"],[oe.CODE_39,"CODE_39"],[oe.CODE_93,"CODE_93"],[oe.CODE_128,"CODE_128"],[oe.DATA_MATRIX,"DATA_MATRIX"],[oe.MAXICODE,"MAXICODE"],[oe.ITF,"ITF"],[oe.EAN_13,"EAN_13"],[oe.EAN_8,"EAN_8"],[oe.PDF_417,"PDF_417"],[oe.RSS_14,"RSS_14"],[oe.RSS_EXPANDED,"RSS_EXPANDED"],[oe.UPC_A,"UPC_A"],[oe.UPC_E,"UPC_E"],[oe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Ja;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.URL=1]="URL"})(Ja||(Ja={}));function es(r){return Object.values(oe).includes(r)}var hi;(function(r){r[r.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",r[r.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(hi||(hi={}));var ts=(function(){function r(){}return r.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",r.SCAN_DEFAULT_FPS=2,r.DEFAULT_DISABLE_FLIP=!1,r.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,r.DEFAULT_SUPPORTED_SCAN_TYPE=[hi.SCAN_TYPE_CAMERA,hi.SCAN_TYPE_FILE],r})(),Yo=(function(){function r(e,t){this.format=e,this.formatName=t}return r.prototype.toString=function(){return this.formatName},r.create=function(e){if(!Qa.has(e))throw"".concat(e," not in html5QrcodeSupportedFormatsTextMap");return new r(e,Qa.get(e))},r})(),$a=(function(){function r(){}return r.createFromText=function(e){var t={text:e};return{decodedText:e,result:t}},r.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},r})(),ra;(function(r){r[r.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",r[r.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",r[r.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(ra||(ra={}));var rs=(function(){function r(){}return r.createFrom=function(e){return{errorMessage:e,type:ra.UNKWOWN_ERROR}},r})(),ns=(function(){function r(e){this.verbose=e}return r.prototype.log=function(e){this.verbose&&console.log(e)},r.prototype.warn=function(e){this.verbose&&console.warn(e)},r.prototype.logError=function(e,t){(this.verbose||t===!0)&&console.error(e)},r.prototype.logErrors=function(e){if(e.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},r})();function Or(r){return typeof r>"u"||r===null}var gn=(function(){function r(){}return r.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},r.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},r.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},r.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},r.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},r.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},r.scannerPaused=function(){return"Scanner paused"},r})(),Zo=(function(){function r(){}return r.isMediaStreamConstraintsValid=function(e,t){if(typeof e!="object"){var n=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var a=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],s=new Set(a),f=Object.keys(e),h=0,x=f;h<x.length;h++){var g=x[h];if(s.has(g))return t.logError("".concat(g," is not supported videoConstaints."),!0),!1}return!0},r})(),Bn={exports:{}},is=Bn.exports,eo;function as(){return eo||(eo=1,(function(r,e){(function(t,n){n(e)})(is,(function(t){function n(m){return m==null}var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,i){m.__proto__=i}||function(m,i){for(var o in i)i.hasOwnProperty(o)&&(m[o]=i[o])};function s(m,i){a(m,i);function o(){this.constructor=m}m.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}function f(m,i){var o=Object.setPrototypeOf;o?o(m,i):m.__proto__=i}function h(m,i){i===void 0&&(i=m.constructor);var o=Error.captureStackTrace;o&&o(m,i)}var x=(function(m){s(i,m);function i(o){var c=this.constructor,u=m.call(this,o)||this;return Object.defineProperty(u,"name",{value:c.name,enumerable:!1}),f(u,c.prototype),h(u),u}return i})(Error);class g extends x{constructor(i=void 0){super(i),this.message=i}getKind(){return this.constructor.kind}}g.kind="Exception";class w extends g{}w.kind="ArgumentException";class A extends g{}A.kind="IllegalArgumentException";class E{constructor(i){if(this.binarizer=i,i===null)throw new A("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(i,o){return this.binarizer.getBlackRow(i,o)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(i,o,c,u){const l=this.binarizer.getLuminanceSource().crop(i,o,c,u);return new E(this.binarizer.createBinarizer(l))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const i=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new E(this.binarizer.createBinarizer(i))}rotateCounterClockwise45(){const i=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new E(this.binarizer.createBinarizer(i))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class C extends g{static getChecksumInstance(){return new C}}C.kind="ChecksumException";class b{constructor(i){this.source=i}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class T{static arraycopy(i,o,c,u,l){for(;l--;)c[u++]=i[o++]}static currentTimeMillis(){return Date.now()}}class P extends g{}P.kind="IndexOutOfBoundsException";class F extends P{constructor(i=void 0,o=void 0){super(o),this.index=i,this.message=o}}F.kind="ArrayIndexOutOfBoundsException";class D{static fill(i,o){for(let c=0,u=i.length;c<u;c++)i[c]=o}static fillWithin(i,o,c,u){D.rangeCheck(i.length,o,c);for(let l=o;l<c;l++)i[l]=u}static rangeCheck(i,o,c){if(o>c)throw new A("fromIndex("+o+") > toIndex("+c+")");if(o<0)throw new F(o);if(c>i)throw new F(c)}static asList(...i){return i}static create(i,o,c){return Array.from({length:i}).map(l=>Array.from({length:o}).fill(c))}static createInt32Array(i,o,c){return Array.from({length:i}).map(l=>Int32Array.from({length:o}).fill(c))}static equals(i,o){if(!i||!o||!i.length||!o.length||i.length!==o.length)return!1;for(let c=0,u=i.length;c<u;c++)if(i[c]!==o[c])return!1;return!0}static hashCode(i){if(i===null)return 0;let o=1;for(const c of i)o=31*o+c;return o}static fillUint8Array(i,o){for(let c=0;c!==i.length;c++)i[c]=o}static copyOf(i,o){return i.slice(0,o)}static copyOfUint8Array(i,o){if(i.length<=o){const c=new Uint8Array(o);return c.set(i),c}return i.slice(0,o)}static copyOfRange(i,o,c){const u=c-o,l=new Int32Array(u);return T.arraycopy(i,o,l,0,u),l}static binarySearch(i,o,c){c===void 0&&(c=D.numberComparator);let u=0,l=i.length-1;for(;u<=l;){const d=l+u>>1,p=c(o,i[d]);if(p>0)u=d+1;else if(p<0)l=d-1;else return d}return-u-1}static numberComparator(i,o){return i-o}}class L{static numberOfTrailingZeros(i){let o;if(i===0)return 32;let c=31;return o=i<<16,o!==0&&(c-=16,i=o),o=i<<8,o!==0&&(c-=8,i=o),o=i<<4,o!==0&&(c-=4,i=o),o=i<<2,o!==0&&(c-=2,i=o),c-(i<<1>>>31)}static numberOfLeadingZeros(i){if(i===0)return 32;let o=1;return i>>>16||(o+=16,i<<=16),i>>>24||(o+=8,i<<=8),i>>>28||(o+=4,i<<=4),i>>>30||(o+=2,i<<=2),o-=i>>>31,o}static toHexString(i){return i.toString(16)}static toBinaryString(i){return String(parseInt(String(i),2))}static bitCount(i){return i=i-(i>>>1&1431655765),i=(i&858993459)+(i>>>2&858993459),i=i+(i>>>4)&252645135,i=i+(i>>>8),i=i+(i>>>16),i&63}static truncDivision(i,o){return Math.trunc(i/o)}static parseInt(i,o=void 0){return parseInt(i,o)}}L.MIN_VALUE_32_BITS=-2147483648,L.MAX_VALUE=Number.MAX_SAFE_INTEGER;class k{constructor(i,o){i===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=i,o==null?this.bits=k.makeArray(i):this.bits=o)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(i){if(i>this.bits.length*32){const o=k.makeArray(i);T.arraycopy(this.bits,0,o,0,this.bits.length),this.bits=o}}get(i){return(this.bits[Math.floor(i/32)]&1<<(i&31))!==0}set(i){this.bits[Math.floor(i/32)]|=1<<(i&31)}flip(i){this.bits[Math.floor(i/32)]^=1<<(i&31)}getNextSet(i){const o=this.size;if(i>=o)return o;const c=this.bits;let u=Math.floor(i/32),l=c[u];l&=~((1<<(i&31))-1);const d=c.length;for(;l===0;){if(++u===d)return o;l=c[u]}const p=u*32+L.numberOfTrailingZeros(l);return p>o?o:p}getNextUnset(i){const o=this.size;if(i>=o)return o;const c=this.bits;let u=Math.floor(i/32),l=~c[u];l&=~((1<<(i&31))-1);const d=c.length;for(;l===0;){if(++u===d)return o;l=~c[u]}const p=u*32+L.numberOfTrailingZeros(l);return p>o?o:p}setBulk(i,o){this.bits[Math.floor(i/32)]=o}setRange(i,o){if(o<i||i<0||o>this.size)throw new A;if(o===i)return;o--;const c=Math.floor(i/32),u=Math.floor(o/32),l=this.bits;for(let d=c;d<=u;d++){const p=d>c?0:i&31,y=(2<<(d<u?31:o&31))-(1<<p);l[d]|=y}}clear(){const i=this.bits.length,o=this.bits;for(let c=0;c<i;c++)o[c]=0}isRange(i,o,c){if(o<i||i<0||o>this.size)throw new A;if(o===i)return!0;o--;const u=Math.floor(i/32),l=Math.floor(o/32),d=this.bits;for(let p=u;p<=l;p++){const v=p>u?0:i&31,_=(2<<(p<l?31:o&31))-(1<<v)&4294967295;if((d[p]&_)!==(c?_:0))return!1}return!0}appendBit(i){this.ensureCapacity(this.size+1),i&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(i,o){if(o<0||o>32)throw new A("Num bits must be between 0 and 32");this.ensureCapacity(this.size+o);for(let c=o;c>0;c--)this.appendBit((i>>c-1&1)===1)}appendBitArray(i){const o=i.size;this.ensureCapacity(this.size+o);for(let c=0;c<o;c++)this.appendBit(i.get(c))}xor(i){if(this.size!==i.size)throw new A("Sizes don't match");const o=this.bits;for(let c=0,u=o.length;c<u;c++)o[c]^=i.bits[c]}toBytes(i,o,c,u){for(let l=0;l<u;l++){let d=0;for(let p=0;p<8;p++)this.get(i)&&(d|=1<<7-p),i++;o[c+l]=d}}getBitArray(){return this.bits}reverse(){const i=new Int32Array(this.bits.length),o=Math.floor((this.size-1)/32),c=o+1,u=this.bits;for(let l=0;l<c;l++){let d=u[l];d=d>>1&1431655765|(d&1431655765)<<1,d=d>>2&858993459|(d&858993459)<<2,d=d>>4&252645135|(d&252645135)<<4,d=d>>8&16711935|(d&16711935)<<8,d=d>>16&65535|(d&65535)<<16,i[o-l]=d}if(this.size!==c*32){const l=c*32-this.size;let d=i[0]>>>l;for(let p=1;p<c;p++){const v=i[p];d|=v<<32-l,i[p-1]=d,d=v>>>l}i[c-1]=d}this.bits=i}static makeArray(i){return new Int32Array(Math.floor((i+31)/32))}equals(i){if(!(i instanceof k))return!1;const o=i;return this.size===o.size&&D.equals(this.bits,o.bits)}hashCode(){return 31*this.size+D.hashCode(this.bits)}toString(){let i="";for(let o=0,c=this.size;o<c;o++)(o&7)===0&&(i+=" "),i+=this.get(o)?"X":".";return i}clone(){return new k(this.size,this.bits.slice())}}var q;(function(m){m[m.OTHER=0]="OTHER",m[m.PURE_BARCODE=1]="PURE_BARCODE",m[m.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",m[m.TRY_HARDER=3]="TRY_HARDER",m[m.CHARACTER_SET=4]="CHARACTER_SET",m[m.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",m[m.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",m[m.ASSUME_GS1=7]="ASSUME_GS1",m[m.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",m[m.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",m[m.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(q||(q={}));var K=q;class U extends g{static getFormatInstance(){return new U}}U.kind="FormatException";var $;(function(m){m[m.Cp437=0]="Cp437",m[m.ISO8859_1=1]="ISO8859_1",m[m.ISO8859_2=2]="ISO8859_2",m[m.ISO8859_3=3]="ISO8859_3",m[m.ISO8859_4=4]="ISO8859_4",m[m.ISO8859_5=5]="ISO8859_5",m[m.ISO8859_6=6]="ISO8859_6",m[m.ISO8859_7=7]="ISO8859_7",m[m.ISO8859_8=8]="ISO8859_8",m[m.ISO8859_9=9]="ISO8859_9",m[m.ISO8859_10=10]="ISO8859_10",m[m.ISO8859_11=11]="ISO8859_11",m[m.ISO8859_13=12]="ISO8859_13",m[m.ISO8859_14=13]="ISO8859_14",m[m.ISO8859_15=14]="ISO8859_15",m[m.ISO8859_16=15]="ISO8859_16",m[m.SJIS=16]="SJIS",m[m.Cp1250=17]="Cp1250",m[m.Cp1251=18]="Cp1251",m[m.Cp1252=19]="Cp1252",m[m.Cp1256=20]="Cp1256",m[m.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",m[m.UTF8=22]="UTF8",m[m.ASCII=23]="ASCII",m[m.Big5=24]="Big5",m[m.GB18030=25]="GB18030",m[m.EUC_KR=26]="EUC_KR"})($||($={}));class Y{constructor(i,o,c,...u){this.valueIdentifier=i,this.name=c,typeof o=="number"?this.values=Int32Array.from([o]):this.values=o,this.otherEncodingNames=u,Y.VALUE_IDENTIFIER_TO_ECI.set(i,this),Y.NAME_TO_ECI.set(c,this);const l=this.values;for(let d=0,p=l.length;d!==p;d++){const v=l[d];Y.VALUES_TO_ECI.set(v,this)}for(const d of u)Y.NAME_TO_ECI.set(d,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(i){if(i<0||i>=900)throw new U("incorect value");const o=Y.VALUES_TO_ECI.get(i);if(o===void 0)throw new U("incorect value");return o}static getCharacterSetECIByName(i){const o=Y.NAME_TO_ECI.get(i);if(o===void 0)throw new U("incorect value");return o}equals(i){if(!(i instanceof Y))return!1;const o=i;return this.getName()===o.getName()}}Y.VALUE_IDENTIFIER_TO_ECI=new Map,Y.VALUES_TO_ECI=new Map,Y.NAME_TO_ECI=new Map,Y.Cp437=new Y($.Cp437,Int32Array.from([0,2]),"Cp437"),Y.ISO8859_1=new Y($.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),Y.ISO8859_2=new Y($.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),Y.ISO8859_3=new Y($.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),Y.ISO8859_4=new Y($.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),Y.ISO8859_5=new Y($.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),Y.ISO8859_6=new Y($.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),Y.ISO8859_7=new Y($.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),Y.ISO8859_8=new Y($.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),Y.ISO8859_9=new Y($.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),Y.ISO8859_10=new Y($.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),Y.ISO8859_11=new Y($.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),Y.ISO8859_13=new Y($.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),Y.ISO8859_14=new Y($.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),Y.ISO8859_15=new Y($.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),Y.ISO8859_16=new Y($.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),Y.SJIS=new Y($.SJIS,20,"SJIS","Shift_JIS"),Y.Cp1250=new Y($.Cp1250,21,"Cp1250","windows-1250"),Y.Cp1251=new Y($.Cp1251,22,"Cp1251","windows-1251"),Y.Cp1252=new Y($.Cp1252,23,"Cp1252","windows-1252"),Y.Cp1256=new Y($.Cp1256,24,"Cp1256","windows-1256"),Y.UnicodeBigUnmarked=new Y($.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),Y.UTF8=new Y($.UTF8,26,"UTF8","UTF-8"),Y.ASCII=new Y($.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),Y.Big5=new Y($.Big5,28,"Big5"),Y.GB18030=new Y($.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),Y.EUC_KR=new Y($.EUC_KR,30,"EUC_KR","EUC-KR");class ue extends g{}ue.kind="UnsupportedOperationException";class _e{static decode(i,o){const c=this.encodingName(o);return this.customDecoder?this.customDecoder(i,c):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(c)?this.decodeFallback(i,c):new TextDecoder(c).decode(i)}static shouldDecodeOnFallback(i){return!_e.isBrowser()&&i==="ISO-8859-1"}static encode(i,o){const c=this.encodingName(o);return this.customEncoder?this.customEncoder(i,c):typeof TextEncoder>"u"?this.encodeFallback(i):new TextEncoder().encode(i)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(i){return typeof i=="string"?i:i.getName()}static encodingCharacterSet(i){return i instanceof Y?i:Y.getCharacterSetECIByName(i)}static decodeFallback(i,o){const c=this.encodingCharacterSet(o);if(_e.isDecodeFallbackSupported(c)){let u="";for(let l=0,d=i.length;l<d;l++){let p=i[l].toString(16);p.length<2&&(p="0"+p),u+="%"+p}return decodeURIComponent(u)}if(c.equals(Y.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(i.buffer));throw new ue(`Encoding ${this.encodingName(o)} not supported by fallback.`)}static isDecodeFallbackSupported(i){return i.equals(Y.UTF8)||i.equals(Y.ISO8859_1)||i.equals(Y.ASCII)}static encodeFallback(i){const c=btoa(unescape(encodeURIComponent(i))).split(""),u=[];for(let l=0;l<c.length;l++)u.push(c[l].charCodeAt(0));return new Uint8Array(u)}}class Z{static castAsNonUtf8Char(i,o=null){const c=o?o.getName():this.ISO88591;return _e.decode(new Uint8Array([i]),c)}static guessEncoding(i,o){if(o!=null&&o.get(K.CHARACTER_SET)!==void 0)return o.get(K.CHARACTER_SET).toString();const c=i.length;let u=!0,l=!0,d=!0,p=0,v=0,y=0,_=0,I=0,S=0,R=0,M=0,B=0,V=0,z=0;const ee=i.length>3&&i[0]===239&&i[1]===187&&i[2]===191;for(let te=0;te<c&&(u||l||d);te++){const J=i[te]&255;d&&(p>0?(J&128)===0?d=!1:p--:(J&128)!==0&&((J&64)===0?d=!1:(p++,(J&32)===0?v++:(p++,(J&16)===0?y++:(p++,(J&8)===0?_++:d=!1))))),u&&(J>127&&J<160?u=!1:J>159&&(J<192||J===215||J===247)&&z++),l&&(I>0?J<64||J===127||J>252?l=!1:I--:J===128||J===160||J>239?l=!1:J>160&&J<224?(S++,M=0,R++,R>B&&(B=R)):J>127?(I++,R=0,M++,M>V&&(V=M)):(R=0,M=0))}return d&&p>0&&(d=!1),l&&I>0&&(l=!1),d&&(ee||v+y+_>0)?Z.UTF8:l&&(Z.ASSUME_SHIFT_JIS||B>=3||V>=3)?Z.SHIFT_JIS:u&&l?B===2&&S===2||z*10>=c?Z.SHIFT_JIS:Z.ISO88591:u?Z.ISO88591:l?Z.SHIFT_JIS:d?Z.UTF8:Z.PLATFORM_DEFAULT_ENCODING}static format(i,...o){let c=-1;function u(d,p,v,y,_,I){if(d==="%%")return"%";if(o[++c]===void 0)return;d=y?parseInt(y.substr(1)):void 0;let S=_?parseInt(_.substr(1)):void 0,R;switch(I){case"s":R=o[c];break;case"c":R=o[c][0];break;case"f":R=parseFloat(o[c]).toFixed(d);break;case"p":R=parseFloat(o[c]).toPrecision(d);break;case"e":R=parseFloat(o[c]).toExponential(d);break;case"x":R=parseInt(o[c]).toString(S||16);break;case"d":R=parseFloat(parseInt(o[c],S||10).toPrecision(d)).toFixed(0);break}R=typeof R=="object"?JSON.stringify(R):(+R).toString(S);let M=parseInt(v),B=v&&v[0]+""=="0"?"0":" ";for(;R.length<M;)R=p!==void 0?R+B:B+R;return R}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return i.replace(l,u)}static getBytes(i,o){return _e.encode(i,o)}static getCharCode(i,o=0){return i.charCodeAt(o)}static getCharAt(i){return String.fromCharCode(i)}}Z.SHIFT_JIS=Y.SJIS.getName(),Z.GB2312="GB2312",Z.ISO88591=Y.ISO8859_1.getName(),Z.EUC_JP="EUC_JP",Z.UTF8=Y.UTF8.getName(),Z.PLATFORM_DEFAULT_ENCODING=Z.UTF8,Z.ASSUME_SHIFT_JIS=!1;class ne{constructor(i=""){this.value=i}enableDecoding(i){return this.encoding=i,this}append(i){return typeof i=="string"?this.value+=i.toString():this.encoding?this.value+=Z.castAsNonUtf8Char(i,this.encoding):this.value+=String.fromCharCode(i),this}appendChars(i,o,c){for(let u=o;o<o+c;u++)this.append(i[u]);return this}length(){return this.value.length}charAt(i){return this.value.charAt(i)}deleteCharAt(i){this.value=this.value.substr(0,i)+this.value.substring(i+1)}setCharAt(i,o){this.value=this.value.substr(0,i)+o+this.value.substr(i+1)}substring(i,o){return this.value.substring(i,o)}setLengthToZero(){this.value=""}toString(){return this.value}insert(i,o){this.value=this.value.substr(0,i)+o+this.value.substr(i+o.length)}}class le{constructor(i,o,c,u){if(this.width=i,this.height=o,this.rowSize=c,this.bits=u,o==null&&(o=i),this.height=o,i<1||o<1)throw new A("Both dimensions must be greater than 0");c==null&&(c=Math.floor((i+31)/32)),this.rowSize=c,u==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(i){const o=i.length,c=i[0].length,u=new le(c,o);for(let l=0;l<o;l++){const d=i[l];for(let p=0;p<c;p++)d[p]&&u.set(p,l)}return u}static parseFromString(i,o,c){if(i===null)throw new A("stringRepresentation cannot be null");const u=new Array(i.length);let l=0,d=0,p=-1,v=0,y=0;for(;y<i.length;)if(i.charAt(y)===`
|
||
`||i.charAt(y)==="\r"){if(l>d){if(p===-1)p=l-d;else if(l-d!==p)throw new A("row lengths do not match");d=l,v++}y++}else if(i.substring(y,y+o.length)===o)y+=o.length,u[l]=!0,l++;else if(i.substring(y,y+c.length)===c)y+=c.length,u[l]=!1,l++;else throw new A("illegal character encountered: "+i.substring(y));if(l>d){if(p===-1)p=l-d;else if(l-d!==p)throw new A("row lengths do not match");v++}const _=new le(p,v);for(let I=0;I<l;I++)u[I]&&_.set(Math.floor(I%p),Math.floor(I/p));return _}get(i,o){const c=o*this.rowSize+Math.floor(i/32);return(this.bits[c]>>>(i&31)&1)!==0}set(i,o){const c=o*this.rowSize+Math.floor(i/32);this.bits[c]|=1<<(i&31)&4294967295}unset(i,o){const c=o*this.rowSize+Math.floor(i/32);this.bits[c]&=~(1<<(i&31)&4294967295)}flip(i,o){const c=o*this.rowSize+Math.floor(i/32);this.bits[c]^=1<<(i&31)&4294967295}xor(i){if(this.width!==i.getWidth()||this.height!==i.getHeight()||this.rowSize!==i.getRowSize())throw new A("input matrix dimensions do not match");const o=new k(Math.floor(this.width/32)+1),c=this.rowSize,u=this.bits;for(let l=0,d=this.height;l<d;l++){const p=l*c,v=i.getRow(l,o).getBitArray();for(let y=0;y<c;y++)u[p+y]^=v[y]}}clear(){const i=this.bits,o=i.length;for(let c=0;c<o;c++)i[c]=0}setRegion(i,o,c,u){if(o<0||i<0)throw new A("Left and top must be nonnegative");if(u<1||c<1)throw new A("Height and width must be at least 1");const l=i+c,d=o+u;if(d>this.height||l>this.width)throw new A("The region must fit inside the matrix");const p=this.rowSize,v=this.bits;for(let y=o;y<d;y++){const _=y*p;for(let I=i;I<l;I++)v[_+Math.floor(I/32)]|=1<<(I&31)&4294967295}}getRow(i,o){o==null||o.getSize()<this.width?o=new k(this.width):o.clear();const c=this.rowSize,u=this.bits,l=i*c;for(let d=0;d<c;d++)o.setBulk(d*32,u[l+d]);return o}setRow(i,o){T.arraycopy(o.getBitArray(),0,this.bits,i*this.rowSize,this.rowSize)}rotate180(){const i=this.getWidth(),o=this.getHeight();let c=new k(i),u=new k(i);for(let l=0,d=Math.floor((o+1)/2);l<d;l++)c=this.getRow(l,c),u=this.getRow(o-1-l,u),c.reverse(),u.reverse(),this.setRow(l,u),this.setRow(o-1-l,c)}getEnclosingRectangle(){const i=this.width,o=this.height,c=this.rowSize,u=this.bits;let l=i,d=o,p=-1,v=-1;for(let y=0;y<o;y++)for(let _=0;_<c;_++){const I=u[y*c+_];if(I!==0){if(y<d&&(d=y),y>v&&(v=y),_*32<l){let S=0;for(;(I<<31-S&4294967295)===0;)S++;_*32+S<l&&(l=_*32+S)}if(_*32+31>p){let S=31;for(;!(I>>>S);)S--;_*32+S>p&&(p=_*32+S)}}}return p<l||v<d?null:Int32Array.from([l,d,p-l+1,v-d+1])}getTopLeftOnBit(){const i=this.rowSize,o=this.bits;let c=0;for(;c<o.length&&o[c]===0;)c++;if(c===o.length)return null;const u=c/i;let l=c%i*32;const d=o[c];let p=0;for(;(d<<31-p&4294967295)===0;)p++;return l+=p,Int32Array.from([l,u])}getBottomRightOnBit(){const i=this.rowSize,o=this.bits;let c=o.length-1;for(;c>=0&&o[c]===0;)c--;if(c<0)return null;const u=Math.floor(c/i);let l=Math.floor(c%i)*32;const d=o[c];let p=31;for(;!(d>>>p);)p--;return l+=p,Int32Array.from([l,u])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(i){if(!(i instanceof le))return!1;const o=i;return this.width===o.width&&this.height===o.height&&this.rowSize===o.rowSize&&D.equals(this.bits,o.bits)}hashCode(){let i=this.width;return i=31*i+this.width,i=31*i+this.height,i=31*i+this.rowSize,i=31*i+D.hashCode(this.bits),i}toString(i="X ",o=" ",c=`
|
||
`){return this.buildToString(i,o,c)}buildToString(i,o,c){let u=new ne;for(let l=0,d=this.height;l<d;l++){for(let p=0,v=this.width;p<v;p++)u.append(this.get(p,l)?i:o);u.append(c)}return u.toString()}clone(){return new le(this.width,this.height,this.rowSize,this.bits.slice())}}class X extends g{static getNotFoundInstance(){return new X}}X.kind="NotFoundException";class me extends b{constructor(i){super(i),this.luminances=me.EMPTY,this.buckets=new Int32Array(me.LUMINANCE_BUCKETS)}getBlackRow(i,o){const c=this.getLuminanceSource(),u=c.getWidth();o==null||o.getSize()<u?o=new k(u):o.clear(),this.initArrays(u);const l=c.getRow(i,this.luminances),d=this.buckets;for(let v=0;v<u;v++)d[(l[v]&255)>>me.LUMINANCE_SHIFT]++;const p=me.estimateBlackPoint(d);if(u<3)for(let v=0;v<u;v++)(l[v]&255)<p&&o.set(v);else{let v=l[0]&255,y=l[1]&255;for(let _=1;_<u-1;_++){const I=l[_+1]&255;(y*4-v-I)/2<p&&o.set(_),v=y,y=I}}return o}getBlackMatrix(){const i=this.getLuminanceSource(),o=i.getWidth(),c=i.getHeight(),u=new le(o,c);this.initArrays(o);const l=this.buckets;for(let v=1;v<5;v++){const y=Math.floor(c*v/5),_=i.getRow(y,this.luminances),I=Math.floor(o*4/5);for(let S=Math.floor(o/5);S<I;S++){const R=_[S]&255;l[R>>me.LUMINANCE_SHIFT]++}}const d=me.estimateBlackPoint(l),p=i.getMatrix();for(let v=0;v<c;v++){const y=v*o;for(let _=0;_<o;_++)(p[y+_]&255)<d&&u.set(_,v)}return u}createBinarizer(i){return new me(i)}initArrays(i){this.luminances.length<i&&(this.luminances=new Uint8ClampedArray(i));const o=this.buckets;for(let c=0;c<me.LUMINANCE_BUCKETS;c++)o[c]=0}static estimateBlackPoint(i){const o=i.length;let c=0,u=0,l=0;for(let _=0;_<o;_++)i[_]>l&&(u=_,l=i[_]),i[_]>c&&(c=i[_]);let d=0,p=0;for(let _=0;_<o;_++){const I=_-u,S=i[_]*I*I;S>p&&(d=_,p=S)}if(u>d){const _=u;u=d,d=_}if(d-u<=o/16)throw new X;let v=d-1,y=-1;for(let _=d-1;_>u;_--){const I=_-u,S=I*I*(d-_)*(c-i[_]);S>y&&(v=_,y=S)}return v<<me.LUMINANCE_SHIFT}}me.LUMINANCE_BITS=5,me.LUMINANCE_SHIFT=8-me.LUMINANCE_BITS,me.LUMINANCE_BUCKETS=1<<me.LUMINANCE_BITS,me.EMPTY=Uint8ClampedArray.from([0]);class ge extends me{constructor(i){super(i),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const i=this.getLuminanceSource(),o=i.getWidth(),c=i.getHeight();if(o>=ge.MINIMUM_DIMENSION&&c>=ge.MINIMUM_DIMENSION){const u=i.getMatrix();let l=o>>ge.BLOCK_SIZE_POWER;(o&ge.BLOCK_SIZE_MASK)!==0&&l++;let d=c>>ge.BLOCK_SIZE_POWER;(c&ge.BLOCK_SIZE_MASK)!==0&&d++;const p=ge.calculateBlackPoints(u,l,d,o,c),v=new le(o,c);ge.calculateThresholdForBlock(u,l,d,o,c,p,v),this.matrix=v}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(i){return new ge(i)}static calculateThresholdForBlock(i,o,c,u,l,d,p){const v=l-ge.BLOCK_SIZE,y=u-ge.BLOCK_SIZE;for(let _=0;_<c;_++){let I=_<<ge.BLOCK_SIZE_POWER;I>v&&(I=v);const S=ge.cap(_,2,c-3);for(let R=0;R<o;R++){let M=R<<ge.BLOCK_SIZE_POWER;M>y&&(M=y);const B=ge.cap(R,2,o-3);let V=0;for(let ee=-2;ee<=2;ee++){const te=d[S+ee];V+=te[B-2]+te[B-1]+te[B]+te[B+1]+te[B+2]}const z=V/25;ge.thresholdBlock(i,M,I,z,u,p)}}}static cap(i,o,c){return i<o?o:i>c?c:i}static thresholdBlock(i,o,c,u,l,d){for(let p=0,v=c*l+o;p<ge.BLOCK_SIZE;p++,v+=l)for(let y=0;y<ge.BLOCK_SIZE;y++)(i[v+y]&255)<=u&&d.set(o+y,c+p)}static calculateBlackPoints(i,o,c,u,l){const d=l-ge.BLOCK_SIZE,p=u-ge.BLOCK_SIZE,v=new Array(c);for(let y=0;y<c;y++){v[y]=new Int32Array(o);let _=y<<ge.BLOCK_SIZE_POWER;_>d&&(_=d);for(let I=0;I<o;I++){let S=I<<ge.BLOCK_SIZE_POWER;S>p&&(S=p);let R=0,M=255,B=0;for(let z=0,ee=_*u+S;z<ge.BLOCK_SIZE;z++,ee+=u){for(let te=0;te<ge.BLOCK_SIZE;te++){const J=i[ee+te]&255;R+=J,J<M&&(M=J),J>B&&(B=J)}if(B-M>ge.MIN_DYNAMIC_RANGE)for(z++,ee+=u;z<ge.BLOCK_SIZE;z++,ee+=u)for(let te=0;te<ge.BLOCK_SIZE;te++)R+=i[ee+te]&255}let V=R>>ge.BLOCK_SIZE_POWER*2;if(B-M<=ge.MIN_DYNAMIC_RANGE&&(V=M/2,y>0&&I>0)){const z=(v[y-1][I]+2*v[y][I-1]+v[y-1][I-1])/4;M<z&&(V=z)}v[y][I]=V}}return v}}ge.BLOCK_SIZE_POWER=3,ge.BLOCK_SIZE=1<<ge.BLOCK_SIZE_POWER,ge.BLOCK_SIZE_MASK=ge.BLOCK_SIZE-1,ge.MINIMUM_DIMENSION=ge.BLOCK_SIZE*5,ge.MIN_DYNAMIC_RANGE=24;class rr{constructor(i,o){this.width=i,this.height=o}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(i,o,c,u){throw new ue("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new ue("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new ue("This luminance source does not support rotation by 45 degrees.")}toString(){const i=new Uint8ClampedArray(this.width);let o=new ne;for(let c=0;c<this.height;c++){const u=this.getRow(c,i);for(let l=0;l<this.width;l++){const d=u[l]&255;let p;d<64?p="#":d<128?p="+":d<192?p=".":p=" ",o.append(p)}o.append(`
|
||
`)}return o.toString()}}class nr extends rr{constructor(i){super(i.getWidth(),i.getHeight()),this.delegate=i}getRow(i,o){const c=this.delegate.getRow(i,o),u=this.getWidth();for(let l=0;l<u;l++)c[l]=255-(c[l]&255);return c}getMatrix(){const i=this.delegate.getMatrix(),o=this.getWidth()*this.getHeight(),c=new Uint8ClampedArray(o);for(let u=0;u<o;u++)c[u]=255-(i[u]&255);return c}isCropSupported(){return this.delegate.isCropSupported()}crop(i,o,c,u){return new nr(this.delegate.crop(i,o,c,u))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new nr(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new nr(this.delegate.rotateCounterClockwise45())}}class Rr extends rr{constructor(i){super(i.width,i.height),this.canvas=i,this.tempCanvasElement=null,this.buffer=Rr.makeBufferFromCanvasImageData(i)}static makeBufferFromCanvasImageData(i){const o=i.getContext("2d").getImageData(0,0,i.width,i.height);return Rr.toGrayscaleBuffer(o.data,i.width,i.height)}static toGrayscaleBuffer(i,o,c){const u=new Uint8ClampedArray(o*c);for(let l=0,d=0,p=i.length;l<p;l+=4,d++){let v;if(i[l+3]===0)v=255;else{const _=i[l],I=i[l+1],S=i[l+2];v=306*_+601*I+117*S+512>>10}u[d]=v}return u}getRow(i,o){if(i<0||i>=this.getHeight())throw new A("Requested row is outside the image: "+i);const c=this.getWidth(),u=i*c;return o===null?o=this.buffer.slice(u,u+c):(o.length<c&&(o=new Uint8ClampedArray(c)),o.set(this.buffer.slice(u,u+c))),o}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(i,o,c,u){return super.crop(i,o,c,u),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const i=this.canvas.ownerDocument.createElement("canvas");i.width=this.canvas.width,i.height=this.canvas.height,this.tempCanvasElement=i}return this.tempCanvasElement}rotate(i){const o=this.getTempCanvasElement(),c=o.getContext("2d"),u=i*Rr.DEGREE_TO_RADIANS,l=this.canvas.width,d=this.canvas.height,p=Math.ceil(Math.abs(Math.cos(u))*l+Math.abs(Math.sin(u))*d),v=Math.ceil(Math.abs(Math.sin(u))*l+Math.abs(Math.cos(u))*d);return o.width=p,o.height=v,c.translate(p/2,v/2),c.rotate(u),c.drawImage(this.canvas,l/-2,d/-2),this.buffer=Rr.makeBufferFromCanvasImageData(o),this}invert(){return new nr(this)}}Rr.DEGREE_TO_RADIANS=Math.PI/180;class Sa{constructor(i,o,c){this.deviceId=i,this.label=o,this.kind="videoinput",this.groupId=c||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var Lt=(globalThis||ti||self||window||void 0)&&(globalThis||ti||self||window||void 0).__awaiter||function(m,i,o,c){function u(l){return l instanceof o?l:new o(function(d){d(l)})}return new(o||(o=Promise))(function(l,d){function p(_){try{y(c.next(_))}catch(I){d(I)}}function v(_){try{y(c.throw(_))}catch(I){d(I)}}function y(_){_.done?l(_.value):u(_.value).then(p,v)}y((c=c.apply(m,i||[])).next())})};class Wr{constructor(i,o=500,c){this.reader=i,this.timeBetweenScansMillis=o,this._hints=c,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(i){this._timeBetweenDecodingAttempts=i<0?0:i}set hints(i){this._hints=i||null}get hints(){return this._hints}listVideoInputDevices(){return Lt(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.");const i=yield navigator.mediaDevices.enumerateDevices(),o=[];for(const c of i){const u=c.kind==="video"?"videoinput":c.kind;if(u!=="videoinput")continue;const l=c.deviceId||c.id,d=c.label||`Video device ${o.length+1}`,p=c.groupId,v={deviceId:l,label:d,kind:u,groupId:p};o.push(v)}return o})}getVideoInputDevices(){return Lt(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(o=>new Sa(o.deviceId,o.label))})}findDeviceById(i){return Lt(this,void 0,void 0,function*(){const o=yield this.listVideoInputDevices();return o?o.find(c=>c.deviceId===i):null})}decodeFromInputVideoDevice(i,o){return Lt(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(i,o)})}decodeOnceFromVideoDevice(i,o){return Lt(this,void 0,void 0,function*(){this.reset();let c;i?c={deviceId:{exact:i}}:c={facingMode:"environment"};const u={video:c};return yield this.decodeOnceFromConstraints(u,o)})}decodeOnceFromConstraints(i,o){return Lt(this,void 0,void 0,function*(){const c=yield navigator.mediaDevices.getUserMedia(i);return yield this.decodeOnceFromStream(c,o)})}decodeOnceFromStream(i,o){return Lt(this,void 0,void 0,function*(){this.reset();const c=yield this.attachStreamToVideo(i,o);return yield this.decodeOnce(c)})}decodeFromInputVideoDeviceContinuously(i,o,c){return Lt(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(i,o,c)})}decodeFromVideoDevice(i,o,c){return Lt(this,void 0,void 0,function*(){let u;i?u={deviceId:{exact:i}}:u={facingMode:"environment"};const l={video:u};return yield this.decodeFromConstraints(l,o,c)})}decodeFromConstraints(i,o,c){return Lt(this,void 0,void 0,function*(){const u=yield navigator.mediaDevices.getUserMedia(i);return yield this.decodeFromStream(u,o,c)})}decodeFromStream(i,o,c){return Lt(this,void 0,void 0,function*(){this.reset();const u=yield this.attachStreamToVideo(i,o);return yield this.decodeContinuously(u,c)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(i,o){return Lt(this,void 0,void 0,function*(){const c=this.prepareVideoElement(o);return this.addVideoSource(c,i),this.videoElement=c,this.stream=i,yield this.playVideoOnLoadAsync(c),c})}playVideoOnLoadAsync(i){return new Promise((o,c)=>this.playVideoOnLoad(i,()=>o()))}playVideoOnLoad(i,o){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(i),i.addEventListener("ended",this.videoEndedListener),i.addEventListener("canplay",this.videoCanPlayListener),i.addEventListener("playing",o),this.tryPlayVideo(i)}isVideoPlaying(i){return i.currentTime>0&&!i.paused&&!i.ended&&i.readyState>2}tryPlayVideo(i){return Lt(this,void 0,void 0,function*(){if(this.isVideoPlaying(i)){console.warn("Trying to play video that is already playing.");return}try{yield i.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(i,o){const c=document.getElementById(i);if(!c)throw new w(`element with id '${i}' not found`);if(c.nodeName.toLowerCase()!==o.toLowerCase())throw new w(`element with id '${i}' must be an ${o} element`);return c}decodeFromImage(i,o){if(!i&&!o)throw new w("either imageElement with a src set or an url must be provided");return o&&!i?this.decodeFromImageUrl(o):this.decodeFromImageElement(i)}decodeFromVideo(i,o){if(!i&&!o)throw new w("Either an element with a src set or an URL must be provided");return o&&!i?this.decodeFromVideoUrl(o):this.decodeFromVideoElement(i)}decodeFromVideoContinuously(i,o,c){if(i===void 0&&o===void 0)throw new w("Either an element with a src set or an URL must be provided");return o&&!i?this.decodeFromVideoUrlContinuously(o,c):this.decodeFromVideoElementContinuously(i,c)}decodeFromImageElement(i){if(!i)throw new w("An image element must be provided.");this.reset();const o=this.prepareImageElement(i);this.imageElement=o;let c;return this.isImageLoaded(o)?c=this.decodeOnce(o,!1,!0):c=this._decodeOnLoadImage(o),c}decodeFromVideoElement(i){const o=this._decodeFromVideoElementSetup(i);return this._decodeOnLoadVideo(o)}decodeFromVideoElementContinuously(i,o){const c=this._decodeFromVideoElementSetup(i);return this._decodeOnLoadVideoContinuously(c,o)}_decodeFromVideoElementSetup(i){if(!i)throw new w("A video element must be provided.");this.reset();const o=this.prepareVideoElement(i);return this.videoElement=o,o}decodeFromImageUrl(i){if(!i)throw new w("An URL must be provided.");this.reset();const o=this.prepareImageElement();this.imageElement=o;const c=this._decodeOnLoadImage(o);return o.src=i,c}decodeFromVideoUrl(i){if(!i)throw new w("An URL must be provided.");this.reset();const o=this.prepareVideoElement(),c=this.decodeFromVideoElement(o);return o.src=i,c}decodeFromVideoUrlContinuously(i,o){if(!i)throw new w("An URL must be provided.");this.reset();const c=this.prepareVideoElement(),u=this.decodeFromVideoElementContinuously(c,o);return c.src=i,u}_decodeOnLoadImage(i){return new Promise((o,c)=>{this.imageLoadedListener=()=>this.decodeOnce(i,!1,!0).then(o,c),i.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(i){return Lt(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(i),yield this.decodeOnce(i)})}_decodeOnLoadVideoContinuously(i,o){return Lt(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(i),this.decodeContinuously(i,o)})}isImageLoaded(i){return!(!i.complete||i.naturalWidth===0)}prepareImageElement(i){let o;return typeof i>"u"&&(o=document.createElement("img"),o.width=200,o.height=200),typeof i=="string"&&(o=this.getMediaElement(i,"img")),i instanceof HTMLImageElement&&(o=i),o}prepareVideoElement(i){let o;return!i&&typeof document<"u"&&(o=document.createElement("video"),o.width=200,o.height=200),typeof i=="string"&&(o=this.getMediaElement(i,"video")),i instanceof HTMLVideoElement&&(o=i),o.setAttribute("autoplay","true"),o.setAttribute("muted","true"),o.setAttribute("playsinline","true"),o}decodeOnce(i,o=!0,c=!0){this._stopAsyncDecode=!1;const u=(l,d)=>{if(this._stopAsyncDecode){d(new X("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const p=this.decode(i);l(p)}catch(p){const v=o&&p instanceof X,_=(p instanceof C||p instanceof U)&&c;if(v||_)return setTimeout(u,this._timeBetweenDecodingAttempts,l,d);d(p)}};return new Promise((l,d)=>u(l,d))}decodeContinuously(i,o){this._stopContinuousDecode=!1;const c=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const u=this.decode(i);o(u,null),setTimeout(c,this.timeBetweenScansMillis)}catch(u){o(null,u);const l=u instanceof C||u instanceof U,d=u instanceof X;(l||d)&&setTimeout(c,this._timeBetweenDecodingAttempts)}};c()}decode(i){const o=this.createBinaryBitmap(i);return this.decodeBitmap(o)}_isHTMLVideoElement(i){return i.videoWidth!==0}drawFrameOnCanvas(i,o,c){o||(o={sx:0,sy:0,sWidth:i.videoWidth,sHeight:i.videoHeight,dx:0,dy:0,dWidth:i.videoWidth,dHeight:i.videoHeight}),c||(c=this.captureCanvasContext),c.drawImage(i,o.sx,o.sy,o.sWidth,o.sHeight,o.dx,o.dy,o.dWidth,o.dHeight)}drawImageOnCanvas(i,o,c=this.captureCanvasContext){o||(o={sx:0,sy:0,sWidth:i.naturalWidth,sHeight:i.naturalHeight,dx:0,dy:0,dWidth:i.naturalWidth,dHeight:i.naturalHeight}),c||(c=this.captureCanvasContext),c.drawImage(i,o.sx,o.sy,o.sWidth,o.sHeight,o.dx,o.dy,o.dWidth,o.dHeight)}createBinaryBitmap(i){this.getCaptureCanvasContext(i),this._isHTMLVideoElement(i)?this.drawFrameOnCanvas(i):this.drawImageOnCanvas(i);const o=this.getCaptureCanvas(i),c=new Rr(o),u=new ge(c);return new E(u)}getCaptureCanvasContext(i){if(!this.captureCanvasContext){const c=this.getCaptureCanvas(i).getContext("2d");this.captureCanvasContext=c}return this.captureCanvasContext}getCaptureCanvas(i){if(!this.captureCanvas){const o=this.createCaptureCanvas(i);this.captureCanvas=o}return this.captureCanvas}decodeBitmap(i){return this.reader.decode(i,this._hints)}createCaptureCanvas(i){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const o=document.createElement("canvas");let c,u;return typeof i<"u"&&(i instanceof HTMLVideoElement?(c=i.videoWidth,u=i.videoHeight):i instanceof HTMLImageElement&&(c=i.naturalWidth||i.width,u=i.naturalHeight||i.height)),o.style.width=c+"px",o.style.height=u+"px",o.width=c,o.height=u,o}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(i=>i.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(i,o){try{i.srcObject=o}catch{i.src=URL.createObjectURL(o)}}cleanVideoSource(i){try{i.srcObject=null}catch{i.src=""}this.videoElement.removeAttribute("src")}}class Ft{constructor(i,o,c=o==null?0:8*o.length,u,l,d=T.currentTimeMillis()){this.text=i,this.rawBytes=o,this.numBits=c,this.resultPoints=u,this.format=l,this.timestamp=d,this.text=i,this.rawBytes=o,c==null?this.numBits=o==null?0:8*o.length:this.numBits=c,this.resultPoints=u,this.format=l,this.resultMetadata=null,d==null?this.timestamp=T.currentTimeMillis():this.timestamp=d}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(i,o){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(i,o)}putAllMetadata(i){i!==null&&(this.resultMetadata===null?this.resultMetadata=i:this.resultMetadata=new Map(i))}addResultPoints(i){const o=this.resultPoints;if(o===null)this.resultPoints=i;else if(i!==null&&i.length>0){const c=new Array(o.length+i.length);T.arraycopy(o,0,c,0,o.length),T.arraycopy(i,0,c,o.length,i.length),this.resultPoints=c}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Ei;(function(m){m[m.AZTEC=0]="AZTEC",m[m.CODABAR=1]="CODABAR",m[m.CODE_39=2]="CODE_39",m[m.CODE_93=3]="CODE_93",m[m.CODE_128=4]="CODE_128",m[m.DATA_MATRIX=5]="DATA_MATRIX",m[m.EAN_8=6]="EAN_8",m[m.EAN_13=7]="EAN_13",m[m.ITF=8]="ITF",m[m.MAXICODE=9]="MAXICODE",m[m.PDF_417=10]="PDF_417",m[m.QR_CODE=11]="QR_CODE",m[m.RSS_14=12]="RSS_14",m[m.RSS_EXPANDED=13]="RSS_EXPANDED",m[m.UPC_A=14]="UPC_A",m[m.UPC_E=15]="UPC_E",m[m.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Ei||(Ei={}));var pe=Ei,Ci;(function(m){m[m.OTHER=0]="OTHER",m[m.ORIENTATION=1]="ORIENTATION",m[m.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",m[m.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",m[m.ISSUE_NUMBER=4]="ISSUE_NUMBER",m[m.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",m[m.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",m[m.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",m[m.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",m[m.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",m[m.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Ci||(Ci={}));var wt=Ci;class yn{constructor(i,o,c,u,l=-1,d=-1){this.rawBytes=i,this.text=o,this.byteSegments=c,this.ecLevel=u,this.structuredAppendSequenceNumber=l,this.structuredAppendParity=d,this.numBits=i==null?0:8*i.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(i){this.numBits=i}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(i){this.errorsCorrected=i}getErasures(){return this.erasures}setErasures(i){this.erasures=i}getOther(){return this.other}setOther(i){this.other=i}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class En{exp(i){return this.expTable[i]}log(i){if(i===0)throw new A;return this.logTable[i]}static addOrSubtract(i,o){return i^o}}class Wt{constructor(i,o){if(o.length===0)throw new A;this.field=i;const c=o.length;if(c>1&&o[0]===0){let u=1;for(;u<c&&o[u]===0;)u++;u===c?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(c-u),T.arraycopy(o,u,this.coefficients,0,this.coefficients.length))}else this.coefficients=o}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(i){return this.coefficients[this.coefficients.length-1-i]}evaluateAt(i){if(i===0)return this.getCoefficient(0);const o=this.coefficients;let c;if(i===1){c=0;for(let d=0,p=o.length;d!==p;d++){const v=o[d];c=En.addOrSubtract(c,v)}return c}c=o[0];const u=o.length,l=this.field;for(let d=1;d<u;d++)c=En.addOrSubtract(l.multiply(i,c),o[d]);return c}addOrSubtract(i){if(!this.field.equals(i.field))throw new A("GenericGFPolys do not have same GenericGF field");if(this.isZero())return i;if(i.isZero())return this;let o=this.coefficients,c=i.coefficients;if(o.length>c.length){const d=o;o=c,c=d}let u=new Int32Array(c.length);const l=c.length-o.length;T.arraycopy(c,0,u,0,l);for(let d=l;d<c.length;d++)u[d]=En.addOrSubtract(o[d-l],c[d]);return new Wt(this.field,u)}multiply(i){if(!this.field.equals(i.field))throw new A("GenericGFPolys do not have same GenericGF field");if(this.isZero()||i.isZero())return this.field.getZero();const o=this.coefficients,c=o.length,u=i.coefficients,l=u.length,d=new Int32Array(c+l-1),p=this.field;for(let v=0;v<c;v++){const y=o[v];for(let _=0;_<l;_++)d[v+_]=En.addOrSubtract(d[v+_],p.multiply(y,u[_]))}return new Wt(p,d)}multiplyScalar(i){if(i===0)return this.field.getZero();if(i===1)return this;const o=this.coefficients.length,c=this.field,u=new Int32Array(o),l=this.coefficients;for(let d=0;d<o;d++)u[d]=c.multiply(l[d],i);return new Wt(c,u)}multiplyByMonomial(i,o){if(i<0)throw new A;if(o===0)return this.field.getZero();const c=this.coefficients,u=c.length,l=new Int32Array(u+i),d=this.field;for(let p=0;p<u;p++)l[p]=d.multiply(c[p],o);return new Wt(d,l)}divide(i){if(!this.field.equals(i.field))throw new A("GenericGFPolys do not have same GenericGF field");if(i.isZero())throw new A("Divide by 0");const o=this.field;let c=o.getZero(),u=this;const l=i.getCoefficient(i.getDegree()),d=o.inverse(l);for(;u.getDegree()>=i.getDegree()&&!u.isZero();){const p=u.getDegree()-i.getDegree(),v=o.multiply(u.getCoefficient(u.getDegree()),d),y=i.multiplyByMonomial(p,v),_=o.buildMonomial(p,v);c=c.addOrSubtract(_),u=u.addOrSubtract(y)}return[c,u]}toString(){let i="";for(let o=this.getDegree();o>=0;o--){let c=this.getCoefficient(o);if(c!==0){if(c<0?(i+=" - ",c=-c):i.length>0&&(i+=" + "),o===0||c!==1){const u=this.field.log(c);u===0?i+="1":u===1?i+="a":(i+="a^",i+=u)}o!==0&&(o===1?i+="x":(i+="x^",i+=o))}}return i}}class Gn extends g{}Gn.kind="ArithmeticException";class Me extends En{constructor(i,o,c){super(),this.primitive=i,this.size=o,this.generatorBase=c;const u=new Int32Array(o);let l=1;for(let p=0;p<o;p++)u[p]=l,l*=2,l>=o&&(l^=i,l&=o-1);this.expTable=u;const d=new Int32Array(o);for(let p=0;p<o-1;p++)d[u[p]]=p;this.logTable=d,this.zero=new Wt(this,Int32Array.from([0])),this.one=new Wt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(i,o){if(i<0)throw new A;if(o===0)return this.zero;const c=new Int32Array(i+1);return c[0]=o,new Wt(this,c)}inverse(i){if(i===0)throw new Gn;return this.expTable[this.size-this.logTable[i]-1]}multiply(i,o){return i===0||o===0?0:this.expTable[(this.logTable[i]+this.logTable[o])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+L.toHexString(this.primitive)+","+this.size+")"}equals(i){return i===this}}Me.AZTEC_DATA_12=new Me(4201,4096,1),Me.AZTEC_DATA_10=new Me(1033,1024,1),Me.AZTEC_DATA_6=new Me(67,64,1),Me.AZTEC_PARAM=new Me(19,16,1),Me.QR_CODE_FIELD_256=new Me(285,256,0),Me.DATA_MATRIX_FIELD_256=new Me(301,256,1),Me.AZTEC_DATA_8=Me.DATA_MATRIX_FIELD_256,Me.MAXICODE_FIELD_64=Me.AZTEC_DATA_6;class nn extends g{}nn.kind="ReedSolomonException";class Ar extends g{}Ar.kind="IllegalStateException";class Cn{constructor(i){this.field=i}decode(i,o){const c=this.field,u=new Wt(c,i),l=new Int32Array(o);let d=!0;for(let R=0;R<o;R++){const M=u.evaluateAt(c.exp(R+c.getGeneratorBase()));l[l.length-1-R]=M,M!==0&&(d=!1)}if(d)return;const p=new Wt(c,l),v=this.runEuclideanAlgorithm(c.buildMonomial(o,1),p,o),y=v[0],_=v[1],I=this.findErrorLocations(y),S=this.findErrorMagnitudes(_,I);for(let R=0;R<I.length;R++){const M=i.length-1-c.log(I[R]);if(M<0)throw new nn("Bad error location");i[M]=Me.addOrSubtract(i[M],S[R])}}runEuclideanAlgorithm(i,o,c){if(i.getDegree()<o.getDegree()){const R=i;i=o,o=R}const u=this.field;let l=i,d=o,p=u.getZero(),v=u.getOne();for(;d.getDegree()>=(c/2|0);){let R=l,M=p;if(l=d,p=v,l.isZero())throw new nn("r_{i-1} was zero");d=R;let B=u.getZero();const V=l.getCoefficient(l.getDegree()),z=u.inverse(V);for(;d.getDegree()>=l.getDegree()&&!d.isZero();){const ee=d.getDegree()-l.getDegree(),te=u.multiply(d.getCoefficient(d.getDegree()),z);B=B.addOrSubtract(u.buildMonomial(ee,te)),d=d.addOrSubtract(l.multiplyByMonomial(ee,te))}if(v=B.multiply(p).addOrSubtract(M),d.getDegree()>=l.getDegree())throw new Ar("Division algorithm failed to reduce polynomial?")}const y=v.getCoefficient(0);if(y===0)throw new nn("sigmaTilde(0) was zero");const _=u.inverse(y),I=v.multiplyScalar(_),S=d.multiplyScalar(_);return[I,S]}findErrorLocations(i){const o=i.getDegree();if(o===1)return Int32Array.from([i.getCoefficient(1)]);const c=new Int32Array(o);let u=0;const l=this.field;for(let d=1;d<l.getSize()&&u<o;d++)i.evaluateAt(d)===0&&(c[u]=l.inverse(d),u++);if(u!==o)throw new nn("Error locator degree does not match number of roots");return c}findErrorMagnitudes(i,o){const c=o.length,u=new Int32Array(c),l=this.field;for(let d=0;d<c;d++){const p=l.inverse(o[d]);let v=1;for(let y=0;y<c;y++)if(d!==y){const _=l.multiply(o[y],p),I=(_&1)===0?_|1:_&-2;v=l.multiply(v,I)}u[d]=l.multiply(i.evaluateAt(p),l.inverse(v)),l.getGeneratorBase()!==0&&(u[d]=l.multiply(u[d],p))}return u}}var It;(function(m){m[m.UPPER=0]="UPPER",m[m.LOWER=1]="LOWER",m[m.MIXED=2]="MIXED",m[m.DIGIT=3]="DIGIT",m[m.PUNCT=4]="PUNCT",m[m.BINARY=5]="BINARY"})(It||(It={}));class Ze{decode(i){this.ddata=i;let o=i.getBits(),c=this.extractBits(o),u=this.correctBits(c),l=Ze.convertBoolArrayToByteArray(u),d=Ze.getEncodedData(u),p=new yn(l,d,null,null);return p.setNumBits(u.length),p}static highLevelDecode(i){return this.getEncodedData(i)}static getEncodedData(i){let o=i.length,c=It.UPPER,u=It.UPPER,l="",d=0;for(;d<o;)if(u===It.BINARY){if(o-d<5)break;let p=Ze.readCode(i,d,5);if(d+=5,p===0){if(o-d<11)break;p=Ze.readCode(i,d,11)+31,d+=11}for(let v=0;v<p;v++){if(o-d<8){d=o;break}const y=Ze.readCode(i,d,8);l+=Z.castAsNonUtf8Char(y),d+=8}u=c}else{let p=u===It.DIGIT?4:5;if(o-d<p)break;let v=Ze.readCode(i,d,p);d+=p;let y=Ze.getCharacter(u,v);y.startsWith("CTRL_")?(c=u,u=Ze.getTable(y.charAt(5)),y.charAt(6)==="L"&&(c=u)):(l+=y,u=c)}return l}static getTable(i){switch(i){case"L":return It.LOWER;case"P":return It.PUNCT;case"M":return It.MIXED;case"D":return It.DIGIT;case"B":return It.BINARY;case"U":default:return It.UPPER}}static getCharacter(i,o){switch(i){case It.UPPER:return Ze.UPPER_TABLE[o];case It.LOWER:return Ze.LOWER_TABLE[o];case It.MIXED:return Ze.MIXED_TABLE[o];case It.PUNCT:return Ze.PUNCT_TABLE[o];case It.DIGIT:return Ze.DIGIT_TABLE[o];default:throw new Ar("Bad table")}}correctBits(i){let o,c;this.ddata.getNbLayers()<=2?(c=6,o=Me.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(c=8,o=Me.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(c=10,o=Me.AZTEC_DATA_10):(c=12,o=Me.AZTEC_DATA_12);let u=this.ddata.getNbDatablocks(),l=i.length/c;if(l<u)throw new U;let d=i.length%c,p=new Int32Array(l);for(let S=0;S<l;S++,d+=c)p[S]=Ze.readCode(i,d,c);try{new Cn(o).decode(p,l-u)}catch(S){throw new U(S)}let v=(1<<c)-1,y=0;for(let S=0;S<u;S++){let R=p[S];if(R===0||R===v)throw new U;(R===1||R===v-1)&&y++}let _=new Array(u*c-y),I=0;for(let S=0;S<u;S++){let R=p[S];if(R===1||R===v-1)_.fill(R>1,I,I+c-1),I+=c-1;else for(let M=c-1;M>=0;--M)_[I++]=(R&1<<M)!==0}return _}extractBits(i){let o=this.ddata.isCompact(),c=this.ddata.getNbLayers(),u=(o?11:14)+c*4,l=new Int32Array(u),d=new Array(this.totalBitsInLayer(c,o));if(o)for(let p=0;p<l.length;p++)l[p]=p;else{let p=u+1+2*L.truncDivision(L.truncDivision(u,2)-1,15),v=u/2,y=L.truncDivision(p,2);for(let _=0;_<v;_++){let I=_+L.truncDivision(_,15);l[v-_-1]=y-I-1,l[v+_]=y+I+1}}for(let p=0,v=0;p<c;p++){let y=(c-p)*4+(o?9:12),_=p*2,I=u-1-_;for(let S=0;S<y;S++){let R=S*2;for(let M=0;M<2;M++)d[v+R+M]=i.get(l[_+M],l[_+S]),d[v+2*y+R+M]=i.get(l[_+S],l[I-M]),d[v+4*y+R+M]=i.get(l[I-M],l[I-S]),d[v+6*y+R+M]=i.get(l[I-S],l[_+M])}v+=y*8}return d}static readCode(i,o,c){let u=0;for(let l=o;l<o+c;l++)u<<=1,i[l]&&(u|=1);return u}static readByte(i,o){let c=i.length-o;return c>=8?Ze.readCode(i,o,8):Ze.readCode(i,o,c)<<8-c}static convertBoolArrayToByteArray(i){let o=new Uint8Array((i.length+7)/8);for(let c=0;c<o.length;c++)o[c]=Ze.readByte(i,8*c);return o}totalBitsInLayer(i,o){return((o?88:112)+16*i)*i}}Ze.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"],Ze.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"],Ze.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
||
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Ze.PUNCT_TABLE=["","\r",`\r
|
||
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ze.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Oe{constructor(){}static round(i){return i===NaN?0:i<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:i>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:i+(i<0?-.5:.5)|0}static distance(i,o,c,u){const l=i-c,d=o-u;return Math.sqrt(l*l+d*d)}static sum(i){let o=0;for(let c=0,u=i.length;c!==u;c++){const l=i[c];o+=l}return o}}class Xn{static floatToIntBits(i){return i}}Xn.MAX_VALUE=Number.MAX_SAFE_INTEGER;class fe{constructor(i,o){this.x=i,this.y=o}getX(){return this.x}getY(){return this.y}equals(i){if(i instanceof fe){const o=i;return this.x===o.x&&this.y===o.y}return!1}hashCode(){return 31*Xn.floatToIntBits(this.x)+Xn.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(i){const o=this.distance(i[0],i[1]),c=this.distance(i[1],i[2]),u=this.distance(i[0],i[2]);let l,d,p;if(c>=o&&c>=u?(d=i[0],l=i[1],p=i[2]):u>=c&&u>=o?(d=i[1],l=i[0],p=i[2]):(d=i[2],l=i[0],p=i[1]),this.crossProductZ(l,d,p)<0){const v=l;l=p,p=v}i[0]=l,i[1]=d,i[2]=p}static distance(i,o){return Oe.distance(i.x,i.y,o.x,o.y)}static crossProductZ(i,o,c){const u=o.x,l=o.y;return(c.x-u)*(i.y-l)-(c.y-l)*(i.x-u)}}class Wn{constructor(i,o){this.bits=i,this.points=o}getBits(){return this.bits}getPoints(){return this.points}}class ba extends Wn{constructor(i,o,c,u,l){super(i,o),this.compact=c,this.nbDatablocks=u,this.nbLayers=l}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Tr{constructor(i,o,c,u){this.image=i,this.height=i.getHeight(),this.width=i.getWidth(),o==null&&(o=Tr.INIT_SIZE),c==null&&(c=i.getWidth()/2|0),u==null&&(u=i.getHeight()/2|0);const l=o/2|0;if(this.leftInit=c-l,this.rightInit=c+l,this.upInit=u-l,this.downInit=u+l,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new X}detect(){let i=this.leftInit,o=this.rightInit,c=this.upInit,u=this.downInit,l=!1,d=!0,p=!1,v=!1,y=!1,_=!1,I=!1;const S=this.width,R=this.height;for(;d;){d=!1;let M=!0;for(;(M||!v)&&o<S;)M=this.containsBlackPoint(c,u,o,!1),M?(o++,d=!0,v=!0):v||o++;if(o>=S){l=!0;break}let B=!0;for(;(B||!y)&&u<R;)B=this.containsBlackPoint(i,o,u,!0),B?(u++,d=!0,y=!0):y||u++;if(u>=R){l=!0;break}let V=!0;for(;(V||!_)&&i>=0;)V=this.containsBlackPoint(c,u,i,!1),V?(i--,d=!0,_=!0):_||i--;if(i<0){l=!0;break}let z=!0;for(;(z||!I)&&c>=0;)z=this.containsBlackPoint(i,o,c,!0),z?(c--,d=!0,I=!0):I||c--;if(c<0){l=!0;break}d&&(p=!0)}if(!l&&p){const M=o-i;let B=null;for(let te=1;B===null&&te<M;te++)B=this.getBlackPointOnSegment(i,u-te,i+te,u);if(B==null)throw new X;let V=null;for(let te=1;V===null&&te<M;te++)V=this.getBlackPointOnSegment(i,c+te,i+te,c);if(V==null)throw new X;let z=null;for(let te=1;z===null&&te<M;te++)z=this.getBlackPointOnSegment(o,c+te,o-te,c);if(z==null)throw new X;let ee=null;for(let te=1;ee===null&&te<M;te++)ee=this.getBlackPointOnSegment(o,u-te,o-te,u);if(ee==null)throw new X;return this.centerEdges(ee,B,z,V)}else throw new X}getBlackPointOnSegment(i,o,c,u){const l=Oe.round(Oe.distance(i,o,c,u)),d=(c-i)/l,p=(u-o)/l,v=this.image;for(let y=0;y<l;y++){const _=Oe.round(i+y*d),I=Oe.round(o+y*p);if(v.get(_,I))return new fe(_,I)}return null}centerEdges(i,o,c,u){const l=i.getX(),d=i.getY(),p=o.getX(),v=o.getY(),y=c.getX(),_=c.getY(),I=u.getX(),S=u.getY(),R=Tr.CORR;return l<this.width/2?[new fe(I-R,S+R),new fe(p+R,v+R),new fe(y-R,_-R),new fe(l+R,d-R)]:[new fe(I+R,S+R),new fe(p+R,v-R),new fe(y-R,_+R),new fe(l-R,d-R)]}containsBlackPoint(i,o,c,u){const l=this.image;if(u){for(let d=i;d<=o;d++)if(l.get(d,c))return!0}else for(let d=i;d<=o;d++)if(l.get(c,d))return!0;return!1}}Tr.INIT_SIZE=10,Tr.CORR=1;class _i{static checkAndNudgePoints(i,o){const c=i.getWidth(),u=i.getHeight();let l=!0;for(let d=0;d<o.length&&l;d+=2){const p=Math.floor(o[d]),v=Math.floor(o[d+1]);if(p<-1||p>c||v<-1||v>u)throw new X;l=!1,p===-1?(o[d]=0,l=!0):p===c&&(o[d]=c-1,l=!0),v===-1?(o[d+1]=0,l=!0):v===u&&(o[d+1]=u-1,l=!0)}l=!0;for(let d=o.length-2;d>=0&&l;d-=2){const p=Math.floor(o[d]),v=Math.floor(o[d+1]);if(p<-1||p>c||v<-1||v>u)throw new X;l=!1,p===-1?(o[d]=0,l=!0):p===c&&(o[d]=c-1,l=!0),v===-1?(o[d+1]=0,l=!0):v===u&&(o[d+1]=u-1,l=!0)}}}class hr{constructor(i,o,c,u,l,d,p,v,y){this.a11=i,this.a21=o,this.a31=c,this.a12=u,this.a22=l,this.a32=d,this.a13=p,this.a23=v,this.a33=y}static quadrilateralToQuadrilateral(i,o,c,u,l,d,p,v,y,_,I,S,R,M,B,V){const z=hr.quadrilateralToSquare(i,o,c,u,l,d,p,v);return hr.squareToQuadrilateral(y,_,I,S,R,M,B,V).times(z)}transformPoints(i){const o=i.length,c=this.a11,u=this.a12,l=this.a13,d=this.a21,p=this.a22,v=this.a23,y=this.a31,_=this.a32,I=this.a33;for(let S=0;S<o;S+=2){const R=i[S],M=i[S+1],B=l*R+v*M+I;i[S]=(c*R+d*M+y)/B,i[S+1]=(u*R+p*M+_)/B}}transformPointsWithValues(i,o){const c=this.a11,u=this.a12,l=this.a13,d=this.a21,p=this.a22,v=this.a23,y=this.a31,_=this.a32,I=this.a33,S=i.length;for(let R=0;R<S;R++){const M=i[R],B=o[R],V=l*M+v*B+I;i[R]=(c*M+d*B+y)/V,o[R]=(u*M+p*B+_)/V}}static squareToQuadrilateral(i,o,c,u,l,d,p,v){const y=i-c+l-p,_=o-u+d-v;if(y===0&&_===0)return new hr(c-i,l-c,i,u-o,d-u,o,0,0,1);{const I=c-l,S=p-l,R=u-d,M=v-d,B=I*M-S*R,V=(y*M-S*_)/B,z=(I*_-y*R)/B;return new hr(c-i+V*c,p-i+z*p,i,u-o+V*u,v-o+z*v,o,V,z,1)}}static quadrilateralToSquare(i,o,c,u,l,d,p,v){return hr.squareToQuadrilateral(i,o,c,u,l,d,p,v).buildAdjoint()}buildAdjoint(){return new hr(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(i){return new hr(this.a11*i.a11+this.a21*i.a12+this.a31*i.a13,this.a11*i.a21+this.a21*i.a22+this.a31*i.a23,this.a11*i.a31+this.a21*i.a32+this.a31*i.a33,this.a12*i.a11+this.a22*i.a12+this.a32*i.a13,this.a12*i.a21+this.a22*i.a22+this.a32*i.a23,this.a12*i.a31+this.a22*i.a32+this.a32*i.a33,this.a13*i.a11+this.a23*i.a12+this.a33*i.a13,this.a13*i.a21+this.a23*i.a22+this.a33*i.a23,this.a13*i.a31+this.a23*i.a32+this.a33*i.a33)}}class Ta extends _i{sampleGrid(i,o,c,u,l,d,p,v,y,_,I,S,R,M,B,V,z,ee,te){const J=hr.quadrilateralToQuadrilateral(u,l,d,p,v,y,_,I,S,R,M,B,V,z,ee,te);return this.sampleGridWithTransform(i,o,c,J)}sampleGridWithTransform(i,o,c,u){if(o<=0||c<=0)throw new X;const l=new le(o,c),d=new Float32Array(2*o);for(let p=0;p<c;p++){const v=d.length,y=p+.5;for(let _=0;_<v;_+=2)d[_]=_/2+.5,d[_+1]=y;u.transformPoints(d),_i.checkAndNudgePoints(i,d);try{for(let _=0;_<v;_+=2)i.get(Math.floor(d[_]),Math.floor(d[_+1]))&&l.set(_/2,p)}catch{throw new X}}return l}}class Dr{static setGridSampler(i){Dr.gridSampler=i}static getInstance(){return Dr.gridSampler}}Dr.gridSampler=new Ta;class kt{constructor(i,o){this.x=i,this.y=o}toResultPoint(){return new fe(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Oa{constructor(i){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=i}detect(){return this.detectMirror(!1)}detectMirror(i){let o=this.getMatrixCenter(),c=this.getBullsEyeCorners(o);if(i){let d=c[0];c[0]=c[2],c[2]=d}this.extractParameters(c);let u=this.sampleGrid(this.image,c[this.shift%4],c[(this.shift+1)%4],c[(this.shift+2)%4],c[(this.shift+3)%4]),l=this.getMatrixCornerPoints(c);return new ba(u,l,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(i){if(!this.isValidPoint(i[0])||!this.isValidPoint(i[1])||!this.isValidPoint(i[2])||!this.isValidPoint(i[3]))throw new X;let o=2*this.nbCenterLayers,c=new Int32Array([this.sampleLine(i[0],i[1],o),this.sampleLine(i[1],i[2],o),this.sampleLine(i[2],i[3],o),this.sampleLine(i[3],i[0],o)]);this.shift=this.getRotation(c,o);let u=0;for(let d=0;d<4;d++){let p=c[(this.shift+d)%4];this.compact?(u<<=7,u+=p>>1&127):(u<<=10,u+=(p>>2&992)+(p>>1&31))}let l=this.getCorrectedParameterData(u,this.compact);this.compact?(this.nbLayers=(l>>6)+1,this.nbDataBlocks=(l&63)+1):(this.nbLayers=(l>>11)+1,this.nbDataBlocks=(l&2047)+1)}getRotation(i,o){let c=0;i.forEach((u,l,d)=>{let p=(u>>o-2<<1)+(u&1);c=(c<<3)+p}),c=((c&1)<<11)+(c>>1);for(let u=0;u<4;u++)if(L.bitCount(c^this.EXPECTED_CORNER_BITS[u])<=2)return u;throw new X}getCorrectedParameterData(i,o){let c,u;o?(c=7,u=2):(c=10,u=4);let l=c-u,d=new Int32Array(c);for(let v=c-1;v>=0;--v)d[v]=i&15,i>>=4;try{new Cn(Me.AZTEC_PARAM).decode(d,l)}catch{throw new X}let p=0;for(let v=0;v<u;v++)p=(p<<4)+d[v];return p}getBullsEyeCorners(i){let o=i,c=i,u=i,l=i,d=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let I=this.getFirstDifferent(o,d,1,-1),S=this.getFirstDifferent(c,d,1,1),R=this.getFirstDifferent(u,d,-1,1),M=this.getFirstDifferent(l,d,-1,-1);if(this.nbCenterLayers>2){let B=this.distancePoint(M,I)*this.nbCenterLayers/(this.distancePoint(l,o)*(this.nbCenterLayers+2));if(B<.75||B>1.25||!this.isWhiteOrBlackRectangle(I,S,R,M))break}o=I,c=S,u=R,l=M,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new X;this.compact=this.nbCenterLayers===5;let p=new fe(o.getX()+.5,o.getY()-.5),v=new fe(c.getX()+.5,c.getY()+.5),y=new fe(u.getX()-.5,u.getY()+.5),_=new fe(l.getX()-.5,l.getY()-.5);return this.expandSquare([p,v,y,_],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let i,o,c,u;try{let p=new Tr(this.image).detect();i=p[0],o=p[1],c=p[2],u=p[3]}catch{let v=this.image.getWidth()/2,y=this.image.getHeight()/2;i=this.getFirstDifferent(new kt(v+7,y-7),!1,1,-1).toResultPoint(),o=this.getFirstDifferent(new kt(v+7,y+7),!1,1,1).toResultPoint(),c=this.getFirstDifferent(new kt(v-7,y+7),!1,-1,1).toResultPoint(),u=this.getFirstDifferent(new kt(v-7,y-7),!1,-1,-1).toResultPoint()}let l=Oe.round((i.getX()+u.getX()+o.getX()+c.getX())/4),d=Oe.round((i.getY()+u.getY()+o.getY()+c.getY())/4);try{let p=new Tr(this.image,15,l,d).detect();i=p[0],o=p[1],c=p[2],u=p[3]}catch{i=this.getFirstDifferent(new kt(l+7,d-7),!1,1,-1).toResultPoint(),o=this.getFirstDifferent(new kt(l+7,d+7),!1,1,1).toResultPoint(),c=this.getFirstDifferent(new kt(l-7,d+7),!1,-1,1).toResultPoint(),u=this.getFirstDifferent(new kt(l-7,d-7),!1,-1,-1).toResultPoint()}return l=Oe.round((i.getX()+u.getX()+o.getX()+c.getX())/4),d=Oe.round((i.getY()+u.getY()+o.getY()+c.getY())/4),new kt(l,d)}getMatrixCornerPoints(i){return this.expandSquare(i,2*this.nbCenterLayers,this.getDimension())}sampleGrid(i,o,c,u,l){let d=Dr.getInstance(),p=this.getDimension(),v=p/2-this.nbCenterLayers,y=p/2+this.nbCenterLayers;return d.sampleGrid(i,p,p,v,v,y,v,y,y,v,y,o.getX(),o.getY(),c.getX(),c.getY(),u.getX(),u.getY(),l.getX(),l.getY())}sampleLine(i,o,c){let u=0,l=this.distanceResultPoint(i,o),d=l/c,p=i.getX(),v=i.getY(),y=d*(o.getX()-i.getX())/l,_=d*(o.getY()-i.getY())/l;for(let I=0;I<c;I++)this.image.get(Oe.round(p+I*y),Oe.round(v+I*_))&&(u|=1<<c-I-1);return u}isWhiteOrBlackRectangle(i,o,c,u){let l=3;i=new kt(i.getX()-l,i.getY()+l),o=new kt(o.getX()-l,o.getY()-l),c=new kt(c.getX()+l,c.getY()-l),u=new kt(u.getX()+l,u.getY()+l);let d=this.getColor(u,i);if(d===0)return!1;let p=this.getColor(i,o);return p!==d||(p=this.getColor(o,c),p!==d)?!1:(p=this.getColor(c,u),p===d)}getColor(i,o){let c=this.distancePoint(i,o),u=(o.getX()-i.getX())/c,l=(o.getY()-i.getY())/c,d=0,p=i.getX(),v=i.getY(),y=this.image.get(i.getX(),i.getY()),_=Math.ceil(c);for(let S=0;S<_;S++)p+=u,v+=l,this.image.get(Oe.round(p),Oe.round(v))!==y&&d++;let I=d/c;return I>.1&&I<.9?0:I<=.1===y?1:-1}getFirstDifferent(i,o,c,u){let l=i.getX()+c,d=i.getY()+u;for(;this.isValid(l,d)&&this.image.get(l,d)===o;)l+=c,d+=u;for(l-=c,d-=u;this.isValid(l,d)&&this.image.get(l,d)===o;)l+=c;for(l-=c;this.isValid(l,d)&&this.image.get(l,d)===o;)d+=u;return d-=u,new kt(l,d)}expandSquare(i,o,c){let u=c/(2*o),l=i[0].getX()-i[2].getX(),d=i[0].getY()-i[2].getY(),p=(i[0].getX()+i[2].getX())/2,v=(i[0].getY()+i[2].getY())/2,y=new fe(p+u*l,v+u*d),_=new fe(p-u*l,v-u*d);l=i[1].getX()-i[3].getX(),d=i[1].getY()-i[3].getY(),p=(i[1].getX()+i[3].getX())/2,v=(i[1].getY()+i[3].getY())/2;let I=new fe(p+u*l,v+u*d),S=new fe(p-u*l,v-u*d);return[y,I,_,S]}isValid(i,o){return i>=0&&i<this.image.getWidth()&&o>0&&o<this.image.getHeight()}isValidPoint(i){let o=Oe.round(i.getX()),c=Oe.round(i.getY());return this.isValid(o,c)}distancePoint(i,o){return Oe.distance(i.getX(),i.getY(),o.getX(),o.getY())}distanceResultPoint(i,o){return Oe.distance(i.getX(),i.getY(),o.getX(),o.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(L.truncDivision(this.nbLayers-4,8)+1)+15}}class zn{decode(i,o=null){let c=null,u=new Oa(i.getBlackMatrix()),l=null,d=null;try{let _=u.detectMirror(!1);l=_.getPoints(),this.reportFoundResultPoints(o,l),d=new Ze().decode(_)}catch(_){c=_}if(d==null)try{let _=u.detectMirror(!0);l=_.getPoints(),this.reportFoundResultPoints(o,l),d=new Ze().decode(_)}catch(_){throw c??_}let p=new Ft(d.getText(),d.getRawBytes(),d.getNumBits(),l,pe.AZTEC,T.currentTimeMillis()),v=d.getByteSegments();v!=null&&p.putMetadata(wt.BYTE_SEGMENTS,v);let y=d.getECLevel();return y!=null&&p.putMetadata(wt.ERROR_CORRECTION_LEVEL,y),p}reportFoundResultPoints(i,o){if(i!=null){let c=i.get(K.NEED_RESULT_POINT_CALLBACK);c!=null&&o.forEach((u,l,d)=>{c.foundPossibleResultPoint(u)})}}reset(){}}class f1 extends Wr{constructor(i=500){super(new zn,i)}}class ct{decode(i,o){try{return this.doDecode(i,o)}catch{if(o&&o.get(K.TRY_HARDER)===!0&&i.isRotateSupported()){const l=i.rotateCounterClockwise(),d=this.doDecode(l,o),p=d.getResultMetadata();let v=270;p!==null&&p.get(wt.ORIENTATION)===!0&&(v=v+p.get(wt.ORIENTATION)%360),d.putMetadata(wt.ORIENTATION,v);const y=d.getResultPoints();if(y!==null){const _=l.getHeight();for(let I=0;I<y.length;I++)y[I]=new fe(_-y[I].getY()-1,y[I].getX())}return d}else throw new X}}reset(){}doDecode(i,o){const c=i.getWidth(),u=i.getHeight();let l=new k(c);const d=o&&o.get(K.TRY_HARDER)===!0,p=Math.max(1,u>>(d?8:5));let v;d?v=u:v=15;const y=Math.trunc(u/2);for(let _=0;_<v;_++){const I=Math.trunc((_+1)/2),S=(_&1)===0,R=y+p*(S?I:-I);if(R<0||R>=u)break;try{l=i.getBlackRow(R,l)}catch{continue}for(let M=0;M<2;M++){if(M===1&&(l.reverse(),o&&o.get(K.NEED_RESULT_POINT_CALLBACK)===!0)){const B=new Map;o.forEach((V,z)=>B.set(z,V)),B.delete(K.NEED_RESULT_POINT_CALLBACK),o=B}try{const B=this.decodeRow(R,l,o);if(M===1){B.putMetadata(wt.ORIENTATION,180);const V=B.getResultPoints();V!==null&&(V[0]=new fe(c-V[0].getX()-1,V[0].getY()),V[1]=new fe(c-V[1].getX()-1,V[1].getY()))}return B}catch{}}}throw new X}static recordPattern(i,o,c){const u=c.length;for(let y=0;y<u;y++)c[y]=0;const l=i.getSize();if(o>=l)throw new X;let d=!i.get(o),p=0,v=o;for(;v<l;){if(i.get(v)!==d)c[p]++;else{if(++p===u)break;c[p]=1,d=!d}v++}if(!(p===u||p===u-1&&v===l))throw new X}static recordPatternInReverse(i,o,c){let u=c.length,l=i.get(o);for(;o>0&&u>=0;)i.get(--o)!==l&&(u--,l=!l);if(u>=0)throw new X;ct.recordPattern(i,o+1,c)}static patternMatchVariance(i,o,c){const u=i.length;let l=0,d=0;for(let y=0;y<u;y++)l+=i[y],d+=o[y];if(l<d)return Number.POSITIVE_INFINITY;const p=l/d;c*=p;let v=0;for(let y=0;y<u;y++){const _=i[y],I=o[y]*p,S=_>I?_-I:I-_;if(S>c)return Number.POSITIVE_INFINITY;v+=S}return v/l}}class ie extends ct{static findStartPattern(i){const o=i.getSize(),c=i.getNextSet(0);let u=0,l=Int32Array.from([0,0,0,0,0,0]),d=c,p=!1;const v=6;for(let y=c;y<o;y++)if(i.get(y)!==p)l[u]++;else{if(u===v-1){let _=ie.MAX_AVG_VARIANCE,I=-1;for(let S=ie.CODE_START_A;S<=ie.CODE_START_C;S++){const R=ct.patternMatchVariance(l,ie.CODE_PATTERNS[S],ie.MAX_INDIVIDUAL_VARIANCE);R<_&&(_=R,I=S)}if(I>=0&&i.isRange(Math.max(0,d-(y-d)/2),d,!1))return Int32Array.from([d,y,I]);d+=l[0]+l[1],l=l.slice(2,l.length-1),l[u-1]=0,l[u]=0,u--}else u++;l[u]=1,p=!p}throw new X}static decodeCode(i,o,c){ct.recordPattern(i,c,o);let u=ie.MAX_AVG_VARIANCE,l=-1;for(let d=0;d<ie.CODE_PATTERNS.length;d++){const p=ie.CODE_PATTERNS[d],v=this.patternMatchVariance(o,p,ie.MAX_INDIVIDUAL_VARIANCE);v<u&&(u=v,l=d)}if(l>=0)return l;throw new X}decodeRow(i,o,c){const u=c&&c.get(K.ASSUME_GS1)===!0,l=ie.findStartPattern(o),d=l[2];let p=0;const v=new Uint8Array(20);v[p++]=d;let y;switch(d){case ie.CODE_START_A:y=ie.CODE_CODE_A;break;case ie.CODE_START_B:y=ie.CODE_CODE_B;break;case ie.CODE_START_C:y=ie.CODE_CODE_C;break;default:throw new U}let _=!1,I=!1,S="",R=l[0],M=l[1];const B=Int32Array.from([0,0,0,0,0,0]);let V=0,z=0,ee=d,te=0,J=!0,Se=!1,Ae=!1;for(;!_;){const dn=I;switch(I=!1,V=z,z=ie.decodeCode(o,B,M),v[p++]=z,z!==ie.CODE_STOP&&(J=!0),z!==ie.CODE_STOP&&(te++,ee+=te*z),R=M,M+=B.reduce((k1,U1)=>k1+U1,0),z){case ie.CODE_START_A:case ie.CODE_START_B:case ie.CODE_START_C:throw new U}switch(y){case ie.CODE_CODE_A:if(z<64)Ae===Se?S+=String.fromCharCode(32+z):S+=String.fromCharCode(32+z+128),Ae=!1;else if(z<96)Ae===Se?S+=String.fromCharCode(z-64):S+=String.fromCharCode(z+64),Ae=!1;else switch(z!==ie.CODE_STOP&&(J=!1),z){case ie.CODE_FNC_1:u&&(S.length===0?S+="]C1":S+="");break;case ie.CODE_FNC_2:case ie.CODE_FNC_3:break;case ie.CODE_FNC_4_A:!Se&&Ae?(Se=!0,Ae=!1):Se&&Ae?(Se=!1,Ae=!1):Ae=!0;break;case ie.CODE_SHIFT:I=!0,y=ie.CODE_CODE_B;break;case ie.CODE_CODE_B:y=ie.CODE_CODE_B;break;case ie.CODE_CODE_C:y=ie.CODE_CODE_C;break;case ie.CODE_STOP:_=!0;break}break;case ie.CODE_CODE_B:if(z<96)Ae===Se?S+=String.fromCharCode(32+z):S+=String.fromCharCode(32+z+128),Ae=!1;else switch(z!==ie.CODE_STOP&&(J=!1),z){case ie.CODE_FNC_1:u&&(S.length===0?S+="]C1":S+="");break;case ie.CODE_FNC_2:case ie.CODE_FNC_3:break;case ie.CODE_FNC_4_B:!Se&&Ae?(Se=!0,Ae=!1):Se&&Ae?(Se=!1,Ae=!1):Ae=!0;break;case ie.CODE_SHIFT:I=!0,y=ie.CODE_CODE_A;break;case ie.CODE_CODE_A:y=ie.CODE_CODE_A;break;case ie.CODE_CODE_C:y=ie.CODE_CODE_C;break;case ie.CODE_STOP:_=!0;break}break;case ie.CODE_CODE_C:if(z<100)z<10&&(S+="0"),S+=z;else switch(z!==ie.CODE_STOP&&(J=!1),z){case ie.CODE_FNC_1:u&&(S.length===0?S+="]C1":S+="");break;case ie.CODE_CODE_A:y=ie.CODE_CODE_A;break;case ie.CODE_CODE_B:y=ie.CODE_CODE_B;break;case ie.CODE_STOP:_=!0;break}break}dn&&(y=y===ie.CODE_CODE_A?ie.CODE_CODE_B:ie.CODE_CODE_A)}const jt=M-R;if(M=o.getNextUnset(M),!o.isRange(M,Math.min(o.getSize(),M+(M-R)/2),!1))throw new X;if(ee-=te*V,ee%103!==V)throw new C;const xr=S.length;if(xr===0)throw new X;xr>0&&J&&(y===ie.CODE_CODE_C?S=S.substring(0,xr-2):S=S.substring(0,xr-1));const Kt=(l[1]+l[0])/2,Ye=R+jt/2,Tt=v.length,er=new Uint8Array(Tt);for(let dn=0;dn<Tt;dn++)er[dn]=v[dn];const hn=[new fe(Kt,i),new fe(Ye,i)];return new Ft(S,er,0,hn,pe.CODE_128,new Date().getTime())}}ie.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])],ie.MAX_AVG_VARIANCE=.25,ie.MAX_INDIVIDUAL_VARIANCE=.7,ie.CODE_SHIFT=98,ie.CODE_CODE_C=99,ie.CODE_CODE_B=100,ie.CODE_CODE_A=101,ie.CODE_FNC_1=102,ie.CODE_FNC_2=97,ie.CODE_FNC_3=96,ie.CODE_FNC_4_A=101,ie.CODE_FNC_4_B=100,ie.CODE_START_A=103,ie.CODE_START_B=104,ie.CODE_START_C=105,ie.CODE_STOP=106;class ft extends ct{constructor(i=!1,o=!1){super(),this.usingCheckDigit=i,this.extendedMode=o,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(i,o,c){let u=this.counters;u.fill(0),this.decodeRowResult="";let l=ft.findAsteriskPattern(o,u),d=o.getNextSet(l[1]),p=o.getSize(),v,y;do{ft.recordPattern(o,d,u);let B=ft.toNarrowWidePattern(u);if(B<0)throw new X;v=ft.patternToChar(B),this.decodeRowResult+=v,y=d;for(let V of u)d+=V;d=o.getNextSet(d)}while(v!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let _=0;for(let B of u)_+=B;let I=d-y-_;if(d!==p&&I*2<_)throw new X;if(this.usingCheckDigit){let B=this.decodeRowResult.length-1,V=0;for(let z=0;z<B;z++)V+=ft.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(z));if(this.decodeRowResult.charAt(B)!==ft.ALPHABET_STRING.charAt(V%43))throw new C;this.decodeRowResult=this.decodeRowResult.substring(0,B)}if(this.decodeRowResult.length===0)throw new X;let S;this.extendedMode?S=ft.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let R=(l[1]+l[0])/2,M=y+_/2;return new Ft(S,null,0,[new fe(R,i),new fe(M,i)],pe.CODE_39,new Date().getTime())}static findAsteriskPattern(i,o){let c=i.getSize(),u=i.getNextSet(0),l=0,d=u,p=!1,v=o.length;for(let y=u;y<c;y++)if(i.get(y)!==p)o[l]++;else{if(l===v-1){if(this.toNarrowWidePattern(o)===ft.ASTERISK_ENCODING&&i.isRange(Math.max(0,d-Math.floor((y-d)/2)),d,!1))return[d,y];d+=o[0]+o[1],o.copyWithin(0,2,2+l-1),o[l-1]=0,o[l]=0,l--}else l++;o[l]=1,p=!p}throw new X}static toNarrowWidePattern(i){let o=i.length,c=0,u;do{let l=2147483647;for(let v of i)v<l&&v>c&&(l=v);c=l,u=0;let d=0,p=0;for(let v=0;v<o;v++){let y=i[v];y>c&&(p|=1<<o-1-v,u++,d+=y)}if(u===3){for(let v=0;v<o&&u>0;v++){let y=i[v];if(y>c&&(u--,y*2>=d))return-1}return p}}while(u>3);return-1}static patternToChar(i){for(let o=0;o<ft.CHARACTER_ENCODINGS.length;o++)if(ft.CHARACTER_ENCODINGS[o]===i)return ft.ALPHABET_STRING.charAt(o);if(i===ft.ASTERISK_ENCODING)return"*";throw new X}static decodeExtended(i){let o=i.length,c="";for(let u=0;u<o;u++){let l=i.charAt(u);if(l==="+"||l==="$"||l==="%"||l==="/"){let d=i.charAt(u+1),p="\0";switch(l){case"+":if(d>="A"&&d<="Z")p=String.fromCharCode(d.charCodeAt(0)+32);else throw new U;break;case"$":if(d>="A"&&d<="Z")p=String.fromCharCode(d.charCodeAt(0)-64);else throw new U;break;case"%":if(d>="A"&&d<="E")p=String.fromCharCode(d.charCodeAt(0)-38);else if(d>="F"&&d<="J")p=String.fromCharCode(d.charCodeAt(0)-11);else if(d>="K"&&d<="O")p=String.fromCharCode(d.charCodeAt(0)+16);else if(d>="P"&&d<="T")p=String.fromCharCode(d.charCodeAt(0)+43);else if(d==="U")p="\0";else if(d==="V")p="@";else if(d==="W")p="`";else if(d==="X"||d==="Y"||d==="Z")p="";else throw new U;break;case"/":if(d>="A"&&d<="O")p=String.fromCharCode(d.charCodeAt(0)-32);else if(d==="Z")p=":";else throw new U;break}c+=p,u++}else c+=l}return c}}ft.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ft.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],ft.ASTERISK_ENCODING=148;class We extends ct{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(i,o,c){let u=this.decodeStart(o),l=this.decodeEnd(o),d=new ne;We.decodeMiddle(o,u[1],l[0],d);let p=d.toString(),v=null;c!=null&&(v=c.get(K.ALLOWED_LENGTHS)),v==null&&(v=We.DEFAULT_ALLOWED_LENGTHS);let y=p.length,_=!1,I=0;for(let M of v){if(y===M){_=!0;break}M>I&&(I=M)}if(!_&&y>I&&(_=!0),!_)throw new U;const S=[new fe(u[1],i),new fe(l[0],i)];return new Ft(p,null,0,S,pe.ITF,new Date().getTime())}static decodeMiddle(i,o,c,u){let l=new Int32Array(10),d=new Int32Array(5),p=new Int32Array(5);for(l.fill(0),d.fill(0),p.fill(0);o<c;){ct.recordPattern(i,o,l);for(let y=0;y<5;y++){let _=2*y;d[y]=l[_],p[y]=l[_+1]}let v=We.decodeDigit(d);u.append(v.toString()),v=this.decodeDigit(p),u.append(v.toString()),l.forEach(function(y){o+=y})}}decodeStart(i){let o=We.skipWhiteSpace(i),c=We.findGuardPattern(i,o,We.START_PATTERN);return this.narrowLineWidth=(c[1]-c[0])/4,this.validateQuietZone(i,c[0]),c}validateQuietZone(i,o){let c=this.narrowLineWidth*10;c=c<o?c:o;for(let u=o-1;c>0&&u>=0&&!i.get(u);u--)c--;if(c!==0)throw new X}static skipWhiteSpace(i){const o=i.getSize(),c=i.getNextSet(0);if(c===o)throw new X;return c}decodeEnd(i){i.reverse();try{let o=We.skipWhiteSpace(i),c;try{c=We.findGuardPattern(i,o,We.END_PATTERN_REVERSED[0])}catch(l){l instanceof X&&(c=We.findGuardPattern(i,o,We.END_PATTERN_REVERSED[1]))}this.validateQuietZone(i,c[0]);let u=c[0];return c[0]=i.getSize()-c[1],c[1]=i.getSize()-u,c}finally{i.reverse()}}static findGuardPattern(i,o,c){let u=c.length,l=new Int32Array(u),d=i.getSize(),p=!1,v=0,y=o;l.fill(0);for(let _=o;_<d;_++)if(i.get(_)!==p)l[v]++;else{if(v===u-1){if(ct.patternMatchVariance(l,c,We.MAX_INDIVIDUAL_VARIANCE)<We.MAX_AVG_VARIANCE)return[y,_];y+=l[0]+l[1],T.arraycopy(l,2,l,0,v-1),l[v-1]=0,l[v]=0,v--}else v++;l[v]=1,p=!p}throw new X}static decodeDigit(i){let o=We.MAX_AVG_VARIANCE,c=-1,u=We.PATTERNS.length;for(let l=0;l<u;l++){let d=We.PATTERNS[l],p=ct.patternMatchVariance(i,d,We.MAX_INDIVIDUAL_VARIANCE);p<o?(o=p,c=l):p===o&&(c=-1)}if(c>=0)return c%10;throw new X}}We.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])],We.MAX_AVG_VARIANCE=.38,We.MAX_INDIVIDUAL_VARIANCE=.5,We.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],We.START_PATTERN=Int32Array.from([1,1,1,1]),We.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class nt extends ct{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(i){let o=!1,c,u=0,l=Int32Array.from([0,0,0]);for(;!o;){l=Int32Array.from([0,0,0]),c=nt.findGuardPattern(i,u,!1,this.START_END_PATTERN,l);let d=c[0];u=c[1];let p=d-(u-d);p>=0&&(o=i.isRange(p,d,!1))}return c}static checkChecksum(i){return nt.checkStandardUPCEANChecksum(i)}static checkStandardUPCEANChecksum(i){let o=i.length;if(o===0)return!1;let c=parseInt(i.charAt(o-1),10);return nt.getStandardUPCEANChecksum(i.substring(0,o-1))===c}static getStandardUPCEANChecksum(i){let o=i.length,c=0;for(let u=o-1;u>=0;u-=2){let l=i.charAt(u).charCodeAt(0)-48;if(l<0||l>9)throw new U;c+=l}c*=3;for(let u=o-2;u>=0;u-=2){let l=i.charAt(u).charCodeAt(0)-48;if(l<0||l>9)throw new U;c+=l}return(1e3-c)%10}static decodeEnd(i,o){return nt.findGuardPattern(i,o,!1,nt.START_END_PATTERN,new Int32Array(nt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(i,o,c,u){return this.findGuardPattern(i,o,c,u,new Int32Array(u.length))}static findGuardPattern(i,o,c,u,l){let d=i.getSize();o=c?i.getNextUnset(o):i.getNextSet(o);let p=0,v=o,y=u.length,_=c;for(let I=o;I<d;I++)if(i.get(I)!==_)l[p]++;else{if(p===y-1){if(ct.patternMatchVariance(l,u,nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return Int32Array.from([v,I]);v+=l[0]+l[1];let S=l.slice(2,l.length-1);for(let R=0;R<p-1;R++)l[R]=S[R];l[p-1]=0,l[p]=0,p--}else p++;l[p]=1,_=!_}throw new X}static decodeDigit(i,o,c,u){this.recordPattern(i,c,o);let l=this.MAX_AVG_VARIANCE,d=-1,p=u.length;for(let v=0;v<p;v++){let y=u[v],_=ct.patternMatchVariance(o,y,nt.MAX_INDIVIDUAL_VARIANCE);_<l&&(l=_,d=v)}if(d>=0)return d;throw new X}}nt.MAX_AVG_VARIANCE=.48,nt.MAX_INDIVIDUAL_VARIANCE=.7,nt.START_END_PATTERN=Int32Array.from([1,1,1]),nt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),nt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),nt.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 _n{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(i,o,c){let u=this.decodeRowStringBuffer,l=this.decodeMiddle(o,c,u),d=u.toString(),p=_n.parseExtensionString(d),v=[new fe((c[0]+c[1])/2,i),new fe(l,i)],y=new Ft(d,null,0,v,pe.UPC_EAN_EXTENSION,new Date().getTime());return p!=null&&y.putAllMetadata(p),y}decodeMiddle(i,o,c){let u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;let l=i.getSize(),d=o[1],p=0;for(let y=0;y<5&&d<l;y++){let _=nt.decodeDigit(i,u,d,nt.L_AND_G_PATTERNS);c+=String.fromCharCode(48+_%10);for(let I of u)d+=I;_>=10&&(p|=1<<4-y),y!==4&&(d=i.getNextSet(d),d=i.getNextUnset(d))}if(c.length!==5)throw new X;let v=this.determineCheckDigit(p);if(_n.extensionChecksum(c.toString())!==v)throw new X;return d}static extensionChecksum(i){let o=i.length,c=0;for(let u=o-2;u>=0;u-=2)c+=i.charAt(u).charCodeAt(0)-48;c*=3;for(let u=o-1;u>=0;u-=2)c+=i.charAt(u).charCodeAt(0)-48;return c*=3,c%10}determineCheckDigit(i){for(let o=0;o<10;o++)if(i===this.CHECK_DIGIT_ENCODINGS[o])return o;throw new X}static parseExtensionString(i){if(i.length!==5)return null;let o=_n.parseExtension5String(i);return o==null?null:new Map([[wt.SUGGESTED_PRICE,o]])}static parseExtension5String(i){let o;switch(i.charAt(0)){case"0":o="£";break;case"5":o="$";break;case"9":switch(i){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}o="";break;default:o="";break}let c=parseInt(i.substring(1)),u=(c/100).toString(),l=c%100,d=l<10?"0"+l:l.toString();return o+u+"."+d}}class mi{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(i,o,c){let u=this.decodeRowStringBuffer,l=this.decodeMiddle(o,c,u),d=u.toString(),p=mi.parseExtensionString(d),v=[new fe((c[0]+c[1])/2,i),new fe(l,i)],y=new Ft(d,null,0,v,pe.UPC_EAN_EXTENSION,new Date().getTime());return p!=null&&y.putAllMetadata(p),y}decodeMiddle(i,o,c){let u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;let l=i.getSize(),d=o[1],p=0;for(let v=0;v<2&&d<l;v++){let y=nt.decodeDigit(i,u,d,nt.L_AND_G_PATTERNS);c+=String.fromCharCode(48+y%10);for(let _ of u)d+=_;y>=10&&(p|=1<<1-v),v!==1&&(d=i.getNextSet(d),d=i.getNextUnset(d))}if(c.length!==2)throw new X;if(parseInt(c.toString())%4!==p)throw new X;return d}static parseExtensionString(i){return i.length!==2?null:new Map([[wt.ISSUE_NUMBER,parseInt(i)]])}}class Na{static decodeRow(i,o,c){let u=nt.findGuardPattern(o,c,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new _n().decodeRow(i,o,u)}catch{return new mi().decodeRow(i,o,u)}}}Na.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Pe extends nt{constructor(){super(),this.decodeRowStringBuffer="",Pe.L_AND_G_PATTERNS=Pe.L_PATTERNS.map(i=>Int32Array.from(i));for(let i=10;i<20;i++){let o=Pe.L_PATTERNS[i-10],c=new Int32Array(o.length);for(let u=0;u<o.length;u++)c[u]=o[o.length-u-1];Pe.L_AND_G_PATTERNS[i]=c}}decodeRow(i,o,c){let u=Pe.findStartGuardPattern(o),l=c==null?null:c.get(K.NEED_RESULT_POINT_CALLBACK);if(l!=null){const J=new fe((u[0]+u[1])/2,i);l.foundPossibleResultPoint(J)}let d=this.decodeMiddle(o,u,this.decodeRowStringBuffer),p=d.rowOffset,v=d.resultString;if(l!=null){const J=new fe(p,i);l.foundPossibleResultPoint(J)}let y=this.decodeEnd(o,p);if(l!=null){const J=new fe((y[0]+y[1])/2,i);l.foundPossibleResultPoint(J)}let _=y[1],I=_+(_-y[0]);if(I>=o.getSize()||!o.isRange(_,I,!1))throw new X;let S=v.toString();if(S.length<8)throw new U;if(!Pe.checkChecksum(S))throw new C;let R=(u[1]+u[0])/2,M=(y[1]+y[0])/2,B=this.getBarcodeFormat(),V=[new fe(R,i),new fe(M,i)],z=new Ft(S,null,0,V,B,new Date().getTime()),ee=0;try{let J=Na.decodeRow(i,o,y[1]);z.putMetadata(wt.UPC_EAN_EXTENSION,J.getText()),z.putAllMetadata(J.getResultMetadata()),z.addResultPoints(J.getResultPoints()),ee=J.getText().length}catch{}let te=c==null?null:c.get(K.ALLOWED_EAN_EXTENSIONS);if(te!=null){let J=!1;for(let Se in te)if(ee.toString()===Se){J=!0;break}if(!J)throw new X}return z}decodeEnd(i,o){return Pe.findGuardPattern(i,o,!1,Pe.START_END_PATTERN,new Int32Array(Pe.START_END_PATTERN.length).fill(0))}static checkChecksum(i){return Pe.checkStandardUPCEANChecksum(i)}static checkStandardUPCEANChecksum(i){let o=i.length;if(o===0)return!1;let c=parseInt(i.charAt(o-1),10);return Pe.getStandardUPCEANChecksum(i.substring(0,o-1))===c}static getStandardUPCEANChecksum(i){let o=i.length,c=0;for(let u=o-1;u>=0;u-=2){let l=i.charAt(u).charCodeAt(0)-48;if(l<0||l>9)throw new U;c+=l}c*=3;for(let u=o-2;u>=0;u-=2){let l=i.charAt(u).charCodeAt(0)-48;if(l<0||l>9)throw new U;c+=l}return(1e3-c)%10}}class zr extends Pe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(i,o,c){let u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;let l=i.getSize(),d=o[1],p=0;for(let y=0;y<6&&d<l;y++){let _=Pe.decodeDigit(i,u,d,Pe.L_AND_G_PATTERNS);c+=String.fromCharCode(48+_%10);for(let I of u)d+=I;_>=10&&(p|=1<<5-y)}c=zr.determineFirstDigit(c,p),d=Pe.findGuardPattern(i,d,!0,Pe.MIDDLE_PATTERN,new Int32Array(Pe.MIDDLE_PATTERN.length).fill(0))[1];for(let y=0;y<6&&d<l;y++){let _=Pe.decodeDigit(i,u,d,Pe.L_PATTERNS);c+=String.fromCharCode(48+_);for(let I of u)d+=I}return{rowOffset:d,resultString:c}}getBarcodeFormat(){return pe.EAN_13}static determineFirstDigit(i,o){for(let c=0;c<10;c++)if(o===this.FIRST_DIGIT_ENCODINGS[c])return i=String.fromCharCode(48+c)+i,i;throw new X}}zr.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Ra extends Pe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(i,o,c){const u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;let l=i.getSize(),d=o[1];for(let v=0;v<4&&d<l;v++){let y=Pe.decodeDigit(i,u,d,Pe.L_PATTERNS);c+=String.fromCharCode(48+y);for(let _ of u)d+=_}d=Pe.findGuardPattern(i,d,!0,Pe.MIDDLE_PATTERN,new Int32Array(Pe.MIDDLE_PATTERN.length).fill(0))[1];for(let v=0;v<4&&d<l;v++){let y=Pe.decodeDigit(i,u,d,Pe.L_PATTERNS);c+=String.fromCharCode(48+y);for(let _ of u)d+=_}return{rowOffset:d,resultString:c}}getBarcodeFormat(){return pe.EAN_8}}class Da extends Pe{constructor(){super(...arguments),this.ean13Reader=new zr}getBarcodeFormat(){return pe.UPC_A}decode(i,o){return this.maybeReturnResult(this.ean13Reader.decode(i))}decodeRow(i,o,c){return this.maybeReturnResult(this.ean13Reader.decodeRow(i,o,c))}decodeMiddle(i,o,c){return this.ean13Reader.decodeMiddle(i,o,c)}maybeReturnResult(i){let o=i.getText();if(o.charAt(0)==="0"){let c=new Ft(o.substring(1),null,null,i.getResultPoints(),pe.UPC_A);return i.getResultMetadata()!=null&&c.putAllMetadata(i.getResultMetadata()),c}else throw new X}reset(){this.ean13Reader.reset()}}class dr extends Pe{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(i,o,c){const u=this.decodeMiddleCounters.map(y=>y);u[0]=0,u[1]=0,u[2]=0,u[3]=0;const l=i.getSize();let d=o[1],p=0;for(let y=0;y<6&&d<l;y++){const _=dr.decodeDigit(i,u,d,dr.L_AND_G_PATTERNS);c+=String.fromCharCode(48+_%10);for(let I of u)d+=I;_>=10&&(p|=1<<5-y)}let v=dr.determineNumSysAndCheckDigit(c,p);return{rowOffset:d,resultString:v}}decodeEnd(i,o){return dr.findGuardPatternWithoutCounters(i,o,!0,dr.MIDDLE_END_PATTERN)}checkChecksum(i){return Pe.checkChecksum(dr.convertUPCEtoUPCA(i))}static determineNumSysAndCheckDigit(i,o){for(let c=0;c<=1;c++)for(let u=0;u<10;u++)if(o===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[c][u]){let l=String.fromCharCode(48+c),d=String.fromCharCode(48+u);return l+i+d}throw X.getNotFoundInstance()}getBarcodeFormat(){return pe.UPC_E}static convertUPCEtoUPCA(i){const o=i.slice(1,7).split("").map(l=>l.charCodeAt(0)),c=new ne;c.append(i.charAt(0));let u=o[5];switch(u){case 0:case 1:case 2:c.appendChars(o,0,2),c.append(u),c.append("0000"),c.appendChars(o,2,3);break;case 3:c.appendChars(o,0,3),c.append("00000"),c.appendChars(o,3,2);break;case 4:c.appendChars(o,0,4),c.append("00000"),c.append(o[4]);break;default:c.appendChars(o,0,5),c.append("0000"),c.append(u);break}return i.length>=8&&c.append(i.charAt(7)),c.toString()}}dr.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),dr.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 Ii extends ct{constructor(i){super();let o=i==null?null:i.get(K.POSSIBLE_FORMATS),c=[];n(o)?(c.push(new zr),c.push(new Da),c.push(new Ra),c.push(new dr)):(o.indexOf(pe.EAN_13)>-1&&c.push(new zr),o.indexOf(pe.UPC_A)>-1&&c.push(new Da),o.indexOf(pe.EAN_8)>-1&&c.push(new Ra),o.indexOf(pe.UPC_E)>-1&&c.push(new dr)),this.readers=c}decodeRow(i,o,c){for(let u of this.readers)try{const l=u.decodeRow(i,o,c),d=l.getBarcodeFormat()===pe.EAN_13&&l.getText().charAt(0)==="0",p=c==null?null:c.get(K.POSSIBLE_FORMATS),v=p==null||p.includes(pe.UPC_A);if(d&&v){const y=l.getRawBytes(),_=new Ft(l.getText().substring(1),y,y?y.length:null,l.getResultPoints(),pe.UPC_A);return _.putAllMetadata(l.getResultMetadata()),_}return l}catch{}throw new X}reset(){for(let i of this.readers)i.reset()}}class Dt extends ct{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(i,o){for(let c=0;c<o.length;c++)if(ct.patternMatchVariance(i,o[c],Dt.MAX_INDIVIDUAL_VARIANCE)<Dt.MAX_AVG_VARIANCE)return c;throw new X}static count(i){return Oe.sum(new Int32Array(i))}static increment(i,o){let c=0,u=o[0];for(let l=1;l<i.length;l++)o[l]>u&&(u=o[l],c=l);i[c]++}static decrement(i,o){let c=0,u=o[0];for(let l=1;l<i.length;l++)o[l]<u&&(u=o[l],c=l);i[c]--}static isFinderPattern(i){let o=i[0]+i[1],c=o+i[2]+i[3],u=o/c;if(u>=Dt.MIN_FINDER_PATTERN_RATIO&&u<=Dt.MAX_FINDER_PATTERN_RATIO){let l=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let p of i)p>d&&(d=p),p<l&&(l=p);return d<10*l}return!1}}Dt.MAX_AVG_VARIANCE=.2,Dt.MAX_INDIVIDUAL_VARIANCE=.45,Dt.MIN_FINDER_PATTERN_RATIO=9.5/12,Dt.MAX_FINDER_PATTERN_RATIO=12.5/14;class an{constructor(i,o){this.value=i,this.checksumPortion=o}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(i){if(!(i instanceof an))return!1;const o=i;return this.value===o.value&&this.checksumPortion===o.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Yn{constructor(i,o,c,u,l){this.value=i,this.startEnd=o,this.value=i,this.startEnd=o,this.resultPoints=new Array,this.resultPoints.push(new fe(c,l)),this.resultPoints.push(new fe(u,l))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(i){if(!(i instanceof Yn))return!1;const o=i;return this.value===o.value}hashCode(){return this.value}}class yr{constructor(){}static getRSSvalue(i,o,c){let u=0;for(let v of i)u+=v;let l=0,d=0,p=i.length;for(let v=0;v<p-1;v++){let y;for(y=1,d|=1<<v;y<i[v];y++,d&=~(1<<v)){let _=yr.combins(u-y-1,p-v-2);if(c&&d===0&&u-y-(p-v-1)>=p-v-1&&(_-=yr.combins(u-y-(p-v),p-v-2)),p-v-1>1){let I=0;for(let S=u-y-(p-v-2);S>o;S--)I+=yr.combins(u-y-S-1,p-v-3);_-=I*(p-1-v)}else u-y>o&&_--;l+=_}u-=y}return l}static combins(i,o){let c,u;i-o>o?(u=o,c=i-o):(u=i-o,c=o);let l=1,d=1;for(let p=i;p>c;p--)l*=p,d<=u&&(l/=d,d++);for(;d<=u;)l/=d,d++;return l}}class u1{static buildBitArray(i){let o=i.length*2-1;i[i.length-1].getRightChar()==null&&(o-=1);let c=12*o,u=new k(c),l=0,p=i[0].getRightChar().getValue();for(let v=11;v>=0;--v)(p&1<<v)!=0&&u.set(l),l++;for(let v=1;v<i.length;++v){let y=i[v],_=y.getLeftChar().getValue();for(let I=11;I>=0;--I)(_&1<<I)!=0&&u.set(l),l++;if(y.getRightChar()!=null){let I=y.getRightChar().getValue();for(let S=11;S>=0;--S)(I&1<<S)!=0&&u.set(l),l++}}return u}}class Yr{constructor(i,o){o?this.decodedInformation=null:(this.finished=i,this.decodedInformation=o)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Si{constructor(i){this.newPosition=i}getNewPosition(){return this.newPosition}}class zt extends Si{constructor(i,o){super(i),this.value=o}getValue(){return this.value}isFNC1(){return this.value===zt.FNC1}}zt.FNC1="$";class Zr extends Si{constructor(i,o,c){super(i),c?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=o}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class ir extends Si{constructor(i,o,c){if(super(i),o<0||o>10||c<0||c>10)throw new U;this.firstDigit=o,this.secondDigit=c}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===ir.FNC1}isSecondDigitFNC1(){return this.secondDigit===ir.FNC1}isAnyFNC1(){return this.firstDigit===ir.FNC1||this.secondDigit===ir.FNC1}}ir.FNC1=10;class ae{constructor(){}static parseFieldsInGeneralPurpose(i){if(!i)return null;if(i.length<2)throw new X;let o=i.substring(0,2);for(let l of ae.TWO_DIGIT_DATA_LENGTH)if(l[0]===o)return l[1]===ae.VARIABLE_LENGTH?ae.processVariableAI(2,l[2],i):ae.processFixedAI(2,l[1],i);if(i.length<3)throw new X;let c=i.substring(0,3);for(let l of ae.THREE_DIGIT_DATA_LENGTH)if(l[0]===c)return l[1]===ae.VARIABLE_LENGTH?ae.processVariableAI(3,l[2],i):ae.processFixedAI(3,l[1],i);for(let l of ae.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(l[0]===c)return l[1]===ae.VARIABLE_LENGTH?ae.processVariableAI(4,l[2],i):ae.processFixedAI(4,l[1],i);if(i.length<4)throw new X;let u=i.substring(0,4);for(let l of ae.FOUR_DIGIT_DATA_LENGTH)if(l[0]===u)return l[1]===ae.VARIABLE_LENGTH?ae.processVariableAI(4,l[2],i):ae.processFixedAI(4,l[1],i);throw new X}static processFixedAI(i,o,c){if(c.length<i)throw new X;let u=c.substring(0,i);if(c.length<i+o)throw new X;let l=c.substring(i,i+o),d=c.substring(i+o),p="("+u+")"+l,v=ae.parseFieldsInGeneralPurpose(d);return v==null?p:p+v}static processVariableAI(i,o,c){let u=c.substring(0,i),l;c.length<i+o?l=c.length:l=i+o;let d=c.substring(i,l),p=c.substring(l),v="("+u+")"+d,y=ae.parseFieldsInGeneralPurpose(p);return y==null?v:v+y}}ae.VARIABLE_LENGTH=[],ae.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ae.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ae.VARIABLE_LENGTH,20],["22",ae.VARIABLE_LENGTH,29],["30",ae.VARIABLE_LENGTH,8],["37",ae.VARIABLE_LENGTH,8],["90",ae.VARIABLE_LENGTH,30],["91",ae.VARIABLE_LENGTH,30],["92",ae.VARIABLE_LENGTH,30],["93",ae.VARIABLE_LENGTH,30],["94",ae.VARIABLE_LENGTH,30],["95",ae.VARIABLE_LENGTH,30],["96",ae.VARIABLE_LENGTH,30],["97",ae.VARIABLE_LENGTH,3],["98",ae.VARIABLE_LENGTH,30],["99",ae.VARIABLE_LENGTH,30]],ae.THREE_DIGIT_DATA_LENGTH=[["240",ae.VARIABLE_LENGTH,30],["241",ae.VARIABLE_LENGTH,30],["242",ae.VARIABLE_LENGTH,6],["250",ae.VARIABLE_LENGTH,30],["251",ae.VARIABLE_LENGTH,30],["253",ae.VARIABLE_LENGTH,17],["254",ae.VARIABLE_LENGTH,20],["400",ae.VARIABLE_LENGTH,30],["401",ae.VARIABLE_LENGTH,30],["402",17],["403",ae.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ae.VARIABLE_LENGTH,20],["421",ae.VARIABLE_LENGTH,15],["422",3],["423",ae.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ae.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",ae.VARIABLE_LENGTH,15],["391",ae.VARIABLE_LENGTH,18],["392",ae.VARIABLE_LENGTH,15],["393",ae.VARIABLE_LENGTH,18],["703",ae.VARIABLE_LENGTH,30]],ae.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ae.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ae.VARIABLE_LENGTH,20],["8003",ae.VARIABLE_LENGTH,30],["8004",ae.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ae.VARIABLE_LENGTH,30],["8008",ae.VARIABLE_LENGTH,12],["8018",18],["8020",ae.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ae.VARIABLE_LENGTH,70],["8200",ae.VARIABLE_LENGTH,70]];class on{constructor(i){this.buffer=new ne,this.information=i}decodeAllCodes(i,o){let c=o,u=null;do{let l=this.decodeGeneralPurposeField(c,u),d=ae.parseFieldsInGeneralPurpose(l.getNewString());if(d!=null&&i.append(d),l.isRemaining()?u=""+l.getRemainingValue():u=null,c===l.getNewPosition())break;c=l.getNewPosition()}while(!0);return i.toString()}isStillNumeric(i){if(i+7>this.information.getSize())return i+4<=this.information.getSize();for(let o=i;o<i+3;++o)if(this.information.get(o))return!0;return this.information.get(i+3)}decodeNumeric(i){if(i+7>this.information.getSize()){let l=this.extractNumericValueFromBitArray(i,4);return l===0?new ir(this.information.getSize(),ir.FNC1,ir.FNC1):new ir(this.information.getSize(),l-1,ir.FNC1)}let o=this.extractNumericValueFromBitArray(i,7),c=(o-8)/11,u=(o-8)%11;return new ir(i+7,c,u)}extractNumericValueFromBitArray(i,o){return on.extractNumericValueFromBitArray(this.information,i,o)}static extractNumericValueFromBitArray(i,o,c){let u=0;for(let l=0;l<c;++l)i.get(o+l)&&(u|=1<<c-l-1);return u}decodeGeneralPurposeField(i,o){this.buffer.setLengthToZero(),o!=null&&this.buffer.append(o),this.current.setPosition(i);let c=this.parseBlocks();return c!=null&&c.isRemaining()?new Zr(this.current.getPosition(),this.buffer.toString(),c.getRemainingValue()):new Zr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let i,o;do{let c=this.current.getPosition();if(this.current.isAlpha()?(o=this.parseAlphaBlock(),i=o.isFinished()):this.current.isIsoIec646()?(o=this.parseIsoIec646Block(),i=o.isFinished()):(o=this.parseNumericBlock(),i=o.isFinished()),!(c!==this.current.getPosition())&&!i)break}while(!i);return o.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let i=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFirstDigitFNC1()){let o;return i.isSecondDigitFNC1()?o=new Zr(this.current.getPosition(),this.buffer.toString()):o=new Zr(this.current.getPosition(),this.buffer.toString(),i.getSecondDigit()),new Yr(!0,o)}if(this.buffer.append(i.getFirstDigit()),i.isSecondDigitFNC1()){let o=new Zr(this.current.getPosition(),this.buffer.toString());return new Yr(!0,o)}this.buffer.append(i.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Yr(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let i=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFNC1()){let o=new Zr(this.current.getPosition(),this.buffer.toString());return new Yr(!0,o)}this.buffer.append(i.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 Yr(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let i=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(i.getNewPosition()),i.isFNC1()){let o=new Zr(this.current.getPosition(),this.buffer.toString());return new Yr(!0,o)}this.buffer.append(i.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 Yr(!1)}isStillIsoIec646(i){if(i+5>this.information.getSize())return!1;let o=this.extractNumericValueFromBitArray(i,5);if(o>=5&&o<16)return!0;if(i+7>this.information.getSize())return!1;let c=this.extractNumericValueFromBitArray(i,7);if(c>=64&&c<116)return!0;if(i+8>this.information.getSize())return!1;let u=this.extractNumericValueFromBitArray(i,8);return u>=232&&u<253}decodeIsoIec646(i){let o=this.extractNumericValueFromBitArray(i,5);if(o===15)return new zt(i+5,zt.FNC1);if(o>=5&&o<15)return new zt(i+5,"0"+(o-5));let c=this.extractNumericValueFromBitArray(i,7);if(c>=64&&c<90)return new zt(i+7,""+(c+1));if(c>=90&&c<116)return new zt(i+7,""+(c+7));let u=this.extractNumericValueFromBitArray(i,8),l;switch(u){case 232:l="!";break;case 233:l='"';break;case 234:l="%";break;case 235:l="&";break;case 236:l="'";break;case 237:l="(";break;case 238:l=")";break;case 239:l="*";break;case 240:l="+";break;case 241:l=",";break;case 242:l="-";break;case 243:l=".";break;case 244:l="/";break;case 245:l=":";break;case 246:l=";";break;case 247:l="<";break;case 248:l="=";break;case 249:l=">";break;case 250:l="?";break;case 251:l="_";break;case 252:l=" ";break;default:throw new U}return new zt(i+8,l)}isStillAlpha(i){if(i+5>this.information.getSize())return!1;let o=this.extractNumericValueFromBitArray(i,5);if(o>=5&&o<16)return!0;if(i+6>this.information.getSize())return!1;let c=this.extractNumericValueFromBitArray(i,6);return c>=16&&c<63}decodeAlphanumeric(i){let o=this.extractNumericValueFromBitArray(i,5);if(o===15)return new zt(i+5,zt.FNC1);if(o>=5&&o<15)return new zt(i+5,"0"+(o-5));let c=this.extractNumericValueFromBitArray(i,6);if(c>=32&&c<58)return new zt(i+6,""+(c+33));let u;switch(c){case 58:u="*";break;case 59:u=",";break;case 60:u="-";break;case 61:u=".";break;case 62:u="/";break;default:throw new Ar("Decoding invalid alphanumeric value: "+c)}return new zt(i+6,u)}isAlphaTo646ToAlphaLatch(i){if(i+1>this.information.getSize())return!1;for(let o=0;o<5&&o+i<this.information.getSize();++o)if(o===2){if(!this.information.get(i+2))return!1}else if(this.information.get(i+o))return!1;return!0}isAlphaOr646ToNumericLatch(i){if(i+3>this.information.getSize())return!1;for(let o=i;o<i+3;++o)if(this.information.get(o))return!1;return!0}isNumericToAlphaNumericLatch(i){if(i+1>this.information.getSize())return!1;for(let o=0;o<4&&o+i<this.information.getSize();++o)if(this.information.get(i+o))return!1;return!0}}class bi{constructor(i){this.information=i,this.generalDecoder=new on(i)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Yt extends bi{constructor(i){super(i)}encodeCompressedGtin(i,o){i.append("(01)");let c=i.length();i.append("9"),this.encodeCompressedGtinWithoutAI(i,o,c)}encodeCompressedGtinWithoutAI(i,o,c){for(let u=0;u<4;++u){let l=this.getGeneralDecoder().extractNumericValueFromBitArray(o+10*u,10);l/100===0&&i.append("0"),l/10===0&&i.append("0"),i.append(l)}Yt.appendCheckDigit(i,c)}static appendCheckDigit(i,o){let c=0;for(let u=0;u<13;u++){let l=i.charAt(u+o).charCodeAt(0)-48;c+=(u&1)===0?3*l:l}c=10-c%10,c===10&&(c=0),i.append(c)}}Yt.GTIN_SIZE=40;class sn extends Yt{constructor(i){super(i)}parseInformation(){let i=new ne;i.append("(01)");let o=i.length(),c=this.getGeneralDecoder().extractNumericValueFromBitArray(sn.HEADER_SIZE,4);return i.append(c),this.encodeCompressedGtinWithoutAI(i,sn.HEADER_SIZE+4,o),this.getGeneralDecoder().decodeAllCodes(i,sn.HEADER_SIZE+44)}}sn.HEADER_SIZE=4;class Zn extends bi{constructor(i){super(i)}parseInformation(){let i=new ne;return this.getGeneralDecoder().decodeAllCodes(i,Zn.HEADER_SIZE)}}Zn.HEADER_SIZE=5;class jn extends Yt{constructor(i){super(i)}encodeCompressedWeight(i,o,c){let u=this.getGeneralDecoder().extractNumericValueFromBitArray(o,c);this.addWeightCode(i,u);let l=this.checkWeight(u),d=1e5;for(let p=0;p<5;++p)l/d===0&&i.append("0"),d/=10;i.append(l)}}class Er extends jn{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()!=Er.HEADER_SIZE+jn.GTIN_SIZE+Er.WEIGHT_SIZE)throw new X;let i=new ne;return this.encodeCompressedGtin(i,Er.HEADER_SIZE),this.encodeCompressedWeight(i,Er.HEADER_SIZE+jn.GTIN_SIZE,Er.WEIGHT_SIZE),i.toString()}}Er.HEADER_SIZE=5,Er.WEIGHT_SIZE=15;class l1 extends Er{constructor(i){super(i)}addWeightCode(i,o){i.append("(3103)")}checkWeight(i){return i}}class h1 extends Er{constructor(i){super(i)}addWeightCode(i,o){o<1e4?i.append("(3202)"):i.append("(3203)")}checkWeight(i){return i<1e4?i:i-1e4}}class Cr extends Yt{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()<Cr.HEADER_SIZE+Yt.GTIN_SIZE)throw new X;let i=new ne;this.encodeCompressedGtin(i,Cr.HEADER_SIZE);let o=this.getGeneralDecoder().extractNumericValueFromBitArray(Cr.HEADER_SIZE+Yt.GTIN_SIZE,Cr.LAST_DIGIT_SIZE);i.append("(392"),i.append(o),i.append(")");let c=this.getGeneralDecoder().decodeGeneralPurposeField(Cr.HEADER_SIZE+Yt.GTIN_SIZE+Cr.LAST_DIGIT_SIZE,null);return i.append(c.getNewString()),i.toString()}}Cr.HEADER_SIZE=8,Cr.LAST_DIGIT_SIZE=2;class Ut extends Yt{constructor(i){super(i)}parseInformation(){if(this.getInformation().getSize()<Ut.HEADER_SIZE+Yt.GTIN_SIZE)throw new X;let i=new ne;this.encodeCompressedGtin(i,Ut.HEADER_SIZE);let o=this.getGeneralDecoder().extractNumericValueFromBitArray(Ut.HEADER_SIZE+Yt.GTIN_SIZE,Ut.LAST_DIGIT_SIZE);i.append("(393"),i.append(o),i.append(")");let c=this.getGeneralDecoder().extractNumericValueFromBitArray(Ut.HEADER_SIZE+Yt.GTIN_SIZE+Ut.LAST_DIGIT_SIZE,Ut.FIRST_THREE_DIGITS_SIZE);c/100==0&&i.append("0"),c/10==0&&i.append("0"),i.append(c);let u=this.getGeneralDecoder().decodeGeneralPurposeField(Ut.HEADER_SIZE+Yt.GTIN_SIZE+Ut.LAST_DIGIT_SIZE+Ut.FIRST_THREE_DIGITS_SIZE,null);return i.append(u.getNewString()),i.toString()}}Ut.HEADER_SIZE=8,Ut.LAST_DIGIT_SIZE=2,Ut.FIRST_THREE_DIGITS_SIZE=10;class et extends jn{constructor(i,o,c){super(i),this.dateCode=c,this.firstAIdigits=o}parseInformation(){if(this.getInformation().getSize()!=et.HEADER_SIZE+et.GTIN_SIZE+et.WEIGHT_SIZE+et.DATE_SIZE)throw new X;let i=new ne;return this.encodeCompressedGtin(i,et.HEADER_SIZE),this.encodeCompressedWeight(i,et.HEADER_SIZE+et.GTIN_SIZE,et.WEIGHT_SIZE),this.encodeCompressedDate(i,et.HEADER_SIZE+et.GTIN_SIZE+et.WEIGHT_SIZE),i.toString()}encodeCompressedDate(i,o){let c=this.getGeneralDecoder().extractNumericValueFromBitArray(o,et.DATE_SIZE);if(c==38400)return;i.append("("),i.append(this.dateCode),i.append(")");let u=c%32;c/=32;let l=c%12+1;c/=12;let d=c;d/10==0&&i.append("0"),i.append(d),l/10==0&&i.append("0"),i.append(l),u/10==0&&i.append("0"),i.append(u)}addWeightCode(i,o){i.append("("),i.append(this.firstAIdigits),i.append(o/1e5),i.append(")")}checkWeight(i){return i%1e5}}et.HEADER_SIZE=8,et.WEIGHT_SIZE=20,et.DATE_SIZE=16;function Ma(m){try{if(m.get(1))return new sn(m);if(!m.get(2))return new Zn(m);switch(on.extractNumericValueFromBitArray(m,1,4)){case 4:return new l1(m);case 5:return new h1(m)}switch(on.extractNumericValueFromBitArray(m,1,5)){case 12:return new Cr(m);case 13:return new Ut(m)}switch(on.extractNumericValueFromBitArray(m,1,7)){case 56:return new et(m,"310","11");case 57:return new et(m,"320","11");case 58:return new et(m,"310","13");case 59:return new et(m,"320","13");case 60:return new et(m,"310","15");case 61:return new et(m,"320","15");case 62:return new et(m,"310","17");case 63:return new et(m,"320","17")}}catch(i){throw console.log(i),new Ar("unknown decoder: "+m)}}class Mr{constructor(i,o,c,u){this.leftchar=i,this.rightchar=o,this.finderpattern=c,this.maybeLast=u}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(i,o){return i instanceof Mr?Mr.equalsOrNull(i.leftchar,o.leftchar)&&Mr.equalsOrNull(i.rightchar,o.rightchar)&&Mr.equalsOrNull(i.finderpattern,o.finderpattern):!1}static equalsOrNull(i,o){return i===null?o===null:Mr.equals(i,o)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Ti{constructor(i,o,c){this.pairs=i,this.rowNumber=o,this.wasReversed=c}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(i){return this.checkEqualitity(this,i)}toString(){return"{ "+this.pairs+" }"}equals(i,o){return i instanceof Ti?this.checkEqualitity(i,o)&&i.wasReversed===o.wasReversed:!1}checkEqualitity(i,o){if(!i||!o)return;let c;return i.forEach((u,l)=>{o.forEach(d=>{u.getLeftChar().getValue()===d.getLeftChar().getValue()&&u.getRightChar().getValue()===d.getRightChar().getValue()&&u.getFinderPatter().getValue()===d.getFinderPatter().getValue()&&(c=!0)})}),c}}class Q extends Dt{constructor(i){super(...arguments),this.pairs=new Array(Q.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=i===!0}decodeRow(i,o,c){this.pairs.length=0,this.startFromEven=!1;try{return Q.constructResult(this.decodeRow2pairs(i,o))}catch(u){this.verbose&&console.log(u)}return this.pairs.length=0,this.startFromEven=!0,Q.constructResult(this.decodeRow2pairs(i,o))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(i,o){let c=!1;for(;!c;)try{this.pairs.push(this.retrieveNextPair(o,this.pairs,i))}catch(l){if(l instanceof X){if(!this.pairs.length)throw new X;c=!0}}if(this.checkChecksum())return this.pairs;let u;if(this.rows.length?u=!0:u=!1,this.storeRow(i,!1),u){let l=this.checkRowsBoolean(!1);if(l!=null||(l=this.checkRowsBoolean(!0),l!=null))return l}throw new X}checkRowsBoolean(i){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,i&&(this.rows=this.rows.reverse());let o=null;try{o=this.checkRows(new Array,0)}catch(c){this.verbose&&console.log(c)}return i&&(this.rows=this.rows.reverse()),o}checkRows(i,o){for(let c=o;c<this.rows.length;c++){let u=this.rows[c];this.pairs.length=0;for(let d of i)this.pairs.push(d.getPairs());if(this.pairs.push(u.getPairs()),!Q.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let l=new Array(i);l.push(u);try{return this.checkRows(l,c+1)}catch(d){this.verbose&&console.log(d)}}throw new X}static isValidSequence(i){for(let o of Q.FINDER_PATTERN_SEQUENCES){if(i.length>o.length)continue;let c=!0;for(let u=0;u<i.length;u++)if(i[u].getFinderPattern().getValue()!=o[u]){c=!1;break}if(c)return!0}return!1}storeRow(i,o){let c=0,u=!1,l=!1;for(;c<this.rows.length;){let d=this.rows[c];if(d.getRowNumber()>i){l=d.isEquivalent(this.pairs);break}u=d.isEquivalent(this.pairs),c++}l||u||Q.isPartialRow(this.pairs,this.rows)||(this.rows.push(c,new Ti(this.pairs,i,o)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(i,o){for(let c of o)if(c.getPairs().length!==i.length){for(let u of c.getPairs())for(let l of i)if(Mr.equals(u,l))break}}static isPartialRow(i,o){for(let c of o){let u=!0;for(let l of i){let d=!1;for(let p of c.getPairs())if(l.equals(p)){d=!0;break}if(!d){u=!1;break}}if(u)return!0}return!1}getRows(){return this.rows}static constructResult(i){let o=u1.buildBitArray(i),u=Ma(o).parseInformation(),l=i[0].getFinderPattern().getResultPoints(),d=i[i.length-1].getFinderPattern().getResultPoints(),p=[l[0],l[1],d[0],d[1]];return new Ft(u,null,null,p,pe.RSS_EXPANDED,null)}checkChecksum(){let i=this.pairs.get(0),o=i.getLeftChar(),c=i.getRightChar();if(c==null)return!1;let u=c.getChecksumPortion(),l=2;for(let p=1;p<this.pairs.size();++p){let v=this.pairs.get(p);u+=v.getLeftChar().getChecksumPortion(),l++;let y=v.getRightChar();y!=null&&(u+=y.getChecksumPortion(),l++)}return u%=211,211*(l-4)+u==o.getValue()}static getNextSecondBar(i,o){let c;return i.get(o)?(c=i.getNextUnset(o),c=i.getNextSet(c)):(c=i.getNextSet(o),c=i.getNextUnset(c)),c}retrieveNextPair(i,o,c){let u=o.length%2==0;this.startFromEven&&(u=!u);let l,d=!0,p=-1;do this.findNextPair(i,o,p),l=this.parseFoundFinderPattern(i,c,u),l==null?p=Q.getNextSecondBar(i,this.startEnd[0]):d=!1;while(d);let v=this.decodeDataCharacter(i,l,u,!0);if(!this.isEmptyPair(o)&&o[o.length-1].mustBeLast())throw new X;let y;try{y=this.decodeDataCharacter(i,l,u,!1)}catch(_){y=null,this.verbose&&console.log(_)}return new Mr(v,y,l,!0)}isEmptyPair(i){return i.length===0}findNextPair(i,o,c){let u=this.getDecodeFinderCounters();u[0]=0,u[1]=0,u[2]=0,u[3]=0;let l=i.getSize(),d;c>=0?d=c:this.isEmptyPair(o)?d=0:d=o[o.length-1].getFinderPattern().getStartEnd()[1];let p=o.length%2!=0;this.startFromEven&&(p=!p);let v=!1;for(;d<l&&(v=!i.get(d),!!v);)d++;let y=0,_=d;for(let I=d;I<l;I++)if(i.get(I)!=v)u[y]++;else{if(y==3){if(p&&Q.reverseCounters(u),Q.isFinderPattern(u)){this.startEnd[0]=_,this.startEnd[1]=I;return}p&&Q.reverseCounters(u),_+=u[0]+u[1],u[0]=u[2],u[1]=u[3],u[2]=0,u[3]=0,y--}else y++;u[y]=1,v=!v}throw new X}static reverseCounters(i){let o=i.length;for(let c=0;c<o/2;++c){let u=i[c];i[c]=i[o-c-1],i[o-c-1]=u}}parseFoundFinderPattern(i,o,c){let u,l,d;if(c){let y=this.startEnd[0]-1;for(;y>=0&&!i.get(y);)y--;y++,u=this.startEnd[0]-y,l=y,d=this.startEnd[1]}else l=this.startEnd[0],d=i.getNextUnset(this.startEnd[1]+1),u=d-this.startEnd[1];let p=this.getDecodeFinderCounters();T.arraycopy(p,0,p,1,p.length-1),p[0]=u;let v;try{v=this.parseFinderValue(p,Q.FINDER_PATTERNS)}catch{return null}return new Yn(v,[l,d],l,d,o)}decodeDataCharacter(i,o,c,u){let l=this.getDataCharacterCounters();for(let Ye=0;Ye<l.length;Ye++)l[Ye]=0;if(u)Q.recordPatternInReverse(i,o.getStartEnd()[0],l);else{Q.recordPattern(i,o.getStartEnd()[1],l);for(let Ye=0,Tt=l.length-1;Ye<Tt;Ye++,Tt--){let er=l[Ye];l[Ye]=l[Tt],l[Tt]=er}}let d=17,p=Oe.sum(new Int32Array(l))/d,v=(o.getStartEnd()[1]-o.getStartEnd()[0])/15;if(Math.abs(p-v)/v>.3)throw new X;let y=this.getOddCounts(),_=this.getEvenCounts(),I=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let Ye=0;Ye<l.length;Ye++){let Tt=1*l[Ye]/p,er=Tt+.5;if(er<1){if(Tt<.3)throw new X;er=1}else if(er>8){if(Tt>8.7)throw new X;er=8}let hn=Ye/2;(Ye&1)==0?(y[hn]=er,I[hn]=Tt-er):(_[hn]=er,S[hn]=Tt-er)}this.adjustOddEvenCounts(d);let R=4*o.getValue()+(c?0:2)+(u?0:1)-1,M=0,B=0;for(let Ye=y.length-1;Ye>=0;Ye--){if(Q.isNotA1left(o,c,u)){let Tt=Q.WEIGHTS[R][2*Ye];B+=y[Ye]*Tt}M+=y[Ye]}let V=0;for(let Ye=_.length-1;Ye>=0;Ye--)if(Q.isNotA1left(o,c,u)){let Tt=Q.WEIGHTS[R][2*Ye+1];V+=_[Ye]*Tt}let z=B+V;if((M&1)!=0||M>13||M<4)throw new X;let ee=(13-M)/2,te=Q.SYMBOL_WIDEST[ee],J=9-te,Se=yr.getRSSvalue(y,te,!0),Ae=yr.getRSSvalue(_,J,!1),jt=Q.EVEN_TOTAL_SUBSET[ee],xr=Q.GSUM[ee],Kt=Se*jt+Ae+xr;return new an(Kt,z)}static isNotA1left(i,o,c){return!(i.getValue()==0&&o&&c)}adjustOddEvenCounts(i){let o=Oe.sum(new Int32Array(this.getOddCounts())),c=Oe.sum(new Int32Array(this.getEvenCounts())),u=!1,l=!1;o>13?l=!0:o<4&&(u=!0);let d=!1,p=!1;c>13?p=!0:c<4&&(d=!0);let v=o+c-i,y=(o&1)==1,_=(c&1)==0;if(v==1)if(y){if(_)throw new X;l=!0}else{if(!_)throw new X;p=!0}else if(v==-1)if(y){if(_)throw new X;u=!0}else{if(!_)throw new X;d=!0}else if(v==0){if(y){if(!_)throw new X;o<c?(u=!0,p=!0):(l=!0,d=!0)}else if(_)throw new X}else throw new X;if(u){if(l)throw new X;Q.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(l&&Q.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(p)throw new X;Q.increment(this.getEvenCounts(),this.getOddRoundingErrors())}p&&Q.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Q.SYMBOL_WIDEST=[7,5,4,3,1],Q.EVEN_TOTAL_SUBSET=[4,20,52,104,204],Q.GSUM=[0,348,1388,2948,3988],Q.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])],Q.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],Q.FINDER_PAT_A=0,Q.FINDER_PAT_B=1,Q.FINDER_PAT_C=2,Q.FINDER_PAT_D=3,Q.FINDER_PAT_E=4,Q.FINDER_PAT_F=5,Q.FINDER_PATTERN_SEQUENCES=[[Q.FINDER_PAT_A,Q.FINDER_PAT_A],[Q.FINDER_PAT_A,Q.FINDER_PAT_B,Q.FINDER_PAT_B],[Q.FINDER_PAT_A,Q.FINDER_PAT_C,Q.FINDER_PAT_B,Q.FINDER_PAT_D],[Q.FINDER_PAT_A,Q.FINDER_PAT_E,Q.FINDER_PAT_B,Q.FINDER_PAT_D,Q.FINDER_PAT_C],[Q.FINDER_PAT_A,Q.FINDER_PAT_E,Q.FINDER_PAT_B,Q.FINDER_PAT_D,Q.FINDER_PAT_D,Q.FINDER_PAT_F],[Q.FINDER_PAT_A,Q.FINDER_PAT_E,Q.FINDER_PAT_B,Q.FINDER_PAT_D,Q.FINDER_PAT_E,Q.FINDER_PAT_F,Q.FINDER_PAT_F],[Q.FINDER_PAT_A,Q.FINDER_PAT_A,Q.FINDER_PAT_B,Q.FINDER_PAT_B,Q.FINDER_PAT_C,Q.FINDER_PAT_C,Q.FINDER_PAT_D,Q.FINDER_PAT_D],[Q.FINDER_PAT_A,Q.FINDER_PAT_A,Q.FINDER_PAT_B,Q.FINDER_PAT_B,Q.FINDER_PAT_C,Q.FINDER_PAT_C,Q.FINDER_PAT_D,Q.FINDER_PAT_E,Q.FINDER_PAT_E],[Q.FINDER_PAT_A,Q.FINDER_PAT_A,Q.FINDER_PAT_B,Q.FINDER_PAT_B,Q.FINDER_PAT_C,Q.FINDER_PAT_C,Q.FINDER_PAT_D,Q.FINDER_PAT_E,Q.FINDER_PAT_F,Q.FINDER_PAT_F],[Q.FINDER_PAT_A,Q.FINDER_PAT_A,Q.FINDER_PAT_B,Q.FINDER_PAT_B,Q.FINDER_PAT_C,Q.FINDER_PAT_D,Q.FINDER_PAT_D,Q.FINDER_PAT_E,Q.FINDER_PAT_E,Q.FINDER_PAT_F,Q.FINDER_PAT_F]],Q.MAX_PAIRS=11;class d1 extends an{constructor(i,o,c){super(i,o),this.count=0,this.finderPattern=c}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class it extends Dt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(i,o,c){const u=this.decodePair(o,!1,i,c);it.addOrTally(this.possibleLeftPairs,u),o.reverse();let l=this.decodePair(o,!0,i,c);it.addOrTally(this.possibleRightPairs,l),o.reverse();for(let d of this.possibleLeftPairs)if(d.getCount()>1){for(let p of this.possibleRightPairs)if(p.getCount()>1&&it.checkChecksum(d,p))return it.constructResult(d,p)}throw new X}static addOrTally(i,o){if(o==null)return;let c=!1;for(let u of i)if(u.getValue()===o.getValue()){u.incrementCount(),c=!0;break}c||i.push(o)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(i,o){let c=4537077*i.getValue()+o.getValue(),u=new String(c).toString(),l=new ne;for(let y=13-u.length;y>0;y--)l.append("0");l.append(u);let d=0;for(let y=0;y<13;y++){let _=l.charAt(y).charCodeAt(0)-48;d+=(y&1)===0?3*_:_}d=10-d%10,d===10&&(d=0),l.append(d.toString());let p=i.getFinderPattern().getResultPoints(),v=o.getFinderPattern().getResultPoints();return new Ft(l.toString(),null,0,[p[0],p[1],v[0],v[1]],pe.RSS_14,new Date().getTime())}static checkChecksum(i,o){let c=(i.getChecksumPortion()+16*o.getChecksumPortion())%79,u=9*i.getFinderPattern().getValue()+o.getFinderPattern().getValue();return u>72&&u--,u>8&&u--,c===u}decodePair(i,o,c,u){try{let l=this.findFinderPattern(i,o),d=this.parseFoundFinderPattern(i,c,o,l),p=u==null?null:u.get(K.NEED_RESULT_POINT_CALLBACK);if(p!=null){let _=(l[0]+l[1])/2;o&&(_=i.getSize()-1-_),p.foundPossibleResultPoint(new fe(_,c))}let v=this.decodeDataCharacter(i,d,!0),y=this.decodeDataCharacter(i,d,!1);return new d1(1597*v.getValue()+y.getValue(),v.getChecksumPortion()+4*y.getChecksumPortion(),d)}catch{return null}}decodeDataCharacter(i,o,c){let u=this.getDataCharacterCounters();for(let V=0;V<u.length;V++)u[V]=0;if(c)ct.recordPatternInReverse(i,o.getStartEnd()[0],u);else{ct.recordPattern(i,o.getStartEnd()[1]+1,u);for(let V=0,z=u.length-1;V<z;V++,z--){let ee=u[V];u[V]=u[z],u[z]=ee}}let l=c?16:15,d=Oe.sum(new Int32Array(u))/l,p=this.getOddCounts(),v=this.getEvenCounts(),y=this.getOddRoundingErrors(),_=this.getEvenRoundingErrors();for(let V=0;V<u.length;V++){let z=u[V]/d,ee=Math.floor(z+.5);ee<1?ee=1:ee>8&&(ee=8);let te=Math.floor(V/2);(V&1)===0?(p[te]=ee,y[te]=z-ee):(v[te]=ee,_[te]=z-ee)}this.adjustOddEvenCounts(c,l);let I=0,S=0;for(let V=p.length-1;V>=0;V--)S*=9,S+=p[V],I+=p[V];let R=0,M=0;for(let V=v.length-1;V>=0;V--)R*=9,R+=v[V],M+=v[V];let B=S+3*R;if(c){if((I&1)!==0||I>12||I<4)throw new X;let V=(12-I)/2,z=it.OUTSIDE_ODD_WIDEST[V],ee=9-z,te=yr.getRSSvalue(p,z,!1),J=yr.getRSSvalue(v,ee,!0),Se=it.OUTSIDE_EVEN_TOTAL_SUBSET[V],Ae=it.OUTSIDE_GSUM[V];return new an(te*Se+J+Ae,B)}else{if((M&1)!==0||M>10||M<4)throw new X;let V=(10-M)/2,z=it.INSIDE_ODD_WIDEST[V],ee=9-z,te=yr.getRSSvalue(p,z,!0),J=yr.getRSSvalue(v,ee,!1),Se=it.INSIDE_ODD_TOTAL_SUBSET[V],Ae=it.INSIDE_GSUM[V];return new an(J*Se+te+Ae,B)}}findFinderPattern(i,o){let c=this.getDecodeFinderCounters();c[0]=0,c[1]=0,c[2]=0,c[3]=0;let u=i.getSize(),l=!1,d=0;for(;d<u&&(l=!i.get(d),o!==l);)d++;let p=0,v=d;for(let y=d;y<u;y++)if(i.get(y)!==l)c[p]++;else{if(p===3){if(Dt.isFinderPattern(c))return[v,y];v+=c[0]+c[1],c[0]=c[2],c[1]=c[3],c[2]=0,c[3]=0,p--}else p++;c[p]=1,l=!l}throw new X}parseFoundFinderPattern(i,o,c,u){let l=i.get(u[0]),d=u[0]-1;for(;d>=0&&l!==i.get(d);)d--;d++;const p=u[0]-d,v=this.getDecodeFinderCounters(),y=new Int32Array(v.length);T.arraycopy(v,0,y,1,v.length-1),y[0]=p;const _=this.parseFinderValue(y,it.FINDER_PATTERNS);let I=d,S=u[1];return c&&(I=i.getSize()-1-I,S=i.getSize()-1-S),new Yn(_,[d,u[1]],I,S,o)}adjustOddEvenCounts(i,o){let c=Oe.sum(new Int32Array(this.getOddCounts())),u=Oe.sum(new Int32Array(this.getEvenCounts())),l=!1,d=!1,p=!1,v=!1;i?(c>12?d=!0:c<4&&(l=!0),u>12?v=!0:u<4&&(p=!0)):(c>11?d=!0:c<5&&(l=!0),u>10?v=!0:u<4&&(p=!0));let y=c+u-o,_=(c&1)===(i?1:0),I=(u&1)===1;if(y===1)if(_){if(I)throw new X;d=!0}else{if(!I)throw new X;v=!0}else if(y===-1)if(_){if(I)throw new X;l=!0}else{if(!I)throw new X;p=!0}else if(y===0){if(_){if(!I)throw new X;c<u?(l=!0,v=!0):(d=!0,p=!0)}else if(I)throw new X}else throw new X;if(l){if(d)throw new X;Dt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&Dt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),p){if(v)throw new X;Dt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}v&&Dt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],it.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],it.OUTSIDE_GSUM=[0,161,961,2015,2715],it.INSIDE_GSUM=[0,336,1036,1516],it.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],it.INSIDE_ODD_WIDEST=[2,4,6,8],it.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 cn extends ct{constructor(i,o){super(),this.readers=[],this.verbose=o===!0;const c=i?i.get(K.POSSIBLE_FORMATS):null,u=i&&i.get(K.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;c?((c.includes(pe.EAN_13)||c.includes(pe.UPC_A)||c.includes(pe.EAN_8)||c.includes(pe.UPC_E))&&this.readers.push(new Ii(i)),c.includes(pe.CODE_39)&&this.readers.push(new ft(u)),c.includes(pe.CODE_128)&&this.readers.push(new ie),c.includes(pe.ITF)&&this.readers.push(new We),c.includes(pe.RSS_14)&&this.readers.push(new it),c.includes(pe.RSS_EXPANDED)&&this.readers.push(new Q(this.verbose))):(this.readers.push(new Ii(i)),this.readers.push(new ft),this.readers.push(new Ii(i)),this.readers.push(new ie),this.readers.push(new We),this.readers.push(new it),this.readers.push(new Q(this.verbose)))}decodeRow(i,o,c){for(let u=0;u<this.readers.length;u++)try{return this.readers[u].decodeRow(i,o,c)}catch{}throw new X}reset(){this.readers.forEach(i=>i.reset())}}class x1 extends Wr{constructor(i=500,o){super(new cn(o),i,o)}}class ke{constructor(i,o,c){this.ecCodewords=i,this.ecBlocks=[o],c&&this.ecBlocks.push(c)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Be{constructor(i,o){this.count=i,this.dataCodewords=o}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class be{constructor(i,o,c,u,l,d){this.versionNumber=i,this.symbolSizeRows=o,this.symbolSizeColumns=c,this.dataRegionSizeRows=u,this.dataRegionSizeColumns=l,this.ecBlocks=d;let p=0;const v=d.getECCodewords(),y=d.getECBlocks();for(let _ of y)p+=_.getCount()*(_.getDataCodewords()+v);this.totalCodewords=p}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(i,o){if((i&1)!==0||(o&1)!==0)throw new U;for(let c of be.VERSIONS)if(c.symbolSizeRows===i&&c.symbolSizeColumns===o)return c;throw new U}toString(){return""+this.versionNumber}static buildVersions(){return[new be(1,10,10,8,8,new ke(5,new Be(1,3))),new be(2,12,12,10,10,new ke(7,new Be(1,5))),new be(3,14,14,12,12,new ke(10,new Be(1,8))),new be(4,16,16,14,14,new ke(12,new Be(1,12))),new be(5,18,18,16,16,new ke(14,new Be(1,18))),new be(6,20,20,18,18,new ke(18,new Be(1,22))),new be(7,22,22,20,20,new ke(20,new Be(1,30))),new be(8,24,24,22,22,new ke(24,new Be(1,36))),new be(9,26,26,24,24,new ke(28,new Be(1,44))),new be(10,32,32,14,14,new ke(36,new Be(1,62))),new be(11,36,36,16,16,new ke(42,new Be(1,86))),new be(12,40,40,18,18,new ke(48,new Be(1,114))),new be(13,44,44,20,20,new ke(56,new Be(1,144))),new be(14,48,48,22,22,new ke(68,new Be(1,174))),new be(15,52,52,24,24,new ke(42,new Be(2,102))),new be(16,64,64,14,14,new ke(56,new Be(2,140))),new be(17,72,72,16,16,new ke(36,new Be(4,92))),new be(18,80,80,18,18,new ke(48,new Be(4,114))),new be(19,88,88,20,20,new ke(56,new Be(4,144))),new be(20,96,96,22,22,new ke(68,new Be(4,174))),new be(21,104,104,24,24,new ke(56,new Be(6,136))),new be(22,120,120,18,18,new ke(68,new Be(6,175))),new be(23,132,132,20,20,new ke(62,new Be(8,163))),new be(24,144,144,22,22,new ke(62,new Be(8,156),new Be(2,155))),new be(25,8,18,6,16,new ke(7,new Be(1,5))),new be(26,8,32,6,14,new ke(11,new Be(1,10))),new be(27,12,26,10,24,new ke(14,new Be(1,16))),new be(28,12,36,10,16,new ke(18,new Be(1,22))),new be(29,16,36,14,16,new ke(24,new Be(1,32))),new be(30,16,48,14,22,new ke(28,new Be(1,49)))]}}be.VERSIONS=be.buildVersions();class Oi{constructor(i){const o=i.getHeight();if(o<8||o>144||(o&1)!==0)throw new U;this.version=Oi.readVersion(i),this.mappingBitMatrix=this.extractDataRegion(i),this.readMappingMatrix=new le(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(i){const o=i.getHeight(),c=i.getWidth();return be.getVersionForDimensions(o,c)}readCodewords(){const i=new Int8Array(this.version.getTotalCodewords());let o=0,c=4,u=0;const l=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let p=!1,v=!1,y=!1,_=!1;do if(c===l&&u===0&&!p)i[o++]=this.readCorner1(l,d)&255,c-=2,u+=2,p=!0;else if(c===l-2&&u===0&&(d&3)!==0&&!v)i[o++]=this.readCorner2(l,d)&255,c-=2,u+=2,v=!0;else if(c===l+4&&u===2&&(d&7)===0&&!y)i[o++]=this.readCorner3(l,d)&255,c-=2,u+=2,y=!0;else if(c===l-2&&u===0&&(d&7)===4&&!_)i[o++]=this.readCorner4(l,d)&255,c-=2,u+=2,_=!0;else{do c<l&&u>=0&&!this.readMappingMatrix.get(u,c)&&(i[o++]=this.readUtah(c,u,l,d)&255),c-=2,u+=2;while(c>=0&&u<d);c+=1,u+=3;do c>=0&&u<d&&!this.readMappingMatrix.get(u,c)&&(i[o++]=this.readUtah(c,u,l,d)&255),c+=2,u-=2;while(c<l&&u>=0);c+=3,u+=1}while(c<l||u<d);if(o!==this.version.getTotalCodewords())throw new U;return i}readModule(i,o,c,u){return i<0&&(i+=c,o+=4-(c+4&7)),o<0&&(o+=u,i+=4-(u+4&7)),this.readMappingMatrix.set(o,i),this.mappingBitMatrix.get(o,i)}readUtah(i,o,c,u){let l=0;return this.readModule(i-2,o-2,c,u)&&(l|=1),l<<=1,this.readModule(i-2,o-1,c,u)&&(l|=1),l<<=1,this.readModule(i-1,o-2,c,u)&&(l|=1),l<<=1,this.readModule(i-1,o-1,c,u)&&(l|=1),l<<=1,this.readModule(i-1,o,c,u)&&(l|=1),l<<=1,this.readModule(i,o-2,c,u)&&(l|=1),l<<=1,this.readModule(i,o-1,c,u)&&(l|=1),l<<=1,this.readModule(i,o,c,u)&&(l|=1),l}readCorner1(i,o){let c=0;return this.readModule(i-1,0,i,o)&&(c|=1),c<<=1,this.readModule(i-1,1,i,o)&&(c|=1),c<<=1,this.readModule(i-1,2,i,o)&&(c|=1),c<<=1,this.readModule(0,o-2,i,o)&&(c|=1),c<<=1,this.readModule(0,o-1,i,o)&&(c|=1),c<<=1,this.readModule(1,o-1,i,o)&&(c|=1),c<<=1,this.readModule(2,o-1,i,o)&&(c|=1),c<<=1,this.readModule(3,o-1,i,o)&&(c|=1),c}readCorner2(i,o){let c=0;return this.readModule(i-3,0,i,o)&&(c|=1),c<<=1,this.readModule(i-2,0,i,o)&&(c|=1),c<<=1,this.readModule(i-1,0,i,o)&&(c|=1),c<<=1,this.readModule(0,o-4,i,o)&&(c|=1),c<<=1,this.readModule(0,o-3,i,o)&&(c|=1),c<<=1,this.readModule(0,o-2,i,o)&&(c|=1),c<<=1,this.readModule(0,o-1,i,o)&&(c|=1),c<<=1,this.readModule(1,o-1,i,o)&&(c|=1),c}readCorner3(i,o){let c=0;return this.readModule(i-1,0,i,o)&&(c|=1),c<<=1,this.readModule(i-1,o-1,i,o)&&(c|=1),c<<=1,this.readModule(0,o-3,i,o)&&(c|=1),c<<=1,this.readModule(0,o-2,i,o)&&(c|=1),c<<=1,this.readModule(0,o-1,i,o)&&(c|=1),c<<=1,this.readModule(1,o-3,i,o)&&(c|=1),c<<=1,this.readModule(1,o-2,i,o)&&(c|=1),c<<=1,this.readModule(1,o-1,i,o)&&(c|=1),c}readCorner4(i,o){let c=0;return this.readModule(i-3,0,i,o)&&(c|=1),c<<=1,this.readModule(i-2,0,i,o)&&(c|=1),c<<=1,this.readModule(i-1,0,i,o)&&(c|=1),c<<=1,this.readModule(0,o-2,i,o)&&(c|=1),c<<=1,this.readModule(0,o-1,i,o)&&(c|=1),c<<=1,this.readModule(1,o-1,i,o)&&(c|=1),c<<=1,this.readModule(2,o-1,i,o)&&(c|=1),c<<=1,this.readModule(3,o-1,i,o)&&(c|=1),c}extractDataRegion(i){const o=this.version.getSymbolSizeRows(),c=this.version.getSymbolSizeColumns();if(i.getHeight()!==o)throw new A("Dimension of bitMatrix must match the version size");const u=this.version.getDataRegionSizeRows(),l=this.version.getDataRegionSizeColumns(),d=o/u|0,p=c/l|0,v=d*u,y=p*l,_=new le(y,v);for(let I=0;I<d;++I){const S=I*u;for(let R=0;R<p;++R){const M=R*l;for(let B=0;B<u;++B){const V=I*(u+2)+1+B,z=S+B;for(let ee=0;ee<l;++ee){const te=R*(l+2)+1+ee;if(i.get(te,V)){const J=M+ee;_.set(J,z)}}}}}return _}}class Ni{constructor(i,o){this.numDataCodewords=i,this.codewords=o}static getDataBlocks(i,o){const c=o.getECBlocks();let u=0;const l=c.getECBlocks();for(let B of l)u+=B.getCount();const d=new Array(u);let p=0;for(let B of l)for(let V=0;V<B.getCount();V++){const z=B.getDataCodewords(),ee=c.getECCodewords()+z;d[p++]=new Ni(z,new Uint8Array(ee))}const y=d[0].codewords.length-c.getECCodewords(),_=y-1;let I=0;for(let B=0;B<_;B++)for(let V=0;V<p;V++)d[V].codewords[B]=i[I++];const S=o.getVersionNumber()===24,R=S?8:p;for(let B=0;B<R;B++)d[B].codewords[y-1]=i[I++];const M=d[0].codewords.length;for(let B=y;B<M;B++)for(let V=0;V<p;V++){const z=S?(V+8)%p:V,ee=S&&z>7?B-1:B;d[z].codewords[ee]=i[I++]}if(I!==i.length)throw new A;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Ri{constructor(i){this.bytes=i,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(i){if(i<1||i>32||i>this.available())throw new A(""+i);let o=0,c=this.bitOffset,u=this.byteOffset;const l=this.bytes;if(c>0){const d=8-c,p=i<d?i:d,v=d-p,y=255>>8-p<<v;o=(l[u]&y)>>v,i-=p,c+=p,c===8&&(c=0,u++)}if(i>0){for(;i>=8;)o=o<<8|l[u]&255,u++,i-=8;if(i>0){const d=8-i,p=255>>d<<d;o=o<<i|(l[u]&p)>>d,c+=i}}return this.bitOffset=c,this.byteOffset=u,o}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var ut;(function(m){m[m.PAD_ENCODE=0]="PAD_ENCODE",m[m.ASCII_ENCODE=1]="ASCII_ENCODE",m[m.C40_ENCODE=2]="C40_ENCODE",m[m.TEXT_ENCODE=3]="TEXT_ENCODE",m[m.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",m[m.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",m[m.BASE256_ENCODE=6]="BASE256_ENCODE"})(ut||(ut={}));class Pr{static decode(i){const o=new Ri(i),c=new ne,u=new ne,l=new Array;let d=ut.ASCII_ENCODE;do if(d===ut.ASCII_ENCODE)d=this.decodeAsciiSegment(o,c,u);else{switch(d){case ut.C40_ENCODE:this.decodeC40Segment(o,c);break;case ut.TEXT_ENCODE:this.decodeTextSegment(o,c);break;case ut.ANSIX12_ENCODE:this.decodeAnsiX12Segment(o,c);break;case ut.EDIFACT_ENCODE:this.decodeEdifactSegment(o,c);break;case ut.BASE256_ENCODE:this.decodeBase256Segment(o,c,l);break;default:throw new U}d=ut.ASCII_ENCODE}while(d!==ut.PAD_ENCODE&&o.available()>0);return u.length()>0&&c.append(u.toString()),new yn(i,c.toString(),l.length===0?null:l,null)}static decodeAsciiSegment(i,o,c){let u=!1;do{let l=i.readBits(8);if(l===0)throw new U;if(l<=128)return u&&(l+=128),o.append(String.fromCharCode(l-1)),ut.ASCII_ENCODE;if(l===129)return ut.PAD_ENCODE;if(l<=229){const d=l-130;d<10&&o.append("0"),o.append(""+d)}else switch(l){case 230:return ut.C40_ENCODE;case 231:return ut.BASE256_ENCODE;case 232:o.append("");break;case 233:case 234:break;case 235:u=!0;break;case 236:o.append("[)>05"),c.insert(0,"");break;case 237:o.append("[)>06"),c.insert(0,"");break;case 238:return ut.ANSIX12_ENCODE;case 239:return ut.TEXT_ENCODE;case 240:return ut.EDIFACT_ENCODE;case 241:break;default:if(l!==254||i.available()!==0)throw new U;break}}while(i.available()>0);return ut.ASCII_ENCODE}static decodeC40Segment(i,o){let c=!1;const u=[];let l=0;do{if(i.available()===8)return;const d=i.readBits(8);if(d===254)return;this.parseTwoBytes(d,i.readBits(8),u);for(let p=0;p<3;p++){const v=u[p];switch(l){case 0:if(v<3)l=v+1;else if(v<this.C40_BASIC_SET_CHARS.length){const y=this.C40_BASIC_SET_CHARS[v];c?(o.append(String.fromCharCode(y.charCodeAt(0)+128)),c=!1):o.append(y)}else throw new U;break;case 1:c?(o.append(String.fromCharCode(v+128)),c=!1):o.append(String.fromCharCode(v)),l=0;break;case 2:if(v<this.C40_SHIFT2_SET_CHARS.length){const y=this.C40_SHIFT2_SET_CHARS[v];c?(o.append(String.fromCharCode(y.charCodeAt(0)+128)),c=!1):o.append(y)}else switch(v){case 27:o.append("");break;case 30:c=!0;break;default:throw new U}l=0;break;case 3:c?(o.append(String.fromCharCode(v+224)),c=!1):o.append(String.fromCharCode(v+96)),l=0;break;default:throw new U}}}while(i.available()>0)}static decodeTextSegment(i,o){let c=!1,u=[],l=0;do{if(i.available()===8)return;const d=i.readBits(8);if(d===254)return;this.parseTwoBytes(d,i.readBits(8),u);for(let p=0;p<3;p++){const v=u[p];switch(l){case 0:if(v<3)l=v+1;else if(v<this.TEXT_BASIC_SET_CHARS.length){const y=this.TEXT_BASIC_SET_CHARS[v];c?(o.append(String.fromCharCode(y.charCodeAt(0)+128)),c=!1):o.append(y)}else throw new U;break;case 1:c?(o.append(String.fromCharCode(v+128)),c=!1):o.append(String.fromCharCode(v)),l=0;break;case 2:if(v<this.TEXT_SHIFT2_SET_CHARS.length){const y=this.TEXT_SHIFT2_SET_CHARS[v];c?(o.append(String.fromCharCode(y.charCodeAt(0)+128)),c=!1):o.append(y)}else switch(v){case 27:o.append("");break;case 30:c=!0;break;default:throw new U}l=0;break;case 3:if(v<this.TEXT_SHIFT3_SET_CHARS.length){const y=this.TEXT_SHIFT3_SET_CHARS[v];c?(o.append(String.fromCharCode(y.charCodeAt(0)+128)),c=!1):o.append(y),l=0}else throw new U;break;default:throw new U}}}while(i.available()>0)}static decodeAnsiX12Segment(i,o){const c=[];do{if(i.available()===8)return;const u=i.readBits(8);if(u===254)return;this.parseTwoBytes(u,i.readBits(8),c);for(let l=0;l<3;l++){const d=c[l];switch(d){case 0:o.append("\r");break;case 1:o.append("*");break;case 2:o.append(">");break;case 3:o.append(" ");break;default:if(d<14)o.append(String.fromCharCode(d+44));else if(d<40)o.append(String.fromCharCode(d+51));else throw new U;break}}}while(i.available()>0)}static parseTwoBytes(i,o,c){let u=(i<<8)+o-1,l=Math.floor(u/1600);c[0]=l,u-=l*1600,l=Math.floor(u/40),c[1]=l,c[2]=u-l*40}static decodeEdifactSegment(i,o){do{if(i.available()<=16)return;for(let c=0;c<4;c++){let u=i.readBits(6);if(u===31){const l=8-i.getBitOffset();l!==8&&i.readBits(l);return}(u&32)===0&&(u|=64),o.append(String.fromCharCode(u))}}while(i.available()>0)}static decodeBase256Segment(i,o,c){let u=1+i.getByteOffset();const l=this.unrandomize255State(i.readBits(8),u++);let d;if(l===0?d=i.available()/8|0:l<250?d=l:d=250*(l-249)+this.unrandomize255State(i.readBits(8),u++),d<0)throw new U;const p=new Uint8Array(d);for(let v=0;v<d;v++){if(i.available()<8)throw new U;p[v]=this.unrandomize255State(i.readBits(8),u++)}c.push(p);try{o.append(_e.decode(p,Z.ISO88591))}catch(v){throw new Ar("Platform does not support required encoding: "+v.message)}}static unrandomize255State(i,o){const c=149*o%255+1,u=i-c;return u>=0?u:u+256}}Pr.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"],Pr.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Pr.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"],Pr.TEXT_SHIFT2_SET_CHARS=Pr.C40_SHIFT2_SET_CHARS,Pr.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","{","|","}","~",""];class g1{constructor(){this.rsDecoder=new Cn(Me.DATA_MATRIX_FIELD_256)}decode(i){const o=new Oi(i),c=o.getVersion(),u=o.readCodewords(),l=Ni.getDataBlocks(u,c);let d=0;for(let y of l)d+=y.getNumDataCodewords();const p=new Uint8Array(d),v=l.length;for(let y=0;y<v;y++){const _=l[y],I=_.getCodewords(),S=_.getNumDataCodewords();this.correctErrors(I,S);for(let R=0;R<S;R++)p[R*v+y]=I[R]}return Pr.decode(p)}correctErrors(i,o){const c=new Int32Array(i);try{this.rsDecoder.decode(c,i.length-o)}catch{throw new C}for(let u=0;u<o;u++)i[u]=c[u]}}class st{constructor(i){this.image=i,this.rectangleDetector=new Tr(this.image)}detect(){const i=this.rectangleDetector.detect();let o=this.detectSolid1(i);if(o=this.detectSolid2(o),o[3]=this.correctTopRight(o),!o[3])throw new X;o=this.shiftToModuleCenter(o);const c=o[0],u=o[1],l=o[2],d=o[3];let p=this.transitionsBetween(c,d)+1,v=this.transitionsBetween(l,d)+1;(p&1)===1&&(p+=1),(v&1)===1&&(v+=1),4*p<7*v&&4*v<7*p&&(p=v=Math.max(p,v));let y=st.sampleGrid(this.image,c,u,l,d,p,v);return new Wn(y,[c,u,l,d])}static shiftPoint(i,o,c){let u=(o.getX()-i.getX())/(c+1),l=(o.getY()-i.getY())/(c+1);return new fe(i.getX()+u,i.getY()+l)}static moveAway(i,o,c){let u=i.getX(),l=i.getY();return u<o?u-=1:u+=1,l<c?l-=1:l+=1,new fe(u,l)}detectSolid1(i){let o=i[0],c=i[1],u=i[3],l=i[2],d=this.transitionsBetween(o,c),p=this.transitionsBetween(c,u),v=this.transitionsBetween(u,l),y=this.transitionsBetween(l,o),_=d,I=[l,o,c,u];return _>p&&(_=p,I[0]=o,I[1]=c,I[2]=u,I[3]=l),_>v&&(_=v,I[0]=c,I[1]=u,I[2]=l,I[3]=o),_>y&&(I[0]=u,I[1]=l,I[2]=o,I[3]=c),I}detectSolid2(i){let o=i[0],c=i[1],u=i[2],l=i[3],d=this.transitionsBetween(o,l),p=st.shiftPoint(c,u,(d+1)*4),v=st.shiftPoint(u,c,(d+1)*4),y=this.transitionsBetween(p,o),_=this.transitionsBetween(v,l);return y<_?(i[0]=o,i[1]=c,i[2]=u,i[3]=l):(i[0]=c,i[1]=u,i[2]=l,i[3]=o),i}correctTopRight(i){let o=i[0],c=i[1],u=i[2],l=i[3],d=this.transitionsBetween(o,l),p=this.transitionsBetween(c,l),v=st.shiftPoint(o,c,(p+1)*4),y=st.shiftPoint(u,c,(d+1)*4);d=this.transitionsBetween(v,l),p=this.transitionsBetween(y,l);let _=new fe(l.getX()+(u.getX()-c.getX())/(d+1),l.getY()+(u.getY()-c.getY())/(d+1)),I=new fe(l.getX()+(o.getX()-c.getX())/(p+1),l.getY()+(o.getY()-c.getY())/(p+1));if(!this.isValid(_))return this.isValid(I)?I:null;if(!this.isValid(I))return _;let S=this.transitionsBetween(v,_)+this.transitionsBetween(y,_),R=this.transitionsBetween(v,I)+this.transitionsBetween(y,I);return S>R?_:I}shiftToModuleCenter(i){let o=i[0],c=i[1],u=i[2],l=i[3],d=this.transitionsBetween(o,l)+1,p=this.transitionsBetween(u,l)+1,v=st.shiftPoint(o,c,p*4),y=st.shiftPoint(u,c,d*4);d=this.transitionsBetween(v,l)+1,p=this.transitionsBetween(y,l)+1,(d&1)===1&&(d+=1),(p&1)===1&&(p+=1);let _=(o.getX()+c.getX()+u.getX()+l.getX())/4,I=(o.getY()+c.getY()+u.getY()+l.getY())/4;o=st.moveAway(o,_,I),c=st.moveAway(c,_,I),u=st.moveAway(u,_,I),l=st.moveAway(l,_,I);let S,R;return v=st.shiftPoint(o,c,p*4),v=st.shiftPoint(v,l,d*4),S=st.shiftPoint(c,o,p*4),S=st.shiftPoint(S,u,d*4),y=st.shiftPoint(u,l,p*4),y=st.shiftPoint(y,c,d*4),R=st.shiftPoint(l,u,p*4),R=st.shiftPoint(R,o,d*4),[v,S,y,R]}isValid(i){return i.getX()>=0&&i.getX()<this.image.getWidth()&&i.getY()>0&&i.getY()<this.image.getHeight()}static sampleGrid(i,o,c,u,l,d,p){return Dr.getInstance().sampleGrid(i,d,p,.5,.5,d-.5,.5,d-.5,p-.5,.5,p-.5,o.getX(),o.getY(),l.getX(),l.getY(),u.getX(),u.getY(),c.getX(),c.getY())}transitionsBetween(i,o){let c=Math.trunc(i.getX()),u=Math.trunc(i.getY()),l=Math.trunc(o.getX()),d=Math.trunc(o.getY()),p=Math.abs(d-u)>Math.abs(l-c);if(p){let B=c;c=u,u=B,B=l,l=d,d=B}let v=Math.abs(l-c),y=Math.abs(d-u),_=-v/2,I=u<d?1:-1,S=c<l?1:-1,R=0,M=this.image.get(p?u:c,p?c:u);for(let B=c,V=u;B!==l;B+=S){let z=this.image.get(p?V:B,p?B:V);if(z!==M&&(R++,M=z),_+=y,_>0){if(V===d)break;V+=I,_-=v}}return R}}class Br{constructor(){this.decoder=new g1}decode(i,o=null){let c,u;if(o!=null&&o.has(K.PURE_BARCODE)){const y=Br.extractPureBits(i.getBlackMatrix());c=this.decoder.decode(y),u=Br.NO_POINTS}else{const y=new st(i.getBlackMatrix()).detect();c=this.decoder.decode(y.getBits()),u=y.getPoints()}const l=c.getRawBytes(),d=new Ft(c.getText(),l,8*l.length,u,pe.DATA_MATRIX,T.currentTimeMillis()),p=c.getByteSegments();p!=null&&d.putMetadata(wt.BYTE_SEGMENTS,p);const v=c.getECLevel();return v!=null&&d.putMetadata(wt.ERROR_CORRECTION_LEVEL,v),d}reset(){}static extractPureBits(i){const o=i.getTopLeftOnBit(),c=i.getBottomRightOnBit();if(o==null||c==null)throw new X;const u=this.moduleSize(o,i);let l=o[1];const d=c[1];let p=o[0];const y=(c[0]-p+1)/u,_=(d-l+1)/u;if(y<=0||_<=0)throw new X;const I=u/2;l+=I,p+=I;const S=new le(y,_);for(let R=0;R<_;R++){const M=l+R*u;for(let B=0;B<y;B++)i.get(p+B*u,M)&&S.set(B,R)}return S}static moduleSize(i,o){const c=o.getWidth();let u=i[0];const l=i[1];for(;u<c&&o.get(u,l);)u++;if(u===c)throw new X;const d=u-i[0];if(d===0)throw new X;return d}}Br.NO_POINTS=[];class p1 extends Wr{constructor(i=500){super(new Br,i)}}var fn;(function(m){m[m.L=0]="L",m[m.M=1]="M",m[m.Q=2]="Q",m[m.H=3]="H"})(fn||(fn={}));class je{constructor(i,o,c){this.value=i,this.stringValue=o,this.bits=c,je.FOR_BITS.set(c,this),je.FOR_VALUE.set(i,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(i){switch(i){case"L":return je.L;case"M":return je.M;case"Q":return je.Q;case"H":return je.H;default:throw new w(i+"not available")}}toString(){return this.stringValue}equals(i){if(!(i instanceof je))return!1;const o=i;return this.value===o.value}static forBits(i){if(i<0||i>=je.FOR_BITS.size)throw new A;return je.FOR_BITS.get(i)}}je.FOR_BITS=new Map,je.FOR_VALUE=new Map,je.L=new je(fn.L,"L",1),je.M=new je(fn.M,"M",0),je.Q=new je(fn.Q,"Q",3),je.H=new je(fn.H,"H",2);class Mt{constructor(i){this.errorCorrectionLevel=je.forBits(i>>3&3),this.dataMask=i&7}static numBitsDiffering(i,o){return L.bitCount(i^o)}static decodeFormatInformation(i,o){const c=Mt.doDecodeFormatInformation(i,o);return c!==null?c:Mt.doDecodeFormatInformation(i^Mt.FORMAT_INFO_MASK_QR,o^Mt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(i,o){let c=Number.MAX_SAFE_INTEGER,u=0;for(const l of Mt.FORMAT_INFO_DECODE_LOOKUP){const d=l[0];if(d===i||d===o)return new Mt(l[1]);let p=Mt.numBitsDiffering(i,d);p<c&&(u=l[1],c=p),i!==o&&(p=Mt.numBitsDiffering(o,d),p<c&&(u=l[1],c=p))}return c<=3?new Mt(u):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(i){if(!(i instanceof Mt))return!1;const o=i;return this.errorCorrectionLevel===o.errorCorrectionLevel&&this.dataMask===o.dataMask}}Mt.FORMAT_INFO_MASK_QR=21522,Mt.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 H{constructor(i,...o){this.ecCodewordsPerBlock=i,this.ecBlocks=o}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let i=0;const o=this.ecBlocks;for(const c of o)i+=c.getCount();return i}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class O{constructor(i,o){this.count=i,this.dataCodewords=o}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class he{constructor(i,o,...c){this.versionNumber=i,this.alignmentPatternCenters=o,this.ecBlocks=c;let u=0;const l=c[0].getECCodewordsPerBlock(),d=c[0].getECBlocks();for(const p of d)u+=p.getCount()*(p.getDataCodewords()+l);this.totalCodewords=u}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(i){return this.ecBlocks[i.getValue()]}static getProvisionalVersionForDimension(i){if(i%4!==1)throw new U;try{return this.getVersionForNumber((i-17)/4)}catch{throw new U}}static getVersionForNumber(i){if(i<1||i>40)throw new A;return he.VERSIONS[i-1]}static decodeVersionInformation(i){let o=Number.MAX_SAFE_INTEGER,c=0;for(let u=0;u<he.VERSION_DECODE_INFO.length;u++){const l=he.VERSION_DECODE_INFO[u];if(l===i)return he.getVersionForNumber(u+7);const d=Mt.numBitsDiffering(i,l);d<o&&(c=u+7,o=d)}return o<=3?he.getVersionForNumber(c):null}buildFunctionPattern(){const i=this.getDimensionForVersion(),o=new le(i);o.setRegion(0,0,9,9),o.setRegion(i-8,0,8,9),o.setRegion(0,i-8,9,8);const c=this.alignmentPatternCenters.length;for(let u=0;u<c;u++){const l=this.alignmentPatternCenters[u]-2;for(let d=0;d<c;d++)u===0&&(d===0||d===c-1)||u===c-1&&d===0||o.setRegion(this.alignmentPatternCenters[d]-2,l,5,5)}return o.setRegion(6,9,1,i-17),o.setRegion(9,6,i-17,1),this.versionNumber>6&&(o.setRegion(i-11,0,3,6),o.setRegion(0,i-11,6,3)),o}toString(){return""+this.versionNumber}}he.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]),he.VERSIONS=[new he(1,new Int32Array(0),new H(7,new O(1,19)),new H(10,new O(1,16)),new H(13,new O(1,13)),new H(17,new O(1,9))),new he(2,Int32Array.from([6,18]),new H(10,new O(1,34)),new H(16,new O(1,28)),new H(22,new O(1,22)),new H(28,new O(1,16))),new he(3,Int32Array.from([6,22]),new H(15,new O(1,55)),new H(26,new O(1,44)),new H(18,new O(2,17)),new H(22,new O(2,13))),new he(4,Int32Array.from([6,26]),new H(20,new O(1,80)),new H(18,new O(2,32)),new H(26,new O(2,24)),new H(16,new O(4,9))),new he(5,Int32Array.from([6,30]),new H(26,new O(1,108)),new H(24,new O(2,43)),new H(18,new O(2,15),new O(2,16)),new H(22,new O(2,11),new O(2,12))),new he(6,Int32Array.from([6,34]),new H(18,new O(2,68)),new H(16,new O(4,27)),new H(24,new O(4,19)),new H(28,new O(4,15))),new he(7,Int32Array.from([6,22,38]),new H(20,new O(2,78)),new H(18,new O(4,31)),new H(18,new O(2,14),new O(4,15)),new H(26,new O(4,13),new O(1,14))),new he(8,Int32Array.from([6,24,42]),new H(24,new O(2,97)),new H(22,new O(2,38),new O(2,39)),new H(22,new O(4,18),new O(2,19)),new H(26,new O(4,14),new O(2,15))),new he(9,Int32Array.from([6,26,46]),new H(30,new O(2,116)),new H(22,new O(3,36),new O(2,37)),new H(20,new O(4,16),new O(4,17)),new H(24,new O(4,12),new O(4,13))),new he(10,Int32Array.from([6,28,50]),new H(18,new O(2,68),new O(2,69)),new H(26,new O(4,43),new O(1,44)),new H(24,new O(6,19),new O(2,20)),new H(28,new O(6,15),new O(2,16))),new he(11,Int32Array.from([6,30,54]),new H(20,new O(4,81)),new H(30,new O(1,50),new O(4,51)),new H(28,new O(4,22),new O(4,23)),new H(24,new O(3,12),new O(8,13))),new he(12,Int32Array.from([6,32,58]),new H(24,new O(2,92),new O(2,93)),new H(22,new O(6,36),new O(2,37)),new H(26,new O(4,20),new O(6,21)),new H(28,new O(7,14),new O(4,15))),new he(13,Int32Array.from([6,34,62]),new H(26,new O(4,107)),new H(22,new O(8,37),new O(1,38)),new H(24,new O(8,20),new O(4,21)),new H(22,new O(12,11),new O(4,12))),new he(14,Int32Array.from([6,26,46,66]),new H(30,new O(3,115),new O(1,116)),new H(24,new O(4,40),new O(5,41)),new H(20,new O(11,16),new O(5,17)),new H(24,new O(11,12),new O(5,13))),new he(15,Int32Array.from([6,26,48,70]),new H(22,new O(5,87),new O(1,88)),new H(24,new O(5,41),new O(5,42)),new H(30,new O(5,24),new O(7,25)),new H(24,new O(11,12),new O(7,13))),new he(16,Int32Array.from([6,26,50,74]),new H(24,new O(5,98),new O(1,99)),new H(28,new O(7,45),new O(3,46)),new H(24,new O(15,19),new O(2,20)),new H(30,new O(3,15),new O(13,16))),new he(17,Int32Array.from([6,30,54,78]),new H(28,new O(1,107),new O(5,108)),new H(28,new O(10,46),new O(1,47)),new H(28,new O(1,22),new O(15,23)),new H(28,new O(2,14),new O(17,15))),new he(18,Int32Array.from([6,30,56,82]),new H(30,new O(5,120),new O(1,121)),new H(26,new O(9,43),new O(4,44)),new H(28,new O(17,22),new O(1,23)),new H(28,new O(2,14),new O(19,15))),new he(19,Int32Array.from([6,30,58,86]),new H(28,new O(3,113),new O(4,114)),new H(26,new O(3,44),new O(11,45)),new H(26,new O(17,21),new O(4,22)),new H(26,new O(9,13),new O(16,14))),new he(20,Int32Array.from([6,34,62,90]),new H(28,new O(3,107),new O(5,108)),new H(26,new O(3,41),new O(13,42)),new H(30,new O(15,24),new O(5,25)),new H(28,new O(15,15),new O(10,16))),new he(21,Int32Array.from([6,28,50,72,94]),new H(28,new O(4,116),new O(4,117)),new H(26,new O(17,42)),new H(28,new O(17,22),new O(6,23)),new H(30,new O(19,16),new O(6,17))),new he(22,Int32Array.from([6,26,50,74,98]),new H(28,new O(2,111),new O(7,112)),new H(28,new O(17,46)),new H(30,new O(7,24),new O(16,25)),new H(24,new O(34,13))),new he(23,Int32Array.from([6,30,54,78,102]),new H(30,new O(4,121),new O(5,122)),new H(28,new O(4,47),new O(14,48)),new H(30,new O(11,24),new O(14,25)),new H(30,new O(16,15),new O(14,16))),new he(24,Int32Array.from([6,28,54,80,106]),new H(30,new O(6,117),new O(4,118)),new H(28,new O(6,45),new O(14,46)),new H(30,new O(11,24),new O(16,25)),new H(30,new O(30,16),new O(2,17))),new he(25,Int32Array.from([6,32,58,84,110]),new H(26,new O(8,106),new O(4,107)),new H(28,new O(8,47),new O(13,48)),new H(30,new O(7,24),new O(22,25)),new H(30,new O(22,15),new O(13,16))),new he(26,Int32Array.from([6,30,58,86,114]),new H(28,new O(10,114),new O(2,115)),new H(28,new O(19,46),new O(4,47)),new H(28,new O(28,22),new O(6,23)),new H(30,new O(33,16),new O(4,17))),new he(27,Int32Array.from([6,34,62,90,118]),new H(30,new O(8,122),new O(4,123)),new H(28,new O(22,45),new O(3,46)),new H(30,new O(8,23),new O(26,24)),new H(30,new O(12,15),new O(28,16))),new he(28,Int32Array.from([6,26,50,74,98,122]),new H(30,new O(3,117),new O(10,118)),new H(28,new O(3,45),new O(23,46)),new H(30,new O(4,24),new O(31,25)),new H(30,new O(11,15),new O(31,16))),new he(29,Int32Array.from([6,30,54,78,102,126]),new H(30,new O(7,116),new O(7,117)),new H(28,new O(21,45),new O(7,46)),new H(30,new O(1,23),new O(37,24)),new H(30,new O(19,15),new O(26,16))),new he(30,Int32Array.from([6,26,52,78,104,130]),new H(30,new O(5,115),new O(10,116)),new H(28,new O(19,47),new O(10,48)),new H(30,new O(15,24),new O(25,25)),new H(30,new O(23,15),new O(25,16))),new he(31,Int32Array.from([6,30,56,82,108,134]),new H(30,new O(13,115),new O(3,116)),new H(28,new O(2,46),new O(29,47)),new H(30,new O(42,24),new O(1,25)),new H(30,new O(23,15),new O(28,16))),new he(32,Int32Array.from([6,34,60,86,112,138]),new H(30,new O(17,115)),new H(28,new O(10,46),new O(23,47)),new H(30,new O(10,24),new O(35,25)),new H(30,new O(19,15),new O(35,16))),new he(33,Int32Array.from([6,30,58,86,114,142]),new H(30,new O(17,115),new O(1,116)),new H(28,new O(14,46),new O(21,47)),new H(30,new O(29,24),new O(19,25)),new H(30,new O(11,15),new O(46,16))),new he(34,Int32Array.from([6,34,62,90,118,146]),new H(30,new O(13,115),new O(6,116)),new H(28,new O(14,46),new O(23,47)),new H(30,new O(44,24),new O(7,25)),new H(30,new O(59,16),new O(1,17))),new he(35,Int32Array.from([6,30,54,78,102,126,150]),new H(30,new O(12,121),new O(7,122)),new H(28,new O(12,47),new O(26,48)),new H(30,new O(39,24),new O(14,25)),new H(30,new O(22,15),new O(41,16))),new he(36,Int32Array.from([6,24,50,76,102,128,154]),new H(30,new O(6,121),new O(14,122)),new H(28,new O(6,47),new O(34,48)),new H(30,new O(46,24),new O(10,25)),new H(30,new O(2,15),new O(64,16))),new he(37,Int32Array.from([6,28,54,80,106,132,158]),new H(30,new O(17,122),new O(4,123)),new H(28,new O(29,46),new O(14,47)),new H(30,new O(49,24),new O(10,25)),new H(30,new O(24,15),new O(46,16))),new he(38,Int32Array.from([6,32,58,84,110,136,162]),new H(30,new O(4,122),new O(18,123)),new H(28,new O(13,46),new O(32,47)),new H(30,new O(48,24),new O(14,25)),new H(30,new O(42,15),new O(32,16))),new he(39,Int32Array.from([6,26,54,82,110,138,166]),new H(30,new O(20,117),new O(4,118)),new H(28,new O(40,47),new O(7,48)),new H(30,new O(43,24),new O(22,25)),new H(30,new O(10,15),new O(67,16))),new he(40,Int32Array.from([6,30,58,86,114,142,170]),new H(30,new O(19,118),new O(6,119)),new H(28,new O(18,47),new O(31,48)),new H(30,new O(34,24),new O(34,25)),new H(30,new O(20,15),new O(61,16)))];var At;(function(m){m[m.DATA_MASK_000=0]="DATA_MASK_000",m[m.DATA_MASK_001=1]="DATA_MASK_001",m[m.DATA_MASK_010=2]="DATA_MASK_010",m[m.DATA_MASK_011=3]="DATA_MASK_011",m[m.DATA_MASK_100=4]="DATA_MASK_100",m[m.DATA_MASK_101=5]="DATA_MASK_101",m[m.DATA_MASK_110=6]="DATA_MASK_110",m[m.DATA_MASK_111=7]="DATA_MASK_111"})(At||(At={}));class ar{constructor(i,o){this.value=i,this.isMasked=o}unmaskBitMatrix(i,o){for(let c=0;c<o;c++)for(let u=0;u<o;u++)this.isMasked(c,u)&&i.flip(u,c)}}ar.values=new Map([[At.DATA_MASK_000,new ar(At.DATA_MASK_000,(m,i)=>(m+i&1)===0)],[At.DATA_MASK_001,new ar(At.DATA_MASK_001,(m,i)=>(m&1)===0)],[At.DATA_MASK_010,new ar(At.DATA_MASK_010,(m,i)=>i%3===0)],[At.DATA_MASK_011,new ar(At.DATA_MASK_011,(m,i)=>(m+i)%3===0)],[At.DATA_MASK_100,new ar(At.DATA_MASK_100,(m,i)=>(Math.floor(m/2)+Math.floor(i/3)&1)===0)],[At.DATA_MASK_101,new ar(At.DATA_MASK_101,(m,i)=>m*i%6===0)],[At.DATA_MASK_110,new ar(At.DATA_MASK_110,(m,i)=>m*i%6<3)],[At.DATA_MASK_111,new ar(At.DATA_MASK_111,(m,i)=>(m+i+m*i%3&1)===0)]]);class v1{constructor(i){const o=i.getHeight();if(o<21||(o&3)!==1)throw new U;this.bitMatrix=i}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let i=0;for(let l=0;l<6;l++)i=this.copyBit(l,8,i);i=this.copyBit(7,8,i),i=this.copyBit(8,8,i),i=this.copyBit(8,7,i);for(let l=5;l>=0;l--)i=this.copyBit(8,l,i);const o=this.bitMatrix.getHeight();let c=0;const u=o-7;for(let l=o-1;l>=u;l--)c=this.copyBit(8,l,c);for(let l=o-8;l<o;l++)c=this.copyBit(l,8,c);if(this.parsedFormatInfo=Mt.decodeFormatInformation(i,c),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new U}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const i=this.bitMatrix.getHeight(),o=Math.floor((i-17)/4);if(o<=6)return he.getVersionForNumber(o);let c=0;const u=i-11;for(let d=5;d>=0;d--)for(let p=i-9;p>=u;p--)c=this.copyBit(p,d,c);let l=he.decodeVersionInformation(c);if(l!==null&&l.getDimensionForVersion()===i)return this.parsedVersion=l,l;c=0;for(let d=5;d>=0;d--)for(let p=i-9;p>=u;p--)c=this.copyBit(d,p,c);if(l=he.decodeVersionInformation(c),l!==null&&l.getDimensionForVersion()===i)return this.parsedVersion=l,l;throw new U}copyBit(i,o,c){return(this.isMirror?this.bitMatrix.get(o,i):this.bitMatrix.get(i,o))?c<<1|1:c<<1}readCodewords(){const i=this.readFormatInformation(),o=this.readVersion(),c=ar.values.get(i.getDataMask()),u=this.bitMatrix.getHeight();c.unmaskBitMatrix(this.bitMatrix,u);const l=o.buildFunctionPattern();let d=!0;const p=new Uint8Array(o.getTotalCodewords());let v=0,y=0,_=0;for(let I=u-1;I>0;I-=2){I===6&&I--;for(let S=0;S<u;S++){const R=d?u-1-S:S;for(let M=0;M<2;M++)l.get(I-M,R)||(_++,y<<=1,this.bitMatrix.get(I-M,R)&&(y|=1),_===8&&(p[v++]=y,_=0,y=0))}d=!d}if(v!==o.getTotalCodewords())throw new U;return p}remask(){if(this.parsedFormatInfo===null)return;const i=ar.values[this.parsedFormatInfo.getDataMask()],o=this.bitMatrix.getHeight();i.unmaskBitMatrix(this.bitMatrix,o)}setMirror(i){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=i}mirror(){const i=this.bitMatrix;for(let o=0,c=i.getWidth();o<c;o++)for(let u=o+1,l=i.getHeight();u<l;u++)i.get(o,u)!==i.get(u,o)&&(i.flip(u,o),i.flip(o,u))}}class Di{constructor(i,o){this.numDataCodewords=i,this.codewords=o}static getDataBlocks(i,o,c){if(i.length!==o.getTotalCodewords())throw new A;const u=o.getECBlocksForLevel(c);let l=0;const d=u.getECBlocks();for(const M of d)l+=M.getCount();const p=new Array(l);let v=0;for(const M of d)for(let B=0;B<M.getCount();B++){const V=M.getDataCodewords(),z=u.getECCodewordsPerBlock()+V;p[v++]=new Di(V,new Uint8Array(z))}const y=p[0].codewords.length;let _=p.length-1;for(;_>=0&&p[_].codewords.length!==y;)_--;_++;const I=y-u.getECCodewordsPerBlock();let S=0;for(let M=0;M<I;M++)for(let B=0;B<v;B++)p[B].codewords[M]=i[S++];for(let M=_;M<v;M++)p[M].codewords[I]=i[S++];const R=p[0].codewords.length;for(let M=I;M<R;M++)for(let B=0;B<v;B++){const V=B<_?M:M+1;p[B].codewords[V]=i[S++]}return p}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var or;(function(m){m[m.TERMINATOR=0]="TERMINATOR",m[m.NUMERIC=1]="NUMERIC",m[m.ALPHANUMERIC=2]="ALPHANUMERIC",m[m.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",m[m.BYTE=4]="BYTE",m[m.ECI=5]="ECI",m[m.KANJI=6]="KANJI",m[m.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",m[m.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",m[m.HANZI=9]="HANZI"})(or||(or={}));class de{constructor(i,o,c,u){this.value=i,this.stringValue=o,this.characterCountBitsForVersions=c,this.bits=u,de.FOR_BITS.set(u,this),de.FOR_VALUE.set(i,this)}static forBits(i){const o=de.FOR_BITS.get(i);if(o===void 0)throw new A;return o}getCharacterCountBits(i){const o=i.getVersionNumber();let c;return o<=9?c=0:o<=26?c=1:c=2,this.characterCountBitsForVersions[c]}getValue(){return this.value}getBits(){return this.bits}equals(i){if(!(i instanceof de))return!1;const o=i;return this.value===o.value}toString(){return this.stringValue}}de.FOR_BITS=new Map,de.FOR_VALUE=new Map,de.TERMINATOR=new de(or.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),de.NUMERIC=new de(or.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),de.ALPHANUMERIC=new de(or.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),de.STRUCTURED_APPEND=new de(or.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),de.BYTE=new de(or.BYTE,"BYTE",Int32Array.from([8,16,16]),4),de.ECI=new de(or.ECI,"ECI",Int32Array.from([0,0,0]),7),de.KANJI=new de(or.KANJI,"KANJI",Int32Array.from([8,10,12]),8),de.FNC1_FIRST_POSITION=new de(or.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),de.FNC1_SECOND_POSITION=new de(or.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),de.HANZI=new de(or.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class rt{static decode(i,o,c,u){const l=new Ri(i);let d=new ne;const p=new Array;let v=-1,y=-1;try{let _=null,I=!1,S;do{if(l.available()<4)S=de.TERMINATOR;else{const R=l.readBits(4);S=de.forBits(R)}switch(S){case de.TERMINATOR:break;case de.FNC1_FIRST_POSITION:case de.FNC1_SECOND_POSITION:I=!0;break;case de.STRUCTURED_APPEND:if(l.available()<16)throw new U;v=l.readBits(8),y=l.readBits(8);break;case de.ECI:const R=rt.parseECIValue(l);if(_=Y.getCharacterSetECIByValue(R),_===null)throw new U;break;case de.HANZI:const M=l.readBits(4),B=l.readBits(S.getCharacterCountBits(o));M===rt.GB2312_SUBSET&&rt.decodeHanziSegment(l,d,B);break;default:const V=l.readBits(S.getCharacterCountBits(o));switch(S){case de.NUMERIC:rt.decodeNumericSegment(l,d,V);break;case de.ALPHANUMERIC:rt.decodeAlphanumericSegment(l,d,V,I);break;case de.BYTE:rt.decodeByteSegment(l,d,V,_,p,u);break;case de.KANJI:rt.decodeKanjiSegment(l,d,V);break;default:throw new U}break}}while(S!==de.TERMINATOR)}catch{throw new U}return new yn(i,d.toString(),p.length===0?null:p,c===null?null:c.toString(),v,y)}static decodeHanziSegment(i,o,c){if(c*13>i.available())throw new U;const u=new Uint8Array(2*c);let l=0;for(;c>0;){const d=i.readBits(13);let p=d/96<<8&4294967295|d%96;p<959?p+=41377:p+=42657,u[l]=p>>8&255,u[l+1]=p&255,l+=2,c--}try{o.append(_e.decode(u,Z.GB2312))}catch(d){throw new U(d)}}static decodeKanjiSegment(i,o,c){if(c*13>i.available())throw new U;const u=new Uint8Array(2*c);let l=0;for(;c>0;){const d=i.readBits(13);let p=d/192<<8&4294967295|d%192;p<7936?p+=33088:p+=49472,u[l]=p>>8,u[l+1]=p,l+=2,c--}try{o.append(_e.decode(u,Z.SHIFT_JIS))}catch(d){throw new U(d)}}static decodeByteSegment(i,o,c,u,l,d){if(8*c>i.available())throw new U;const p=new Uint8Array(c);for(let y=0;y<c;y++)p[y]=i.readBits(8);let v;u===null?v=Z.guessEncoding(p,d):v=u.getName();try{o.append(_e.decode(p,v))}catch(y){throw new U(y)}l.push(p)}static toAlphaNumericChar(i){if(i>=rt.ALPHANUMERIC_CHARS.length)throw new U;return rt.ALPHANUMERIC_CHARS[i]}static decodeAlphanumericSegment(i,o,c,u){const l=o.length();for(;c>1;){if(i.available()<11)throw new U;const d=i.readBits(11);o.append(rt.toAlphaNumericChar(Math.floor(d/45))),o.append(rt.toAlphaNumericChar(d%45)),c-=2}if(c===1){if(i.available()<6)throw new U;o.append(rt.toAlphaNumericChar(i.readBits(6)))}if(u)for(let d=l;d<o.length();d++)o.charAt(d)==="%"&&(d<o.length()-1&&o.charAt(d+1)==="%"?o.deleteCharAt(d+1):o.setCharAt(d,""))}static decodeNumericSegment(i,o,c){for(;c>=3;){if(i.available()<10)throw new U;const u=i.readBits(10);if(u>=1e3)throw new U;o.append(rt.toAlphaNumericChar(Math.floor(u/100))),o.append(rt.toAlphaNumericChar(Math.floor(u/10)%10)),o.append(rt.toAlphaNumericChar(u%10)),c-=3}if(c===2){if(i.available()<7)throw new U;const u=i.readBits(7);if(u>=100)throw new U;o.append(rt.toAlphaNumericChar(Math.floor(u/10))),o.append(rt.toAlphaNumericChar(u%10))}else if(c===1){if(i.available()<4)throw new U;const u=i.readBits(4);if(u>=10)throw new U;o.append(rt.toAlphaNumericChar(u))}}static parseECIValue(i){const o=i.readBits(8);if((o&128)===0)return o&127;if((o&192)===128){const c=i.readBits(8);return(o&63)<<8&4294967295|c}if((o&224)===192){const c=i.readBits(16);return(o&31)<<16&4294967295|c}throw new U}}rt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",rt.GB2312_SUBSET=1;class Pa{constructor(i){this.mirrored=i}isMirrored(){return this.mirrored}applyMirroredCorrection(i){if(!this.mirrored||i===null||i.length<3)return;const o=i[0];i[0]=i[2],i[2]=o}}class w1{constructor(){this.rsDecoder=new Cn(Me.QR_CODE_FIELD_256)}decodeBooleanArray(i,o){return this.decodeBitMatrix(le.parseFromBooleanArray(i),o)}decodeBitMatrix(i,o){const c=new v1(i);let u=null;try{return this.decodeBitMatrixParser(c,o)}catch(l){u=l}try{c.remask(),c.setMirror(!0),c.readVersion(),c.readFormatInformation(),c.mirror();const l=this.decodeBitMatrixParser(c,o);return l.setOther(new Pa(!0)),l}catch(l){throw u!==null?u:l}}decodeBitMatrixParser(i,o){const c=i.readVersion(),u=i.readFormatInformation().getErrorCorrectionLevel(),l=i.readCodewords(),d=Di.getDataBlocks(l,c,u);let p=0;for(const _ of d)p+=_.getNumDataCodewords();const v=new Uint8Array(p);let y=0;for(const _ of d){const I=_.getCodewords(),S=_.getNumDataCodewords();this.correctErrors(I,S);for(let R=0;R<S;R++)v[y++]=I[R]}return rt.decode(v,c,u,o)}correctErrors(i,o){const c=new Int32Array(i);try{this.rsDecoder.decode(c,i.length-o)}catch{throw new C}for(let u=0;u<o;u++)i[u]=c[u]}}class Mi extends fe{constructor(i,o,c){super(i,o),this.estimatedModuleSize=c}aboutEquals(i,o,c){if(Math.abs(o-this.getY())<=i&&Math.abs(c-this.getX())<=i){const u=Math.abs(i-this.estimatedModuleSize);return u<=1||u<=this.estimatedModuleSize}return!1}combineEstimate(i,o,c){const u=(this.getX()+o)/2,l=(this.getY()+i)/2,d=(this.estimatedModuleSize+c)/2;return new Mi(u,l,d)}}class Kn{constructor(i,o,c,u,l,d,p){this.image=i,this.startX=o,this.startY=c,this.width=u,this.height=l,this.moduleSize=d,this.resultPointCallback=p,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const i=this.startX,o=this.height,c=this.width,u=i+c,l=this.startY+o/2,d=new Int32Array(3),p=this.image;for(let v=0;v<o;v++){const y=l+((v&1)===0?Math.floor((v+1)/2):-Math.floor((v+1)/2));d[0]=0,d[1]=0,d[2]=0;let _=i;for(;_<u&&!p.get(_,y);)_++;let I=0;for(;_<u;){if(p.get(_,y))if(I===1)d[1]++;else if(I===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,y,_);if(S!==null)return S}d[0]=d[2],d[1]=1,d[2]=0,I=1}else d[++I]++;else I===1&&I++,d[I]++;_++}if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,y,u);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new X}static centerFromEnd(i,o){return o-i[2]-i[1]/2}foundPatternCross(i){const o=this.moduleSize,c=o/2;for(let u=0;u<3;u++)if(Math.abs(o-i[u])>=c)return!1;return!0}crossCheckVertical(i,o,c,u){const l=this.image,d=l.getHeight(),p=this.crossCheckStateCount;p[0]=0,p[1]=0,p[2]=0;let v=i;for(;v>=0&&l.get(o,v)&&p[1]<=c;)p[1]++,v--;if(v<0||p[1]>c)return NaN;for(;v>=0&&!l.get(o,v)&&p[0]<=c;)p[0]++,v--;if(p[0]>c)return NaN;for(v=i+1;v<d&&l.get(o,v)&&p[1]<=c;)p[1]++,v++;if(v===d||p[1]>c)return NaN;for(;v<d&&!l.get(o,v)&&p[2]<=c;)p[2]++,v++;if(p[2]>c)return NaN;const y=p[0]+p[1]+p[2];return 5*Math.abs(y-u)>=2*u?NaN:this.foundPatternCross(p)?Kn.centerFromEnd(p,v):NaN}handlePossibleCenter(i,o,c){const u=i[0]+i[1]+i[2],l=Kn.centerFromEnd(i,c),d=this.crossCheckVertical(o,l,2*i[1],u);if(!isNaN(d)){const p=(i[0]+i[1]+i[2])/3;for(const y of this.possibleCenters)if(y.aboutEquals(p,d,l))return y.combineEstimate(d,l,p);const v=new Mi(l,d,p);this.possibleCenters.push(v),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(v)}return null}}class Pi extends fe{constructor(i,o,c,u){super(i,o),this.estimatedModuleSize=c,this.count=u,u===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(i,o,c){if(Math.abs(o-this.getY())<=i&&Math.abs(c-this.getX())<=i){const u=Math.abs(i-this.estimatedModuleSize);return u<=1||u<=this.estimatedModuleSize}return!1}combineEstimate(i,o,c){const u=this.count+1,l=(this.count*this.getX()+o)/u,d=(this.count*this.getY()+i)/u,p=(this.count*this.estimatedModuleSize+c)/u;return new Pi(l,d,p,u)}}class A1{constructor(i){this.bottomLeft=i[0],this.topLeft=i[1],this.topRight=i[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class yt{constructor(i,o){this.image=i,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=o}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(i){const o=i!=null&&i.get(K.TRY_HARDER)!==void 0,c=i!=null&&i.get(K.PURE_BARCODE)!==void 0,u=this.image,l=u.getHeight(),d=u.getWidth();let p=Math.floor(3*l/(4*yt.MAX_MODULES));(p<yt.MIN_SKIP||o)&&(p=yt.MIN_SKIP);let v=!1;const y=new Int32Array(5);for(let I=p-1;I<l&&!v;I+=p){y[0]=0,y[1]=0,y[2]=0,y[3]=0,y[4]=0;let S=0;for(let R=0;R<d;R++)if(u.get(R,I))(S&1)===1&&S++,y[S]++;else if((S&1)===0)if(S===4)if(yt.foundPatternCross(y)){if(this.handlePossibleCenter(y,I,R,c)===!0)if(p=2,this.hasSkipped===!0)v=this.haveMultiplyConfirmedCenters();else{const B=this.findRowSkip();B>y[2]&&(I+=B-y[2]-p,R=d-1)}else{y[0]=y[2],y[1]=y[3],y[2]=y[4],y[3]=1,y[4]=0,S=3;continue}S=0,y[0]=0,y[1]=0,y[2]=0,y[3]=0,y[4]=0}else y[0]=y[2],y[1]=y[3],y[2]=y[4],y[3]=1,y[4]=0,S=3;else y[++S]++;else y[S]++;yt.foundPatternCross(y)&&this.handlePossibleCenter(y,I,d,c)===!0&&(p=y[0],this.hasSkipped&&(v=this.haveMultiplyConfirmedCenters()))}const _=this.selectBestPatterns();return fe.orderBestPatterns(_),new A1(_)}static centerFromEnd(i,o){return o-i[4]-i[3]-i[2]/2}static foundPatternCross(i){let o=0;for(let l=0;l<5;l++){const d=i[l];if(d===0)return!1;o+=d}if(o<7)return!1;const c=o/7,u=c/2;return Math.abs(c-i[0])<u&&Math.abs(c-i[1])<u&&Math.abs(3*c-i[2])<3*u&&Math.abs(c-i[3])<u&&Math.abs(c-i[4])<u}getCrossCheckStateCount(){const i=this.crossCheckStateCount;return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i}crossCheckDiagonal(i,o,c,u){const l=this.getCrossCheckStateCount();let d=0;const p=this.image;for(;i>=d&&o>=d&&p.get(o-d,i-d);)l[2]++,d++;if(i<d||o<d)return!1;for(;i>=d&&o>=d&&!p.get(o-d,i-d)&&l[1]<=c;)l[1]++,d++;if(i<d||o<d||l[1]>c)return!1;for(;i>=d&&o>=d&&p.get(o-d,i-d)&&l[0]<=c;)l[0]++,d++;if(l[0]>c)return!1;const v=p.getHeight(),y=p.getWidth();for(d=1;i+d<v&&o+d<y&&p.get(o+d,i+d);)l[2]++,d++;if(i+d>=v||o+d>=y)return!1;for(;i+d<v&&o+d<y&&!p.get(o+d,i+d)&&l[3]<c;)l[3]++,d++;if(i+d>=v||o+d>=y||l[3]>=c)return!1;for(;i+d<v&&o+d<y&&p.get(o+d,i+d)&&l[4]<c;)l[4]++,d++;if(l[4]>=c)return!1;const _=l[0]+l[1]+l[2]+l[3]+l[4];return Math.abs(_-u)<2*u&&yt.foundPatternCross(l)}crossCheckVertical(i,o,c,u){const l=this.image,d=l.getHeight(),p=this.getCrossCheckStateCount();let v=i;for(;v>=0&&l.get(o,v);)p[2]++,v--;if(v<0)return NaN;for(;v>=0&&!l.get(o,v)&&p[1]<=c;)p[1]++,v--;if(v<0||p[1]>c)return NaN;for(;v>=0&&l.get(o,v)&&p[0]<=c;)p[0]++,v--;if(p[0]>c)return NaN;for(v=i+1;v<d&&l.get(o,v);)p[2]++,v++;if(v===d)return NaN;for(;v<d&&!l.get(o,v)&&p[3]<c;)p[3]++,v++;if(v===d||p[3]>=c)return NaN;for(;v<d&&l.get(o,v)&&p[4]<c;)p[4]++,v++;if(p[4]>=c)return NaN;const y=p[0]+p[1]+p[2]+p[3]+p[4];return 5*Math.abs(y-u)>=2*u?NaN:yt.foundPatternCross(p)?yt.centerFromEnd(p,v):NaN}crossCheckHorizontal(i,o,c,u){const l=this.image,d=l.getWidth(),p=this.getCrossCheckStateCount();let v=i;for(;v>=0&&l.get(v,o);)p[2]++,v--;if(v<0)return NaN;for(;v>=0&&!l.get(v,o)&&p[1]<=c;)p[1]++,v--;if(v<0||p[1]>c)return NaN;for(;v>=0&&l.get(v,o)&&p[0]<=c;)p[0]++,v--;if(p[0]>c)return NaN;for(v=i+1;v<d&&l.get(v,o);)p[2]++,v++;if(v===d)return NaN;for(;v<d&&!l.get(v,o)&&p[3]<c;)p[3]++,v++;if(v===d||p[3]>=c)return NaN;for(;v<d&&l.get(v,o)&&p[4]<c;)p[4]++,v++;if(p[4]>=c)return NaN;const y=p[0]+p[1]+p[2]+p[3]+p[4];return 5*Math.abs(y-u)>=u?NaN:yt.foundPatternCross(p)?yt.centerFromEnd(p,v):NaN}handlePossibleCenter(i,o,c,u){const l=i[0]+i[1]+i[2]+i[3]+i[4];let d=yt.centerFromEnd(i,c),p=this.crossCheckVertical(o,Math.floor(d),i[2],l);if(!isNaN(p)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(p),i[2],l),!isNaN(d)&&(!u||this.crossCheckDiagonal(Math.floor(p),Math.floor(d),i[2],l)))){const v=l/7;let y=!1;const _=this.possibleCenters;for(let I=0,S=_.length;I<S;I++){const R=_[I];if(R.aboutEquals(v,p,d)){_[I]=R.combineEstimate(p,d,v),y=!0;break}}if(!y){const I=new Pi(d,p,v);_.push(I),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(I)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let o=null;for(const c of this.possibleCenters)if(c.getCount()>=yt.CENTER_QUORUM)if(o==null)o=c;else return this.hasSkipped=!0,Math.floor((Math.abs(o.getX()-c.getX())-Math.abs(o.getY()-c.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let i=0,o=0;const c=this.possibleCenters.length;for(const d of this.possibleCenters)d.getCount()>=yt.CENTER_QUORUM&&(i++,o+=d.getEstimatedModuleSize());if(i<3)return!1;const u=o/c;let l=0;for(const d of this.possibleCenters)l+=Math.abs(d.getEstimatedModuleSize()-u);return l<=.05*o}selectBestPatterns(){const i=this.possibleCenters.length;if(i<3)throw new X;const o=this.possibleCenters;let c;if(i>3){let u=0,l=0;for(const v of this.possibleCenters){const y=v.getEstimatedModuleSize();u+=y,l+=y*y}c=u/i;let d=Math.sqrt(l/i-c*c);o.sort((v,y)=>{const _=Math.abs(y.getEstimatedModuleSize()-c),I=Math.abs(v.getEstimatedModuleSize()-c);return _<I?-1:_>I?1:0});const p=Math.max(.2*c,d);for(let v=0;v<o.length&&o.length>3;v++){const y=o[v];Math.abs(y.getEstimatedModuleSize()-c)>p&&(o.splice(v,1),v--)}}if(o.length>3){let u=0;for(const l of o)u+=l.getEstimatedModuleSize();c=u/o.length,o.sort((l,d)=>{if(d.getCount()===l.getCount()){const p=Math.abs(d.getEstimatedModuleSize()-c),v=Math.abs(l.getEstimatedModuleSize()-c);return p<v?1:p>v?-1:0}else return d.getCount()-l.getCount()}),o.splice(3)}return[o[0],o[1],o[2]]}}yt.CENTER_QUORUM=2,yt.MIN_SKIP=3,yt.MAX_MODULES=57;class mn{constructor(i){this.image=i}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(i){this.resultPointCallback=i==null?null:i.get(K.NEED_RESULT_POINT_CALLBACK);const c=new yt(this.image,this.resultPointCallback).find(i);return this.processFinderPatternInfo(c)}processFinderPatternInfo(i){const o=i.getTopLeft(),c=i.getTopRight(),u=i.getBottomLeft(),l=this.calculateModuleSize(o,c,u);if(l<1)throw new X("No pattern found in proccess finder.");const d=mn.computeDimension(o,c,u,l),p=he.getProvisionalVersionForDimension(d),v=p.getDimensionForVersion()-7;let y=null;if(p.getAlignmentPatternCenters().length>0){const R=c.getX()-o.getX()+u.getX(),M=c.getY()-o.getY()+u.getY(),B=1-3/v,V=Math.floor(o.getX()+B*(R-o.getX())),z=Math.floor(o.getY()+B*(M-o.getY()));for(let ee=4;ee<=16;ee<<=1)try{y=this.findAlignmentInRegion(l,V,z,ee);break}catch(te){if(!(te instanceof X))throw te}}const _=mn.createTransform(o,c,u,y,d),I=mn.sampleGrid(this.image,_,d);let S;return y===null?S=[u,o,c]:S=[u,o,c,y],new Wn(I,S)}static createTransform(i,o,c,u,l){const d=l-3.5;let p,v,y,_;return u!==null?(p=u.getX(),v=u.getY(),y=d-3,_=y):(p=o.getX()-i.getX()+c.getX(),v=o.getY()-i.getY()+c.getY(),y=d,_=d),hr.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,y,_,3.5,d,i.getX(),i.getY(),o.getX(),o.getY(),p,v,c.getX(),c.getY())}static sampleGrid(i,o,c){return Dr.getInstance().sampleGridWithTransform(i,c,c,o)}static computeDimension(i,o,c,u){const l=Oe.round(fe.distance(i,o)/u),d=Oe.round(fe.distance(i,c)/u);let p=Math.floor((l+d)/2)+7;switch(p&3){case 0:p++;break;case 2:p--;break;case 3:throw new X("Dimensions could be not found.")}return p}calculateModuleSize(i,o,c){return(this.calculateModuleSizeOneWay(i,o)+this.calculateModuleSizeOneWay(i,c))/2}calculateModuleSizeOneWay(i,o){const c=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(i.getX()),Math.floor(i.getY()),Math.floor(o.getX()),Math.floor(o.getY())),u=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(o.getX()),Math.floor(o.getY()),Math.floor(i.getX()),Math.floor(i.getY()));return isNaN(c)?u/7:isNaN(u)?c/7:(c+u)/14}sizeOfBlackWhiteBlackRunBothWays(i,o,c,u){let l=this.sizeOfBlackWhiteBlackRun(i,o,c,u),d=1,p=i-(c-i);p<0?(d=i/(i-p),p=0):p>=this.image.getWidth()&&(d=(this.image.getWidth()-1-i)/(p-i),p=this.image.getWidth()-1);let v=Math.floor(o-(u-o)*d);return d=1,v<0?(d=o/(o-v),v=0):v>=this.image.getHeight()&&(d=(this.image.getHeight()-1-o)/(v-o),v=this.image.getHeight()-1),p=Math.floor(i+(p-i)*d),l+=this.sizeOfBlackWhiteBlackRun(i,o,p,v),l-1}sizeOfBlackWhiteBlackRun(i,o,c,u){const l=Math.abs(u-o)>Math.abs(c-i);if(l){let R=i;i=o,o=R,R=c,c=u,u=R}const d=Math.abs(c-i),p=Math.abs(u-o);let v=-d/2;const y=i<c?1:-1,_=o<u?1:-1;let I=0;const S=c+y;for(let R=i,M=o;R!==S;R+=y){const B=l?M:R,V=l?R:M;if(I===1===this.image.get(B,V)){if(I===2)return Oe.distance(R,M,i,o);I++}if(v+=p,v>0){if(M===u)break;M+=_,v-=d}}return I===2?Oe.distance(c+y,u,i,o):NaN}findAlignmentInRegion(i,o,c,u){const l=Math.floor(u*i),d=Math.max(0,o-l),p=Math.min(this.image.getWidth()-1,o+l);if(p-d<i*3)throw new X("Alignment top exceeds estimated module size.");const v=Math.max(0,c-l),y=Math.min(this.image.getHeight()-1,c+l);if(y-v<i*3)throw new X("Alignment bottom exceeds estimated module size.");return new Kn(this.image,d,v,p-d,y-v,i,this.resultPointCallback).find()}}class Lr{constructor(){this.decoder=new w1}getDecoder(){return this.decoder}decode(i,o){let c,u;if(o!=null&&o.get(K.PURE_BARCODE)!==void 0){const v=Lr.extractPureBits(i.getBlackMatrix());c=this.decoder.decodeBitMatrix(v,o),u=Lr.NO_POINTS}else{const v=new mn(i.getBlackMatrix()).detect(o);c=this.decoder.decodeBitMatrix(v.getBits(),o),u=v.getPoints()}c.getOther()instanceof Pa&&c.getOther().applyMirroredCorrection(u);const l=new Ft(c.getText(),c.getRawBytes(),void 0,u,pe.QR_CODE,void 0),d=c.getByteSegments();d!==null&&l.putMetadata(wt.BYTE_SEGMENTS,d);const p=c.getECLevel();return p!==null&&l.putMetadata(wt.ERROR_CORRECTION_LEVEL,p),c.hasStructuredAppend()&&(l.putMetadata(wt.STRUCTURED_APPEND_SEQUENCE,c.getStructuredAppendSequenceNumber()),l.putMetadata(wt.STRUCTURED_APPEND_PARITY,c.getStructuredAppendParity())),l}reset(){}static extractPureBits(i){const o=i.getTopLeftOnBit(),c=i.getBottomRightOnBit();if(o===null||c===null)throw new X;const u=this.moduleSize(o,i);let l=o[1],d=c[1],p=o[0],v=c[0];if(p>=v||l>=d)throw new X;if(d-l!==v-p&&(v=p+(d-l),v>=i.getWidth()))throw new X;const y=Math.round((v-p+1)/u),_=Math.round((d-l+1)/u);if(y<=0||_<=0)throw new X;if(_!==y)throw new X;const I=Math.floor(u/2);l+=I,p+=I;const S=p+Math.floor((y-1)*u)-v;if(S>0){if(S>I)throw new X;p-=S}const R=l+Math.floor((_-1)*u)-d;if(R>0){if(R>I)throw new X;l-=R}const M=new le(y,_);for(let B=0;B<_;B++){const V=l+Math.floor(B*u);for(let z=0;z<y;z++)i.get(p+Math.floor(z*u),V)&&M.set(z,B)}return M}static moduleSize(i,o){const c=o.getHeight(),u=o.getWidth();let l=i[0],d=i[1],p=!0,v=0;for(;l<u&&d<c;){if(p!==o.get(l,d)){if(++v===5)break;p=!p}l++,d++}if(l===u||d===c)throw new X;return(l-i[0])/7}}Lr.NO_POINTS=new Array;class we{PDF417Common(){}static getBitCountSum(i){return Oe.sum(i)}static toIntArray(i){if(i==null||!i.length)return we.EMPTY_INT_ARRAY;const o=new Int32Array(i.length);let c=0;for(const u of i)o[c++]=u;return o}static getCodeword(i){const o=D.binarySearch(we.SYMBOL_TABLE,i&262143);return o<0?-1:(we.CODEWORD_TABLE[o]-1)%we.NUMBER_OF_CODEWORDS}}we.NUMBER_OF_CODEWORDS=929,we.MAX_CODEWORDS_IN_BARCODE=we.NUMBER_OF_CODEWORDS-1,we.MIN_ROWS_IN_BARCODE=3,we.MAX_ROWS_IN_BARCODE=90,we.MODULES_IN_CODEWORD=17,we.MODULES_IN_STOP_PATTERN=18,we.BARS_IN_MODULE=8,we.EMPTY_INT_ARRAY=new Int32Array([]),we.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]),we.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class y1{constructor(i,o){this.bits=i,this.points=o}getBits(){return this.bits}getPoints(){return this.points}}class ye{static detectMultiple(i,o,c){let u=i.getBlackMatrix(),l=ye.detect(c,u);return l.length||(u=u.clone(),u.rotate180(),l=ye.detect(c,u)),new y1(u,l)}static detect(i,o){const c=new Array;let u=0,l=0,d=!1;for(;u<o.getHeight();){const p=ye.findVertices(o,u,l);if(p[0]==null&&p[3]==null){if(!d)break;d=!1,l=0;for(const v of c)v[1]!=null&&(u=Math.trunc(Math.max(u,v[1].getY()))),v[3]!=null&&(u=Math.max(u,Math.trunc(v[3].getY())));u+=ye.ROW_STEP;continue}if(d=!0,c.push(p),!i)break;p[2]!=null?(l=Math.trunc(p[2].getX()),u=Math.trunc(p[2].getY())):(l=Math.trunc(p[4].getX()),u=Math.trunc(p[4].getY()))}return c}static findVertices(i,o,c){const u=i.getHeight(),l=i.getWidth(),d=new Array(8);return ye.copyToResult(d,ye.findRowsWithPattern(i,u,l,o,c,ye.START_PATTERN),ye.INDEXES_START_PATTERN),d[4]!=null&&(c=Math.trunc(d[4].getX()),o=Math.trunc(d[4].getY())),ye.copyToResult(d,ye.findRowsWithPattern(i,u,l,o,c,ye.STOP_PATTERN),ye.INDEXES_STOP_PATTERN),d}static copyToResult(i,o,c){for(let u=0;u<c.length;u++)i[c[u]]=o[u]}static findRowsWithPattern(i,o,c,u,l,d){const p=new Array(4);let v=!1;const y=new Int32Array(d.length);for(;u<o;u+=ye.ROW_STEP){let I=ye.findGuardPattern(i,l,u,c,!1,d,y);if(I!=null){for(;u>0;){const S=ye.findGuardPattern(i,l,--u,c,!1,d,y);if(S!=null)I=S;else{u++;break}}p[0]=new fe(I[0],u),p[1]=new fe(I[1],u),v=!0;break}}let _=u+1;if(v){let I=0,S=Int32Array.from([Math.trunc(p[0].getX()),Math.trunc(p[1].getX())]);for(;_<o;_++){const R=ye.findGuardPattern(i,S[0],_,c,!1,d,y);if(R!=null&&Math.abs(S[0]-R[0])<ye.MAX_PATTERN_DRIFT&&Math.abs(S[1]-R[1])<ye.MAX_PATTERN_DRIFT)S=R,I=0;else{if(I>ye.SKIPPED_ROW_COUNT_MAX)break;I++}}_-=I+1,p[2]=new fe(S[0],_),p[3]=new fe(S[1],_)}return _-u<ye.BARCODE_MIN_HEIGHT&&D.fill(p,null),p}static findGuardPattern(i,o,c,u,l,d,p){D.fillWithin(p,0,p.length,0);let v=o,y=0;for(;i.get(v,c)&&v>0&&y++<ye.MAX_PIXEL_DRIFT;)v--;let _=v,I=0,S=d.length;for(let R=l;_<u;_++)if(i.get(_,c)!==R)p[I]++;else{if(I===S-1){if(ye.patternMatchVariance(p,d,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE)return new Int32Array([v,_]);v+=p[0]+p[1],T.arraycopy(p,2,p,0,I-1),p[I-1]=0,p[I]=0,I--}else I++;p[I]=1,R=!R}return I===S-1&&ye.patternMatchVariance(p,d,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE?new Int32Array([v,_-1]):null}static patternMatchVariance(i,o,c){let u=i.length,l=0,d=0;for(let y=0;y<u;y++)l+=i[y],d+=o[y];if(l<d)return 1/0;let p=l/d;c*=p;let v=0;for(let y=0;y<u;y++){let _=i[y],I=o[y]*p,S=_>I?_-I:I-_;if(S>c)return 1/0;v+=S}return v/l}}ye.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ye.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ye.MAX_AVG_VARIANCE=.42,ye.MAX_INDIVIDUAL_VARIANCE=.8,ye.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ye.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ye.MAX_PIXEL_DRIFT=3,ye.MAX_PATTERN_DRIFT=5,ye.SKIPPED_ROW_COUNT_MAX=25,ye.ROW_STEP=5,ye.BARCODE_MIN_HEIGHT=10;class St{constructor(i,o){if(o.length===0)throw new A;this.field=i;let c=o.length;if(c>1&&o[0]===0){let u=1;for(;u<c&&o[u]===0;)u++;u===c?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(c-u),T.arraycopy(o,u,this.coefficients,0,this.coefficients.length))}else this.coefficients=o}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(i){return this.coefficients[this.coefficients.length-1-i]}evaluateAt(i){if(i===0)return this.getCoefficient(0);if(i===1){let u=0;for(let l of this.coefficients)u=this.field.add(u,l);return u}let o=this.coefficients[0],c=this.coefficients.length;for(let u=1;u<c;u++)o=this.field.add(this.field.multiply(i,o),this.coefficients[u]);return o}add(i){if(!this.field.equals(i.field))throw new A("ModulusPolys do not have same ModulusGF field");if(this.isZero())return i;if(i.isZero())return this;let o=this.coefficients,c=i.coefficients;if(o.length>c.length){let d=o;o=c,c=d}let u=new Int32Array(c.length),l=c.length-o.length;T.arraycopy(c,0,u,0,l);for(let d=l;d<c.length;d++)u[d]=this.field.add(o[d-l],c[d]);return new St(this.field,u)}subtract(i){if(!this.field.equals(i.field))throw new A("ModulusPolys do not have same ModulusGF field");return i.isZero()?this:this.add(i.negative())}multiply(i){return i instanceof St?this.multiplyOther(i):this.multiplyScalar(i)}multiplyOther(i){if(!this.field.equals(i.field))throw new A("ModulusPolys do not have same ModulusGF field");if(this.isZero()||i.isZero())return new St(this.field,new Int32Array([0]));let o=this.coefficients,c=o.length,u=i.coefficients,l=u.length,d=new Int32Array(c+l-1);for(let p=0;p<c;p++){let v=o[p];for(let y=0;y<l;y++)d[p+y]=this.field.add(d[p+y],this.field.multiply(v,u[y]))}return new St(this.field,d)}negative(){let i=this.coefficients.length,o=new Int32Array(i);for(let c=0;c<i;c++)o[c]=this.field.subtract(0,this.coefficients[c]);return new St(this.field,o)}multiplyScalar(i){if(i===0)return new St(this.field,new Int32Array([0]));if(i===1)return this;let o=this.coefficients.length,c=new Int32Array(o);for(let u=0;u<o;u++)c[u]=this.field.multiply(this.coefficients[u],i);return new St(this.field,c)}multiplyByMonomial(i,o){if(i<0)throw new A;if(o===0)return new St(this.field,new Int32Array([0]));let c=this.coefficients.length,u=new Int32Array(c+i);for(let l=0;l<c;l++)u[l]=this.field.multiply(this.coefficients[l],o);return new St(this.field,u)}toString(){let i=new ne;for(let o=this.getDegree();o>=0;o--){let c=this.getCoefficient(o);c!==0&&(c<0?(i.append(" - "),c=-c):i.length()>0&&i.append(" + "),(o===0||c!==1)&&i.append(c),o!==0&&(o===1?i.append("x"):(i.append("x^"),i.append(o))))}return i.toString()}}class E1{add(i,o){return(i+o)%this.modulus}subtract(i,o){return(this.modulus+i-o)%this.modulus}exp(i){return this.expTable[i]}log(i){if(i===0)throw new A;return this.logTable[i]}inverse(i){if(i===0)throw new Gn;return this.expTable[this.modulus-this.logTable[i]-1]}multiply(i,o){return i===0||o===0?0:this.expTable[(this.logTable[i]+this.logTable[o])%(this.modulus-1)]}getSize(){return this.modulus}equals(i){return i===this}}class Bi extends E1{constructor(i,o){super(),this.modulus=i,this.expTable=new Int32Array(i),this.logTable=new Int32Array(i);let c=1;for(let u=0;u<i;u++)this.expTable[u]=c,c=c*o%i;for(let u=0;u<i-1;u++)this.logTable[this.expTable[u]]=u;this.zero=new St(this,new Int32Array([0])),this.one=new St(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(i,o){if(i<0)throw new A;if(o===0)return this.zero;let c=new Int32Array(i+1);return c[0]=o,new St(this,c)}}Bi.PDF417_GF=new Bi(we.NUMBER_OF_CODEWORDS,3);class Ba{constructor(){this.field=Bi.PDF417_GF}decode(i,o,c){let u=new St(this.field,i),l=new Int32Array(o),d=!1;for(let M=o;M>0;M--){let B=u.evaluateAt(this.field.exp(M));l[o-M]=B,B!==0&&(d=!0)}if(!d)return 0;let p=this.field.getOne();if(c!=null)for(const M of c){let B=this.field.exp(i.length-1-M),V=new St(this.field,new Int32Array([this.field.subtract(0,B),1]));p=p.multiply(V)}let v=new St(this.field,l),y=this.runEuclideanAlgorithm(this.field.buildMonomial(o,1),v,o),_=y[0],I=y[1],S=this.findErrorLocations(_),R=this.findErrorMagnitudes(I,_,S);for(let M=0;M<S.length;M++){let B=i.length-1-this.field.log(S[M]);if(B<0)throw C.getChecksumInstance();i[B]=this.field.subtract(i[B],R[M])}return S.length}runEuclideanAlgorithm(i,o,c){if(i.getDegree()<o.getDegree()){let S=i;i=o,o=S}let u=i,l=o,d=this.field.getZero(),p=this.field.getOne();for(;l.getDegree()>=Math.round(c/2);){let S=u,R=d;if(u=l,d=p,u.isZero())throw C.getChecksumInstance();l=S;let M=this.field.getZero(),B=u.getCoefficient(u.getDegree()),V=this.field.inverse(B);for(;l.getDegree()>=u.getDegree()&&!l.isZero();){let z=l.getDegree()-u.getDegree(),ee=this.field.multiply(l.getCoefficient(l.getDegree()),V);M=M.add(this.field.buildMonomial(z,ee)),l=l.subtract(u.multiplyByMonomial(z,ee))}p=M.multiply(d).subtract(R).negative()}let v=p.getCoefficient(0);if(v===0)throw C.getChecksumInstance();let y=this.field.inverse(v),_=p.multiply(y),I=l.multiply(y);return[_,I]}findErrorLocations(i){let o=i.getDegree(),c=new Int32Array(o),u=0;for(let l=1;l<this.field.getSize()&&u<o;l++)i.evaluateAt(l)===0&&(c[u]=this.field.inverse(l),u++);if(u!==o)throw C.getChecksumInstance();return c}findErrorMagnitudes(i,o,c){let u=o.getDegree(),l=new Int32Array(u);for(let y=1;y<=u;y++)l[u-y]=this.field.multiply(y,o.getCoefficient(y));let d=new St(this.field,l),p=c.length,v=new Int32Array(p);for(let y=0;y<p;y++){let _=this.field.inverse(c[y]),I=this.field.subtract(0,i.evaluateAt(_)),S=this.field.inverse(d.evaluateAt(_));v[y]=this.field.multiply(I,S)}return v}}class jr{constructor(i,o,c,u,l){i instanceof jr?this.constructor_2(i):this.constructor_1(i,o,c,u,l)}constructor_1(i,o,c,u,l){const d=o==null||c==null,p=u==null||l==null;if(d&&p)throw new X;d?(o=new fe(0,u.getY()),c=new fe(0,l.getY())):p&&(u=new fe(i.getWidth()-1,o.getY()),l=new fe(i.getWidth()-1,c.getY())),this.image=i,this.topLeft=o,this.bottomLeft=c,this.topRight=u,this.bottomRight=l,this.minX=Math.trunc(Math.min(o.getX(),c.getX())),this.maxX=Math.trunc(Math.max(u.getX(),l.getX())),this.minY=Math.trunc(Math.min(o.getY(),u.getY())),this.maxY=Math.trunc(Math.max(c.getY(),l.getY()))}constructor_2(i){this.image=i.image,this.topLeft=i.getTopLeft(),this.bottomLeft=i.getBottomLeft(),this.topRight=i.getTopRight(),this.bottomRight=i.getBottomRight(),this.minX=i.getMinX(),this.maxX=i.getMaxX(),this.minY=i.getMinY(),this.maxY=i.getMaxY()}static merge(i,o){return i==null?o:o==null?i:new jr(i.image,i.topLeft,i.bottomLeft,o.topRight,o.bottomRight)}addMissingRows(i,o,c){let u=this.topLeft,l=this.bottomLeft,d=this.topRight,p=this.bottomRight;if(i>0){let v=c?this.topLeft:this.topRight,y=Math.trunc(v.getY()-i);y<0&&(y=0);let _=new fe(v.getX(),y);c?u=_:d=_}if(o>0){let v=c?this.bottomLeft:this.bottomRight,y=Math.trunc(v.getY()+o);y>=this.image.getHeight()&&(y=this.image.getHeight()-1);let _=new fe(v.getX(),y);c?l=_:p=_}return new jr(this.image,u,l,d,p)}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 C1{constructor(i,o,c,u){this.columnCount=i,this.errorCorrectionLevel=u,this.rowCountUpperPart=o,this.rowCountLowerPart=c,this.rowCount=o+c}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class In{constructor(){this.buffer=""}static form(i,o){let c=-1;function u(d,p,v,y,_,I){if(d==="%%")return"%";if(o[++c]===void 0)return;d=y?parseInt(y.substr(1)):void 0;let S=_?parseInt(_.substr(1)):void 0,R;switch(I){case"s":R=o[c];break;case"c":R=o[c][0];break;case"f":R=parseFloat(o[c]).toFixed(d);break;case"p":R=parseFloat(o[c]).toPrecision(d);break;case"e":R=parseFloat(o[c]).toExponential(d);break;case"x":R=parseInt(o[c]).toString(S||16);break;case"d":R=parseFloat(parseInt(o[c],S||10).toPrecision(d)).toFixed(0);break}R=typeof R=="object"?JSON.stringify(R):(+R).toString(S);let M=parseInt(v),B=v&&v[0]+""=="0"?"0":" ";for(;R.length<M;)R=p!==void 0?R+B:B+R;return R}let l=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return i.replace(l,u)}format(i,...o){this.buffer+=In.form(i,o)}toString(){return this.buffer}}class Sn{constructor(i){this.boundingBox=new jr(i),this.codewords=new Array(i.getMaxY()-i.getMinY()+1)}getCodewordNearby(i){let o=this.getCodeword(i);if(o!=null)return o;for(let c=1;c<Sn.MAX_NEARBY_DISTANCE;c++){let u=this.imageRowToCodewordIndex(i)-c;if(u>=0&&(o=this.codewords[u],o!=null)||(u=this.imageRowToCodewordIndex(i)+c,u<this.codewords.length&&(o=this.codewords[u],o!=null)))return o}return null}imageRowToCodewordIndex(i){return i-this.boundingBox.getMinY()}setCodeword(i,o){this.codewords[this.imageRowToCodewordIndex(i)]=o}getCodeword(i){return this.codewords[this.imageRowToCodewordIndex(i)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const i=new In;let o=0;for(const c of this.codewords){if(c==null){i.format("%3d: | %n",o++);continue}i.format("%3d: %3d|%3d%n",o++,c.getRowNumber(),c.getValue())}return i.toString()}}Sn.MAX_NEARBY_DISTANCE=5;class bn{constructor(){this.values=new Map}setValue(i){i=Math.trunc(i);let o=this.values.get(i);o==null&&(o=0),o++,this.values.set(i,o)}getValue(){let i=-1,o=new Array;for(const[c,u]of this.values.entries()){const l={getKey:()=>c,getValue:()=>u};l.getValue()>i?(i=l.getValue(),o=[],o.push(l.getKey())):l.getValue()===i&&o.push(l.getKey())}return we.toIntArray(o)}getConfidence(i){return this.values.get(i)}}class La extends Sn{constructor(i,o){super(i),this._isLeft=o}setRowNumbers(){for(let i of this.getCodewords())i!=null&&i.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(i){let o=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(o,i);let c=this.getBoundingBox(),u=this._isLeft?c.getTopLeft():c.getTopRight(),l=this._isLeft?c.getBottomLeft():c.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(u.getY())),p=this.imageRowToCodewordIndex(Math.trunc(l.getY())),v=-1,y=1,_=0;for(let I=d;I<p;I++){if(o[I]==null)continue;let S=o[I],R=S.getRowNumber()-v;if(R===0)_++;else if(R===1)y=Math.max(y,_),_=1,v=S.getRowNumber();else if(R<0||S.getRowNumber()>=i.getRowCount()||R>I)o[I]=null;else{let M;y>2?M=(y-2)*R:M=R;let B=M>=I;for(let V=1;V<=M&&!B;V++)B=o[I-V]!=null;B?o[I]=null:(v=S.getRowNumber(),_=1)}}}getRowHeights(){let i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);let o=new Int32Array(i.getRowCount());for(let c of this.getCodewords())if(c!=null){let u=c.getRowNumber();if(u>=o.length)continue;o[u]++}return o}adjustIncompleteIndicatorColumnRowNumbers(i){let o=this.getBoundingBox(),c=this._isLeft?o.getTopLeft():o.getTopRight(),u=this._isLeft?o.getBottomLeft():o.getBottomRight(),l=this.imageRowToCodewordIndex(Math.trunc(c.getY())),d=this.imageRowToCodewordIndex(Math.trunc(u.getY())),p=this.getCodewords(),v=-1;for(let y=l;y<d;y++){if(p[y]==null)continue;let _=p[y];_.setRowNumberAsRowIndicatorColumn();let I=_.getRowNumber()-v;I===0||(I===1?v=_.getRowNumber():_.getRowNumber()>=i.getRowCount()?p[y]=null:v=_.getRowNumber())}}getBarcodeMetadata(){let i=this.getCodewords(),o=new bn,c=new bn,u=new bn,l=new bn;for(let p of i){if(p==null)continue;p.setRowNumberAsRowIndicatorColumn();let v=p.getValue()%30,y=p.getRowNumber();switch(this._isLeft||(y+=2),y%3){case 0:c.setValue(v*3+1);break;case 1:l.setValue(v/3),u.setValue(v%3);break;case 2:o.setValue(v+1);break}}if(o.getValue().length===0||c.getValue().length===0||u.getValue().length===0||l.getValue().length===0||o.getValue()[0]<1||c.getValue()[0]+u.getValue()[0]<we.MIN_ROWS_IN_BARCODE||c.getValue()[0]+u.getValue()[0]>we.MAX_ROWS_IN_BARCODE)return null;let d=new C1(o.getValue()[0],c.getValue()[0],u.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(i,d),d}removeIncorrectCodewords(i,o){for(let c=0;c<i.length;c++){let u=i[c];if(i[c]==null)continue;let l=u.getValue()%30,d=u.getRowNumber();if(d>o.getRowCount()){i[c]=null;continue}switch(this._isLeft||(d+=2),d%3){case 0:l*3+1!==o.getRowCountUpperPart()&&(i[c]=null);break;case 1:(Math.trunc(l/3)!==o.getErrorCorrectionLevel()||l%3!==o.getRowCountLowerPart())&&(i[c]=null);break;case 2:l+1!==o.getColumnCount()&&(i[c]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
||
`+super.toString()}}class Tn{constructor(i,o){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=i,this.barcodeColumnCount=i.getColumnCount(),this.boundingBox=o,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let i=we.MAX_CODEWORDS_IN_BARCODE,o;do o=i,i=this.adjustRowNumbersAndGetCount();while(i>0&&i<o);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(i){i!=null&&i.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let i=this.adjustRowNumbersByRow();if(i===0)return 0;for(let o=1;o<this.barcodeColumnCount+1;o++){let c=this.detectionResultColumns[o].getCodewords();for(let u=0;u<c.length;u++)c[u]!=null&&(c[u].hasValidRowNumber()||this.adjustRowNumbers(o,u,c))}return i}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let i=this.detectionResultColumns[0].getCodewords(),o=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let c=0;c<i.length;c++)if(i[c]!=null&&o[c]!=null&&i[c].getRowNumber()===o[c].getRowNumber())for(let u=1;u<=this.barcodeColumnCount;u++){let l=this.detectionResultColumns[u].getCodewords()[c];l!=null&&(l.setRowNumber(i[c].getRowNumber()),l.hasValidRowNumber()||(this.detectionResultColumns[u].getCodewords()[c]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let i=0,o=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let c=0;c<o.length;c++){if(o[c]==null)continue;let u=o[c].getRowNumber(),l=0;for(let d=this.barcodeColumnCount+1;d>0&&l<this.ADJUST_ROW_NUMBER_SKIP;d--){let p=this.detectionResultColumns[d].getCodewords()[c];p!=null&&(l=Tn.adjustRowNumberIfValid(u,l,p),p.hasValidRowNumber()||i++)}}return i}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let i=0,o=this.detectionResultColumns[0].getCodewords();for(let c=0;c<o.length;c++){if(o[c]==null)continue;let u=o[c].getRowNumber(),l=0;for(let d=1;d<this.barcodeColumnCount+1&&l<this.ADJUST_ROW_NUMBER_SKIP;d++){let p=this.detectionResultColumns[d].getCodewords()[c];p!=null&&(l=Tn.adjustRowNumberIfValid(u,l,p),p.hasValidRowNumber()||i++)}}return i}static adjustRowNumberIfValid(i,o,c){return c==null||c.hasValidRowNumber()||(c.isValidRowNumber(i)?(c.setRowNumber(i),o=0):++o),o}adjustRowNumbers(i,o,c){if(!this.detectionResultColumns[i-1])return;let u=c[o],l=this.detectionResultColumns[i-1].getCodewords(),d=l;this.detectionResultColumns[i+1]!=null&&(d=this.detectionResultColumns[i+1].getCodewords());let p=new Array(14);p[2]=l[o],p[3]=d[o],o>0&&(p[0]=c[o-1],p[4]=l[o-1],p[5]=d[o-1]),o>1&&(p[8]=c[o-2],p[10]=l[o-2],p[11]=d[o-2]),o<c.length-1&&(p[1]=c[o+1],p[6]=l[o+1],p[7]=d[o+1]),o<c.length-2&&(p[9]=c[o+2],p[12]=l[o+2],p[13]=d[o+2]);for(let v of p)if(Tn.adjustRowNumber(u,v))return}static adjustRowNumber(i,o){return o==null?!1:o.hasValidRowNumber()&&o.getBucket()===i.getBucket()?(i.setRowNumber(o.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(i){this.boundingBox=i}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(i,o){this.detectionResultColumns[i]=o}getDetectionResultColumn(i){return this.detectionResultColumns[i]}toString(){let i=this.detectionResultColumns[0];i==null&&(i=this.detectionResultColumns[this.barcodeColumnCount+1]);let o=new In;for(let c=0;c<i.getCodewords().length;c++){o.format("CW %3d:",c);for(let u=0;u<this.barcodeColumnCount+2;u++){if(this.detectionResultColumns[u]==null){o.format(" | ");continue}let l=this.detectionResultColumns[u].getCodewords()[c];if(l==null){o.format(" | ");continue}o.format(" %3d|%3d",l.getRowNumber(),l.getValue())}o.format("%n")}return o.toString()}}class On{constructor(i,o,c,u){this.rowNumber=On.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(i),this.endX=Math.trunc(o),this.bucket=Math.trunc(c),this.value=Math.trunc(u)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(i){return i!==On.BARCODE_ROW_UNKNOWN&&this.bucket===i%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(i){this.rowNumber=i}toString(){return this.rowNumber+"|"+this.value}}On.BARCODE_ROW_UNKNOWN=-1;class Zt{static initialize(){for(let i=0;i<we.SYMBOL_TABLE.length;i++){let o=we.SYMBOL_TABLE[i],c=o&1;for(let u=0;u<we.BARS_IN_MODULE;u++){let l=0;for(;(o&1)===c;)l+=1,o>>=1;c=o&1,Zt.RATIOS_TABLE[i]||(Zt.RATIOS_TABLE[i]=new Array(we.BARS_IN_MODULE)),Zt.RATIOS_TABLE[i][we.BARS_IN_MODULE-u-1]=Math.fround(l/we.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(i){let o=Zt.getDecodedCodewordValue(Zt.sampleBitCounts(i));return o!==-1?o:Zt.getClosestDecodedValue(i)}static sampleBitCounts(i){let o=Oe.sum(i),c=new Int32Array(we.BARS_IN_MODULE),u=0,l=0;for(let d=0;d<we.MODULES_IN_CODEWORD;d++){let p=o/(2*we.MODULES_IN_CODEWORD)+d*o/we.MODULES_IN_CODEWORD;l+i[u]<=p&&(l+=i[u],u++),c[u]++}return c}static getDecodedCodewordValue(i){let o=Zt.getBitValue(i);return we.getCodeword(o)===-1?-1:o}static getBitValue(i){let o=0;for(let c=0;c<i.length;c++)for(let u=0;u<i[c];u++)o=o<<1|(c%2===0?1:0);return Math.trunc(o)}static getClosestDecodedValue(i){let o=Oe.sum(i),c=new Array(we.BARS_IN_MODULE);if(o>1)for(let d=0;d<c.length;d++)c[d]=Math.fround(i[d]/o);let u=Xn.MAX_VALUE,l=-1;this.bSymbolTableReady||Zt.initialize();for(let d=0;d<Zt.RATIOS_TABLE.length;d++){let p=0,v=Zt.RATIOS_TABLE[d];for(let y=0;y<we.BARS_IN_MODULE;y++){let _=Math.fround(v[y]-c[y]);if(p+=Math.fround(_*_),p>=u)break}p<u&&(u=p,l=we.SYMBOL_TABLE[d])}return l}}Zt.bSymbolTableReady=!1,Zt.RATIOS_TABLE=new Array(we.SYMBOL_TABLE.length).map(m=>new Array(we.BARS_IN_MODULE));class Fa{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(i){this.segmentIndex=i}getFileId(){return this.fileId}setFileId(i){this.fileId=i}getOptionalData(){return this.optionalData}setOptionalData(i){this.optionalData=i}isLastSegment(){return this.lastSegment}setLastSegment(i){this.lastSegment=i}getSegmentCount(){return this.segmentCount}setSegmentCount(i){this.segmentCount=i}getSender(){return this.sender||null}setSender(i){this.sender=i}getAddressee(){return this.addressee||null}setAddressee(i){this.addressee=i}getFileName(){return this.fileName}setFileName(i){this.fileName=i}getFileSize(){return this.fileSize}setFileSize(i){this.fileSize=i}getChecksum(){return this.checksum}setChecksum(i){this.checksum=i}getTimestamp(){return this.timestamp}setTimestamp(i){this.timestamp=i}}class ka{static parseLong(i,o=void 0){return parseInt(i,o)}}class Ua extends g{}Ua.kind="NullPointerException";class _1{writeBytes(i){this.writeBytesOffset(i,0,i.length)}writeBytesOffset(i,o,c){if(i==null)throw new Ua;if(o<0||o>i.length||c<0||o+c>i.length||o+c<0)throw new P;if(c===0)return;for(let u=0;u<c;u++)this.write(i[o+u])}flush(){}close(){}}class m1 extends g{}class I1 extends _1{constructor(i=32){if(super(),this.count=0,i<0)throw new A("Negative initial size: "+i);this.buf=new Uint8Array(i)}ensureCapacity(i){i-this.buf.length>0&&this.grow(i)}grow(i){let c=this.buf.length<<1;if(c-i<0&&(c=i),c<0){if(i<0)throw new m1;c=L.MAX_VALUE}this.buf=D.copyOfUint8Array(this.buf,c)}write(i){this.ensureCapacity(this.count+1),this.buf[this.count]=i,this.count+=1}writeBytesOffset(i,o,c){if(o<0||o>i.length||c<0||o+c-i.length>0)throw new P;this.ensureCapacity(this.count+c),T.arraycopy(i,o,this.buf,this.count,c),this.count+=c}writeTo(i){i.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return D.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(i){return i?typeof i=="string"?this.toString_string(i):this.toString_number(i):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(i){return new String(this.buf).toString()}toString_number(i){return new String(this.buf).toString()}close(){}}var Ge;(function(m){m[m.ALPHA=0]="ALPHA",m[m.LOWER=1]="LOWER",m[m.MIXED=2]="MIXED",m[m.PUNCT=3]="PUNCT",m[m.ALPHA_SHIFT=4]="ALPHA_SHIFT",m[m.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Ge||(Ge={}));function Va(){if(typeof window<"u")return window.BigInt||null;if(typeof ti<"u")return ti.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let qn;function Fr(m){if(typeof qn>"u"&&(qn=Va()),qn===null)throw new Error("BigInt is not supported!");return qn(m)}function S1(){let m=[];m[0]=Fr(1);let i=Fr(900);m[1]=i;for(let o=2;o<16;o++)m[o]=m[o-1]*i;return m}class W{static decode(i,o){let c=new ne(""),u=Y.ISO8859_1;c.enableDecoding(u);let l=1,d=i[l++],p=new Fa;for(;l<i[0];){switch(d){case W.TEXT_COMPACTION_MODE_LATCH:l=W.textCompaction(i,l,c);break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:l=W.byteCompaction(d,i,u,l,c);break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:c.append(i[l++]);break;case W.NUMERIC_COMPACTION_MODE_LATCH:l=W.numericCompaction(i,l,c);break;case W.ECI_CHARSET:Y.getCharacterSetECIByValue(i[l++]);break;case W.ECI_GENERAL_PURPOSE:l+=2;break;case W.ECI_USER_DEFINED:l++;break;case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:l=W.decodeMacroBlock(i,l,p);break;case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:throw new U;default:l--,l=W.textCompaction(i,l,c);break}if(l<i.length)d=i[l++];else throw U.getFormatInstance()}if(c.length()===0)throw U.getFormatInstance();let v=new yn(null,c.toString(),null,o);return v.setOther(p),v}static decodeMacroBlock(i,o,c){if(o+W.NUMBER_OF_SEQUENCE_CODEWORDS>i[0])throw U.getFormatInstance();let u=new Int32Array(W.NUMBER_OF_SEQUENCE_CODEWORDS);for(let p=0;p<W.NUMBER_OF_SEQUENCE_CODEWORDS;p++,o++)u[p]=i[o];c.setSegmentIndex(L.parseInt(W.decodeBase900toBase10(u,W.NUMBER_OF_SEQUENCE_CODEWORDS)));let l=new ne;o=W.textCompaction(i,o,l),c.setFileId(l.toString());let d=-1;for(i[o]===W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(d=o+1);o<i[0];)switch(i[o]){case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(o++,i[o]){case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let p=new ne;o=W.textCompaction(i,o+1,p),c.setFileName(p.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let v=new ne;o=W.textCompaction(i,o+1,v),c.setSender(v.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let y=new ne;o=W.textCompaction(i,o+1,y),c.setAddressee(y.toString());break;case W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let _=new ne;o=W.numericCompaction(i,o+1,_),c.setSegmentCount(L.parseInt(_.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let I=new ne;o=W.numericCompaction(i,o+1,I),c.setTimestamp(ka.parseLong(I.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new ne;o=W.numericCompaction(i,o+1,S),c.setChecksum(L.parseInt(S.toString()));break;case W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let R=new ne;o=W.numericCompaction(i,o+1,R),c.setFileSize(ka.parseLong(R.toString()));break;default:throw U.getFormatInstance()}break;case W.MACRO_PDF417_TERMINATOR:o++,c.setLastSegment(!0);break;default:throw U.getFormatInstance()}if(d!==-1){let p=o-d;c.isLastSegment()&&p--,c.setOptionalData(D.copyOfRange(i,d,d+p))}return o}static textCompaction(i,o,c){let u=new Int32Array((i[0]-o)*2),l=new Int32Array((i[0]-o)*2),d=0,p=!1;for(;o<i[0]&&!p;){let v=i[o++];if(v<W.TEXT_COMPACTION_MODE_LATCH)u[d]=v/30,u[d+1]=v%30,d+=2;else switch(v){case W.TEXT_COMPACTION_MODE_LATCH:u[d++]=W.TEXT_COMPACTION_MODE_LATCH;break;case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:o--,p=!0;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u[d]=W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,v=i[o++],l[d]=v,d++;break}}return W.decodeTextCompaction(u,l,d,c),o}static decodeTextCompaction(i,o,c,u){let l=Ge.ALPHA,d=Ge.ALPHA,p=0;for(;p<c;){let v=i[p],y="";switch(l){case Ge.ALPHA:if(v<26)y=String.fromCharCode(65+v);else switch(v){case 26:y=" ";break;case W.LL:l=Ge.LOWER;break;case W.ML:l=Ge.MIXED;break;case W.PS:d=l,l=Ge.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u.append(o[p]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break;case Ge.LOWER:if(v<26)y=String.fromCharCode(97+v);else switch(v){case 26:y=" ";break;case W.AS:d=l,l=Ge.ALPHA_SHIFT;break;case W.ML:l=Ge.MIXED;break;case W.PS:d=l,l=Ge.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u.append(o[p]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break;case Ge.MIXED:if(v<W.PL)y=W.MIXED_CHARS[v];else switch(v){case W.PL:l=Ge.PUNCT;break;case 26:y=" ";break;case W.LL:l=Ge.LOWER;break;case W.AL:l=Ge.ALPHA;break;case W.PS:d=l,l=Ge.PUNCT_SHIFT;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u.append(o[p]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break;case Ge.PUNCT:if(v<W.PAL)y=W.PUNCT_CHARS[v];else switch(v){case W.PAL:l=Ge.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u.append(o[p]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break;case Ge.ALPHA_SHIFT:if(l=d,v<26)y=String.fromCharCode(65+v);else switch(v){case 26:y=" ";break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break;case Ge.PUNCT_SHIFT:if(l=d,v<W.PAL)y=W.PUNCT_CHARS[v];else switch(v){case W.PAL:l=Ge.ALPHA;break;case W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:u.append(o[p]);break;case W.TEXT_COMPACTION_MODE_LATCH:l=Ge.ALPHA;break}break}y!==""&&u.append(y),p++}}static byteCompaction(i,o,c,u,l){let d=new I1,p=0,v=0,y=!1;switch(i){case W.BYTE_COMPACTION_MODE_LATCH:let _=new Int32Array(6),I=o[u++];for(;u<o[0]&&!y;)switch(_[p++]=I,v=900*v+I,I=o[u++],I){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:u--,y=!0;break;default:if(p%5===0&&p>0){for(let S=0;S<6;++S)d.write(Number(Fr(v)>>Fr(8*(5-S))));v=0,p=0}break}u===o[0]&&I<W.TEXT_COMPACTION_MODE_LATCH&&(_[p++]=I);for(let S=0;S<p;S++)d.write(_[S]);break;case W.BYTE_COMPACTION_MODE_LATCH_6:for(;u<o[0]&&!y;){let S=o[u++];if(S<W.TEXT_COMPACTION_MODE_LATCH)p++,v=900*v+S;else switch(S){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.NUMERIC_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:u--,y=!0;break}if(p%5===0&&p>0){for(let R=0;R<6;++R)d.write(Number(Fr(v)>>Fr(8*(5-R))));v=0,p=0}}break}return l.append(_e.decode(d.toByteArray(),c)),u}static numericCompaction(i,o,c){let u=0,l=!1,d=new Int32Array(W.MAX_NUMERIC_CODEWORDS);for(;o<i[0]&&!l;){let p=i[o++];if(o===i[0]&&(l=!0),p<W.TEXT_COMPACTION_MODE_LATCH)d[u]=p,u++;else switch(p){case W.TEXT_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH:case W.BYTE_COMPACTION_MODE_LATCH_6:case W.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case W.MACRO_PDF417_TERMINATOR:o--,l=!0;break}(u%W.MAX_NUMERIC_CODEWORDS===0||p===W.NUMERIC_COMPACTION_MODE_LATCH||l)&&u>0&&(c.append(W.decodeBase900toBase10(d,u)),u=0)}return o}static decodeBase900toBase10(i,o){let c=Fr(0);for(let l=0;l<o;l++)c+=W.EXP900[o-l-1]*Fr(i[l]);let u=c.toString();if(u.charAt(0)!=="1")throw new U;return u.substring(1)}}W.TEXT_COMPACTION_MODE_LATCH=900,W.BYTE_COMPACTION_MODE_LATCH=901,W.NUMERIC_COMPACTION_MODE_LATCH=902,W.BYTE_COMPACTION_MODE_LATCH_6=924,W.ECI_USER_DEFINED=925,W.ECI_GENERAL_PURPOSE=926,W.ECI_CHARSET=927,W.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,W.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,W.MACRO_PDF417_TERMINATOR=922,W.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,W.MAX_NUMERIC_CODEWORDS=15,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,W.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,W.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,W.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,W.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,W.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,W.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,W.PL=25,W.LL=27,W.AS=27,W.ML=28,W.AL=28,W.PS=29,W.PAL=29,W.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
||
-.$/"|*()?{}'`,W.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",W.EXP900=Va()?S1():[],W.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ee{constructor(){}static decode(i,o,c,u,l,d,p){let v=new jr(i,o,c,u,l),y=null,_=null,I;for(let M=!0;;M=!1){if(o!=null&&(y=Ee.getRowIndicatorColumn(i,v,o,!0,d,p)),u!=null&&(_=Ee.getRowIndicatorColumn(i,v,u,!1,d,p)),I=Ee.merge(y,_),I==null)throw X.getNotFoundInstance();let B=I.getBoundingBox();if(M&&B!=null&&(B.getMinY()<v.getMinY()||B.getMaxY()>v.getMaxY()))v=B;else break}I.setBoundingBox(v);let S=I.getBarcodeColumnCount()+1;I.setDetectionResultColumn(0,y),I.setDetectionResultColumn(S,_);let R=y!=null;for(let M=1;M<=S;M++){let B=R?M:S-M;if(I.getDetectionResultColumn(B)!==void 0)continue;let V;B===0||B===S?V=new La(v,B===0):V=new Sn(v),I.setDetectionResultColumn(B,V);let z=-1,ee=z;for(let te=v.getMinY();te<=v.getMaxY();te++){if(z=Ee.getStartColumn(I,B,te,R),z<0||z>v.getMaxX()){if(ee===-1)continue;z=ee}let J=Ee.detectCodeword(i,v.getMinX(),v.getMaxX(),R,z,te,d,p);J!=null&&(V.setCodeword(te,J),ee=z,d=Math.min(d,J.getWidth()),p=Math.max(p,J.getWidth()))}}return Ee.createDecoderResult(I)}static merge(i,o){if(i==null&&o==null)return null;let c=Ee.getBarcodeMetadata(i,o);if(c==null)return null;let u=jr.merge(Ee.adjustBoundingBox(i),Ee.adjustBoundingBox(o));return new Tn(c,u)}static adjustBoundingBox(i){if(i==null)return null;let o=i.getRowHeights();if(o==null)return null;let c=Ee.getMax(o),u=0;for(let p of o)if(u+=c-p,p>0)break;let l=i.getCodewords();for(let p=0;u>0&&l[p]==null;p++)u--;let d=0;for(let p=o.length-1;p>=0&&(d+=c-o[p],!(o[p]>0));p--);for(let p=l.length-1;d>0&&l[p]==null;p--)d--;return i.getBoundingBox().addMissingRows(u,d,i.isLeft())}static getMax(i){let o=-1;for(let c of i)o=Math.max(o,c);return o}static getBarcodeMetadata(i,o){let c;if(i==null||(c=i.getBarcodeMetadata())==null)return o==null?null:o.getBarcodeMetadata();let u;return o==null||(u=o.getBarcodeMetadata())==null?c:c.getColumnCount()!==u.getColumnCount()&&c.getErrorCorrectionLevel()!==u.getErrorCorrectionLevel()&&c.getRowCount()!==u.getRowCount()?null:c}static getRowIndicatorColumn(i,o,c,u,l,d){let p=new La(o,u);for(let v=0;v<2;v++){let y=v===0?1:-1,_=Math.trunc(Math.trunc(c.getX()));for(let I=Math.trunc(Math.trunc(c.getY()));I<=o.getMaxY()&&I>=o.getMinY();I+=y){let S=Ee.detectCodeword(i,0,i.getWidth(),u,_,I,l,d);S!=null&&(p.setCodeword(I,S),u?_=S.getStartX():_=S.getEndX())}}return p}static adjustCodewordCount(i,o){let c=o[0][1],u=c.getValue(),l=i.getBarcodeColumnCount()*i.getBarcodeRowCount()-Ee.getNumberOfECCodeWords(i.getBarcodeECLevel());if(u.length===0){if(l<1||l>we.MAX_CODEWORDS_IN_BARCODE)throw X.getNotFoundInstance();c.setValue(l)}else u[0]!==l&&c.setValue(l)}static createDecoderResult(i){let o=Ee.createBarcodeMatrix(i);Ee.adjustCodewordCount(i,o);let c=new Array,u=new Int32Array(i.getBarcodeRowCount()*i.getBarcodeColumnCount()),l=[],d=new Array;for(let v=0;v<i.getBarcodeRowCount();v++)for(let y=0;y<i.getBarcodeColumnCount();y++){let _=o[v][y+1].getValue(),I=v*i.getBarcodeColumnCount()+y;_.length===0?c.push(I):_.length===1?u[I]=_[0]:(d.push(I),l.push(_))}let p=new Array(l.length);for(let v=0;v<p.length;v++)p[v]=l[v];return Ee.createDecoderResultFromAmbiguousValues(i.getBarcodeECLevel(),u,we.toIntArray(c),we.toIntArray(d),p)}static createDecoderResultFromAmbiguousValues(i,o,c,u,l){let d=new Int32Array(u.length),p=100;for(;p-- >0;){for(let v=0;v<d.length;v++)o[u[v]]=l[v][d[v]];try{return Ee.decodeCodewords(o,i,c)}catch(v){if(!(v instanceof C))throw v}if(d.length===0)throw C.getChecksumInstance();for(let v=0;v<d.length;v++)if(d[v]<l[v].length-1){d[v]++;break}else if(d[v]=0,v===d.length-1)throw C.getChecksumInstance()}throw C.getChecksumInstance()}static createBarcodeMatrix(i){let o=Array.from({length:i.getBarcodeRowCount()},()=>new Array(i.getBarcodeColumnCount()+2));for(let u=0;u<o.length;u++)for(let l=0;l<o[u].length;l++)o[u][l]=new bn;let c=0;for(let u of i.getDetectionResultColumns()){if(u!=null){for(let l of u.getCodewords())if(l!=null){let d=l.getRowNumber();if(d>=0){if(d>=o.length)continue;o[d][c].setValue(l.getValue())}}}c++}return o}static isValidBarcodeColumn(i,o){return o>=0&&o<=i.getBarcodeColumnCount()+1}static getStartColumn(i,o,c,u){let l=u?1:-1,d=null;if(Ee.isValidBarcodeColumn(i,o-l)&&(d=i.getDetectionResultColumn(o-l).getCodeword(c)),d!=null)return u?d.getEndX():d.getStartX();if(d=i.getDetectionResultColumn(o).getCodewordNearby(c),d!=null)return u?d.getStartX():d.getEndX();if(Ee.isValidBarcodeColumn(i,o-l)&&(d=i.getDetectionResultColumn(o-l).getCodewordNearby(c)),d!=null)return u?d.getEndX():d.getStartX();let p=0;for(;Ee.isValidBarcodeColumn(i,o-l);){o-=l;for(let v of i.getDetectionResultColumn(o).getCodewords())if(v!=null)return(u?v.getEndX():v.getStartX())+l*p*(v.getEndX()-v.getStartX());p++}return u?i.getBoundingBox().getMinX():i.getBoundingBox().getMaxX()}static detectCodeword(i,o,c,u,l,d,p,v){l=Ee.adjustCodewordStartColumn(i,o,c,u,l,d);let y=Ee.getModuleBitCount(i,o,c,u,l,d);if(y==null)return null;let _,I=Oe.sum(y);if(u)_=l+I;else{for(let M=0;M<y.length/2;M++){let B=y[M];y[M]=y[y.length-1-M],y[y.length-1-M]=B}_=l,l=_-I}if(!Ee.checkCodewordSkew(I,p,v))return null;let S=Zt.getDecodedValue(y),R=we.getCodeword(S);return R===-1?null:new On(l,_,Ee.getCodewordBucketNumber(S),R)}static getModuleBitCount(i,o,c,u,l,d){let p=l,v=new Int32Array(8),y=0,_=u?1:-1,I=u;for(;(u?p<c:p>=o)&&y<v.length;)i.get(p,d)===I?(v[y]++,p+=_):(y++,I=!I);return y===v.length||p===(u?c:o)&&y===v.length-1?v:null}static getNumberOfECCodeWords(i){return 2<<i}static adjustCodewordStartColumn(i,o,c,u,l,d){let p=l,v=u?-1:1;for(let y=0;y<2;y++){for(;(u?p>=o:p<c)&&u===i.get(p,d);){if(Math.abs(l-p)>Ee.CODEWORD_SKEW_SIZE)return l;p+=v}v=-v,u=!u}return p}static checkCodewordSkew(i,o,c){return o-Ee.CODEWORD_SKEW_SIZE<=i&&i<=c+Ee.CODEWORD_SKEW_SIZE}static decodeCodewords(i,o,c){if(i.length===0)throw U.getFormatInstance();let u=1<<o+1,l=Ee.correctErrors(i,c,u);Ee.verifyCodewordCount(i,u);let d=W.decode(i,""+o);return d.setErrorsCorrected(l),d.setErasures(c.length),d}static correctErrors(i,o,c){if(o!=null&&o.length>c/2+Ee.MAX_ERRORS||c<0||c>Ee.MAX_EC_CODEWORDS)throw C.getChecksumInstance();return Ee.errorCorrection.decode(i,c,o)}static verifyCodewordCount(i,o){if(i.length<4)throw U.getFormatInstance();let c=i[0];if(c>i.length)throw U.getFormatInstance();if(c===0)if(o<i.length)i[0]=i.length-o;else throw U.getFormatInstance()}static getBitCountForCodeword(i){let o=new Int32Array(8),c=0,u=o.length-1;for(;!((i&1)!==c&&(c=i&1,u--,u<0));)o[u]++,i>>=1;return o}static getCodewordBucketNumber(i){return i instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(i):this.getCodewordBucketNumber_number(i)}static getCodewordBucketNumber_number(i){return Ee.getCodewordBucketNumber(Ee.getBitCountForCodeword(i))}static getCodewordBucketNumber_Int32Array(i){return(i[0]-i[2]+i[4]-i[6]+9)%9}static toString(i){let o=new In;for(let c=0;c<i.length;c++){o.format("Row %2d: ",c);for(let u=0;u<i[c].length;u++){let l=i[c][u];l.getValue().length===0?o.format(" ",null):o.format("%4d(%2d)",l.getValue()[0],l.getConfidence(l.getValue()[0]))}o.format("%n")}return o.toString()}}Ee.CODEWORD_SKEW_SIZE=2,Ee.MAX_ERRORS=3,Ee.MAX_EC_CODEWORDS=512,Ee.errorCorrection=new Ba;class bt{decode(i,o=null){let c=bt.decode(i,o,!1);if(c==null||c.length===0||c[0]==null)throw X.getNotFoundInstance();return c[0]}decodeMultiple(i,o=null){try{return bt.decode(i,o,!0)}catch(c){throw c instanceof U||c instanceof C?X.getNotFoundInstance():c}}static decode(i,o,c){const u=new Array,l=ye.detectMultiple(i,o,c);for(const d of l.getPoints()){const p=Ee.decode(l.getBits(),d[4],d[5],d[6],d[7],bt.getMinCodewordWidth(d),bt.getMaxCodewordWidth(d)),v=new Ft(p.getText(),p.getRawBytes(),void 0,d,pe.PDF_417);v.putMetadata(wt.ERROR_CORRECTION_LEVEL,p.getECLevel());const y=p.getOther();y!=null&&v.putMetadata(wt.PDF417_EXTRA_METADATA,y),u.push(v)}return u.map(d=>d)}static getMaxWidth(i,o){return i==null||o==null?0:Math.trunc(Math.abs(i.getX()-o.getX()))}static getMinWidth(i,o){return i==null||o==null?L.MAX_VALUE:Math.trunc(Math.abs(i.getX()-o.getX()))}static getMaxCodewordWidth(i){return Math.floor(Math.max(Math.max(bt.getMaxWidth(i[0],i[4]),bt.getMaxWidth(i[6],i[2])*we.MODULES_IN_CODEWORD/we.MODULES_IN_STOP_PATTERN),Math.max(bt.getMaxWidth(i[1],i[5]),bt.getMaxWidth(i[7],i[3])*we.MODULES_IN_CODEWORD/we.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(i){return Math.floor(Math.min(Math.min(bt.getMinWidth(i[0],i[4]),bt.getMinWidth(i[6],i[2])*we.MODULES_IN_CODEWORD/we.MODULES_IN_STOP_PATTERN),Math.min(bt.getMinWidth(i[1],i[5]),bt.getMinWidth(i[7],i[3])*we.MODULES_IN_CODEWORD/we.MODULES_IN_STOP_PATTERN)))}reset(){}}class Qn extends g{}Qn.kind="ReaderException";class Ha{constructor(i,o){this.verbose=i===!0,o&&this.setHints(o)}decode(i,o){return o&&this.setHints(o),this.decodeInternal(i)}decodeWithState(i){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(i)}setHints(i){this.hints=i;const o=!n(i)&&i.get(K.TRY_HARDER)===!0,c=n(i)?null:i.get(K.POSSIBLE_FORMATS),u=new Array;if(!n(c)){const l=c.some(d=>d===pe.UPC_A||d===pe.UPC_E||d===pe.EAN_13||d===pe.EAN_8||d===pe.CODABAR||d===pe.CODE_39||d===pe.CODE_93||d===pe.CODE_128||d===pe.ITF||d===pe.RSS_14||d===pe.RSS_EXPANDED);l&&!o&&u.push(new cn(i,this.verbose)),c.includes(pe.QR_CODE)&&u.push(new Lr),c.includes(pe.DATA_MATRIX)&&u.push(new Br),c.includes(pe.AZTEC)&&u.push(new zn),c.includes(pe.PDF_417)&&u.push(new bt),l&&o&&u.push(new cn(i,this.verbose))}u.length===0&&(o||u.push(new cn(i,this.verbose)),u.push(new Lr),u.push(new Br),u.push(new zn),u.push(new bt),o&&u.push(new cn(i,this.verbose))),this.readers=u}reset(){if(this.readers!==null)for(const i of this.readers)i.reset()}decodeInternal(i){if(this.readers===null)throw new Qn("No readers where selected, nothing can be read.");for(const o of this.readers)try{return o.decode(i,this.hints)}catch(c){if(c instanceof Qn)continue}throw new X("No MultiFormat Readers were able to detect the code.")}}class b1 extends Wr{constructor(i=null,o=500){const c=new Ha;c.setHints(i),super(c,o)}decodeBitmap(i){return this.reader.decodeWithState(i)}}class T1 extends Wr{constructor(i=500){super(new bt,i)}}class O1 extends Wr{constructor(i=500){super(new Lr,i)}}var Li;(function(m){m[m.ERROR_CORRECTION=0]="ERROR_CORRECTION",m[m.CHARACTER_SET=1]="CHARACTER_SET",m[m.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",m[m.MIN_SIZE=3]="MIN_SIZE",m[m.MAX_SIZE=4]="MAX_SIZE",m[m.MARGIN=5]="MARGIN",m[m.PDF417_COMPACT=6]="PDF417_COMPACT",m[m.PDF417_COMPACTION=7]="PDF417_COMPACTION",m[m.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",m[m.AZTEC_LAYERS=9]="AZTEC_LAYERS",m[m.QR_VERSION=10]="QR_VERSION"})(Li||(Li={}));var lt=Li;class Fi{constructor(i){this.field=i,this.cachedGenerators=[],this.cachedGenerators.push(new Wt(i,Int32Array.from([1])))}buildGenerator(i){const o=this.cachedGenerators;if(i>=o.length){let c=o[o.length-1];const u=this.field;for(let l=o.length;l<=i;l++){const d=c.multiply(new Wt(u,Int32Array.from([1,u.exp(l-1+u.getGeneratorBase())])));o.push(d),c=d}}return o[i]}encode(i,o){if(o===0)throw new A("No error correction bytes");const c=i.length-o;if(c<=0)throw new A("No data bytes provided");const u=this.buildGenerator(o),l=new Int32Array(c);T.arraycopy(i,0,l,0,c);let d=new Wt(this.field,l);d=d.multiplyByMonomial(o,1);const v=d.divide(u)[1].getCoefficients(),y=o-v.length;for(let _=0;_<y;_++)i[c+_]=0;T.arraycopy(v,0,i,c+y,v.length)}}class at{constructor(){}static applyMaskPenaltyRule1(i){return at.applyMaskPenaltyRule1Internal(i,!0)+at.applyMaskPenaltyRule1Internal(i,!1)}static applyMaskPenaltyRule2(i){let o=0;const c=i.getArray(),u=i.getWidth(),l=i.getHeight();for(let d=0;d<l-1;d++){const p=c[d];for(let v=0;v<u-1;v++){const y=p[v];y===p[v+1]&&y===c[d+1][v]&&y===c[d+1][v+1]&&o++}}return at.N2*o}static applyMaskPenaltyRule3(i){let o=0;const c=i.getArray(),u=i.getWidth(),l=i.getHeight();for(let d=0;d<l;d++)for(let p=0;p<u;p++){const v=c[d];p+6<u&&v[p]===1&&v[p+1]===0&&v[p+2]===1&&v[p+3]===1&&v[p+4]===1&&v[p+5]===0&&v[p+6]===1&&(at.isWhiteHorizontal(v,p-4,p)||at.isWhiteHorizontal(v,p+7,p+11))&&o++,d+6<l&&c[d][p]===1&&c[d+1][p]===0&&c[d+2][p]===1&&c[d+3][p]===1&&c[d+4][p]===1&&c[d+5][p]===0&&c[d+6][p]===1&&(at.isWhiteVertical(c,p,d-4,d)||at.isWhiteVertical(c,p,d+7,d+11))&&o++}return o*at.N3}static isWhiteHorizontal(i,o,c){o=Math.max(o,0),c=Math.min(c,i.length);for(let u=o;u<c;u++)if(i[u]===1)return!1;return!0}static isWhiteVertical(i,o,c,u){c=Math.max(c,0),u=Math.min(u,i.length);for(let l=c;l<u;l++)if(i[l][o]===1)return!1;return!0}static applyMaskPenaltyRule4(i){let o=0;const c=i.getArray(),u=i.getWidth(),l=i.getHeight();for(let v=0;v<l;v++){const y=c[v];for(let _=0;_<u;_++)y[_]===1&&o++}const d=i.getHeight()*i.getWidth();return Math.floor(Math.abs(o*2-d)*10/d)*at.N4}static getDataMaskBit(i,o,c){let u,l;switch(i){case 0:u=c+o&1;break;case 1:u=c&1;break;case 2:u=o%3;break;case 3:u=(c+o)%3;break;case 4:u=Math.floor(c/2)+Math.floor(o/3)&1;break;case 5:l=c*o,u=(l&1)+l%3;break;case 6:l=c*o,u=(l&1)+l%3&1;break;case 7:l=c*o,u=l%3+(c+o&1)&1;break;default:throw new A("Invalid mask pattern: "+i)}return u===0}static applyMaskPenaltyRule1Internal(i,o){let c=0;const u=o?i.getHeight():i.getWidth(),l=o?i.getWidth():i.getHeight(),d=i.getArray();for(let p=0;p<u;p++){let v=0,y=-1;for(let _=0;_<l;_++){const I=o?d[p][_]:d[_][p];I===y?v++:(v>=5&&(c+=at.N1+(v-5)),v=1,y=I)}v>=5&&(c+=at.N1+(v-5))}return c}}at.N1=3,at.N2=3,at.N3=40,at.N4=10;class Jn{constructor(i,o){this.width=i,this.height=o;const c=new Array(o);for(let u=0;u!==o;u++)c[u]=new Uint8Array(i);this.bytes=c}getHeight(){return this.height}getWidth(){return this.width}get(i,o){return this.bytes[o][i]}getArray(){return this.bytes}setNumber(i,o,c){this.bytes[o][i]=c}setBoolean(i,o,c){this.bytes[o][i]=c?1:0}clear(i){for(const o of this.bytes)D.fill(o,i)}equals(i){if(!(i instanceof Jn))return!1;const o=i;if(this.width!==o.width||this.height!==o.height)return!1;for(let c=0,u=this.height;c<u;++c){const l=this.bytes[c],d=o.bytes[c];for(let p=0,v=this.width;p<v;++p)if(l[p]!==d[p])return!1}return!0}toString(){const i=new ne;for(let o=0,c=this.height;o<c;++o){const u=this.bytes[o];for(let l=0,d=this.width;l<d;++l)switch(u[l]){case 0:i.append(" 0");break;case 1:i.append(" 1");break;default:i.append(" ");break}i.append(`
|
||
`)}return i.toString()}}class Kr{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(){const i=new ne;return i.append(`<<
|
||
`),i.append(" mode: "),i.append(this.mode?this.mode.toString():"null"),i.append(`
|
||
ecLevel: `),i.append(this.ecLevel?this.ecLevel.toString():"null"),i.append(`
|
||
version: `),i.append(this.version?this.version.toString():"null"),i.append(`
|
||
maskPattern: `),i.append(this.maskPattern.toString()),this.matrix?(i.append(`
|
||
matrix:
|
||
`),i.append(this.matrix.toString())):i.append(`
|
||
matrix: null
|
||
`),i.append(`>>
|
||
`),i.toString()}setMode(i){this.mode=i}setECLevel(i){this.ecLevel=i}setVersion(i){this.version=i}setMaskPattern(i){this.maskPattern=i}setMatrix(i){this.matrix=i}static isValidMaskPattern(i){return i>=0&&i<Kr.NUM_MASK_PATTERNS}}Kr.NUM_MASK_PATTERNS=8;class ze extends g{}ze.kind="WriterException";class ve{constructor(){}static clearMatrix(i){i.clear(255)}static buildMatrix(i,o,c,u,l){ve.clearMatrix(l),ve.embedBasicPatterns(c,l),ve.embedTypeInfo(o,u,l),ve.maybeEmbedVersionInfo(c,l),ve.embedDataBits(i,u,l)}static embedBasicPatterns(i,o){ve.embedPositionDetectionPatternsAndSeparators(o),ve.embedDarkDotAtLeftBottomCorner(o),ve.maybeEmbedPositionAdjustmentPatterns(i,o),ve.embedTimingPatterns(o)}static embedTypeInfo(i,o,c){const u=new k;ve.makeTypeInfoBits(i,o,u);for(let l=0,d=u.getSize();l<d;++l){const p=u.get(u.getSize()-1-l),v=ve.TYPE_INFO_COORDINATES[l],y=v[0],_=v[1];if(c.setBoolean(y,_,p),l<8){const I=c.getWidth()-l-1;c.setBoolean(I,8,p)}else{const S=c.getHeight()-7+(l-8);c.setBoolean(8,S,p)}}}static maybeEmbedVersionInfo(i,o){if(i.getVersionNumber()<7)return;const c=new k;ve.makeVersionInfoBits(i,c);let u=17;for(let l=0;l<6;++l)for(let d=0;d<3;++d){const p=c.get(u);u--,o.setBoolean(l,o.getHeight()-11+d,p),o.setBoolean(o.getHeight()-11+d,l,p)}}static embedDataBits(i,o,c){let u=0,l=-1,d=c.getWidth()-1,p=c.getHeight()-1;for(;d>0;){for(d===6&&(d-=1);p>=0&&p<c.getHeight();){for(let v=0;v<2;++v){const y=d-v;if(!ve.isEmpty(c.get(y,p)))continue;let _;u<i.getSize()?(_=i.get(u),++u):_=!1,o!==255&&at.getDataMaskBit(o,y,p)&&(_=!_),c.setBoolean(y,p,_)}p+=l}l=-l,p+=l,d-=2}if(u!==i.getSize())throw new ze("Not all bits consumed: "+u+"/"+i.getSize())}static findMSBSet(i){return 32-L.numberOfLeadingZeros(i)}static calculateBCHCode(i,o){if(o===0)throw new A("0 polynomial");const c=ve.findMSBSet(o);for(i<<=c-1;ve.findMSBSet(i)>=c;)i^=o<<ve.findMSBSet(i)-c;return i}static makeTypeInfoBits(i,o,c){if(!Kr.isValidMaskPattern(o))throw new ze("Invalid mask pattern");const u=i.getBits()<<3|o;c.appendBits(u,5);const l=ve.calculateBCHCode(u,ve.TYPE_INFO_POLY);c.appendBits(l,10);const d=new k;if(d.appendBits(ve.TYPE_INFO_MASK_PATTERN,15),c.xor(d),c.getSize()!==15)throw new ze("should not happen but we got: "+c.getSize())}static makeVersionInfoBits(i,o){o.appendBits(i.getVersionNumber(),6);const c=ve.calculateBCHCode(i.getVersionNumber(),ve.VERSION_INFO_POLY);if(o.appendBits(c,12),o.getSize()!==18)throw new ze("should not happen but we got: "+o.getSize())}static isEmpty(i){return i===255}static embedTimingPatterns(i){for(let o=8;o<i.getWidth()-8;++o){const c=(o+1)%2;ve.isEmpty(i.get(o,6))&&i.setNumber(o,6,c),ve.isEmpty(i.get(6,o))&&i.setNumber(6,o,c)}}static embedDarkDotAtLeftBottomCorner(i){if(i.get(8,i.getHeight()-8)===0)throw new ze;i.setNumber(8,i.getHeight()-8,1)}static embedHorizontalSeparationPattern(i,o,c){for(let u=0;u<8;++u){if(!ve.isEmpty(c.get(i+u,o)))throw new ze;c.setNumber(i+u,o,0)}}static embedVerticalSeparationPattern(i,o,c){for(let u=0;u<7;++u){if(!ve.isEmpty(c.get(i,o+u)))throw new ze;c.setNumber(i,o+u,0)}}static embedPositionAdjustmentPattern(i,o,c){for(let u=0;u<5;++u){const l=ve.POSITION_ADJUSTMENT_PATTERN[u];for(let d=0;d<5;++d)c.setNumber(i+d,o+u,l[d])}}static embedPositionDetectionPattern(i,o,c){for(let u=0;u<7;++u){const l=ve.POSITION_DETECTION_PATTERN[u];for(let d=0;d<7;++d)c.setNumber(i+d,o+u,l[d])}}static embedPositionDetectionPatternsAndSeparators(i){const o=ve.POSITION_DETECTION_PATTERN[0].length;ve.embedPositionDetectionPattern(0,0,i),ve.embedPositionDetectionPattern(i.getWidth()-o,0,i),ve.embedPositionDetectionPattern(0,i.getWidth()-o,i);const c=8;ve.embedHorizontalSeparationPattern(0,c-1,i),ve.embedHorizontalSeparationPattern(i.getWidth()-c,c-1,i),ve.embedHorizontalSeparationPattern(0,i.getWidth()-c,i);const u=7;ve.embedVerticalSeparationPattern(u,0,i),ve.embedVerticalSeparationPattern(i.getHeight()-u-1,0,i),ve.embedVerticalSeparationPattern(u,i.getHeight()-u,i)}static maybeEmbedPositionAdjustmentPatterns(i,o){if(i.getVersionNumber()<2)return;const c=i.getVersionNumber()-1,u=ve.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[c];for(let l=0,d=u.length;l!==d;l++){const p=u[l];if(p>=0)for(let v=0;v!==d;v++){const y=u[v];y>=0&&ve.isEmpty(o.get(y,p))&&ve.embedPositionAdjustmentPattern(y-2,p-2,o)}}}}ve.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])]),ve.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])]),ve.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])]),ve.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])]),ve.VERSION_INFO_POLY=7973,ve.TYPE_INFO_POLY=1335,ve.TYPE_INFO_MASK_PATTERN=21522;class N1{constructor(i,o){this.dataBytes=i,this.errorCorrectionBytes=o}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class qe{constructor(){}static calculateMaskPenalty(i){return at.applyMaskPenaltyRule1(i)+at.applyMaskPenaltyRule2(i)+at.applyMaskPenaltyRule3(i)+at.applyMaskPenaltyRule4(i)}static encode(i,o,c=null){let u=qe.DEFAULT_BYTE_MODE_ENCODING;const l=c!==null&&c.get(lt.CHARACTER_SET)!==void 0;l&&(u=c.get(lt.CHARACTER_SET).toString());const d=this.chooseMode(i,u),p=new k;if(d===de.BYTE&&(l||qe.DEFAULT_BYTE_MODE_ENCODING!==u)){const te=Y.getCharacterSetECIByName(u);te!==void 0&&this.appendECI(te,p)}this.appendModeInfo(d,p);const v=new k;this.appendBytes(i,d,v,u);let y;if(c!==null&&c.get(lt.QR_VERSION)!==void 0){const te=Number.parseInt(c.get(lt.QR_VERSION).toString(),10);y=he.getVersionForNumber(te);const J=this.calculateBitsNeeded(d,p,v,y);if(!this.willFit(J,y,o))throw new ze("Data too big for requested version")}else y=this.recommendVersion(o,d,p,v);const _=new k;_.appendBitArray(p);const I=d===de.BYTE?v.getSizeInBytes():i.length;this.appendLengthInfo(I,y,d,_),_.appendBitArray(v);const S=y.getECBlocksForLevel(o),R=y.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(R,_);const M=this.interleaveWithECBytes(_,y.getTotalCodewords(),R,S.getNumBlocks()),B=new Kr;B.setECLevel(o),B.setMode(d),B.setVersion(y);const V=y.getDimensionForVersion(),z=new Jn(V,V),ee=this.chooseMaskPattern(M,o,y,z);return B.setMaskPattern(ee),ve.buildMatrix(M,o,y,ee,z),B.setMatrix(z),B}static recommendVersion(i,o,c,u){const l=this.calculateBitsNeeded(o,c,u,he.getVersionForNumber(1)),d=this.chooseVersion(l,i),p=this.calculateBitsNeeded(o,c,u,d);return this.chooseVersion(p,i)}static calculateBitsNeeded(i,o,c,u){return o.getSize()+i.getCharacterCountBits(u)+c.getSize()}static getAlphanumericCode(i){return i<qe.ALPHANUMERIC_TABLE.length?qe.ALPHANUMERIC_TABLE[i]:-1}static chooseMode(i,o=null){if(Y.SJIS.getName()===o&&this.isOnlyDoubleByteKanji(i))return de.KANJI;let c=!1,u=!1;for(let l=0,d=i.length;l<d;++l){const p=i.charAt(l);if(qe.isDigit(p))c=!0;else if(this.getAlphanumericCode(p.charCodeAt(0))!==-1)u=!0;else return de.BYTE}return u?de.ALPHANUMERIC:c?de.NUMERIC:de.BYTE}static isOnlyDoubleByteKanji(i){let o;try{o=_e.encode(i,Y.SJIS)}catch{return!1}const c=o.length;if(c%2!==0)return!1;for(let u=0;u<c;u+=2){const l=o[u]&255;if((l<129||l>159)&&(l<224||l>235))return!1}return!0}static chooseMaskPattern(i,o,c,u){let l=Number.MAX_SAFE_INTEGER,d=-1;for(let p=0;p<Kr.NUM_MASK_PATTERNS;p++){ve.buildMatrix(i,o,c,p,u);let v=this.calculateMaskPenalty(u);v<l&&(l=v,d=p)}return d}static chooseVersion(i,o){for(let c=1;c<=40;c++){const u=he.getVersionForNumber(c);if(qe.willFit(i,u,o))return u}throw new ze("Data too big")}static willFit(i,o,c){const u=o.getTotalCodewords(),d=o.getECBlocksForLevel(c).getTotalECCodewords(),p=u-d,v=(i+7)/8;return p>=v}static terminateBits(i,o){const c=i*8;if(o.getSize()>c)throw new ze("data bits cannot fit in the QR Code"+o.getSize()+" > "+c);for(let d=0;d<4&&o.getSize()<c;++d)o.appendBit(!1);const u=o.getSize()&7;if(u>0)for(let d=u;d<8;d++)o.appendBit(!1);const l=i-o.getSizeInBytes();for(let d=0;d<l;++d)o.appendBits((d&1)===0?236:17,8);if(o.getSize()!==c)throw new ze("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(i,o,c,u,l,d){if(u>=c)throw new ze("Block ID too large");const p=i%c,v=c-p,y=Math.floor(i/c),_=y+1,I=Math.floor(o/c),S=I+1,R=y-I,M=_-S;if(R!==M)throw new ze("EC bytes mismatch");if(c!==v+p)throw new ze("RS blocks mismatch");if(i!==(I+R)*v+(S+M)*p)throw new ze("Total bytes mismatch");u<v?(l[0]=I,d[0]=R):(l[0]=S,d[0]=M)}static interleaveWithECBytes(i,o,c,u){if(i.getSizeInBytes()!==c)throw new ze("Number of bits and data bytes does not match");let l=0,d=0,p=0;const v=new Array;for(let _=0;_<u;++_){const I=new Int32Array(1),S=new Int32Array(1);qe.getNumDataBytesAndNumECBytesForBlockID(o,c,u,_,I,S);const R=I[0],M=new Uint8Array(R);i.toBytes(8*l,M,0,R);const B=qe.generateECBytes(M,S[0]);v.push(new N1(M,B)),d=Math.max(d,R),p=Math.max(p,B.length),l+=I[0]}if(c!==l)throw new ze("Data bytes does not match offset");const y=new k;for(let _=0;_<d;++_)for(const I of v){const S=I.getDataBytes();_<S.length&&y.appendBits(S[_],8)}for(let _=0;_<p;++_)for(const I of v){const S=I.getErrorCorrectionBytes();_<S.length&&y.appendBits(S[_],8)}if(o!==y.getSizeInBytes())throw new ze("Interleaving error: "+o+" and "+y.getSizeInBytes()+" differ.");return y}static generateECBytes(i,o){const c=i.length,u=new Int32Array(c+o);for(let d=0;d<c;d++)u[d]=i[d]&255;new Fi(Me.QR_CODE_FIELD_256).encode(u,o);const l=new Uint8Array(o);for(let d=0;d<o;d++)l[d]=u[c+d];return l}static appendModeInfo(i,o){o.appendBits(i.getBits(),4)}static appendLengthInfo(i,o,c,u){const l=c.getCharacterCountBits(o);if(i>=1<<l)throw new ze(i+" is bigger than "+((1<<l)-1));u.appendBits(i,l)}static appendBytes(i,o,c,u){switch(o){case de.NUMERIC:qe.appendNumericBytes(i,c);break;case de.ALPHANUMERIC:qe.appendAlphanumericBytes(i,c);break;case de.BYTE:qe.append8BitBytes(i,c,u);break;case de.KANJI:qe.appendKanjiBytes(i,c);break;default:throw new ze("Invalid mode: "+o)}}static getDigit(i){return i.charCodeAt(0)-48}static isDigit(i){const o=qe.getDigit(i);return o>=0&&o<=9}static appendNumericBytes(i,o){const c=i.length;let u=0;for(;u<c;){const l=qe.getDigit(i.charAt(u));if(u+2<c){const d=qe.getDigit(i.charAt(u+1)),p=qe.getDigit(i.charAt(u+2));o.appendBits(l*100+d*10+p,10),u+=3}else if(u+1<c){const d=qe.getDigit(i.charAt(u+1));o.appendBits(l*10+d,7),u+=2}else o.appendBits(l,4),u++}}static appendAlphanumericBytes(i,o){const c=i.length;let u=0;for(;u<c;){const l=qe.getAlphanumericCode(i.charCodeAt(u));if(l===-1)throw new ze;if(u+1<c){const d=qe.getAlphanumericCode(i.charCodeAt(u+1));if(d===-1)throw new ze;o.appendBits(l*45+d,11),u+=2}else o.appendBits(l,6),u++}}static append8BitBytes(i,o,c){let u;try{u=_e.encode(i,c)}catch(l){throw new ze(l)}for(let l=0,d=u.length;l!==d;l++){const p=u[l];o.appendBits(p,8)}}static appendKanjiBytes(i,o){let c;try{c=_e.encode(i,Y.SJIS)}catch(l){throw new ze(l)}const u=c.length;for(let l=0;l<u;l+=2){const d=c[l]&255,p=c[l+1]&255,v=d<<8&4294967295|p;let y=-1;if(v>=33088&&v<=40956?y=v-33088:v>=57408&&v<=60351&&(y=v-49472),y===-1)throw new ze("Invalid byte sequence");const _=(y>>8)*192+(y&255);o.appendBits(_,13)}}static appendECI(i,o){o.appendBits(de.ECI.getBits(),4),o.appendBits(i.getValue(),8)}}qe.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]),qe.DEFAULT_BYTE_MODE_ENCODING=Y.UTF8.getName();class qr{write(i,o,c,u=null){if(i.length===0)throw new A("Found empty contents");if(o<0||c<0)throw new A("Requested dimensions are too small: "+o+"x"+c);let l=je.L,d=qr.QUIET_ZONE_SIZE;u!==null&&(u.get(lt.ERROR_CORRECTION)!==void 0&&(l=je.fromString(u.get(lt.ERROR_CORRECTION).toString())),u.get(lt.MARGIN)!==void 0&&(d=Number.parseInt(u.get(lt.MARGIN).toString(),10)));const p=qe.encode(i,l,u);return this.renderResult(p,o,c,d)}writeToDom(i,o,c,u,l=null){typeof i=="string"&&(i=document.querySelector(i));const d=this.write(o,c,u,l);i&&i.appendChild(d)}renderResult(i,o,c,u){const l=i.getMatrix();if(l===null)throw new Ar;const d=l.getWidth(),p=l.getHeight(),v=d+u*2,y=p+u*2,_=Math.max(o,v),I=Math.max(c,y),S=Math.min(Math.floor(_/v),Math.floor(I/y)),R=Math.floor((_-d*S)/2),M=Math.floor((I-p*S)/2),B=this.createSVGElement(_,I);for(let V=0,z=M;V<p;V++,z+=S)for(let ee=0,te=R;ee<d;ee++,te+=S)if(l.get(ee,V)===1){const J=this.createSvgRectElement(te,z,S,S);B.appendChild(J)}return B}createSVGElement(i,o){const c=document.createElementNS(qr.SVG_NS,"svg");return c.setAttributeNS(null,"height",i.toString()),c.setAttributeNS(null,"width",o.toString()),c}createSvgRectElement(i,o,c,u){const l=document.createElementNS(qr.SVG_NS,"rect");return l.setAttributeNS(null,"x",i.toString()),l.setAttributeNS(null,"y",o.toString()),l.setAttributeNS(null,"height",c.toString()),l.setAttributeNS(null,"width",u.toString()),l.setAttributeNS(null,"fill","#000000"),l}}qr.QUIET_ZONE_SIZE=4,qr.SVG_NS="http://www.w3.org/2000/svg";class un{encode(i,o,c,u,l){if(i.length===0)throw new A("Found empty contents");if(o!==pe.QR_CODE)throw new A("Can only encode QR_CODE, but got "+o);if(c<0||u<0)throw new A(`Requested dimensions are too small: ${c}x${u}`);let d=je.L,p=un.QUIET_ZONE_SIZE;l!==null&&(l.get(lt.ERROR_CORRECTION)!==void 0&&(d=je.fromString(l.get(lt.ERROR_CORRECTION).toString())),l.get(lt.MARGIN)!==void 0&&(p=Number.parseInt(l.get(lt.MARGIN).toString(),10)));const v=qe.encode(i,d,l);return un.renderResult(v,c,u,p)}static renderResult(i,o,c,u){const l=i.getMatrix();if(l===null)throw new Ar;const d=l.getWidth(),p=l.getHeight(),v=d+u*2,y=p+u*2,_=Math.max(o,v),I=Math.max(c,y),S=Math.min(Math.floor(_/v),Math.floor(I/y)),R=Math.floor((_-d*S)/2),M=Math.floor((I-p*S)/2),B=new le(_,I);for(let V=0,z=M;V<p;V++,z+=S)for(let ee=0,te=R;ee<d;ee++,te+=S)l.get(ee,V)===1&&B.setRegion(te,z,S,S);return B}}un.QUIET_ZONE_SIZE=4;class R1{encode(i,o,c,u,l){let d;switch(o){case pe.QR_CODE:d=new un;break;default:throw new A("No encoder available for format "+o)}return d.encode(i,o,c,u,l)}}class _r extends rr{constructor(i,o,c,u,l,d,p,v){if(super(d,p),this.yuvData=i,this.dataWidth=o,this.dataHeight=c,this.left=u,this.top=l,u+d>o||l+p>c)throw new A("Crop rectangle does not fit within image data.");v&&this.reverseHorizontal(d,p)}getRow(i,o){if(i<0||i>=this.getHeight())throw new A("Requested row is outside the image: "+i);const c=this.getWidth();(o==null||o.length<c)&&(o=new Uint8ClampedArray(c));const u=(i+this.top)*this.dataWidth+this.left;return T.arraycopy(this.yuvData,u,o,0,c),o}getMatrix(){const i=this.getWidth(),o=this.getHeight();if(i===this.dataWidth&&o===this.dataHeight)return this.yuvData;const c=i*o,u=new Uint8ClampedArray(c);let l=this.top*this.dataWidth+this.left;if(i===this.dataWidth)return T.arraycopy(this.yuvData,l,u,0,c),u;for(let d=0;d<o;d++){const p=d*i;T.arraycopy(this.yuvData,l,u,p,i),l+=this.dataWidth}return u}isCropSupported(){return!0}crop(i,o,c,u){return new _r(this.yuvData,this.dataWidth,this.dataHeight,this.left+i,this.top+o,c,u,!1)}renderThumbnail(){const i=this.getWidth()/_r.THUMBNAIL_SCALE_FACTOR,o=this.getHeight()/_r.THUMBNAIL_SCALE_FACTOR,c=new Int32Array(i*o),u=this.yuvData;let l=this.top*this.dataWidth+this.left;for(let d=0;d<o;d++){const p=d*i;for(let v=0;v<i;v++){const y=u[l+v*_r.THUMBNAIL_SCALE_FACTOR]&255;c[p+v]=4278190080|y*65793}l+=this.dataWidth*_r.THUMBNAIL_SCALE_FACTOR}return c}getThumbnailWidth(){return this.getWidth()/_r.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/_r.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(i,o){const c=this.yuvData;for(let u=0,l=this.top*this.dataWidth+this.left;u<o;u++,l+=this.dataWidth){const d=l+i/2;for(let p=l,v=l+i-1;p<d;p++,v--){const y=c[p];c[p]=c[v],c[v]=y}}}invert(){return new nr(this)}}_r.THUMBNAIL_SCALE_FACTOR=2;class ki extends rr{constructor(i,o,c,u,l,d,p){if(super(o,c),this.dataWidth=u,this.dataHeight=l,this.left=d,this.top=p,i.BYTES_PER_ELEMENT===4){const v=o*c,y=new Uint8ClampedArray(v);for(let _=0;_<v;_++){const I=i[_],S=I>>16&255,R=I>>7&510,M=I&255;y[_]=(S+R+M)/4&255}this.luminances=y}else this.luminances=i;if(u===void 0&&(this.dataWidth=o),l===void 0&&(this.dataHeight=c),d===void 0&&(this.left=0),p===void 0&&(this.top=0),this.left+o>this.dataWidth||this.top+c>this.dataHeight)throw new A("Crop rectangle does not fit within image data.")}getRow(i,o){if(i<0||i>=this.getHeight())throw new A("Requested row is outside the image: "+i);const c=this.getWidth();(o==null||o.length<c)&&(o=new Uint8ClampedArray(c));const u=(i+this.top)*this.dataWidth+this.left;return T.arraycopy(this.luminances,u,o,0,c),o}getMatrix(){const i=this.getWidth(),o=this.getHeight();if(i===this.dataWidth&&o===this.dataHeight)return this.luminances;const c=i*o,u=new Uint8ClampedArray(c);let l=this.top*this.dataWidth+this.left;if(i===this.dataWidth)return T.arraycopy(this.luminances,l,u,0,c),u;for(let d=0;d<o;d++){const p=d*i;T.arraycopy(this.luminances,l,u,p,i),l+=this.dataWidth}return u}isCropSupported(){return!0}crop(i,o,c,u){return new ki(this.luminances,c,u,this.dataWidth,this.dataHeight,this.left+i,this.top+o)}invert(){return new nr(this)}}class Ga extends Y{static forName(i){return this.getCharacterSetECIByName(i)}}class Ui{}Ui.ISO_8859_1=Y.ISO8859_1;class Xa{isCompact(){return this.compact}setCompact(i){this.compact=i}getSize(){return this.size}setSize(i){this.size=i}getLayers(){return this.layers}setLayers(i){this.layers=i}getCodeWords(){return this.codeWords}setCodeWords(i){this.codeWords=i}getMatrix(){return this.matrix}setMatrix(i){this.matrix=i}}class Wa{static singletonList(i){return[i]}static min(i,o){return i.sort(o)[0]}}class D1{constructor(i){this.previous=i}getPrevious(){return this.previous}}class ln extends D1{constructor(i,o,c){super(i),this.value=o,this.bitCount=c}appendTo(i,o){i.appendBits(this.value,this.bitCount)}add(i,o){return new ln(this,i,o)}addBinaryShift(i,o){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new ln(this,i,o)}toString(){let i=this.value&(1<<this.bitCount)-1;return i|=1<<this.bitCount,"<"+L.toBinaryString(i|1<<this.bitCount).substring(1)+">"}}class Vi extends ln{constructor(i,o,c){super(i,0,0),this.binaryShiftStart=o,this.binaryShiftByteCount=c}appendTo(i,o){for(let c=0;c<this.binaryShiftByteCount;c++)(c===0||c===31&&this.binaryShiftByteCount<=62)&&(i.appendBits(31,5),this.binaryShiftByteCount>62?i.appendBits(this.binaryShiftByteCount-31,16):c===0?i.appendBits(Math.min(this.binaryShiftByteCount,31),5):i.appendBits(this.binaryShiftByteCount-31,5)),i.appendBits(o[this.binaryShiftStart+c],8)}addBinaryShift(i,o){return new Vi(this,i,o)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function M1(m,i,o){return new Vi(m,i,o)}function Nn(m,i,o){return new ln(m,i,o)}const P1=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],kr=0,$n=1,sr=2,za=3,mr=4,B1=new ln(null,0,0),Hi=[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 L1(m){for(let i of m)D.fill(i,-1);return m[kr][mr]=0,m[$n][mr]=0,m[$n][kr]=28,m[za][mr]=0,m[sr][mr]=0,m[sr][kr]=15,m}const Ya=L1(D.createInt32Array(6,6));class Ir{constructor(i,o,c,u){this.token=i,this.mode=o,this.binaryShiftByteCount=c,this.bitCount=u}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(i,o){let c=this.bitCount,u=this.token;if(i!==this.mode){let d=Hi[this.mode][i];u=Nn(u,d&65535,d>>16),c+=d>>16}let l=i===sr?4:5;return u=Nn(u,o,l),new Ir(u,i,0,c+l)}shiftAndAppend(i,o){let c=this.token,u=this.mode===sr?4:5;return c=Nn(c,Ya[this.mode][i],u),c=Nn(c,o,5),new Ir(c,this.mode,0,this.bitCount+u+5)}addBinaryShiftChar(i){let o=this.token,c=this.mode,u=this.bitCount;if(this.mode===mr||this.mode===sr){let p=Hi[c][kr];o=Nn(o,p&65535,p>>16),u+=p>>16,c=kr}let l=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new Ir(o,c,this.binaryShiftByteCount+1,u+l);return d.binaryShiftByteCount===2078&&(d=d.endBinaryShift(i+1)),d}endBinaryShift(i){if(this.binaryShiftByteCount===0)return this;let o=this.token;return o=M1(o,i-this.binaryShiftByteCount,this.binaryShiftByteCount),new Ir(o,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(i){let o=this.bitCount+(Hi[this.mode][i.mode]>>16);return this.binaryShiftByteCount<i.binaryShiftByteCount?o+=Ir.calculateBinaryShiftCost(i)-Ir.calculateBinaryShiftCost(this):this.binaryShiftByteCount>i.binaryShiftByteCount&&i.binaryShiftByteCount>0&&(o+=10),o<=i.bitCount}toBitArray(i){let o=[];for(let u=this.endBinaryShift(i.length).token;u!==null;u=u.getPrevious())o.unshift(u);let c=new k;for(const u of o)u.appendTo(c,i);return c}toString(){return Z.format("%s bits=%d bytes=%d",P1[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(i){return i.binaryShiftByteCount>62?21:i.binaryShiftByteCount>31?20:i.binaryShiftByteCount>0?10:0}}Ir.INITIAL_STATE=new Ir(B1,kr,0,0);function F1(m){const i=Z.getCharCode(" "),o=Z.getCharCode("."),c=Z.getCharCode(",");m[kr][i]=1;const u=Z.getCharCode("Z"),l=Z.getCharCode("A");for(let S=l;S<=u;S++)m[kr][S]=S-l+2;m[$n][i]=1;const d=Z.getCharCode("z"),p=Z.getCharCode("a");for(let S=p;S<=d;S++)m[$n][S]=S-p+2;m[sr][i]=1;const v=Z.getCharCode("9"),y=Z.getCharCode("0");for(let S=y;S<=v;S++)m[sr][S]=S-y+2;m[sr][c]=12,m[sr][o]=13;const _=["\0"," ","","","","","","","\x07","\b"," ",`
|
||
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<_.length;S++)m[za][Z.getCharCode(_[S])]=S;const I=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<I.length;S++)Z.getCharCode(I[S])>0&&(m[mr][Z.getCharCode(I[S])]=S);return m}const Gi=F1(D.createInt32Array(5,256));class Rn{constructor(i){this.text=i}encode(){const i=Z.getCharCode(" "),o=Z.getCharCode(`
|
||
`);let c=Wa.singletonList(Ir.INITIAL_STATE);for(let l=0;l<this.text.length;l++){let d,p=l+1<this.text.length?this.text[l+1]:0;switch(this.text[l]){case Z.getCharCode("\r"):d=p===o?2:0;break;case Z.getCharCode("."):d=p===i?3:0;break;case Z.getCharCode(","):d=p===i?4:0;break;case Z.getCharCode(":"):d=p===i?5:0;break;default:d=0}d>0?(c=Rn.updateStateListForPair(c,l,d),l++):c=this.updateStateListForChar(c,l)}return Wa.min(c,(l,d)=>l.getBitCount()-d.getBitCount()).toBitArray(this.text)}updateStateListForChar(i,o){const c=[];for(let u of i)this.updateStateForChar(u,o,c);return Rn.simplifyStates(c)}updateStateForChar(i,o,c){let u=this.text[o]&255,l=Gi[i.getMode()][u]>0,d=null;for(let p=0;p<=mr;p++){let v=Gi[p][u];if(v>0){if(d==null&&(d=i.endBinaryShift(o)),!l||p===i.getMode()||p===sr){const y=d.latchAndAppend(p,v);c.push(y)}if(!l&&Ya[i.getMode()][p]>=0){const y=d.shiftAndAppend(p,v);c.push(y)}}}if(i.getBinaryShiftByteCount()>0||Gi[i.getMode()][u]===0){let p=i.addBinaryShiftChar(o);c.push(p)}}static updateStateListForPair(i,o,c){const u=[];for(let l of i)this.updateStateForPair(l,o,c,u);return this.simplifyStates(u)}static updateStateForPair(i,o,c,u){let l=i.endBinaryShift(o);if(u.push(l.latchAndAppend(mr,c)),i.getMode()!==mr&&u.push(l.shiftAndAppend(mr,c)),c===3||c===4){let d=l.latchAndAppend(sr,16-c).latchAndAppend(sr,1);u.push(d)}if(i.getBinaryShiftByteCount()>0){let d=i.addBinaryShiftChar(o).addBinaryShiftChar(o+1);u.push(d)}}static simplifyStates(i){let o=[];for(const c of i){let u=!0;for(const l of o){if(l.isBetterThanOrEqualTo(c)){u=!1;break}c.isBetterThanOrEqualTo(l)&&(o=o.filter(d=>d!==l))}u&&o.push(c)}return o}}class Ne{constructor(){}static encodeBytes(i){return Ne.encode(i,Ne.DEFAULT_EC_PERCENT,Ne.DEFAULT_AZTEC_LAYERS)}static encode(i,o,c){let u=new Rn(i).encode(),l=L.truncDivision(u.getSize()*o,100)+11,d=u.getSize()+l,p,v,y,_,I;if(c!==Ne.DEFAULT_AZTEC_LAYERS){if(p=c<0,v=Math.abs(c),v>(p?Ne.MAX_NB_BITS_COMPACT:Ne.MAX_NB_BITS))throw new A(Z.format("Illegal value %s for layers",c));y=Ne.totalBitsInLayer(v,p),_=Ne.WORD_SIZE[v];let J=y-y%_;if(I=Ne.stuffBits(u,_),I.getSize()+l>J)throw new A("Data to large for user specified layer");if(p&&I.getSize()>_*64)throw new A("Data to large for user specified layer")}else{_=0,I=null;for(let J=0;;J++){if(J>Ne.MAX_NB_BITS)throw new A("Data too large for an Aztec code");if(p=J<=3,v=p?J+1:J,y=Ne.totalBitsInLayer(v,p),d>y)continue;(I==null||_!==Ne.WORD_SIZE[v])&&(_=Ne.WORD_SIZE[v],I=Ne.stuffBits(u,_));let Se=y-y%_;if(!(p&&I.getSize()>_*64)&&I.getSize()+l<=Se)break}}let S=Ne.generateCheckWords(I,y,_),R=I.getSize()/_,M=Ne.generateModeMessage(p,v,R),B=(p?11:14)+v*4,V=new Int32Array(B),z;if(p){z=B;for(let J=0;J<V.length;J++)V[J]=J}else{z=B+1+2*L.truncDivision(L.truncDivision(B,2)-1,15);let J=L.truncDivision(B,2),Se=L.truncDivision(z,2);for(let Ae=0;Ae<J;Ae++){let jt=Ae+L.truncDivision(Ae,15);V[J-Ae-1]=Se-jt-1,V[J+Ae]=Se+jt+1}}let ee=new le(z);for(let J=0,Se=0;J<v;J++){let Ae=(v-J)*4+(p?9:12);for(let jt=0;jt<Ae;jt++){let xr=jt*2;for(let Kt=0;Kt<2;Kt++)S.get(Se+xr+Kt)&&ee.set(V[J*2+Kt],V[J*2+jt]),S.get(Se+Ae*2+xr+Kt)&&ee.set(V[J*2+jt],V[B-1-J*2-Kt]),S.get(Se+Ae*4+xr+Kt)&&ee.set(V[B-1-J*2-Kt],V[B-1-J*2-jt]),S.get(Se+Ae*6+xr+Kt)&&ee.set(V[B-1-J*2-jt],V[J*2+Kt])}Se+=Ae*8}if(Ne.drawModeMessage(ee,p,z,M),p)Ne.drawBullsEye(ee,L.truncDivision(z,2),5);else{Ne.drawBullsEye(ee,L.truncDivision(z,2),7);for(let J=0,Se=0;J<L.truncDivision(B,2)-1;J+=15,Se+=16)for(let Ae=L.truncDivision(z,2)&1;Ae<z;Ae+=2)ee.set(L.truncDivision(z,2)-Se,Ae),ee.set(L.truncDivision(z,2)+Se,Ae),ee.set(Ae,L.truncDivision(z,2)-Se),ee.set(Ae,L.truncDivision(z,2)+Se)}let te=new Xa;return te.setCompact(p),te.setSize(z),te.setLayers(v),te.setCodeWords(R),te.setMatrix(ee),te}static drawBullsEye(i,o,c){for(let u=0;u<c;u+=2)for(let l=o-u;l<=o+u;l++)i.set(l,o-u),i.set(l,o+u),i.set(o-u,l),i.set(o+u,l);i.set(o-c,o-c),i.set(o-c+1,o-c),i.set(o-c,o-c+1),i.set(o+c,o-c),i.set(o+c,o-c+1),i.set(o+c,o+c-1)}static generateModeMessage(i,o,c){let u=new k;return i?(u.appendBits(o-1,2),u.appendBits(c-1,6),u=Ne.generateCheckWords(u,28,4)):(u.appendBits(o-1,5),u.appendBits(c-1,11),u=Ne.generateCheckWords(u,40,4)),u}static drawModeMessage(i,o,c,u){let l=L.truncDivision(c,2);if(o)for(let d=0;d<7;d++){let p=l-3+d;u.get(d)&&i.set(p,l-5),u.get(d+7)&&i.set(l+5,p),u.get(20-d)&&i.set(p,l+5),u.get(27-d)&&i.set(l-5,p)}else for(let d=0;d<10;d++){let p=l-5+d+L.truncDivision(d,5);u.get(d)&&i.set(p,l-7),u.get(d+10)&&i.set(l+7,p),u.get(29-d)&&i.set(p,l+7),u.get(39-d)&&i.set(l-7,p)}}static generateCheckWords(i,o,c){let u=i.getSize()/c,l=new Fi(Ne.getGF(c)),d=L.truncDivision(o,c),p=Ne.bitsToWords(i,c,d);l.encode(p,d-u);let v=o%c,y=new k;y.appendBits(0,v);for(const _ of Array.from(p))y.appendBits(_,c);return y}static bitsToWords(i,o,c){let u=new Int32Array(c),l,d;for(l=0,d=i.getSize()/o;l<d;l++){let p=0;for(let v=0;v<o;v++)p|=i.get(l*o+v)?1<<o-v-1:0;u[l]=p}return u}static getGF(i){switch(i){case 4:return Me.AZTEC_PARAM;case 6:return Me.AZTEC_DATA_6;case 8:return Me.AZTEC_DATA_8;case 10:return Me.AZTEC_DATA_10;case 12:return Me.AZTEC_DATA_12;default:throw new A("Unsupported word size "+i)}}static stuffBits(i,o){let c=new k,u=i.getSize(),l=(1<<o)-2;for(let d=0;d<u;d+=o){let p=0;for(let v=0;v<o;v++)(d+v>=u||i.get(d+v))&&(p|=1<<o-1-v);(p&l)===l?(c.appendBits(p&l,o),d--):(p&l)===0?(c.appendBits(p|1,o),d--):c.appendBits(p,o)}return c}static totalBitsInLayer(i,o){return((o?88:112)+16*i)*i}}Ne.DEFAULT_EC_PERCENT=33,Ne.DEFAULT_AZTEC_LAYERS=0,Ne.MAX_NB_BITS=32,Ne.MAX_NB_BITS_COMPACT=4,Ne.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 ei{encode(i,o,c,u){return this.encodeWithHints(i,o,c,u,null)}encodeWithHints(i,o,c,u,l){let d=Ui.ISO_8859_1,p=Ne.DEFAULT_EC_PERCENT,v=Ne.DEFAULT_AZTEC_LAYERS;return l!=null&&(l.has(lt.CHARACTER_SET)&&(d=Ga.forName(l.get(lt.CHARACTER_SET).toString())),l.has(lt.ERROR_CORRECTION)&&(p=L.parseInt(l.get(lt.ERROR_CORRECTION).toString())),l.has(lt.AZTEC_LAYERS)&&(v=L.parseInt(l.get(lt.AZTEC_LAYERS).toString()))),ei.encodeLayers(i,o,c,u,d,p,v)}static encodeLayers(i,o,c,u,l,d,p){if(o!==pe.AZTEC)throw new A("Can only encode AZTEC, but got "+o);let v=Ne.encode(Z.getBytes(i,l),d,p);return ei.renderResult(v,c,u)}static renderResult(i,o,c){let u=i.getMatrix();if(u==null)throw new Ar;let l=u.getWidth(),d=u.getHeight(),p=Math.max(o,l),v=Math.max(c,d),y=Math.min(p/l,v/d),_=(p-l*y)/2,I=(v-d*y)/2,S=new le(p,v);for(let R=0,M=I;R<d;R++,M+=y)for(let B=0,V=_;B<l;B++,V+=y)u.get(B,R)&&S.setRegion(V,M,y,y);return S}}t.AbstractExpandedDecoder=bi,t.ArgumentException=w,t.ArithmeticException=Gn,t.AztecCode=Xa,t.AztecCodeReader=zn,t.AztecCodeWriter=ei,t.AztecDecoder=Ze,t.AztecDetector=Oa,t.AztecDetectorResult=ba,t.AztecEncoder=Ne,t.AztecHighLevelEncoder=Rn,t.AztecPoint=kt,t.BarcodeFormat=pe,t.Binarizer=b,t.BinaryBitmap=E,t.BitArray=k,t.BitMatrix=le,t.BitSource=Ri,t.BrowserAztecCodeReader=f1,t.BrowserBarcodeReader=x1,t.BrowserCodeReader=Wr,t.BrowserDatamatrixCodeReader=p1,t.BrowserMultiFormatReader=b1,t.BrowserPDF417Reader=T1,t.BrowserQRCodeReader=O1,t.BrowserQRCodeSvgWriter=qr,t.CharacterSetECI=Y,t.ChecksumException=C,t.Code128Reader=ie,t.Code39Reader=ft,t.DataMatrixDecodedBitStreamParser=Pr,t.DataMatrixReader=Br,t.DecodeHintType=K,t.DecoderResult=yn,t.DefaultGridSampler=Ta,t.DetectorResult=Wn,t.EAN13Reader=zr,t.EncodeHintType=lt,t.Exception=g,t.FormatException=U,t.GenericGF=Me,t.GenericGFPoly=Wt,t.GlobalHistogramBinarizer=me,t.GridSampler=_i,t.GridSamplerInstance=Dr,t.HTMLCanvasElementLuminanceSource=Rr,t.HybridBinarizer=ge,t.ITFReader=We,t.IllegalArgumentException=A,t.IllegalStateException=Ar,t.InvertedLuminanceSource=nr,t.LuminanceSource=rr,t.MathUtils=Oe,t.MultiFormatOneDReader=cn,t.MultiFormatReader=Ha,t.MultiFormatWriter=R1,t.NotFoundException=X,t.OneDReader=ct,t.PDF417DecodedBitStreamParser=W,t.PDF417DecoderErrorCorrection=Ba,t.PDF417Reader=bt,t.PDF417ResultMetadata=Fa,t.PerspectiveTransform=hr,t.PlanarYUVLuminanceSource=_r,t.QRCodeByteMatrix=Jn,t.QRCodeDataMask=ar,t.QRCodeDecodedBitStreamParser=rt,t.QRCodeDecoderErrorCorrectionLevel=je,t.QRCodeDecoderFormatInformation=Mt,t.QRCodeEncoder=qe,t.QRCodeEncoderQRCode=Kr,t.QRCodeMaskUtil=at,t.QRCodeMatrixUtil=ve,t.QRCodeMode=de,t.QRCodeReader=Lr,t.QRCodeVersion=he,t.QRCodeWriter=un,t.RGBLuminanceSource=ki,t.RSS14Reader=it,t.RSSExpandedReader=Q,t.ReaderException=Qn,t.ReedSolomonDecoder=Cn,t.ReedSolomonEncoder=Fi,t.ReedSolomonException=nn,t.Result=Ft,t.ResultMetadataType=wt,t.ResultPoint=fe,t.StringUtils=Z,t.UnsupportedOperationException=ue,t.VideoInputDevice=Sa,t.WhiteRectangleDetector=Tr,t.WriterException=ze,t.ZXingArrays=D,t.ZXingCharset=Ga,t.ZXingInteger=L,t.ZXingStandardCharsets=Ui,t.ZXingStringBuilder=ne,t.ZXingStringEncoding=_e,t.ZXingSystem=T,t.createAbstractExpandedDecoder=Ma,Object.defineProperty(t,"__esModule",{value:!0})}))})(Bn,Bn.exports)),Bn.exports}var Qe=as();const os=G1(Qe),ss=K1({__proto__:null,default:os},[Qe]);var to=(function(){function r(e,t,n){if(this.formatMap=new Map([[oe.QR_CODE,Qe.BarcodeFormat.QR_CODE],[oe.AZTEC,Qe.BarcodeFormat.AZTEC],[oe.CODABAR,Qe.BarcodeFormat.CODABAR],[oe.CODE_39,Qe.BarcodeFormat.CODE_39],[oe.CODE_93,Qe.BarcodeFormat.CODE_93],[oe.CODE_128,Qe.BarcodeFormat.CODE_128],[oe.DATA_MATRIX,Qe.BarcodeFormat.DATA_MATRIX],[oe.MAXICODE,Qe.BarcodeFormat.MAXICODE],[oe.ITF,Qe.BarcodeFormat.ITF],[oe.EAN_13,Qe.BarcodeFormat.EAN_13],[oe.EAN_8,Qe.BarcodeFormat.EAN_8],[oe.PDF_417,Qe.BarcodeFormat.PDF_417],[oe.RSS_14,Qe.BarcodeFormat.RSS_14],[oe.RSS_EXPANDED,Qe.BarcodeFormat.RSS_EXPANDED],[oe.UPC_A,Qe.BarcodeFormat.UPC_A],[oe.UPC_E,Qe.BarcodeFormat.UPC_E],[oe.UPC_EAN_EXTENSION,Qe.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!ss)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=n;var a=this.createZXingFormats(e),s=new Map;s.set(Qe.DecodeHintType.POSSIBLE_FORMATS,a),s.set(Qe.DecodeHintType.TRY_HARDER,!1),this.hints=s}return r.prototype.decodeAsync=function(e){var t=this;return new Promise(function(n,a){try{n(t.decode(e))}catch(s){a(s)}})},r.prototype.decode=function(e){var t=new Qe.MultiFormatReader(this.verbose,this.hints),n=new Qe.HTMLCanvasElementLuminanceSource(e),a=new Qe.BinaryBitmap(new Qe.HybridBinarizer(n)),s=t.decode(a);return{text:s.text,format:Yo.create(this.toHtml5QrcodeSupportedFormats(s.format)),debugData:this.createDebugData()}},r.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,a){e.set(t,n)}),e},r.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},r.prototype.createZXingFormats=function(e){for(var t=[],n=0,a=e;n<a.length;n++){var s=a[n];this.formatMap.has(s)?t.push(this.formatMap.get(s)):this.logger.logError("".concat(s," is not supported by")+"ZXingHtml5QrcodeShim")}return t},r.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},r})(),cs=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},fs=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,g[0]&&(t=0)),t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},ro=(function(){function r(e,t,n){if(this.formatMap=new Map([[oe.QR_CODE,"qr_code"],[oe.AZTEC,"aztec"],[oe.CODABAR,"codabar"],[oe.CODE_39,"code_39"],[oe.CODE_93,"code_93"],[oe.CODE_128,"code_128"],[oe.DATA_MATRIX,"data_matrix"],[oe.ITF,"itf"],[oe.EAN_13,"ean_13"],[oe.EAN_8,"ean_8"],[oe.PDF_417,"pdf417"],[oe.UPC_A,"upc_a"],[oe.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!r.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=t,this.logger=n;var a=this.createBarcodeDetectorFormats(e);if(this.detector=new BarcodeDetector(a),!this.detector)throw"BarcodeDetector detector not supported"}return r.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var e=new BarcodeDetector({formats:["qr_code"]});return typeof e<"u"},r.prototype.decodeAsync=function(e){return cs(this,void 0,void 0,function(){var t,n;return fs(this,function(a){switch(a.label){case 0:return[4,this.detector.detect(e)];case 1:if(t=a.sent(),!t||t.length===0)throw"No barcode or QR code detected.";return n=this.selectLargestBarcode(t),[2,{text:n.rawValue,format:Yo.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},r.prototype.selectLargestBarcode=function(e){for(var t=null,n=0,a=0,s=e;a<s.length;a++){var f=s[a],h=f.boundingBox.width*f.boundingBox.height;h>n&&(n=h,t=f)}if(!t)throw"No largest barcode found";return t},r.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],n=0,a=e;n<a.length;n++){var s=a[n];this.formatMap.has(s)?t.push(this.formatMap.get(s)):this.logger.warn("".concat(s," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},r.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},r.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,a){e.set(t,n)}),e},r.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},r})(),no=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},io=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,g[0]&&(t=0)),t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},us=(function(){function r(e,t,n,a){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,t&&ro.isSupported()?(this.primaryDecoder=new ro(e,n,a),this.secondaryDecoder=new to(e,n,a)):this.primaryDecoder=new to(e,n,a)}return r.prototype.decodeAsync=function(e){return no(this,void 0,void 0,function(){var t;return io(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},r.prototype.decodeRobustlyAsync=function(e){return no(this,void 0,void 0,function(){var t,n;return io(this,function(a){switch(a.label){case 0:t=performance.now(),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,a.sent()];case 3:if(n=a.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw n;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},r.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},r.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},r.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,n=this.executionResults;t<n.length;t++){var a=n[t];e+=a}var s=e/this.executionResults.length;console.log("".concat(s," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},r})(),va=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(n[s]=a[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),di=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},xi=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,g[0]&&(t=0)),t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},jo=(function(){function r(e,t){this.name=e,this.track=t}return r.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},r.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},r.prototype.value=function(){var e=this.track.getSettings();if(this.name in e){var t=e[this.name];return t}return null},r})(),ls=(function(r){va(e,r);function e(t,n){return r.call(this,t,n)||this}return e.prototype.min=function(){return this.getCapabilities().min},e.prototype.max=function(){return this.getCapabilities().max},e.prototype.step=function(){return this.getCapabilities().step},e.prototype.apply=function(t){var n={};n[this.name]=t;var a={advanced:[n]};return this.track.applyConstraints(a)},e.prototype.getCapabilities=function(){this.failIfNotSupported();var t=this.track.getCapabilities(),n=t[this.name];return{min:n.min,max:n.max,step:n.step}},e.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},e})(jo),hs=(function(r){va(e,r);function e(t){return r.call(this,"zoom",t)||this}return e})(ls),ds=(function(r){va(e,r);function e(t){return r.call(this,"torch",t)||this}return e})(jo),xs=(function(){function r(e){this.track=e}return r.prototype.zoomFeature=function(){return new hs(this.track)},r.prototype.torchFeature=function(){return new ds(this.track)},r})(),gs=(function(){function r(e,t,n){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return r.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},r.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var n=e.surface.clientWidth,a=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(n,a),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},r.create=function(e,t,n,a){return di(this,void 0,void 0,function(){var s,f;return xi(this,function(h){switch(h.label){case 0:return s=new r(e,t,a),n.aspectRatio?(f={aspectRatio:n.aspectRatio},[4,s.getFirstTrackOrFail().applyConstraints(f)]):[3,2];case 1:h.sent(),h.label=2;case 2:return s.setupSurface(),[2,s]}})})},r.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},r.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},r.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},r.prototype.resume=function(e){this.failIfClosed();var t=this,n=function(){setTimeout(e,200),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},r.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},r.prototype.getSurface=function(){return this.failIfClosed(),this.surface},r.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},r.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},r.prototype.applyVideoConstraints=function(e){return di(this,void 0,void 0,function(){return xi(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},r.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,n){var a=e.mediaStream.getVideoTracks(),s=a.length,f=0;e.mediaStream.getVideoTracks().forEach(function(h){e.mediaStream.removeTrack(h),h.stop(),++f,f>=s&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},r.prototype.getCapabilities=function(){return new xs(this.getFirstTrackOrFail())},r})(),ps=(function(){function r(e){this.mediaStream=e}return r.prototype.render=function(e,t,n){return di(this,void 0,void 0,function(){return xi(this,function(a){return[2,gs.create(e,this.mediaStream,t,n)]})})},r.create=function(e){return di(this,void 0,void 0,function(){var t,n;return xi(this,function(a){switch(a.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return t={audio:!1,video:e},[4,navigator.mediaDevices.getUserMedia(t)];case 1:return n=a.sent(),[2,new r(n)]}})})},r})(),ao=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},oo=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,g[0]&&(t=0)),t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},vs=(function(){function r(){}return r.failIfNotSupported=function(){return ao(this,void 0,void 0,function(){return oo(this,function(e){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new r]})})},r.prototype.create=function(e){return ao(this,void 0,void 0,function(){return oo(this,function(t){return[2,ps.create(e)]})})},r})(),ws=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},As=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;f&&(f=0,g[0]&&(t=0)),t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},ys=(function(){function r(){}return r.retrieve=function(){if(navigator.mediaDevices)return r.getCamerasFromMediaDevices();var e=MediaStreamTrack;return MediaStreamTrack&&e.getSources?r.getCamerasFromMediaStreamTrack():r.rejectWithError()},r.rejectWithError=function(){var e=gn.unableToQuerySupportedDevices();return r.isHttpsOrLocalhost()||(e=gn.insecureContextCameraQueryError()),Promise.reject(e)},r.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var e=location.host.split(":")[0];return e==="127.0.0.1"||e==="localhost"},r.getCamerasFromMediaDevices=function(){return ws(this,void 0,void 0,function(){var e,t,n,a,s,f,h;return As(this,function(x){switch(x.label){case 0:return e=function(g){for(var w=g.getVideoTracks(),A=0,E=w;A<E.length;A++){var C=E[A];C.enabled=!1,C.stop(),g.removeTrack(C)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=x.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=x.sent(),a=[],s=0,f=n;s<f.length;s++)h=f[s],h.kind==="videoinput"&&a.push({id:h.deviceId,label:h.label});return e(t),[2,a]}})})},r.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){var n=function(s){for(var f=[],h=0,x=s;h<x.length;h++){var g=x[h];g.kind==="video"&&f.push({id:g.id,label:g.label})}e(f)},a=MediaStreamTrack;a.getSources(n)})},r})(),ot;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.NOT_STARTED=1]="NOT_STARTED",r[r.SCANNING=2]="SCANNING",r[r.PAUSED=3]="PAUSED"})(ot||(ot={}));var Es=(function(){function r(){this.state=ot.NOT_STARTED,this.onGoingTransactionNewState=ot.UNKNOWN}return r.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},r.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},r.prototype.execute=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=ot.UNKNOWN,this.directTransition(e)},r.prototype.cancel=function(){if(this.onGoingTransactionNewState===ot.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=ot.UNKNOWN},r.prototype.getState=function(){return this.state},r.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==ot.UNKNOWN)throw"Cannot transition to a new state, already under transition"},r.prototype.validateTransition=function(e){switch(this.state){case ot.UNKNOWN:throw"Transition from unknown is not allowed";case ot.NOT_STARTED:this.failIfNewStateIs(e,[ot.PAUSED]);break;case ot.SCANNING:break;case ot.PAUSED:break}},r.prototype.failIfNewStateIs=function(e,t){for(var n=0,a=t;n<a.length;n++){var s=a[n];if(e===s)throw"Cannot transition from ".concat(this.state," to ").concat(e)}},r})(),Cs=(function(){function r(e){this.stateManager=e}return r.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},r.prototype.directTransition=function(e){this.stateManager.directTransition(e)},r.prototype.getState=function(){return this.stateManager.getState()},r.prototype.canScanFile=function(){return this.stateManager.getState()===ot.NOT_STARTED},r.prototype.isScanning=function(){return this.stateManager.getState()!==ot.NOT_STARTED},r.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===ot.SCANNING},r.prototype.isPaused=function(){return this.stateManager.getState()===ot.PAUSED},r})(),_s=(function(){function r(){}return r.create=function(){return new Cs(new Es)},r})(),ms=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(n[s]=a[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),tr=(function(r){ms(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.DEFAULT_WIDTH=300,e.DEFAULT_WIDTH_OFFSET=2,e.FILE_SCAN_MIN_HEIGHT=300,e.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,e.MIN_QR_BOX_SIZE=50,e.SHADED_LEFT=1,e.SHADED_RIGHT=2,e.SHADED_TOP=3,e.SHADED_BOTTOM=4,e.SHADED_REGION_ELEMENT_ID="qr-shaded-region",e.VERBOSE=!1,e.BORDER_SHADER_DEFAULT_COLOR="#ffffff",e.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",e})(ts),Is=(function(){function r(e,t){this.logger=t,this.fps=tr.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=e.disableFlip===!0,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=tr.DEFAULT_DISABLE_FLIP}return r.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Zo.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},r.prototype.isShadedBoxEnabled=function(){return!Or(this.qrbox)},r.create=function(e,t){return new r(e,t)},r})(),so=(function(){function r(e,t){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(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1;var n;typeof t=="boolean"?this.verbose=t===!0:t&&(n=t,this.verbose=n.verbose===!0,n.experimentalFeatures),this.logger=new ns(this.verbose),this.qrcode=new us(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=_s.create()}return r.prototype.start=function(e,t,n,a){var s=this;if(!e)throw"cameraIdOrConfig is required";if(!n||typeof n!="function")throw"qrCodeSuccessCallback is required and should be a function.";var f;a?f=a:f=this.verbose?this.logger.log:function(){};var h=Is.create(t,this.logger);this.clearElement();var x=!1;h.videoConstraints&&(h.isMediaStreamConstraintsValid()?x=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var g=x,w=document.getElementById(this.elementId);w.clientWidth?w.clientWidth:tr.DEFAULT_WIDTH,w.style.position="relative",this.shouldScan=!0,this.element=w;var A=this,E=this.stateManagerProxy.startTransition(ot.SCANNING);return new Promise(function(C,b){var T=g?h.videoConstraints:A.createVideoConstraints(e);if(!T){E.cancel(),b("videoConstraints should be defined");return}var P={};(!g||h.aspectRatio)&&(P.aspectRatio=h.aspectRatio);var F={onRenderSurfaceReady:function(D,L){A.setupUi(D,L,h),A.isScanning=!0,A.foreverScan(h,n,f)}};vs.failIfNotSupported().then(function(D){D.create(T).then(function(L){return L.render(s.element,P,F).then(function(k){A.renderedCamera=k,E.execute(),C(null)}).catch(function(k){E.cancel(),b(k)})}).catch(function(L){E.cancel(),b(gn.errorGettingUserMedia(L))})}).catch(function(D){E.cancel(),b(gn.cameraStreamingNotSupported())})})},r.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(ot.PAUSED),this.showPausedState(),(Or(e)||e!==!0)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},r.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(ot.SCANNING),e.hidePausedState()};if(!this.renderedCamera.isPaused()){t();return}this.renderedCamera.resume(function(){t()})},r.prototype.getState=function(){return this.stateManagerProxy.getState()},r.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(ot.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=function(){if(e.element){var s=document.getElementById(tr.SHADED_REGION_ELEMENT_ID);s&&e.element.removeChild(s)}},a=this;return this.renderedCamera.close().then(function(){return a.renderedCamera=null,a.element&&(a.element.removeChild(a.canvasElement),a.canvasElement=null),n(),a.qrRegion&&(a.qrRegion=null),a.context&&(a.context=null),t.execute(),a.hidePausedState(),a.isScanning=!1,Promise.resolve()})},r.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(n){return n.decodedText})},r.prototype.scanFileV2=function(e,t){var n=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Or(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(a,s){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(e);var f=new Image;f.onload=function(){var h=f.width,x=f.height,g=document.getElementById(n.elementId),w=g.clientWidth?g.clientWidth:tr.DEFAULT_WIDTH,A=Math.max(g.clientHeight?g.clientHeight:x,tr.FILE_SCAN_MIN_HEIGHT),E=n.computeCanvasDrawConfig(h,x,w,A);if(t){var C=n.createCanvasElement(w,A,"qr-canvas-visible");C.style.display="inline-block",g.appendChild(C);var b=C.getContext("2d");if(!b)throw"Unable to get 2d context from canvas";b.canvas.width=w,b.canvas.height=A,b.drawImage(f,0,0,h,x,E.x,E.y,E.width,E.height)}var T=tr.FILE_SCAN_HIDDEN_CANVAS_PADDING,P=Math.max(f.width,E.width),F=Math.max(f.height,E.height),D=P+2*T,L=F+2*T,k=n.createCanvasElement(D,L);g.appendChild(k);var q=k.getContext("2d");if(!q)throw"Unable to get 2d context from canvas";q.canvas.width=D,q.canvas.height=L,q.drawImage(f,0,0,h,x,T,T,P,F);try{n.qrcode.decodeRobustlyAsync(k).then(function(K){a($a.createFromQrcodeResult(K))}).catch(s)}catch(K){s("QR code parse error, error = ".concat(K))}},f.onerror=s,f.onabort=s,f.onstalled=s,f.onsuspend=s,f.src=URL.createObjectURL(e)})},r.prototype.clear=function(){this.clearElement()},r.getCameras=function(){return ys.retrieve()},r.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},r.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},r.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},r.prototype.applyVideoConstraints=function(e){if(e){if(!Zo.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},r.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},r.prototype.getSupportedFormats=function(e){var t=[oe.QR_CODE,oe.AZTEC,oe.CODABAR,oe.CODE_39,oe.CODE_93,oe.CODE_128,oe.DATA_MATRIX,oe.MAXICODE,oe.ITF,oe.EAN_13,oe.EAN_8,oe.PDF_417,oe.RSS_14,oe.RSS_EXPANDED,oe.UPC_A,oe.UPC_E,oe.UPC_EAN_EXTENSION];if(!e||typeof e=="boolean"||!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(e.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],a=0,s=e.formatsToSupport;a<s.length;a++){var f=s[a];es(f)?n.push(f):this.logger.warn("Invalid format: ".concat(f," passed in config, ignoring."))}if(n.length===0)throw"None of formatsToSupport match supported values.";return n},r.prototype.getUseBarCodeDetectorIfSupported=function(e){if(Or(e))return!0;if(!Or(e.useBarCodeDetectorIfSupported))return e.useBarCodeDetectorIfSupported!==!1;if(Or(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return Or(t.useBarCodeDetectorIfSupported)?!0:t.useBarCodeDetectorIfSupported!==!1},r.prototype.validateQrboxSize=function(e,t,n){var a=this,s=n.qrbox;this.validateQrboxConfig(s);var f=this.toQrdimensions(e,t,s),h=function(g){if(g<tr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(tr.MIN_QR_BOX_SIZE,"px.")},x=function(g){return g>e&&(a.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."),g=e),g};h(f.width),h(f.height),f.width=x(f.width)},r.prototype.validateQrboxConfig=function(e){if(typeof e!="number"&&typeof e!="function"&&(e.width===void 0||e.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},r.prototype.toQrdimensions=function(e,t,n){if(typeof n=="number")return{width:n,height:n};if(typeof n=="function")try{return n(e,t)}catch(a){throw new Error("qrbox config was passed as a function but it failed with unknown error"+a)}return n},r.prototype.setupUi=function(e,t,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,n);var a=Or(n.qrbox)?{width:e,height:t}:n.qrbox;this.validateQrboxConfig(a);var s=this.toQrdimensions(e,t,a);s.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var f=n.isShadedBoxEnabled()&&s.height<=t,h={x:0,y:0,width:e,height:t},x=f?this.getShadedRegionBounds(e,t,s):h,g=this.createCanvasElement(x.width,x.height),w={willReadFrequently:!0},A=g.getContext("2d",w);A.canvas.width=x.width,A.canvas.height=x.height,this.element.append(g),f&&this.possiblyInsertShadingElement(this.element,e,t,s),this.createScannerPausedUiElement(this.element),this.qrRegion=x,this.context=A,this.canvasElement=g},r.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=gn.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},r.prototype.scanContext=function(e,t){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(a){return e(a.text,$a.createFromQrcodeResult(a)),n.possiblyUpdateShaders(!0),!0}).catch(function(a){n.possiblyUpdateShaders(!1);var s=gn.codeParseError(a);return t(s,rs.createFrom(s)),!1})},r.prototype.foreverScan=function(e,t,n){var a=this;if(this.shouldScan&&this.renderedCamera){var s=this.renderedCamera.getSurface(),f=s.videoWidth/s.clientWidth,h=s.videoHeight/s.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var x=this.qrRegion.width*f,g=this.qrRegion.height*h,w=this.qrRegion.x*f,A=this.qrRegion.y*h;this.context.drawImage(s,w,A,x,g,0,0,this.qrRegion.width,this.qrRegion.height);var E=function(){a.foreverScanTimeout=setTimeout(function(){a.foreverScan(e,t,n)},a.getTimeoutFps(e.fps))};this.scanContext(t,n).then(function(C){!C&&e.disableFlip!==!0?(a.context.translate(a.context.canvas.width,0),a.context.scale(-1,1),a.scanContext(t,n).finally(function(){E()})):E()}).catch(function(C){a.logger.logError("Error happend while scanning context",C),E()})}},r.prototype.createVideoConstraints=function(e){if(typeof e=="string")return{deviceId:{exact:e}};if(typeof e=="object"){var t="facingMode",n="deviceId",a={user:!0,environment:!0},s="exact",f=function(b){if(b in a)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(b,"'")},h=Object.keys(e);if(h.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(h.length," keys");var x=Object.keys(e)[0];if(x!==t&&x!==n)throw"Only '".concat(t,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(x===t){var g=e.facingMode;if(typeof g=="string"){if(f(g))return{facingMode:g}}else if(typeof g=="object")if(s in g){if(f(g["".concat(s)]))return{facingMode:{exact:g["".concat(s)]}}}else throw"'facingMode' should be string or object with"+" ".concat(s," as key.");else{var w=typeof g;throw"Invalid type of 'facingMode' = ".concat(w)}}else{var A=e.deviceId;if(typeof A=="string")return{deviceId:A};if(typeof A=="object"){if(s in A)return{deviceId:{exact:A["".concat(s)]}};throw"'deviceId' should be string or object with"+" ".concat(s," as key.")}else{var E=typeof A;throw"Invalid type of 'deviceId' = ".concat(E)}}}var C=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(C)},r.prototype.computeCanvasDrawConfig=function(e,t,n,a){if(e<=n&&t<=a){var s=(n-e)/2,f=(a-t)/2;return{x:s,y:f,width:e,height:t}}else{var h=e,x=t;return e>n&&(t=n/e*t,e=n),t>a&&(e=a/t*e,t=a),this.logger.log("Image downsampled from "+"".concat(h,"X").concat(x)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,n,a)}},r.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},r.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?tr.BORDER_SHADER_MATCH_COLOR:tr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},r.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},r.prototype.createCanvasElement=function(e,t,n){var a=e,s=t,f=document.createElement("canvas");return f.style.width="".concat(a,"px"),f.style.height="".concat(s,"px"),f.style.display="none",f.id=Or(n)?"qr-canvas":n,f},r.prototype.getShadedRegionBounds=function(e,t,n){if(n.width>e||n.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-n.width)/2,y:(t-n.height)/2,width:n.width,height:n.height}},r.prototype.possiblyInsertShadingElement=function(e,t,n,a){if(!(t-a.width<1||n-a.height<1)){var s=document.createElement("div");s.style.position="absolute";var f=(t-a.width)/2,h=(n-a.height)/2;if(s.style.borderLeft="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),s.style.borderRight="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),s.style.borderTop="".concat(h,"px solid rgba(0, 0, 0, 0.48)"),s.style.borderBottom="".concat(h,"px solid rgba(0, 0, 0, 0.48)"),s.style.boxSizing="border-box",s.style.top="0px",s.style.bottom="0px",s.style.left="0px",s.style.right="0px",s.id="".concat(tr.SHADED_REGION_ELEMENT_ID),t-a.width<11||n-a.height<11)this.hasBorderShaders=!1;else{var x=5,g=40;this.insertShaderBorders(s,g,x,-x,null,0,!0),this.insertShaderBorders(s,g,x,-x,null,0,!1),this.insertShaderBorders(s,g,x,null,-x,0,!0),this.insertShaderBorders(s,g,x,null,-x,0,!1),this.insertShaderBorders(s,x,g+x,-x,null,-x,!0),this.insertShaderBorders(s,x,g+x,null,-x,-x,!0),this.insertShaderBorders(s,x,g+x,-x,null,-x,!1),this.insertShaderBorders(s,x,g+x,null,-x,-x,!1),this.hasBorderShaders=!0}e.append(s)}},r.prototype.insertShaderBorders=function(e,t,n,a,s,f,h){var x=document.createElement("div");x.style.position="absolute",x.style.backgroundColor=tr.BORDER_SHADER_DEFAULT_COLOR,x.style.width="".concat(t,"px"),x.style.height="".concat(n,"px"),a!==null&&(x.style.top="".concat(a,"px")),s!==null&&(x.style.bottom="".concat(s,"px")),h?x.style.left="".concat(f,"px"):x.style.right="".concat(f,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(x),e.appendChild(x)},r.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},r.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},r.prototype.getTimeoutFps=function(e){return 1e3/e},r})(),co;(function(r){r[r.STATUS_DEFAULT=0]="STATUS_DEFAULT",r[r.STATUS_SUCCESS=1]="STATUS_SUCCESS",r[r.STATUS_WARNING=2]="STATUS_WARNING",r[r.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(co||(co={}));const Ss={props:{content:{type:Object,required:!0},uid:{type:String,required:!0},id:{type:String},wwElementState:{type:Object,required:!0},useForm:{type:Boolean,default:!0}},emits:["trigger-event","add-state","remove-state","update:content:effect","update:sidepanel-content"],setup(r,{emit:e}){const{value:t,setValue:n}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"code",type:"string",readonly:!0,defaultValue:""}),{value:a,setValue:s}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"cameras",type:"array",readonly:!0,defaultValue:[]}),f=Qt("pending"),h=Qt([]),{value:x,setValue:g}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"status",type:"string",readonly:!0,defaultValue:Xt(()=>f.value)}),{value:w,setValue:A}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"hasCamera",type:"boolean",readonly:!0,defaultValue:Xt(()=>{const k=r.content.cameraSelection;return(k==="custom"||!k)&&r.content.cameraName?!!h.value.find(K=>K.label===r.content.cameraName||K.id===r.content.cameraName)||!!r.content.cameraName:k==="user"||k==="environment"||!k})}),E=X1("_wwForm:useForm",()=>{}),C=Xt(()=>r.content.fieldName),b=Xt(()=>r.content.validation),T=Xt(()=>r.content.customValidation),P=Xt(()=>r.content.required);E(t,{fieldName:C,validation:b,customValidation:T,required:P,initialValue:Xt(()=>"")},{elementState:r.wwElementState,emit:e,sidepanelFormPath:"form",setValue:n});const F=Qt({status:x,value:t,hasCamera:w,cameras:a}),D={};return wwLib.wwElement.useRegisterElementLocalContext("qrScanner",F.value,D,'### QR Scanner local context\n\n#### Data available\n- `status`: Current scanning status ("pending", "scanning", "success", "error")\n- `value`: Last scanned QR code value\n- `hasCamera`: Boolean indicating if camera is available and configured\n- `cameras`: Array of available camera device names'),{codeValue:t,setCodeValue:n,camerasValue:a,setCamerasValue:s,lastCodeTimestamp:Qt(0),cameras:h,html5QrCode:Qt(void 0),resizeTimeout:Qt(void 0),scanningState:f}},computed:{elementId(){return this.id||`ww-input-qr-code-${this.uid}`},scanningStatus(){return this.scanningState},cameraConfig(){const r=this.content.cameraSelection;if((r==="custom"||!r)&&this.content.cameraName){const e=this.cameras.find(t=>t.label===this.content.cameraName||t.id===this.content.cameraName);return e?{type:"deviceId",value:e.id}:{type:"deviceId",value:this.content.cameraName}}return r==="user"?{type:"facingMode",value:"user"}:{type:"facingMode",value:"environment"}}},async mounted(){await this.init(),new ResizeObserver(e=>{clearTimeout(this.resizeTimeout),e[0].contentRect.width&&e[0].contentRect.height&&(this.resizeTimeout=setTimeout(async()=>{await this.refresh()},500))}).observe(this.$el)},async unmounted(){await this.stopScan()},watch:{async"content.cameraSelection"(r,e){e!==r&&await this.refresh()},async"content.cameraName"(r,e){e!==r&&await this.refresh()}},methods:{async init(){try{this.scanningState="pending",this.html5QrCode=new so(this.elementId),this.cameras=await so.getCameras(),this.cameras&&this.setCamerasValue(this.cameras.map(r=>r.label)),await this.startScan()}catch{this.scanningState="error"}},async refresh(){this.html5QrCode&&(await this.stopScan(),await this.startScan())},async stopScan(){var r;try{if(!this.html5QrCode)return;const e=this.html5QrCode.getState();e===2&&await this.html5QrCode.stop(),e!==1&&await this.html5QrCode.clear(),this.scanningState="pending"}catch(e){(r=e.message)!=null&&r.includes("Cannot clear while scan is ongoing")||(this.scanningState="error")}},async startScan(){var a;if(!this.html5QrCode||!((a=this.cameraConfig)!=null&&a.value))return;const r=this.$el.getBoundingClientRect();if(r.width===0||r.height===0)return;const e=r.width/(r.height||r.width*16/9);let t;const n={aspectRatio:isNaN(e)?9/16:e};this.cameraConfig.type==="facingMode"?t={facingMode:this.cameraConfig.value}:t=this.cameraConfig.value;try{this.scanningState="scanning";const s=this;await this.html5QrCode.start(t,n,(f,h)=>{const x=f;h.result.format.formatName==="QR_CODE"&&(Date.now()-s.lastCodeTimestamp<1e3&&x===s.codeValue?s.lastCodeTimestamp=Date.now():(s.lastCodeTimestamp=Date.now(),s.setCodeValue(x),s.scanningState="success",s.$emit("trigger-event",{name:"scan",event:{code:x}})))},f=>{f.includes("QR code found")||(this.scanningState="error")})}catch{this.scanningState="error"}}}},bs=["id"];function Ts(r,e,t,n,a,s){return fr(),Nr("div",{class:"ww-input-qr-code",id:s.elementId},null,8,bs)}const mu=vi(Ss,[["render",Ts],["__scopeId","data-v-655ba93e"]]);function Os(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function Ns(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var Rs=(function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,s){a.__proto__=s}||function(a,s){for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(a[f]=s[f])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ds=(function(r){Rs(e,r);function e(t,n){var a=this.constructor,s=r.call(this,t,n)||this;return Object.defineProperty(s,"name",{value:a.name,enumerable:!1,configurable:!0}),Os(s,a.prototype),Ns(s),s}return e})(Error),Ms=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),$t=(function(r){Ms(e,r);function e(t){t===void 0&&(t=void 0);var n=r.call(this,t)||this;return n.message=t,n}return e.prototype.getKind=function(){var t=this.constructor;return t.kind},e.kind="Exception",e})(Ds),Ps=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),pr=(function(r){Ps(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e})($t),Bs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),xe=(function(r){Bs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e})($t),Ls=(function(){function r(e){if(this.binarizer=e,e===null)throw new xe("Binarizer must be non-null.")}return r.prototype.getWidth=function(){return this.binarizer.getWidth()},r.prototype.getHeight=function(){return this.binarizer.getHeight()},r.prototype.getBlackRow=function(e,t){return this.binarizer.getBlackRow(e,t)},r.prototype.getBlackMatrix=function(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix},r.prototype.isCropSupported=function(){return this.binarizer.getLuminanceSource().isCropSupported()},r.prototype.crop=function(e,t,n,a){var s=this.binarizer.getLuminanceSource().crop(e,t,n,a);return new r(this.binarizer.createBinarizer(s))},r.prototype.isRotateSupported=function(){return this.binarizer.getLuminanceSource().isRotateSupported()},r.prototype.rotateCounterClockwise=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new r(this.binarizer.createBinarizer(e))},r.prototype.rotateCounterClockwise45=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new r(this.binarizer.createBinarizer(e))},r.prototype.toString=function(){try{return this.getBlackMatrix().toString()}catch{return""}},r})(),Fs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),_t=(function(r){Fs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e})($t),ks=(function(){function r(e){this.source=e}return r.prototype.getLuminanceSource=function(){return this.source},r.prototype.getWidth=function(){return this.source.getWidth()},r.prototype.getHeight=function(){return this.source.getHeight()},r})(),Ke=(function(){function r(){}return r.arraycopy=function(e,t,n,a,s){for(;s--;)n[a++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r})(),Us=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),wa=(function(r){Us(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e})($t),Vs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),fo=(function(r){Vs(e,r);function e(t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var a=r.call(this,n)||this;return a.index=t,a.message=n,a}return e.kind="ArrayIndexOutOfBoundsException",e})(wa),Hs=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},pt=(function(){function r(){}return r.fill=function(e,t){for(var n=0,a=e.length;n<a;n++)e[n]=t},r.fillWithin=function(e,t,n,a){r.rangeCheck(e.length,t,n);for(var s=t;s<n;s++)e[s]=a},r.rangeCheck=function(e,t,n){if(t>n)throw new xe("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new fo(t);if(n>e)throw new fo(n)},r.asList=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},r.create=function(e,t,n){var a=Array.from({length:e});return a.map(function(s){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var a=Array.from({length:e});return a.map(function(s){return Int32Array.from({length:t}).fill(n)})},r.equals=function(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(var n=0,a=e.length;n<a;n++)if(e[n]!==t[n])return!1;return!0},r.hashCode=function(e){var t,n;if(e===null)return 0;var a=1;try{for(var s=Hs(e),f=s.next();!f.done;f=s.next()){var h=f.value;a=31*a+h}}catch(x){t={error:x}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},r.fillUint8Array=function(e,t){for(var n=0;n!==e.length;n++)e[n]=t},r.copyOf=function(e,t){return e.slice(0,t)},r.copyOfUint8Array=function(e,t){if(e.length<=t){var n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)},r.copyOfRange=function(e,t,n){var a=n-t,s=new Int32Array(a);return Ke.arraycopy(e,t,s,0,a),s},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var a=0,s=e.length-1;a<=s;){var f=s+a>>1,h=n(t,e[f]);if(h>0)a=f+1;else if(h<0)s=f-1;else return f}return-a-1},r.numberComparator=function(e,t){return e-t},r})(),Ie=(function(){function r(){}return r.numberOfTrailingZeros=function(e){var t;if(e===0)return 32;var 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)},r.numberOfLeadingZeros=function(e){if(e===0)return 32;var 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},r.toHexString=function(e){return e.toString(16)},r.toBinaryString=function(e){return String(parseInt(String(e),2))},r.bitCount=function(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},r.truncDivision=function(e,t){return Math.trunc(e/t)},r.parseInt=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r.MIN_VALUE_32_BITS=-2147483648,r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r})(),mt=(function(){function r(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=r.makeArray(e):this.bits=t)}return r.prototype.getSize=function(){return this.size},r.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},r.prototype.ensureCapacity=function(e){if(e>this.bits.length*32){var t=r.makeArray(e);Ke.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}},r.prototype.get=function(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0},r.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(e&31)},r.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(e&31)},r.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,a=Math.floor(e/32),s=n[a];s&=~((1<<(e&31))-1);for(var f=n.length;s===0;){if(++a===f)return t;s=n[a]}var h=a*32+Ie.numberOfTrailingZeros(s);return h>t?t:h},r.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,a=Math.floor(e/32),s=~n[a];s&=~((1<<(e&31))-1);for(var f=n.length;s===0;){if(++a===f)return t;s=~n[a]}var h=a*32+Ie.numberOfTrailingZeros(s);return h>t?t:h},r.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},r.prototype.setRange=function(e,t){if(t<e||e<0||t>this.size)throw new xe;if(t!==e){t--;for(var n=Math.floor(e/32),a=Math.floor(t/32),s=this.bits,f=n;f<=a;f++){var h=f>n?0:e&31,x=f<a?31:t&31,g=(2<<x)-(1<<h);s[f]|=g}}},r.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,n=0;n<e;n++)t[n]=0},r.prototype.isRange=function(e,t,n){if(t<e||e<0||t>this.size)throw new xe;if(t===e)return!0;t--;for(var a=Math.floor(e/32),s=Math.floor(t/32),f=this.bits,h=a;h<=s;h++){var x=h>a?0:e&31,g=h<s?31:t&31,w=(2<<g)-(1<<x)&4294967295;if((f[h]&w)!==(n?w:0))return!1}return!0},r.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++},r.prototype.appendBits=function(e,t){if(t<0||t>32)throw new xe("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)},r.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n<t;n++)this.appendBit(e.get(n))},r.prototype.xor=function(e){if(this.size!==e.size)throw new xe("Sizes don't match");for(var t=this.bits,n=0,a=t.length;n<a;n++)t[n]^=e.bits[n]},r.prototype.toBytes=function(e,t,n,a){for(var s=0;s<a;s++){for(var f=0,h=0;h<8;h++)this.get(e)&&(f|=1<<7-h),e++;t[n+s]=f}},r.prototype.getBitArray=function(){return this.bits},r.prototype.reverse=function(){for(var e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,a=this.bits,s=0;s<n;s++){var f=a[s];f=f>>1&1431655765|(f&1431655765)<<1,f=f>>2&858993459|(f&858993459)<<2,f=f>>4&252645135|(f&252645135)<<4,f=f>>8&16711935|(f&16711935)<<8,f=f>>16&65535|(f&65535)<<16,e[t-s]=f}if(this.size!==n*32){for(var h=n*32-this.size,x=e[0]>>>h,s=1;s<n;s++){var g=e[s];x|=g<<32-h,e[s-1]=x,x=g>>>h}e[n-1]=x}this.bits=e},r.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.size===t.size&&pt.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+pt.hashCode(this.bits)},r.prototype.toString=function(){for(var e="",t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e},r.prototype.clone=function(){return new r(this.size,this.bits.slice())},r.prototype.toArray=function(){for(var e=[],t=0,n=this.size;t<n;t++)e.push(this.get(t));return e},r})(),na;(function(r){r[r.OTHER=0]="OTHER",r[r.PURE_BARCODE=1]="PURE_BARCODE",r[r.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",r[r.TRY_HARDER=3]="TRY_HARDER",r[r.CHARACTER_SET=4]="CHARACTER_SET",r[r.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",r[r.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",r[r.ASSUME_GS1=7]="ASSUME_GS1",r[r.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",r[r.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",r[r.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(na||(na={}));const tt=na;var Gs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),re=(function(r){Gs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e})($t),Xs=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ve;(function(r){r[r.Cp437=0]="Cp437",r[r.ISO8859_1=1]="ISO8859_1",r[r.ISO8859_2=2]="ISO8859_2",r[r.ISO8859_3=3]="ISO8859_3",r[r.ISO8859_4=4]="ISO8859_4",r[r.ISO8859_5=5]="ISO8859_5",r[r.ISO8859_6=6]="ISO8859_6",r[r.ISO8859_7=7]="ISO8859_7",r[r.ISO8859_8=8]="ISO8859_8",r[r.ISO8859_9=9]="ISO8859_9",r[r.ISO8859_10=10]="ISO8859_10",r[r.ISO8859_11=11]="ISO8859_11",r[r.ISO8859_13=12]="ISO8859_13",r[r.ISO8859_14=13]="ISO8859_14",r[r.ISO8859_15=14]="ISO8859_15",r[r.ISO8859_16=15]="ISO8859_16",r[r.SJIS=16]="SJIS",r[r.Cp1250=17]="Cp1250",r[r.Cp1251=18]="Cp1251",r[r.Cp1252=19]="Cp1252",r[r.Cp1256=20]="Cp1256",r[r.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",r[r.UTF8=22]="UTF8",r[r.ASCII=23]="ASCII",r[r.Big5=24]="Big5",r[r.GB18030=25]="GB18030",r[r.EUC_KR=26]="EUC_KR"})(Ve||(Ve={}));var gt=(function(){function r(e,t,n){for(var a,s,f=[],h=3;h<arguments.length;h++)f[h-3]=arguments[h];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=f,r.VALUE_IDENTIFIER_TO_ECI.set(e,this),r.NAME_TO_ECI.set(n,this);for(var x=this.values,g=0,w=x.length;g!==w;g++){var A=x[g];r.VALUES_TO_ECI.set(A,this)}try{for(var E=Xs(f),C=E.next();!C.done;C=E.next()){var b=C.value;r.NAME_TO_ECI.set(b,this)}}catch(T){a={error:T}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}}return r.prototype.getValueIdentifier=function(){return this.valueIdentifier},r.prototype.getName=function(){return this.name},r.prototype.getValue=function(){return this.values[0]},r.getCharacterSetECIByValue=function(e){if(e<0||e>=900)throw new re("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new re("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new re("incorect value");return t},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.getName()===t.getName()},r.VALUE_IDENTIFIER_TO_ECI=new Map,r.VALUES_TO_ECI=new Map,r.NAME_TO_ECI=new Map,r.Cp437=new r(Ve.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(Ve.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(Ve.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(Ve.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(Ve.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(Ve.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(Ve.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(Ve.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(Ve.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(Ve.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(Ve.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(Ve.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(Ve.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(Ve.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(Ve.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(Ve.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(Ve.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(Ve.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(Ve.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(Ve.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(Ve.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(Ve.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(Ve.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(Ve.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(Ve.Big5,28,"Big5"),r.GB18030=new r(Ve.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(Ve.EUC_KR,30,"EUC_KR","EUC-KR"),r})(),Ws=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),fi=(function(r){Ws(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e})($t),lr=(function(){function r(){}return r.decode=function(e,t){var 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)},r.shouldDecodeOnFallback=function(e){return!r.isBrowser()&&e==="ISO-8859-1"},r.encode=function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)},r.isBrowser=function(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"},r.encodingName=function(e){return typeof e=="string"?e:e.getName()},r.encodingCharacterSet=function(e){return e instanceof gt?e:gt.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var a="",s=0,f=e.length;s<f;s++){var h=e[s].toString(16);h.length<2&&(h="0"+h),a+="%"+h}return decodeURIComponent(a)}if(n.equals(gt.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new fi("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(gt.UTF8)||e.equals(gt.ISO8859_1)||e.equals(gt.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),a=[],s=0;s<n.length;s++)a.push(n[s].charCodeAt(0));return new Uint8Array(a)},r})(),Te=(function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return lr.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(tt.CHARACTER_SET)!==void 0)return t.get(tt.CHARACTER_SET).toString();for(var n=e.length,a=!0,s=!0,f=!0,h=0,x=0,g=0,w=0,A=0,E=0,C=0,b=0,T=0,P=0,F=0,D=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,L=0;L<n&&(a||s||f);L++){var k=e[L]&255;f&&(h>0?(k&128)===0?f=!1:h--:(k&128)!==0&&((k&64)===0?f=!1:(h++,(k&32)===0?x++:(h++,(k&16)===0?g++:(h++,(k&8)===0?w++:f=!1))))),a&&(k>127&&k<160?a=!1:k>159&&(k<192||k===215||k===247)&&F++),s&&(A>0?k<64||k===127||k>252?s=!1:A--:k===128||k===160||k>239?s=!1:k>160&&k<224?(E++,b=0,C++,C>T&&(T=C)):k>127?(A++,C=0,b++,b>P&&(P=b)):(C=0,b=0))}return f&&h>0&&(f=!1),s&&A>0&&(s=!1),f&&(D||x+g+w>0)?r.UTF8:s&&(r.ASSUME_SHIFT_JIS||T>=3||P>=3)?r.SHIFT_JIS:a&&s?T===2&&E===2||F*10>=n?r.SHIFT_JIS:r.ISO88591:a?r.ISO88591:s?r.SHIFT_JIS:f?r.UTF8:r.PLATFORM_DEFAULT_ENCODING},r.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var a=-1;function s(h,x,g,w,A,E){if(h==="%%")return"%";if(t[++a]!==void 0){h=w?parseInt(w.substr(1)):void 0;var C=A?parseInt(A.substr(1)):void 0,b;switch(E){case"s":b=t[a];break;case"c":b=t[a][0];break;case"f":b=parseFloat(t[a]).toFixed(h);break;case"p":b=parseFloat(t[a]).toPrecision(h);break;case"e":b=parseFloat(t[a]).toExponential(h);break;case"x":b=parseInt(t[a]).toString(C||16);break;case"d":b=parseFloat(parseInt(t[a],C||10).toPrecision(h)).toFixed(0);break}b=typeof b=="object"?JSON.stringify(b):(+b).toString(C);for(var T=parseInt(g),P=g&&g[0]+""=="0"?"0":" ";b.length<T;)b=x!==void 0?b+P:P+b;return b}}var f=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(f,s)},r.getBytes=function(e,t){return lr.encode(e,t)},r.getCharCode=function(e,t){return t===void 0&&(t=0),e.charCodeAt(t)},r.getCharAt=function(e){return String.fromCharCode(e)},r.SHIFT_JIS=gt.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=gt.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=gt.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r})(),Ce=(function(){function r(e){e===void 0&&(e=""),this.value=e}return r.prototype.enableDecoding=function(e){return this.encoding=e,this},r.prototype.append=function(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=Te.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this},r.prototype.appendChars=function(e,t,n){for(var a=t;t<t+n;a++)this.append(e[a]);return this},r.prototype.length=function(){return this.value.length},r.prototype.charAt=function(e){return this.value.charAt(e)},r.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},r.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},r.prototype.substring=function(e,t){return this.value.substring(e,t)},r.prototype.setLengthToZero=function(){this.value=""},r.prototype.toString=function(){return this.value},r.prototype.insert=function(e,t){this.value=this.value.substring(0,e)+t+this.value.substring(e)},r})(),br=(function(){function r(e,t,n,a){if(this.width=e,this.height=t,this.rowSize=n,this.bits=a,t==null&&(t=e),this.height=t,e<1||t<1)throw new xe("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,a==null&&(this.bits=new Int32Array(this.rowSize*this.height))}return r.parseFromBooleanArray=function(e){for(var t=e.length,n=e[0].length,a=new r(n,t),s=0;s<t;s++)for(var f=e[s],h=0;h<n;h++)f[h]&&a.set(h,s);return a},r.parseFromString=function(e,t,n){if(e===null)throw new xe("stringRepresentation cannot be null");for(var a=new Array(e.length),s=0,f=0,h=-1,x=0,g=0;g<e.length;)if(e.charAt(g)===`
|
||
`||e.charAt(g)==="\r"){if(s>f){if(h===-1)h=s-f;else if(s-f!==h)throw new xe("row lengths do not match");f=s,x++}g++}else if(e.substring(g,g+t.length)===t)g+=t.length,a[s]=!0,s++;else if(e.substring(g,g+n.length)===n)g+=n.length,a[s]=!1,s++;else throw new xe("illegal character encountered: "+e.substring(g));if(s>f){if(h===-1)h=s-f;else if(s-f!==h)throw new xe("row lengths do not match");x++}for(var w=new r(h,x),A=0;A<s;A++)a[A]&&w.set(Math.floor(A%h),Math.floor(A/h));return w},r.prototype.get=function(e,t){var n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0},r.prototype.set=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295},r.prototype.unset=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)},r.prototype.flip=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295},r.prototype.xor=function(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new xe("input matrix dimensions do not match");for(var t=new mt(Math.floor(this.width/32)+1),n=this.rowSize,a=this.bits,s=0,f=this.height;s<f;s++)for(var h=s*n,x=e.getRow(s,t).getBitArray(),g=0;g<n;g++)a[h+g]^=x[g]},r.prototype.clear=function(){for(var e=this.bits,t=e.length,n=0;n<t;n++)e[n]=0},r.prototype.setRegion=function(e,t,n,a){if(t<0||e<0)throw new xe("Left and top must be nonnegative");if(a<1||n<1)throw new xe("Height and width must be at least 1");var s=e+n,f=t+a;if(f>this.height||s>this.width)throw new xe("The region must fit inside the matrix");for(var h=this.rowSize,x=this.bits,g=t;g<f;g++)for(var w=g*h,A=e;A<s;A++)x[w+Math.floor(A/32)]|=1<<(A&31)&4294967295},r.prototype.getRow=function(e,t){t==null||t.getSize()<this.width?t=new mt(this.width):t.clear();for(var n=this.rowSize,a=this.bits,s=e*n,f=0;f<n;f++)t.setBulk(f*32,a[s+f]);return t},r.prototype.setRow=function(e,t){Ke.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)},r.prototype.rotate180=function(){for(var e=this.getWidth(),t=this.getHeight(),n=new mt(e),a=new mt(e),s=0,f=Math.floor((t+1)/2);s<f;s++)n=this.getRow(s,n),a=this.getRow(t-1-s,a),n.reverse(),a.reverse(),this.setRow(s,a),this.setRow(t-1-s,n)},r.prototype.getEnclosingRectangle=function(){for(var e=this.width,t=this.height,n=this.rowSize,a=this.bits,s=e,f=t,h=-1,x=-1,g=0;g<t;g++)for(var w=0;w<n;w++){var A=a[g*n+w];if(A!==0){if(g<f&&(f=g),g>x&&(x=g),w*32<s){for(var E=0;(A<<31-E&4294967295)===0;)E++;w*32+E<s&&(s=w*32+E)}if(w*32+31>h){for(var E=31;!(A>>>E);)E--;w*32+E>h&&(h=w*32+E)}}}return h<s||x<f?null:Int32Array.from([s,f,h-s+1,x-f+1])},r.prototype.getTopLeftOnBit=function(){for(var e=this.rowSize,t=this.bits,n=0;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;for(var a=n/e,s=n%e*32,f=t[n],h=0;(f<<31-h&4294967295)===0;)h++;return s+=h,Int32Array.from([s,a])},r.prototype.getBottomRightOnBit=function(){for(var e=this.rowSize,t=this.bits,n=t.length-1;n>=0&&t[n]===0;)n--;if(n<0)return null;for(var a=Math.floor(n/e),s=Math.floor(n%e)*32,f=t[n],h=31;!(f>>>h);)h--;return s+=h,Int32Array.from([s,a])},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.getRowSize=function(){return this.rowSize},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&pt.equals(this.bits,t.bits)},r.prototype.hashCode=function(){var e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+pt.hashCode(this.bits),e},r.prototype.toString=function(e,t,n){return e===void 0&&(e="X "),t===void 0&&(t=" "),n===void 0&&(n=`
|
||
`),this.buildToString(e,t,n)},r.prototype.buildToString=function(e,t,n){for(var a=new Ce,s=0,f=this.height;s<f;s++){for(var h=0,x=this.width;h<x;h++)a.append(this.get(h,s)?e:t);a.append(n)}return a.toString()},r.prototype.clone=function(){return new r(this.width,this.height,this.rowSize,this.bits.slice())},r})(),zs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),j=(function(r){zs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getNotFoundInstance=function(){return new e},e.kind="NotFoundException",e})($t),Ys=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Zs=(function(r){Ys(e,r);function e(t){var n=r.call(this,t)||this;return n.luminances=e.EMPTY,n.buckets=new Int32Array(e.LUMINANCE_BUCKETS),n}return e.prototype.getBlackRow=function(t,n){var a=this.getLuminanceSource(),s=a.getWidth();n==null||n.getSize()<s?n=new mt(s):n.clear(),this.initArrays(s);for(var f=a.getRow(t,this.luminances),h=this.buckets,x=0;x<s;x++)h[(f[x]&255)>>e.LUMINANCE_SHIFT]++;var g=e.estimateBlackPoint(h);if(s<3)for(var x=0;x<s;x++)(f[x]&255)<g&&n.set(x);else for(var w=f[0]&255,A=f[1]&255,x=1;x<s-1;x++){var E=f[x+1]&255;(A*4-w-E)/2<g&&n.set(x),w=A,A=E}return n},e.prototype.getBlackMatrix=function(){var t=this.getLuminanceSource(),n=t.getWidth(),a=t.getHeight(),s=new br(n,a);this.initArrays(n);for(var f=this.buckets,h=1;h<5;h++)for(var x=Math.floor(a*h/5),g=t.getRow(x,this.luminances),w=Math.floor(n*4/5),A=Math.floor(n/5);A<w;A++){var E=g[A]&255;f[E>>e.LUMINANCE_SHIFT]++}for(var C=e.estimateBlackPoint(f),b=t.getMatrix(),h=0;h<a;h++)for(var T=h*n,A=0;A<n;A++){var E=b[T+A]&255;E<C&&s.set(A,h)}return s},e.prototype.createBinarizer=function(t){return new e(t)},e.prototype.initArrays=function(t){this.luminances.length<t&&(this.luminances=new Uint8ClampedArray(t));for(var n=this.buckets,a=0;a<e.LUMINANCE_BUCKETS;a++)n[a]=0},e.estimateBlackPoint=function(t){for(var n=t.length,a=0,s=0,f=0,h=0;h<n;h++)t[h]>f&&(s=h,f=t[h]),t[h]>a&&(a=t[h]);for(var x=0,g=0,h=0;h<n;h++){var w=h-s,A=t[h]*w*w;A>g&&(x=h,g=A)}if(s>x){var E=s;s=x,x=E}if(x-s<=n/16)throw new j;for(var C=x-1,b=-1,h=x-1;h>s;h--){var T=h-s,A=T*T*(x-h)*(a-t[h]);A>b&&(C=h,b=A)}return C<<e.LUMINANCE_SHIFT},e.LUMINANCE_BITS=5,e.LUMINANCE_SHIFT=8-e.LUMINANCE_BITS,e.LUMINANCE_BUCKETS=1<<e.LUMINANCE_BITS,e.EMPTY=Uint8ClampedArray.from([0]),e})(ks),js=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ks=(function(r){js(e,r);function e(t){var n=r.call(this,t)||this;return n.matrix=null,n}return e.prototype.getBlackMatrix=function(){if(this.matrix!==null)return this.matrix;var t=this.getLuminanceSource(),n=t.getWidth(),a=t.getHeight();if(n>=e.MINIMUM_DIMENSION&&a>=e.MINIMUM_DIMENSION){var s=t.getMatrix(),f=n>>e.BLOCK_SIZE_POWER;(n&e.BLOCK_SIZE_MASK)!==0&&f++;var h=a>>e.BLOCK_SIZE_POWER;(a&e.BLOCK_SIZE_MASK)!==0&&h++;var x=e.calculateBlackPoints(s,f,h,n,a),g=new br(n,a);e.calculateThresholdForBlock(s,f,h,n,a,x,g),this.matrix=g}else this.matrix=r.prototype.getBlackMatrix.call(this);return this.matrix},e.prototype.createBinarizer=function(t){return new e(t)},e.calculateThresholdForBlock=function(t,n,a,s,f,h,x){for(var g=f-e.BLOCK_SIZE,w=s-e.BLOCK_SIZE,A=0;A<a;A++){var E=A<<e.BLOCK_SIZE_POWER;E>g&&(E=g);for(var C=e.cap(A,2,a-3),b=0;b<n;b++){var T=b<<e.BLOCK_SIZE_POWER;T>w&&(T=w);for(var P=e.cap(b,2,n-3),F=0,D=-2;D<=2;D++){var L=h[C+D];F+=L[P-2]+L[P-1]+L[P]+L[P+1]+L[P+2]}var k=F/25;e.thresholdBlock(t,T,E,k,s,x)}}},e.cap=function(t,n,a){return t<n?n:t>a?a:t},e.thresholdBlock=function(t,n,a,s,f,h){for(var x=0,g=a*f+n;x<e.BLOCK_SIZE;x++,g+=f)for(var w=0;w<e.BLOCK_SIZE;w++)(t[g+w]&255)<=s&&h.set(n+w,a+x)},e.calculateBlackPoints=function(t,n,a,s,f){for(var h=f-e.BLOCK_SIZE,x=s-e.BLOCK_SIZE,g=new Array(a),w=0;w<a;w++){g[w]=new Int32Array(n);var A=w<<e.BLOCK_SIZE_POWER;A>h&&(A=h);for(var E=0;E<n;E++){var C=E<<e.BLOCK_SIZE_POWER;C>x&&(C=x);for(var b=0,T=255,P=0,F=0,D=A*s+C;F<e.BLOCK_SIZE;F++,D+=s){for(var L=0;L<e.BLOCK_SIZE;L++){var k=t[D+L]&255;b+=k,k<T&&(T=k),k>P&&(P=k)}if(P-T>e.MIN_DYNAMIC_RANGE)for(F++,D+=s;F<e.BLOCK_SIZE;F++,D+=s)for(var L=0;L<e.BLOCK_SIZE;L++)b+=t[D+L]&255}var q=b>>e.BLOCK_SIZE_POWER*2;if(P-T<=e.MIN_DYNAMIC_RANGE&&(q=T/2,w>0&&E>0)){var K=(g[w-1][E]+2*g[w][E-1]+g[w-1][E-1])/4;T<K&&(q=K)}g[w][E]=q}}return g},e.BLOCK_SIZE_POWER=3,e.BLOCK_SIZE=1<<e.BLOCK_SIZE_POWER,e.BLOCK_SIZE_MASK=e.BLOCK_SIZE-1,e.MINIMUM_DIMENSION=e.BLOCK_SIZE*5,e.MIN_DYNAMIC_RANGE=24,e})(Zs),wi=(function(){function r(e,t){this.width=e,this.height=t}return r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.isCropSupported=function(){return!1},r.prototype.crop=function(e,t,n,a){throw new fi("This luminance source does not support cropping.")},r.prototype.isRotateSupported=function(){return!1},r.prototype.rotateCounterClockwise=function(){throw new fi("This luminance source does not support rotation by 90 degrees.")},r.prototype.rotateCounterClockwise45=function(){throw new fi("This luminance source does not support rotation by 45 degrees.")},r.prototype.toString=function(){for(var e=new Uint8ClampedArray(this.width),t=new Ce,n=0;n<this.height;n++){for(var a=this.getRow(n,e),s=0;s<this.width;s++){var f=a[s]&255,h=void 0;f<64?h="#":f<128?h="+":f<192?h=".":h=" ",t.append(h)}t.append(`
|
||
`)}return t.toString()},r})(),qs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Aa=(function(r){qs(e,r);function e(t){var n=r.call(this,t.getWidth(),t.getHeight())||this;return n.delegate=t,n}return e.prototype.getRow=function(t,n){for(var a=this.delegate.getRow(t,n),s=this.getWidth(),f=0;f<s;f++)a[f]=255-(a[f]&255);return a},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),n=this.getWidth()*this.getHeight(),a=new Uint8ClampedArray(n),s=0;s<n;s++)a[s]=255-(t[s]&255);return a},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,n,a,s){return new e(this.delegate.crop(t,n,a,s))},e.prototype.isRotateSupported=function(){return this.delegate.isRotateSupported()},e.prototype.invert=function(){return this.delegate},e.prototype.rotateCounterClockwise=function(){return new e(this.delegate.rotateCounterClockwise())},e.prototype.rotateCounterClockwise45=function(){return new e(this.delegate.rotateCounterClockwise45())},e})(wi),Qs=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Js=(function(r){Qs(e,r);function e(t){var n=r.call(this,t.width,t.height)||this;return n.canvas=t,n.tempCanvasElement=null,n.buffer=e.makeBufferFromCanvasImageData(t),n}return e.makeBufferFromCanvasImageData=function(t){var n=t.getContext("2d").getImageData(0,0,t.width,t.height);return e.toGrayscaleBuffer(n.data,t.width,t.height)},e.toGrayscaleBuffer=function(t,n,a){var s=new Uint8ClampedArray(n*a);if(e.FRAME_INDEX=!e.FRAME_INDEX,e.FRAME_INDEX)for(var f=0,h=0,x=t.length;f<x;f+=4,h++){var g=void 0,w=t[f+3];if(w===0)g=255;else{var A=t[f],E=t[f+1],C=t[f+2];g=306*A+601*E+117*C+512>>10}s[h]=g}else for(var f=0,h=0,b=t.length;f<b;f+=4,h++){var g=void 0,w=t[f+3];if(w===0)g=255;else{var A=t[f],E=t[f+1],C=t[f+2];g=306*A+601*E+117*C+512>>10}s[h]=255-g}return s},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new xe("Requested row is outside the image: "+t);var a=this.getWidth(),s=t*a;return n===null?n=this.buffer.slice(s,s+a):(n.length<a&&(n=new Uint8ClampedArray(a)),n.set(this.buffer.slice(s,s+a))),n},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,a,s){return r.prototype.crop.call(this,t,n,a,s),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement},e.prototype.rotate=function(t){var n=this.getTempCanvasElement(),a=n.getContext("2d"),s=t*e.DEGREE_TO_RADIANS,f=this.canvas.width,h=this.canvas.height,x=Math.ceil(Math.abs(Math.cos(s))*f+Math.abs(Math.sin(s))*h),g=Math.ceil(Math.abs(Math.sin(s))*f+Math.abs(Math.cos(s))*h);return n.width=x,n.height=g,a.translate(x/2,g/2),a.rotate(s),a.drawImage(this.canvas,f/-2,h/-2),this.buffer=e.makeBufferFromCanvasImageData(n),this},e.prototype.invert=function(){return new Aa(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e})(wi),$s=(function(){function r(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}return r.prototype.toJSON=function(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}},r})(),Vt=function(r,e,t,n){function a(s){return s instanceof t?s:new t(function(f){f(s)})}return new(t||(t=Promise))(function(s,f){function h(w){try{g(n.next(w))}catch(A){f(A)}}function x(w){try{g(n.throw(w))}catch(A){f(A)}}function g(w){w.done?s(w.value):a(w.value).then(h,x)}g((n=n.apply(r,e||[])).next())})},Ht=function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,f;return f={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function h(g){return function(w){return x([g,w])}}function x(g){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,a&&(s=g[0]&2?a.return:g[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,g[1])).done)return s;switch(a=0,s&&(g=[g[0]&2,s.value]),g[0]){case 0:case 1:s=g;break;case 4:return t.label++,{value:g[1],done:!1};case 5:t.label++,a=g[1],g=[0];continue;case 7:g=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!s||g[1]>s[0]&&g[1]<s[3])){t.label=g[1];break}if(g[0]===6&&t.label<s[1]){t.label=s[1],s=g;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(g);break}s[2]&&t.ops.pop(),t.trys.pop();continue}g=e.call(r,t)}catch(w){g=[6,w],a=0}finally{n=s=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}},e0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},An=(function(){function r(e,t,n){t===void 0&&(t=500),this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return Object.defineProperty(r.prototype,"hasNavigator",{get:function(){return typeof navigator<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMediaDevicesSuported",{get:function(){return this.hasNavigator&&!!navigator.mediaDevices},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canEnumerateDevices",{get:function(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"timeBetweenDecodingAttempts",{get:function(){return this._timeBetweenDecodingAttempts},set:function(e){this._timeBetweenDecodingAttempts=e<0?0:e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hints",{get:function(){return this._hints},set:function(e){this._hints=e||null},enumerable:!1,configurable:!0}),r.prototype.listVideoInputDevices=function(){return Vt(this,void 0,void 0,function(){var e,t,n,a,s,f,h,x,g,w,A,E;return Ht(this,function(C){switch(C.label){case 0: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.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=C.sent(),t=[];try{for(n=e0(e),a=n.next();!a.done;a=n.next())s=a.value,f=s.kind==="video"?"videoinput":s.kind,f==="videoinput"&&(h=s.deviceId||s.id,x=s.label||"Video device "+(t.length+1),g=s.groupId,w={deviceId:h,label:x,kind:f,groupId:g},t.push(w))}catch(b){A={error:b}}finally{try{a&&!a.done&&(E=n.return)&&E.call(n)}finally{if(A)throw A.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Vt(this,void 0,void 0,function(){var e;return Ht(this,function(t){switch(t.label){case 0:return[4,this.listVideoInputDevices()];case 1:return e=t.sent(),[2,e.map(function(n){return new $s(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Vt(this,void 0,void 0,function(){var t;return Ht(this,function(n){switch(n.label){case 0:return[4,this.listVideoInputDevices()];case 1:return t=n.sent(),t?[2,t.find(function(a){return a.deviceId===e})]:[2,null]}})})},r.prototype.decodeFromInputVideoDevice=function(e,t){return Vt(this,void 0,void 0,function(){return Ht(this,function(n){switch(n.label){case 0:return[4,this.decodeOnceFromVideoDevice(e,t)];case 1:return[2,n.sent()]}})})},r.prototype.decodeOnceFromVideoDevice=function(e,t){return Vt(this,void 0,void 0,function(){var n,a;return Ht(this,function(s){switch(s.label){case 0:return this.reset(),e?n={deviceId:{exact:e}}:n={facingMode:"environment"},a={video:n},[4,this.decodeOnceFromConstraints(a,t)];case 1:return[2,s.sent()]}})})},r.prototype.decodeOnceFromConstraints=function(e,t){return Vt(this,void 0,void 0,function(){var n;return Ht(this,function(a){switch(a.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return n=a.sent(),[4,this.decodeOnceFromStream(n,t)];case 2:return[2,a.sent()]}})})},r.prototype.decodeOnceFromStream=function(e,t){return Vt(this,void 0,void 0,function(){var n,a;return Ht(this,function(s){switch(s.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return n=s.sent(),[4,this.decodeOnce(n)];case 2:return a=s.sent(),[2,a]}})})},r.prototype.decodeFromInputVideoDeviceContinuously=function(e,t,n){return Vt(this,void 0,void 0,function(){return Ht(this,function(a){switch(a.label){case 0:return[4,this.decodeFromVideoDevice(e,t,n)];case 1:return[2,a.sent()]}})})},r.prototype.decodeFromVideoDevice=function(e,t,n){return Vt(this,void 0,void 0,function(){var a,s;return Ht(this,function(f){switch(f.label){case 0:return e?a={deviceId:{exact:e}}:a={facingMode:"environment"},s={video:a},[4,this.decodeFromConstraints(s,t,n)];case 1:return[2,f.sent()]}})})},r.prototype.decodeFromConstraints=function(e,t,n){return Vt(this,void 0,void 0,function(){var a;return Ht(this,function(s){switch(s.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return a=s.sent(),[4,this.decodeFromStream(a,t,n)];case 2:return[2,s.sent()]}})})},r.prototype.decodeFromStream=function(e,t,n){return Vt(this,void 0,void 0,function(){var a;return Ht(this,function(s){switch(s.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return a=s.sent(),[4,this.decodeContinuously(a,n)];case 2:return[2,s.sent()]}})})},r.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},r.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},r.prototype.attachStreamToVideo=function(e,t){return Vt(this,void 0,void 0,function(){var n;return Ht(this,function(a){switch(a.label){case 0:return n=this.prepareVideoElement(t),this.addVideoSource(n,e),this.videoElement=n,this.stream=e,[4,this.playVideoOnLoadAsync(n)];case 1:return a.sent(),[2,n]}})})},r.prototype.playVideoOnLoadAsync=function(e){var t=this;return new Promise(function(n,a){return t.playVideoOnLoad(e,function(){return n()})})},r.prototype.playVideoOnLoad=function(e,t){var n=this;this.videoEndedListener=function(){return n.stopStreams()},this.videoCanPlayListener=function(){return n.tryPlayVideo(e)},e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)},r.prototype.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2},r.prototype.tryPlayVideo=function(e){return Vt(this,void 0,void 0,function(){return Ht(this,function(t){switch(t.label){case 0:if(this.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,e.play()];case 2:return t.sent(),[3,4];case 3:return t.sent(),console.warn("It was not possible to play the video."),[3,4];case 4:return[2]}})})},r.prototype.getMediaElement=function(e,t){var n=document.getElementById(e);if(!n)throw new pr("element with id '"+e+"' not found");if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new pr("element with id '"+e+"' must be an "+t+" element");return n},r.prototype.decodeFromImage=function(e,t){if(!e&&!t)throw new pr("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)},r.prototype.decodeFromVideo=function(e,t){if(!e&&!t)throw new pr("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)},r.prototype.decodeFromVideoContinuously=function(e,t,n){if(e===void 0&&t===void 0)throw new pr("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)},r.prototype.decodeFromImageElement=function(e){if(!e)throw new pr("An image element must be provided.");this.reset();var t=this.prepareImageElement(e);this.imageElement=t;var n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n},r.prototype.decodeFromVideoElement=function(e){var t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)},r.prototype.decodeFromVideoElementContinuously=function(e,t){var n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)},r.prototype._decodeFromVideoElementSetup=function(e){if(!e)throw new pr("A video element must be provided.");this.reset();var t=this.prepareVideoElement(e);return this.videoElement=t,t},r.prototype.decodeFromImageUrl=function(e){if(!e)throw new pr("An URL must be provided.");this.reset();var t=this.prepareImageElement();this.imageElement=t;var n=this._decodeOnLoadImage(t);return t.src=e,n},r.prototype.decodeFromVideoUrl=function(e){if(!e)throw new pr("An URL must be provided.");this.reset();var t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n},r.prototype.decodeFromVideoUrlContinuously=function(e,t){if(!e)throw new pr("An URL must be provided.");this.reset();var n=this.prepareVideoElement(),a=this.decodeFromVideoElementContinuously(n,t);return n.src=e,a},r.prototype._decodeOnLoadImage=function(e){var t=this;return new Promise(function(n,a){t.imageLoadedListener=function(){return t.decodeOnce(e,!1,!0).then(n,a)},e.addEventListener("load",t.imageLoadedListener)})},r.prototype._decodeOnLoadVideo=function(e){return Vt(this,void 0,void 0,function(){return Ht(this,function(t){switch(t.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return t.sent(),[4,this.decodeOnce(e)];case 2:return[2,t.sent()]}})})},r.prototype._decodeOnLoadVideoContinuously=function(e,t){return Vt(this,void 0,void 0,function(){return Ht(this,function(n){switch(n.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return n.sent(),this.decodeContinuously(e,t),[2]}})})},r.prototype.isImageLoaded=function(e){return!(!e.complete||e.naturalWidth===0)},r.prototype.prepareImageElement=function(e){var 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},r.prototype.prepareVideoElement=function(e){var 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},r.prototype.decodeOnce=function(e,t,n){var a=this;t===void 0&&(t=!0),n===void 0&&(n=!0),this._stopAsyncDecode=!1;var s=function(f,h){if(a._stopAsyncDecode){h(new j("Video stream has ended before any code could be detected.")),a._stopAsyncDecode=void 0;return}try{var x=a.decode(e);f(x)}catch(E){var g=t&&E instanceof j,w=E instanceof _t||E instanceof re,A=w&&n;if(g||A)return setTimeout(s,a._timeBetweenDecodingAttempts,f,h);h(E)}};return new Promise(function(f,h){return s(f,h)})},r.prototype.decodeContinuously=function(e,t){var n=this;this._stopContinuousDecode=!1;var a=function(){if(n._stopContinuousDecode){n._stopContinuousDecode=void 0;return}try{var s=n.decode(e);t(s,null),setTimeout(a,n.timeBetweenScansMillis)}catch(x){t(null,x);var f=x instanceof _t||x instanceof re,h=x instanceof j;(f||h)&&setTimeout(a,n._timeBetweenDecodingAttempts)}};a()},r.prototype.decode=function(e){var t=this.createBinaryBitmap(e);return this.decodeBitmap(t)},r.prototype.createBinaryBitmap=function(e){this.getCaptureCanvasContext(e),e instanceof HTMLVideoElement?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);var t=this.getCaptureCanvas(e),n=new Js(t),a=new Ks(n);return new Ls(a)},r.prototype.getCaptureCanvasContext=function(e){if(!this.captureCanvasContext){var t=this.getCaptureCanvas(e),n=void 0;try{n=t.getContext("2d",{willReadFrequently:!0})}catch{n=t.getContext("2d")}this.captureCanvasContext=n}return this.captureCanvasContext},r.prototype.getCaptureCanvas=function(e){if(!this.captureCanvas){var t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas},r.prototype.drawFrameOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.drawImageOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.decodeBitmap=function(e){return this.reader.decode(e,this._hints)},r.prototype.createCaptureCanvas=function(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;var t=document.createElement("canvas"),n,a;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,a=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,a=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=a+"px",t.width=n,t.height=a,t},r.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach(function(e){return e.stop()}),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()},r.prototype.reset=function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()},r.prototype._destroyVideoElement=function(){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)},r.prototype._destroyImageElement=function(){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)},r.prototype._destroyCaptureCanvas=function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0},r.prototype.addVideoSource=function(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}},r.prototype.cleanVideoSource=function(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")},r})(),Bt=(function(){function r(e,t,n,a,s,f){n===void 0&&(n=t==null?0:8*t.length),f===void 0&&(f=Ke.currentTimeMillis()),this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=a,this.format=s,this.timestamp=f,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=a,this.format=s,this.resultMetadata=null,f==null?this.timestamp=Ke.currentTimeMillis():this.timestamp=f}return r.prototype.getText=function(){return this.text},r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.getBarcodeFormat=function(){return this.format},r.prototype.getResultMetadata=function(){return this.resultMetadata},r.prototype.putMetadata=function(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)},r.prototype.putAllMetadata=function(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))},r.prototype.addResultPoints=function(e){var t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){var n=new Array(t.length+e.length);Ke.arraycopy(t,0,n,0,t.length),Ke.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.toString=function(){return this.text},r})(),ia;(function(r){r[r.AZTEC=0]="AZTEC",r[r.CODABAR=1]="CODABAR",r[r.CODE_39=2]="CODE_39",r[r.CODE_93=3]="CODE_93",r[r.CODE_128=4]="CODE_128",r[r.DATA_MATRIX=5]="DATA_MATRIX",r[r.EAN_8=6]="EAN_8",r[r.EAN_13=7]="EAN_13",r[r.ITF=8]="ITF",r[r.MAXICODE=9]="MAXICODE",r[r.PDF_417=10]="PDF_417",r[r.QR_CODE=11]="QR_CODE",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(ia||(ia={}));const se=ia;var aa;(function(r){r[r.OTHER=0]="OTHER",r[r.ORIENTATION=1]="ORIENTATION",r[r.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",r[r.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",r[r.ISSUE_NUMBER=4]="ISSUE_NUMBER",r[r.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",r[r.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",r[r.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",r[r.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",r[r.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",r[r.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(aa||(aa={}));const Rt=aa;var Ai=(function(){function r(e,t,n,a,s,f){s===void 0&&(s=-1),f===void 0&&(f=-1),this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=a,this.structuredAppendSequenceNumber=s,this.structuredAppendParity=f,this.numBits=e==null?0:8*e.length}return r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.setNumBits=function(e){this.numBits=e},r.prototype.getText=function(){return this.text},r.prototype.getByteSegments=function(){return this.byteSegments},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getErrorsCorrected=function(){return this.errorsCorrected},r.prototype.setErrorsCorrected=function(e){this.errorsCorrected=e},r.prototype.getErasures=function(){return this.erasures},r.prototype.setErasures=function(e){this.erasures=e},r.prototype.getOther=function(){return this.other},r.prototype.setOther=function(e){this.other=e},r.prototype.hasStructuredAppend=function(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0},r.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},r.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},r})(),Ln=(function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new xe;return this.logTable[e]},r.addOrSubtract=function(e,t){return e^t},r})(),Gr=(function(){function r(e,t){if(t.length===0)throw new xe;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var a=1;a<n&&t[a]===0;)a++;a===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-a),Ke.arraycopy(t,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){if(e===0)return this.getCoefficient(0);var t=this.coefficients,n;if(e===1){n=0;for(var a=0,s=t.length;a!==s;a++){var f=t[a];n=Ln.addOrSubtract(n,f)}return n}n=t[0];for(var h=t.length,x=this.field,a=1;a<h;a++)n=Ln.addOrSubtract(x.multiply(e,n),t[a]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new xe("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var a=t;t=n,n=a}var s=new Int32Array(n.length),f=n.length-t.length;Ke.arraycopy(n,0,s,0,f);for(var h=f;h<n.length;h++)s[h]=Ln.addOrSubtract(t[h-f],n[h]);return new r(this.field,s)},r.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new xe("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();for(var t=this.coefficients,n=t.length,a=e.coefficients,s=a.length,f=new Int32Array(n+s-1),h=this.field,x=0;x<n;x++)for(var g=t[x],w=0;w<s;w++)f[x+w]=Ln.addOrSubtract(f[x+w],h.multiply(g,a[w]));return new r(h,f)},r.prototype.multiplyScalar=function(e){if(e===0)return this.field.getZero();if(e===1)return this;for(var t=this.coefficients.length,n=this.field,a=new Int32Array(t),s=this.coefficients,f=0;f<t;f++)a[f]=n.multiply(s[f],e);return new r(n,a)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new xe;if(t===0)return this.field.getZero();for(var n=this.coefficients,a=n.length,s=new Int32Array(a+e),f=this.field,h=0;h<a;h++)s[h]=f.multiply(n[h],t);return new r(f,s)},r.prototype.divide=function(e){if(!this.field.equals(e.field))throw new xe("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new xe("Divide by 0");for(var t=this.field,n=t.getZero(),a=this,s=e.getCoefficient(e.getDegree()),f=t.inverse(s);a.getDegree()>=e.getDegree()&&!a.isZero();){var h=a.getDegree()-e.getDegree(),x=t.multiply(a.getCoefficient(a.getDegree()),f),g=e.multiplyByMonomial(h,x),w=t.buildMonomial(h,x);n=n.addOrSubtract(w),a=a.addOrSubtract(g)}return[n,a]},r.prototype.toString=function(){for(var e="",t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){var a=this.field.log(n);a===0?e+="1":a===1?e+="a":(e+="a^",e+=a)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e},r})(),t0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ko=(function(r){t0(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e})($t),r0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Jt=(function(r){r0(e,r);function e(t,n,a){var s=r.call(this)||this;s.primitive=t,s.size=n,s.generatorBase=a;for(var f=new Int32Array(n),h=1,x=0;x<n;x++)f[x]=h,h*=2,h>=n&&(h^=t,h&=n-1);s.expTable=f;for(var g=new Int32Array(n),x=0;x<n-1;x++)g[f[x]]=x;return s.logTable=g,s.zero=new Gr(s,Int32Array.from([0])),s.one=new Gr(s,Int32Array.from([1])),s}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new xe;if(n===0)return this.zero;var a=new Int32Array(t+1);return a[0]=n,new Gr(this,a)},e.prototype.inverse=function(t){if(t===0)throw new Ko;return this.expTable[this.size-this.logTable[t]-1]},e.prototype.multiply=function(t,n){return t===0||n===0?0:this.expTable[(this.logTable[t]+this.logTable[n])%(this.size-1)]},e.prototype.getSize=function(){return this.size},e.prototype.getGeneratorBase=function(){return this.generatorBase},e.prototype.toString=function(){return"GF(0x"+Ie.toHexString(this.primitive)+","+this.size+")"},e.prototype.equals=function(t){return t===this},e.AZTEC_DATA_12=new e(4201,4096,1),e.AZTEC_DATA_10=new e(1033,1024,1),e.AZTEC_DATA_6=new e(67,64,1),e.AZTEC_PARAM=new e(19,16,1),e.QR_CODE_FIELD_256=new e(285,256,0),e.DATA_MATRIX_FIELD_256=new e(301,256,1),e.AZTEC_DATA_8=e.DATA_MATRIX_FIELD_256,e.MAXICODE_FIELD_64=e.AZTEC_DATA_6,e})(Ln),n0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),ri=(function(r){n0(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e})($t),i0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Hn=(function(r){i0(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e})($t),yi=(function(){function r(e){this.field=e}return r.prototype.decode=function(e,t){for(var n=this.field,a=new Gr(n,e),s=new Int32Array(t),f=!0,h=0;h<t;h++){var x=a.evaluateAt(n.exp(h+n.getGeneratorBase()));s[s.length-1-h]=x,x!==0&&(f=!1)}if(!f)for(var g=new Gr(n,s),w=this.runEuclideanAlgorithm(n.buildMonomial(t,1),g,t),A=w[0],E=w[1],C=this.findErrorLocations(A),b=this.findErrorMagnitudes(E,C),h=0;h<C.length;h++){var T=e.length-1-n.log(C[h]);if(T<0)throw new ri("Bad error location");e[T]=Jt.addOrSubtract(e[T],b[h])}},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var a=e;e=t,t=a}for(var s=this.field,f=e,h=t,x=s.getZero(),g=s.getOne();h.getDegree()>=(n/2|0);){var w=f,A=x;if(f=h,x=g,f.isZero())throw new ri("r_{i-1} was zero");h=w;for(var E=s.getZero(),C=f.getCoefficient(f.getDegree()),b=s.inverse(C);h.getDegree()>=f.getDegree()&&!h.isZero();){var T=h.getDegree()-f.getDegree(),P=s.multiply(h.getCoefficient(h.getDegree()),b);E=E.addOrSubtract(s.buildMonomial(T,P)),h=h.addOrSubtract(f.multiplyByMonomial(T,P))}if(g=E.multiply(x).addOrSubtract(A),h.getDegree()>=f.getDegree())throw new Hn("Division algorithm failed to reduce polynomial?")}var F=g.getCoefficient(0);if(F===0)throw new ri("sigmaTilde(0) was zero");var D=s.inverse(F),L=g.multiplyScalar(D),k=h.multiplyScalar(D);return[L,k]},r.prototype.findErrorLocations=function(e){var t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);for(var n=new Int32Array(t),a=0,s=this.field,f=1;f<s.getSize()&&a<t;f++)e.evaluateAt(f)===0&&(n[a]=s.inverse(f),a++);if(a!==t)throw new ri("Error locator degree does not match number of roots");return n},r.prototype.findErrorMagnitudes=function(e,t){for(var n=t.length,a=new Int32Array(n),s=this.field,f=0;f<n;f++){for(var h=s.inverse(t[f]),x=1,g=0;g<n;g++)if(f!==g){var w=s.multiply(t[g],h),A=(w&1)===0?w|1:w&-2;x=s.multiply(x,A)}a[f]=s.multiply(e.evaluateAt(h),s.inverse(x)),s.getGeneratorBase()!==0&&(a[f]=s.multiply(a[f],h))}return a},r})(),Ot;(function(r){r[r.UPPER=0]="UPPER",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.DIGIT=3]="DIGIT",r[r.PUNCT=4]="PUNCT",r[r.BINARY=5]="BINARY"})(Ot||(Ot={}));var uo=(function(){function r(){}return r.prototype.decode=function(e){this.ddata=e;var t=e.getBits(),n=this.extractBits(t),a=this.correctBits(n),s=r.convertBoolArrayToByteArray(a),f=r.getEncodedData(a),h=new Ai(s,f,null,null);return h.setNumBits(a.length),h},r.highLevelDecode=function(e){return this.getEncodedData(e)},r.getEncodedData=function(e){for(var t=e.length,n=Ot.UPPER,a=Ot.UPPER,s="",f=0;f<t;)if(a===Ot.BINARY){if(t-f<5)break;var h=r.readCode(e,f,5);if(f+=5,h===0){if(t-f<11)break;h=r.readCode(e,f,11)+31,f+=11}for(var x=0;x<h;x++){if(t-f<8){f=t;break}var g=r.readCode(e,f,8);s+=Te.castAsNonUtf8Char(g),f+=8}a=n}else{var w=a===Ot.DIGIT?4:5;if(t-f<w)break;var g=r.readCode(e,f,w);f+=w;var A=r.getCharacter(a,g);A.startsWith("CTRL_")?(n=a,a=r.getTable(A.charAt(5)),A.charAt(6)==="L"&&(n=a)):(s+=A,a=n)}return s},r.getTable=function(e){switch(e){case"L":return Ot.LOWER;case"P":return Ot.PUNCT;case"M":return Ot.MIXED;case"D":return Ot.DIGIT;case"B":return Ot.BINARY;case"U":default:return Ot.UPPER}},r.getCharacter=function(e,t){switch(e){case Ot.UPPER:return r.UPPER_TABLE[t];case Ot.LOWER:return r.LOWER_TABLE[t];case Ot.MIXED:return r.MIXED_TABLE[t];case Ot.PUNCT:return r.PUNCT_TABLE[t];case Ot.DIGIT:return r.DIGIT_TABLE[t];default:throw new Hn("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=Jt.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Jt.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Jt.AZTEC_DATA_10):(n=12,t=Jt.AZTEC_DATA_12);var a=this.ddata.getNbDatablocks(),s=e.length/n;if(s<a)throw new re;for(var f=e.length%n,h=new Int32Array(s),x=0;x<s;x++,f+=n)h[x]=r.readCode(e,f,n);try{var g=new yi(t);g.decode(h,s-a)}catch(P){throw new re(P)}for(var w=(1<<n)-1,A=0,x=0;x<a;x++){var E=h[x];if(E===0||E===w)throw new re;(E===1||E===w-1)&&A++}for(var C=new Array(a*n-A),b=0,x=0;x<a;x++){var E=h[x];if(E===1||E===w-1)C.fill(E>1,b,b+n-1),b+=n-1;else for(var T=n-1;T>=0;--T)C[b++]=(E&1<<T)!==0}return C},r.prototype.extractBits=function(e){var t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),a=(t?11:14)+n*4,s=new Int32Array(a),f=new Array(this.totalBitsInLayer(n,t));if(t)for(var h=0;h<s.length;h++)s[h]=h;else for(var x=a+1+2*Ie.truncDivision(Ie.truncDivision(a,2)-1,15),g=a/2,w=Ie.truncDivision(x,2),h=0;h<g;h++){var A=h+Ie.truncDivision(h,15);s[g-h-1]=w-A-1,s[g+h]=w+A+1}for(var h=0,E=0;h<n;h++){for(var C=(n-h)*4+(t?9:12),b=h*2,T=a-1-b,P=0;P<C;P++)for(var F=P*2,D=0;D<2;D++)f[E+F+D]=e.get(s[b+D],s[b+P]),f[E+2*C+F+D]=e.get(s[b+P],s[T-D]),f[E+4*C+F+D]=e.get(s[T-D],s[T-P]),f[E+6*C+F+D]=e.get(s[T-P],s[b+D]);E+=C*8}return f},r.readCode=function(e,t,n){for(var a=0,s=t;s<t+n;s++)a<<=1,e[s]&&(a|=1);return a},r.readByte=function(e,t){var n=e.length-t;return n>=8?r.readCode(e,t,8):r.readCode(e,t,n)<<8-n},r.convertBoolArrayToByteArray=function(e){for(var t=new Uint8Array((e.length+7)/8),n=0;n<t.length;n++)t[n]=r.readByte(e,8*n);return t},r.prototype.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.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"],r.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"],r.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
||
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],r.PUNCT_TABLE=["","\r",`\r
|
||
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],r.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],r})(),De=(function(){function r(){}return r.round=function(e){return isNaN(e)?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},r.distance=function(e,t,n,a){var s=e-n,f=t-a;return Math.sqrt(s*s+f*f)},r.sum=function(e){for(var t=0,n=0,a=e.length;n!==a;n++){var s=e[n];t+=s}return t},r})(),oa=(function(){function r(){}return r.floatToIntBits=function(e){return e},r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r})(),ce=(function(){function r(e,t){this.x=e,this.y=t}return r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.equals=function(e){if(e instanceof r){var t=e;return this.x===t.x&&this.y===t.y}return!1},r.prototype.hashCode=function(){return 31*oa.floatToIntBits(this.x)+oa.floatToIntBits(this.y)},r.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.orderBestPatterns=function(e){var t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),a=this.distance(e[0],e[2]),s,f,h;if(n>=t&&n>=a?(f=e[0],s=e[1],h=e[2]):a>=n&&a>=t?(f=e[1],s=e[0],h=e[2]):(f=e[2],s=e[0],h=e[1]),this.crossProductZ(s,f,h)<0){var x=s;s=h,h=x}e[0]=s,e[1]=f,e[2]=h},r.distance=function(e,t){return De.distance(e.x,e.y,t.x,t.y)},r.crossProductZ=function(e,t,n){var a=t.x,s=t.y;return(n.x-a)*(e.y-s)-(n.y-s)*(e.x-a)},r})(),ya=(function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r})(),a0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),o0=(function(r){a0(e,r);function e(t,n,a,s,f){var h=r.call(this,t,n)||this;return h.compact=a,h.nbDatablocks=s,h.nbLayers=f,h}return e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e})(ya),sa=(function(){function r(e,t,n,a){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=r.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),a==null&&(a=e.getHeight()/2|0);var s=t/2|0;if(this.leftInit=n-s,this.rightInit=n+s,this.upInit=a-s,this.downInit=a+s,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new j}return r.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,a=this.downInit,s=!1,f=!0,h=!1,x=!1,g=!1,w=!1,A=!1,E=this.width,C=this.height;f;){f=!1;for(var b=!0;(b||!x)&&t<E;)b=this.containsBlackPoint(n,a,t,!1),b?(t++,f=!0,x=!0):x||t++;if(t>=E){s=!0;break}for(var T=!0;(T||!g)&&a<C;)T=this.containsBlackPoint(e,t,a,!0),T?(a++,f=!0,g=!0):g||a++;if(a>=C){s=!0;break}for(var P=!0;(P||!w)&&e>=0;)P=this.containsBlackPoint(n,a,e,!1),P?(e--,f=!0,w=!0):w||e--;if(e<0){s=!0;break}for(var F=!0;(F||!A)&&n>=0;)F=this.containsBlackPoint(e,t,n,!0),F?(n--,f=!0,A=!0):A||n--;if(n<0){s=!0;break}f&&(h=!0)}if(!s&&h){for(var D=t-e,L=null,k=1;L===null&&k<D;k++)L=this.getBlackPointOnSegment(e,a-k,e+k,a);if(L==null)throw new j;for(var q=null,k=1;q===null&&k<D;k++)q=this.getBlackPointOnSegment(e,n+k,e+k,n);if(q==null)throw new j;for(var K=null,k=1;K===null&&k<D;k++)K=this.getBlackPointOnSegment(t,n+k,t-k,n);if(K==null)throw new j;for(var U=null,k=1;U===null&&k<D;k++)U=this.getBlackPointOnSegment(t,a-k,t-k,a);if(U==null)throw new j;return this.centerEdges(U,L,K,q)}else throw new j},r.prototype.getBlackPointOnSegment=function(e,t,n,a){for(var s=De.round(De.distance(e,t,n,a)),f=(n-e)/s,h=(a-t)/s,x=this.image,g=0;g<s;g++){var w=De.round(e+g*f),A=De.round(t+g*h);if(x.get(w,A))return new ce(w,A)}return null},r.prototype.centerEdges=function(e,t,n,a){var s=e.getX(),f=e.getY(),h=t.getX(),x=t.getY(),g=n.getX(),w=n.getY(),A=a.getX(),E=a.getY(),C=r.CORR;return s<this.width/2?[new ce(A-C,E+C),new ce(h+C,x+C),new ce(g-C,w-C),new ce(s+C,f-C)]:[new ce(A+C,E+C),new ce(h+C,x-C),new ce(g-C,w+C),new ce(s-C,f-C)]},r.prototype.containsBlackPoint=function(e,t,n,a){var s=this.image;if(a){for(var f=e;f<=t;f++)if(s.get(f,n))return!0}else for(var h=e;h<=t;h++)if(s.get(n,h))return!0;return!1},r.INIT_SIZE=10,r.CORR=1,r})(),lo=(function(){function r(){}return r.checkAndNudgePoints=function(e,t){for(var n=e.getWidth(),a=e.getHeight(),s=!0,f=0;f<t.length&&s;f+=2){var h=Math.floor(t[f]),x=Math.floor(t[f+1]);if(h<-1||h>n||x<-1||x>a)throw new j;s=!1,h===-1?(t[f]=0,s=!0):h===n&&(t[f]=n-1,s=!0),x===-1?(t[f+1]=0,s=!0):x===a&&(t[f+1]=a-1,s=!0)}s=!0;for(var f=t.length-2;f>=0&&s;f-=2){var h=Math.floor(t[f]),x=Math.floor(t[f+1]);if(h<-1||h>n||x<-1||x>a)throw new j;s=!1,h===-1?(t[f]=0,s=!0):h===n&&(t[f]=n-1,s=!0),x===-1?(t[f+1]=0,s=!0):x===a&&(t[f+1]=a-1,s=!0)}},r})(),qo=(function(){function r(e,t,n,a,s,f,h,x,g){this.a11=e,this.a21=t,this.a31=n,this.a12=a,this.a22=s,this.a32=f,this.a13=h,this.a23=x,this.a33=g}return r.quadrilateralToQuadrilateral=function(e,t,n,a,s,f,h,x,g,w,A,E,C,b,T,P){var F=r.quadrilateralToSquare(e,t,n,a,s,f,h,x),D=r.squareToQuadrilateral(g,w,A,E,C,b,T,P);return D.times(F)},r.prototype.transformPoints=function(e){for(var t=e.length,n=this.a11,a=this.a12,s=this.a13,f=this.a21,h=this.a22,x=this.a23,g=this.a31,w=this.a32,A=this.a33,E=0;E<t;E+=2){var C=e[E],b=e[E+1],T=s*C+x*b+A;e[E]=(n*C+f*b+g)/T,e[E+1]=(a*C+h*b+w)/T}},r.prototype.transformPointsWithValues=function(e,t){for(var n=this.a11,a=this.a12,s=this.a13,f=this.a21,h=this.a22,x=this.a23,g=this.a31,w=this.a32,A=this.a33,E=e.length,C=0;C<E;C++){var b=e[C],T=t[C],P=s*b+x*T+A;e[C]=(n*b+f*T+g)/P,t[C]=(a*b+h*T+w)/P}},r.squareToQuadrilateral=function(e,t,n,a,s,f,h,x){var g=e-n+s-h,w=t-a+f-x;if(g===0&&w===0)return new r(n-e,s-n,e,a-t,f-a,t,0,0,1);var A=n-s,E=h-s,C=a-f,b=x-f,T=A*b-E*C,P=(g*b-E*w)/T,F=(A*w-g*C)/T;return new r(n-e+P*n,h-e+F*h,e,a-t+P*a,x-t+F*x,t,P,F,1)},r.quadrilateralToSquare=function(e,t,n,a,s,f,h,x){return r.squareToQuadrilateral(e,t,n,a,s,f,h,x).buildAdjoint()},r.prototype.buildAdjoint=function(){return new r(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)},r.prototype.times=function(e){return new r(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)},r})(),s0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),c0=(function(r){s0(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.sampleGrid=function(t,n,a,s,f,h,x,g,w,A,E,C,b,T,P,F,D,L,k){var q=qo.quadrilateralToQuadrilateral(s,f,h,x,g,w,A,E,C,b,T,P,F,D,L,k);return this.sampleGridWithTransform(t,n,a,q)},e.prototype.sampleGridWithTransform=function(t,n,a,s){if(n<=0||a<=0)throw new j;for(var f=new br(n,a),h=new Float32Array(2*n),x=0;x<a;x++){for(var g=h.length,w=x+.5,A=0;A<g;A+=2)h[A]=A/2+.5,h[A+1]=w;s.transformPoints(h),lo.checkAndNudgePoints(t,h);try{for(var A=0;A<g;A+=2)t.get(Math.floor(h[A]),Math.floor(h[A+1]))&&f.set(A/2,x)}catch{throw new j}}return f},e})(lo),Ea=(function(){function r(){}return r.setGridSampler=function(e){r.gridSampler=e},r.getInstance=function(){return r.gridSampler},r.gridSampler=new c0,r})(),qt=(function(){function r(e,t){this.x=e,this.y=t}return r.prototype.toResultPoint=function(){return new ce(this.getX(),this.getY())},r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r})(),f0=(function(){function r(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}return r.prototype.detect=function(){return this.detectMirror(!1)},r.prototype.detectMirror=function(e){var t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){var a=n[0];n[0]=n[2],n[2]=a}this.extractParameters(n);var s=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),f=this.getMatrixCornerPoints(n);return new o0(s,f,this.compact,this.nbDataBlocks,this.nbLayers)},r.prototype.extractParameters=function(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new j;var 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);for(var a=0,s=0;s<4;s++){var f=n[(this.shift+s)%4];this.compact?(a<<=7,a+=f>>1&127):(a<<=10,a+=(f>>2&992)+(f>>1&31))}var h=this.getCorrectedParameterData(a,this.compact);this.compact?(this.nbLayers=(h>>6)+1,this.nbDataBlocks=(h&63)+1):(this.nbLayers=(h>>11)+1,this.nbDataBlocks=(h&2047)+1)},r.prototype.getRotation=function(e,t){var n=0;e.forEach(function(s,f,h){var x=(s>>t-2<<1)+(s&1);n=(n<<3)+x}),n=((n&1)<<11)+(n>>1);for(var a=0;a<4;a++)if(Ie.bitCount(n^this.EXPECTED_CORNER_BITS[a])<=2)return a;throw new j},r.prototype.getCorrectedParameterData=function(e,t){var n,a;t?(n=7,a=2):(n=10,a=4);for(var s=n-a,f=new Int32Array(n),h=n-1;h>=0;--h)f[h]=e&15,e>>=4;try{var x=new yi(Jt.AZTEC_PARAM);x.decode(f,s)}catch{throw new j}for(var g=0,h=0;h<a;h++)g=(g<<4)+f[h];return g},r.prototype.getBullsEyeCorners=function(e){var t=e,n=e,a=e,s=e,f=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){var h=this.getFirstDifferent(t,f,1,-1),x=this.getFirstDifferent(n,f,1,1),g=this.getFirstDifferent(a,f,-1,1),w=this.getFirstDifferent(s,f,-1,-1);if(this.nbCenterLayers>2){var A=this.distancePoint(w,h)*this.nbCenterLayers/(this.distancePoint(s,t)*(this.nbCenterLayers+2));if(A<.75||A>1.25||!this.isWhiteOrBlackRectangle(h,x,g,w))break}t=h,n=x,a=g,s=w,f=!f}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new j;this.compact=this.nbCenterLayers===5;var E=new ce(t.getX()+.5,t.getY()-.5),C=new ce(n.getX()+.5,n.getY()+.5),b=new ce(a.getX()-.5,a.getY()+.5),T=new ce(s.getX()-.5,s.getY()-.5);return this.expandSquare([E,C,b,T],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},r.prototype.getMatrixCenter=function(){var e,t,n,a;try{var s=new sa(this.image).detect();e=s[0],t=s[1],n=s[2],a=s[3]}catch{var f=this.image.getWidth()/2,h=this.image.getHeight()/2;e=this.getFirstDifferent(new qt(f+7,h-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new qt(f+7,h+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new qt(f-7,h+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new qt(f-7,h-7),!1,-1,-1).toResultPoint()}var x=De.round((e.getX()+a.getX()+t.getX()+n.getX())/4),g=De.round((e.getY()+a.getY()+t.getY()+n.getY())/4);try{var s=new sa(this.image,15,x,g).detect();e=s[0],t=s[1],n=s[2],a=s[3]}catch{e=this.getFirstDifferent(new qt(x+7,g-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new qt(x+7,g+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new qt(x-7,g+7),!1,-1,1).toResultPoint(),a=this.getFirstDifferent(new qt(x-7,g-7),!1,-1,-1).toResultPoint()}return x=De.round((e.getX()+a.getX()+t.getX()+n.getX())/4),g=De.round((e.getY()+a.getY()+t.getY()+n.getY())/4),new qt(x,g)},r.prototype.getMatrixCornerPoints=function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())},r.prototype.sampleGrid=function(e,t,n,a,s){var f=Ea.getInstance(),h=this.getDimension(),x=h/2-this.nbCenterLayers,g=h/2+this.nbCenterLayers;return f.sampleGrid(e,h,h,x,x,g,x,g,g,x,g,t.getX(),t.getY(),n.getX(),n.getY(),a.getX(),a.getY(),s.getX(),s.getY())},r.prototype.sampleLine=function(e,t,n){for(var a=0,s=this.distanceResultPoint(e,t),f=s/n,h=e.getX(),x=e.getY(),g=f*(t.getX()-e.getX())/s,w=f*(t.getY()-e.getY())/s,A=0;A<n;A++)this.image.get(De.round(h+A*g),De.round(x+A*w))&&(a|=1<<n-A-1);return a},r.prototype.isWhiteOrBlackRectangle=function(e,t,n,a){var s=3;e=new qt(e.getX()-s,e.getY()+s),t=new qt(t.getX()-s,t.getY()-s),n=new qt(n.getX()+s,n.getY()-s),a=new qt(a.getX()+s,a.getY()+s);var f=this.getColor(a,e);if(f===0)return!1;var h=this.getColor(e,t);return h!==f||(h=this.getColor(t,n),h!==f)?!1:(h=this.getColor(n,a),h===f)},r.prototype.getColor=function(e,t){for(var n=this.distancePoint(e,t),a=(t.getX()-e.getX())/n,s=(t.getY()-e.getY())/n,f=0,h=e.getX(),x=e.getY(),g=this.image.get(e.getX(),e.getY()),w=Math.ceil(n),A=0;A<w;A++)h+=a,x+=s,this.image.get(De.round(h),De.round(x))!==g&&f++;var E=f/n;return E>.1&&E<.9?0:E<=.1===g?1:-1},r.prototype.getFirstDifferent=function(e,t,n,a){for(var s=e.getX()+n,f=e.getY()+a;this.isValid(s,f)&&this.image.get(s,f)===t;)s+=n,f+=a;for(s-=n,f-=a;this.isValid(s,f)&&this.image.get(s,f)===t;)s+=n;for(s-=n;this.isValid(s,f)&&this.image.get(s,f)===t;)f+=a;return f-=a,new qt(s,f)},r.prototype.expandSquare=function(e,t,n){var a=n/(2*t),s=e[0].getX()-e[2].getX(),f=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,x=(e[0].getY()+e[2].getY())/2,g=new ce(h+a*s,x+a*f),w=new ce(h-a*s,x-a*f);s=e[1].getX()-e[3].getX(),f=e[1].getY()-e[3].getY(),h=(e[1].getX()+e[3].getX())/2,x=(e[1].getY()+e[3].getY())/2;var A=new ce(h+a*s,x+a*f),E=new ce(h-a*s,x-a*f),C=[g,A,w,E];return C},r.prototype.isValid=function(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()},r.prototype.isValidPoint=function(e){var t=De.round(e.getX()),n=De.round(e.getY());return this.isValid(t,n)},r.prototype.distancePoint=function(e,t){return De.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.distanceResultPoint=function(e,t){return De.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.getDimension=function(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(Ie.truncDivision(this.nbLayers-4,8)+1)+15},r})(),ca=(function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=null,a=new f0(e.getBlackMatrix()),s=null,f=null;try{var h=a.detectMirror(!1);s=h.getPoints(),this.reportFoundResultPoints(t,s),f=new uo().decode(h)}catch(A){n=A}if(f==null)try{var h=a.detectMirror(!0);s=h.getPoints(),this.reportFoundResultPoints(t,s),f=new uo().decode(h)}catch(A){throw n??A}var x=new Bt(f.getText(),f.getRawBytes(),f.getNumBits(),s,se.AZTEC,Ke.currentTimeMillis()),g=f.getByteSegments();g!=null&&x.putMetadata(Rt.BYTE_SEGMENTS,g);var w=f.getECLevel();return w!=null&&x.putMetadata(Rt.ERROR_CORRECTION_LEVEL,w),x},r.prototype.reportFoundResultPoints=function(e,t){if(e!=null){var n=e.get(tt.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach(function(a,s,f){n.foundPossibleResultPoint(a)})}},r.prototype.reset=function(){},r})(),u0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){u0(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new ca,t)||this}return e})(An);var vt=(function(){function r(){}return r.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch{var n=t&&t.get(tt.TRY_HARDER)===!0;if(n&&e.isRotateSupported()){var a=e.rotateCounterClockwise(),s=this.doDecode(a,t),f=s.getResultMetadata(),h=270;f!==null&&f.get(Rt.ORIENTATION)===!0&&(h=h+f.get(Rt.ORIENTATION)%360),s.putMetadata(Rt.ORIENTATION,h);var x=s.getResultPoints();if(x!==null)for(var g=a.getHeight(),w=0;w<x.length;w++)x[w]=new ce(g-x[w].getY()-1,x[w].getX());return s}else throw new j}},r.prototype.reset=function(){},r.prototype.doDecode=function(e,t){var n=e.getWidth(),a=e.getHeight(),s=new mt(n),f=t&&t.get(tt.TRY_HARDER)===!0,h=Math.max(1,a>>(f?8:5)),x;f?x=a:x=15;for(var g=Math.trunc(a/2),w=0;w<x;w++){var A=Math.trunc((w+1)/2),E=(w&1)===0,C=g+h*(E?A:-A);if(C<0||C>=a)break;try{s=e.getBlackRow(C,s)}catch{continue}for(var b=function(D){if(D===1&&(s.reverse(),t&&t.get(tt.NEED_RESULT_POINT_CALLBACK)===!0)){var L=new Map;t.forEach(function(K,U){return L.set(U,K)}),L.delete(tt.NEED_RESULT_POINT_CALLBACK),t=L}try{var k=T.decodeRow(C,s,t);if(D===1){k.putMetadata(Rt.ORIENTATION,180);var q=k.getResultPoints();q!==null&&(q[0]=new ce(n-q[0].getX()-1,q[0].getY()),q[1]=new ce(n-q[1].getX()-1,q[1].getY()))}return{value:k}}catch{}},T=this,P=0;P<2;P++){var F=b(P);if(typeof F=="object")return F.value}}throw new j},r.recordPattern=function(e,t,n){for(var a=n.length,s=0;s<a;s++)n[s]=0;var f=e.getSize();if(t>=f)throw new j;for(var h=!e.get(t),x=0,g=t;g<f;){if(e.get(g)!==h)n[x]++;else{if(++x===a)break;n[x]=1,h=!h}g++}if(!(x===a||x===a-1&&g===f))throw new j},r.recordPatternInReverse=function(e,t,n){for(var a=n.length,s=e.get(t);t>0&&a>=0;)e.get(--t)!==s&&(a--,s=!s);if(a>=0)throw new j;r.recordPattern(e,t+1,n)},r.patternMatchVariance=function(e,t,n){for(var a=e.length,s=0,f=0,h=0;h<a;h++)s+=e[h],f+=t[h];if(s<f)return Number.POSITIVE_INFINITY;var x=s/f;n*=x;for(var g=0,w=0;w<a;w++){var A=e[w],E=t[w]*x,C=A>E?A-E:E-A;if(C>n)return Number.POSITIVE_INFINITY;g+=C}return g/s},r})(),l0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),ho=(function(r){l0(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.findStartPattern=function(t){for(var n=t.getSize(),a=t.getNextSet(0),s=0,f=Int32Array.from([0,0,0,0,0,0]),h=a,x=!1,g=6,w=a;w<n;w++)if(t.get(w)!==x)f[s]++;else{if(s===g-1){for(var A=e.MAX_AVG_VARIANCE,E=-1,C=e.CODE_START_A;C<=e.CODE_START_C;C++){var b=vt.patternMatchVariance(f,e.CODE_PATTERNS[C],e.MAX_INDIVIDUAL_VARIANCE);b<A&&(A=b,E=C)}if(E>=0&&t.isRange(Math.max(0,h-(w-h)/2),h,!1))return Int32Array.from([h,w,E]);h+=f[0]+f[1],f=f.slice(2,f.length-1),f[s-1]=0,f[s]=0,s--}else s++;f[s]=1,x=!x}throw new j},e.decodeCode=function(t,n,a){vt.recordPattern(t,a,n);for(var s=e.MAX_AVG_VARIANCE,f=-1,h=0;h<e.CODE_PATTERNS.length;h++){var x=e.CODE_PATTERNS[h],g=this.patternMatchVariance(n,x,e.MAX_INDIVIDUAL_VARIANCE);g<s&&(s=g,f=h)}if(f>=0)return f;throw new j},e.prototype.decodeRow=function(t,n,a){var s=a&&a.get(tt.ASSUME_GS1)===!0,f=e.findStartPattern(n),h=f[2],x=0,g=new Uint8Array(20);g[x++]=h;var w;switch(h){case e.CODE_START_A:w=e.CODE_CODE_A;break;case e.CODE_START_B:w=e.CODE_CODE_B;break;case e.CODE_START_C:w=e.CODE_CODE_C;break;default:throw new re}for(var A=!1,E=!1,C="",b=f[0],T=f[1],P=Int32Array.from([0,0,0,0,0,0]),F=0,D=0,L=h,k=0,q=!0,K=!1,U=!1;!A;){var $=E;switch(E=!1,F=D,D=e.decodeCode(n,P,T),g[x++]=D,D!==e.CODE_STOP&&(q=!0),D!==e.CODE_STOP&&(k++,L+=k*D),b=T,T+=P.reduce(function(ge,rr){return ge+rr},0),D){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new re}switch(w){case e.CODE_CODE_A:if(D<64)U===K?C+=String.fromCharCode(32+D):C+=String.fromCharCode(32+D+128),U=!1;else if(D<96)U===K?C+=String.fromCharCode(D-64):C+=String.fromCharCode(D+64),U=!1;else switch(D!==e.CODE_STOP&&(q=!1),D){case e.CODE_FNC_1:s&&(C.length===0?C+="]C1":C+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!K&&U?(K=!0,U=!1):K&&U?(K=!1,U=!1):U=!0;break;case e.CODE_SHIFT:E=!0,w=e.CODE_CODE_B;break;case e.CODE_CODE_B:w=e.CODE_CODE_B;break;case e.CODE_CODE_C:w=e.CODE_CODE_C;break;case e.CODE_STOP:A=!0;break}break;case e.CODE_CODE_B:if(D<96)U===K?C+=String.fromCharCode(32+D):C+=String.fromCharCode(32+D+128),U=!1;else switch(D!==e.CODE_STOP&&(q=!1),D){case e.CODE_FNC_1:s&&(C.length===0?C+="]C1":C+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!K&&U?(K=!0,U=!1):K&&U?(K=!1,U=!1):U=!0;break;case e.CODE_SHIFT:E=!0,w=e.CODE_CODE_A;break;case e.CODE_CODE_A:w=e.CODE_CODE_A;break;case e.CODE_CODE_C:w=e.CODE_CODE_C;break;case e.CODE_STOP:A=!0;break}break;case e.CODE_CODE_C:if(D<100)D<10&&(C+="0"),C+=D;else switch(D!==e.CODE_STOP&&(q=!1),D){case e.CODE_FNC_1:s&&(C.length===0?C+="]C1":C+="");break;case e.CODE_CODE_A:w=e.CODE_CODE_A;break;case e.CODE_CODE_B:w=e.CODE_CODE_B;break;case e.CODE_STOP:A=!0;break}break}$&&(w=w===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var Y=T-b;if(T=n.getNextUnset(T),!n.isRange(T,Math.min(n.getSize(),T+(T-b)/2),!1))throw new j;if(L-=k*F,L%103!==F)throw new _t;var ue=C.length;if(ue===0)throw new j;ue>0&&q&&(w===e.CODE_CODE_C?C=C.substring(0,ue-2):C=C.substring(0,ue-1));for(var _e=(f[1]+f[0])/2,Z=b+Y/2,ne=g.length,le=new Uint8Array(ne),X=0;X<ne;X++)le[X]=g[X];var me=[new ce(_e,t),new ce(Z,t)];return new Bt(C,le,0,me,se.CODE_128,new Date().getTime())},e.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])],e.MAX_AVG_VARIANCE=.25,e.MAX_INDIVIDUAL_VARIANCE=.7,e.CODE_SHIFT=98,e.CODE_CODE_C=99,e.CODE_CODE_B=100,e.CODE_CODE_A=101,e.CODE_FNC_1=102,e.CODE_FNC_2=97,e.CODE_FNC_3=96,e.CODE_FNC_4_A=101,e.CODE_FNC_4_B=100,e.CODE_START_A=103,e.CODE_START_B=104,e.CODE_START_C=105,e.CODE_STOP=106,e})(vt),h0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Wi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},xo=(function(r){h0(e,r);function e(t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var a=r.call(this)||this;return a.usingCheckDigit=t,a.extendedMode=n,a.decodeRowResult="",a.counters=new Int32Array(9),a}return e.prototype.decodeRow=function(t,n,a){var s,f,h,x,g=this.counters;g.fill(0),this.decodeRowResult="";var w=e.findAsteriskPattern(n,g),A=n.getNextSet(w[1]),E=n.getSize(),C,b;do{e.recordPattern(n,A,g);var T=e.toNarrowWidePattern(g);if(T<0)throw new j;C=e.patternToChar(T),this.decodeRowResult+=C,b=A;try{for(var P=(s=void 0,Wi(g)),F=P.next();!F.done;F=P.next()){var D=F.value;A+=D}}catch(ne){s={error:ne}}finally{try{F&&!F.done&&(f=P.return)&&f.call(P)}finally{if(s)throw s.error}}A=n.getNextSet(A)}while(C!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var L=0;try{for(var k=Wi(g),q=k.next();!q.done;q=k.next()){var D=q.value;L+=D}}catch(ne){h={error:ne}}finally{try{q&&!q.done&&(x=k.return)&&x.call(k)}finally{if(h)throw h.error}}var K=A-b-L;if(A!==E&&K*2<L)throw new j;if(this.usingCheckDigit){for(var U=this.decodeRowResult.length-1,$=0,Y=0;Y<U;Y++)$+=e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(Y));if(this.decodeRowResult.charAt(U)!==e.ALPHABET_STRING.charAt($%43))throw new _t;this.decodeRowResult=this.decodeRowResult.substring(0,U)}if(this.decodeRowResult.length===0)throw new j;var ue;this.extendedMode?ue=e.decodeExtended(this.decodeRowResult):ue=this.decodeRowResult;var _e=(w[1]+w[0])/2,Z=b+L/2;return new Bt(ue,null,0,[new ce(_e,t),new ce(Z,t)],se.CODE_39,new Date().getTime())},e.findAsteriskPattern=function(t,n){for(var a=t.getSize(),s=t.getNextSet(0),f=0,h=s,x=!1,g=n.length,w=s;w<a;w++)if(t.get(w)!==x)n[f]++;else{if(f===g-1){if(this.toNarrowWidePattern(n)===e.ASTERISK_ENCODING&&t.isRange(Math.max(0,h-Math.floor((w-h)/2)),h,!1))return[h,w];h+=n[0]+n[1],n.copyWithin(0,2,2+f-1),n[f-1]=0,n[f]=0,f--}else f++;n[f]=1,x=!x}throw new j},e.toNarrowWidePattern=function(t){var n,a,s=t.length,f=0,h;do{var x=2147483647;try{for(var g=(n=void 0,Wi(t)),w=g.next();!w.done;w=g.next()){var A=w.value;A<x&&A>f&&(x=A)}}catch(T){n={error:T}}finally{try{w&&!w.done&&(a=g.return)&&a.call(g)}finally{if(n)throw n.error}}f=x,h=0;for(var E=0,C=0,b=0;b<s;b++){var A=t[b];A>f&&(C|=1<<s-1-b,h++,E+=A)}if(h===3){for(var b=0;b<s&&h>0;b++){var A=t[b];if(A>f&&(h--,A*2>=E))return-1}return C}}while(h>3);return-1},e.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);if(t===e.ASTERISK_ENCODING)return"*";throw new j},e.decodeExtended=function(t){for(var n=t.length,a="",s=0;s<n;s++){var f=t.charAt(s);if(f==="+"||f==="$"||f==="%"||f==="/"){var h=t.charAt(s+1),x="\0";switch(f){case"+":if(h>="A"&&h<="Z")x=String.fromCharCode(h.charCodeAt(0)+32);else throw new re;break;case"$":if(h>="A"&&h<="Z")x=String.fromCharCode(h.charCodeAt(0)-64);else throw new re;break;case"%":if(h>="A"&&h<="E")x=String.fromCharCode(h.charCodeAt(0)-38);else if(h>="F"&&h<="J")x=String.fromCharCode(h.charCodeAt(0)-11);else if(h>="K"&&h<="O")x=String.fromCharCode(h.charCodeAt(0)+16);else if(h>="P"&&h<="T")x=String.fromCharCode(h.charCodeAt(0)+43);else if(h==="U")x="\0";else if(h==="V")x="@";else if(h==="W")x="`";else if(h==="X"||h==="Y"||h==="Z")x="";else throw new re;break;case"/":if(h>="A"&&h<="O")x=String.fromCharCode(h.charCodeAt(0)-32);else if(h==="Z")x=":";else throw new re;break}a+=x,s++}else a+=f}return a},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.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],e.ASTERISK_ENCODING=148,e})(vt),d0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),zi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},go=(function(r){d0(e,r);function e(){var t=r.call(this)||this;return t.decodeRowResult="",t.counters=new Int32Array(6),t}return e.prototype.decodeRow=function(t,n,a){var s,f,h,x,g=this.findAsteriskPattern(n),w=n.getNextSet(g[1]),A=n.getSize(),E=this.counters;E.fill(0),this.decodeRowResult="";var C,b;do{e.recordPattern(n,w,E);var T=this.toPattern(E);if(T<0)throw new j;C=this.patternToChar(T),this.decodeRowResult+=C,b=w;try{for(var P=(s=void 0,zi(E)),F=P.next();!F.done;F=P.next()){var D=F.value;w+=D}}catch(Y){s={error:Y}}finally{try{F&&!F.done&&(f=P.return)&&f.call(P)}finally{if(s)throw s.error}}w=n.getNextSet(w)}while(C!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var L=0;try{for(var k=zi(E),q=k.next();!q.done;q=k.next()){var D=q.value;L+=D}}catch(Y){h={error:Y}}finally{try{q&&!q.done&&(x=k.return)&&x.call(k)}finally{if(h)throw h.error}}if(w===A||!n.get(w))throw new j;if(this.decodeRowResult.length<2)throw new j;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var K=this.decodeExtended(this.decodeRowResult),U=(g[1]+g[0])/2,$=b+L/2;return new Bt(K,null,0,[new ce(U,t),new ce($,t)],se.CODE_93,new Date().getTime())},e.prototype.findAsteriskPattern=function(t){var n=t.getSize(),a=t.getNextSet(0);this.counters.fill(0);for(var s=this.counters,f=a,h=!1,x=s.length,g=0,w=a;w<n;w++)if(t.get(w)!==h)s[g]++;else{if(g===x-1){if(this.toPattern(s)===e.ASTERISK_ENCODING)return new Int32Array([f,w]);f+=s[0]+s[1],s.copyWithin(0,2,2+g-1),s[g-1]=0,s[g]=0,g--}else g++;s[g]=1,h=!h}throw new j},e.prototype.toPattern=function(t){var n,a,s=0;try{for(var f=zi(t),h=f.next();!h.done;h=f.next()){var x=h.value;s+=x}}catch(b){n={error:b}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}for(var g=0,w=t.length,A=0;A<w;A++){var E=Math.round(t[A]*9/s);if(E<1||E>4)return-1;if((A&1)===0)for(var C=0;C<E;C++)g=g<<1|1;else g<<=E}return g},e.prototype.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);throw new j},e.prototype.decodeExtended=function(t){for(var n=t.length,a="",s=0;s<n;s++){var f=t.charAt(s);if(f>="a"&&f<="d"){if(s>=n-1)throw new re;var h=t.charAt(s+1),x="\0";switch(f){case"d":if(h>="A"&&h<="Z")x=String.fromCharCode(h.charCodeAt(0)+32);else throw new re;break;case"a":if(h>="A"&&h<="Z")x=String.fromCharCode(h.charCodeAt(0)-64);else throw new re;break;case"b":if(h>="A"&&h<="E")x=String.fromCharCode(h.charCodeAt(0)-38);else if(h>="F"&&h<="J")x=String.fromCharCode(h.charCodeAt(0)-11);else if(h>="K"&&h<="O")x=String.fromCharCode(h.charCodeAt(0)+16);else if(h>="P"&&h<="T")x=String.fromCharCode(h.charCodeAt(0)+43);else if(h==="U")x="\0";else if(h==="V")x="@";else if(h==="W")x="`";else if(h>="X"&&h<="Z")x="";else throw new re;break;case"c":if(h>="A"&&h<="O")x=String.fromCharCode(h.charCodeAt(0)-32);else if(h==="Z")x=":";else throw new re;break}a+=x,s++}else a+=f}return a},e.prototype.checkChecksums=function(t){var n=t.length;this.checkOneChecksum(t,n-2,20),this.checkOneChecksum(t,n-1,15)},e.prototype.checkOneChecksum=function(t,n,a){for(var s=1,f=0,h=n-1;h>=0;h--)f+=s*e.ALPHABET_STRING.indexOf(t.charAt(h)),++s>a&&(s=1);if(t.charAt(n)!==e.ALPHABET_STRING[f%47])throw new _t},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e})(vt),x0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),g0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},po=(function(r){x0(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.narrowLineWidth=-1,t}return e.prototype.decodeRow=function(t,n,a){var s,f,h=this.decodeStart(n),x=this.decodeEnd(n),g=new Ce;e.decodeMiddle(n,h[1],x[0],g);var w=g.toString(),A=null;a!=null&&(A=a.get(tt.ALLOWED_LENGTHS)),A==null&&(A=e.DEFAULT_ALLOWED_LENGTHS);var E=w.length,C=!1,b=0;try{for(var T=g0(A),P=T.next();!P.done;P=T.next()){var F=P.value;if(E===F){C=!0;break}F>b&&(b=F)}}catch(k){s={error:k}}finally{try{P&&!P.done&&(f=T.return)&&f.call(T)}finally{if(s)throw s.error}}if(!C&&E>b&&(C=!0),!C)throw new re;var D=[new ce(h[1],t),new ce(x[0],t)],L=new Bt(w,null,0,D,se.ITF,new Date().getTime());return L},e.decodeMiddle=function(t,n,a,s){var f=new Int32Array(10),h=new Int32Array(5),x=new Int32Array(5);for(f.fill(0),h.fill(0),x.fill(0);n<a;){vt.recordPattern(t,n,f);for(var g=0;g<5;g++){var w=2*g;h[g]=f[w],x[g]=f[w+1]}var A=e.decodeDigit(h);s.append(A.toString()),A=this.decodeDigit(x),s.append(A.toString()),f.forEach(function(E){n+=E})}},e.prototype.decodeStart=function(t){var n=e.skipWhiteSpace(t),a=e.findGuardPattern(t,n,e.START_PATTERN);return this.narrowLineWidth=(a[1]-a[0])/4,this.validateQuietZone(t,a[0]),a},e.prototype.validateQuietZone=function(t,n){var a=this.narrowLineWidth*10;a=a<n?a:n;for(var s=n-1;a>0&&s>=0&&!t.get(s);s--)a--;if(a!==0)throw new j},e.skipWhiteSpace=function(t){var n=t.getSize(),a=t.getNextSet(0);if(a===n)throw new j;return a},e.prototype.decodeEnd=function(t){t.reverse();try{var n=e.skipWhiteSpace(t),a=void 0;try{a=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[0])}catch(f){f instanceof j&&(a=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,a[0]);var s=a[0];return a[0]=t.getSize()-a[1],a[1]=t.getSize()-s,a}finally{t.reverse()}},e.findGuardPattern=function(t,n,a){var s=a.length,f=new Int32Array(s),h=t.getSize(),x=!1,g=0,w=n;f.fill(0);for(var A=n;A<h;A++)if(t.get(A)!==x)f[g]++;else{if(g===s-1){if(vt.patternMatchVariance(f,a,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[w,A];w+=f[0]+f[1],Ke.arraycopy(f,2,f,0,g-1),f[g-1]=0,f[g]=0,g--}else g++;f[g]=1,x=!x}throw new j},e.decodeDigit=function(t){for(var n=e.MAX_AVG_VARIANCE,a=-1,s=e.PATTERNS.length,f=0;f<s;f++){var h=e.PATTERNS[f],x=vt.patternMatchVariance(t,h,e.MAX_INDIVIDUAL_VARIANCE);x<n?(n=x,a=f):x===n&&(a=-1)}if(a>=0)return a%10;throw new j},e.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])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e})(vt),p0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),wn=(function(r){p0(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.decodeRowStringBuffer="",t}return e.findStartGuardPattern=function(t){for(var n=!1,a,s=0,f=Int32Array.from([0,0,0]);!n;){f=Int32Array.from([0,0,0]),a=e.findGuardPattern(t,s,!1,this.START_END_PATTERN,f);var h=a[0];s=a[1];var x=h-(s-h);x>=0&&(n=t.isRange(x,h,!1))}return a},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var a=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===a},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,a=0,s=n-1;s>=0;s-=2){var f=t.charAt(s).charCodeAt(0)-48;if(f<0||f>9)throw new re;a+=f}a*=3;for(var s=n-2;s>=0;s-=2){var f=t.charAt(s).charCodeAt(0)-48;if(f<0||f>9)throw new re;a+=f}return(1e3-a)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,n,a,s){return this.findGuardPattern(t,n,a,s,new Int32Array(s.length))},e.findGuardPattern=function(t,n,a,s,f){var h=t.getSize();n=a?t.getNextUnset(n):t.getNextSet(n);for(var x=0,g=n,w=s.length,A=a,E=n;E<h;E++)if(t.get(E)!==A)f[x]++;else{if(x===w-1){if(vt.patternMatchVariance(f,s,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return Int32Array.from([g,E]);g+=f[0]+f[1];for(var C=f.slice(2,f.length),b=0;b<x-1;b++)f[b]=C[b];f[x-1]=0,f[x]=0,x--}else x++;f[x]=1,A=!A}throw new j},e.decodeDigit=function(t,n,a,s){this.recordPattern(t,a,n);for(var f=this.MAX_AVG_VARIANCE,h=-1,x=s.length,g=0;g<x;g++){var w=s[g],A=vt.patternMatchVariance(n,w,e.MAX_INDIVIDUAL_VARIANCE);A<f&&(f=A,h=g)}if(h>=0)return h;throw new j},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])],e})(vt),v0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},w0=(function(){function r(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var a=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,a),f=a.toString(),h=r.parseExtensionString(f),x=[new ce((n[0]+n[1])/2,e),new ce(s,e)],g=new Bt(f,null,0,x,se.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&g.putAllMetadata(h),g},r.prototype.decodeMiddle=function(e,t,n){var a,s,f=this.decodeMiddleCounters;f[0]=0,f[1]=0,f[2]=0,f[3]=0;for(var h=e.getSize(),x=t[1],g=0,w=0;w<5&&x<h;w++){var A=wn.decodeDigit(e,f,x,wn.L_AND_G_PATTERNS);n+=String.fromCharCode(48+A%10);try{for(var E=(a=void 0,v0(f)),C=E.next();!C.done;C=E.next()){var b=C.value;x+=b}}catch(P){a={error:P}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}A>=10&&(g|=1<<4-w),w!==4&&(x=e.getNextSet(x),x=e.getNextUnset(x))}if(n.length!==5)throw new j;var T=this.determineCheckDigit(g);if(r.extensionChecksum(n.toString())!==T)throw new j;return x},r.extensionChecksum=function(e){for(var t=e.length,n=0,a=t-2;a>=0;a-=2)n+=e.charAt(a).charCodeAt(0)-48;n*=3;for(var a=t-1;a>=0;a-=2)n+=e.charAt(a).charCodeAt(0)-48;return n*=3,n%10},r.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new j},r.parseExtensionString=function(e){if(e.length!==5)return null;var t=r.parseExtension5String(e);return t==null?null:new Map([[Rt.SUGGESTED_PRICE,t]])},r.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";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}var n=parseInt(e.substring(1)),a=(n/100).toString(),s=n%100,f=s<10?"0"+s:s.toString();return t+a+"."+f},r})(),A0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},y0=(function(){function r(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var a=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,a),f=a.toString(),h=r.parseExtensionString(f),x=[new ce((n[0]+n[1])/2,e),new ce(s,e)],g=new Bt(f,null,0,x,se.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&g.putAllMetadata(h),g},r.prototype.decodeMiddle=function(e,t,n){var a,s,f=this.decodeMiddleCounters;f[0]=0,f[1]=0,f[2]=0,f[3]=0;for(var h=e.getSize(),x=t[1],g=0,w=0;w<2&&x<h;w++){var A=wn.decodeDigit(e,f,x,wn.L_AND_G_PATTERNS);n+=String.fromCharCode(48+A%10);try{for(var E=(a=void 0,A0(f)),C=E.next();!C.done;C=E.next()){var b=C.value;x+=b}}catch(T){a={error:T}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}A>=10&&(g|=1<<1-w),w!==1&&(x=e.getNextSet(x),x=e.getNextUnset(x))}if(n.length!==2)throw new j;if(parseInt(n.toString())%4!==g)throw new j;return x},r.parseExtensionString=function(e){return e.length!==2?null:new Map([[Rt.ISSUE_NUMBER,parseInt(e)]])},r})(),E0=(function(){function r(){}return r.decodeRow=function(e,t,n){var a=wn.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{var s=new w0;return s.decodeRow(e,t,a)}catch{var f=new y0;return f.decodeRow(e,t,a)}},r.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),r})(),C0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),xt=(function(r){C0(e,r);function e(){var t=r.call(this)||this;t.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(h){return Int32Array.from(h)});for(var n=10;n<20;n++){for(var a=e.L_PATTERNS[n-10],s=new Int32Array(a.length),f=0;f<a.length;f++)s[f]=a[a.length-f-1];e.L_AND_G_PATTERNS[n]=s}return t}return e.prototype.decodeRow=function(t,n,a){var s=e.findStartGuardPattern(n),f=a==null?null:a.get(tt.NEED_RESULT_POINT_CALLBACK);if(f!=null){var h=new ce((s[0]+s[1])/2,t);f.foundPossibleResultPoint(h)}var x=this.decodeMiddle(n,s,this.decodeRowStringBuffer),g=x.rowOffset,w=x.resultString;if(f!=null){var A=new ce(g,t);f.foundPossibleResultPoint(A)}var E=e.decodeEnd(n,g);if(f!=null){var C=new ce((E[0]+E[1])/2,t);f.foundPossibleResultPoint(C)}var b=E[1],T=b+(b-E[0]);if(T>=n.getSize()||!n.isRange(b,T,!1))throw new j;var P=w.toString();if(P.length<8)throw new re;if(!e.checkChecksum(P))throw new _t;var F=(s[1]+s[0])/2,D=(E[1]+E[0])/2,L=this.getBarcodeFormat(),k=[new ce(F,t),new ce(D,t)],q=new Bt(P,null,0,k,L,new Date().getTime()),K=0;try{var U=E0.decodeRow(t,n,E[1]);q.putMetadata(Rt.UPC_EAN_EXTENSION,U.getText()),q.putAllMetadata(U.getResultMetadata()),q.addResultPoints(U.getResultPoints()),K=U.getText().length}catch{}var $=a==null?null:a.get(tt.ALLOWED_EAN_EXTENSIONS);if($!=null){var Y=!1;for(var ue in $)if(K.toString()===ue){Y=!0;break}if(!Y)throw new j}return L===se.EAN_13||se.UPC_A,q},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var a=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===a},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,a=0,s=n-1;s>=0;s-=2){var f=t.charAt(s).charCodeAt(0)-48;if(f<0||f>9)throw new re;a+=f}a*=3;for(var s=n-2;s>=0;s-=2){var f=t.charAt(s).charCodeAt(0)-48;if(f<0||f>9)throw new re;a+=f}return(1e3-a)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e})(wn),_0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),vo=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},fa=(function(r){_0(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,a){var s,f,h,x,g=this.decodeMiddleCounters;g[0]=0,g[1]=0,g[2]=0,g[3]=0;for(var w=t.getSize(),A=n[1],E=0,C=0;C<6&&A<w;C++){var b=xt.decodeDigit(t,g,A,xt.L_AND_G_PATTERNS);a+=String.fromCharCode(48+b%10);try{for(var T=(s=void 0,vo(g)),P=T.next();!P.done;P=T.next()){var F=P.value;A+=F}}catch(q){s={error:q}}finally{try{P&&!P.done&&(f=T.return)&&f.call(T)}finally{if(s)throw s.error}}b>=10&&(E|=1<<5-C)}a=e.determineFirstDigit(a,E);var D=xt.findGuardPattern(t,A,!0,xt.MIDDLE_PATTERN,new Int32Array(xt.MIDDLE_PATTERN.length).fill(0));A=D[1];for(var C=0;C<6&&A<w;C++){var b=xt.decodeDigit(t,g,A,xt.L_PATTERNS);a+=String.fromCharCode(48+b);try{for(var L=(h=void 0,vo(g)),k=L.next();!k.done;k=L.next()){var F=k.value;A+=F}}catch(U){h={error:U}}finally{try{k&&!k.done&&(x=L.return)&&x.call(L)}finally{if(h)throw h.error}}}return{rowOffset:A,resultString:a}},e.prototype.getBarcodeFormat=function(){return se.EAN_13},e.determineFirstDigit=function(t,n){for(var a=0;a<10;a++)if(n===this.FIRST_DIGIT_ENCODINGS[a])return t=String.fromCharCode(48+a)+t,t;throw new j},e.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],e})(xt),m0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),wo=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ao=(function(r){m0(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,a){var s,f,h,x,g=this.decodeMiddleCounters;g[0]=0,g[1]=0,g[2]=0,g[3]=0;for(var w=t.getSize(),A=n[1],E=0;E<4&&A<w;E++){var C=xt.decodeDigit(t,g,A,xt.L_PATTERNS);a+=String.fromCharCode(48+C);try{for(var b=(s=void 0,wo(g)),T=b.next();!T.done;T=b.next()){var P=T.value;A+=P}}catch(k){s={error:k}}finally{try{T&&!T.done&&(f=b.return)&&f.call(b)}finally{if(s)throw s.error}}}var F=xt.findGuardPattern(t,A,!0,xt.MIDDLE_PATTERN,new Int32Array(xt.MIDDLE_PATTERN.length).fill(0));A=F[1];for(var E=0;E<4&&A<w;E++){var C=xt.decodeDigit(t,g,A,xt.L_PATTERNS);a+=String.fromCharCode(48+C);try{for(var D=(h=void 0,wo(g)),L=D.next();!L.done;L=D.next()){var P=L.value;A+=P}}catch(K){h={error:K}}finally{try{L&&!L.done&&(x=D.return)&&x.call(D)}finally{if(h)throw h.error}}}return{rowOffset:A,resultString:a}},e.prototype.getBarcodeFormat=function(){return se.EAN_8},e})(xt),I0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),yo=(function(r){I0(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ean13Reader=new fa,t}return e.prototype.getBarcodeFormat=function(){return se.UPC_A},e.prototype.decode=function(t,n){return this.maybeReturnResult(this.ean13Reader.decode(t))},e.prototype.decodeRow=function(t,n,a){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,n,a))},e.prototype.decodeMiddle=function(t,n,a){return this.ean13Reader.decodeMiddle(t,n,a)},e.prototype.maybeReturnResult=function(t){var n=t.getText();if(n.charAt(0)==="0"){var a=new Bt(n.substring(1),null,null,t.getResultPoints(),se.UPC_A);return t.getResultMetadata()!=null&&a.putAllMetadata(t.getResultMetadata()),a}else throw new j},e.prototype.reset=function(){this.ean13Reader.reset()},e})(xt),S0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),b0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Eo=(function(r){S0(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=new Int32Array(4),t}return e.prototype.decodeMiddle=function(t,n,a){var s,f,h=this.decodeMiddleCounters.map(function(P){return P});h[0]=0,h[1]=0,h[2]=0,h[3]=0;for(var x=t.getSize(),g=n[1],w=0,A=0;A<6&&g<x;A++){var E=e.decodeDigit(t,h,g,e.L_AND_G_PATTERNS);a+=String.fromCharCode(48+E%10);try{for(var C=(s=void 0,b0(h)),b=C.next();!b.done;b=C.next()){var T=b.value;g+=T}}catch(P){s={error:P}}finally{try{b&&!b.done&&(f=C.return)&&f.call(C)}finally{if(s)throw s.error}}E>=10&&(w|=1<<5-A)}return e.determineNumSysAndCheckDigit(new Ce(a),w),g},e.prototype.decodeEnd=function(t,n){return e.findGuardPatternWithoutCounters(t,n,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return xt.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,n){for(var a=0;a<=1;a++)for(var s=0;s<10;s++)if(n===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[a][s]){t.insert(0,"0"+a),t.append("0"+s);return}throw j.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return se.UPC_E},e.convertUPCEtoUPCA=function(t){var n=t.slice(1,7).split("").map(function(f){return f.charCodeAt(0)}),a=new Ce;a.append(t.charAt(0));var s=n[5];switch(s){case 0:case 1:case 2:a.appendChars(n,0,2),a.append(s),a.append("0000"),a.appendChars(n,2,3);break;case 3:a.appendChars(n,0,3),a.append("00000"),a.appendChars(n,3,2);break;case 4:a.appendChars(n,0,4),a.append("00000"),a.append(n[4]);break;default:a.appendChars(n,0,5),a.append("0000"),a.append(s);break}return t.length>=8&&a.append(t.charAt(7)),a.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.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,1])],e})(xt),T0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Co=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Yi=(function(r){T0(e,r);function e(t){var n=r.call(this)||this,a=t==null?null:t.get(tt.POSSIBLE_FORMATS),s=[];return a!=null&&(a.indexOf(se.EAN_13)>-1&&s.push(new fa),a.indexOf(se.UPC_A)>-1&&s.push(new yo),a.indexOf(se.EAN_8)>-1&&s.push(new Ao),a.indexOf(se.UPC_E)>-1&&s.push(new Eo)),s.length===0&&(s.push(new fa),s.push(new yo),s.push(new Ao),s.push(new Eo)),n.readers=s,n}return e.prototype.decodeRow=function(t,n,a){var s,f;try{for(var h=Co(this.readers),x=h.next();!x.done;x=h.next()){var g=x.value;try{var w=g.decodeRow(t,n,a),A=w.getBarcodeFormat()===se.EAN_13&&w.getText().charAt(0)==="0",E=a==null?null:a.get(tt.POSSIBLE_FORMATS),C=E==null||E.includes(se.UPC_A);if(A&&C){var b=w.getRawBytes(),T=new Bt(w.getText().substring(1),b,b?b.length:null,w.getResultPoints(),se.UPC_A);return T.putAllMetadata(w.getResultMetadata()),T}return w}catch{}}}catch(P){s={error:P}}finally{try{x&&!x.done&&(f=h.return)&&f.call(h)}finally{if(s)throw s.error}}throw new j},e.prototype.reset=function(){var t,n;try{for(var a=Co(this.readers),s=a.next();!s.done;s=a.next()){var f=s.value;f.reset()}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}},e})(vt),O0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),N0=(function(r){O0(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"},t}return e.prototype.decodeRow=function(t,n,a){var s=this.getValidRowData(n);if(!s)throw new j;var f=this.codaBarDecodeRow(s.row);if(!f)throw new j;return new Bt(f,null,0,[new ce(s.left,t),new ce(s.right,t)],se.CODABAR,new Date().getTime())},e.prototype.getValidRowData=function(t){var n=t.toArray(),a=n.indexOf(!0);if(a===-1)return null;var s=n.lastIndexOf(!0);if(s<=a)return null;n=n.slice(a,s+1);for(var f=[],h=n[0],x=1,g=1;g<n.length;g++)n[g]===h?x++:(h=n[g],f.push(x),x=1);return f.push(x),f.length<23&&(f.length+1)%8!==0?null:{row:f,left:a,right:s}},e.prototype.codaBarDecodeRow=function(t){for(var n=[],a=Math.ceil(t.reduce(function(x,g){return(x+g)/2},0));t.length>0;){var s=t.splice(0,8).splice(0,7),f=s.map(function(x){return x<a?"n":"w"}).join("");if(this.CODA_BAR_CHAR_SET[f]===void 0)return null;n.push(this.CODA_BAR_CHAR_SET[f])}var h=n.join("");return this.validCodaBarString(h)?h:null},e.prototype.validCodaBarString=function(t){var n=/^[A-D].{1,}[A-D]$/;return n.test(t)},e})(vt),R0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),D0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},$r=(function(r){R0(e,r);function e(){var t=r.call(this)||this;return t.decodeFinderCounters=new Int32Array(4),t.dataCharacterCounters=new Int32Array(8),t.oddRoundingErrors=new Array(4),t.evenRoundingErrors=new Array(4),t.oddCounts=new Array(t.dataCharacterCounters.length/2),t.evenCounts=new Array(t.dataCharacterCounters.length/2),t}return e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,n){for(var a=0;a<n.length;a++)if(vt.patternMatchVariance(t,n[a],e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return a;throw new j},e.count=function(t){return De.sum(new Int32Array(t))},e.increment=function(t,n){for(var a=0,s=n[0],f=1;f<t.length;f++)n[f]>s&&(s=n[f],a=f);t[a]++},e.decrement=function(t,n){for(var a=0,s=n[0],f=1;f<t.length;f++)n[f]<s&&(s=n[f],a=f);t[a]--},e.isFinderPattern=function(t){var n,a,s=t[0]+t[1],f=s+t[2]+t[3],h=s/f;if(h>=e.MIN_FINDER_PATTERN_RATIO&&h<=e.MAX_FINDER_PATTERN_RATIO){var x=Number.MAX_SAFE_INTEGER,g=Number.MIN_SAFE_INTEGER;try{for(var w=D0(t),A=w.next();!A.done;A=w.next()){var E=A.value;E>g&&(g=E),E<x&&(x=E)}}catch(C){n={error:C}}finally{try{A&&!A.done&&(a=w.return)&&a.call(w)}finally{if(n)throw n.error}}return g<10*x}return!1},e.MAX_AVG_VARIANCE=.2,e.MAX_INDIVIDUAL_VARIANCE=.45,e.MIN_FINDER_PATTERN_RATIO=9.5/12,e.MAX_FINDER_PATTERN_RATIO=12.5/14,e})(vt),gi=(function(){function r(e,t){this.value=e,this.checksumPortion=t}return r.prototype.getValue=function(){return this.value},r.prototype.getChecksumPortion=function(){return this.checksumPortion},r.prototype.toString=function(){return this.value+"("+this.checksumPortion+")"},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion},r.prototype.hashCode=function(){return this.value^this.checksumPortion},r})(),Qo=(function(){function r(e,t,n,a,s){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ce(n,s)),this.resultPoints.push(new ce(a,s))}return r.prototype.getValue=function(){return this.value},r.prototype.getStartEnd=function(){return this.startEnd},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.hashCode=function(){return this.value},r})(),M0=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},pn=(function(){function r(){}return r.getRSSvalue=function(e,t,n){var a,s,f=0;try{for(var h=M0(e),x=h.next();!x.done;x=h.next()){var g=x.value;f+=g}}catch(D){a={error:D}}finally{try{x&&!x.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}for(var w=0,A=0,E=e.length,C=0;C<E-1;C++){var b=void 0;for(b=1,A|=1<<C;b<e[C];b++,A&=~(1<<C)){var T=r.combins(f-b-1,E-C-2);if(n&&A===0&&f-b-(E-C-1)>=E-C-1&&(T-=r.combins(f-b-(E-C),E-C-2)),E-C-1>1){for(var P=0,F=f-b-(E-C-2);F>t;F--)P+=r.combins(f-b-F-1,E-C-3);T-=P*(E-1-C)}else f-b>t&&T--;w+=T}f-=b}return w},r.combins=function(e,t){var n,a;e-t>t?(a=t,n=e-t):(a=e-t,n=t);for(var s=1,f=1,h=e;h>n;h--)s*=h,f<=a&&(s/=f,f++);for(;f<=a;)s/=f,f++;return s},r})(),P0=(function(){function r(){}return r.buildBitArray=function(e){var t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);for(var n=12*t,a=new mt(n),s=0,f=e[0],h=f.getRightChar().getValue(),x=11;x>=0;--x)(h&1<<x)!==0&&a.set(s),s++;for(var x=1;x<e.length;++x){for(var g=e[x],w=g.getLeftChar().getValue(),A=11;A>=0;--A)(w&1<<A)!==0&&a.set(s),s++;if(g.getRightChar()!==null)for(var E=g.getRightChar().getValue(),A=11;A>=0;--A)(E&1<<A)!==0&&a.set(s),s++}return a},r})(),Qr=(function(){function r(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}return r.prototype.getDecodedInformation=function(){return this.decodedInformation},r.prototype.isFinished=function(){return this.finished},r})(),Ca=(function(){function r(e){this.newPosition=e}return r.prototype.getNewPosition=function(){return this.newPosition},r})(),B0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),gr=(function(r){B0(e,r);function e(t,n){var a=r.call(this,t)||this;return a.value=n,a}return e.prototype.getValue=function(){return this.value},e.prototype.isFNC1=function(){return this.value===e.FNC1},e.FNC1="$",e})(Ca),L0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Jr=(function(r){L0(e,r);function e(t,n,a){var s=r.call(this,t)||this;return a?(s.remaining=!0,s.remainingValue=s.remainingValue):(s.remaining=!1,s.remainingValue=0),s.newString=n,s}return e.prototype.getNewString=function(){return this.newString},e.prototype.isRemaining=function(){return this.remaining},e.prototype.getRemainingValue=function(){return this.remainingValue},e})(Ca),F0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),xn=(function(r){F0(e,r);function e(t,n,a){var s=r.call(this,t)||this;if(n<0||n>10||a<0||a>10)throw new re;return s.firstDigit=n,s.secondDigit=a,s}return e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return this.firstDigit*10+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e})(Ca),ni=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},k0=(function(){function r(){}return r.parseFieldsInGeneralPurpose=function(e){var t,n,a,s,f,h,x,g;if(!e)return null;if(e.length<2)throw new j;var w=e.substring(0,2);try{for(var A=ni(r.TWO_DIGIT_DATA_LENGTH),E=A.next();!E.done;E=A.next()){var C=E.value;if(C[0]===w)return C[1]===r.VARIABLE_LENGTH?r.processVariableAI(2,C[2],e):r.processFixedAI(2,C[1],e)}}catch(K){t={error:K}}finally{try{E&&!E.done&&(n=A.return)&&n.call(A)}finally{if(t)throw t.error}}if(e.length<3)throw new j;var b=e.substring(0,3);try{for(var T=ni(r.THREE_DIGIT_DATA_LENGTH),P=T.next();!P.done;P=T.next()){var C=P.value;if(C[0]===b)return C[1]===r.VARIABLE_LENGTH?r.processVariableAI(3,C[2],e):r.processFixedAI(3,C[1],e)}}catch(K){a={error:K}}finally{try{P&&!P.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}try{for(var F=ni(r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),D=F.next();!D.done;D=F.next()){var C=D.value;if(C[0]===b)return C[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,C[2],e):r.processFixedAI(4,C[1],e)}}catch(K){f={error:K}}finally{try{D&&!D.done&&(h=F.return)&&h.call(F)}finally{if(f)throw f.error}}if(e.length<4)throw new j;var L=e.substring(0,4);try{for(var k=ni(r.FOUR_DIGIT_DATA_LENGTH),q=k.next();!q.done;q=k.next()){var C=q.value;if(C[0]===L)return C[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,C[2],e):r.processFixedAI(4,C[1],e)}}catch(K){x={error:K}}finally{try{q&&!q.done&&(g=k.return)&&g.call(k)}finally{if(x)throw x.error}}throw new j},r.processFixedAI=function(e,t,n){if(n.length<e)throw new j;var a=n.substring(0,e);if(n.length<e+t)throw new j;var s=n.substring(e,e+t),f=n.substring(e+t),h="("+a+")"+s,x=r.parseFieldsInGeneralPurpose(f);return x==null?h:h+x},r.processVariableAI=function(e,t,n){var a=n.substring(0,e),s;n.length<e+t?s=n.length:s=e+t;var f=n.substring(e,s),h=n.substring(s),x="("+a+")"+f,g=r.parseFieldsInGeneralPurpose(h);return g==null?x:x+g},r.VARIABLE_LENGTH=[],r.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",r.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",r.VARIABLE_LENGTH,20],["22",r.VARIABLE_LENGTH,29],["30",r.VARIABLE_LENGTH,8],["37",r.VARIABLE_LENGTH,8],["90",r.VARIABLE_LENGTH,30],["91",r.VARIABLE_LENGTH,30],["92",r.VARIABLE_LENGTH,30],["93",r.VARIABLE_LENGTH,30],["94",r.VARIABLE_LENGTH,30],["95",r.VARIABLE_LENGTH,30],["96",r.VARIABLE_LENGTH,30],["97",r.VARIABLE_LENGTH,3],["98",r.VARIABLE_LENGTH,30],["99",r.VARIABLE_LENGTH,30]],r.THREE_DIGIT_DATA_LENGTH=[["240",r.VARIABLE_LENGTH,30],["241",r.VARIABLE_LENGTH,30],["242",r.VARIABLE_LENGTH,6],["250",r.VARIABLE_LENGTH,30],["251",r.VARIABLE_LENGTH,30],["253",r.VARIABLE_LENGTH,17],["254",r.VARIABLE_LENGTH,20],["400",r.VARIABLE_LENGTH,30],["401",r.VARIABLE_LENGTH,30],["402",17],["403",r.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",r.VARIABLE_LENGTH,20],["421",r.VARIABLE_LENGTH,15],["422",3],["423",r.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],r.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",r.VARIABLE_LENGTH,15],["391",r.VARIABLE_LENGTH,18],["392",r.VARIABLE_LENGTH,15],["393",r.VARIABLE_LENGTH,18],["703",r.VARIABLE_LENGTH,30]],r.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",r.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",r.VARIABLE_LENGTH,20],["8003",r.VARIABLE_LENGTH,30],["8004",r.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",r.VARIABLE_LENGTH,30],["8008",r.VARIABLE_LENGTH,12],["8018",18],["8020",r.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",r.VARIABLE_LENGTH,70],["8200",r.VARIABLE_LENGTH,70]],r})(),ui=(function(){function r(e){this.buffer=new Ce,this.information=e}return r.prototype.decodeAllCodes=function(e,t){var n=t,a=null;do{var s=this.decodeGeneralPurposeField(n,a),f=k0.parseFieldsInGeneralPurpose(s.getNewString());if(f!=null&&e.append(f),s.isRemaining()?a=""+s.getRemainingValue():a=null,n===s.getNewPosition())break;n=s.getNewPosition()}while(!0);return e.toString()},r.prototype.isStillNumeric=function(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(var t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)},r.prototype.decodeNumeric=function(e){if(e+7>this.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return t===0?new xn(this.information.getSize(),xn.FNC1,xn.FNC1):new xn(this.information.getSize(),t-1,xn.FNC1)}var n=this.extractNumericValueFromBitArray(e,7),a=(n-8)/11,s=(n-8)%11;return new xn(e+7,a,s)},r.prototype.extractNumericValueFromBitArray=function(e,t){return r.extractNumericValueFromBitArray(this.information,e,t)},r.extractNumericValueFromBitArray=function(e,t,n){for(var a=0,s=0;s<n;++s)e.get(t+s)&&(a|=1<<n-s-1);return a},r.prototype.decodeGeneralPurposeField=function(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return n!=null&&n.isRemaining()?new Jr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Jr(this.current.getPosition(),this.buffer.toString())},r.prototype.parseBlocks=function(){var e,t;do{var n=this.current.getPosition();this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished());var a=n!==this.current.getPosition();if(!a&&!e)break}while(!e);return t.getDecodedInformation()},r.prototype.parseNumericBlock=function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return e.isSecondDigitFNC1()?t=new Jr(this.current.getPosition(),this.buffer.toString()):t=new Jr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Qr(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var t=new Jr(this.current.getPosition(),this.buffer.toString());return new Qr(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Qr(!1)},r.prototype.parseIsoIec646Block=function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new Jr(this.current.getPosition(),this.buffer.toString());return new Qr(!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 Qr(!1)},r.prototype.parseAlphaBlock=function(){for(;this.isStillAlpha(this.current.getPosition());){var e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new Jr(this.current.getPosition(),this.buffer.toString());return new Qr(!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 Qr(!1)},r.prototype.isStillIsoIec646=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var a=this.extractNumericValueFromBitArray(e,8);return a>=232&&a<253},r.prototype.decodeIsoIec646=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new gr(e+5,gr.FNC1);if(t>=5&&t<15)return new gr(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new gr(e+7,""+(n+1));if(n>=90&&n<116)return new gr(e+7,""+(n+7));var a=this.extractNumericValueFromBitArray(e,8),s;switch(a){case 232:s="!";break;case 233:s='"';break;case 234:s="%";break;case 235:s="&";break;case 236:s="'";break;case 237:s="(";break;case 238:s=")";break;case 239:s="*";break;case 240:s="+";break;case 241:s=",";break;case 242:s="-";break;case 243:s=".";break;case 244:s="/";break;case 245:s=":";break;case 246:s=";";break;case 247:s="<";break;case 248:s="=";break;case 249:s=">";break;case 250:s="?";break;case 251:s="_";break;case 252:s=" ";break;default:throw new re}return new gr(e+8,s)},r.prototype.isStillAlpha=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63},r.prototype.decodeAlphanumeric=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new gr(e+5,gr.FNC1);if(t>=5&&t<15)return new gr(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new gr(e+6,""+(n+33));var a;switch(n){case 58:a="*";break;case 59:a=",";break;case 60:a="-";break;case 61:a=".";break;case 62:a="/";break;default:throw new Hn("Decoding invalid alphanumeric value: "+n)}return new gr(e+6,a)},r.prototype.isAlphaTo646ToAlphaLatch=function(e){if(e+1>this.information.getSize())return!1;for(var 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},r.prototype.isAlphaOr646ToNumericLatch=function(e){if(e+3>this.information.getSize())return!1;for(var t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0},r.prototype.isNumericToAlphaNumericLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0},r})(),Jo=(function(){function r(e){this.information=e,this.generalDecoder=new ui(e)}return r.prototype.getInformation=function(){return this.information},r.prototype.getGeneralDecoder=function(){return this.generalDecoder},r})(),U0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),vr=(function(r){U0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedGtin=function(t,n){t.append("(01)");var a=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,a)},e.prototype.encodeCompressedGtinWithoutAI=function(t,n,a){for(var s=0;s<4;++s){var f=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*s,10);f/100===0&&t.append("0"),f/10===0&&t.append("0"),t.append(f)}e.appendCheckDigit(t,a)},e.appendCheckDigit=function(t,n){for(var a=0,s=0;s<13;s++){var f=t.charAt(s+n).charCodeAt(0)-48;a+=(s&1)===0?3*f:f}a=10-a%10,a===10&&(a=0),t.append(a)},e.GTIN_SIZE=40,e})(Jo),V0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),H0=(function(r){V0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new Ce;t.append("(01)");var n=t.length(),a=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(a),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e})(vr),G0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),X0=(function(r){G0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new Ce;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e})(Jo),W0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),li=(function(r){W0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedWeight=function(t,n,a){var s=this.getGeneralDecoder().extractNumericValueFromBitArray(n,a);this.addWeightCode(t,s);for(var f=this.checkWeight(s),h=1e5,x=0;x<5;++x)f/h===0&&t.append("0"),h/=10;t.append(f)},e})(vr),z0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),$o=(function(r){z0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+li.GTIN_SIZE+e.WEIGHT_SIZE)throw new j;var t=new Ce;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+li.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e})(li),Y0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Z0=(function(r){Y0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e})($o),j0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),K0=(function(r){j0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){n<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e})($o),q0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Q0=(function(r){q0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+vr.GTIN_SIZE)throw new j;var t=new Ce;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+vr.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");var a=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+vr.GTIN_SIZE+e.LAST_DIGIT_SIZE,null);return t.append(a.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e})(vr),J0=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),$0=(function(r){J0(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+vr.GTIN_SIZE)throw new j;var t=new Ce;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+vr.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");var a=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+vr.GTIN_SIZE+e.LAST_DIGIT_SIZE,e.FIRST_THREE_DIGITS_SIZE);a/100===0&&t.append("0"),a/10===0&&t.append("0"),t.append(a);var s=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+vr.GTIN_SIZE+e.LAST_DIGIT_SIZE+e.FIRST_THREE_DIGITS_SIZE,null);return t.append(s.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e.FIRST_THREE_DIGITS_SIZE=10,e})(vr),ec=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ur=(function(r){ec(e,r);function e(t,n,a){var s=r.call(this,t)||this;return s.dateCode=a,s.firstAIdigits=n,s}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE+e.DATE_SIZE)throw new j;var t=new Ce;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+e.GTIN_SIZE,e.WEIGHT_SIZE),this.encodeCompressedDate(t,e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE),t.toString()},e.prototype.encodeCompressedDate=function(t,n){var a=this.getGeneralDecoder().extractNumericValueFromBitArray(n,e.DATE_SIZE);if(a!==38400){t.append("("),t.append(this.dateCode),t.append(")");var s=a%32;a/=32;var f=a%12+1;a/=12;var h=a;h/10===0&&t.append("0"),t.append(h),f/10===0&&t.append("0"),t.append(f),s/10===0&&t.append("0"),t.append(s)}},e.prototype.addWeightCode=function(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")},e.prototype.checkWeight=function(t){return t%1e5},e.HEADER_SIZE=8,e.WEIGHT_SIZE=20,e.DATE_SIZE=16,e})(li);function tc(r){try{if(r.get(1))return new H0(r);if(!r.get(2))return new X0(r);var e=ui.extractNumericValueFromBitArray(r,1,4);switch(e){case 4:return new Z0(r);case 5:return new K0(r)}var t=ui.extractNumericValueFromBitArray(r,1,5);switch(t){case 12:return new Q0(r);case 13:return new $0(r)}var n=ui.extractNumericValueFromBitArray(r,1,7);switch(n){case 56:return new Ur(r,"310","11");case 57:return new Ur(r,"320","11");case 58:return new Ur(r,"310","13");case 59:return new Ur(r,"320","13");case 60:return new Ur(r,"310","15");case 61:return new Ur(r,"320","15");case 62:return new Ur(r,"310","17");case 63:return new Ur(r,"320","17")}}catch(a){throw console.log(a),new Hn("unknown decoder: "+r)}}var _o=(function(){function r(e,t,n,a){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=a}return r.prototype.mayBeLast=function(){return this.maybeLast},r.prototype.getLeftChar=function(){return this.leftchar},r.prototype.getRightChar=function(){return this.rightchar},r.prototype.getFinderPattern=function(){return this.finderpattern},r.prototype.mustBeLast=function(){return this.rightchar==null},r.prototype.toString=function(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"},r.equals=function(e,t){return e instanceof r?r.equalsOrNull(e.leftchar,t.leftchar)&&r.equalsOrNull(e.rightchar,t.rightchar)&&r.equalsOrNull(e.finderpattern,t.finderpattern):!1},r.equalsOrNull=function(e,t){return e===null?t===null:r.equals(e,t)},r.prototype.hashCode=function(){var e=this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue();return e},r})(),rc=(function(){function r(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}return r.prototype.getPairs=function(){return this.pairs},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.isReversed=function(){return this.wasReversed},r.prototype.isEquivalent=function(e){return this.checkEqualitity(this,e)},r.prototype.toString=function(){return"{ "+this.pairs+" }"},r.prototype.equals=function(e,t){return e instanceof r?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1},r.prototype.checkEqualitity=function(e,t){if(!(!e||!t)){var n;return e.forEach(function(a,s){t.forEach(function(f){a.getLeftChar().getValue()===f.getLeftChar().getValue()&&a.getRightChar().getValue()===f.getRightChar().getValue()&&a.getFinderPatter().getValue()===f.getFinderPatter().getValue()&&(n=!0)})}),n}},r})(),nc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Vr=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ic=(function(r){nc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.pairs=new Array(e.MAX_PAIRS),t.rows=new Array,t.startEnd=[2],t}return e.prototype.decodeRow=function(t,n,a){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,n))}catch{}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,n))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,n){for(var a=!1;!a;)try{this.pairs.push(this.retrieveNextPair(n,this.pairs,t))}catch(h){if(h instanceof j){if(!this.pairs.length)throw new j;a=!0}}if(this.checkChecksum())return this.pairs;var s;if(this.rows.length?s=!0:s=!1,this.storeRow(t,!1),s){var f=this.checkRowsBoolean(!1);if(f!=null||(f=this.checkRowsBoolean(!0),f!=null))return f}throw new j},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var n=null;try{n=this.checkRows(new Array,0)}catch(a){console.log(a)}return t&&(this.rows=this.rows.reverse()),n},e.prototype.checkRows=function(t,n){for(var a,s,f=n;f<this.rows.length;f++){var h=this.rows[f];this.pairs.length=0;try{for(var x=(a=void 0,Vr(t)),g=x.next();!g.done;g=x.next()){var w=g.value;this.pairs.push(w.getPairs())}}catch(E){a={error:E}}finally{try{g&&!g.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}if(this.pairs.push(h.getPairs()),!!e.isValidSequence(this.pairs)){if(this.checkChecksum())return this.pairs;var A=new Array(t);A.push(h);try{return this.checkRows(A,f+1)}catch(E){console.log(E)}}}throw new j},e.isValidSequence=function(t){var n,a;try{for(var s=Vr(e.FINDER_PATTERN_SEQUENCES),f=s.next();!f.done;f=s.next()){var h=f.value;if(!(t.length>h.length)){for(var x=!0,g=0;g<t.length;g++)if(t[g].getFinderPattern().getValue()!==h[g]){x=!1;break}if(x)return!0}}}catch(w){n={error:w}}finally{try{f&&!f.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}return!1},e.prototype.storeRow=function(t,n){for(var a=0,s=!1,f=!1;a<this.rows.length;){var h=this.rows[a];if(h.getRowNumber()>t){f=h.isEquivalent(this.pairs);break}s=h.isEquivalent(this.pairs),a++}f||s||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(a,new rc(this.pairs,t,n)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,n){var a,s,f,h,x,g;try{for(var w=Vr(n),A=w.next();!A.done;A=w.next()){var E=A.value;if(E.getPairs().length!==t.length){var C=!0;try{for(var b=(f=void 0,Vr(E.getPairs())),T=b.next();!T.done;T=b.next()){var P=T.value,F=!1;try{for(var D=(x=void 0,Vr(t)),L=D.next();!L.done;L=D.next()){var k=L.value;if(_o.equals(P,k)){F=!0;break}}}catch(q){x={error:q}}finally{try{L&&!L.done&&(g=D.return)&&g.call(D)}finally{if(x)throw x.error}}F||(C=!1)}}catch(q){f={error:q}}finally{try{T&&!T.done&&(h=b.return)&&h.call(b)}finally{if(f)throw f.error}}}}}catch(q){a={error:q}}finally{try{A&&!A.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}},e.isPartialRow=function(t,n){var a,s,f,h,x,g;try{for(var w=Vr(n),A=w.next();!A.done;A=w.next()){var E=A.value,C=!0;try{for(var b=(f=void 0,Vr(t)),T=b.next();!T.done;T=b.next()){var P=T.value,F=!1;try{for(var D=(x=void 0,Vr(E.getPairs())),L=D.next();!L.done;L=D.next()){var k=L.value;if(P.equals(k)){F=!0;break}}}catch(q){x={error:q}}finally{try{L&&!L.done&&(g=D.return)&&g.call(D)}finally{if(x)throw x.error}}if(!F){C=!1;break}}}catch(q){f={error:q}}finally{try{T&&!T.done&&(h=b.return)&&h.call(b)}finally{if(f)throw f.error}}if(C)return!0}}catch(q){a={error:q}}finally{try{A&&!A.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var n=P0.buildBitArray(t),a=tc(n),s=a.parseInformation(),f=t[0].getFinderPattern().getResultPoints(),h=t[t.length-1].getFinderPattern().getResultPoints(),x=[f[0],f[1],h[0],h[1]];return new Bt(s,null,null,x,se.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),n=t.getLeftChar(),a=t.getRightChar();if(a===null)return!1;for(var s=a.getChecksumPortion(),f=2,h=1;h<this.pairs.size();++h){var x=this.pairs.get(h);s+=x.getLeftChar().getChecksumPortion(),f++;var g=x.getRightChar();g!=null&&(s+=g.getChecksumPortion(),f++)}s%=211;var w=211*(f-4)+s;return w===n.getValue()},e.getNextSecondBar=function(t,n){var a;return t.get(n)?(a=t.getNextUnset(n),a=t.getNextSet(a)):(a=t.getNextSet(n),a=t.getNextUnset(a)),a},e.prototype.retrieveNextPair=function(t,n,a){var s=n.length%2===0;this.startFromEven&&(s=!s);var f,h=!0,x=-1;do this.findNextPair(t,n,x),f=this.parseFoundFinderPattern(t,a,s),f===null?x=e.getNextSecondBar(t,this.startEnd[0]):h=!1;while(h);var g=this.decodeDataCharacter(t,f,s,!0);if(!this.isEmptyPair(n)&&n[n.length-1].mustBeLast())throw new j;var w;try{w=this.decodeDataCharacter(t,f,s,!1)}catch(A){w=null,console.log(A)}return new _o(g,w,f,!0)},e.prototype.isEmptyPair=function(t){return t.length===0},e.prototype.findNextPair=function(t,n,a){var s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;var f=t.getSize(),h;if(a>=0)h=a;else if(this.isEmptyPair(n))h=0;else{var x=n[n.length-1];h=x.getFinderPattern().getStartEnd()[1]}var g=n.length%2!==0;this.startFromEven&&(g=!g);for(var w=!1;h<f&&(w=!t.get(h),!!w);)h++;for(var A=0,E=h,C=h;C<f;C++)if(t.get(C)!==w)s[A]++;else{if(A===3){if(g&&e.reverseCounters(s),e.isFinderPattern(s)){this.startEnd[0]=E,this.startEnd[1]=C;return}g&&e.reverseCounters(s),E+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,A--}else A++;s[A]=1,w=!w}throw new j},e.reverseCounters=function(t){for(var n=t.length,a=0;a<n/2;++a){var s=t[a];t[a]=t[n-a-1],t[n-a-1]=s}},e.prototype.parseFoundFinderPattern=function(t,n,a){var s,f,h;if(a){for(var x=this.startEnd[0]-1;x>=0&&!t.get(x);)x--;x++,s=this.startEnd[0]-x,f=x,h=this.startEnd[1]}else f=this.startEnd[0],h=t.getNextUnset(this.startEnd[1]+1),s=h-this.startEnd[1];var g=this.getDecodeFinderCounters();Ke.arraycopy(g,0,g,1,g.length-1),g[0]=s;var w;try{w=this.parseFinderValue(g,e.FINDER_PATTERNS)}catch{return null}return new Qo(w,[f,h],f,h,n)},e.prototype.decodeDataCharacter=function(t,n,a,s){for(var f=this.getDataCharacterCounters(),h=0;h<f.length;h++)f[h]=0;if(s)e.recordPatternInReverse(t,n.getStartEnd()[0],f);else{e.recordPattern(t,n.getStartEnd()[1],f);for(var x=0,g=f.length-1;x<g;x++,g--){var w=f[x];f[x]=f[g],f[g]=w}}var A=17,E=De.sum(new Int32Array(f))/A,C=(n.getStartEnd()[1]-n.getStartEnd()[0])/15;if(Math.abs(E-C)/C>.3)throw new j;for(var b=this.getOddCounts(),T=this.getEvenCounts(),P=this.getOddRoundingErrors(),F=this.getEvenRoundingErrors(),x=0;x<f.length;x++){var D=1*f[x]/E,L=D+.5;if(L<1){if(D<.3)throw new j;L=1}else if(L>8){if(D>8.7)throw new j;L=8}var k=x/2;(x&1)===0?(b[k]=L,P[k]=D-L):(T[k]=L,F[k]=D-L)}this.adjustOddEvenCounts(A);for(var q=4*n.getValue()+(a?0:2)+(s?0:1)-1,K=0,U=0,x=b.length-1;x>=0;x--){if(e.isNotA1left(n,a,s)){var $=e.WEIGHTS[q][2*x];U+=b[x]*$}K+=b[x]}for(var Y=0,x=T.length-1;x>=0;x--)if(e.isNotA1left(n,a,s)){var $=e.WEIGHTS[q][2*x+1];Y+=T[x]*$}var ue=U+Y;if((K&1)!==0||K>13||K<4)throw new j;var _e=(13-K)/2,Z=e.SYMBOL_WIDEST[_e],ne=9-Z,le=pn.getRSSvalue(b,Z,!0),X=pn.getRSSvalue(T,ne,!1),me=e.EVEN_TOTAL_SUBSET[_e],ge=e.GSUM[_e],rr=le*me+X+ge;return new gi(rr,ue)},e.isNotA1left=function(t,n,a){return!(t.getValue()===0&&n&&a)},e.prototype.adjustOddEvenCounts=function(t){var n=De.sum(new Int32Array(this.getOddCounts())),a=De.sum(new Int32Array(this.getEvenCounts())),s=!1,f=!1;n>13?f=!0:n<4&&(s=!0);var h=!1,x=!1;a>13?x=!0:a<4&&(h=!0);var g=n+a-t,w=(n&1)===1,A=(a&1)===0;if(g===1)if(w){if(A)throw new j;f=!0}else{if(!A)throw new j;x=!0}else if(g===-1)if(w){if(A)throw new j;s=!0}else{if(!A)throw new j;h=!0}else if(g===0){if(w){if(!A)throw new j;n<a?(s=!0,x=!0):(f=!0,h=!0)}else if(A)throw new j}else throw new j;if(s){if(f)throw new j;e.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(f&&e.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(x)throw new j;e.increment(this.getEvenCounts(),this.getOddRoundingErrors())}x&&e.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.SYMBOL_WIDEST=[7,5,4,3,1],e.EVEN_TOTAL_SUBSET=[4,20,52,104,204],e.GSUM=[0,348,1388,2948,3988],e.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])],e.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],e.FINDER_PAT_A=0,e.FINDER_PAT_B=1,e.FINDER_PAT_C=2,e.FINDER_PAT_D=3,e.FINDER_PAT_E=4,e.FINDER_PAT_F=5,e.FINDER_PATTERN_SEQUENCES=[[e.FINDER_PAT_A,e.FINDER_PAT_A],[e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B],[e.FINDER_PAT_A,e.FINDER_PAT_C,e.FINDER_PAT_B,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_C],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F]],e.MAX_PAIRS=11,e})($r),ac=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),oc=(function(r){ac(e,r);function e(t,n,a){var s=r.call(this,t,n)||this;return s.count=0,s.finderPattern=a,s}return e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e})(gi),sc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Zi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},mo=(function(r){sc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.possibleLeftPairs=[],t.possibleRightPairs=[],t}return e.prototype.decodeRow=function(t,n,a){var s,f,h,x,g=this.decodePair(n,!1,t,a);e.addOrTally(this.possibleLeftPairs,g),n.reverse();var w=this.decodePair(n,!0,t,a);e.addOrTally(this.possibleRightPairs,w),n.reverse();try{for(var A=Zi(this.possibleLeftPairs),E=A.next();!E.done;E=A.next()){var C=E.value;if(C.getCount()>1)try{for(var b=(h=void 0,Zi(this.possibleRightPairs)),T=b.next();!T.done;T=b.next()){var P=T.value;if(P.getCount()>1&&e.checkChecksum(C,P))return e.constructResult(C,P)}}catch(F){h={error:F}}finally{try{T&&!T.done&&(x=b.return)&&x.call(b)}finally{if(h)throw h.error}}}}catch(F){s={error:F}}finally{try{E&&!E.done&&(f=A.return)&&f.call(A)}finally{if(s)throw s.error}}throw new j},e.addOrTally=function(t,n){var a,s;if(n!=null){var f=!1;try{for(var h=Zi(t),x=h.next();!x.done;x=h.next()){var g=x.value;if(g.getValue()===n.getValue()){g.incrementCount(),f=!0;break}}}catch(w){a={error:w}}finally{try{x&&!x.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}f||t.push(n)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,n){for(var a=4537077*t.getValue()+n.getValue(),s=new String(a).toString(),f=new Ce,h=13-s.length;h>0;h--)f.append("0");f.append(s);for(var x=0,h=0;h<13;h++){var g=f.charAt(h).charCodeAt(0)-48;x+=(h&1)===0?3*g:g}x=10-x%10,x===10&&(x=0),f.append(x.toString());var w=t.getFinderPattern().getResultPoints(),A=n.getFinderPattern().getResultPoints();return new Bt(f.toString(),null,0,[w[0],w[1],A[0],A[1]],se.RSS_14,new Date().getTime())},e.checkChecksum=function(t,n){var a=(t.getChecksumPortion()+16*n.getChecksumPortion())%79,s=9*t.getFinderPattern().getValue()+n.getFinderPattern().getValue();return s>72&&s--,s>8&&s--,a===s},e.prototype.decodePair=function(t,n,a,s){try{var f=this.findFinderPattern(t,n),h=this.parseFoundFinderPattern(t,a,n,f),x=s==null?null:s.get(tt.NEED_RESULT_POINT_CALLBACK);if(x!=null){var g=(f[0]+f[1])/2;n&&(g=t.getSize()-1-g),x.foundPossibleResultPoint(new ce(g,a))}var w=this.decodeDataCharacter(t,h,!0),A=this.decodeDataCharacter(t,h,!1);return new oc(1597*w.getValue()+A.getValue(),w.getChecksumPortion()+4*A.getChecksumPortion(),h)}catch{return null}},e.prototype.decodeDataCharacter=function(t,n,a){for(var s=this.getDataCharacterCounters(),f=0;f<s.length;f++)s[f]=0;if(a)vt.recordPatternInReverse(t,n.getStartEnd()[0],s);else{vt.recordPattern(t,n.getStartEnd()[1]+1,s);for(var h=0,x=s.length-1;h<x;h++,x--){var g=s[h];s[h]=s[x],s[x]=g}}for(var w=a?16:15,A=De.sum(new Int32Array(s))/w,E=this.getOddCounts(),C=this.getEvenCounts(),b=this.getOddRoundingErrors(),T=this.getEvenRoundingErrors(),h=0;h<s.length;h++){var P=s[h]/A,F=Math.floor(P+.5);F<1?F=1:F>8&&(F=8);var D=Math.floor(h/2);(h&1)===0?(E[D]=F,b[D]=P-F):(C[D]=F,T[D]=P-F)}this.adjustOddEvenCounts(a,w);for(var L=0,k=0,h=E.length-1;h>=0;h--)k*=9,k+=E[h],L+=E[h];for(var q=0,K=0,h=C.length-1;h>=0;h--)q*=9,q+=C[h],K+=C[h];var U=k+3*q;if(a){if((L&1)!==0||L>12||L<4)throw new j;var $=(12-L)/2,Y=e.OUTSIDE_ODD_WIDEST[$],ue=9-Y,_e=pn.getRSSvalue(E,Y,!1),Z=pn.getRSSvalue(C,ue,!0),ne=e.OUTSIDE_EVEN_TOTAL_SUBSET[$],le=e.OUTSIDE_GSUM[$];return new gi(_e*ne+Z+le,U)}else{if((K&1)!==0||K>10||K<4)throw new j;var $=(10-K)/2,Y=e.INSIDE_ODD_WIDEST[$],ue=9-Y,_e=pn.getRSSvalue(E,Y,!0),Z=pn.getRSSvalue(C,ue,!1),X=e.INSIDE_ODD_TOTAL_SUBSET[$],le=e.INSIDE_GSUM[$];return new gi(Z*X+_e+le,U)}},e.prototype.findFinderPattern=function(t,n){var a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;for(var s=t.getSize(),f=!1,h=0;h<s&&(f=!t.get(h),n!==f);)h++;for(var x=0,g=h,w=h;w<s;w++)if(t.get(w)!==f)a[x]++;else{if(x===3){if($r.isFinderPattern(a))return[g,w];g+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,x--}else x++;a[x]=1,f=!f}throw new j},e.prototype.parseFoundFinderPattern=function(t,n,a,s){for(var f=t.get(s[0]),h=s[0]-1;h>=0&&f!==t.get(h);)h--;h++;var x=s[0]-h,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);Ke.arraycopy(g,0,w,1,g.length-1),w[0]=x;var A=this.parseFinderValue(w,e.FINDER_PATTERNS),E=h,C=s[1];return a&&(E=t.getSize()-1-E,C=t.getSize()-1-C),new Qo(A,[h,s[1]],E,C,n)},e.prototype.adjustOddEvenCounts=function(t,n){var a=De.sum(new Int32Array(this.getOddCounts())),s=De.sum(new Int32Array(this.getEvenCounts())),f=!1,h=!1,x=!1,g=!1;t?(a>12?h=!0:a<4&&(f=!0),s>12?g=!0:s<4&&(x=!0)):(a>11?h=!0:a<5&&(f=!0),s>10?g=!0:s<4&&(x=!0));var w=a+s-n,A=(a&1)===(t?1:0),E=(s&1)===1;if(w===1)if(A){if(E)throw new j;h=!0}else{if(!E)throw new j;g=!0}else if(w===-1)if(A){if(E)throw new j;f=!0}else{if(!E)throw new j;x=!0}else if(w===0){if(A){if(!E)throw new j;a<s?(f=!0,g=!0):(h=!0,x=!0)}else if(E)throw new j}else throw new j;if(f){if(h)throw new j;$r.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(h&&$r.decrement(this.getOddCounts(),this.getOddRoundingErrors()),x){if(g)throw new j;$r.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&$r.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],e.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],e.OUTSIDE_GSUM=[0,161,961,2015,2715],e.INSIDE_GSUM=[0,336,1036,1516],e.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],e.INSIDE_ODD_WIDEST=[2,4,6,8],e.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])],e})($r),cc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Fn=(function(r){cc(e,r);function e(t){var n=r.call(this)||this;n.readers=[];var a=t?t.get(tt.POSSIBLE_FORMATS):null,s=t&&t.get(tt.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;return a&&((a.includes(se.EAN_13)||a.includes(se.UPC_A)||a.includes(se.EAN_8)||a.includes(se.UPC_E))&&n.readers.push(new Yi(t)),a.includes(se.CODE_39)&&n.readers.push(new xo(s)),a.includes(se.CODE_93)&&n.readers.push(new go),a.includes(se.CODE_128)&&n.readers.push(new ho),a.includes(se.ITF)&&n.readers.push(new po),a.includes(se.CODABAR)&&n.readers.push(new N0),a.includes(se.RSS_14)&&n.readers.push(new mo),a.includes(se.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),n.readers.push(new ic))),n.readers.length===0&&(n.readers.push(new Yi(t)),n.readers.push(new xo),n.readers.push(new go),n.readers.push(new Yi(t)),n.readers.push(new ho),n.readers.push(new po),n.readers.push(new mo)),n}return e.prototype.decodeRow=function(t,n,a){for(var s=0;s<this.readers.length;s++)try{return this.readers[s].decodeRow(t,n,a)}catch{}throw new j},e.prototype.reset=function(){this.readers.forEach(function(t){return t.reset()})},e})(vt),fc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){fc(e,r);function e(t,n){return t===void 0&&(t=500),r.call(this,new Fn(n),t,n)||this}return e})(An);var Io=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ue=(function(){function r(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}return r.prototype.getECCodewords=function(){return this.ecCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r})(),Le=(function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r})(),uc=(function(){function r(e,t,n,a,s,f){var h,x;this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=a,this.dataRegionSizeColumns=s,this.ecBlocks=f;var g=0,w=f.getECCodewords(),A=f.getECBlocks();try{for(var E=Io(A),C=E.next();!C.done;C=E.next()){var b=C.value;g+=b.getCount()*(b.getDataCodewords()+w)}}catch(T){h={error:T}}finally{try{C&&!C.done&&(x=E.return)&&x.call(E)}finally{if(h)throw h.error}}this.totalCodewords=g}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},r.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},r.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},r.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r.getVersionForDimensions=function(e,t){var n,a;if((e&1)!==0||(t&1)!==0)throw new re;try{for(var s=Io(r.VERSIONS),f=s.next();!f.done;f=s.next()){var h=f.value;if(h.symbolSizeRows===e&&h.symbolSizeColumns===t)return h}}catch(x){n={error:x}}finally{try{f&&!f.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}throw new re},r.prototype.toString=function(){return""+this.versionNumber},r.buildVersions=function(){return[new r(1,10,10,8,8,new Ue(5,new Le(1,3))),new r(2,12,12,10,10,new Ue(7,new Le(1,5))),new r(3,14,14,12,12,new Ue(10,new Le(1,8))),new r(4,16,16,14,14,new Ue(12,new Le(1,12))),new r(5,18,18,16,16,new Ue(14,new Le(1,18))),new r(6,20,20,18,18,new Ue(18,new Le(1,22))),new r(7,22,22,20,20,new Ue(20,new Le(1,30))),new r(8,24,24,22,22,new Ue(24,new Le(1,36))),new r(9,26,26,24,24,new Ue(28,new Le(1,44))),new r(10,32,32,14,14,new Ue(36,new Le(1,62))),new r(11,36,36,16,16,new Ue(42,new Le(1,86))),new r(12,40,40,18,18,new Ue(48,new Le(1,114))),new r(13,44,44,20,20,new Ue(56,new Le(1,144))),new r(14,48,48,22,22,new Ue(68,new Le(1,174))),new r(15,52,52,24,24,new Ue(42,new Le(2,102))),new r(16,64,64,14,14,new Ue(56,new Le(2,140))),new r(17,72,72,16,16,new Ue(36,new Le(4,92))),new r(18,80,80,18,18,new Ue(48,new Le(4,114))),new r(19,88,88,20,20,new Ue(56,new Le(4,144))),new r(20,96,96,22,22,new Ue(68,new Le(4,174))),new r(21,104,104,24,24,new Ue(56,new Le(6,136))),new r(22,120,120,18,18,new Ue(68,new Le(6,175))),new r(23,132,132,20,20,new Ue(62,new Le(8,163))),new r(24,144,144,22,22,new Ue(62,new Le(8,156),new Le(2,155))),new r(25,8,18,6,16,new Ue(7,new Le(1,5))),new r(26,8,32,6,14,new Ue(11,new Le(1,10))),new r(27,12,26,10,24,new Ue(14,new Le(1,16))),new r(28,12,36,10,16,new Ue(18,new Le(1,22))),new r(29,16,36,14,16,new Ue(24,new Le(1,32))),new r(30,16,48,14,22,new Ue(28,new Le(1,49)))]},r.VERSIONS=r.buildVersions(),r})(),lc=(function(){function r(e){var t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new re;this.version=r.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new br(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return r.prototype.getVersion=function(){return this.version},r.readVersion=function(e){var t=e.getHeight(),n=e.getWidth();return uc.getVersionForDimensions(t,n)},r.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,a=0,s=this.mappingBitMatrix.getHeight(),f=this.mappingBitMatrix.getWidth(),h=!1,x=!1,g=!1,w=!1;do if(n===s&&a===0&&!h)e[t++]=this.readCorner1(s,f)&255,n-=2,a+=2,h=!0;else if(n===s-2&&a===0&&(f&3)!==0&&!x)e[t++]=this.readCorner2(s,f)&255,n-=2,a+=2,x=!0;else if(n===s+4&&a===2&&(f&7)===0&&!g)e[t++]=this.readCorner3(s,f)&255,n-=2,a+=2,g=!0;else if(n===s-2&&a===0&&(f&7)===4&&!w)e[t++]=this.readCorner4(s,f)&255,n-=2,a+=2,w=!0;else{do n<s&&a>=0&&!this.readMappingMatrix.get(a,n)&&(e[t++]=this.readUtah(n,a,s,f)&255),n-=2,a+=2;while(n>=0&&a<f);n+=1,a+=3;do n>=0&&a<f&&!this.readMappingMatrix.get(a,n)&&(e[t++]=this.readUtah(n,a,s,f)&255),n+=2,a-=2;while(n<s&&a>=0);n+=3,a+=1}while(n<s||a<f);if(t!==this.version.getTotalCodewords())throw new re;return e},r.prototype.readModule=function(e,t,n,a){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=a,e+=4-(a+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)},r.prototype.readUtah=function(e,t,n,a){var s=0;return this.readModule(e-2,t-2,n,a)&&(s|=1),s<<=1,this.readModule(e-2,t-1,n,a)&&(s|=1),s<<=1,this.readModule(e-1,t-2,n,a)&&(s|=1),s<<=1,this.readModule(e-1,t-1,n,a)&&(s|=1),s<<=1,this.readModule(e-1,t,n,a)&&(s|=1),s<<=1,this.readModule(e,t-2,n,a)&&(s|=1),s<<=1,this.readModule(e,t-1,n,a)&&(s|=1),s<<=1,this.readModule(e,t,n,a)&&(s|=1),s},r.prototype.readCorner1=function(e,t){var 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},r.prototype.readCorner2=function(e,t){var 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},r.prototype.readCorner3=function(e,t){var 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},r.prototype.readCorner4=function(e,t){var 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},r.prototype.extractDataRegion=function(e){var t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new xe("Dimension of bitMatrix must match the version size");for(var a=this.version.getDataRegionSizeRows(),s=this.version.getDataRegionSizeColumns(),f=t/a|0,h=n/s|0,x=f*a,g=h*s,w=new br(g,x),A=0;A<f;++A)for(var E=A*a,C=0;C<h;++C)for(var b=C*s,T=0;T<a;++T)for(var P=A*(a+2)+1+T,F=E+T,D=0;D<s;++D){var L=C*(s+2)+1+D;if(e.get(L,P)){var k=b+D;w.set(k,F)}}return w},r})(),So=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},hc=(function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t){var n,a,s,f,h=t.getECBlocks(),x=0,g=h.getECBlocks();try{for(var w=So(g),A=w.next();!A.done;A=w.next()){var E=A.value;x+=E.getCount()}}catch(le){n={error:le}}finally{try{A&&!A.done&&(a=w.return)&&a.call(w)}finally{if(n)throw n.error}}var C=new Array(x),b=0;try{for(var T=So(g),P=T.next();!P.done;P=T.next())for(var E=P.value,F=0;F<E.getCount();F++){var D=E.getDataCodewords(),L=h.getECCodewords()+D;C[b++]=new r(D,new Uint8Array(L))}}catch(le){s={error:le}}finally{try{P&&!P.done&&(f=T.return)&&f.call(T)}finally{if(s)throw s.error}}for(var k=C[0].codewords.length,q=k-h.getECCodewords(),K=q-1,U=0,F=0;F<K;F++)for(var $=0;$<b;$++)C[$].codewords[F]=e[U++];for(var Y=t.getVersionNumber()===24,ue=Y?8:b,$=0;$<ue;$++)C[$].codewords[q-1]=e[U++];for(var _e=C[0].codewords.length,F=q;F<_e;F++)for(var $=0;$<b;$++){var Z=Y?($+8)%b:$,ne=Y&&Z>7?F-1:F;C[Z].codewords[ne]=e[U++]}if(U!==e.length)throw new xe;return C},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r})(),e1=(function(){function r(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return r.prototype.getBitOffset=function(){return this.bitOffset},r.prototype.getByteOffset=function(){return this.byteOffset},r.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new xe(""+e);var t=0,n=this.bitOffset,a=this.byteOffset,s=this.bytes;if(n>0){var f=8-n,h=e<f?e:f,x=f-h,g=255>>8-h<<x;t=(s[a]&g)>>x,e-=h,n+=h,n===8&&(n=0,a++)}if(e>0){for(;e>=8;)t=t<<8|s[a]&255,a++,e-=8;if(e>0){var x=8-e,g=255>>x<<x;t=t<<e|(s[a]&g)>>x,n+=e}}return this.bitOffset=n,this.byteOffset=a,t},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r})(),ht;(function(r){r[r.PAD_ENCODE=0]="PAD_ENCODE",r[r.ASCII_ENCODE=1]="ASCII_ENCODE",r[r.C40_ENCODE=2]="C40_ENCODE",r[r.TEXT_ENCODE=3]="TEXT_ENCODE",r[r.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",r[r.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",r[r.BASE256_ENCODE=6]="BASE256_ENCODE"})(ht||(ht={}));var dc=(function(){function r(){}return r.decode=function(e){var t=new e1(e),n=new Ce,a=new Ce,s=new Array,f=ht.ASCII_ENCODE;do if(f===ht.ASCII_ENCODE)f=this.decodeAsciiSegment(t,n,a);else{switch(f){case ht.C40_ENCODE:this.decodeC40Segment(t,n);break;case ht.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case ht.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case ht.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case ht.BASE256_ENCODE:this.decodeBase256Segment(t,n,s);break;default:throw new re}f=ht.ASCII_ENCODE}while(f!==ht.PAD_ENCODE&&t.available()>0);return a.length()>0&&n.append(a.toString()),new Ai(e,n.toString(),s.length===0?null:s,null)},r.decodeAsciiSegment=function(e,t,n){var a=!1;do{var s=e.readBits(8);if(s===0)throw new re;if(s<=128)return a&&(s+=128),t.append(String.fromCharCode(s-1)),ht.ASCII_ENCODE;if(s===129)return ht.PAD_ENCODE;if(s<=229){var f=s-130;f<10&&t.append("0"),t.append(""+f)}else switch(s){case 230:return ht.C40_ENCODE;case 231:return ht.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:a=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return ht.ANSIX12_ENCODE;case 239:return ht.TEXT_ENCODE;case 240:return ht.EDIFACT_ENCODE;case 241:break;default:if(s!==254||e.available()!==0)throw new re;break}}while(e.available()>0);return ht.ASCII_ENCODE},r.decodeC40Segment=function(e,t){var n=!1,a=[],s=0;do{if(e.available()===8)return;var f=e.readBits(8);if(f===254)return;this.parseTwoBytes(f,e.readBits(8),a);for(var h=0;h<3;h++){var x=a[h];switch(s){case 0:if(x<3)s=x+1;else if(x<this.C40_BASIC_SET_CHARS.length){var g=this.C40_BASIC_SET_CHARS[x];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else throw new re;break;case 1:n?(t.append(String.fromCharCode(x+128)),n=!1):t.append(String.fromCharCode(x)),s=0;break;case 2:if(x<this.C40_SHIFT2_SET_CHARS.length){var g=this.C40_SHIFT2_SET_CHARS[x];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else switch(x){case 27:t.append("");break;case 30:n=!0;break;default:throw new re}s=0;break;case 3:n?(t.append(String.fromCharCode(x+224)),n=!1):t.append(String.fromCharCode(x+96)),s=0;break;default:throw new re}}}while(e.available()>0)},r.decodeTextSegment=function(e,t){var n=!1,a=[],s=0;do{if(e.available()===8)return;var f=e.readBits(8);if(f===254)return;this.parseTwoBytes(f,e.readBits(8),a);for(var h=0;h<3;h++){var x=a[h];switch(s){case 0:if(x<3)s=x+1;else if(x<this.TEXT_BASIC_SET_CHARS.length){var g=this.TEXT_BASIC_SET_CHARS[x];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else throw new re;break;case 1:n?(t.append(String.fromCharCode(x+128)),n=!1):t.append(String.fromCharCode(x)),s=0;break;case 2:if(x<this.TEXT_SHIFT2_SET_CHARS.length){var g=this.TEXT_SHIFT2_SET_CHARS[x];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g)}else switch(x){case 27:t.append("");break;case 30:n=!0;break;default:throw new re}s=0;break;case 3:if(x<this.TEXT_SHIFT3_SET_CHARS.length){var g=this.TEXT_SHIFT3_SET_CHARS[x];n?(t.append(String.fromCharCode(g.charCodeAt(0)+128)),n=!1):t.append(g),s=0}else throw new re;break;default:throw new re}}}while(e.available()>0)},r.decodeAnsiX12Segment=function(e,t){var n=[];do{if(e.available()===8)return;var a=e.readBits(8);if(a===254)return;this.parseTwoBytes(a,e.readBits(8),n);for(var s=0;s<3;s++){var f=n[s];switch(f){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(f<14)t.append(String.fromCharCode(f+44));else if(f<40)t.append(String.fromCharCode(f+51));else throw new re;break}}}while(e.available()>0)},r.parseTwoBytes=function(e,t,n){var a=(e<<8)+t-1,s=Math.floor(a/1600);n[0]=s,a-=s*1600,s=Math.floor(a/40),n[1]=s,n[2]=a-s*40},r.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var a=e.readBits(6);if(a===31){var s=8-e.getBitOffset();s!==8&&e.readBits(s);return}(a&32)===0&&(a|=64),t.append(String.fromCharCode(a))}}while(e.available()>0)},r.decodeBase256Segment=function(e,t,n){var a=1+e.getByteOffset(),s=this.unrandomize255State(e.readBits(8),a++),f;if(s===0?f=e.available()/8|0:s<250?f=s:f=250*(s-249)+this.unrandomize255State(e.readBits(8),a++),f<0)throw new re;for(var h=new Uint8Array(f),x=0;x<f;x++){if(e.available()<8)throw new re;h[x]=this.unrandomize255State(e.readBits(8),a++)}n.push(h);try{t.append(lr.decode(h,Te.ISO88591))}catch(g){throw new Hn("Platform does not support required encoding: "+g.message)}},r.unrandomize255State=function(e,t){var n=149*t%255+1,a=e-n;return a>=0?a:a+256},r.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"],r.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],r.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"],r.TEXT_SHIFT2_SET_CHARS=r.C40_SHIFT2_SET_CHARS,r.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","{","|","}","~",""],r})(),xc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},gc=(function(){function r(){this.rsDecoder=new yi(Jt.DATA_MATRIX_FIELD_256)}return r.prototype.decode=function(e){var t,n,a=new lc(e),s=a.getVersion(),f=a.readCodewords(),h=hc.getDataBlocks(f,s),x=0;try{for(var g=xc(h),w=g.next();!w.done;w=g.next()){var A=w.value;x+=A.getNumDataCodewords()}}catch(L){t={error:L}}finally{try{w&&!w.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}for(var E=new Uint8Array(x),C=h.length,b=0;b<C;b++){var T=h[b],P=T.getCodewords(),F=T.getNumDataCodewords();this.correctErrors(P,F);for(var D=0;D<F;D++)E[D*C+b]=P[D]}return dc.decode(E)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new _t}for(var a=0;a<t;a++)e[a]=n[a]},r})(),pc=(function(){function r(e){this.image=e,this.rectangleDetector=new sa(this.image)}return r.prototype.detect=function(){var e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new j;t=this.shiftToModuleCenter(t);var n=t[0],a=t[1],s=t[2],f=t[3],h=this.transitionsBetween(n,f)+1,x=this.transitionsBetween(s,f)+1;(h&1)===1&&(h+=1),(x&1)===1&&(x+=1),4*h<7*x&&4*x<7*h&&(h=x=Math.max(h,x));var g=r.sampleGrid(this.image,n,a,s,f,h,x);return new ya(g,[n,a,s,f])},r.shiftPoint=function(e,t,n){var a=(t.getX()-e.getX())/(n+1),s=(t.getY()-e.getY())/(n+1);return new ce(e.getX()+a,e.getY()+s)},r.moveAway=function(e,t,n){var a=e.getX(),s=e.getY();return a<t?a-=1:a+=1,s<n?s-=1:s+=1,new ce(a,s)},r.prototype.detectSolid1=function(e){var t=e[0],n=e[1],a=e[3],s=e[2],f=this.transitionsBetween(t,n),h=this.transitionsBetween(n,a),x=this.transitionsBetween(a,s),g=this.transitionsBetween(s,t),w=f,A=[s,t,n,a];return w>h&&(w=h,A[0]=t,A[1]=n,A[2]=a,A[3]=s),w>x&&(w=x,A[0]=n,A[1]=a,A[2]=s,A[3]=t),w>g&&(A[0]=a,A[1]=s,A[2]=t,A[3]=n),A},r.prototype.detectSolid2=function(e){var t=e[0],n=e[1],a=e[2],s=e[3],f=this.transitionsBetween(t,s),h=r.shiftPoint(n,a,(f+1)*4),x=r.shiftPoint(a,n,(f+1)*4),g=this.transitionsBetween(h,t),w=this.transitionsBetween(x,s);return g<w?(e[0]=t,e[1]=n,e[2]=a,e[3]=s):(e[0]=n,e[1]=a,e[2]=s,e[3]=t),e},r.prototype.correctTopRight=function(e){var t=e[0],n=e[1],a=e[2],s=e[3],f=this.transitionsBetween(t,s),h=this.transitionsBetween(n,s),x=r.shiftPoint(t,n,(h+1)*4),g=r.shiftPoint(a,n,(f+1)*4);f=this.transitionsBetween(x,s),h=this.transitionsBetween(g,s);var w=new ce(s.getX()+(a.getX()-n.getX())/(f+1),s.getY()+(a.getY()-n.getY())/(f+1)),A=new ce(s.getX()+(t.getX()-n.getX())/(h+1),s.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(w))return this.isValid(A)?A:null;if(!this.isValid(A))return w;var E=this.transitionsBetween(x,w)+this.transitionsBetween(g,w),C=this.transitionsBetween(x,A)+this.transitionsBetween(g,A);return E>C?w:A},r.prototype.shiftToModuleCenter=function(e){var t=e[0],n=e[1],a=e[2],s=e[3],f=this.transitionsBetween(t,s)+1,h=this.transitionsBetween(a,s)+1,x=r.shiftPoint(t,n,h*4),g=r.shiftPoint(a,n,f*4);f=this.transitionsBetween(x,s)+1,h=this.transitionsBetween(g,s)+1,(f&1)===1&&(f+=1),(h&1)===1&&(h+=1);var w=(t.getX()+n.getX()+a.getX()+s.getX())/4,A=(t.getY()+n.getY()+a.getY()+s.getY())/4;t=r.moveAway(t,w,A),n=r.moveAway(n,w,A),a=r.moveAway(a,w,A),s=r.moveAway(s,w,A);var E,C;return x=r.shiftPoint(t,n,h*4),x=r.shiftPoint(x,s,f*4),E=r.shiftPoint(n,t,h*4),E=r.shiftPoint(E,a,f*4),g=r.shiftPoint(a,s,h*4),g=r.shiftPoint(g,n,f*4),C=r.shiftPoint(s,a,h*4),C=r.shiftPoint(C,t,f*4),[x,E,g,C]},r.prototype.isValid=function(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()},r.sampleGrid=function(e,t,n,a,s,f,h){var x=Ea.getInstance();return x.sampleGrid(e,f,h,.5,.5,f-.5,.5,f-.5,h-.5,.5,h-.5,t.getX(),t.getY(),s.getX(),s.getY(),a.getX(),a.getY(),n.getX(),n.getY())},r.prototype.transitionsBetween=function(e,t){var n=Math.trunc(e.getX()),a=Math.trunc(e.getY()),s=Math.trunc(t.getX()),f=Math.trunc(t.getY()),h=Math.abs(f-a)>Math.abs(s-n);if(h){var x=n;n=a,a=x,x=s,s=f,f=x}for(var g=Math.abs(s-n),w=Math.abs(f-a),A=-g/2,E=a<f?1:-1,C=n<s?1:-1,b=0,T=this.image.get(h?a:n,h?n:a),P=n,F=a;P!==s;P+=C){var D=this.image.get(h?F:P,h?P:F);if(D!==T&&(b++,T=D),A+=w,A>0){if(F===f)break;F+=E,A-=g}}return b},r})(),ua=(function(){function r(){this.decoder=new gc}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n,a;if(t!=null&&t.has(tt.PURE_BARCODE)){var s=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(s),a=r.NO_POINTS}else{var f=new pc(e.getBlackMatrix()).detect();n=this.decoder.decode(f.getBits()),a=f.getPoints()}var h=n.getRawBytes(),x=new Bt(n.getText(),h,8*h.length,a,se.DATA_MATRIX,Ke.currentTimeMillis()),g=n.getByteSegments();g!=null&&x.putMetadata(Rt.BYTE_SEGMENTS,g);var w=n.getECLevel();return w!=null&&x.putMetadata(Rt.ERROR_CORRECTION_LEVEL,w),x},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new j;var a=this.moduleSize(t,e),s=t[1],f=n[1],h=t[0],x=n[0],g=(x-h+1)/a,w=(f-s+1)/a;if(g<=0||w<=0)throw new j;var A=a/2;s+=A,h+=A;for(var E=new br(g,w),C=0;C<w;C++)for(var b=s+C*a,T=0;T<g;T++)e.get(h+T*a,b)&&E.set(T,C);return E},r.moduleSize=function(e,t){for(var n=t.getWidth(),a=e[0],s=e[1];a<n&&t.get(a,s);)a++;if(a===n)throw new j;var f=a-e[0];if(f===0)throw new j;return f},r.NO_POINTS=[],r})(),vc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){vc(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new ua,t)||this}return e})(An);var vn;(function(r){r[r.L=0]="L",r[r.M=1]="M",r[r.Q=2]="Q",r[r.H=3]="H"})(vn||(vn={}));var wc=(function(){function r(e,t,n){this.value=e,this.stringValue=t,this.bits=n,r.FOR_BITS.set(n,this),r.FOR_VALUE.set(e,this)}return r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.fromString=function(e){switch(e){case"L":return r.L;case"M":return r.M;case"Q":return r.Q;case"H":return r.H;default:throw new pr(e+"not available")}},r.prototype.toString=function(){return this.stringValue},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.forBits=function(e){if(e<0||e>=r.FOR_BITS.size)throw new xe;return r.FOR_BITS.get(e)},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.L=new r(vn.L,"L",1),r.M=new r(vn.M,"M",0),r.Q=new r(vn.Q,"Q",3),r.H=new r(vn.H,"H",2),r})(),Ac=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},t1=(function(){function r(e){this.errorCorrectionLevel=wc.forBits(e>>3&3),this.dataMask=e&7}return r.numBitsDiffering=function(e,t){return Ie.bitCount(e^t)},r.decodeFormatInformation=function(e,t){var n=r.doDecodeFormatInformation(e,t);return n!==null?n:r.doDecodeFormatInformation(e^r.FORMAT_INFO_MASK_QR,t^r.FORMAT_INFO_MASK_QR)},r.doDecodeFormatInformation=function(e,t){var n,a,s=Number.MAX_SAFE_INTEGER,f=0;try{for(var h=Ac(r.FORMAT_INFO_DECODE_LOOKUP),x=h.next();!x.done;x=h.next()){var g=x.value,w=g[0];if(w===e||w===t)return new r(g[1]);var A=r.numBitsDiffering(e,w);A<s&&(f=g[1],s=A),e!==t&&(A=r.numBitsDiffering(t,w),A<s&&(f=g[1],s=A))}}catch(E){n={error:E}}finally{try{x&&!x.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}return s<=3?new r(f):null},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getDataMask=function(){return this.dataMask},r.prototype.hashCode=function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask},r.FORMAT_INFO_MASK_QR=21522,r.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])],r})(),yc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},G=(function(){function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.ecCodewordsPerBlock=e,this.ecBlocks=t}return r.prototype.getECCodewordsPerBlock=function(){return this.ecCodewordsPerBlock},r.prototype.getNumBlocks=function(){var e,t,n=0,a=this.ecBlocks;try{for(var s=yc(a),f=s.next();!f.done;f=s.next()){var h=f.value;n+=h.getCount()}}catch(x){e={error:x}}finally{try{f&&!f.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return n},r.prototype.getTotalECCodewords=function(){return this.ecCodewordsPerBlock*this.getNumBlocks()},r.prototype.getECBlocks=function(){return this.ecBlocks},r})(),N=(function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r})(),Ec=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rn=(function(){function r(e,t){for(var n,a,s=[],f=2;f<arguments.length;f++)s[f-2]=arguments[f];this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=s;var h=0,x=s[0].getECCodewordsPerBlock(),g=s[0].getECBlocks();try{for(var w=Ec(g),A=w.next();!A.done;A=w.next()){var E=A.value;h+=E.getCount()*(E.getDataCodewords()+x)}}catch(C){n={error:C}}finally{try{A&&!A.done&&(a=w.return)&&a.call(w)}finally{if(n)throw n.error}}this.totalCodewords=h}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getAlignmentPatternCenters=function(){return this.alignmentPatternCenters},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getDimensionForVersion=function(){return 17+4*this.versionNumber},r.prototype.getECBlocksForLevel=function(e){return this.ecBlocks[e.getValue()]},r.getProvisionalVersionForDimension=function(e){if(e%4!==1)throw new re;try{return this.getVersionForNumber((e-17)/4)}catch{throw new re}},r.getVersionForNumber=function(e){if(e<1||e>40)throw new xe;return r.VERSIONS[e-1]},r.decodeVersionInformation=function(e){for(var t=Number.MAX_SAFE_INTEGER,n=0,a=0;a<r.VERSION_DECODE_INFO.length;a++){var s=r.VERSION_DECODE_INFO[a];if(s===e)return r.getVersionForNumber(a+7);var f=t1.numBitsDiffering(e,s);f<t&&(n=a+7,t=f)}return t<=3?r.getVersionForNumber(n):null},r.prototype.buildFunctionPattern=function(){var e=this.getDimensionForVersion(),t=new br(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);for(var n=this.alignmentPatternCenters.length,a=0;a<n;a++)for(var s=this.alignmentPatternCenters[a]-2,f=0;f<n;f++)a===0&&(f===0||f===n-1)||a===n-1&&f===0||t.setRegion(this.alignmentPatternCenters[f]-2,s,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},r.prototype.toString=function(){return""+this.versionNumber},r.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]),r.VERSIONS=[new r(1,new Int32Array(0),new G(7,new N(1,19)),new G(10,new N(1,16)),new G(13,new N(1,13)),new G(17,new N(1,9))),new r(2,Int32Array.from([6,18]),new G(10,new N(1,34)),new G(16,new N(1,28)),new G(22,new N(1,22)),new G(28,new N(1,16))),new r(3,Int32Array.from([6,22]),new G(15,new N(1,55)),new G(26,new N(1,44)),new G(18,new N(2,17)),new G(22,new N(2,13))),new r(4,Int32Array.from([6,26]),new G(20,new N(1,80)),new G(18,new N(2,32)),new G(26,new N(2,24)),new G(16,new N(4,9))),new r(5,Int32Array.from([6,30]),new G(26,new N(1,108)),new G(24,new N(2,43)),new G(18,new N(2,15),new N(2,16)),new G(22,new N(2,11),new N(2,12))),new r(6,Int32Array.from([6,34]),new G(18,new N(2,68)),new G(16,new N(4,27)),new G(24,new N(4,19)),new G(28,new N(4,15))),new r(7,Int32Array.from([6,22,38]),new G(20,new N(2,78)),new G(18,new N(4,31)),new G(18,new N(2,14),new N(4,15)),new G(26,new N(4,13),new N(1,14))),new r(8,Int32Array.from([6,24,42]),new G(24,new N(2,97)),new G(22,new N(2,38),new N(2,39)),new G(22,new N(4,18),new N(2,19)),new G(26,new N(4,14),new N(2,15))),new r(9,Int32Array.from([6,26,46]),new G(30,new N(2,116)),new G(22,new N(3,36),new N(2,37)),new G(20,new N(4,16),new N(4,17)),new G(24,new N(4,12),new N(4,13))),new r(10,Int32Array.from([6,28,50]),new G(18,new N(2,68),new N(2,69)),new G(26,new N(4,43),new N(1,44)),new G(24,new N(6,19),new N(2,20)),new G(28,new N(6,15),new N(2,16))),new r(11,Int32Array.from([6,30,54]),new G(20,new N(4,81)),new G(30,new N(1,50),new N(4,51)),new G(28,new N(4,22),new N(4,23)),new G(24,new N(3,12),new N(8,13))),new r(12,Int32Array.from([6,32,58]),new G(24,new N(2,92),new N(2,93)),new G(22,new N(6,36),new N(2,37)),new G(26,new N(4,20),new N(6,21)),new G(28,new N(7,14),new N(4,15))),new r(13,Int32Array.from([6,34,62]),new G(26,new N(4,107)),new G(22,new N(8,37),new N(1,38)),new G(24,new N(8,20),new N(4,21)),new G(22,new N(12,11),new N(4,12))),new r(14,Int32Array.from([6,26,46,66]),new G(30,new N(3,115),new N(1,116)),new G(24,new N(4,40),new N(5,41)),new G(20,new N(11,16),new N(5,17)),new G(24,new N(11,12),new N(5,13))),new r(15,Int32Array.from([6,26,48,70]),new G(22,new N(5,87),new N(1,88)),new G(24,new N(5,41),new N(5,42)),new G(30,new N(5,24),new N(7,25)),new G(24,new N(11,12),new N(7,13))),new r(16,Int32Array.from([6,26,50,74]),new G(24,new N(5,98),new N(1,99)),new G(28,new N(7,45),new N(3,46)),new G(24,new N(15,19),new N(2,20)),new G(30,new N(3,15),new N(13,16))),new r(17,Int32Array.from([6,30,54,78]),new G(28,new N(1,107),new N(5,108)),new G(28,new N(10,46),new N(1,47)),new G(28,new N(1,22),new N(15,23)),new G(28,new N(2,14),new N(17,15))),new r(18,Int32Array.from([6,30,56,82]),new G(30,new N(5,120),new N(1,121)),new G(26,new N(9,43),new N(4,44)),new G(28,new N(17,22),new N(1,23)),new G(28,new N(2,14),new N(19,15))),new r(19,Int32Array.from([6,30,58,86]),new G(28,new N(3,113),new N(4,114)),new G(26,new N(3,44),new N(11,45)),new G(26,new N(17,21),new N(4,22)),new G(26,new N(9,13),new N(16,14))),new r(20,Int32Array.from([6,34,62,90]),new G(28,new N(3,107),new N(5,108)),new G(26,new N(3,41),new N(13,42)),new G(30,new N(15,24),new N(5,25)),new G(28,new N(15,15),new N(10,16))),new r(21,Int32Array.from([6,28,50,72,94]),new G(28,new N(4,116),new N(4,117)),new G(26,new N(17,42)),new G(28,new N(17,22),new N(6,23)),new G(30,new N(19,16),new N(6,17))),new r(22,Int32Array.from([6,26,50,74,98]),new G(28,new N(2,111),new N(7,112)),new G(28,new N(17,46)),new G(30,new N(7,24),new N(16,25)),new G(24,new N(34,13))),new r(23,Int32Array.from([6,30,54,78,102]),new G(30,new N(4,121),new N(5,122)),new G(28,new N(4,47),new N(14,48)),new G(30,new N(11,24),new N(14,25)),new G(30,new N(16,15),new N(14,16))),new r(24,Int32Array.from([6,28,54,80,106]),new G(30,new N(6,117),new N(4,118)),new G(28,new N(6,45),new N(14,46)),new G(30,new N(11,24),new N(16,25)),new G(30,new N(30,16),new N(2,17))),new r(25,Int32Array.from([6,32,58,84,110]),new G(26,new N(8,106),new N(4,107)),new G(28,new N(8,47),new N(13,48)),new G(30,new N(7,24),new N(22,25)),new G(30,new N(22,15),new N(13,16))),new r(26,Int32Array.from([6,30,58,86,114]),new G(28,new N(10,114),new N(2,115)),new G(28,new N(19,46),new N(4,47)),new G(28,new N(28,22),new N(6,23)),new G(30,new N(33,16),new N(4,17))),new r(27,Int32Array.from([6,34,62,90,118]),new G(30,new N(8,122),new N(4,123)),new G(28,new N(22,45),new N(3,46)),new G(30,new N(8,23),new N(26,24)),new G(30,new N(12,15),new N(28,16))),new r(28,Int32Array.from([6,26,50,74,98,122]),new G(30,new N(3,117),new N(10,118)),new G(28,new N(3,45),new N(23,46)),new G(30,new N(4,24),new N(31,25)),new G(30,new N(11,15),new N(31,16))),new r(29,Int32Array.from([6,30,54,78,102,126]),new G(30,new N(7,116),new N(7,117)),new G(28,new N(21,45),new N(7,46)),new G(30,new N(1,23),new N(37,24)),new G(30,new N(19,15),new N(26,16))),new r(30,Int32Array.from([6,26,52,78,104,130]),new G(30,new N(5,115),new N(10,116)),new G(28,new N(19,47),new N(10,48)),new G(30,new N(15,24),new N(25,25)),new G(30,new N(23,15),new N(25,16))),new r(31,Int32Array.from([6,30,56,82,108,134]),new G(30,new N(13,115),new N(3,116)),new G(28,new N(2,46),new N(29,47)),new G(30,new N(42,24),new N(1,25)),new G(30,new N(23,15),new N(28,16))),new r(32,Int32Array.from([6,34,60,86,112,138]),new G(30,new N(17,115)),new G(28,new N(10,46),new N(23,47)),new G(30,new N(10,24),new N(35,25)),new G(30,new N(19,15),new N(35,16))),new r(33,Int32Array.from([6,30,58,86,114,142]),new G(30,new N(17,115),new N(1,116)),new G(28,new N(14,46),new N(21,47)),new G(30,new N(29,24),new N(19,25)),new G(30,new N(11,15),new N(46,16))),new r(34,Int32Array.from([6,34,62,90,118,146]),new G(30,new N(13,115),new N(6,116)),new G(28,new N(14,46),new N(23,47)),new G(30,new N(44,24),new N(7,25)),new G(30,new N(59,16),new N(1,17))),new r(35,Int32Array.from([6,30,54,78,102,126,150]),new G(30,new N(12,121),new N(7,122)),new G(28,new N(12,47),new N(26,48)),new G(30,new N(39,24),new N(14,25)),new G(30,new N(22,15),new N(41,16))),new r(36,Int32Array.from([6,24,50,76,102,128,154]),new G(30,new N(6,121),new N(14,122)),new G(28,new N(6,47),new N(34,48)),new G(30,new N(46,24),new N(10,25)),new G(30,new N(2,15),new N(64,16))),new r(37,Int32Array.from([6,28,54,80,106,132,158]),new G(30,new N(17,122),new N(4,123)),new G(28,new N(29,46),new N(14,47)),new G(30,new N(49,24),new N(10,25)),new G(30,new N(24,15),new N(46,16))),new r(38,Int32Array.from([6,32,58,84,110,136,162]),new G(30,new N(4,122),new N(18,123)),new G(28,new N(13,46),new N(32,47)),new G(30,new N(48,24),new N(14,25)),new G(30,new N(42,15),new N(32,16))),new r(39,Int32Array.from([6,26,54,82,110,138,166]),new G(30,new N(20,117),new N(4,118)),new G(28,new N(40,47),new N(7,48)),new G(30,new N(43,24),new N(22,25)),new G(30,new N(10,15),new N(67,16))),new r(40,Int32Array.from([6,30,58,86,114,142,170]),new G(30,new N(19,118),new N(6,119)),new G(28,new N(18,47),new N(31,48)),new G(30,new N(34,24),new N(34,25)),new G(30,new N(20,15),new N(61,16)))],r})(),Et;(function(r){r[r.DATA_MASK_000=0]="DATA_MASK_000",r[r.DATA_MASK_001=1]="DATA_MASK_001",r[r.DATA_MASK_010=2]="DATA_MASK_010",r[r.DATA_MASK_011=3]="DATA_MASK_011",r[r.DATA_MASK_100=4]="DATA_MASK_100",r[r.DATA_MASK_101=5]="DATA_MASK_101",r[r.DATA_MASK_110=6]="DATA_MASK_110",r[r.DATA_MASK_111=7]="DATA_MASK_111"})(Et||(Et={}));var bo=(function(){function r(e,t){this.value=e,this.isMasked=t}return r.prototype.unmaskBitMatrix=function(e,t){for(var n=0;n<t;n++)for(var a=0;a<t;a++)this.isMasked(n,a)&&e.flip(a,n)},r.values=new Map([[Et.DATA_MASK_000,new r(Et.DATA_MASK_000,function(e,t){return(e+t&1)===0})],[Et.DATA_MASK_001,new r(Et.DATA_MASK_001,function(e,t){return(e&1)===0})],[Et.DATA_MASK_010,new r(Et.DATA_MASK_010,function(e,t){return t%3===0})],[Et.DATA_MASK_011,new r(Et.DATA_MASK_011,function(e,t){return(e+t)%3===0})],[Et.DATA_MASK_100,new r(Et.DATA_MASK_100,function(e,t){return(Math.floor(e/2)+Math.floor(t/3)&1)===0})],[Et.DATA_MASK_101,new r(Et.DATA_MASK_101,function(e,t){return e*t%6===0})],[Et.DATA_MASK_110,new r(Et.DATA_MASK_110,function(e,t){return e*t%6<3})],[Et.DATA_MASK_111,new r(Et.DATA_MASK_111,function(e,t){return(e+t+e*t%3&1)===0})]]),r})(),Cc=(function(){function r(e){var t=e.getHeight();if(t<21||(t&3)!==1)throw new re;this.bitMatrix=e}return r.prototype.readFormatInformation=function(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;for(var e=0,t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var n=5;n>=0;n--)e=this.copyBit(8,n,e);for(var a=this.bitMatrix.getHeight(),s=0,f=a-7,n=a-1;n>=f;n--)s=this.copyBit(8,n,s);for(var t=a-8;t<a;t++)s=this.copyBit(t,8,s);if(this.parsedFormatInfo=t1.decodeFormatInformation(e,s),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new re},r.prototype.readVersion=function(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;var e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return rn.getVersionForNumber(t);for(var n=0,a=e-11,s=5;s>=0;s--)for(var f=e-9;f>=a;f--)n=this.copyBit(f,s,n);var h=rn.decodeVersionInformation(n);if(h!==null&&h.getDimensionForVersion()===e)return this.parsedVersion=h,h;n=0;for(var f=5;f>=0;f--)for(var s=e-9;s>=a;s--)n=this.copyBit(f,s,n);if(h=rn.decodeVersionInformation(n),h!==null&&h.getDimensionForVersion()===e)return this.parsedVersion=h,h;throw new re},r.prototype.copyBit=function(e,t,n){var a=this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t);return a?n<<1|1:n<<1},r.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=bo.values.get(e.getDataMask()),a=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,a);for(var s=t.buildFunctionPattern(),f=!0,h=new Uint8Array(t.getTotalCodewords()),x=0,g=0,w=0,A=a-1;A>0;A-=2){A===6&&A--;for(var E=0;E<a;E++)for(var C=f?a-1-E:E,b=0;b<2;b++)s.get(A-b,C)||(w++,g<<=1,this.bitMatrix.get(A-b,C)&&(g|=1),w===8&&(h[x++]=g,w=0,g=0));f=!f}if(x!==t.getTotalCodewords())throw new re;return h},r.prototype.remask=function(){if(this.parsedFormatInfo!==null){var e=bo.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}},r.prototype.setMirror=function(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e},r.prototype.mirror=function(){for(var e=this.bitMatrix,t=0,n=e.getWidth();t<n;t++)for(var a=t+1,s=e.getHeight();a<s;a++)e.get(t,a)!==e.get(a,t)&&(e.flip(a,t),e.flip(t,a))},r})(),To=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},_c=(function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t,n){var a,s,f,h;if(e.length!==t.getTotalCodewords())throw new xe;var x=t.getECBlocksForLevel(n),g=0,w=x.getECBlocks();try{for(var A=To(w),E=A.next();!E.done;E=A.next()){var C=E.value;g+=C.getCount()}}catch(ne){a={error:ne}}finally{try{E&&!E.done&&(s=A.return)&&s.call(A)}finally{if(a)throw a.error}}var b=new Array(g),T=0;try{for(var P=To(w),F=P.next();!F.done;F=P.next())for(var C=F.value,D=0;D<C.getCount();D++){var L=C.getDataCodewords(),k=x.getECCodewordsPerBlock()+L;b[T++]=new r(L,new Uint8Array(k))}}catch(ne){f={error:ne}}finally{try{F&&!F.done&&(h=P.return)&&h.call(P)}finally{if(f)throw f.error}}for(var q=b[0].codewords.length,K=b.length-1;K>=0;){var U=b[K].codewords.length;if(U===q)break;K--}K++;for(var $=q-x.getECCodewordsPerBlock(),Y=0,D=0;D<$;D++)for(var ue=0;ue<T;ue++)b[ue].codewords[D]=e[Y++];for(var ue=K;ue<T;ue++)b[ue].codewords[$]=e[Y++];for(var _e=b[0].codewords.length,D=$;D<_e;D++)for(var ue=0;ue<T;ue++){var Z=ue<K?D:D+1;b[ue].codewords[Z]=e[Y++]}return b},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r})(),cr;(function(r){r[r.TERMINATOR=0]="TERMINATOR",r[r.NUMERIC=1]="NUMERIC",r[r.ALPHANUMERIC=2]="ALPHANUMERIC",r[r.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",r[r.BYTE=4]="BYTE",r[r.ECI=5]="ECI",r[r.KANJI=6]="KANJI",r[r.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",r[r.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",r[r.HANZI=9]="HANZI"})(cr||(cr={}));var $e=(function(){function r(e,t,n,a){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=a,r.FOR_BITS.set(a,this),r.FOR_VALUE.set(e,this)}return r.forBits=function(e){var t=r.FOR_BITS.get(e);if(t===void 0)throw new xe;return t},r.prototype.getCharacterCountBits=function(e){var t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]},r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.toString=function(){return this.stringValue},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.TERMINATOR=new r(cr.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),r.NUMERIC=new r(cr.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),r.ALPHANUMERIC=new r(cr.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),r.STRUCTURED_APPEND=new r(cr.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),r.BYTE=new r(cr.BYTE,"BYTE",Int32Array.from([8,16,16]),4),r.ECI=new r(cr.ECI,"ECI",Int32Array.from([0,0,0]),7),r.KANJI=new r(cr.KANJI,"KANJI",Int32Array.from([8,10,12]),8),r.FNC1_FIRST_POSITION=new r(cr.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),r.FNC1_SECOND_POSITION=new r(cr.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),r.HANZI=new r(cr.HANZI,"HANZI",Int32Array.from([8,10,12]),13),r})(),mc=(function(){function r(){}return r.decode=function(e,t,n,a){var s=new e1(e),f=new Ce,h=new Array,x=-1,g=-1;try{var w=null,A=!1,E=void 0;do{if(s.available()<4)E=$e.TERMINATOR;else{var C=s.readBits(4);E=$e.forBits(C)}switch(E){case $e.TERMINATOR:break;case $e.FNC1_FIRST_POSITION:case $e.FNC1_SECOND_POSITION:A=!0;break;case $e.STRUCTURED_APPEND:if(s.available()<16)throw new re;x=s.readBits(8),g=s.readBits(8);break;case $e.ECI:var b=r.parseECIValue(s);if(w=gt.getCharacterSetECIByValue(b),w===null)throw new re;break;case $e.HANZI:var T=s.readBits(4),P=s.readBits(E.getCharacterCountBits(t));T===r.GB2312_SUBSET&&r.decodeHanziSegment(s,f,P);break;default:var F=s.readBits(E.getCharacterCountBits(t));switch(E){case $e.NUMERIC:r.decodeNumericSegment(s,f,F);break;case $e.ALPHANUMERIC:r.decodeAlphanumericSegment(s,f,F,A);break;case $e.BYTE:r.decodeByteSegment(s,f,F,w,h,a);break;case $e.KANJI:r.decodeKanjiSegment(s,f,F);break;default:throw new re}break}}while(E!==$e.TERMINATOR)}catch{throw new re}return new Ai(e,f.toString(),h.length===0?null:h,n===null?null:n.toString(),x,g)},r.decodeHanziSegment=function(e,t,n){if(n*13>e.available())throw new re;for(var a=new Uint8Array(2*n),s=0;n>0;){var f=e.readBits(13),h=f/96<<8&4294967295|f%96;h<959?h+=41377:h+=42657,a[s]=h>>8&255,a[s+1]=h&255,s+=2,n--}try{t.append(lr.decode(a,Te.GB2312))}catch(x){throw new re(x)}},r.decodeKanjiSegment=function(e,t,n){if(n*13>e.available())throw new re;for(var a=new Uint8Array(2*n),s=0;n>0;){var f=e.readBits(13),h=f/192<<8&4294967295|f%192;h<7936?h+=33088:h+=49472,a[s]=h>>8,a[s+1]=h,s+=2,n--}try{t.append(lr.decode(a,Te.SHIFT_JIS))}catch(x){throw new re(x)}},r.decodeByteSegment=function(e,t,n,a,s,f){if(8*n>e.available())throw new re;for(var h=new Uint8Array(n),x=0;x<n;x++)h[x]=e.readBits(8);var g;a===null?g=Te.guessEncoding(h,f):g=a.getName();try{t.append(lr.decode(h,g))}catch(w){throw new re(w)}s.push(h)},r.toAlphaNumericChar=function(e){if(e>=r.ALPHANUMERIC_CHARS.length)throw new re;return r.ALPHANUMERIC_CHARS[e]},r.decodeAlphanumericSegment=function(e,t,n,a){for(var s=t.length();n>1;){if(e.available()<11)throw new re;var f=e.readBits(11);t.append(r.toAlphaNumericChar(Math.floor(f/45))),t.append(r.toAlphaNumericChar(f%45)),n-=2}if(n===1){if(e.available()<6)throw new re;t.append(r.toAlphaNumericChar(e.readBits(6)))}if(a)for(var h=s;h<t.length();h++)t.charAt(h)==="%"&&(h<t.length()-1&&t.charAt(h+1)==="%"?t.deleteCharAt(h+1):t.setCharAt(h,""))},r.decodeNumericSegment=function(e,t,n){for(;n>=3;){if(e.available()<10)throw new re;var a=e.readBits(10);if(a>=1e3)throw new re;t.append(r.toAlphaNumericChar(Math.floor(a/100))),t.append(r.toAlphaNumericChar(Math.floor(a/10)%10)),t.append(r.toAlphaNumericChar(a%10)),n-=3}if(n===2){if(e.available()<7)throw new re;var s=e.readBits(7);if(s>=100)throw new re;t.append(r.toAlphaNumericChar(Math.floor(s/10))),t.append(r.toAlphaNumericChar(s%10))}else if(n===1){if(e.available()<4)throw new re;var f=e.readBits(4);if(f>=10)throw new re;t.append(r.toAlphaNumericChar(f))}},r.parseECIValue=function(e){var t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){var n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){var a=e.readBits(16);return(t&31)<<16&4294967295|a}throw new re},r.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",r.GB2312_SUBSET=1,r})(),r1=(function(){function r(e){this.mirrored=e}return r.prototype.isMirrored=function(){return this.mirrored},r.prototype.applyMirroredCorrection=function(e){if(!(!this.mirrored||e===null||e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},r})(),Oo=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ic=(function(){function r(){this.rsDecoder=new yi(Jt.QR_CODE_FIELD_256)}return r.prototype.decodeBooleanArray=function(e,t){return this.decodeBitMatrix(br.parseFromBooleanArray(e),t)},r.prototype.decodeBitMatrix=function(e,t){var n=new Cc(e),a=null;try{return this.decodeBitMatrixParser(n,t)}catch(f){a=f}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var s=this.decodeBitMatrixParser(n,t);return s.setOther(new r1(!0)),s}catch(f){throw a!==null?a:f}},r.prototype.decodeBitMatrixParser=function(e,t){var n,a,s,f,h=e.readVersion(),x=e.readFormatInformation().getErrorCorrectionLevel(),g=e.readCodewords(),w=_c.getDataBlocks(g,h,x),A=0;try{for(var E=Oo(w),C=E.next();!C.done;C=E.next()){var b=C.value;A+=b.getNumDataCodewords()}}catch(K){n={error:K}}finally{try{C&&!C.done&&(a=E.return)&&a.call(E)}finally{if(n)throw n.error}}var T=new Uint8Array(A),P=0;try{for(var F=Oo(w),D=F.next();!D.done;D=F.next()){var b=D.value,L=b.getCodewords(),k=b.getNumDataCodewords();this.correctErrors(L,k);for(var q=0;q<k;q++)T[P++]=L[q]}}catch(K){s={error:K}}finally{try{D&&!D.done&&(f=F.return)&&f.call(F)}finally{if(s)throw s.error}}return mc.decode(T,h,x,t)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new _t}for(var a=0;a<t;a++)e[a]=n[a]},r})(),Sc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),bc=(function(r){Sc(e,r);function e(t,n,a){var s=r.call(this,t,n)||this;return s.estimatedModuleSize=a,s}return e.prototype.aboutEquals=function(t,n,a){if(Math.abs(n-this.getY())<=t&&Math.abs(a-this.getX())<=t){var s=Math.abs(t-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,a){var s=(this.getX()+n)/2,f=(this.getY()+t)/2,h=(this.estimatedModuleSize+a)/2;return new e(s,f,h)},e})(ce),Tc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Oc=(function(){function r(e,t,n,a,s,f,h){this.image=e,this.startX=t,this.startY=n,this.width=a,this.height=s,this.moduleSize=f,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return r.prototype.find=function(){for(var e=this.startX,t=this.height,n=this.width,a=e+n,s=this.startY+t/2,f=new Int32Array(3),h=this.image,x=0;x<t;x++){var g=s+((x&1)===0?Math.floor((x+1)/2):-Math.floor((x+1)/2));f[0]=0,f[1]=0,f[2]=0;for(var w=e;w<a&&!h.get(w,g);)w++;for(var A=0;w<a;){if(h.get(w,g))if(A===1)f[1]++;else if(A===2){if(this.foundPatternCross(f)){var E=this.handlePossibleCenter(f,g,w);if(E!==null)return E}f[0]=f[2],f[1]=1,f[2]=0,A=1}else f[++A]++;else A===1&&A++,f[A]++;w++}if(this.foundPatternCross(f)){var E=this.handlePossibleCenter(f,g,a);if(E!==null)return E}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new j},r.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},r.prototype.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,a=0;a<3;a++)if(Math.abs(t-e[a])>=n)return!1;return!0},r.prototype.crossCheckVertical=function(e,t,n,a){var s=this.image,f=s.getHeight(),h=this.crossCheckStateCount;h[0]=0,h[1]=0,h[2]=0;for(var x=e;x>=0&&s.get(t,x)&&h[1]<=n;)h[1]++,x--;if(x<0||h[1]>n)return NaN;for(;x>=0&&!s.get(t,x)&&h[0]<=n;)h[0]++,x--;if(h[0]>n)return NaN;for(x=e+1;x<f&&s.get(t,x)&&h[1]<=n;)h[1]++,x++;if(x===f||h[1]>n)return NaN;for(;x<f&&!s.get(t,x)&&h[2]<=n;)h[2]++,x++;if(h[2]>n)return NaN;var g=h[0]+h[1]+h[2];return 5*Math.abs(g-a)>=2*a?NaN:this.foundPatternCross(h)?r.centerFromEnd(h,x):NaN},r.prototype.handlePossibleCenter=function(e,t,n){var a,s,f=e[0]+e[1]+e[2],h=r.centerFromEnd(e,n),x=this.crossCheckVertical(t,h,2*e[1],f);if(!isNaN(x)){var g=(e[0]+e[1]+e[2])/3;try{for(var w=Tc(this.possibleCenters),A=w.next();!A.done;A=w.next()){var E=A.value;if(E.aboutEquals(g,x,h))return E.combineEstimate(x,h,g)}}catch(b){a={error:b}}finally{try{A&&!A.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}var C=new bc(h,x,g);this.possibleCenters.push(C),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(C)}return null},r})(),Nc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Rc=(function(r){Nc(e,r);function e(t,n,a,s){var f=r.call(this,t,n)||this;return f.estimatedModuleSize=a,f.count=s,s===void 0&&(f.count=1),f}return e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,n,a){if(Math.abs(n-this.getY())<=t&&Math.abs(a-this.getX())<=t){var s=Math.abs(t-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,a){var s=this.count+1,f=(this.count*this.getX()+n)/s,h=(this.count*this.getY()+t)/s,x=(this.count*this.estimatedModuleSize+a)/s;return new e(f,h,x,s)},e})(ce),Dc=(function(){function r(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}return r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r})(),Dn=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Mc=(function(){function r(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}return r.prototype.getImage=function(){return this.image},r.prototype.getPossibleCenters=function(){return this.possibleCenters},r.prototype.find=function(e){var t=e!=null&&e.get(tt.TRY_HARDER)!==void 0,n=e!=null&&e.get(tt.PURE_BARCODE)!==void 0,a=this.image,s=a.getHeight(),f=a.getWidth(),h=Math.floor(3*s/(4*r.MAX_MODULES));(h<r.MIN_SKIP||t)&&(h=r.MIN_SKIP);for(var x=!1,g=new Int32Array(5),w=h-1;w<s&&!x;w+=h){g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0;for(var A=0,E=0;E<f;E++)if(a.get(E,w))(A&1)===1&&A++,g[A]++;else if((A&1)===0)if(A===4)if(r.foundPatternCross(g)){var C=this.handlePossibleCenter(g,w,E,n);if(C===!0)if(h=2,this.hasSkipped===!0)x=this.haveMultiplyConfirmedCenters();else{var b=this.findRowSkip();b>g[2]&&(w+=b-g[2]-h,E=f-1)}else{g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;continue}A=0,g[0]=0,g[1]=0,g[2]=0,g[3]=0,g[4]=0}else g[0]=g[2],g[1]=g[3],g[2]=g[4],g[3]=1,g[4]=0,A=3;else g[++A]++;else g[A]++;if(r.foundPatternCross(g)){var C=this.handlePossibleCenter(g,w,f,n);C===!0&&(h=g[0],this.hasSkipped&&(x=this.haveMultiplyConfirmedCenters()))}}var T=this.selectBestPatterns();return ce.orderBestPatterns(T),new Dc(T)},r.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},r.foundPatternCross=function(e){for(var t=0,n=0;n<5;n++){var a=e[n];if(a===0)return!1;t+=a}if(t<7)return!1;var s=t/7,f=s/2;return Math.abs(s-e[0])<f&&Math.abs(s-e[1])<f&&Math.abs(3*s-e[2])<3*f&&Math.abs(s-e[3])<f&&Math.abs(s-e[4])<f},r.prototype.getCrossCheckStateCount=function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e},r.prototype.crossCheckDiagonal=function(e,t,n,a){for(var s=this.getCrossCheckStateCount(),f=0,h=this.image;e>=f&&t>=f&&h.get(t-f,e-f);)s[2]++,f++;if(e<f||t<f)return!1;for(;e>=f&&t>=f&&!h.get(t-f,e-f)&&s[1]<=n;)s[1]++,f++;if(e<f||t<f||s[1]>n)return!1;for(;e>=f&&t>=f&&h.get(t-f,e-f)&&s[0]<=n;)s[0]++,f++;if(s[0]>n)return!1;var x=h.getHeight(),g=h.getWidth();for(f=1;e+f<x&&t+f<g&&h.get(t+f,e+f);)s[2]++,f++;if(e+f>=x||t+f>=g)return!1;for(;e+f<x&&t+f<g&&!h.get(t+f,e+f)&&s[3]<n;)s[3]++,f++;if(e+f>=x||t+f>=g||s[3]>=n)return!1;for(;e+f<x&&t+f<g&&h.get(t+f,e+f)&&s[4]<n;)s[4]++,f++;if(s[4]>=n)return!1;var w=s[0]+s[1]+s[2]+s[3]+s[4];return Math.abs(w-a)<2*a&&r.foundPatternCross(s)},r.prototype.crossCheckVertical=function(e,t,n,a){for(var s=this.image,f=s.getHeight(),h=this.getCrossCheckStateCount(),x=e;x>=0&&s.get(t,x);)h[2]++,x--;if(x<0)return NaN;for(;x>=0&&!s.get(t,x)&&h[1]<=n;)h[1]++,x--;if(x<0||h[1]>n)return NaN;for(;x>=0&&s.get(t,x)&&h[0]<=n;)h[0]++,x--;if(h[0]>n)return NaN;for(x=e+1;x<f&&s.get(t,x);)h[2]++,x++;if(x===f)return NaN;for(;x<f&&!s.get(t,x)&&h[3]<n;)h[3]++,x++;if(x===f||h[3]>=n)return NaN;for(;x<f&&s.get(t,x)&&h[4]<n;)h[4]++,x++;if(h[4]>=n)return NaN;var g=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(g-a)>=2*a?NaN:r.foundPatternCross(h)?r.centerFromEnd(h,x):NaN},r.prototype.crossCheckHorizontal=function(e,t,n,a){for(var s=this.image,f=s.getWidth(),h=this.getCrossCheckStateCount(),x=e;x>=0&&s.get(x,t);)h[2]++,x--;if(x<0)return NaN;for(;x>=0&&!s.get(x,t)&&h[1]<=n;)h[1]++,x--;if(x<0||h[1]>n)return NaN;for(;x>=0&&s.get(x,t)&&h[0]<=n;)h[0]++,x--;if(h[0]>n)return NaN;for(x=e+1;x<f&&s.get(x,t);)h[2]++,x++;if(x===f)return NaN;for(;x<f&&!s.get(x,t)&&h[3]<n;)h[3]++,x++;if(x===f||h[3]>=n)return NaN;for(;x<f&&s.get(x,t)&&h[4]<n;)h[4]++,x++;if(h[4]>=n)return NaN;var g=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(g-a)>=a?NaN:r.foundPatternCross(h)?r.centerFromEnd(h,x):NaN},r.prototype.handlePossibleCenter=function(e,t,n,a){var s=e[0]+e[1]+e[2]+e[3]+e[4],f=r.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(f),e[2],s);if(!isNaN(h)&&(f=this.crossCheckHorizontal(Math.floor(f),Math.floor(h),e[2],s),!isNaN(f)&&(!a||this.crossCheckDiagonal(Math.floor(h),Math.floor(f),e[2],s)))){for(var x=s/7,g=!1,w=this.possibleCenters,A=0,E=w.length;A<E;A++){var C=w[A];if(C.aboutEquals(x,h,f)){w[A]=C.combineEstimate(h,f,x),g=!0;break}}if(!g){var b=new Rc(f,h,x);w.push(b),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(b)}return!0}return!1},r.prototype.findRowSkip=function(){var e,t,n=this.possibleCenters.length;if(n<=1)return 0;var a=null;try{for(var s=Dn(this.possibleCenters),f=s.next();!f.done;f=s.next()){var h=f.value;if(h.getCount()>=r.CENTER_QUORUM)if(a==null)a=h;else return this.hasSkipped=!0,Math.floor((Math.abs(a.getX()-h.getX())-Math.abs(a.getY()-h.getY()))/2)}}catch(x){e={error:x}}finally{try{f&&!f.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return 0},r.prototype.haveMultiplyConfirmedCenters=function(){var e,t,n,a,s=0,f=0,h=this.possibleCenters.length;try{for(var x=Dn(this.possibleCenters),g=x.next();!g.done;g=x.next()){var w=g.value;w.getCount()>=r.CENTER_QUORUM&&(s++,f+=w.getEstimatedModuleSize())}}catch(T){e={error:T}}finally{try{g&&!g.done&&(t=x.return)&&t.call(x)}finally{if(e)throw e.error}}if(s<3)return!1;var A=f/h,E=0;try{for(var C=Dn(this.possibleCenters),b=C.next();!b.done;b=C.next()){var w=b.value;E+=Math.abs(w.getEstimatedModuleSize()-A)}}catch(T){n={error:T}}finally{try{b&&!b.done&&(a=C.return)&&a.call(C)}finally{if(n)throw n.error}}return E<=.05*f},r.prototype.selectBestPatterns=function(){var e,t,n,a,s=this.possibleCenters.length;if(s<3)throw new j;var f=this.possibleCenters,h;if(s>3){var x=0,g=0;try{for(var w=Dn(this.possibleCenters),A=w.next();!A.done;A=w.next()){var E=A.value,C=E.getEstimatedModuleSize();x+=C,g+=C*C}}catch(q){e={error:q}}finally{try{A&&!A.done&&(t=w.return)&&t.call(w)}finally{if(e)throw e.error}}h=x/s;var b=Math.sqrt(g/s-h*h);f.sort(function(q,K){var U=Math.abs(K.getEstimatedModuleSize()-h),$=Math.abs(q.getEstimatedModuleSize()-h);return U<$?-1:U>$?1:0});for(var T=Math.max(.2*h,b),P=0;P<f.length&&f.length>3;P++){var F=f[P];Math.abs(F.getEstimatedModuleSize()-h)>T&&(f.splice(P,1),P--)}}if(f.length>3){var x=0;try{for(var D=Dn(f),L=D.next();!L.done;L=D.next()){var k=L.value;x+=k.getEstimatedModuleSize()}}catch(K){n={error:K}}finally{try{L&&!L.done&&(a=D.return)&&a.call(D)}finally{if(n)throw n.error}}h=x/f.length,f.sort(function(K,U){if(U.getCount()===K.getCount()){var $=Math.abs(U.getEstimatedModuleSize()-h),Y=Math.abs(K.getEstimatedModuleSize()-h);return $<Y?1:$>Y?-1:0}else return U.getCount()-K.getCount()}),f.splice(3)}return[f[0],f[1],f[2]]},r.CENTER_QUORUM=2,r.MIN_SKIP=3,r.MAX_MODULES=57,r})(),Pc=(function(){function r(e){this.image=e}return r.prototype.getImage=function(){return this.image},r.prototype.getResultPointCallback=function(){return this.resultPointCallback},r.prototype.detect=function(e){this.resultPointCallback=e==null?null:e.get(tt.NEED_RESULT_POINT_CALLBACK);var t=new Mc(this.image,this.resultPointCallback),n=t.find(e);return this.processFinderPatternInfo(n)},r.prototype.processFinderPatternInfo=function(e){var t=e.getTopLeft(),n=e.getTopRight(),a=e.getBottomLeft(),s=this.calculateModuleSize(t,n,a);if(s<1)throw new j("No pattern found in proccess finder.");var f=r.computeDimension(t,n,a,s),h=rn.getProvisionalVersionForDimension(f),x=h.getDimensionForVersion()-7,g=null;if(h.getAlignmentPatternCenters().length>0)for(var w=n.getX()-t.getX()+a.getX(),A=n.getY()-t.getY()+a.getY(),E=1-3/x,C=Math.floor(t.getX()+E*(w-t.getX())),b=Math.floor(t.getY()+E*(A-t.getY())),T=4;T<=16;T<<=1)try{g=this.findAlignmentInRegion(s,C,b,T);break}catch(L){if(!(L instanceof j))throw L}var P=r.createTransform(t,n,a,g,f),F=r.sampleGrid(this.image,P,f),D;return g===null?D=[a,t,n]:D=[a,t,n,g],new ya(F,D)},r.createTransform=function(e,t,n,a,s){var f=s-3.5,h,x,g,w;return a!==null?(h=a.getX(),x=a.getY(),g=f-3,w=g):(h=t.getX()-e.getX()+n.getX(),x=t.getY()-e.getY()+n.getY(),g=f,w=f),qo.quadrilateralToQuadrilateral(3.5,3.5,f,3.5,g,w,3.5,f,e.getX(),e.getY(),t.getX(),t.getY(),h,x,n.getX(),n.getY())},r.sampleGrid=function(e,t,n){var a=Ea.getInstance();return a.sampleGridWithTransform(e,n,n,t)},r.computeDimension=function(e,t,n,a){var s=De.round(ce.distance(e,t)/a),f=De.round(ce.distance(e,n)/a),h=Math.floor((s+f)/2)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw new j("Dimensions could be not found.")}return h},r.prototype.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},r.prototype.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),a=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?a/7:isNaN(a)?n/7:(n+a)/14},r.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,n,a){var s=this.sizeOfBlackWhiteBlackRun(e,t,n,a),f=1,h=e-(n-e);h<0?(f=e/(e-h),h=0):h>=this.image.getWidth()&&(f=(this.image.getWidth()-1-e)/(h-e),h=this.image.getWidth()-1);var x=Math.floor(t-(a-t)*f);return f=1,x<0?(f=t/(t-x),x=0):x>=this.image.getHeight()&&(f=(this.image.getHeight()-1-t)/(x-t),x=this.image.getHeight()-1),h=Math.floor(e+(h-e)*f),s+=this.sizeOfBlackWhiteBlackRun(e,t,h,x),s-1},r.prototype.sizeOfBlackWhiteBlackRun=function(e,t,n,a){var s=Math.abs(a-t)>Math.abs(n-e);if(s){var f=e;e=t,t=f,f=n,n=a,a=f}for(var h=Math.abs(n-e),x=Math.abs(a-t),g=-h/2,w=e<n?1:-1,A=t<a?1:-1,E=0,C=n+w,b=e,T=t;b!==C;b+=w){var P=s?T:b,F=s?b:T;if(E===1===this.image.get(P,F)){if(E===2)return De.distance(b,T,e,t);E++}if(g+=x,g>0){if(T===a)break;T+=A,g-=h}}return E===2?De.distance(n+w,a,e,t):NaN},r.prototype.findAlignmentInRegion=function(e,t,n,a){var s=Math.floor(a*e),f=Math.max(0,t-s),h=Math.min(this.image.getWidth()-1,t+s);if(h-f<e*3)throw new j("Alignment top exceeds estimated module size.");var x=Math.max(0,n-s),g=Math.min(this.image.getHeight()-1,n+s);if(g-x<e*3)throw new j("Alignment bottom exceeds estimated module size.");var w=new Oc(this.image,f,x,h-f,g-x,e,this.resultPointCallback);return w.find()},r})(),la=(function(){function r(){this.decoder=new Ic}return r.prototype.getDecoder=function(){return this.decoder},r.prototype.decode=function(e,t){var n,a;if(t!=null&&t.get(tt.PURE_BARCODE)!==void 0){var s=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(s,t),a=r.NO_POINTS}else{var f=new Pc(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(f.getBits(),t),a=f.getPoints()}n.getOther()instanceof r1&&n.getOther().applyMirroredCorrection(a);var h=new Bt(n.getText(),n.getRawBytes(),void 0,a,se.QR_CODE,void 0),x=n.getByteSegments();x!==null&&h.putMetadata(Rt.BYTE_SEGMENTS,x);var g=n.getECLevel();return g!==null&&h.putMetadata(Rt.ERROR_CORRECTION_LEVEL,g),n.hasStructuredAppend()&&(h.putMetadata(Rt.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),h.putMetadata(Rt.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),h},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new j;var a=this.moduleSize(t,e),s=t[1],f=n[1],h=t[0],x=n[0];if(h>=x||s>=f)throw new j;if(f-s!==x-h&&(x=h+(f-s),x>=e.getWidth()))throw new j;var g=Math.round((x-h+1)/a),w=Math.round((f-s+1)/a);if(g<=0||w<=0)throw new j;if(w!==g)throw new j;var A=Math.floor(a/2);s+=A,h+=A;var E=h+Math.floor((g-1)*a)-x;if(E>0){if(E>A)throw new j;h-=E}var C=s+Math.floor((w-1)*a)-f;if(C>0){if(C>A)throw new j;s-=C}for(var b=new br(g,w),T=0;T<w;T++)for(var P=s+Math.floor(T*a),F=0;F<g;F++)e.get(h+Math.floor(F*a),P)&&b.set(F,T);return b},r.moduleSize=function(e,t){for(var n=t.getHeight(),a=t.getWidth(),s=e[0],f=e[1],h=!0,x=0;s<a&&f<n;){if(h!==t.get(s,f)){if(++x===5)break;h=!h}s++,f++}if(s===a||f===n)throw new j;return(s-e[0])/7},r.NO_POINTS=new Array,r})(),Bc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Re=(function(){function r(){}return r.prototype.PDF417Common=function(){},r.getBitCountSum=function(e){return De.sum(e)},r.toIntArray=function(e){var t,n;if(e==null||!e.length)return r.EMPTY_INT_ARRAY;var a=new Int32Array(e.length),s=0;try{for(var f=Bc(e),h=f.next();!h.done;h=f.next()){var x=h.value;a[s++]=x}}catch(g){t={error:g}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return a},r.getCodeword=function(e){var t=pt.binarySearch(r.SYMBOL_TABLE,e&262143);return t<0?-1:(r.CODEWORD_TABLE[t]-1)%r.NUMBER_OF_CODEWORDS},r.NUMBER_OF_CODEWORDS=929,r.MAX_CODEWORDS_IN_BARCODE=r.NUMBER_OF_CODEWORDS-1,r.MIN_ROWS_IN_BARCODE=3,r.MAX_ROWS_IN_BARCODE=90,r.MODULES_IN_CODEWORD=17,r.MODULES_IN_STOP_PATTERN=18,r.BARS_IN_MODULE=8,r.EMPTY_INT_ARRAY=new Int32Array([]),r.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]),r.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]),r})(),Lc=(function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r})(),Fc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},kc=(function(){function r(){}return r.detectMultiple=function(e,t,n){var a=e.getBlackMatrix(),s=r.detect(n,a);return s.length||(a=a.clone(),a.rotate180(),s=r.detect(n,a)),new Lc(a,s)},r.detect=function(e,t){for(var n,a,s=new Array,f=0,h=0,x=!1;f<t.getHeight();){var g=r.findVertices(t,f,h);if(g[0]==null&&g[3]==null){if(!x)break;x=!1,h=0;try{for(var w=(n=void 0,Fc(s)),A=w.next();!A.done;A=w.next()){var E=A.value;E[1]!=null&&(f=Math.trunc(Math.max(f,E[1].getY()))),E[3]!=null&&(f=Math.max(f,Math.trunc(E[3].getY())))}}catch(C){n={error:C}}finally{try{A&&!A.done&&(a=w.return)&&a.call(w)}finally{if(n)throw n.error}}f+=r.ROW_STEP;continue}if(x=!0,s.push(g),!e)break;g[2]!=null?(h=Math.trunc(g[2].getX()),f=Math.trunc(g[2].getY())):(h=Math.trunc(g[4].getX()),f=Math.trunc(g[4].getY()))}return s},r.findVertices=function(e,t,n){var a=e.getHeight(),s=e.getWidth(),f=new Array(8);return r.copyToResult(f,r.findRowsWithPattern(e,a,s,t,n,r.START_PATTERN),r.INDEXES_START_PATTERN),f[4]!=null&&(n=Math.trunc(f[4].getX()),t=Math.trunc(f[4].getY())),r.copyToResult(f,r.findRowsWithPattern(e,a,s,t,n,r.STOP_PATTERN),r.INDEXES_STOP_PATTERN),f},r.copyToResult=function(e,t,n){for(var a=0;a<n.length;a++)e[n[a]]=t[a]},r.findRowsWithPattern=function(e,t,n,a,s,f){for(var h=new Array(4),x=!1,g=new Int32Array(f.length);a<t;a+=r.ROW_STEP){var w=r.findGuardPattern(e,s,a,n,!1,f,g);if(w!=null){for(;a>0;){var A=r.findGuardPattern(e,s,--a,n,!1,f,g);if(A!=null)w=A;else{a++;break}}h[0]=new ce(w[0],a),h[1]=new ce(w[1],a),x=!0;break}}var E=a+1;if(x){for(var C=0,A=Int32Array.from([Math.trunc(h[0].getX()),Math.trunc(h[1].getX())]);E<t;E++){var w=r.findGuardPattern(e,A[0],E,n,!1,f,g);if(w!=null&&Math.abs(A[0]-w[0])<r.MAX_PATTERN_DRIFT&&Math.abs(A[1]-w[1])<r.MAX_PATTERN_DRIFT)A=w,C=0;else{if(C>r.SKIPPED_ROW_COUNT_MAX)break;C++}}E-=C+1,h[2]=new ce(A[0],E),h[3]=new ce(A[1],E)}return E-a<r.BARCODE_MIN_HEIGHT&&pt.fill(h,null),h},r.findGuardPattern=function(e,t,n,a,s,f,h){pt.fillWithin(h,0,h.length,0);for(var x=t,g=0;e.get(x,n)&&x>0&&g++<r.MAX_PIXEL_DRIFT;)x--;for(var w=x,A=0,E=f.length,C=s;w<a;w++){var b=e.get(w,n);if(b!==C)h[A]++;else{if(A===E-1){if(r.patternMatchVariance(h,f,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE)return new Int32Array([x,w]);x+=h[0]+h[1],Ke.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,C=!C}}return A===E-1&&r.patternMatchVariance(h,f,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE?new Int32Array([x,w-1]):null},r.patternMatchVariance=function(e,t,n){for(var a=e.length,s=0,f=0,h=0;h<a;h++)s+=e[h],f+=t[h];if(s<f)return 1/0;var x=s/f;n*=x;for(var g=0,w=0;w<a;w++){var A=e[w],E=t[w]*x,C=A>E?A-E:E-A;if(C>n)return 1/0;g+=C}return g/s},r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),r.MAX_AVG_VARIANCE=.42,r.MAX_INDIVIDUAL_VARIANCE=.8,r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),r.MAX_PIXEL_DRIFT=3,r.MAX_PATTERN_DRIFT=5,r.SKIPPED_ROW_COUNT_MAX=25,r.ROW_STEP=5,r.BARCODE_MIN_HEIGHT=10,r})(),Uc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},en=(function(){function r(e,t){if(t.length===0)throw new xe;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var a=1;a<n&&t[a]===0;)a++;a===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-a),Ke.arraycopy(t,a,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){var t,n;if(e===0)return this.getCoefficient(0);if(e===1){var a=0;try{for(var s=Uc(this.coefficients),f=s.next();!f.done;f=s.next()){var h=f.value;a=this.field.add(a,h)}}catch(A){t={error:A}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}for(var x=this.coefficients[0],g=this.coefficients.length,w=1;w<g;w++)x=this.field.add(this.field.multiply(e,x),this.coefficients[w]);return x},r.prototype.add=function(e){if(!this.field.equals(e.field))throw new xe("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var a=t;t=n,n=a}var s=new Int32Array(n.length),f=n.length-t.length;Ke.arraycopy(n,0,s,0,f);for(var h=f;h<n.length;h++)s[h]=this.field.add(t[h-f],n[h]);return new r(this.field,s)},r.prototype.subtract=function(e){if(!this.field.equals(e.field))throw new xe("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())},r.prototype.multiply=function(e){return e instanceof r?this.multiplyOther(e):this.multiplyScalar(e)},r.prototype.multiplyOther=function(e){if(!this.field.equals(e.field))throw new xe("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new r(this.field,new Int32Array([0]));for(var t=this.coefficients,n=t.length,a=e.coefficients,s=a.length,f=new Int32Array(n+s-1),h=0;h<n;h++)for(var x=t[h],g=0;g<s;g++)f[h+g]=this.field.add(f[h+g],this.field.multiply(x,a[g]));return new r(this.field,f)},r.prototype.negative=function(){for(var e=this.coefficients.length,t=new Int32Array(e),n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new r(this.field,t)},r.prototype.multiplyScalar=function(e){if(e===0)return new r(this.field,new Int32Array([0]));if(e===1)return this;for(var t=this.coefficients.length,n=new Int32Array(t),a=0;a<t;a++)n[a]=this.field.multiply(this.coefficients[a],e);return new r(this.field,n)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new xe;if(t===0)return new r(this.field,new Int32Array([0]));for(var n=this.coefficients.length,a=new Int32Array(n+e),s=0;s<n;s++)a[s]=this.field.multiply(this.coefficients[s],t);return new r(this.field,a)},r.prototype.toString=function(){for(var e=new Ce,t=this.getDegree();t>=0;t--){var 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()},r})(),Vc=(function(){function r(){}return r.prototype.add=function(e,t){return(e+t)%this.modulus},r.prototype.subtract=function(e,t){return(this.modulus+e-t)%this.modulus},r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new xe;return this.logTable[e]},r.prototype.inverse=function(e){if(e===0)throw new Ko;return this.expTable[this.modulus-this.logTable[e]-1]},r.prototype.multiply=function(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]},r.prototype.getSize=function(){return this.modulus},r.prototype.equals=function(e){return e===this},r})(),Hc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Gc=(function(r){Hc(e,r);function e(t,n){var a=r.call(this)||this;a.modulus=t,a.expTable=new Int32Array(t),a.logTable=new Int32Array(t);for(var s=1,f=0;f<t;f++)a.expTable[f]=s,s=s*n%t;for(var f=0;f<t-1;f++)a.logTable[a.expTable[f]]=f;return a.zero=new en(a,new Int32Array([0])),a.one=new en(a,new Int32Array([1])),a}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new xe;if(n===0)return this.zero;var a=new Int32Array(t+1);return a[0]=n,new en(this,a)},e.PDF417_GF=new e(Re.NUMBER_OF_CODEWORDS,3),e})(Vc),Xc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Wc=(function(){function r(){this.field=Gc.PDF417_GF}return r.prototype.decode=function(e,t,n){for(var a,s,f=new en(this.field,e),h=new Int32Array(t),x=!1,g=t;g>0;g--){var w=f.evaluateAt(this.field.exp(g));h[t-g]=w,w!==0&&(x=!0)}if(!x)return 0;var A=this.field.getOne();if(n!=null)try{for(var E=Xc(n),C=E.next();!C.done;C=E.next()){var b=C.value,T=this.field.exp(e.length-1-b),P=new en(this.field,new Int32Array([this.field.subtract(0,T),1]));A=A.multiply(P)}}catch($){a={error:$}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}for(var F=new en(this.field,h),D=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),F,t),L=D[0],k=D[1],q=this.findErrorLocations(L),K=this.findErrorMagnitudes(k,L,q),g=0;g<q.length;g++){var U=e.length-1-this.field.log(q[g]);if(U<0)throw _t.getChecksumInstance();e[U]=this.field.subtract(e[U],K[g])}return q.length},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var a=e;e=t,t=a}for(var s=e,f=t,h=this.field.getZero(),x=this.field.getOne();f.getDegree()>=Math.round(n/2);){var g=s,w=h;if(s=f,h=x,s.isZero())throw _t.getChecksumInstance();f=g;for(var A=this.field.getZero(),E=s.getCoefficient(s.getDegree()),C=this.field.inverse(E);f.getDegree()>=s.getDegree()&&!f.isZero();){var b=f.getDegree()-s.getDegree(),T=this.field.multiply(f.getCoefficient(f.getDegree()),C);A=A.add(this.field.buildMonomial(b,T)),f=f.subtract(s.multiplyByMonomial(b,T))}x=A.multiply(h).subtract(w).negative()}var P=x.getCoefficient(0);if(P===0)throw _t.getChecksumInstance();var F=this.field.inverse(P),D=x.multiply(F),L=f.multiply(F);return[D,L]},r.prototype.findErrorLocations=function(e){for(var t=e.getDegree(),n=new Int32Array(t),a=0,s=1;s<this.field.getSize()&&a<t;s++)e.evaluateAt(s)===0&&(n[a]=this.field.inverse(s),a++);if(a!==t)throw _t.getChecksumInstance();return n},r.prototype.findErrorMagnitudes=function(e,t,n){for(var a=t.getDegree(),s=new Int32Array(a),f=1;f<=a;f++)s[a-f]=this.field.multiply(f,t.getCoefficient(f));for(var h=new en(this.field,s),x=n.length,g=new Int32Array(x),f=0;f<x;f++){var w=this.field.inverse(n[f]),A=this.field.subtract(0,e.evaluateAt(w)),E=this.field.inverse(h.evaluateAt(w));g[f]=this.field.multiply(A,E)}return g},r})(),ha=(function(){function r(e,t,n,a,s){e instanceof r?this.constructor_2(e):this.constructor_1(e,t,n,a,s)}return r.prototype.constructor_1=function(e,t,n,a,s){var f=t==null||n==null,h=a==null||s==null;if(f&&h)throw new j;f?(t=new ce(0,a.getY()),n=new ce(0,s.getY())):h&&(a=new ce(e.getWidth()-1,t.getY()),s=new ce(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=a,this.bottomRight=s,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(a.getX(),s.getX())),this.minY=Math.trunc(Math.min(t.getY(),a.getY())),this.maxY=Math.trunc(Math.max(n.getY(),s.getY()))},r.prototype.constructor_2=function(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()},r.merge=function(e,t){return e==null?t:t==null?e:new r(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)},r.prototype.addMissingRows=function(e,t,n){var a=this.topLeft,s=this.bottomLeft,f=this.topRight,h=this.bottomRight;if(e>0){var x=n?this.topLeft:this.topRight,g=Math.trunc(x.getY()-e);g<0&&(g=0);var w=new ce(x.getX(),g);n?a=w:f=w}if(t>0){var A=n?this.bottomLeft:this.bottomRight,E=Math.trunc(A.getY()+t);E>=this.image.getHeight()&&(E=this.image.getHeight()-1);var C=new ce(A.getX(),E);n?s=C:h=C}return new r(this.image,a,s,f,h)},r.prototype.getMinX=function(){return this.minX},r.prototype.getMaxX=function(){return this.maxX},r.prototype.getMinY=function(){return this.minY},r.prototype.getMaxY=function(){return this.maxY},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getBottomRight=function(){return this.bottomRight},r})(),zc=(function(){function r(e,t,n,a){this.columnCount=e,this.errorCorrectionLevel=a,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}return r.prototype.getColumnCount=function(){return this.columnCount},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},r.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},r})(),_a=(function(){function r(){this.buffer=""}return r.form=function(e,t){var n=-1;function a(f,h,x,g,w,A){if(f==="%%")return"%";if(t[++n]!==void 0){f=g?parseInt(g.substr(1)):void 0;var E=w?parseInt(w.substr(1)):void 0,C;switch(A){case"s":C=t[n];break;case"c":C=t[n][0];break;case"f":C=parseFloat(t[n]).toFixed(f);break;case"p":C=parseFloat(t[n]).toPrecision(f);break;case"e":C=parseFloat(t[n]).toExponential(f);break;case"x":C=parseInt(t[n]).toString(E||16);break;case"d":C=parseFloat(parseInt(t[n],E||10).toPrecision(f)).toFixed(0);break}C=typeof C=="object"?JSON.stringify(C):(+C).toString(E);for(var b=parseInt(x),T=x&&x[0]+""=="0"?"0":" ";C.length<b;)C=h!==void 0?C+T:T+C;return C}}var s=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(s,a)},r.prototype.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.buffer+=r.form(e,t)},r.prototype.toString=function(){return this.buffer},r})(),Yc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n1=(function(){function r(e){this.boundingBox=new ha(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}return r.prototype.getCodewordNearby=function(e){var t=this.getCodeword(e);if(t!=null)return t;for(var n=1;n<r.MAX_NEARBY_DISTANCE;n++){var a=this.imageRowToCodewordIndex(e)-n;if(a>=0&&(t=this.codewords[a],t!=null)||(a=this.imageRowToCodewordIndex(e)+n,a<this.codewords.length&&(t=this.codewords[a],t!=null)))return t}return null},r.prototype.imageRowToCodewordIndex=function(e){return e-this.boundingBox.getMinY()},r.prototype.setCodeword=function(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t},r.prototype.getCodeword=function(e){return this.codewords[this.imageRowToCodewordIndex(e)]},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.getCodewords=function(){return this.codewords},r.prototype.toString=function(){var e,t,n=new _a,a=0;try{for(var s=Yc(this.codewords),f=s.next();!f.done;f=s.next()){var h=f.value;if(h==null){n.format("%3d: | %n",a++);continue}n.format("%3d: %3d|%3d%n",a++,h.getRowNumber(),h.getValue())}}catch(x){e={error:x}}finally{try{f&&!f.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return n.toString()},r.MAX_NEARBY_DISTANCE=5,r})(),Zc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},jc=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),a,s=[],f;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)s.push(a.value)}catch(h){f={error:h}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(f)throw f.error}}return s},kn=(function(){function r(){this.values=new Map}return r.prototype.setValue=function(e){e=Math.trunc(e);var t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)},r.prototype.getValue=function(){var e,t,n=-1,a=new Array,s=function(A,E){var C={getKey:function(){return A},getValue:function(){return E}};C.getValue()>n?(n=C.getValue(),a=[],a.push(C.getKey())):C.getValue()===n&&a.push(C.getKey())};try{for(var f=Zc(this.values.entries()),h=f.next();!h.done;h=f.next()){var x=jc(h.value,2),g=x[0],w=x[1];s(g,w)}}catch(A){e={error:A}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}return Re.toIntArray(a)},r.prototype.getConfidence=function(e){return this.values.get(e)},r})(),Kc=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),ji=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},No=(function(r){Kc(e,r);function e(t,n){var a=r.call(this,t)||this;return a._isLeft=n,a}return e.prototype.setRowNumbers=function(){var t,n;try{for(var a=ji(this.getCodewords()),s=a.next();!s.done;s=a.next()){var f=s.value;f!=null&&f.setRowNumberAsRowIndicatorColumn()}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var n=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(n,t);for(var a=this.getBoundingBox(),s=this._isLeft?a.getTopLeft():a.getTopRight(),f=this._isLeft?a.getBottomLeft():a.getBottomRight(),h=this.imageRowToCodewordIndex(Math.trunc(s.getY())),x=this.imageRowToCodewordIndex(Math.trunc(f.getY())),g=-1,w=1,A=0,E=h;E<x;E++)if(n[E]!=null){var C=n[E],b=C.getRowNumber()-g;if(b===0)A++;else if(b===1)w=Math.max(w,A),A=1,g=C.getRowNumber();else if(b<0||C.getRowNumber()>=t.getRowCount()||b>E)n[E]=null;else{var T=void 0;w>2?T=(w-2)*b:T=b;for(var P=T>=E,F=1;F<=T&&!P;F++)P=n[E-F]!=null;P?n[E]=null:(g=C.getRowNumber(),A=1)}}},e.prototype.getRowHeights=function(){var t,n,a=this.getBarcodeMetadata();if(a==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(a);var s=new Int32Array(a.getRowCount());try{for(var f=ji(this.getCodewords()),h=f.next();!h.done;h=f.next()){var x=h.value;if(x!=null){var g=x.getRowNumber();if(g>=s.length)continue;s[g]++}}}catch(w){t={error:w}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return s},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var n=this.getBoundingBox(),a=this._isLeft?n.getTopLeft():n.getTopRight(),s=this._isLeft?n.getBottomLeft():n.getBottomRight(),f=this.imageRowToCodewordIndex(Math.trunc(a.getY())),h=this.imageRowToCodewordIndex(Math.trunc(s.getY())),x=this.getCodewords(),g=-1,w=f;w<h;w++)if(x[w]!=null){var A=x[w];A.setRowNumberAsRowIndicatorColumn();var E=A.getRowNumber()-g;E===0||(E===1?g=A.getRowNumber():A.getRowNumber()>=t.getRowCount()?x[w]=null:g=A.getRowNumber())}},e.prototype.getBarcodeMetadata=function(){var t,n,a=this.getCodewords(),s=new kn,f=new kn,h=new kn,x=new kn;try{for(var g=ji(a),w=g.next();!w.done;w=g.next()){var A=w.value;if(A!=null){A.setRowNumberAsRowIndicatorColumn();var E=A.getValue()%30,C=A.getRowNumber();switch(this._isLeft||(C+=2),C%3){case 0:f.setValue(E*3+1);break;case 1:x.setValue(E/3),h.setValue(E%3);break;case 2:s.setValue(E+1);break}}}}catch(T){t={error:T}}finally{try{w&&!w.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}if(s.getValue().length===0||f.getValue().length===0||h.getValue().length===0||x.getValue().length===0||s.getValue()[0]<1||f.getValue()[0]+h.getValue()[0]<Re.MIN_ROWS_IN_BARCODE||f.getValue()[0]+h.getValue()[0]>Re.MAX_ROWS_IN_BARCODE)return null;var b=new zc(s.getValue()[0],f.getValue()[0],h.getValue()[0],x.getValue()[0]);return this.removeIncorrectCodewords(a,b),b},e.prototype.removeIncorrectCodewords=function(t,n){for(var a=0;a<t.length;a++){var s=t[a];if(t[a]!=null){var f=s.getValue()%30,h=s.getRowNumber();if(h>n.getRowCount()){t[a]=null;continue}switch(this._isLeft||(h+=2),h%3){case 0:f*3+1!==n.getRowCountUpperPart()&&(t[a]=null);break;case 1:(Math.trunc(f/3)!==n.getErrorCorrectionLevel()||f%3!==n.getRowCountLowerPart())&&(t[a]=null);break;case 2:f+1!==n.getColumnCount()&&(t[a]=null);break}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+`
|
||
`+r.prototype.toString.call(this)},e})(n1),qc=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Qc=(function(){function r(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)}return r.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e=Re.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns},r.prototype.adjustIndicatorColumnRowNumbers=function(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)},r.prototype.adjustRowNumbersAndGetCount=function(){var e=this.adjustRowNumbersByRow();if(e===0)return 0;for(var t=1;t<this.barcodeColumnCount+1;t++)for(var n=this.detectionResultColumns[t].getCodewords(),a=0;a<n.length;a++)n[a]!=null&&(n[a].hasValidRowNumber()||this.adjustRowNumbers(t,a,n));return e},r.prototype.adjustRowNumbersByRow=function(){this.adjustRowNumbersFromBothRI();var e=this.adjustRowNumbersFromLRI();return e+this.adjustRowNumbersFromRRI()},r.prototype.adjustRowNumbersFromBothRI=function(){if(!(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)){for(var e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(var a=1;a<=this.barcodeColumnCount;a++){var s=this.detectionResultColumns[a].getCodewords()[n];s!=null&&(s.setRowNumber(e[n].getRowNumber()),s.hasValidRowNumber()||(this.detectionResultColumns[a].getCodewords()[n]=null))}}},r.prototype.adjustRowNumbersFromRRI=function(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;for(var e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var a=t[n].getRowNumber(),s=0,f=this.barcodeColumnCount+1;f>0&&s<this.ADJUST_ROW_NUMBER_SKIP;f--){var h=this.detectionResultColumns[f].getCodewords()[n];h!=null&&(s=r.adjustRowNumberIfValid(a,s,h),h.hasValidRowNumber()||e++)}return e},r.prototype.adjustRowNumbersFromLRI=function(){if(this.detectionResultColumns[0]==null)return 0;for(var e=0,t=this.detectionResultColumns[0].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var a=t[n].getRowNumber(),s=0,f=1;f<this.barcodeColumnCount+1&&s<this.ADJUST_ROW_NUMBER_SKIP;f++){var h=this.detectionResultColumns[f].getCodewords()[n];h!=null&&(s=r.adjustRowNumberIfValid(a,s,h),h.hasValidRowNumber()||e++)}return e},r.adjustRowNumberIfValid=function(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t},r.prototype.adjustRowNumbers=function(e,t,n){var a,s;if(this.detectionResultColumns[e-1]!=null){var f=n[t],h=this.detectionResultColumns[e-1].getCodewords(),x=h;this.detectionResultColumns[e+1]!=null&&(x=this.detectionResultColumns[e+1].getCodewords());var g=new Array(14);g[2]=h[t],g[3]=x[t],t>0&&(g[0]=n[t-1],g[4]=h[t-1],g[5]=x[t-1]),t>1&&(g[8]=n[t-2],g[10]=h[t-2],g[11]=x[t-2]),t<n.length-1&&(g[1]=n[t+1],g[6]=h[t+1],g[7]=x[t+1]),t<n.length-2&&(g[9]=n[t+2],g[12]=h[t+2],g[13]=x[t+2]);try{for(var w=qc(g),A=w.next();!A.done;A=w.next()){var E=A.value;if(r.adjustRowNumber(f,E))return}}catch(C){a={error:C}}finally{try{A&&!A.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}}},r.adjustRowNumber=function(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1},r.prototype.getBarcodeColumnCount=function(){return this.barcodeColumnCount},r.prototype.getBarcodeRowCount=function(){return this.barcodeMetadata.getRowCount()},r.prototype.getBarcodeECLevel=function(){return this.barcodeMetadata.getErrorCorrectionLevel()},r.prototype.setBoundingBox=function(e){this.boundingBox=e},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.setDetectionResultColumn=function(e,t){this.detectionResultColumns[e]=t},r.prototype.getDetectionResultColumn=function(e){return this.detectionResultColumns[e]},r.prototype.toString=function(){var e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);for(var t=new _a,n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(var a=0;a<this.barcodeColumnCount+2;a++){if(this.detectionResultColumns[a]==null){t.format(" | ");continue}var s=this.detectionResultColumns[a].getCodewords()[n];if(s==null){t.format(" | ");continue}t.format(" %3d|%3d",s.getRowNumber(),s.getValue())}t.format("%n")}return t.toString()},r})(),Jc=(function(){function r(e,t,n,a){this.rowNumber=r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(a)}return r.prototype.hasValidRowNumber=function(){return this.isValidRowNumber(this.rowNumber)},r.prototype.isValidRowNumber=function(e){return e!==r.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3},r.prototype.setRowNumberAsRowIndicatorColumn=function(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))},r.prototype.getWidth=function(){return this.endX-this.startX},r.prototype.getStartX=function(){return this.startX},r.prototype.getEndX=function(){return this.endX},r.prototype.getBucket=function(){return this.bucket},r.prototype.getValue=function(){return this.value},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.setRowNumber=function(e){this.rowNumber=e},r.prototype.toString=function(){return this.rowNumber+"|"+this.value},r.BARCODE_ROW_UNKNOWN=-1,r})(),$c=(function(){function r(){}return r.initialize=function(){for(var e=0;e<Re.SYMBOL_TABLE.length;e++)for(var t=Re.SYMBOL_TABLE[e],n=t&1,a=0;a<Re.BARS_IN_MODULE;a++){for(var s=0;(t&1)===n;)s+=1,t>>=1;n=t&1,r.RATIOS_TABLE[e]||(r.RATIOS_TABLE[e]=new Array(Re.BARS_IN_MODULE)),r.RATIOS_TABLE[e][Re.BARS_IN_MODULE-a-1]=Math.fround(s/Re.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},r.getDecodedValue=function(e){var t=r.getDecodedCodewordValue(r.sampleBitCounts(e));return t!==-1?t:r.getClosestDecodedValue(e)},r.sampleBitCounts=function(e){for(var t=De.sum(e),n=new Int32Array(Re.BARS_IN_MODULE),a=0,s=0,f=0;f<Re.MODULES_IN_CODEWORD;f++){var h=t/(2*Re.MODULES_IN_CODEWORD)+f*t/Re.MODULES_IN_CODEWORD;s+e[a]<=h&&(s+=e[a],a++),n[a]++}return n},r.getDecodedCodewordValue=function(e){var t=r.getBitValue(e);return Re.getCodeword(t)===-1?-1:t},r.getBitValue=function(e){for(var t=0,n=0;n<e.length;n++)for(var a=0;a<e[n];a++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)},r.getClosestDecodedValue=function(e){var t=De.sum(e),n=new Array(Re.BARS_IN_MODULE);if(t>1)for(var a=0;a<n.length;a++)n[a]=Math.fround(e[a]/t);var s=oa.MAX_VALUE,f=-1;this.bSymbolTableReady||r.initialize();for(var h=0;h<r.RATIOS_TABLE.length;h++){for(var x=0,g=r.RATIOS_TABLE[h],w=0;w<Re.BARS_IN_MODULE;w++){var A=Math.fround(g[w]-n[w]);if(x+=Math.fround(A*A),x>=s)break}x<s&&(s=x,f=Re.SYMBOL_TABLE[h])}return f},r.bSymbolTableReady=!1,r.RATIOS_TABLE=new Array(Re.SYMBOL_TABLE.length).map(function(e){return new Array(Re.BARS_IN_MODULE)}),r})(),ef=(function(){function r(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return r.prototype.getSegmentIndex=function(){return this.segmentIndex},r.prototype.setSegmentIndex=function(e){this.segmentIndex=e},r.prototype.getFileId=function(){return this.fileId},r.prototype.setFileId=function(e){this.fileId=e},r.prototype.getOptionalData=function(){return this.optionalData},r.prototype.setOptionalData=function(e){this.optionalData=e},r.prototype.isLastSegment=function(){return this.lastSegment},r.prototype.setLastSegment=function(e){this.lastSegment=e},r.prototype.getSegmentCount=function(){return this.segmentCount},r.prototype.setSegmentCount=function(e){this.segmentCount=e},r.prototype.getSender=function(){return this.sender||null},r.prototype.setSender=function(e){this.sender=e},r.prototype.getAddressee=function(){return this.addressee||null},r.prototype.setAddressee=function(e){this.addressee=e},r.prototype.getFileName=function(){return this.fileName},r.prototype.setFileName=function(e){this.fileName=e},r.prototype.getFileSize=function(){return this.fileSize},r.prototype.setFileSize=function(e){this.fileSize=e},r.prototype.getChecksum=function(){return this.checksum},r.prototype.setChecksum=function(e){this.checksum=e},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.setTimestamp=function(e){this.timestamp=e},r})(),Ro=(function(){function r(){}return r.parseLong=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r})(),tf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),rf=(function(r){tf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="NullPointerException",e})($t),nf=(function(){function r(){}return r.prototype.writeBytes=function(e){this.writeBytesOffset(e,0,e.length)},r.prototype.writeBytesOffset=function(e,t,n){if(e==null)throw new rf;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new wa;if(n===0)return;for(var a=0;a<n;a++)this.write(e[t+a])},r.prototype.flush=function(){},r.prototype.close=function(){},r})(),af=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),of=(function(r){af(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e})($t),sf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),cf=(function(r){sf(e,r);function e(t){t===void 0&&(t=32);var n=r.call(this)||this;if(n.count=0,t<0)throw new xe("Negative initial size: "+t);return n.buf=new Uint8Array(t),n}return e.prototype.ensureCapacity=function(t){t-this.buf.length>0&&this.grow(t)},e.prototype.grow=function(t){var n=this.buf.length,a=n<<1;if(a-t<0&&(a=t),a<0){if(t<0)throw new of;a=Ie.MAX_VALUE}this.buf=pt.copyOfUint8Array(this.buf,a)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,n,a){if(n<0||n>t.length||a<0||n+a-t.length>0)throw new wa;this.ensureCapacity(this.count+a),Ke.arraycopy(t,n,this.buf,this.count,a),this.count+=a},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return pt.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?typeof t=="string"?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e})(nf),Xe;(function(r){r[r.ALPHA=0]="ALPHA",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.PUNCT=3]="PUNCT",r[r.ALPHA_SHIFT=4]="ALPHA_SHIFT",r[r.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(Xe||(Xe={}));function i1(){if(typeof window<"u")return window.BigInt||null;if(typeof ja<"u")return ja.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}var ii;function Hr(r){if(typeof ii>"u"&&(ii=i1()),ii===null)throw new Error("BigInt is not supported!");return ii(r)}function ff(){var r=[];r[0]=Hr(1);var e=Hr(900);r[1]=e;for(var t=2;t<16;t++)r[t]=r[t-1]*e;return r}var uf=(function(){function r(){}return r.decode=function(e,t){var n=new Ce(""),a=gt.ISO8859_1;n.enableDecoding(a);for(var s=1,f=e[s++],h=new ef;s<e[0];){switch(f){case r.TEXT_COMPACTION_MODE_LATCH:s=r.textCompaction(e,s,n);break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:s=r.byteCompaction(f,e,a,s,n);break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[s++]);break;case r.NUMERIC_COMPACTION_MODE_LATCH:s=r.numericCompaction(e,s,n);break;case r.ECI_CHARSET:gt.getCharacterSetECIByValue(e[s++]);break;case r.ECI_GENERAL_PURPOSE:s+=2;break;case r.ECI_USER_DEFINED:s++;break;case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:s=r.decodeMacroBlock(e,s,h);break;case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:throw new re;default:s--,s=r.textCompaction(e,s,n);break}if(s<e.length)f=e[s++];else throw re.getFormatInstance()}if(n.length()===0)throw re.getFormatInstance();var x=new Ai(null,n.toString(),null,t);return x.setOther(h),x},r.decodeMacroBlock=function(e,t,n){if(t+r.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw re.getFormatInstance();for(var a=new Int32Array(r.NUMBER_OF_SEQUENCE_CODEWORDS),s=0;s<r.NUMBER_OF_SEQUENCE_CODEWORDS;s++,t++)a[s]=e[t];n.setSegmentIndex(Ie.parseInt(r.decodeBase900toBase10(a,r.NUMBER_OF_SEQUENCE_CODEWORDS)));var f=new Ce;t=r.textCompaction(e,t,f),n.setFileId(f.toString());var h=-1;for(e[t]===r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(h=t+1);t<e[0];)switch(e[t]){case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:var x=new Ce;t=r.textCompaction(e,t+1,x),n.setFileName(x.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SENDER:var g=new Ce;t=r.textCompaction(e,t+1,g),n.setSender(g.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:var w=new Ce;t=r.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:var A=new Ce;t=r.numericCompaction(e,t+1,A),n.setSegmentCount(Ie.parseInt(A.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:var E=new Ce;t=r.numericCompaction(e,t+1,E),n.setTimestamp(Ro.parseLong(E.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:var C=new Ce;t=r.numericCompaction(e,t+1,C),n.setChecksum(Ie.parseInt(C.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:var b=new Ce;t=r.numericCompaction(e,t+1,b),n.setFileSize(Ro.parseLong(b.toString()));break;default:throw re.getFormatInstance()}break;case r.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw re.getFormatInstance()}if(h!==-1){var T=t-h;n.isLastSegment()&&T--,n.setOptionalData(pt.copyOfRange(e,h,h+T))}return t},r.textCompaction=function(e,t,n){for(var a=new Int32Array((e[0]-t)*2),s=new Int32Array((e[0]-t)*2),f=0,h=!1;t<e[0]&&!h;){var x=e[t++];if(x<r.TEXT_COMPACTION_MODE_LATCH)a[f]=x/30,a[f+1]=x%30,f+=2;else switch(x){case r.TEXT_COMPACTION_MODE_LATCH:a[f++]=r.TEXT_COMPACTION_MODE_LATCH;break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a[f]=r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,x=e[t++],s[f]=x,f++;break}}return r.decodeTextCompaction(a,s,f,n),t},r.decodeTextCompaction=function(e,t,n,a){for(var s=Xe.ALPHA,f=Xe.ALPHA,h=0;h<n;){var x=e[h],g="";switch(s){case Xe.ALPHA:if(x<26)g=String.fromCharCode(65+x);else switch(x){case 26:g=" ";break;case r.LL:s=Xe.LOWER;break;case r.ML:s=Xe.MIXED;break;case r.PS:f=s,s=Xe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(t[h]);break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break;case Xe.LOWER:if(x<26)g=String.fromCharCode(97+x);else switch(x){case 26:g=" ";break;case r.AS:f=s,s=Xe.ALPHA_SHIFT;break;case r.ML:s=Xe.MIXED;break;case r.PS:f=s,s=Xe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(t[h]);break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break;case Xe.MIXED:if(x<r.PL)g=r.MIXED_CHARS[x];else switch(x){case r.PL:s=Xe.PUNCT;break;case 26:g=" ";break;case r.LL:s=Xe.LOWER;break;case r.AL:s=Xe.ALPHA;break;case r.PS:f=s,s=Xe.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(t[h]);break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break;case Xe.PUNCT:if(x<r.PAL)g=r.PUNCT_CHARS[x];else switch(x){case r.PAL:s=Xe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(t[h]);break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break;case Xe.ALPHA_SHIFT:if(s=f,x<26)g=String.fromCharCode(65+x);else switch(x){case 26:g=" ";break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break;case Xe.PUNCT_SHIFT:if(s=f,x<r.PAL)g=r.PUNCT_CHARS[x];else switch(x){case r.PAL:s=Xe.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:a.append(t[h]);break;case r.TEXT_COMPACTION_MODE_LATCH:s=Xe.ALPHA;break}break}g!==""&&a.append(g),h++}},r.byteCompaction=function(e,t,n,a,s){var f=new cf,h=0,x=0,g=!1;switch(e){case r.BYTE_COMPACTION_MODE_LATCH:for(var w=new Int32Array(6),A=t[a++];a<t[0]&&!g;)switch(w[h++]=A,x=900*x+A,A=t[a++],A){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:a--,g=!0;break;default:if(h%5===0&&h>0){for(var E=0;E<6;++E)f.write(Number(Hr(x)>>Hr(8*(5-E))));x=0,h=0}break}a===t[0]&&A<r.TEXT_COMPACTION_MODE_LATCH&&(w[h++]=A);for(var C=0;C<h;C++)f.write(w[C]);break;case r.BYTE_COMPACTION_MODE_LATCH_6:for(;a<t[0]&&!g;){var b=t[a++];if(b<r.TEXT_COMPACTION_MODE_LATCH)h++,x=900*x+b;else switch(b){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:a--,g=!0;break}if(h%5===0&&h>0){for(var E=0;E<6;++E)f.write(Number(Hr(x)>>Hr(8*(5-E))));x=0,h=0}}break}return s.append(lr.decode(f.toByteArray(),n)),a},r.numericCompaction=function(e,t,n){for(var a=0,s=!1,f=new Int32Array(r.MAX_NUMERIC_CODEWORDS);t<e[0]&&!s;){var h=e[t++];if(t===e[0]&&(s=!0),h<r.TEXT_COMPACTION_MODE_LATCH)f[a]=h,a++;else switch(h){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,s=!0;break}(a%r.MAX_NUMERIC_CODEWORDS===0||h===r.NUMERIC_COMPACTION_MODE_LATCH||s)&&a>0&&(n.append(r.decodeBase900toBase10(f,a)),a=0)}return t},r.decodeBase900toBase10=function(e,t){for(var n=Hr(0),a=0;a<t;a++)n+=r.EXP900[t-a-1]*Hr(e[a]);var s=n.toString();if(s.charAt(0)!=="1")throw new re;return s.substring(1)},r.TEXT_COMPACTION_MODE_LATCH=900,r.BYTE_COMPACTION_MODE_LATCH=901,r.NUMERIC_COMPACTION_MODE_LATCH=902,r.BYTE_COMPACTION_MODE_LATCH_6=924,r.ECI_USER_DEFINED=925,r.ECI_GENERAL_PURPOSE=926,r.ECI_CHARSET=927,r.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,r.MACRO_PDF417_TERMINATOR=922,r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,r.MAX_NUMERIC_CODEWORDS=15,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,r.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,r.PL=25,r.LL=27,r.AS=27,r.ML=28,r.AL=28,r.PS=29,r.PAL=29,r.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
||
-.$/"|*()?{}'`,r.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",r.EXP900=i1()?ff():[],r.NUMBER_OF_SEQUENCE_CODEWORDS=2,r})(),Mn=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},lf=(function(){function r(){}return r.decode=function(e,t,n,a,s,f,h){for(var x=new ha(e,t,n,a,s),g=null,w=null,A,E=!0;;E=!1){if(t!=null&&(g=r.getRowIndicatorColumn(e,x,t,!0,f,h)),a!=null&&(w=r.getRowIndicatorColumn(e,x,a,!1,f,h)),A=r.merge(g,w),A==null)throw j.getNotFoundInstance();var C=A.getBoundingBox();if(E&&C!=null&&(C.getMinY()<x.getMinY()||C.getMaxY()>x.getMaxY()))x=C;else break}A.setBoundingBox(x);var b=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,g),A.setDetectionResultColumn(b,w);for(var T=g!=null,P=1;P<=b;P++){var F=T?P:b-P;if(A.getDetectionResultColumn(F)===void 0){var D=void 0;F===0||F===b?D=new No(x,F===0):D=new n1(x),A.setDetectionResultColumn(F,D);for(var L=-1,k=L,q=x.getMinY();q<=x.getMaxY();q++){if(L=r.getStartColumn(A,F,q,T),L<0||L>x.getMaxX()){if(k===-1)continue;L=k}var K=r.detectCodeword(e,x.getMinX(),x.getMaxX(),T,L,q,f,h);K!=null&&(D.setCodeword(q,K),k=L,f=Math.min(f,K.getWidth()),h=Math.max(h,K.getWidth()))}}}return r.createDecoderResult(A)},r.merge=function(e,t){if(e==null&&t==null)return null;var n=r.getBarcodeMetadata(e,t);if(n==null)return null;var a=ha.merge(r.adjustBoundingBox(e),r.adjustBoundingBox(t));return new Qc(n,a)},r.adjustBoundingBox=function(e){var t,n;if(e==null)return null;var a=e.getRowHeights();if(a==null)return null;var s=r.getMax(a),f=0;try{for(var h=Mn(a),x=h.next();!x.done;x=h.next()){var g=x.value;if(f+=s-g,g>0)break}}catch(C){t={error:C}}finally{try{x&&!x.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}for(var w=e.getCodewords(),A=0;f>0&&w[A]==null;A++)f--;for(var E=0,A=a.length-1;A>=0&&(E+=s-a[A],!(a[A]>0));A--);for(var A=w.length-1;E>0&&w[A]==null;A--)E--;return e.getBoundingBox().addMissingRows(f,E,e.isLeft())},r.getMax=function(e){var t,n,a=-1;try{for(var s=Mn(e),f=s.next();!f.done;f=s.next()){var h=f.value;a=Math.max(a,h)}}catch(x){t={error:x}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},r.getBarcodeMetadata=function(e,t){var n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();var a;return t==null||(a=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==a.getColumnCount()&&n.getErrorCorrectionLevel()!==a.getErrorCorrectionLevel()&&n.getRowCount()!==a.getRowCount()?null:n},r.getRowIndicatorColumn=function(e,t,n,a,s,f){for(var h=new No(t,a),x=0;x<2;x++)for(var g=x===0?1:-1,w=Math.trunc(Math.trunc(n.getX())),A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=g){var E=r.detectCodeword(e,0,e.getWidth(),a,w,A,s,f);E!=null&&(h.setCodeword(A,E),a?w=E.getStartX():w=E.getEndX())}return h},r.adjustCodewordCount=function(e,t){var n=t[0][1],a=n.getValue(),s=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-r.getNumberOfECCodeWords(e.getBarcodeECLevel());if(a.length===0){if(s<1||s>Re.MAX_CODEWORDS_IN_BARCODE)throw j.getNotFoundInstance();n.setValue(s)}else a[0]!==s&&n.setValue(s)},r.createDecoderResult=function(e){var t=r.createBarcodeMatrix(e);r.adjustCodewordCount(e,t);for(var n=new Array,a=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),s=[],f=new Array,h=0;h<e.getBarcodeRowCount();h++)for(var x=0;x<e.getBarcodeColumnCount();x++){var g=t[h][x+1].getValue(),w=h*e.getBarcodeColumnCount()+x;g.length===0?n.push(w):g.length===1?a[w]=g[0]:(f.push(w),s.push(g))}for(var A=new Array(s.length),E=0;E<A.length;E++)A[E]=s[E];return r.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),a,Re.toIntArray(n),Re.toIntArray(f),A)},r.createDecoderResultFromAmbiguousValues=function(e,t,n,a,s){for(var f=new Int32Array(a.length),h=100;h-- >0;){for(var x=0;x<f.length;x++)t[a[x]]=s[x][f[x]];try{return r.decodeCodewords(t,e,n)}catch(w){var g=w instanceof _t;if(!g)throw w}if(f.length===0)throw _t.getChecksumInstance();for(var x=0;x<f.length;x++)if(f[x]<s[x].length-1){f[x]++;break}else if(f[x]=0,x===f.length-1)throw _t.getChecksumInstance()}throw _t.getChecksumInstance()},r.createBarcodeMatrix=function(e){for(var t,n,a,s,f=Array.from({length:e.getBarcodeRowCount()},function(){return new Array(e.getBarcodeColumnCount()+2)}),h=0;h<f.length;h++)for(var x=0;x<f[h].length;x++)f[h][x]=new kn;var g=0;try{for(var w=Mn(e.getDetectionResultColumns()),A=w.next();!A.done;A=w.next()){var E=A.value;if(E!=null)try{for(var C=(a=void 0,Mn(E.getCodewords())),b=C.next();!b.done;b=C.next()){var T=b.value;if(T!=null){var P=T.getRowNumber();if(P>=0){if(P>=f.length)continue;f[P][g].setValue(T.getValue())}}}}catch(F){a={error:F}}finally{try{b&&!b.done&&(s=C.return)&&s.call(C)}finally{if(a)throw a.error}}g++}}catch(F){t={error:F}}finally{try{A&&!A.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}return f},r.isValidBarcodeColumn=function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1},r.getStartColumn=function(e,t,n,a){var s,f,h=a?1:-1,x=null;if(r.isValidBarcodeColumn(e,t-h)&&(x=e.getDetectionResultColumn(t-h).getCodeword(n)),x!=null)return a?x.getEndX():x.getStartX();if(x=e.getDetectionResultColumn(t).getCodewordNearby(n),x!=null)return a?x.getStartX():x.getEndX();if(r.isValidBarcodeColumn(e,t-h)&&(x=e.getDetectionResultColumn(t-h).getCodewordNearby(n)),x!=null)return a?x.getEndX():x.getStartX();for(var g=0;r.isValidBarcodeColumn(e,t-h);){t-=h;try{for(var w=(s=void 0,Mn(e.getDetectionResultColumn(t).getCodewords())),A=w.next();!A.done;A=w.next()){var E=A.value;if(E!=null)return(a?E.getEndX():E.getStartX())+h*g*(E.getEndX()-E.getStartX())}}catch(C){s={error:C}}finally{try{A&&!A.done&&(f=w.return)&&f.call(w)}finally{if(s)throw s.error}}g++}return a?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},r.detectCodeword=function(e,t,n,a,s,f,h,x){s=r.adjustCodewordStartColumn(e,t,n,a,s,f);var g=r.getModuleBitCount(e,t,n,a,s,f);if(g==null)return null;var w,A=De.sum(g);if(a)w=s+A;else{for(var E=0;E<g.length/2;E++){var C=g[E];g[E]=g[g.length-1-E],g[g.length-1-E]=C}w=s,s=w-A}if(!r.checkCodewordSkew(A,h,x))return null;var b=$c.getDecodedValue(g),T=Re.getCodeword(b);return T===-1?null:new Jc(s,w,r.getCodewordBucketNumber(b),T)},r.getModuleBitCount=function(e,t,n,a,s,f){for(var h=s,x=new Int32Array(8),g=0,w=a?1:-1,A=a;(a?h<n:h>=t)&&g<x.length;)e.get(h,f)===A?(x[g]++,h+=w):(g++,A=!A);return g===x.length||h===(a?n:t)&&g===x.length-1?x:null},r.getNumberOfECCodeWords=function(e){return 2<<e},r.adjustCodewordStartColumn=function(e,t,n,a,s,f){for(var h=s,x=a?-1:1,g=0;g<2;g++){for(;(a?h>=t:h<n)&&a===e.get(h,f);){if(Math.abs(s-h)>r.CODEWORD_SKEW_SIZE)return s;h+=x}x=-x,a=!a}return h},r.checkCodewordSkew=function(e,t,n){return t-r.CODEWORD_SKEW_SIZE<=e&&e<=n+r.CODEWORD_SKEW_SIZE},r.decodeCodewords=function(e,t,n){if(e.length===0)throw re.getFormatInstance();var a=1<<t+1,s=r.correctErrors(e,n,a);r.verifyCodewordCount(e,a);var f=uf.decode(e,""+t);return f.setErrorsCorrected(s),f.setErasures(n.length),f},r.correctErrors=function(e,t,n){if(t!=null&&t.length>n/2+r.MAX_ERRORS||n<0||n>r.MAX_EC_CODEWORDS)throw _t.getChecksumInstance();return r.errorCorrection.decode(e,n,t)},r.verifyCodewordCount=function(e,t){if(e.length<4)throw re.getFormatInstance();var n=e[0];if(n>e.length)throw re.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw re.getFormatInstance()},r.getBitCountForCodeword=function(e){for(var t=new Int32Array(8),n=0,a=t.length-1;!((e&1)!==n&&(n=e&1,a--,a<0));)t[a]++,e>>=1;return t},r.getCodewordBucketNumber=function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)},r.getCodewordBucketNumber_number=function(e){return r.getCodewordBucketNumber(r.getBitCountForCodeword(e))},r.getCodewordBucketNumber_Int32Array=function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9},r.toString=function(e){for(var t=new _a,n=0;n<e.length;n++){t.format("Row %2d: ",n);for(var a=0;a<e[n].length;a++){var s=e[n][a];s.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",s.getValue()[0],s.getConfidence(s.getValue()[0]))}t.format("%n")}return t.toString()},r.CODEWORD_SKEW_SIZE=2,r.MAX_ERRORS=3,r.MAX_EC_CODEWORDS=512,r.errorCorrection=new Wc,r})(),hf=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},da=(function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=r.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw j.getNotFoundInstance();return n[0]},r.prototype.decodeMultiple=function(e,t){t===void 0&&(t=null);try{return r.decode(e,t,!0)}catch(n){throw n instanceof re||n instanceof _t?j.getNotFoundInstance():n}},r.decode=function(e,t,n){var a,s,f=new Array,h=kc.detectMultiple(e,t,n);try{for(var x=hf(h.getPoints()),g=x.next();!g.done;g=x.next()){var w=g.value,A=lf.decode(h.getBits(),w[4],w[5],w[6],w[7],r.getMinCodewordWidth(w),r.getMaxCodewordWidth(w)),E=new Bt(A.getText(),A.getRawBytes(),void 0,w,se.PDF_417);E.putMetadata(Rt.ERROR_CORRECTION_LEVEL,A.getECLevel());var C=A.getOther();C!=null&&E.putMetadata(Rt.PDF417_EXTRA_METADATA,C),f.push(E)}}catch(b){a={error:b}}finally{try{g&&!g.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}return f.map(function(b){return b})},r.getMaxWidth=function(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMinWidth=function(e,t){return e==null||t==null?Ie.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(r.getMaxWidth(e[0],e[4]),r.getMaxWidth(e[6],e[2])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN),Math.max(r.getMaxWidth(e[1],e[5]),r.getMaxWidth(e[7],e[3])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN)))},r.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(r.getMinWidth(e[0],e[4]),r.getMinWidth(e[6],e[2])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN),Math.min(r.getMinWidth(e[1],e[5]),r.getMinWidth(e[7],e[3])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN)))},r.prototype.reset=function(){},r})(),df=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Do=(function(r){df(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReaderException",e})($t),Mo=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},xf=(function(){function r(){}return r.prototype.decode=function(e,t){return this.setHints(t),this.decodeInternal(e)},r.prototype.decodeWithState=function(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)},r.prototype.setHints=function(e){this.hints=e;var t=e!=null&&e.get(tt.TRY_HARDER)!==void 0,n=e==null?null:e.get(tt.POSSIBLE_FORMATS),a=new Array;if(n!=null){var s=n.some(function(f){return f===se.UPC_A||f===se.UPC_E||f===se.EAN_13||f===se.EAN_8||f===se.CODABAR||f===se.CODE_39||f===se.CODE_93||f===se.CODE_128||f===se.ITF||f===se.RSS_14||f===se.RSS_EXPANDED});s&&!t&&a.push(new Fn(e)),n.includes(se.QR_CODE)&&a.push(new la),n.includes(se.DATA_MATRIX)&&a.push(new ua),n.includes(se.AZTEC)&&a.push(new ca),n.includes(se.PDF_417)&&a.push(new da),s&&t&&a.push(new Fn(e))}a.length===0&&(t||a.push(new Fn(e)),a.push(new la),a.push(new ua),a.push(new ca),a.push(new da),t&&a.push(new Fn(e))),this.readers=a},r.prototype.reset=function(){var e,t;if(this.readers!==null)try{for(var n=Mo(this.readers),a=n.next();!a.done;a=n.next()){var s=a.value;s.reset()}}catch(f){e={error:f}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.decodeInternal=function(e){var t,n;if(this.readers===null)throw new Do("No readers where selected, nothing can be read.");try{for(var a=Mo(this.readers),s=a.next();!s.done;s=a.next()){var f=s.value;try{return f.decode(e,this.hints)}catch(h){if(h instanceof Do)continue}}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}throw new j("No MultiFormat Readers were able to detect the code.")},r})(),gf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),pf=(function(r){gf(e,r);function e(t,n){t===void 0&&(t=null),n===void 0&&(n=500);var a=this,s=new xf;return s.setHints(t),a=r.call(this,s,n)||this,a}return e.prototype.decodeBitmap=function(t){return this.reader.decodeWithState(t)},e})(An),vf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){vf(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new da,t)||this}return e})(An);var wf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){wf(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new la,t)||this}return e})(An);var xa;(function(r){r[r.ERROR_CORRECTION=0]="ERROR_CORRECTION",r[r.CHARACTER_SET=1]="CHARACTER_SET",r[r.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",r[r.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",r[r.MIN_SIZE=4]="MIN_SIZE",r[r.MAX_SIZE=5]="MAX_SIZE",r[r.MARGIN=6]="MARGIN",r[r.PDF417_COMPACT=7]="PDF417_COMPACT",r[r.PDF417_COMPACTION=8]="PDF417_COMPACTION",r[r.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",r[r.AZTEC_LAYERS=10]="AZTEC_LAYERS",r[r.QR_VERSION=11]="QR_VERSION",r[r.GS1_FORMAT=12]="GS1_FORMAT",r[r.FORCE_C40=13]="FORCE_C40"})(xa||(xa={}));const ai=xa;var a1=(function(){function r(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Gr(e,Int32Array.from([1])))}return r.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],a=this.field,s=t.length;s<=e;s++){var f=n.multiply(new Gr(a,Int32Array.from([1,a.exp(s-1+a.getGeneratorBase())])));t.push(f),n=f}return t[e]},r.prototype.encode=function(e,t){if(t===0)throw new xe("No error correction bytes");var n=e.length-t;if(n<=0)throw new xe("No data bytes provided");var a=this.buildGenerator(t),s=new Int32Array(n);Ke.arraycopy(e,0,s,0,n);var f=new Gr(this.field,s);f=f.multiplyByMonomial(t,1);for(var h=f.divide(a)[1],x=h.getCoefficients(),g=t-x.length,w=0;w<g;w++)e[n+w]=0;Ke.arraycopy(x,0,e,n+g,x.length)},r})(),Un=(function(){function r(){}return r.applyMaskPenaltyRule1=function(e){return r.applyMaskPenaltyRule1Internal(e,!0)+r.applyMaskPenaltyRule1Internal(e,!1)},r.applyMaskPenaltyRule2=function(e){for(var t=0,n=e.getArray(),a=e.getWidth(),s=e.getHeight(),f=0;f<s-1;f++)for(var h=n[f],x=0;x<a-1;x++){var g=h[x];g===h[x+1]&&g===n[f+1][x]&&g===n[f+1][x+1]&&t++}return r.N2*t},r.applyMaskPenaltyRule3=function(e){for(var t=0,n=e.getArray(),a=e.getWidth(),s=e.getHeight(),f=0;f<s;f++)for(var h=0;h<a;h++){var x=n[f];h+6<a&&x[h]===1&&x[h+1]===0&&x[h+2]===1&&x[h+3]===1&&x[h+4]===1&&x[h+5]===0&&x[h+6]===1&&(r.isWhiteHorizontal(x,h-4,h)||r.isWhiteHorizontal(x,h+7,h+11))&&t++,f+6<s&&n[f][h]===1&&n[f+1][h]===0&&n[f+2][h]===1&&n[f+3][h]===1&&n[f+4][h]===1&&n[f+5][h]===0&&n[f+6][h]===1&&(r.isWhiteVertical(n,h,f-4,f)||r.isWhiteVertical(n,h,f+7,f+11))&&t++}return t*r.N3},r.isWhiteHorizontal=function(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(var a=t;a<n;a++)if(e[a]===1)return!1;return!0},r.isWhiteVertical=function(e,t,n,a){n=Math.max(n,0),a=Math.min(a,e.length);for(var s=n;s<a;s++)if(e[s][t]===1)return!1;return!0},r.applyMaskPenaltyRule4=function(e){for(var t=0,n=e.getArray(),a=e.getWidth(),s=e.getHeight(),f=0;f<s;f++)for(var h=n[f],x=0;x<a;x++)h[x]===1&&t++;var g=e.getHeight()*e.getWidth(),w=Math.floor(Math.abs(t*2-g)*10/g);return w*r.N4},r.getDataMaskBit=function(e,t,n){var a,s;switch(e){case 0:a=n+t&1;break;case 1:a=n&1;break;case 2:a=t%3;break;case 3:a=(n+t)%3;break;case 4:a=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:s=n*t,a=(s&1)+s%3;break;case 6:s=n*t,a=(s&1)+s%3&1;break;case 7:s=n*t,a=s%3+(n+t&1)&1;break;default:throw new xe("Invalid mask pattern: "+e)}return a===0},r.applyMaskPenaltyRule1Internal=function(e,t){for(var n=0,a=t?e.getHeight():e.getWidth(),s=t?e.getWidth():e.getHeight(),f=e.getArray(),h=0;h<a;h++){for(var x=0,g=-1,w=0;w<s;w++){var A=t?f[h][w]:f[w][h];A===g?x++:(x>=5&&(n+=r.N1+(x-5)),x=1,g=A)}x>=5&&(n+=r.N1+(x-5))}return n},r.N1=3,r.N2=3,r.N3=40,r.N4=10,r})(),Af=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},yf=(function(){function r(e,t){this.width=e,this.height=t;for(var n=new Array(t),a=0;a!==t;a++)n[a]=new Uint8Array(e);this.bytes=n}return r.prototype.getHeight=function(){return this.height},r.prototype.getWidth=function(){return this.width},r.prototype.get=function(e,t){return this.bytes[t][e]},r.prototype.getArray=function(){return this.bytes},r.prototype.setNumber=function(e,t,n){this.bytes[t][e]=n},r.prototype.setBoolean=function(e,t,n){this.bytes[t][e]=n?1:0},r.prototype.clear=function(e){var t,n;try{for(var a=Af(this.bytes),s=a.next();!s.done;s=a.next()){var f=s.value;pt.fill(f,e)}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(var n=0,a=this.height;n<a;++n)for(var s=this.bytes[n],f=t.bytes[n],h=0,x=this.width;h<x;++h)if(s[h]!==f[h])return!1;return!0},r.prototype.toString=function(){for(var e=new Ce,t=0,n=this.height;t<n;++t){for(var a=this.bytes[t],s=0,f=this.width;s<f;++s)switch(a[s]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
||
`)}return e.toString()},r})(),ga=(function(){function r(){this.maskPattern=-1}return r.prototype.getMode=function(){return this.mode},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getVersion=function(){return this.version},r.prototype.getMaskPattern=function(){return this.maskPattern},r.prototype.getMatrix=function(){return this.matrix},r.prototype.toString=function(){var e=new Ce;return e.append(`<<
|
||
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
||
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
||
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
||
maskPattern: `),e.append(this.maskPattern.toString()),this.matrix?(e.append(`
|
||
matrix:
|
||
`),e.append(this.matrix.toString())):e.append(`
|
||
matrix: null
|
||
`),e.append(`>>
|
||
`),e.toString()},r.prototype.setMode=function(e){this.mode=e},r.prototype.setECLevel=function(e){this.ecLevel=e},r.prototype.setVersion=function(e){this.version=e},r.prototype.setMaskPattern=function(e){this.maskPattern=e},r.prototype.setMatrix=function(e){this.matrix=e},r.isValidMaskPattern=function(e){return e>=0&&e<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,r})(),Ef=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Je=(function(r){Ef(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="WriterException",e})($t),Po=(function(){function r(){}return r.clearMatrix=function(e){e.clear(255)},r.buildMatrix=function(e,t,n,a,s){r.clearMatrix(s),r.embedBasicPatterns(n,s),r.embedTypeInfo(t,a,s),r.maybeEmbedVersionInfo(n,s),r.embedDataBits(e,a,s)},r.embedBasicPatterns=function(e,t){r.embedPositionDetectionPatternsAndSeparators(t),r.embedDarkDotAtLeftBottomCorner(t),r.maybeEmbedPositionAdjustmentPatterns(e,t),r.embedTimingPatterns(t)},r.embedTypeInfo=function(e,t,n){var a=new mt;r.makeTypeInfoBits(e,t,a);for(var s=0,f=a.getSize();s<f;++s){var h=a.get(a.getSize()-1-s),x=r.TYPE_INFO_COORDINATES[s],g=x[0],w=x[1];if(n.setBoolean(g,w,h),s<8){var A=n.getWidth()-s-1,E=8;n.setBoolean(A,E,h)}else{var A=8,E=n.getHeight()-7+(s-8);n.setBoolean(A,E,h)}}},r.maybeEmbedVersionInfo=function(e,t){if(!(e.getVersionNumber()<7)){var n=new mt;r.makeVersionInfoBits(e,n);for(var a=17,s=0;s<6;++s)for(var f=0;f<3;++f){var h=n.get(a);a--,t.setBoolean(s,t.getHeight()-11+f,h),t.setBoolean(t.getHeight()-11+f,s,h)}}},r.embedDataBits=function(e,t,n){for(var a=0,s=-1,f=n.getWidth()-1,h=n.getHeight()-1;f>0;){for(f===6&&(f-=1);h>=0&&h<n.getHeight();){for(var x=0;x<2;++x){var g=f-x;if(r.isEmpty(n.get(g,h))){var w=void 0;a<e.getSize()?(w=e.get(a),++a):w=!1,t!==255&&Un.getDataMaskBit(t,g,h)&&(w=!w),n.setBoolean(g,h,w)}}h+=s}s=-s,h+=s,f-=2}if(a!==e.getSize())throw new Je("Not all bits consumed: "+a+"/"+e.getSize())},r.findMSBSet=function(e){return 32-Ie.numberOfLeadingZeros(e)},r.calculateBCHCode=function(e,t){if(t===0)throw new xe("0 polynomial");var n=r.findMSBSet(t);for(e<<=n-1;r.findMSBSet(e)>=n;)e^=t<<r.findMSBSet(e)-n;return e},r.makeTypeInfoBits=function(e,t,n){if(!ga.isValidMaskPattern(t))throw new Je("Invalid mask pattern");var a=e.getBits()<<3|t;n.appendBits(a,5);var s=r.calculateBCHCode(a,r.TYPE_INFO_POLY);n.appendBits(s,10);var f=new mt;if(f.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(f),n.getSize()!==15)throw new Je("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(e,t){t.appendBits(e.getVersionNumber(),6);var n=r.calculateBCHCode(e.getVersionNumber(),r.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new Je("should not happen but we got: "+t.getSize())},r.isEmpty=function(e){return e===255},r.embedTimingPatterns=function(e){for(var t=8;t<e.getWidth()-8;++t){var n=(t+1)%2;r.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),r.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}},r.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new Je;e.setNumber(8,e.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(e,t,n){for(var a=0;a<8;++a){if(!r.isEmpty(n.get(e+a,t)))throw new Je;n.setNumber(e+a,t,0)}},r.embedVerticalSeparationPattern=function(e,t,n){for(var a=0;a<7;++a){if(!r.isEmpty(n.get(e,t+a)))throw new Je;n.setNumber(e,t+a,0)}},r.embedPositionAdjustmentPattern=function(e,t,n){for(var a=0;a<5;++a)for(var s=r.POSITION_ADJUSTMENT_PATTERN[a],f=0;f<5;++f)n.setNumber(e+f,t+a,s[f])},r.embedPositionDetectionPattern=function(e,t,n){for(var a=0;a<7;++a)for(var s=r.POSITION_DETECTION_PATTERN[a],f=0;f<7;++f)n.setNumber(e+f,t+a,s[f])},r.embedPositionDetectionPatternsAndSeparators=function(e){var t=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,e),r.embedPositionDetectionPattern(e.getWidth()-t,0,e),r.embedPositionDetectionPattern(0,e.getWidth()-t,e);var n=8;r.embedHorizontalSeparationPattern(0,n-1,e),r.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),r.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);var a=7;r.embedVerticalSeparationPattern(a,0,e),r.embedVerticalSeparationPattern(e.getHeight()-a-1,0,e),r.embedVerticalSeparationPattern(a,e.getHeight()-a,e)},r.maybeEmbedPositionAdjustmentPatterns=function(e,t){if(!(e.getVersionNumber()<2))for(var n=e.getVersionNumber()-1,a=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],s=0,f=a.length;s!==f;s++){var h=a[s];if(h>=0)for(var x=0;x!==f;x++){var g=a[x];g>=0&&r.isEmpty(t.get(g,h))&&r.embedPositionAdjustmentPattern(g-2,h-2,t)}}},r.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])]),r.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])]),r.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])]),r.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])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r})(),Cf=(function(){function r(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r})(),Bo=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.calculateMaskPenalty=function(e){return Un.applyMaskPenaltyRule1(e)+Un.applyMaskPenaltyRule2(e)+Un.applyMaskPenaltyRule3(e)+Un.applyMaskPenaltyRule4(e)},r.encode=function(e,t,n){n===void 0&&(n=null);var a=r.DEFAULT_BYTE_MODE_ENCODING,s=n!==null&&n.get(ai.CHARACTER_SET)!==void 0;s&&(a=n.get(ai.CHARACTER_SET).toString());var f=this.chooseMode(e,a),h=new mt;if(f===$e.BYTE&&(s||r.DEFAULT_BYTE_MODE_ENCODING!==a)){var x=gt.getCharacterSetECIByName(a);x!==void 0&&this.appendECI(x,h)}this.appendModeInfo(f,h);var g=new mt;this.appendBytes(e,f,g,a);var w;if(n!==null&&n.get(ai.QR_VERSION)!==void 0){var A=Number.parseInt(n.get(ai.QR_VERSION).toString(),10);w=rn.getVersionForNumber(A);var E=this.calculateBitsNeeded(f,h,g,w);if(!this.willFit(E,w,t))throw new Je("Data too big for requested version")}else w=this.recommendVersion(t,f,h,g);var C=new mt;C.appendBitArray(h);var b=f===$e.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(b,w,f,C),C.appendBitArray(g);var T=w.getECBlocksForLevel(t),P=w.getTotalCodewords()-T.getTotalECCodewords();this.terminateBits(P,C);var F=this.interleaveWithECBytes(C,w.getTotalCodewords(),P,T.getNumBlocks()),D=new ga;D.setECLevel(t),D.setMode(f),D.setVersion(w);var L=w.getDimensionForVersion(),k=new yf(L,L),q=this.chooseMaskPattern(F,t,w,k);return D.setMaskPattern(q),Po.buildMatrix(F,t,w,q,k),D.setMatrix(k),D},r.recommendVersion=function(e,t,n,a){var s=this.calculateBitsNeeded(t,n,a,rn.getVersionForNumber(1)),f=this.chooseVersion(s,e),h=this.calculateBitsNeeded(t,n,a,f);return this.chooseVersion(h,e)},r.calculateBitsNeeded=function(e,t,n,a){return t.getSize()+e.getCharacterCountBits(a)+n.getSize()},r.getAlphanumericCode=function(e){return e<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[e]:-1},r.chooseMode=function(e,t){if(t===void 0&&(t=null),gt.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return $e.KANJI;for(var n=!1,a=!1,s=0,f=e.length;s<f;++s){var h=e.charAt(s);if(r.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)a=!0;else return $e.BYTE}return a?$e.ALPHANUMERIC:n?$e.NUMERIC:$e.BYTE},r.isOnlyDoubleByteKanji=function(e){var t;try{t=lr.encode(e,gt.SJIS)}catch{return!1}var n=t.length;if(n%2!==0)return!1;for(var a=0;a<n;a+=2){var s=t[a]&255;if((s<129||s>159)&&(s<224||s>235))return!1}return!0},r.chooseMaskPattern=function(e,t,n,a){for(var s=Number.MAX_SAFE_INTEGER,f=-1,h=0;h<ga.NUM_MASK_PATTERNS;h++){Po.buildMatrix(e,t,n,h,a);var x=this.calculateMaskPenalty(a);x<s&&(s=x,f=h)}return f},r.chooseVersion=function(e,t){for(var n=1;n<=40;n++){var a=rn.getVersionForNumber(n);if(r.willFit(e,a,t))return a}throw new Je("Data too big")},r.willFit=function(e,t,n){var a=t.getTotalCodewords(),s=t.getECBlocksForLevel(n),f=s.getTotalECCodewords(),h=a-f,x=(e+7)/8;return h>=x},r.terminateBits=function(e,t){var n=e*8;if(t.getSize()>n)throw new Je("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var a=0;a<4&&t.getSize()<n;++a)t.appendBit(!1);var s=t.getSize()&7;if(s>0)for(var a=s;a<8;a++)t.appendBit(!1);for(var f=e-t.getSizeInBytes(),a=0;a<f;++a)t.appendBits((a&1)===0?236:17,8);if(t.getSize()!==n)throw new Je("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(e,t,n,a,s,f){if(a>=n)throw new Je("Block ID too large");var h=e%n,x=n-h,g=Math.floor(e/n),w=g+1,A=Math.floor(t/n),E=A+1,C=g-A,b=w-E;if(C!==b)throw new Je("EC bytes mismatch");if(n!==x+h)throw new Je("RS blocks mismatch");if(e!==(A+C)*x+(E+b)*h)throw new Je("Total bytes mismatch");a<x?(s[0]=A,f[0]=C):(s[0]=E,f[0]=b)},r.interleaveWithECBytes=function(e,t,n,a){var s,f,h,x;if(e.getSizeInBytes()!==n)throw new Je("Number of bits and data bytes does not match");for(var g=0,w=0,A=0,E=new Array,C=0;C<a;++C){var b=new Int32Array(1),T=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(t,n,a,C,b,T);var P=b[0],F=new Uint8Array(P);e.toBytes(8*g,F,0,P);var D=r.generateECBytes(F,T[0]);E.push(new Cf(F,D)),w=Math.max(w,P),A=Math.max(A,D.length),g+=b[0]}if(n!==g)throw new Je("Data bytes does not match offset");for(var L=new mt,C=0;C<w;++C)try{for(var k=(s=void 0,Bo(E)),q=k.next();!q.done;q=k.next()){var K=q.value,F=K.getDataBytes();C<F.length&&L.appendBits(F[C],8)}}catch(ue){s={error:ue}}finally{try{q&&!q.done&&(f=k.return)&&f.call(k)}finally{if(s)throw s.error}}for(var C=0;C<A;++C)try{for(var U=(h=void 0,Bo(E)),$=U.next();!$.done;$=U.next()){var K=$.value,D=K.getErrorCorrectionBytes();C<D.length&&L.appendBits(D[C],8)}}catch(ue){h={error:ue}}finally{try{$&&!$.done&&(x=U.return)&&x.call(U)}finally{if(h)throw h.error}}if(t!==L.getSizeInBytes())throw new Je("Interleaving error: "+t+" and "+L.getSizeInBytes()+" differ.");return L},r.generateECBytes=function(e,t){for(var n=e.length,a=new Int32Array(n+t),s=0;s<n;s++)a[s]=e[s]&255;new a1(Jt.QR_CODE_FIELD_256).encode(a,t);for(var f=new Uint8Array(t),s=0;s<t;s++)f[s]=a[n+s];return f},r.appendModeInfo=function(e,t){t.appendBits(e.getBits(),4)},r.appendLengthInfo=function(e,t,n,a){var s=n.getCharacterCountBits(t);if(e>=1<<s)throw new Je(e+" is bigger than "+((1<<s)-1));a.appendBits(e,s)},r.appendBytes=function(e,t,n,a){switch(t){case $e.NUMERIC:r.appendNumericBytes(e,n);break;case $e.ALPHANUMERIC:r.appendAlphanumericBytes(e,n);break;case $e.BYTE:r.append8BitBytes(e,n,a);break;case $e.KANJI:r.appendKanjiBytes(e,n);break;default:throw new Je("Invalid mode: "+t)}},r.getDigit=function(e){return e.charCodeAt(0)-48},r.isDigit=function(e){var t=r.getDigit(e);return t>=0&&t<=9},r.appendNumericBytes=function(e,t){for(var n=e.length,a=0;a<n;){var s=r.getDigit(e.charAt(a));if(a+2<n){var f=r.getDigit(e.charAt(a+1)),h=r.getDigit(e.charAt(a+2));t.appendBits(s*100+f*10+h,10),a+=3}else if(a+1<n){var f=r.getDigit(e.charAt(a+1));t.appendBits(s*10+f,7),a+=2}else t.appendBits(s,4),a++}},r.appendAlphanumericBytes=function(e,t){for(var n=e.length,a=0;a<n;){var s=r.getAlphanumericCode(e.charCodeAt(a));if(s===-1)throw new Je;if(a+1<n){var f=r.getAlphanumericCode(e.charCodeAt(a+1));if(f===-1)throw new Je;t.appendBits(s*45+f,11),a+=2}else t.appendBits(s,6),a++}},r.append8BitBytes=function(e,t,n){var a;try{a=lr.encode(e,n)}catch(x){throw new Je(x)}for(var s=0,f=a.length;s!==f;s++){var h=a[s];t.appendBits(h,8)}},r.appendKanjiBytes=function(e,t){var n;try{n=lr.encode(e,gt.SJIS)}catch(A){throw new Je(A)}for(var a=n.length,s=0;s<a;s+=2){var f=n[s]&255,h=n[s+1]&255,x=f<<8&4294967295|h,g=-1;if(x>=33088&&x<=40956?g=x-33088:x>=57408&&x<=60351&&(g=x-49472),g===-1)throw new Je("Invalid byte sequence");var w=(g>>8)*192+(g&255);t.appendBits(w,13)}},r.appendECI=function(e,t){t.appendBits($e.ECI.getBits(),4),t.appendBits(e.getValue(),8)},r.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]),r.DEFAULT_BYTE_MODE_ENCODING=gt.UTF8.getName(),r})();var _f=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){_f(e,r);function e(t,n,a,s,f,h,x,g){var w=r.call(this,h,x)||this;if(w.yuvData=t,w.dataWidth=n,w.dataHeight=a,w.left=s,w.top=f,s+h>n||f+x>a)throw new xe("Crop rectangle does not fit within image data.");return g&&w.reverseHorizontal(h,x),w}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new xe("Requested row is outside the image: "+t);var a=this.getWidth();(n==null||n.length<a)&&(n=new Uint8ClampedArray(a));var s=(t+this.top)*this.dataWidth+this.left;return Ke.arraycopy(this.yuvData,s,n,0,a),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;var a=t*n,s=new Uint8ClampedArray(a),f=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return Ke.arraycopy(this.yuvData,f,s,0,a),s;for(var h=0;h<n;h++){var x=h*t;Ke.arraycopy(this.yuvData,f,s,x,t),f+=this.dataWidth}return s},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,a,s){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,a,s,!1)},e.prototype.renderThumbnail=function(){for(var t=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,a=new Int32Array(t*n),s=this.yuvData,f=this.top*this.dataWidth+this.left,h=0;h<n;h++){for(var x=h*t,g=0;g<t;g++){var w=s[f+g*e.THUMBNAIL_SCALE_FACTOR]&255;a[x+g]=4278190080|w*65793}f+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return a},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(t,n){for(var a=this.yuvData,s=0,f=this.top*this.dataWidth+this.left;s<n;s++,f+=this.dataWidth)for(var h=f+t/2,x=f,g=f+t-1;x<h;x++,g--){var w=a[x];a[x]=a[g],a[g]=w}},e.prototype.invert=function(){return new Aa(this)},e.THUMBNAIL_SCALE_FACTOR=2,e})(wi);var mf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();(function(r){mf(e,r);function e(t,n,a,s,f,h,x){var g=r.call(this,n,a)||this;if(g.dataWidth=s,g.dataHeight=f,g.left=h,g.top=x,t.BYTES_PER_ELEMENT===4){for(var w=n*a,A=new Uint8ClampedArray(w),E=0;E<w;E++){var C=t[E],b=C>>16&255,T=C>>7&510,P=C&255;A[E]=(b+T+P)/4&255}g.luminances=A}else g.luminances=t;if(s===void 0&&(g.dataWidth=n),f===void 0&&(g.dataHeight=a),h===void 0&&(g.left=0),x===void 0&&(g.top=0),g.left+n>g.dataWidth||g.top+a>g.dataHeight)throw new xe("Crop rectangle does not fit within image data.");return g}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new xe("Requested row is outside the image: "+t);var a=this.getWidth();(n==null||n.length<a)&&(n=new Uint8ClampedArray(a));var s=(t+this.top)*this.dataWidth+this.left;return Ke.arraycopy(this.luminances,s,n,0,a),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.luminances;var a=t*n,s=new Uint8ClampedArray(a),f=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return Ke.arraycopy(this.luminances,f,s,0,a),s;for(var h=0;h<n;h++){var x=h*t;Ke.arraycopy(this.luminances,f,s,x,t),f+=this.dataWidth}return s},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,a,s){return new e(this.luminances,a,s,this.dataWidth,this.dataHeight,this.left+t,this.top+n)},e.prototype.invert=function(){return new Aa(this)},e})(wi);var If=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Sf=(function(r){If(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.forName=function(t){return this.getCharacterSetECIByName(t)},e})(gt),bf=(function(){function r(){}return r.ISO_8859_1=gt.ISO8859_1,r})(),pa,Tf=301,Of=function(r,e){for(var t=1,n=0;n<255;n++)e[n]=t,r[t]=n,t*=2,t>=256&&(t^=Tf);return{LOG:r,ALOG:e}};pa=Of([],[]),pa.LOG;pa.ALOG;var Lo;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})(Lo||(Lo={}));var Fo=129,o1=230,Nf=231,Rf=235,Df=236,Mf=237,Pf=238,Bf=239,Lf=240,Ki=254,Ff=254,ko="[)>05",Uo="[)>06",Vo="",He=0,Nt=1,Gt=2,dt=3,Ct=4,Pt=5,kf=(function(){function r(){}return r.prototype.getEncodingMode=function(){return He},r.prototype.encode=function(e){var t=wr.determineConsecutiveDigitCount(e.getMessage(),e.pos);if(t>=2)e.writeCodeword(this.encodeASCIIDigits(e.getMessage().charCodeAt(e.pos),e.getMessage().charCodeAt(e.pos+1))),e.pos+=2;else{var n=e.getCurrentChar(),a=wr.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(a!==this.getEncodingMode())switch(a){case Pt:e.writeCodeword(Nf),e.signalEncoderChange(Pt);return;case Nt:e.writeCodeword(o1),e.signalEncoderChange(Nt);return;case dt:e.writeCodeword(Pf),e.signalEncoderChange(dt);break;case Gt:e.writeCodeword(Bf),e.signalEncoderChange(Gt);break;case Ct:e.writeCodeword(Lf),e.signalEncoderChange(Ct);break;default:throw new Error("Illegal mode: "+a)}else wr.isExtendedASCII(n)?(e.writeCodeword(Rf),e.writeCodeword(n-128+1),e.pos++):(e.writeCodeword(n+1),e.pos++)}},r.prototype.encodeASCIIDigits=function(e,t){if(wr.isDigit(e)&&wr.isDigit(t)){var n=(e-48)*10+(t-48);return n+130}throw new Error("not digits: "+e+t)},r})(),Uf=(function(){function r(){}return r.prototype.getEncodingMode=function(){return Pt},r.prototype.encode=function(e){var t=new Ce;for(t.append(0);e.hasMoreCharacters();){var n=e.getCurrentChar();t.append(n),e.pos++;var a=wr.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(a!==this.getEncodingMode()){e.signalEncoderChange(He);break}}var s=t.length()-1,f=1,h=e.getCodewordCount()+s+f;e.updateSymbolInfo(h);var x=e.getSymbolInfo().getDataCapacity()-h>0;if(e.hasMoreCharacters()||x)if(s<=249)t.setCharAt(0,Te.getCharAt(s));else if(s<=1555)t.setCharAt(0,Te.getCharAt(Math.floor(s/250)+249)),t.insert(1,Te.getCharAt(s%250));else throw new Error("Message length not in valid ranges: "+s);for(var g=0,n=t.length();g<n;g++)e.writeCodeword(this.randomize255State(t.charAt(g).charCodeAt(0),e.getCodewordCount()+1))},r.prototype.randomize255State=function(e,t){var n=149*t%255+1,a=e+n;return a<=255?a:a-256},r})(),ma=(function(){function r(){}return r.prototype.getEncodingMode=function(){return Nt},r.prototype.encodeMaximal=function(e){for(var t=new Ce,n=0,a=e.pos,s=0;e.hasMoreCharacters();){var f=e.getCurrentChar();e.pos++,n=this.encodeChar(f,t),t.length()%3===0&&(a=e.pos,s=t.length())}if(s!==t.length()){var h=Math.floor(t.length()/3*2),x=Math.floor(e.getCodewordCount()+h+1);e.updateSymbolInfo(x);var g=e.getSymbolInfo().getDataCapacity()-x,w=Math.floor(t.length()%3);(w===2&&g!==2||w===1&&(n>3||g!==1))&&(e.pos=a)}t.length()>0&&e.writeCodeword(o1),this.handleEOD(e,t)},r.prototype.encode=function(e){for(var t=new Ce;e.hasMoreCharacters();){var n=e.getCurrentChar();e.pos++;var a=this.encodeChar(n,t),s=Math.floor(t.length()/3)*2,f=e.getCodewordCount()+s;e.updateSymbolInfo(f);var h=e.getSymbolInfo().getDataCapacity()-f;if(!e.hasMoreCharacters()){var x=new Ce;for(t.length()%3===2&&h!==2&&(a=this.backtrackOneCharacter(e,t,x,a));t.length()%3===1&&(a>3||h!==1);)a=this.backtrackOneCharacter(e,t,x,a);break}var g=t.length();if(g%3===0){var w=wr.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(w!==this.getEncodingMode()){e.signalEncoderChange(He);break}}}this.handleEOD(e,t)},r.prototype.backtrackOneCharacter=function(e,t,n,a){var s=t.length(),f=t.toString().substring(0,s-a);t.setLengthToZero(),t.append(f),e.pos--;var h=e.getCurrentChar();return a=this.encodeChar(h,n),e.resetSymbolInfo(),a},r.prototype.writeNextTriplet=function(e,t){e.writeCodewords(this.encodeToCodewords(t.toString()));var n=t.toString().substring(3);t.setLengthToZero(),t.append(n)},r.prototype.handleEOD=function(e,t){var n=Math.floor(t.length()/3*2),a=t.length()%3,s=e.getCodewordCount()+n;e.updateSymbolInfo(s);var f=e.getSymbolInfo().getDataCapacity()-s;if(a===2){for(t.append("\0");t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(Ki)}else if(f===1&&a===1){for(;t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(Ki),e.pos--}else if(a===0){for(;t.length()>=3;)this.writeNextTriplet(e,t);(f>0||e.hasMoreCharacters())&&e.writeCodeword(Ki)}else throw new Error("Unexpected case. Please report!");e.signalEncoderChange(He)},r.prototype.encodeChar=function(e,t){if(e===32)return t.append(3),1;if(e>=48&&e<=57)return t.append(e-48+4),1;if(e>=65&&e<=90)return t.append(e-65+14),1;if(e<32)return t.append(0),t.append(e),2;if(e<=47)return t.append(1),t.append(e-33),2;if(e<=64)return t.append(1),t.append(e-58+15),2;if(e<=95)return t.append(1),t.append(e-91+22),2;if(e<=127)return t.append(2),t.append(e-96),2;t.append("1");var n=2;return n+=this.encodeChar(e-128,t),n},r.prototype.encodeToCodewords=function(e){var t=1600*e.charCodeAt(0)+40*e.charCodeAt(1)+e.charCodeAt(2)+1,n=t/256,a=t%256,s=new Ce;return s.append(n),s.append(a),s.toString()},r})(),Vf=(function(){function r(){}return r.prototype.getEncodingMode=function(){return Ct},r.prototype.encode=function(e){for(var t=new Ce;e.hasMoreCharacters();){var n=e.getCurrentChar();this.encodeChar(n,t),e.pos++;var a=t.length();if(a>=4){e.writeCodewords(this.encodeToCodewords(t.toString()));var s=t.toString().substring(4);t.setLengthToZero(),t.append(s);var f=wr.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(f!==this.getEncodingMode()){e.signalEncoderChange(He);break}}}t.append(Te.getCharAt(31)),this.handleEOD(e,t)},r.prototype.handleEOD=function(e,t){try{var n=t.length();if(n===0)return;if(n===1){e.updateSymbolInfo();var a=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),s=e.getRemainingCharacters();if(s>a&&(e.updateSymbolInfo(e.getCodewordCount()+1),a=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount()),s<=a&&a<=2)return}if(n>4)throw new Error("Count must not exceed 4");var f=n-1,h=this.encodeToCodewords(t.toString()),x=!e.hasMoreCharacters(),g=x&&f<=2;if(f<=2){e.updateSymbolInfo(e.getCodewordCount()+f);var a=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount();a>=3&&(g=!1,e.updateSymbolInfo(e.getCodewordCount()+h.length))}g?(e.resetSymbolInfo(),e.pos-=f):e.writeCodewords(h)}finally{e.signalEncoderChange(He)}},r.prototype.encodeChar=function(e,t){e>=32&&e<=63?t.append(e):e>=64&&e<=94?t.append(Te.getCharAt(e-64)):wr.illegalCharacter(Te.getCharAt(e))},r.prototype.encodeToCodewords=function(e){var t=e.length;if(t===0)throw new Error("StringBuilder must not be empty");var n=e.charAt(0).charCodeAt(0),a=t>=2?e.charAt(1).charCodeAt(0):0,s=t>=3?e.charAt(2).charCodeAt(0):0,f=t>=4?e.charAt(3).charCodeAt(0):0,h=(n<<18)+(a<<12)+(s<<6)+f,x=h>>16&255,g=h>>8&255,w=h&255,A=new Ce;return A.append(x),t>=2&&A.append(g),t>=3&&A.append(w),A.toString()},r})(),Hf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Gf=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Fe=(function(){function r(e,t,n,a,s,f,h,x){h===void 0&&(h=0),x===void 0&&(x=0),this.rectangular=e,this.dataCapacity=t,this.errorCodewords=n,this.matrixWidth=a,this.matrixHeight=s,this.dataRegions=f,this.rsBlockData=h,this.rsBlockError=x}return r.lookup=function(e,t,n,a,s){var f,h;t===void 0&&(t=0),n===void 0&&(n=null),a===void 0&&(a=null),s===void 0&&(s=!0);try{for(var x=Gf(Wf),g=x.next();!g.done;g=x.next()){var w=g.value;if(!(t===1&&w.rectangular)&&!(t===2&&!w.rectangular)&&!(n!=null&&(w.getSymbolWidth()<n.getWidth()||w.getSymbolHeight()<n.getHeight()))&&!(a!=null&&(w.getSymbolWidth()>a.getWidth()||w.getSymbolHeight()>a.getHeight()))&&e<=w.dataCapacity)return w}}catch(A){f={error:A}}finally{try{g&&!g.done&&(h=x.return)&&h.call(x)}finally{if(f)throw f.error}}if(s)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+e);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(e){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(e){return this.rsBlockError},r})(),Xf=(function(r){Hf(e,r);function e(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e})(Fe),Wf=[new Fe(!1,3,5,8,8,1),new Fe(!1,5,7,10,10,1),new Fe(!0,5,7,16,6,1),new Fe(!1,8,10,12,12,1),new Fe(!0,10,11,14,6,2),new Fe(!1,12,12,14,14,1),new Fe(!0,16,14,24,10,1),new Fe(!1,18,14,16,16,1),new Fe(!1,22,18,18,18,1),new Fe(!0,22,18,16,10,2),new Fe(!1,30,20,20,20,1),new Fe(!0,32,24,16,14,2),new Fe(!1,36,24,22,22,1),new Fe(!1,44,28,24,24,1),new Fe(!0,49,28,22,14,2),new Fe(!1,62,36,14,14,4),new Fe(!1,86,42,16,16,4),new Fe(!1,114,48,18,18,4),new Fe(!1,144,56,20,20,4),new Fe(!1,174,68,22,22,4),new Fe(!1,204,84,24,24,4,102,42),new Fe(!1,280,112,14,14,16,140,56),new Fe(!1,368,144,16,16,16,92,36),new Fe(!1,456,192,18,18,16,114,48),new Fe(!1,576,224,20,20,16,144,56),new Fe(!1,696,272,22,22,16,174,68),new Fe(!1,816,336,24,24,16,136,56),new Fe(!1,1050,408,18,18,36,175,68),new Fe(!1,1304,496,20,20,36,163,62),new Xf],zf=(function(){function r(e){this.msg=e,this.pos=0,this.skipAtEnd=0;for(var t=e.split("").map(function(h){return h.charCodeAt(0)}),n=new Ce,a=0,s=t.length;a<s;a++){var f=String.fromCharCode(t[a]&255);if(f==="?"&&e.charAt(a)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(f)}this.msg=n.toString(),this.shape=0,this.codewords=new Ce,this.newEncoding=-1}return r.prototype.setSymbolShape=function(e){this.shape=e},r.prototype.setSizeConstraints=function(e,t){this.minSize=e,this.maxSize=t},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(e){this.skipAtEnd=e},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(e){this.codewords.append(e)},r.prototype.writeCodeword=function(e){this.codewords.append(e)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(e){this.newEncoding=e},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(e){e===void 0&&(e=this.getCodewordCount()),(this.symbolInfo==null||e>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=Fe.lookup(e,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r})(),Yf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Zf=(function(r){Yf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return dt},e.prototype.encode=function(t){for(var n=new Ce;t.hasMoreCharacters();){var a=t.getCurrentChar();t.pos++,this.encodeChar(a,n);var s=n.length();if(s%3===0){this.writeNextTriplet(t,n);var f=wr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(f!==this.getEncodingMode()){t.signalEncoderChange(He);break}}}this.handleEOD(t,n)},e.prototype.encodeChar=function(t,n){switch(t){case 13:n.append(0);break;case 42:n.append(1);break;case 62:n.append(2);break;case 32:n.append(3);break;default:t>=48&&t<=57?n.append(t-48+4):t>=65&&t<=90?n.append(t-65+14):wr.illegalCharacter(Te.getCharAt(t));break}return 1},e.prototype.handleEOD=function(t,n){t.updateSymbolInfo();var a=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),s=n.length();t.pos-=s,(t.getRemainingCharacters()>1||a>1||t.getRemainingCharacters()!==a)&&t.writeCodeword(Ff),t.getNewEncoding()<0&&t.signalEncoderChange(He)},e})(ma),jf=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Kf=(function(r){jf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return Gt},e.prototype.encodeChar=function(t,n){if(t===32)return n.append(3),1;if(t>=48&&t<=57)return n.append(t-48+4),1;if(t>=97&&t<=122)return n.append(t-97+14),1;if(t<32)return n.append(0),n.append(t),2;if(t<=47)return n.append(1),n.append(t-33),2;if(t<=64)return n.append(1),n.append(t-58+15),2;if(t>=91&&t<=95)return n.append(1),n.append(t-91+22),2;if(t===96)return n.append(2),n.append(0),2;if(t<=90)return n.append(2),n.append(t-65+1),2;if(t<=127)return n.append(2),n.append(t-123+27),2;n.append("1");var a=2;return a+=this.encodeChar(t-128,n),a},e})(ma),wr=(function(){function r(){}return r.randomize253State=function(e){var t=149*e%253+1,n=Fo+t;return n<=254?n:n-254},r.encodeHighLevel=function(e,t,n,a,s){t===void 0&&(t=0),n===void 0&&(n=null),a===void 0&&(a=null),s===void 0&&(s=!1);var f=new ma,h=[new kf,f,new Kf,new Zf,new Vf,new Uf],x=new zf(e);x.setSymbolShape(t),x.setSizeConstraints(n,a),e.startsWith(ko)&&e.endsWith(Vo)?(x.writeCodeword(Df),x.setSkipAtEnd(2),x.pos+=ko.length):e.startsWith(Uo)&&e.endsWith(Vo)&&(x.writeCodeword(Mf),x.setSkipAtEnd(2),x.pos+=Uo.length);var g=He;for(s&&(f.encodeMaximal(x),g=x.getNewEncoding(),x.resetEncoderSignal());x.hasMoreCharacters();)h[g].encode(x),x.getNewEncoding()>=0&&(g=x.getNewEncoding(),x.resetEncoderSignal());var w=x.getCodewordCount();x.updateSymbolInfo();var A=x.getSymbolInfo().getDataCapacity();w<A&&g!==He&&g!==Pt&&g!==Ct&&x.writeCodeword("þ");var E=x.getCodewords();for(E.length()<A&&E.append(Fo);E.length()<A;)E.append(this.randomize253State(E.length()+1));return x.getCodewords().toString()},r.lookAheadTest=function(e,t,n){var a=this.lookAheadTestIntern(e,t,n);if(n===dt&&a===dt){for(var s=Math.min(t+3,e.length),f=t;f<s;f++)if(!this.isNativeX12(e.charCodeAt(f)))return He}else if(n===Ct&&a===Ct){for(var s=Math.min(t+4,e.length),f=t;f<s;f++)if(!this.isNativeEDIFACT(e.charCodeAt(f)))return He}return a},r.lookAheadTestIntern=function(e,t,n){if(t>=e.length)return n;var a;n===He?a=[0,1,1,1,1,1.25]:(a=[1,2,2,2,2,2.25],a[n]=0);for(var s=0,f=new Uint8Array(6),h=[];;){if(t+s===e.length){pt.fill(f,0),pt.fill(h,0);var x=this.findMinimums(a,h,Ie.MAX_VALUE,f),g=this.getMinimumCount(f);if(h[He]===x)return He;if(g===1){if(f[Pt]>0)return Pt;if(f[Ct]>0)return Ct;if(f[Gt]>0)return Gt;if(f[dt]>0)return dt}return Nt}var w=e.charCodeAt(t+s);if(s++,this.isDigit(w)?a[He]+=.5:this.isExtendedASCII(w)?(a[He]=Math.ceil(a[He]),a[He]+=2):(a[He]=Math.ceil(a[He]),a[He]++),this.isNativeC40(w)?a[Nt]+=2/3:this.isExtendedASCII(w)?a[Nt]+=8/3:a[Nt]+=4/3,this.isNativeText(w)?a[Gt]+=2/3:this.isExtendedASCII(w)?a[Gt]+=8/3:a[Gt]+=4/3,this.isNativeX12(w)?a[dt]+=2/3:this.isExtendedASCII(w)?a[dt]+=13/3:a[dt]+=10/3,this.isNativeEDIFACT(w)?a[Ct]+=3/4:this.isExtendedASCII(w)?a[Ct]+=17/4:a[Ct]+=13/4,this.isSpecialB256(w)?a[Pt]+=4:a[Pt]++,s>=4){if(pt.fill(f,0),pt.fill(h,0),this.findMinimums(a,h,Ie.MAX_VALUE,f),h[He]<this.min(h[Pt],h[Nt],h[Gt],h[dt],h[Ct]))return He;if(h[Pt]<h[He]||h[Pt]+1<this.min(h[Nt],h[Gt],h[dt],h[Ct]))return Pt;if(h[Ct]+1<this.min(h[Pt],h[Nt],h[Gt],h[dt],h[He]))return Ct;if(h[Gt]+1<this.min(h[Pt],h[Nt],h[Ct],h[dt],h[He]))return Gt;if(h[dt]+1<this.min(h[Pt],h[Nt],h[Ct],h[Gt],h[He]))return dt;if(h[Nt]+1<this.min(h[He],h[Pt],h[Ct],h[Gt])){if(h[Nt]<h[dt])return Nt;if(h[Nt]===h[dt]){for(var A=t+s+1;A<e.length;){var E=e.charCodeAt(A);if(this.isX12TermSep(E))return dt;if(!this.isNativeX12(E))break;A++}return Nt}}}}},r.min=function(e,t,n,a,s){var f=Math.min(e,Math.min(t,Math.min(n,a)));return s===void 0?f:Math.min(f,s)},r.findMinimums=function(e,t,n,a){for(var s=0;s<6;s++){var f=t[s]=Math.ceil(e[s]);n>f&&(n=f,pt.fill(a,0)),n===f&&(a[s]=a[s]+1)}return n},r.getMinimumCount=function(e){for(var t=0,n=0;n<6;n++)t+=e[n];return t||0},r.isDigit=function(e){return e>=48&&e<=57},r.isExtendedASCII=function(e){return e>=128&&e<=255},r.isNativeC40=function(e){return e===32||e>=48&&e<=57||e>=65&&e<=90},r.isNativeText=function(e){return e===32||e>=48&&e<=57||e>=97&&e<=122},r.isNativeX12=function(e){return this.isX12TermSep(e)||e===32||e>=48&&e<=57||e>=65&&e<=90},r.isX12TermSep=function(e){return e===13||e===42||e===62},r.isNativeEDIFACT=function(e){return e>=32&&e<=94},r.isSpecialB256=function(e){return!1},r.determineConsecutiveDigitCount=function(e,t){t===void 0&&(t=0);for(var n=e.length,a=t;a<n&&this.isDigit(e.charCodeAt(a));)a++;return a-t},r.illegalCharacter=function(e){var t=Ie.toHexString(e.charCodeAt(0));throw t="0000".substring(0,4-t.length)+t,new Error("Illegal character: "+e+" (0x"+t+")")},r})(),qi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ho=(function(){function r(e){this.charset=e,this.name=e.name}return r.prototype.canEncode=function(e){try{return lr.encode(e,this.charset)!=null}catch{return!1}},r})(),qf=(function(){function r(e,t,n){var a,s,f,h,x,g;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(Y){return new Ho(Sf.forName(Y))}),this.encoders=[];var w=[];w.push(new Ho(bf.ISO_8859_1));for(var A=t!=null&&t.name.startsWith("UTF"),E=0;E<e.length;E++){var C=!1;try{for(var b=(a=void 0,qi(w)),T=b.next();!T.done;T=b.next()){var P=T.value,F=e.charAt(E),D=F.charCodeAt(0);if(D===n||P.canEncode(F)){C=!0;break}}}catch(Y){a={error:Y}}finally{try{T&&!T.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}if(!C)try{for(var L=(f=void 0,qi(this.ENCODERS)),k=L.next();!k.done;k=L.next()){var P=k.value;if(P.canEncode(e.charAt(E))){w.push(P),C=!0;break}}}catch(Y){f={error:Y}}finally{try{k&&!k.done&&(h=L.return)&&h.call(L)}finally{if(f)throw f.error}}C||(A=!0)}if(w.length===1&&!A)this.encoders=[w[0]];else{this.encoders=[];var q=0;try{for(var K=qi(w),U=K.next();!U.done;U=K.next()){var P=U.value;this.encoders[q++]=P}}catch(Y){x={error:Y}}finally{try{U&&!U.done&&(g=K.return)&&g.call(K)}finally{if(x)throw x.error}}}var $=-1;if(t!=null){for(var E=0;E<this.encoders.length;E++)if(this.encoders[E]!=null&&t.name===this.encoders[E].name){$=E;break}}this.priorityEncoderIndex=$}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].name},r.prototype.getCharset=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].charset},r.prototype.getECIValue=function(e){return this.encoders[e].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return lr.encode(Te.getCharAt(e),this.encoders[t].name)},r})(),Qf=3,Jf=(function(){function r(e,t,n){this.fnc1=n;var a=new qf(e,t,n);if(a.length()===1)for(var s=0;s<this.bytes.length;s++){var f=e.charAt(s).charCodeAt(0);this.bytes[s]=f===n?1e3:f}else this.bytes=this.encodeMinimally(e,a,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(e,t){if(e+t-1>=this.bytes.length)return!1;for(var n=0;n<t;n++)if(this.isECI(e+n))return!1;return!0},r.prototype.charAt=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(this.isECI(e))throw new Error("value at "+e+" is not a character but an ECI");return this.isFNC1(e)?this.fnc1:this.bytes[e]},r.prototype.subSequence=function(e,t){if(e<0||e>t||t>this.length())throw new Error(""+e);for(var n=new Ce,a=e;a<t;a++){if(this.isECI(a))throw new Error("value at "+a+" is not a character but an ECI");n.append(this.charAt(a))}return n.toString()},r.prototype.isECI=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]>255&&this.bytes[e]<=999},r.prototype.isFNC1=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]===1e3},r.prototype.getECIValue=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(!this.isECI(e))throw new Error("value at "+e+" is not an ECI but a character");return this.bytes[e]-256},r.prototype.addEdge=function(e,t,n){(e[t][n.encoderIndex]==null||e[t][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(e[t][n.encoderIndex]=n)},r.prototype.addEdges=function(e,t,n,a,s,f){var h=e.charAt(a).charCodeAt(0),x=0,g=t.length();t.getPriorityEncoderIndex()>=0&&(h===f||t.canEncode(h,t.getPriorityEncoderIndex()))&&(x=t.getPriorityEncoderIndex(),g=x+1);for(var w=x;w<g;w++)(h===f||t.canEncode(h,w))&&this.addEdge(n,a+1,new Go(h,t,w,s,f))},r.prototype.encodeMinimally=function(e,t,n){var a=e.length,s=new Go[a+1][t.length()];this.addEdges(e,t,s,0,null,n);for(var f=1;f<=a;f++){for(var h=0;h<t.length();h++)s[f][h]!=null&&f<a&&this.addEdges(e,t,s,f,s[f][h],n);for(var h=0;h<t.length();h++)s[f-1][h]=null}for(var x=-1,g=Ie.MAX_VALUE,h=0;h<t.length();h++)if(s[a][h]!=null){var w=s[a][h];w.cachedTotalSize<g&&(g=w.cachedTotalSize,x=h)}if(x<0)throw new Error('Failed to encode "'+e+'"');for(var A=[],E=s[a][x];E!=null;){if(E.isFNC1())A.unshift(1e3);else for(var C=t.encode(E.c,E.encoderIndex),f=C.length-1;f>=0;f--)A.unshift(C[f]&255);var b=E.previous===null?0:E.previous.encoderIndex;b!==E.encoderIndex&&A.unshift(256+t.getECIValue(E.encoderIndex)),E=E.previous}for(var T=[],f=0;f<T.length;f++)T[f]=A[f];return T},r})(),Go=(function(){function r(e,t,n,a,s){this.c=e,this.encoderSet=t,this.encoderIndex=n,this.previous=a,this.fnc1=s,this.c=e===s?1e3:e;var f=this.isFNC1()?1:t.encode(e,n).length,h=a===null?0:a.encoderIndex;h!==n&&(f+=Qf),a!=null&&(f+=a.cachedTotalSize),this.cachedTotalSize=f}return r.prototype.isFNC1=function(){return this.c===1e3},r})(),$f=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();var Xo;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(Xo||(Xo={}));(function(r){$f(e,r);function e(t,n,a,s,f){var h=r.call(this,t,n,a)||this;return h.shape=s,h.macroId=f,h}return e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e})(Jf);var eu=(function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(e){this.compact=e},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(e){this.size=e},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(e){this.layers=e},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(e){this.codeWords=e},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(e){this.matrix=e},r})(),Wo=(function(){function r(){}return r.singletonList=function(e){return[e]},r.min=function(e,t){return e.sort(t)[0]},r})(),tu=(function(){function r(e){this.previous=e}return r.prototype.getPrevious=function(){return this.previous},r})(),ru=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ia=(function(r){ru(e,r);function e(t,n,a){var s=r.call(this,t)||this;return s.value=n,s.bitCount=a,s}return e.prototype.appendTo=function(t,n){t.appendBits(this.value,this.bitCount)},e.prototype.add=function(t,n){return new e(this,t,n)},e.prototype.addBinaryShift=function(t,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,t,n)},e.prototype.toString=function(){var t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+Ie.toBinaryString(t|1<<this.bitCount).substring(1)+">"},e})(tu),nu=(function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),iu=(function(r){nu(e,r);function e(t,n,a){var s=r.call(this,t,0,0)||this;return s.binaryShiftStart=n,s.binaryShiftByteCount=a,s}return e.prototype.appendTo=function(t,n){for(var a=0;a<this.binaryShiftByteCount;a++)(a===0||a===31&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):a===0?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(n[this.binaryShiftStart+a],8)},e.prototype.addBinaryShift=function(t,n){return new e(this,t,n)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e})(Ia);function au(r,e,t){return new iu(r,e,t)}function Pn(r,e,t){return new Ia(r,e,t)}var ou=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Xr=0,pi=1,ur=2,s1=3,Sr=4,su=new Ia(null,0,0),Qi=[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])],cu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function fu(r){var e,t;try{for(var n=cu(r),a=n.next();!a.done;a=n.next()){var s=a.value;pt.fill(s,-1)}}catch(f){e={error:f}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r[Xr][Sr]=0,r[pi][Sr]=0,r[pi][Xr]=28,r[s1][Sr]=0,r[ur][Sr]=0,r[ur][Xr]=15,r}var c1=fu(pt.createInt32Array(6,6)),uu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},lu=(function(){function r(e,t,n,a){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=a}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(e,t){var n=this.bitCount,a=this.token;if(e!==this.mode){var s=Qi[this.mode][e];a=Pn(a,s&65535,s>>16),n+=s>>16}var f=e===ur?4:5;return a=Pn(a,t,f),new r(a,e,0,n+f)},r.prototype.shiftAndAppend=function(e,t){var n=this.token,a=this.mode===ur?4:5;return n=Pn(n,c1[this.mode][e],a),n=Pn(n,t,5),new r(n,this.mode,0,this.bitCount+a+5)},r.prototype.addBinaryShiftChar=function(e){var t=this.token,n=this.mode,a=this.bitCount;if(this.mode===Sr||this.mode===ur){var s=Qi[n][Xr];t=Pn(t,s&65535,s>>16),a+=s>>16,n=Xr}var f=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,h=new r(t,n,this.binaryShiftByteCount+1,a+f);return h.binaryShiftByteCount===2078&&(h=h.endBinaryShift(e+1)),h},r.prototype.endBinaryShift=function(e){if(this.binaryShiftByteCount===0)return this;var t=this.token;return t=au(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(t,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(e){var t=this.bitCount+(Qi[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=r.calculateBinaryShiftCost(e)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount},r.prototype.toBitArray=function(e){for(var t,n,a=[],s=this.endBinaryShift(e.length).token;s!==null;s=s.getPrevious())a.unshift(s);var f=new mt;try{for(var h=uu(a),x=h.next();!x.done;x=h.next()){var g=x.value;g.appendTo(f,e)}}catch(w){t={error:w}}finally{try{x&&!x.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return f},r.prototype.toString=function(){return Te.format("%s bits=%d bytes=%d",ou[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(su,Xr,0,0),r})();function hu(r){var e=Te.getCharCode(" "),t=Te.getCharCode("."),n=Te.getCharCode(",");r[Xr][e]=1;for(var a=Te.getCharCode("Z"),s=Te.getCharCode("A"),f=s;f<=a;f++)r[Xr][f]=f-s+2;r[pi][e]=1;for(var h=Te.getCharCode("z"),x=Te.getCharCode("a"),f=x;f<=h;f++)r[pi][f]=f-x+2;r[ur][e]=1;for(var g=Te.getCharCode("9"),w=Te.getCharCode("0"),f=w;f<=g;f++)r[ur][f]=f-w+2;r[ur][n]=12,r[ur][t]=13;for(var A=["\0"," ","","","","","","","\x07","\b"," ",`
|
||
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],E=0;E<A.length;E++)r[s1][Te.getCharCode(A[E])]=E;for(var C=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"],E=0;E<C.length;E++)Te.getCharCode(C[E])>0&&(r[Sr][Te.getCharCode(C[E])]=E);return r}var Ji=hu(pt.createInt32Array(5,256)),oi=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},du=(function(){function r(e){this.text=e}return r.prototype.encode=function(){for(var e=Te.getCharCode(" "),t=Te.getCharCode(`
|
||
`),n=Wo.singletonList(lu.INITIAL_STATE),a=0;a<this.text.length;a++){var s=void 0,f=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case Te.getCharCode("\r"):s=f===t?2:0;break;case Te.getCharCode("."):s=f===e?3:0;break;case Te.getCharCode(","):s=f===e?4:0;break;case Te.getCharCode(":"):s=f===e?5:0;break;default:s=0}s>0?(n=r.updateStateListForPair(n,a,s),a++):n=this.updateStateListForChar(n,a)}var h=Wo.min(n,function(x,g){return x.getBitCount()-g.getBitCount()});return h.toBitArray(this.text)},r.prototype.updateStateListForChar=function(e,t){var n,a,s=[];try{for(var f=oi(e),h=f.next();!h.done;h=f.next()){var x=h.value;this.updateStateForChar(x,t,s)}}catch(g){n={error:g}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}return r.simplifyStates(s)},r.prototype.updateStateForChar=function(e,t,n){for(var a=this.text[t]&255,s=Ji[e.getMode()][a]>0,f=null,h=0;h<=Sr;h++){var x=Ji[h][a];if(x>0){if(f==null&&(f=e.endBinaryShift(t)),!s||h===e.getMode()||h===ur){var g=f.latchAndAppend(h,x);n.push(g)}if(!s&&c1[e.getMode()][h]>=0){var w=f.shiftAndAppend(h,x);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||Ji[e.getMode()][a]===0){var A=e.addBinaryShiftChar(t);n.push(A)}},r.updateStateListForPair=function(e,t,n){var a,s,f=[];try{for(var h=oi(e),x=h.next();!x.done;x=h.next()){var g=x.value;this.updateStateForPair(g,t,n,f)}}catch(w){a={error:w}}finally{try{x&&!x.done&&(s=h.return)&&s.call(h)}finally{if(a)throw a.error}}return this.simplifyStates(f)},r.updateStateForPair=function(e,t,n,a){var s=e.endBinaryShift(t);if(a.push(s.latchAndAppend(Sr,n)),e.getMode()!==Sr&&a.push(s.shiftAndAppend(Sr,n)),n===3||n===4){var f=s.latchAndAppend(ur,16-n).latchAndAppend(ur,1);a.push(f)}if(e.getBinaryShiftByteCount()>0){var h=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);a.push(h)}},r.simplifyStates=function(e){var t,n,a,s,f=[];try{for(var h=oi(e),x=h.next();!x.done;x=h.next()){var g=x.value,w=!0,A=function(P){if(P.isBetterThanOrEqualTo(g))return w=!1,"break";g.isBetterThanOrEqualTo(P)&&(f=f.filter(function(F){return F!==P}))};try{for(var E=(a=void 0,oi(f)),C=E.next();!C.done;C=E.next()){var b=C.value,T=A(b);if(T==="break")break}}catch(P){a={error:P}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}w&&f.push(g)}}catch(P){t={error:P}}finally{try{x&&!x.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return f},r})(),xu=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(){function r(){}return r.encodeBytes=function(e){return r.encode(e,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(e,t,n){var a=new du(e).encode(),s=Ie.truncDivision(a.getSize()*t,100)+11,f=a.getSize()+s,h,x,g,w,A;if(n!==r.DEFAULT_AZTEC_LAYERS){if(h=n<0,x=Math.abs(n),x>(h?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new xe(Te.format("Illegal value %s for layers",n));g=r.totalBitsInLayer(x,h),w=r.WORD_SIZE[x];var E=g-g%w;if(A=r.stuffBits(a,w),A.getSize()+s>E)throw new xe("Data to large for user specified layer");if(h&&A.getSize()>w*64)throw new xe("Data to large for user specified layer")}else{w=0,A=null;for(var C=0;;C++){if(C>r.MAX_NB_BITS)throw new xe("Data too large for an Aztec code");if(h=C<=3,x=h?C+1:C,g=r.totalBitsInLayer(x,h),!(f>g)){(A==null||w!==r.WORD_SIZE[x])&&(w=r.WORD_SIZE[x],A=r.stuffBits(a,w));var E=g-g%w;if(!(h&&A.getSize()>w*64)&&A.getSize()+s<=E)break}}}var b=r.generateCheckWords(A,g,w),T=A.getSize()/w,P=r.generateModeMessage(h,x,T),F=(h?11:14)+x*4,D=new Int32Array(F),L;if(h){L=F;for(var C=0;C<D.length;C++)D[C]=C}else{L=F+1+2*Ie.truncDivision(Ie.truncDivision(F,2)-1,15);for(var k=Ie.truncDivision(F,2),q=Ie.truncDivision(L,2),C=0;C<k;C++){var K=C+Ie.truncDivision(C,15);D[k-C-1]=q-K-1,D[k+C]=q+K+1}}for(var U=new br(L),C=0,$=0;C<x;C++){for(var Y=(x-C)*4+(h?9:12),ue=0;ue<Y;ue++)for(var _e=ue*2,Z=0;Z<2;Z++)b.get($+_e+Z)&&U.set(D[C*2+Z],D[C*2+ue]),b.get($+Y*2+_e+Z)&&U.set(D[C*2+ue],D[F-1-C*2-Z]),b.get($+Y*4+_e+Z)&&U.set(D[F-1-C*2-Z],D[F-1-C*2-ue]),b.get($+Y*6+_e+Z)&&U.set(D[F-1-C*2-ue],D[C*2+Z]);$+=Y*8}if(r.drawModeMessage(U,h,L,P),h)r.drawBullsEye(U,Ie.truncDivision(L,2),5);else{r.drawBullsEye(U,Ie.truncDivision(L,2),7);for(var C=0,ue=0;C<Ie.truncDivision(F,2)-1;C+=15,ue+=16)for(var Z=Ie.truncDivision(L,2)&1;Z<L;Z+=2)U.set(Ie.truncDivision(L,2)-ue,Z),U.set(Ie.truncDivision(L,2)+ue,Z),U.set(Z,Ie.truncDivision(L,2)-ue),U.set(Z,Ie.truncDivision(L,2)+ue)}var ne=new eu;return ne.setCompact(h),ne.setSize(L),ne.setLayers(x),ne.setCodeWords(T),ne.setMatrix(U),ne},r.drawBullsEye=function(e,t,n){for(var a=0;a<n;a+=2)for(var s=t-a;s<=t+a;s++)e.set(s,t-a),e.set(s,t+a),e.set(t-a,s),e.set(t+a,s);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)},r.generateModeMessage=function(e,t,n){var a=new mt;return e?(a.appendBits(t-1,2),a.appendBits(n-1,6),a=r.generateCheckWords(a,28,4)):(a.appendBits(t-1,5),a.appendBits(n-1,11),a=r.generateCheckWords(a,40,4)),a},r.drawModeMessage=function(e,t,n,a){var s=Ie.truncDivision(n,2);if(t)for(var f=0;f<7;f++){var h=s-3+f;a.get(f)&&e.set(h,s-5),a.get(f+7)&&e.set(s+5,h),a.get(20-f)&&e.set(h,s+5),a.get(27-f)&&e.set(s-5,h)}else for(var f=0;f<10;f++){var h=s-5+f+Ie.truncDivision(f,5);a.get(f)&&e.set(h,s-7),a.get(f+10)&&e.set(s+7,h),a.get(29-f)&&e.set(h,s+7),a.get(39-f)&&e.set(s-7,h)}},r.generateCheckWords=function(e,t,n){var a,s,f=e.getSize()/n,h=new a1(r.getGF(n)),x=Ie.truncDivision(t,n),g=r.bitsToWords(e,n,x);h.encode(g,x-f);var w=t%n,A=new mt;A.appendBits(0,w);try{for(var E=xu(Array.from(g)),C=E.next();!C.done;C=E.next()){var b=C.value;A.appendBits(b,n)}}catch(T){a={error:T}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}return A},r.bitsToWords=function(e,t,n){var a=new Int32Array(n),s,f;for(s=0,f=e.getSize()/t;s<f;s++){for(var h=0,x=0;x<t;x++)h|=e.get(s*t+x)?1<<t-x-1:0;a[s]=h}return a},r.getGF=function(e){switch(e){case 4:return Jt.AZTEC_PARAM;case 6:return Jt.AZTEC_DATA_6;case 8:return Jt.AZTEC_DATA_8;case 10:return Jt.AZTEC_DATA_10;case 12:return Jt.AZTEC_DATA_12;default:throw new xe("Unsupported word size "+e)}},r.stuffBits=function(e,t){for(var n=new mt,a=e.getSize(),s=(1<<t)-2,f=0;f<a;f+=t){for(var h=0,x=0;x<t;x++)(f+x>=a||e.get(f+x))&&(h|=1<<t-1-x);(h&s)===s?(n.appendBits(h&s,t),f--):(h&s)===0?(n.appendBits(h|1,t),f--):n.appendBits(h,t)}return n},r.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.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]),r})();const gu={props:{content:{type:Object,required:!0},uid:{type:String,required:!0}},emits:["trigger-event"],setup(r,{emit:e}){const t=Xt(()=>!1),n=Qt(null),a=Qt(null),s=Qt(""),f=Qt([]),h=Qt(!1),x=Qt(!1),g=Qt(!1),w=Qt(""),{setValue:A}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"currentCameraName",type:"string",defaultValue:""}),{setValue:E}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"cameraList",type:"array",defaultValue:[]}),{setValue:C}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"torchEnabled",type:"boolean",defaultValue:!1}),{setValue:b}=wwLib.wwVariable.useComponentVariable({uid:r.uid,name:"scannedValue",type:"string",defaultValue:""}),T=Xt(()=>{var Z;return{width:"100%",height:"100%",position:"relative",overflow:"hidden",backgroundColor:((Z=r.content)==null?void 0:Z.backgroundColor)||"#000000"}}),P=Xt(()=>{var Z;return{width:"100%",height:"100%",objectFit:((Z=r.content)==null?void 0:Z.objectFit)||"cover"}}),F=Xt(()=>{var ne,le,X,me;const Z=((ne=r.content)==null?void 0:ne.scanAreaSize)||"200px";return{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:Z,height:Z,border:`2px solid ${((le=r.content)==null?void 0:le.scanAreaColor)||"#00FF00"}`,boxShadow:`0 0 0 5000px ${((X=r.content)==null?void 0:X.scanAreaOverlay)||"rgba(0, 0, 0, 0.5)"}`,borderRadius:((me=r.content)==null?void 0:me.scanAreaBorderRadius)||"10px"}}),D=Xt(()=>{var Z;return((Z=r.content)==null?void 0:Z.showScanArea)!==!1}),L=Xt(()=>{var Z;return((Z=r.content)==null?void 0:Z.showLastResult)===!0}),k=Xt(()=>{var Z;return((Z=r.content)==null?void 0:Z.permissionMessage)||"Camera access is required to scan codes"}),q=Xt(()=>{var Z;return((Z=r.content)==null?void 0:Z.scanFrequency)||500}),K=()=>{var le;const Z=[],ne=((le=r.content)==null?void 0:le.formats)||["QR_CODE"];return ne.includes("QR_CODE")&&Z.push(se.QR_CODE),ne.includes("DATA_MATRIX")&&Z.push(se.DATA_MATRIX),ne.includes("CODE_39")&&Z.push(se.CODE_39),ne.includes("CODE_128")&&Z.push(se.CODE_128),ne.includes("EAN_13")&&Z.push(se.EAN_13),ne.includes("EAN_8")&&Z.push(se.EAN_8),ne.includes("ITF")&&Z.push(se.ITF),ne.includes("UPC_A")&&Z.push(se.UPC_A),ne.includes("UPC_E")&&Z.push(se.UPC_E),ne.includes("PDF_417")&&Z.push(se.PDF_417),ne.includes("AZTEC")&&Z.push(se.AZTEC),Z},U=async()=>{var Z;try{if(t.value)return;a.value=new pf,await navigator.mediaDevices.getUserMedia({video:!0}),h.value=!0;const ne=await a.value.listVideoInputDevices();f.value=ne||[],E(f.value.map(me=>({label:me.label,deviceId:me.deviceId})));const le=f.value.find(me=>/back|rear/i.test(me.label));s.value=le?le.deviceId:((Z=f.value[0])==null?void 0:Z.deviceId)||"";const X=f.value.find(me=>me.deviceId===s.value);A(X?X.label:""),await qa()}catch(ne){console.error("Camera init failed:",ne),h.value=!1}},$=async()=>{if(!(t.value||x.value||!a.value||!s.value))try{x.value=!0;const Z=new Map,ne=K();ne.length>0&&Z.set(tt.POSSIBLE_FORMATS,ne);let le=0;w.value="",b(""),await a.value.decodeFromVideoDevice(s.value,n.value,X=>{var me,ge;if(X&&X.getText()){const rr=Date.now();if(rr-le<q.value)return;le=rr;const nr=X.getText();w.value=nr,b(nr),e("trigger-event",{name:"scan",event:{value:nr}}),((me=r.content)==null?void 0:me.continuousScan)!==!0&&(ge=r.content)!=null&&ge.shutdownAfterScan&&Y()}},Z)}catch(Z){console.error("Error starting scanner:",Z),x.value=!1}},Y=()=>{var Z;a.value&&a.value.reset(),(Z=n.value)!=null&&Z.srcObject&&(n.value.srcObject.getTracks().forEach(X=>X.stop()),n.value.srcObject=null),x.value=!1,g.value=!1,C(!1)},ue=async()=>{if(t.value||!h.value||f.value.length<=1||(await qa(),!n.value))return;const ne=(f.value.findIndex(X=>X.deviceId===s.value)+1)%f.value.length;s.value=f.value[ne].deviceId;const le=f.value.find(X=>X.deviceId===s.value);A(le?le.label:""),x.value=!1,await a.value.decodeFromVideoDevice(s.value,n.value,X=>{var me;if(X&&X.getText()){const ge=X.getText();w.value=ge,b(ge),e("trigger-event",{name:"scan",event:{value:ge}}),((me=r.content)==null?void 0:me.continuousScan)!==!0&&Y()}}),x.value=!0},_e=async()=>{var Z,ne;if(!(t.value||!x.value||!n.value))try{const le=(Z=n.value.srcObject)==null?void 0:Z.getVideoTracks()[0];if(!((ne=le==null?void 0:le.getCapabilities)!=null&&ne.call(le).torch)){console.log("Torch not supported on this device");return}g.value=!g.value,C(g.value),await le.applyConstraints({advanced:[{torch:g.value}]})}catch(le){console.error("Error toggling torch:",le)}};return W1(()=>{var Z;return(Z=r.content)==null?void 0:Z.autoStart},Z=>{Z&&!x.value&&h.value&&!t.value&&$()}),z1(async()=>{var Z;await U(),(Z=r.content)!=null&&Z.autoStart&&!t.value&&$()}),Y1(()=>{Y()}),{videoElement:n,containerStyle:T,videoStyle:P,scanAreaStyle:F,isScanning:x,hasPermission:h,lastResult:w,showScanArea:D,showLastResult:L,permissionMessage:k,startScanning:$,stopScanning:Y,toggleCamera:ue,toggleTorch:_e}}},pu={key:1,class:"qr-code-scanner__result"},vu={key:2,class:"qr-code-scanner__permission-message"};function wu(r,e,t,n,a,s){return fr(),Nr("div",{class:"qr-code-scanner",style:Vn(n.containerStyle)},[ci("video",{ref:"videoElement",class:"qr-code-scanner__video",style:Vn(n.videoStyle),autoplay:"",muted:"",playsinline:""},null,4),n.isScanning&&n.showScanArea?(fr(),Nr("div",{key:0,class:"qr-code-scanner__scan-area",style:Vn(n.scanAreaStyle)},null,4)):tn("",!0),n.isScanning&&n.showLastResult&&n.lastResult?(fr(),Nr("div",pu,Ka(n.lastResult),1)):tn("",!0),n.hasPermission?tn("",!0):(fr(),Nr("div",vu,Ka(n.permissionMessage),1))],4)}const Iu=vi(gu,[["render",wu],["__scopeId","data-v-a9011397"]]),Au={topLeft:{"--justify":"flex-start","--align":"flex-start"},topMiddle:{"--justify":"flex-start","--align":"center"},topRight:{"--justify":"flex-start","--align":"flex-end"},middleLeft:{"--justify":"center","--align":"flex-start"},middle:{"--justify":"center","--align":"center"},middleRight:{"--justify":"center","--align":"flex-end"},bottomLeft:{"--justify":"flex-end","--align":"flex-start"},bottomMiddle:{"--justify":"flex-end","--align":"center"},bottomRight:{"--justify":"flex-end","--align":"flex-end"}},yu={props:{content:{type:Object,required:!0}},emits:["trigger-event","update:sidepanel-content"],computed:{isEditing(){return!1},show(){return this.content.display},backdropStyle(){return this.show&&this.content.backdrop?{"--backdropColor":this.content.backdropColor,"--backdropEvents":"auto",zIndex:this.content.zIndex}:{"--backdropColor":"transparent","--backdropEvents":"none",zIndex:this.content.zIndex}},modalContentStyle(){const r={"--transition":this.content.transition};return this.content.position!=="custom"?{...r,...Au[this.content.position]}:{...r,"--top":this.content.positionTop,"--left":this.content.positionLeft}}},watch:{}};function Eu(r,e,t,n,a,s){const f=si("wwLayout");return fr(),Nr("div",{class:"modal-container",style:Vn(s.backdropStyle),"ww-responsive":"modal-container",onMousedown:e[0]||(e[0]=j1(h=>r.$emit("trigger-event",{name:"backdropClick"}),["self"]))},[ta(Z1,{name:t.content.animation,mode:"out-in"},{default:zo(()=>[s.show?(fr(),ea(f,{key:0,class:$i(["modal-dropzone",t.content.position]),direction:"column",path:"modalContent",style:Vn(s.modalContentStyle),"ww-responsive":"modal-dropzone","inherit-from-element":["width"]},null,8,["class","style"])):tn("",!0)]),_:1},8,["name"])],36)}const Su=vi(yu,[["render",Eu],["__scopeId","data-v-f2e126dd"]]);export{mu as a,Iu as b,_u as e,Su as s};
|