airloom 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -3
- package/dist/viewer/assets/{browser-B9RMX6OC.js → browser-2h9wHAy0.js} +1 -1
- package/dist/viewer/assets/{index-D3PxNxWB.js → index-Cg3W-pBy.js} +1 -1
- package/dist/viewer/assets/{index-CoclVuPf.js → index-DFxK5hoA.js} +14 -14
- package/dist/viewer/index.html +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1387,9 +1387,7 @@ function createHostServer(opts) {
|
|
|
1387
1387
|
try {
|
|
1388
1388
|
const message = JSON.parse(data.toString());
|
|
1389
1389
|
if (message.type === "terminal_input" && typeof message.data === "string") {
|
|
1390
|
-
|
|
1391
|
-
if (!filtered) return;
|
|
1392
|
-
opts.state.terminal?.writeRawInput(filtered);
|
|
1390
|
+
opts.state.terminal?.writeRawInput(message.data);
|
|
1393
1391
|
} else if (message.type === "terminal_resize") {
|
|
1394
1392
|
opts.state.terminal?.handleMessage(message);
|
|
1395
1393
|
}
|
|
@@ -1583,6 +1581,10 @@ function initTerminal() {
|
|
|
1583
1581
|
fitAddon = new FitAddon();
|
|
1584
1582
|
term.loadAddon(fitAddon);
|
|
1585
1583
|
term.open(document.getElementById('terminal'));
|
|
1584
|
+
// Suppress OSC color query responses \u2014 see viewer/main.ts for details.
|
|
1585
|
+
for (const osc of [4, 10, 11, 12, 17, 19]) {
|
|
1586
|
+
term.parser.registerOscHandler(osc, () => true);
|
|
1587
|
+
}
|
|
1586
1588
|
term.onData((data) => {
|
|
1587
1589
|
if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: 'terminal_input', data }));
|
|
1588
1590
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as c}from"./index-
|
|
1
|
+
import{g as c}from"./index-DFxK5hoA.js";function f(t,i){for(var o=0;o<i.length;o++){const e=i[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(e,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var n,a;function b(){return a||(a=1,n=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),n}var u=b();const w=c(u),p=f({__proto__:null,default:w},[u]);export{p as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as vn}from"./index-CoclVuPf.js";var z;(function(f){f[f.QR_CODE=0]="QR_CODE",f[f.AZTEC=1]="AZTEC",f[f.CODABAR=2]="CODABAR",f[f.CODE_39=3]="CODE_39",f[f.CODE_93=4]="CODE_93",f[f.CODE_128=5]="CODE_128",f[f.DATA_MATRIX=6]="DATA_MATRIX",f[f.MAXICODE=7]="MAXICODE",f[f.ITF=8]="ITF",f[f.EAN_13=9]="EAN_13",f[f.EAN_8=10]="EAN_8",f[f.PDF_417=11]="PDF_417",f[f.RSS_14=12]="RSS_14",f[f.RSS_EXPANDED=13]="RSS_EXPANDED",f[f.UPC_A=14]="UPC_A",f[f.UPC_E=15]="UPC_E",f[f.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(z||(z={}));var _r=new Map([[z.QR_CODE,"QR_CODE"],[z.AZTEC,"AZTEC"],[z.CODABAR,"CODABAR"],[z.CODE_39,"CODE_39"],[z.CODE_93,"CODE_93"],[z.CODE_128,"CODE_128"],[z.DATA_MATRIX,"DATA_MATRIX"],[z.MAXICODE,"MAXICODE"],[z.ITF,"ITF"],[z.EAN_13,"EAN_13"],[z.EAN_8,"EAN_8"],[z.PDF_417,"PDF_417"],[z.RSS_14,"RSS_14"],[z.RSS_EXPANDED,"RSS_EXPANDED"],[z.UPC_A,"UPC_A"],[z.UPC_E,"UPC_E"],[z.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Dr;(function(f){f[f.UNKNOWN=0]="UNKNOWN",f[f.URL=1]="URL"})(Dr||(Dr={}));function _i(f){return Object.values(z).includes(f)}var Vt;(function(f){f[f.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",f[f.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Vt||(Vt={}));var Et=(function(){function f(){}return f.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",f.SCAN_DEFAULT_FPS=2,f.DEFAULT_DISABLE_FLIP=!1,f.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,f.DEFAULT_SUPPORTED_SCAN_TYPE=[Vt.SCAN_TYPE_CAMERA,Vt.SCAN_TYPE_FILE],f})(),Yr=(function(){function f(u,l){this.format=u,this.formatName=l}return f.prototype.toString=function(){return this.formatName},f.create=function(u){if(!_r.has(u))throw"".concat(u," not in html5QrcodeSupportedFormatsTextMap");return new f(u,_r.get(u))},f})(),Rr=(function(){function f(){}return f.createFromText=function(u){var l={text:u};return{decodedText:u,result:l}},f.createFromQrcodeResult=function(u){return{decodedText:u.text,result:u}},f})(),or;(function(f){f[f.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",f[f.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",f[f.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(or||(or={}));var Xr=(function(){function f(){}return f.createFrom=function(u){return{errorMessage:u,type:or.UNKWOWN_ERROR}},f})(),Zr=(function(){function f(u){this.verbose=u}return f.prototype.log=function(u){this.verbose&&console.log(u)},f.prototype.warn=function(u){this.verbose&&console.warn(u)},f.prototype.logError=function(u,l){(this.verbose||l===!0)&&console.error(u)},f.prototype.logErrors=function(u){if(u.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(u)},f})();function Nt(f){return typeof f>"u"||f===null}function Di(f,u,l){return f>l?l:f<u?u:f}var an=(function(){function f(){}return f.codeParseError=function(u){return"QR code parse error, error = ".concat(u)},f.errorGettingUserMedia=function(u){return"Error getting userMedia, error = ".concat(u)},f.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},f.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},f.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},f.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},f.scannerPaused=function(){return"Scanner paused"},f})(),xe=(function(){function f(){}return f.scanningStatus=function(){return"Scanning"},f.idleStatus=function(){return"Idle"},f.errorStatus=function(){return"Error"},f.permissionStatus=function(){return"Permission"},f.noCameraFoundErrorStatus=function(){return"No Cameras"},f.lastMatch=function(u){return"Last Match: ".concat(u)},f.codeScannerTitle=function(){return"Code Scanner"},f.cameraPermissionTitle=function(){return"Request Camera Permissions"},f.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},f.noCameraFound=function(){return"No camera found"},f.scanButtonStopScanningText=function(){return"Stop Scanning"},f.scanButtonStartScanningText=function(){return"Start Scanning"},f.torchOnButton=function(){return"Switch On Torch"},f.torchOffButton=function(){return"Switch Off Torch"},f.torchOnFailedMessage=function(){return"Failed to turn on torch"},f.torchOffFailedMessage=function(){return"Failed to turn off torch"},f.scanButtonScanningStarting=function(){return"Launching Camera..."},f.textIfCameraScanSelected=function(){return"Scan an Image File"},f.textIfFileScanSelected=function(){return"Scan using camera directly"},f.selectCamera=function(){return"Select Camera"},f.fileSelectionChooseImage=function(){return"Choose Image"},f.fileSelectionChooseAnother=function(){return"Choose Another"},f.fileSelectionNoImageSelected=function(){return"No image choosen"},f.anonymousCameraPrefix=function(){return"Anonymous Camera"},f.dragAndDropMessage=function(){return"Or drop an image to scan"},f.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},f.zoom=function(){return"zoom"},f.loadingImage=function(){return"Loading image..."},f.cameraScanAltText=function(){return"Camera based scan"},f.fileScanAltText=function(){return"Fule based scan"},f})(),Lr=(function(){function f(){}return f.poweredBy=function(){return"Powered by "},f.reportIssues=function(){return"Report issues"},f})(),Qr=(function(){function f(){}return f.isMediaStreamConstraintsValid=function(u,l){if(typeof u!="object"){var w=typeof u;return l.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(w,"."),!0),!1}for(var E=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],x=new Set(E),T=Object.keys(u),D=0,L=T;D<L.length;D++){var C=L[D];if(x.has(C))return l.logError("".concat(C," is not supported videoConstaints."),!0),!1}return!0},f})(),mn={exports:{}},Ri=mn.exports,Br;function Li(){return Br||(Br=1,(function(f,u){(function(l,w){w(u)})(Ri,(function(l){function w(d){return d==null}var E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)e.hasOwnProperty(t)&&(d[t]=e[t])};function x(d,e){E(d,e);function t(){this.constructor=d}d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function T(d,e){var t=Object.setPrototypeOf;t?t(d,e):d.__proto__=e}function D(d,e){e===void 0&&(e=d.constructor);var t=Error.captureStackTrace;t&&t(d,e)}var L=(function(d){x(e,d);function e(t){var n=this.constructor,r=d.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),T(r,n.prototype),D(r),r}return e})(Error);class C extends L{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}C.kind="Exception";class _ extends C{}_.kind="ArgumentException";class O extends C{}O.kind="IllegalArgumentException";class ie{constructor(e){if(this.binarizer=e,e===null)throw new O("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new ie(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new ie(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new ie(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class J extends C{static getChecksumInstance(){return new J}}J.kind="ChecksumException";class Be{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class K{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class Ie extends C{}Ie.kind="IndexOutOfBoundsException";class Ze extends Ie{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}Ze.kind="ArrayIndexOutOfBoundsException";class le{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){le.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new O("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ze(t);if(n>e)throw new Ze(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return K.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=le.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class Q{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}Q.MIN_VALUE_32_BITS=-2147483648,Q.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ce{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=ce.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=ce.makeArray(e);K.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new O;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){const o=s>n?0:e&31,c=(2<<(s<r?31:t&31))-(1<<o);i[s]|=c}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new O;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){const a=o>r?0:e&31,h=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&h)!==(n?h:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new O("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new O("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){const i=n*32-this.size;let s=e[0]>>>i;for(let o=1;o<n;o++){const a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof ce))return!1;const t=e;return this.size===t.size&&le.equals(this.bits,t.bits)}hashCode(){return 31*this.size+le.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new ce(this.size,this.bits.slice())}}var _t;(function(d){d[d.OTHER=0]="OTHER",d[d.PURE_BARCODE=1]="PURE_BARCODE",d[d.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",d[d.TRY_HARDER=3]="TRY_HARDER",d[d.CHARACTER_SET=4]="CHARACTER_SET",d[d.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",d[d.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",d[d.ASSUME_GS1=7]="ASSUME_GS1",d[d.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",d[d.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",d[d.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(_t||(_t={}));var we=_t;class U extends C{static getFormatInstance(){return new U}}U.kind="FormatException";var ge;(function(d){d[d.Cp437=0]="Cp437",d[d.ISO8859_1=1]="ISO8859_1",d[d.ISO8859_2=2]="ISO8859_2",d[d.ISO8859_3=3]="ISO8859_3",d[d.ISO8859_4=4]="ISO8859_4",d[d.ISO8859_5=5]="ISO8859_5",d[d.ISO8859_6=6]="ISO8859_6",d[d.ISO8859_7=7]="ISO8859_7",d[d.ISO8859_8=8]="ISO8859_8",d[d.ISO8859_9=9]="ISO8859_9",d[d.ISO8859_10=10]="ISO8859_10",d[d.ISO8859_11=11]="ISO8859_11",d[d.ISO8859_13=12]="ISO8859_13",d[d.ISO8859_14=13]="ISO8859_14",d[d.ISO8859_15=14]="ISO8859_15",d[d.ISO8859_16=15]="ISO8859_16",d[d.SJIS=16]="SJIS",d[d.Cp1250=17]="Cp1250",d[d.Cp1251=18]="Cp1251",d[d.Cp1252=19]="Cp1252",d[d.Cp1256=20]="Cp1256",d[d.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",d[d.UTF8=22]="UTF8",d[d.ASCII=23]="ASCII",d[d.Big5=24]="Big5",d[d.GB18030=25]="GB18030",d[d.EUC_KR=26]="EUC_KR"})(ge||(ge={}));class k{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,k.VALUE_IDENTIFIER_TO_ECI.set(e,this),k.NAME_TO_ECI.set(n,this);const i=this.values;for(let s=0,o=i.length;s!==o;s++){const a=i[s];k.VALUES_TO_ECI.set(a,this)}for(const s of r)k.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new U("incorect value");const t=k.VALUES_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}static getCharacterSetECIByName(e){const t=k.NAME_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}equals(e){if(!(e instanceof k))return!1;const t=e;return this.getName()===t.getName()}}k.VALUE_IDENTIFIER_TO_ECI=new Map,k.VALUES_TO_ECI=new Map,k.NAME_TO_ECI=new Map,k.Cp437=new k(ge.Cp437,Int32Array.from([0,2]),"Cp437"),k.ISO8859_1=new k(ge.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),k.ISO8859_2=new k(ge.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),k.ISO8859_3=new k(ge.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),k.ISO8859_4=new k(ge.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),k.ISO8859_5=new k(ge.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),k.ISO8859_6=new k(ge.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),k.ISO8859_7=new k(ge.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),k.ISO8859_8=new k(ge.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),k.ISO8859_9=new k(ge.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),k.ISO8859_10=new k(ge.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),k.ISO8859_11=new k(ge.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),k.ISO8859_13=new k(ge.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),k.ISO8859_14=new k(ge.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),k.ISO8859_15=new k(ge.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),k.ISO8859_16=new k(ge.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),k.SJIS=new k(ge.SJIS,20,"SJIS","Shift_JIS"),k.Cp1250=new k(ge.Cp1250,21,"Cp1250","windows-1250"),k.Cp1251=new k(ge.Cp1251,22,"Cp1251","windows-1251"),k.Cp1252=new k(ge.Cp1252,23,"Cp1252","windows-1252"),k.Cp1256=new k(ge.Cp1256,24,"Cp1256","windows-1256"),k.UnicodeBigUnmarked=new k(ge.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),k.UTF8=new k(ge.UTF8,26,"UTF8","UTF-8"),k.ASCII=new k(ge.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),k.Big5=new k(ge.Big5,28,"Big5"),k.GB18030=new k(ge.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),k.EUC_KR=new k(ge.EUC_KR,30,"EUC_KR","EUC-KR");class Qt extends C{}Qt.kind="UnsupportedOperationException";class tt{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!tt.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof k?e:k.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(tt.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(k.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Qt(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(k.UTF8)||e.equals(k.ISO8859_1)||e.equals(k.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class q{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return tt.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(we.CHARACTER_SET)!==void 0)return t.get(we.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,s=!0,o=0,a=0,c=0,h=0,g=0,A=0,m=0,I=0,S=0,y=0,M=0;const P=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let F=0;F<n&&(r||i||s);F++){const v=e[F]&255;s&&(o>0?(v&128)===0?s=!1:o--:(v&128)!==0&&((v&64)===0?s=!1:(o++,(v&32)===0?a++:(o++,(v&16)===0?c++:(o++,(v&8)===0?h++:s=!1))))),r&&(v>127&&v<160?r=!1:v>159&&(v<192||v===215||v===247)&&M++),i&&(g>0?v<64||v===127||v>252?i=!1:g--:v===128||v===160||v>239?i=!1:v>160&&v<224?(A++,I=0,m++,m>S&&(S=m)):v>127?(g++,m=0,I++,I>y&&(y=I)):(m=0,I=0))}return s&&o>0&&(s=!1),i&&g>0&&(i=!1),s&&(P||a+c+h>0)?q.UTF8:i&&(q.ASSUME_SHIFT_JIS||S>=3||y>=3)?q.SHIFT_JIS:r&&i?S===2&&A===2||M*10>=n?q.SHIFT_JIS:q.ISO88591:r?q.ISO88591:i?q.SHIFT_JIS:s?q.UTF8:q.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,c,h,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=h?parseInt(h.substr(1)):void 0,m;switch(g){case"s":m=t[n];break;case"c":m=t[n][0];break;case"f":m=parseFloat(t[n]).toFixed(s);break;case"p":m=parseFloat(t[n]).toPrecision(s);break;case"e":m=parseFloat(t[n]).toExponential(s);break;case"x":m=parseInt(t[n]).toString(A||16);break;case"d":m=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}m=typeof m=="object"?JSON.stringify(m):(+m).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;m.length<I;)m=o!==void 0?m+S:S+m;return m}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return tt.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}q.SHIFT_JIS=k.SJIS.getName(),q.GB2312="GB2312",q.ISO88591=k.ISO8859_1.getName(),q.EUC_JP="EUC_JP",q.UTF8=k.UTF8.getName(),q.PLATFORM_DEFAULT_ENCODING=q.UTF8,q.ASSUME_SHIFT_JIS=!1;class Ae{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=q.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class Ue{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new O("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new Ue(n,t);for(let i=0;i<t;i++){const s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}static parseFromString(e,t,n){if(e===null)throw new O("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,s=0,o=-1,a=0,c=0;for(;c<e.length;)if(e.charAt(c)===`
|
|
1
|
+
import{c as vn}from"./index-DFxK5hoA.js";var z;(function(f){f[f.QR_CODE=0]="QR_CODE",f[f.AZTEC=1]="AZTEC",f[f.CODABAR=2]="CODABAR",f[f.CODE_39=3]="CODE_39",f[f.CODE_93=4]="CODE_93",f[f.CODE_128=5]="CODE_128",f[f.DATA_MATRIX=6]="DATA_MATRIX",f[f.MAXICODE=7]="MAXICODE",f[f.ITF=8]="ITF",f[f.EAN_13=9]="EAN_13",f[f.EAN_8=10]="EAN_8",f[f.PDF_417=11]="PDF_417",f[f.RSS_14=12]="RSS_14",f[f.RSS_EXPANDED=13]="RSS_EXPANDED",f[f.UPC_A=14]="UPC_A",f[f.UPC_E=15]="UPC_E",f[f.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(z||(z={}));var _r=new Map([[z.QR_CODE,"QR_CODE"],[z.AZTEC,"AZTEC"],[z.CODABAR,"CODABAR"],[z.CODE_39,"CODE_39"],[z.CODE_93,"CODE_93"],[z.CODE_128,"CODE_128"],[z.DATA_MATRIX,"DATA_MATRIX"],[z.MAXICODE,"MAXICODE"],[z.ITF,"ITF"],[z.EAN_13,"EAN_13"],[z.EAN_8,"EAN_8"],[z.PDF_417,"PDF_417"],[z.RSS_14,"RSS_14"],[z.RSS_EXPANDED,"RSS_EXPANDED"],[z.UPC_A,"UPC_A"],[z.UPC_E,"UPC_E"],[z.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Dr;(function(f){f[f.UNKNOWN=0]="UNKNOWN",f[f.URL=1]="URL"})(Dr||(Dr={}));function _i(f){return Object.values(z).includes(f)}var Vt;(function(f){f[f.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",f[f.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Vt||(Vt={}));var Et=(function(){function f(){}return f.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",f.SCAN_DEFAULT_FPS=2,f.DEFAULT_DISABLE_FLIP=!1,f.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,f.DEFAULT_SUPPORTED_SCAN_TYPE=[Vt.SCAN_TYPE_CAMERA,Vt.SCAN_TYPE_FILE],f})(),Yr=(function(){function f(u,l){this.format=u,this.formatName=l}return f.prototype.toString=function(){return this.formatName},f.create=function(u){if(!_r.has(u))throw"".concat(u," not in html5QrcodeSupportedFormatsTextMap");return new f(u,_r.get(u))},f})(),Rr=(function(){function f(){}return f.createFromText=function(u){var l={text:u};return{decodedText:u,result:l}},f.createFromQrcodeResult=function(u){return{decodedText:u.text,result:u}},f})(),or;(function(f){f[f.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",f[f.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",f[f.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(or||(or={}));var Xr=(function(){function f(){}return f.createFrom=function(u){return{errorMessage:u,type:or.UNKWOWN_ERROR}},f})(),Zr=(function(){function f(u){this.verbose=u}return f.prototype.log=function(u){this.verbose&&console.log(u)},f.prototype.warn=function(u){this.verbose&&console.warn(u)},f.prototype.logError=function(u,l){(this.verbose||l===!0)&&console.error(u)},f.prototype.logErrors=function(u){if(u.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(u)},f})();function Nt(f){return typeof f>"u"||f===null}function Di(f,u,l){return f>l?l:f<u?u:f}var an=(function(){function f(){}return f.codeParseError=function(u){return"QR code parse error, error = ".concat(u)},f.errorGettingUserMedia=function(u){return"Error getting userMedia, error = ".concat(u)},f.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},f.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},f.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},f.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},f.scannerPaused=function(){return"Scanner paused"},f})(),xe=(function(){function f(){}return f.scanningStatus=function(){return"Scanning"},f.idleStatus=function(){return"Idle"},f.errorStatus=function(){return"Error"},f.permissionStatus=function(){return"Permission"},f.noCameraFoundErrorStatus=function(){return"No Cameras"},f.lastMatch=function(u){return"Last Match: ".concat(u)},f.codeScannerTitle=function(){return"Code Scanner"},f.cameraPermissionTitle=function(){return"Request Camera Permissions"},f.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},f.noCameraFound=function(){return"No camera found"},f.scanButtonStopScanningText=function(){return"Stop Scanning"},f.scanButtonStartScanningText=function(){return"Start Scanning"},f.torchOnButton=function(){return"Switch On Torch"},f.torchOffButton=function(){return"Switch Off Torch"},f.torchOnFailedMessage=function(){return"Failed to turn on torch"},f.torchOffFailedMessage=function(){return"Failed to turn off torch"},f.scanButtonScanningStarting=function(){return"Launching Camera..."},f.textIfCameraScanSelected=function(){return"Scan an Image File"},f.textIfFileScanSelected=function(){return"Scan using camera directly"},f.selectCamera=function(){return"Select Camera"},f.fileSelectionChooseImage=function(){return"Choose Image"},f.fileSelectionChooseAnother=function(){return"Choose Another"},f.fileSelectionNoImageSelected=function(){return"No image choosen"},f.anonymousCameraPrefix=function(){return"Anonymous Camera"},f.dragAndDropMessage=function(){return"Or drop an image to scan"},f.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},f.zoom=function(){return"zoom"},f.loadingImage=function(){return"Loading image..."},f.cameraScanAltText=function(){return"Camera based scan"},f.fileScanAltText=function(){return"Fule based scan"},f})(),Lr=(function(){function f(){}return f.poweredBy=function(){return"Powered by "},f.reportIssues=function(){return"Report issues"},f})(),Qr=(function(){function f(){}return f.isMediaStreamConstraintsValid=function(u,l){if(typeof u!="object"){var w=typeof u;return l.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(w,"."),!0),!1}for(var E=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],x=new Set(E),T=Object.keys(u),D=0,L=T;D<L.length;D++){var C=L[D];if(x.has(C))return l.logError("".concat(C," is not supported videoConstaints."),!0),!1}return!0},f})(),mn={exports:{}},Ri=mn.exports,Br;function Li(){return Br||(Br=1,(function(f,u){(function(l,w){w(u)})(Ri,(function(l){function w(d){return d==null}var E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,e){d.__proto__=e}||function(d,e){for(var t in e)e.hasOwnProperty(t)&&(d[t]=e[t])};function x(d,e){E(d,e);function t(){this.constructor=d}d.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function T(d,e){var t=Object.setPrototypeOf;t?t(d,e):d.__proto__=e}function D(d,e){e===void 0&&(e=d.constructor);var t=Error.captureStackTrace;t&&t(d,e)}var L=(function(d){x(e,d);function e(t){var n=this.constructor,r=d.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),T(r,n.prototype),D(r),r}return e})(Error);class C extends L{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}C.kind="Exception";class _ extends C{}_.kind="ArgumentException";class O extends C{}O.kind="IllegalArgumentException";class ie{constructor(e){if(this.binarizer=e,e===null)throw new O("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new ie(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new ie(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new ie(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class J extends C{static getChecksumInstance(){return new J}}J.kind="ChecksumException";class Be{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class K{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class Ie extends C{}Ie.kind="IndexOutOfBoundsException";class Ze extends Ie{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}Ze.kind="ArrayIndexOutOfBoundsException";class le{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){le.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new O("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ze(t);if(n>e)throw new Ze(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return K.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=le.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class Q{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}Q.MIN_VALUE_32_BITS=-2147483648,Q.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ce{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=ce.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=ce.makeArray(e);K.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}const o=r*32+Q.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new O;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){const o=s>n?0:e&31,c=(2<<(s<r?31:t&31))-(1<<o);i[s]|=c}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new O;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){const a=o>r?0:e&31,h=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&h)!==(n?h:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new O("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new O("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){const i=n*32-this.size;let s=e[0]>>>i;for(let o=1;o<n;o++){const a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof ce))return!1;const t=e;return this.size===t.size&&le.equals(this.bits,t.bits)}hashCode(){return 31*this.size+le.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new ce(this.size,this.bits.slice())}}var _t;(function(d){d[d.OTHER=0]="OTHER",d[d.PURE_BARCODE=1]="PURE_BARCODE",d[d.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",d[d.TRY_HARDER=3]="TRY_HARDER",d[d.CHARACTER_SET=4]="CHARACTER_SET",d[d.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",d[d.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",d[d.ASSUME_GS1=7]="ASSUME_GS1",d[d.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",d[d.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",d[d.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(_t||(_t={}));var we=_t;class U extends C{static getFormatInstance(){return new U}}U.kind="FormatException";var ge;(function(d){d[d.Cp437=0]="Cp437",d[d.ISO8859_1=1]="ISO8859_1",d[d.ISO8859_2=2]="ISO8859_2",d[d.ISO8859_3=3]="ISO8859_3",d[d.ISO8859_4=4]="ISO8859_4",d[d.ISO8859_5=5]="ISO8859_5",d[d.ISO8859_6=6]="ISO8859_6",d[d.ISO8859_7=7]="ISO8859_7",d[d.ISO8859_8=8]="ISO8859_8",d[d.ISO8859_9=9]="ISO8859_9",d[d.ISO8859_10=10]="ISO8859_10",d[d.ISO8859_11=11]="ISO8859_11",d[d.ISO8859_13=12]="ISO8859_13",d[d.ISO8859_14=13]="ISO8859_14",d[d.ISO8859_15=14]="ISO8859_15",d[d.ISO8859_16=15]="ISO8859_16",d[d.SJIS=16]="SJIS",d[d.Cp1250=17]="Cp1250",d[d.Cp1251=18]="Cp1251",d[d.Cp1252=19]="Cp1252",d[d.Cp1256=20]="Cp1256",d[d.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",d[d.UTF8=22]="UTF8",d[d.ASCII=23]="ASCII",d[d.Big5=24]="Big5",d[d.GB18030=25]="GB18030",d[d.EUC_KR=26]="EUC_KR"})(ge||(ge={}));class k{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,k.VALUE_IDENTIFIER_TO_ECI.set(e,this),k.NAME_TO_ECI.set(n,this);const i=this.values;for(let s=0,o=i.length;s!==o;s++){const a=i[s];k.VALUES_TO_ECI.set(a,this)}for(const s of r)k.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new U("incorect value");const t=k.VALUES_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}static getCharacterSetECIByName(e){const t=k.NAME_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}equals(e){if(!(e instanceof k))return!1;const t=e;return this.getName()===t.getName()}}k.VALUE_IDENTIFIER_TO_ECI=new Map,k.VALUES_TO_ECI=new Map,k.NAME_TO_ECI=new Map,k.Cp437=new k(ge.Cp437,Int32Array.from([0,2]),"Cp437"),k.ISO8859_1=new k(ge.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),k.ISO8859_2=new k(ge.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),k.ISO8859_3=new k(ge.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),k.ISO8859_4=new k(ge.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),k.ISO8859_5=new k(ge.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),k.ISO8859_6=new k(ge.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),k.ISO8859_7=new k(ge.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),k.ISO8859_8=new k(ge.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),k.ISO8859_9=new k(ge.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),k.ISO8859_10=new k(ge.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),k.ISO8859_11=new k(ge.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),k.ISO8859_13=new k(ge.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),k.ISO8859_14=new k(ge.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),k.ISO8859_15=new k(ge.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),k.ISO8859_16=new k(ge.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),k.SJIS=new k(ge.SJIS,20,"SJIS","Shift_JIS"),k.Cp1250=new k(ge.Cp1250,21,"Cp1250","windows-1250"),k.Cp1251=new k(ge.Cp1251,22,"Cp1251","windows-1251"),k.Cp1252=new k(ge.Cp1252,23,"Cp1252","windows-1252"),k.Cp1256=new k(ge.Cp1256,24,"Cp1256","windows-1256"),k.UnicodeBigUnmarked=new k(ge.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),k.UTF8=new k(ge.UTF8,26,"UTF8","UTF-8"),k.ASCII=new k(ge.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),k.Big5=new k(ge.Big5,28,"Big5"),k.GB18030=new k(ge.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),k.EUC_KR=new k(ge.EUC_KR,30,"EUC_KR","EUC-KR");class Qt extends C{}Qt.kind="UnsupportedOperationException";class tt{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!tt.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof k?e:k.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(tt.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(k.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Qt(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(k.UTF8)||e.equals(k.ISO8859_1)||e.equals(k.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class q{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return tt.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(we.CHARACTER_SET)!==void 0)return t.get(we.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,s=!0,o=0,a=0,c=0,h=0,g=0,A=0,m=0,I=0,S=0,y=0,M=0;const P=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let F=0;F<n&&(r||i||s);F++){const v=e[F]&255;s&&(o>0?(v&128)===0?s=!1:o--:(v&128)!==0&&((v&64)===0?s=!1:(o++,(v&32)===0?a++:(o++,(v&16)===0?c++:(o++,(v&8)===0?h++:s=!1))))),r&&(v>127&&v<160?r=!1:v>159&&(v<192||v===215||v===247)&&M++),i&&(g>0?v<64||v===127||v>252?i=!1:g--:v===128||v===160||v>239?i=!1:v>160&&v<224?(A++,I=0,m++,m>S&&(S=m)):v>127?(g++,m=0,I++,I>y&&(y=I)):(m=0,I=0))}return s&&o>0&&(s=!1),i&&g>0&&(i=!1),s&&(P||a+c+h>0)?q.UTF8:i&&(q.ASSUME_SHIFT_JIS||S>=3||y>=3)?q.SHIFT_JIS:r&&i?S===2&&A===2||M*10>=n?q.SHIFT_JIS:q.ISO88591:r?q.ISO88591:i?q.SHIFT_JIS:s?q.UTF8:q.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,c,h,g){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=h?parseInt(h.substr(1)):void 0,m;switch(g){case"s":m=t[n];break;case"c":m=t[n][0];break;case"f":m=parseFloat(t[n]).toFixed(s);break;case"p":m=parseFloat(t[n]).toPrecision(s);break;case"e":m=parseFloat(t[n]).toExponential(s);break;case"x":m=parseInt(t[n]).toString(A||16);break;case"d":m=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}m=typeof m=="object"?JSON.stringify(m):(+m).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;m.length<I;)m=o!==void 0?m+S:S+m;return m}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return tt.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}q.SHIFT_JIS=k.SJIS.getName(),q.GB2312="GB2312",q.ISO88591=k.ISO8859_1.getName(),q.EUC_JP="EUC_JP",q.UTF8=k.UTF8.getName(),q.PLATFORM_DEFAULT_ENCODING=q.UTF8,q.ASSUME_SHIFT_JIS=!1;class Ae{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=q.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class Ue{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new O("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new Ue(n,t);for(let i=0;i<t;i++){const s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}static parseFromString(e,t,n){if(e===null)throw new O("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,s=0,o=-1,a=0,c=0;for(;c<e.length;)if(e.charAt(c)===`
|
|
2
2
|
`||e.charAt(c)==="\r"){if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new O("row lengths do not match");s=i,a++}c++}else if(e.substring(c,c+t.length)===t)c+=t.length,r[i]=!0,i++;else if(e.substring(c,c+n.length)===n)c+=n.length,r[i]=!1,i++;else throw new O("illegal character encountered: "+e.substring(c));if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new O("row lengths do not match");a++}const h=new Ue(o,a);for(let g=0;g<i;g++)r[g]&&h.set(Math.floor(g%o),Math.floor(g/o));return h}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new O("input matrix dimensions do not match");const t=new ce(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,s=this.height;i<s;i++){const o=i*n,a=e.getRow(i,t).getBitArray();for(let c=0;c<n;c++)r[o+c]^=a[c]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,r){if(t<0||e<0)throw new O("Left and top must be nonnegative");if(r<1||n<1)throw new O("Height and width must be at least 1");const i=e+n,s=t+r;if(s>this.height||i>this.width)throw new O("The region must fit inside the matrix");const o=this.rowSize,a=this.bits;for(let c=t;c<s;c++){const h=c*o;for(let g=e;g<i;g++)a[h+Math.floor(g/32)]|=1<<(g&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new ce(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let s=0;s<n;s++)t.setBulk(s*32,r[i+s]);return t}setRow(e,t){K.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new ce(e),r=new ce(e);for(let i=0,s=Math.floor((t+1)/2);i<s;i++)n=this.getRow(i,n),r=this.getRow(t-1-i,r),n.reverse(),r.reverse(),this.setRow(i,r),this.setRow(t-1-i,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,s=t,o=-1,a=-1;for(let c=0;c<t;c++)for(let h=0;h<n;h++){const g=r[c*n+h];if(g!==0){if(c<s&&(s=c),c>a&&(a=c),h*32<i){let A=0;for(;(g<<31-A&4294967295)===0;)A++;h*32+A<i&&(i=h*32+A)}if(h*32+31>o){let A=31;for(;!(g>>>A);)A--;h*32+A>o&&(o=h*32+A)}}}return o<i||a<s?null:Int32Array.from([i,s,o-i+1,a-s+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const s=t[n];let o=0;for(;(s<<31-o&4294967295)===0;)o++;return i+=o,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;const r=Math.floor(n/e);let i=Math.floor(n%e)*32;const s=t[n];let o=31;for(;!(s>>>o);)o--;return i+=o,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof Ue))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&le.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+le.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|
3
3
|
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new Ae;for(let i=0,s=this.height;i<s;i++){for(let o=0,a=this.width;o<a;o++)r.append(this.get(o,i)?e:t);r.append(n)}return r.toString()}clone(){return new Ue(this.width,this.height,this.rowSize,this.bits.slice())}}class R extends C{static getNotFoundInstance(){return new R}}R.kind="NotFoundException";class He extends Be{constructor(e){super(e),this.luminances=He.EMPTY,this.buckets=new Int32Array(He.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new ce(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),s=this.buckets;for(let a=0;a<r;a++)s[(i[a]&255)>>He.LUMINANCE_SHIFT]++;const o=He.estimateBlackPoint(s);if(r<3)for(let a=0;a<r;a++)(i[a]&255)<o&&t.set(a);else{let a=i[0]&255,c=i[1]&255;for(let h=1;h<r-1;h++){const g=i[h+1]&255;(c*4-a-g)/2<o&&t.set(h),a=c,c=g}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new Ue(t,n);this.initArrays(t);const i=this.buckets;for(let a=1;a<5;a++){const c=Math.floor(n*a/5),h=e.getRow(c,this.luminances),g=Math.floor(t*4/5);for(let A=Math.floor(t/5);A<g;A++){const m=h[A]&255;i[m>>He.LUMINANCE_SHIFT]++}}const s=He.estimateBlackPoint(i),o=e.getMatrix();for(let a=0;a<n;a++){const c=a*t;for(let h=0;h<t;h++)(o[c+h]&255)<s&&r.set(h,a)}return r}createBinarizer(e){return new He(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<He.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let h=0;h<t;h++)e[h]>i&&(r=h,i=e[h]),e[h]>n&&(n=e[h]);let s=0,o=0;for(let h=0;h<t;h++){const g=h-r,A=e[h]*g*g;A>o&&(s=h,o=A)}if(r>s){const h=r;r=s,s=h}if(s-r<=t/16)throw new R;let a=s-1,c=-1;for(let h=s-1;h>r;h--){const g=h-r,A=g*g*(s-h)*(n-e[h]);A>c&&(a=h,c=A)}return a<<He.LUMINANCE_SHIFT}}He.LUMINANCE_BITS=5,He.LUMINANCE_SHIFT=8-He.LUMINANCE_BITS,He.LUMINANCE_BUCKETS=1<<He.LUMINANCE_BITS,He.EMPTY=Uint8ClampedArray.from([0]);class ee extends He{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=ee.MINIMUM_DIMENSION&&n>=ee.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>ee.BLOCK_SIZE_POWER;(t&ee.BLOCK_SIZE_MASK)!==0&&i++;let s=n>>ee.BLOCK_SIZE_POWER;(n&ee.BLOCK_SIZE_MASK)!==0&&s++;const o=ee.calculateBlackPoints(r,i,s,t,n),a=new Ue(t,n);ee.calculateThresholdForBlock(r,i,s,t,n,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new ee(e)}static calculateThresholdForBlock(e,t,n,r,i,s,o){const a=i-ee.BLOCK_SIZE,c=r-ee.BLOCK_SIZE;for(let h=0;h<n;h++){let g=h<<ee.BLOCK_SIZE_POWER;g>a&&(g=a);const A=ee.cap(h,2,n-3);for(let m=0;m<t;m++){let I=m<<ee.BLOCK_SIZE_POWER;I>c&&(I=c);const S=ee.cap(m,2,t-3);let y=0;for(let P=-2;P<=2;P++){const F=s[A+P];y+=F[S-2]+F[S-1]+F[S]+F[S+1]+F[S+2]}const M=y/25;ee.thresholdBlock(e,I,g,M,r,o)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,s){for(let o=0,a=n*i+t;o<ee.BLOCK_SIZE;o++,a+=i)for(let c=0;c<ee.BLOCK_SIZE;c++)(e[a+c]&255)<=r&&s.set(t+c,n+o)}static calculateBlackPoints(e,t,n,r,i){const s=i-ee.BLOCK_SIZE,o=r-ee.BLOCK_SIZE,a=new Array(n);for(let c=0;c<n;c++){a[c]=new Int32Array(t);let h=c<<ee.BLOCK_SIZE_POWER;h>s&&(h=s);for(let g=0;g<t;g++){let A=g<<ee.BLOCK_SIZE_POWER;A>o&&(A=o);let m=0,I=255,S=0;for(let M=0,P=h*r+A;M<ee.BLOCK_SIZE;M++,P+=r){for(let F=0;F<ee.BLOCK_SIZE;F++){const v=e[P+F]&255;m+=v,v<I&&(I=v),v>S&&(S=v)}if(S-I>ee.MIN_DYNAMIC_RANGE)for(M++,P+=r;M<ee.BLOCK_SIZE;M++,P+=r)for(let F=0;F<ee.BLOCK_SIZE;F++)m+=e[P+F]&255}let y=m>>ee.BLOCK_SIZE_POWER*2;if(S-I<=ee.MIN_DYNAMIC_RANGE&&(y=I/2,c>0&&g>0)){const M=(a[c-1][g]+2*a[c][g-1]+a[c-1][g-1])/4;I<M&&(y=M)}a[c][g]=y}}return a}}ee.BLOCK_SIZE_POWER=3,ee.BLOCK_SIZE=1<<ee.BLOCK_SIZE_POWER,ee.BLOCK_SIZE_MASK=ee.BLOCK_SIZE-1,ee.MINIMUM_DIMENSION=ee.BLOCK_SIZE*5,ee.MIN_DYNAMIC_RANGE=24;class cn{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,r){throw new Qt("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new Qt("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new Qt("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new Ae;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let i=0;i<this.width;i++){const s=r[i]&255;let o;s<64?o="#":s<128?o="+":s<192?o=".":o=" ",t.append(o)}t.append(`
|
|
4
4
|
`)}return t.toString()}}class Dt extends cn{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let i=0;i<r;i++)n[i]=255-(n[i]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new Dt(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Dt(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Dt(this.delegate.rotateCounterClockwise45())}}class Rt extends cn{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=Rt.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return Rt.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let i=0,s=0,o=e.length;i<o;i+=4,s++){let a;if(e[i+3]===0)a=255;else{const h=e[i],g=e[i+1],A=e[i+2];a=306*h+601*g+117*A+512>>10}r[s]=a}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),r=e*Rt.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*s),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*s);return t.width=o,t.height=a,n.translate(o/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,s/-2),this.buffer=Rt.makeBufferFromCanvasImageData(t),this}invert(){return new Dt(this)}}Rt.DEGREE_TO_RADIANS=Math.PI/180;class lr{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var qe=(globalThis||vn||self||window||void 0)&&(globalThis||vn||self||window||void 0).__awaiter||function(d,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(h){try{c(n.next(h))}catch(g){s(g)}}function a(h){try{c(n.throw(h))}catch(g){s(g)}}function c(h){h.done?i(h.value):r(h.value).then(o,a)}c((n=n.apply(d,e||[])).next())})};class zt{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return qe(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 e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;const i=n.deviceId||n.id,s=n.label||`Video device ${t.length+1}`,o=n.groupId,a={deviceId:i,label:s,kind:r,groupId:o};t.push(a)}return t})}getVideoInputDevices(){return qe(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new lr(t.deviceId,t.label))})}findDeviceById(e){return qe(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return qe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return qe(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return qe(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return qe(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return qe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return qe(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}decodeFromConstraints(e,t,n){return qe(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return qe(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return qe(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return qe(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new _(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new _(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new _("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new _("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new _("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new _("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new _("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new _("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new _("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new _("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return qe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return qe(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,s)=>{if(this._stopAsyncDecode){s(new R("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const o=this.decode(e);i(o)}catch(o){const a=t&&o instanceof R,h=(o instanceof J||o instanceof U)&&n;if(a||h)return setTimeout(r,this._timeBetweenDecodingAttempts,i,s);s(o)}};return new Promise((i,s)=>r(i,s))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);const i=r instanceof J||r instanceof U,s=r instanceof R;(i||s)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return e.videoWidth!==0}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);const t=this.getCaptureCanvas(e),n=new Rt(t),r=new ee(n);return new ie(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class Je{constructor(e,t,n=t==null?0:8*t.length,r,i,s=K.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=s,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=i,this.resultMetadata=null,s==null?this.timestamp=K.currentTimeMillis():this.timestamp=s}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){const n=new Array(t.length+e.length);K.arraycopy(t,0,n,0,t.length),K.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var kn;(function(d){d[d.AZTEC=0]="AZTEC",d[d.CODABAR=1]="CODABAR",d[d.CODE_39=2]="CODE_39",d[d.CODE_93=3]="CODE_93",d[d.CODE_128=4]="CODE_128",d[d.DATA_MATRIX=5]="DATA_MATRIX",d[d.EAN_8=6]="EAN_8",d[d.EAN_13=7]="EAN_13",d[d.ITF=8]="ITF",d[d.MAXICODE=9]="MAXICODE",d[d.PDF_417=10]="PDF_417",d[d.QR_CODE=11]="QR_CODE",d[d.RSS_14=12]="RSS_14",d[d.RSS_EXPANDED=13]="RSS_EXPANDED",d[d.UPC_A=14]="UPC_A",d[d.UPC_E=15]="UPC_E",d[d.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(kn||(kn={}));var Y=kn,Un;(function(d){d[d.OTHER=0]="OTHER",d[d.ORIENTATION=1]="ORIENTATION",d[d.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",d[d.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",d[d.ISSUE_NUMBER=4]="ISSUE_NUMBER",d[d.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",d[d.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",d[d.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",d[d.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",d[d.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",d[d.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Un||(Un={}));var Ve=Un;class ln{constructor(e,t,n,r,i=-1,s=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class un{exp(e){return this.expTable[e]}log(e){if(e===0)throw new O;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class nt{constructor(e,t){if(t.length===0)throw new O;this.field=e;const n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),K.arraycopy(t,r,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);const t=this.coefficients;let n;if(e===1){n=0;for(let s=0,o=t.length;s!==o;s++){const a=t[s];n=un.addOrSubtract(n,a)}return n}n=t[0];const r=t.length,i=this.field;for(let s=1;s<r;s++)n=un.addOrSubtract(i.multiply(e,n),t[s]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new O("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const s=t;t=n,n=s}let r=new Int32Array(n.length);const i=n.length-t.length;K.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=un.addOrSubtract(t[s-i],n[s]);return new nt(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new O("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1),o=this.field;for(let a=0;a<n;a++){const c=t[a];for(let h=0;h<i;h++)s[a+h]=un.addOrSubtract(s[a+h],o.multiply(c,r[h]))}return new nt(o,s)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let s=0;s<t;s++)r[s]=n.multiply(i[s],e);return new nt(n,r)}multiplyByMonomial(e,t){if(e<0)throw new O;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),s=this.field;for(let o=0;o<r;o++)i[o]=s.multiply(n[o],t);return new nt(s,i)}divide(e){if(!this.field.equals(e.field))throw new O("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new O("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),s=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const o=r.getDegree()-e.getDegree(),a=t.multiply(r.getCoefficient(r.getDegree()),s),c=e.multiplyByMonomial(o,a),h=t.buildMonomial(o,a);n=n.addOrSubtract(h),r=r.addOrSubtract(c)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){const r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class In extends C{}In.kind="ArithmeticException";class ue extends un{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let o=0;o<t;o++)r[o]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const s=new Int32Array(t);for(let o=0;o<t-1;o++)s[r[o]]=o;this.logTable=s,this.zero=new nt(this,Int32Array.from([0])),this.one=new nt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new O;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new nt(this,n)}inverse(e){if(e===0)throw new In;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+Q.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ue.AZTEC_DATA_12=new ue(4201,4096,1),ue.AZTEC_DATA_10=new ue(1033,1024,1),ue.AZTEC_DATA_6=new ue(67,64,1),ue.AZTEC_PARAM=new ue(19,16,1),ue.QR_CODE_FIELD_256=new ue(285,256,0),ue.DATA_MATRIX_FIELD_256=new ue(301,256,1),ue.AZTEC_DATA_8=ue.DATA_MATRIX_FIELD_256,ue.MAXICODE_FIELD_64=ue.AZTEC_DATA_6;class Kt extends C{}Kt.kind="ReedSolomonException";class pt extends C{}pt.kind="IllegalStateException";class hn{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new nt(n,e),i=new Int32Array(t);let s=!0;for(let m=0;m<t;m++){const I=r.evaluateAt(n.exp(m+n.getGeneratorBase()));i[i.length-1-m]=I,I!==0&&(s=!1)}if(s)return;const o=new nt(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),o,t),c=a[0],h=a[1],g=this.findErrorLocations(c),A=this.findErrorMagnitudes(h,g);for(let m=0;m<g.length;m++){const I=e.length-1-n.log(g[m]);if(I<0)throw new Kt("Bad error location");e[I]=ue.addOrSubtract(e[I],A[m])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const m=e;e=t,t=m}const r=this.field;let i=e,s=t,o=r.getZero(),a=r.getOne();for(;s.getDegree()>=(n/2|0);){let m=i,I=o;if(i=s,o=a,i.isZero())throw new Kt("r_{i-1} was zero");s=m;let S=r.getZero();const y=i.getCoefficient(i.getDegree()),M=r.inverse(y);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){const P=s.getDegree()-i.getDegree(),F=r.multiply(s.getCoefficient(s.getDegree()),M);S=S.addOrSubtract(r.buildMonomial(P,F)),s=s.addOrSubtract(i.multiplyByMonomial(P,F))}if(a=S.multiply(o).addOrSubtract(I),s.getDegree()>=i.getDegree())throw new pt("Division algorithm failed to reduce polynomial?")}const c=a.getCoefficient(0);if(c===0)throw new Kt("sigmaTilde(0) was zero");const h=r.inverse(c),g=a.multiplyScalar(h),A=s.multiplyScalar(h);return[g,A]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let s=1;s<i.getSize()&&r<t;s++)e.evaluateAt(s)===0&&(n[r]=i.inverse(s),r++);if(r!==t)throw new Kt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let s=0;s<n;s++){const o=i.inverse(t[s]);let a=1;for(let c=0;c<n;c++)if(s!==c){const h=i.multiply(t[c],o),g=(h&1)===0?h|1:h&-2;a=i.multiply(a,g)}r[s]=i.multiply(e.evaluateAt(o),i.inverse(a)),i.getGeneratorBase()!==0&&(r[s]=i.multiply(r[s],o))}return r}}var je;(function(d){d[d.UPPER=0]="UPPER",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.DIGIT=3]="DIGIT",d[d.PUNCT=4]="PUNCT",d[d.BINARY=5]="BINARY"})(je||(je={}));class Se{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=Se.convertBoolArrayToByteArray(r),s=Se.getEncodedData(r),o=new ln(i,s,null,null);return o.setNumBits(r.length),o}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=je.UPPER,r=je.UPPER,i="",s=0;for(;s<t;)if(r===je.BINARY){if(t-s<5)break;let o=Se.readCode(e,s,5);if(s+=5,o===0){if(t-s<11)break;o=Se.readCode(e,s,11)+31,s+=11}for(let a=0;a<o;a++){if(t-s<8){s=t;break}const c=Se.readCode(e,s,8);i+=q.castAsNonUtf8Char(c),s+=8}r=n}else{let o=r===je.DIGIT?4:5;if(t-s<o)break;let a=Se.readCode(e,s,o);s+=o;let c=Se.getCharacter(r,a);c.startsWith("CTRL_")?(n=r,r=Se.getTable(c.charAt(5)),c.charAt(6)==="L"&&(n=r)):(i+=c,r=n)}return i}static getTable(e){switch(e){case"L":return je.LOWER;case"P":return je.PUNCT;case"M":return je.MIXED;case"D":return je.DIGIT;case"B":return je.BINARY;case"U":default:return je.UPPER}}static getCharacter(e,t){switch(e){case je.UPPER:return Se.UPPER_TABLE[t];case je.LOWER:return Se.LOWER_TABLE[t];case je.MIXED:return Se.MIXED_TABLE[t];case je.PUNCT:return Se.PUNCT_TABLE[t];case je.DIGIT:return Se.DIGIT_TABLE[t];default:throw new pt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=ue.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=ue.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=ue.AZTEC_DATA_10):(n=12,t=ue.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new U;let s=e.length%n,o=new Int32Array(i);for(let A=0;A<i;A++,s+=n)o[A]=Se.readCode(e,s,n);try{new hn(t).decode(o,i-r)}catch(A){throw new U(A)}let a=(1<<n)-1,c=0;for(let A=0;A<r;A++){let m=o[A];if(m===0||m===a)throw new U;(m===1||m===a-1)&&c++}let h=new Array(r*n-c),g=0;for(let A=0;A<r;A++){let m=o[A];if(m===1||m===a-1)h.fill(m>1,g,g+n-1),g+=n-1;else for(let I=n-1;I>=0;--I)h[g++]=(m&1<<I)!==0}return h}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,i=new Int32Array(r),s=new Array(this.totalBitsInLayer(n,t));if(t)for(let o=0;o<i.length;o++)i[o]=o;else{let o=r+1+2*Q.truncDivision(Q.truncDivision(r,2)-1,15),a=r/2,c=Q.truncDivision(o,2);for(let h=0;h<a;h++){let g=h+Q.truncDivision(h,15);i[a-h-1]=c-g-1,i[a+h]=c+g+1}}for(let o=0,a=0;o<n;o++){let c=(n-o)*4+(t?9:12),h=o*2,g=r-1-h;for(let A=0;A<c;A++){let m=A*2;for(let I=0;I<2;I++)s[a+m+I]=e.get(i[h+I],i[h+A]),s[a+2*c+m+I]=e.get(i[h+A],i[g-I]),s[a+4*c+m+I]=e.get(i[g-I],i[g-A]),s[a+6*c+m+I]=e.get(i[g-A],i[h+I])}a+=c*8}return s}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?Se.readCode(e,t,8):Se.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=Se.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Se.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"],Se.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"],Se.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|