vue3-barcode-qrcode-reader
Version:
Vue 3 barcodes and QR codes scanner
1,135 lines (1,134 loc) • 624 kB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".scanner__container[data-v-c4f5ee33]{position:relative}.scanner__container .content[data-v-c4f5ee33]{display:flex;min-height:100vh;width:100%;align-items:center;justify-content:center}.scanner__container .content video[data-v-c4f5ee33]{height:100%;width:100%}.scanner__container .container-btn-stop[data-v-c4f5ee33]{position:absolute;top:90%;left:50%;margin:auto;transform:translate(-50%,-50%)}.scanner__container .container-btn-stop button.btn-stop[data-v-c4f5ee33]{height:2.5rem;width:2.5rem;border-radius:9999px;border-width:4px;--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;transition-delay:75ms;animation:blink-c4f5ee33 1s infinite}@keyframes blink-c4f5ee33{0%{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}50%{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}to{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}}.scanner__container .container-btn-stop button.btn-stop[data-v-c4f5ee33]:hover{border-width:4px;--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity));animation:none}.scanner__container .container-btn-facemode[data-v-c4f5ee33]{position:absolute;top:90%;left:15%;margin:auto;transform:translate(-50%,-50%)}.scanner__container .container-btn-facemode button.btn-facemode[data-v-c4f5ee33]{display:inline-flex;height:2.5rem;width:2.5rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity));padding:.375rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;transition-delay:75ms}.scanner__container .container-btn-facemode button.btn-facemode[data-v-c4f5ee33]:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(229 231 235 / var(--tw-ring-opacity)) }.scanner__container .btn-stream[data-v-c4f5ee33]{border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity));padding:.625rem 1.25rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.scanner__container .btn-stream[data-v-c4f5ee33]:hover{--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity))}.scanner__container .btn-stream[data-v-c4f5ee33]:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity)) }.scanner__container .btn-reset[data-v-c4f5ee33]{margin-inline-start:.5rem;border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity));padding:.625rem 1.25rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.scanner__container .btn-reset[data-v-c4f5ee33]:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.scanner__container .btn-reset[data-v-c4f5ee33]:focus{outline:2px solid transparent;outline-offset:2px}")),document.head.appendChild(t)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
import { getCurrentInstance as kr, onMounted as We, nextTick as en, getCurrentScope as rn, onScopeDispose as nn, unref as an, ref as mt, watch as ze, watchEffect as on, computed as be, openBlock as Kt, createElementBlock as qt, createElementVNode as bt, defineComponent as fn, onBeforeUnmount as sn, normalizeClass as un, withDirectives as cn, vShow as ln, Fragment as hn, renderSlot as _e, createVNode as dn, createCommentVNode as rr } from "vue";
function Ur(r) {
return rn() ? (nn(r), !0) : !1;
}
function Ye(r) {
return typeof r == "function" ? r() : an(r);
}
const vn = typeof window < "u" && typeof document < "u";
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const pn = Object.prototype.toString, gn = (r) => pn.call(r) === "[object Object]", xn = () => {
};
function yn(r, t = !0) {
kr() ? We(r) : t ? r() : en(r);
}
function _n(r) {
var t;
const e = Ye(r);
return (t = e == null ? void 0 : e.$el) != null ? t : e;
}
const je = vn ? window : void 0;
function wn(...r) {
let t, e, n, i;
if (typeof r[0] == "string" || Array.isArray(r[0]) ? ([e, n, i] = r, t = je) : [t, e, n, i] = r, !t)
return xn;
Array.isArray(e) || (e = [e]), Array.isArray(n) || (n = [n]);
const a = [], o = () => {
a.forEach((c) => c()), a.length = 0;
}, f = (c, l, h, d) => (c.addEventListener(l, h, d), () => c.removeEventListener(l, h, d)), s = ze(
() => [_n(t), Ye(i)],
([c, l]) => {
if (o(), !c)
return;
const h = gn(l) ? { ...l } : l;
a.push(
...e.flatMap((d) => n.map((v) => f(c, d, v, h)))
);
},
{ immediate: !0, flush: "post" }
), u = () => {
s(), o();
};
return Ur(u), u;
}
function An() {
const r = mt(!1);
return kr() && We(() => {
r.value = !0;
}), r;
}
function En(r) {
const t = An();
return be(() => (t.value, !!r()));
}
function Cn(r, t = {}) {
const { window: e = je } = t, n = En(() => e && "matchMedia" in e && typeof e.matchMedia == "function");
let i;
const a = mt(!1), o = (u) => {
a.value = u.matches;
}, f = () => {
i && ("removeEventListener" in i ? i.removeEventListener("change", o) : i.removeListener(o));
}, s = on(() => {
n.value && (f(), i = e.matchMedia(Ye(r)), "addEventListener" in i ? i.addEventListener("change", o) : i.addListener(o), a.value = i.matches);
});
return Ur(() => {
s(), f(), i = void 0;
}), a;
}
function In(r = {}) {
const {
window: t = je,
initialWidth: e = Number.POSITIVE_INFINITY,
initialHeight: n = Number.POSITIVE_INFINITY,
listenOrientation: i = !0,
includeScrollbar: a = !0
} = r, o = mt(e), f = mt(n), s = () => {
t && (a ? (o.value = t.innerWidth, f.value = t.innerHeight) : (o.value = t.document.documentElement.clientWidth, f.value = t.document.documentElement.clientHeight));
};
if (s(), yn(s), wn("resize", s, { passive: !0 }), i) {
const u = Cn("(orientation: portrait)");
ze(u, () => s());
}
return { width: o, height: f };
}
const Hr = (r, t) => {
const e = r.__vccOpts || r;
for (const [n, i] of t)
e[n] = i;
return e;
}, Sn = {}, mn = {
xmlns: "http://www.w3.org/2000/svg",
width: "32",
height: "32",
viewBox: "0 0 24 24"
}, Tn = /* @__PURE__ */ bt("g", {
fill: "none",
stroke: "currentColor",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"stroke-width": "1.5"
}, [
/* @__PURE__ */ bt("path", { d: "M22.003 3v4.497A.503.503 0 0 1 21.5 8v0c-.2 0-.38-.119-.466-.3A10.001 10.001 0 0 0 12.003 2c-5.186 0-9.45 3.947-9.95 9" }),
/* @__PURE__ */ bt("path", { d: "M6 16.4V9.394a.6.6 0 0 1 .6-.6h1.173a.6.6 0 0 0 .504-.275l1.446-2.244A.6.6 0 0 1 10.227 6h3.546a.6.6 0 0 1 .504.275l1.446 2.244a.6.6 0 0 0 .504.275H17.4a.6.6 0 0 1 .6.6V16.4a.6.6 0 0 1-.6.6H6.6a.6.6 0 0 1-.6-.6Z" }),
/* @__PURE__ */ bt("path", { d: "M12 14a2 2 0 1 0 0-4a2 2 0 0 0 0 4Zm-9.95 7v-4.497c0-.278.226-.503.504-.503v0c.2 0 .38.119.466.3a10.001 10.001 0 0 0 9.03 5.7c5.186 0 9.45-3.947 9.951-9" })
], -1), On = [
Tn
];
function bn(r, t) {
return Kt(), qt("svg", mn, On);
}
const Dn = /* @__PURE__ */ Hr(Sn, [["render", bn]]);
function Nn(r, t) {
var e = Object.setPrototypeOf;
e ? e(r, t) : r.__proto__ = t;
}
function Rn(r, t) {
t === void 0 && (t = r.constructor);
var e = Error.captureStackTrace;
e && e(r, t);
}
var Pn = function() {
var r = function(e, n) {
return r = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(i, a) {
i.__proto__ = a;
} || function(i, a) {
for (var o in a)
Object.prototype.hasOwnProperty.call(a, o) && (i[o] = a[o]);
}, r(e, n);
};
return function(t, e) {
if (typeof e != "function" && e !== null)
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), Mn = function(r) {
Pn(t, r);
function t(e, n) {
var i = this.constructor, a = r.call(this, e, n) || this;
return Object.defineProperty(a, "name", {
value: i.name,
enumerable: !1,
configurable: !0
}), Nn(a, i.prototype), Rn(a), a;
}
return t;
}(Error), Bn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), gt = (
/** @class */
function(r) {
Bn(t, r);
function t(e) {
e === void 0 && (e = void 0);
var n = r.call(this, e) || this;
return n.message = e, n;
}
return t.prototype.getKind = function() {
var e = this.constructor;
return e.kind;
}, t.kind = "Exception", t;
}(Mn)
), Fn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), St = (
/** @class */
function(r) {
Fn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "ArgumentException", t;
}(gt)
), Ln = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), P = (
/** @class */
function(r) {
Ln(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "IllegalArgumentException", t;
}(gt)
), kn = (
/** @class */
function() {
function r(t) {
if (this.binarizer = t, t === null)
throw new P("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(t, e) {
return this.binarizer.getBlackRow(t, e);
}, 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(t, e, n, i) {
var a = this.binarizer.getLuminanceSource().crop(t, e, n, i);
return new r(this.binarizer.createBinarizer(a));
}, r.prototype.isRotateSupported = function() {
return this.binarizer.getLuminanceSource().isRotateSupported();
}, r.prototype.rotateCounterClockwise = function() {
var t = this.binarizer.getLuminanceSource().rotateCounterClockwise();
return new r(this.binarizer.createBinarizer(t));
}, r.prototype.rotateCounterClockwise45 = function() {
var t = this.binarizer.getLuminanceSource().rotateCounterClockwise45();
return new r(this.binarizer.createBinarizer(t));
}, r.prototype.toString = function() {
try {
return this.getBlackMatrix().toString();
} catch {
return "";
}
}, r;
}()
), Un = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), ot = (
/** @class */
function(r) {
Un(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getChecksumInstance = function() {
return new t();
}, t.kind = "ChecksumException", t;
}(gt)
), Hn = (
/** @class */
function() {
function r(t) {
this.source = t;
}
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;
}()
), Y = (
/** @class */
function() {
function r() {
}
return r.arraycopy = function(t, e, n, i, a) {
for (; a--; )
n[i++] = t[e++];
}, r.currentTimeMillis = function() {
return Date.now();
}, r;
}()
), Vn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), Ze = (
/** @class */
function(r) {
Vn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "IndexOutOfBoundsException", t;
}(gt)
), Gn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), nr = (
/** @class */
function(r) {
Gn(t, r);
function t(e, n) {
e === void 0 && (e = void 0), n === void 0 && (n = void 0);
var i = r.call(this, n) || this;
return i.index = e, i.message = n, i;
}
return t.kind = "ArrayIndexOutOfBoundsException", t;
}(Ze)
), Xn = globalThis && globalThis.__values || function(r) {
var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], n = 0;
if (e)
return e.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(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}, rt = (
/** @class */
function() {
function r() {
}
return r.fill = function(t, e) {
for (var n = 0, i = t.length; n < i; n++)
t[n] = e;
}, r.fillWithin = function(t, e, n, i) {
r.rangeCheck(t.length, e, n);
for (var a = e; a < n; a++)
t[a] = i;
}, r.rangeCheck = function(t, e, n) {
if (e > n)
throw new P("fromIndex(" + e + ") > toIndex(" + n + ")");
if (e < 0)
throw new nr(e);
if (n > t)
throw new nr(n);
}, r.asList = function() {
for (var t = [], e = 0; e < arguments.length; e++)
t[e] = arguments[e];
return t;
}, r.create = function(t, e, n) {
var i = Array.from({ length: t });
return i.map(function(a) {
return Array.from({ length: e }).fill(n);
});
}, r.createInt32Array = function(t, e, n) {
var i = Array.from({ length: t });
return i.map(function(a) {
return Int32Array.from({ length: e }).fill(n);
});
}, r.equals = function(t, e) {
if (!t || !e || !t.length || !e.length || t.length !== e.length)
return !1;
for (var n = 0, i = t.length; n < i; n++)
if (t[n] !== e[n])
return !1;
return !0;
}, r.hashCode = function(t) {
var e, n;
if (t === null)
return 0;
var i = 1;
try {
for (var a = Xn(t), o = a.next(); !o.done; o = a.next()) {
var f = o.value;
i = 31 * i + f;
}
} catch (s) {
e = { error: s };
} finally {
try {
o && !o.done && (n = a.return) && n.call(a);
} finally {
if (e)
throw e.error;
}
}
return i;
}, r.fillUint8Array = function(t, e) {
for (var n = 0; n !== t.length; n++)
t[n] = e;
}, r.copyOf = function(t, e) {
return t.slice(0, e);
}, r.copyOfUint8Array = function(t, e) {
if (t.length <= e) {
var n = new Uint8Array(e);
return n.set(t), n;
}
return t.slice(0, e);
}, r.copyOfRange = function(t, e, n) {
var i = n - e, a = new Int32Array(i);
return Y.arraycopy(t, e, a, 0, i), a;
}, r.binarySearch = function(t, e, n) {
n === void 0 && (n = r.numberComparator);
for (var i = 0, a = t.length - 1; i <= a; ) {
var o = a + i >> 1, f = n(e, t[o]);
if (f > 0)
i = o + 1;
else if (f < 0)
a = o - 1;
else
return o;
}
return -i - 1;
}, r.numberComparator = function(t, e) {
return t - e;
}, r;
}()
), B = (
/** @class */
function() {
function r() {
}
return r.numberOfTrailingZeros = function(t) {
var e;
if (t === 0)
return 32;
var n = 31;
return e = t << 16, e !== 0 && (n -= 16, t = e), e = t << 8, e !== 0 && (n -= 8, t = e), e = t << 4, e !== 0 && (n -= 4, t = e), e = t << 2, e !== 0 && (n -= 2, t = e), n - (t << 1 >>> 31);
}, r.numberOfLeadingZeros = function(t) {
if (t === 0)
return 32;
var e = 1;
return t >>> 16 || (e += 16, t <<= 16), t >>> 24 || (e += 8, t <<= 8), t >>> 28 || (e += 4, t <<= 4), t >>> 30 || (e += 2, t <<= 2), e -= t >>> 31, e;
}, r.toHexString = function(t) {
return t.toString(16);
}, r.toBinaryString = function(t) {
return String(parseInt(String(t), 2));
}, r.bitCount = function(t) {
return t = t - (t >>> 1 & 1431655765), t = (t & 858993459) + (t >>> 2 & 858993459), t = t + (t >>> 4) & 252645135, t = t + (t >>> 8), t = t + (t >>> 16), t & 63;
}, r.truncDivision = function(t, e) {
return Math.trunc(t / e);
}, r.parseInt = function(t, e) {
return e === void 0 && (e = void 0), parseInt(t, e);
}, r.MIN_VALUE_32_BITS = -2147483648, r.MAX_VALUE = Number.MAX_SAFE_INTEGER, r;
}()
), ft = (
/** @class */
function() {
function r(t, e) {
t === void 0 ? (this.size = 0, this.bits = new Int32Array(1)) : (this.size = t, e == null ? this.bits = r.makeArray(t) : this.bits = e);
}
return r.prototype.getSize = function() {
return this.size;
}, r.prototype.getSizeInBytes = function() {
return Math.floor((this.size + 7) / 8);
}, r.prototype.ensureCapacity = function(t) {
if (t > this.bits.length * 32) {
var e = r.makeArray(t);
Y.arraycopy(this.bits, 0, e, 0, this.bits.length), this.bits = e;
}
}, r.prototype.get = function(t) {
return (this.bits[Math.floor(t / 32)] & 1 << (t & 31)) !== 0;
}, r.prototype.set = function(t) {
this.bits[Math.floor(t / 32)] |= 1 << (t & 31);
}, r.prototype.flip = function(t) {
this.bits[Math.floor(t / 32)] ^= 1 << (t & 31);
}, r.prototype.getNextSet = function(t) {
var e = this.size;
if (t >= e)
return e;
var n = this.bits, i = Math.floor(t / 32), a = n[i];
a &= ~((1 << (t & 31)) - 1);
for (var o = n.length; a === 0; ) {
if (++i === o)
return e;
a = n[i];
}
var f = i * 32 + B.numberOfTrailingZeros(a);
return f > e ? e : f;
}, r.prototype.getNextUnset = function(t) {
var e = this.size;
if (t >= e)
return e;
var n = this.bits, i = Math.floor(t / 32), a = ~n[i];
a &= ~((1 << (t & 31)) - 1);
for (var o = n.length; a === 0; ) {
if (++i === o)
return e;
a = ~n[i];
}
var f = i * 32 + B.numberOfTrailingZeros(a);
return f > e ? e : f;
}, r.prototype.setBulk = function(t, e) {
this.bits[Math.floor(t / 32)] = e;
}, r.prototype.setRange = function(t, e) {
if (e < t || t < 0 || e > this.size)
throw new P();
if (e !== t) {
e--;
for (var n = Math.floor(t / 32), i = Math.floor(e / 32), a = this.bits, o = n; o <= i; o++) {
var f = o > n ? 0 : t & 31, s = o < i ? 31 : e & 31, u = (2 << s) - (1 << f);
a[o] |= u;
}
}
}, r.prototype.clear = function() {
for (var t = this.bits.length, e = this.bits, n = 0; n < t; n++)
e[n] = 0;
}, r.prototype.isRange = function(t, e, n) {
if (e < t || t < 0 || e > this.size)
throw new P();
if (e === t)
return !0;
e--;
for (var i = Math.floor(t / 32), a = Math.floor(e / 32), o = this.bits, f = i; f <= a; f++) {
var s = f > i ? 0 : t & 31, u = f < a ? 31 : e & 31, c = (2 << u) - (1 << s) & 4294967295;
if ((o[f] & c) !== (n ? c : 0))
return !1;
}
return !0;
}, r.prototype.appendBit = function(t) {
this.ensureCapacity(this.size + 1), t && (this.bits[Math.floor(this.size / 32)] |= 1 << (this.size & 31)), this.size++;
}, r.prototype.appendBits = function(t, e) {
if (e < 0 || e > 32)
throw new P("Num bits must be between 0 and 32");
this.ensureCapacity(this.size + e);
for (var n = e; n > 0; n--)
this.appendBit((t >> n - 1 & 1) === 1);
}, r.prototype.appendBitArray = function(t) {
var e = t.size;
this.ensureCapacity(this.size + e);
for (var n = 0; n < e; n++)
this.appendBit(t.get(n));
}, r.prototype.xor = function(t) {
if (this.size !== t.size)
throw new P("Sizes don't match");
for (var e = this.bits, n = 0, i = e.length; n < i; n++)
e[n] ^= t.bits[n];
}, r.prototype.toBytes = function(t, e, n, i) {
for (var a = 0; a < i; a++) {
for (var o = 0, f = 0; f < 8; f++)
this.get(t) && (o |= 1 << 7 - f), t++;
e[n + a] = /*(byte)*/
o;
}
}, r.prototype.getBitArray = function() {
return this.bits;
}, r.prototype.reverse = function() {
for (var t = new Int32Array(this.bits.length), e = Math.floor((this.size - 1) / 32), n = e + 1, i = this.bits, a = 0; a < n; a++) {
var o = i[a];
o = o >> 1 & 1431655765 | (o & 1431655765) << 1, o = o >> 2 & 858993459 | (o & 858993459) << 2, o = o >> 4 & 252645135 | (o & 252645135) << 4, o = o >> 8 & 16711935 | (o & 16711935) << 8, o = o >> 16 & 65535 | (o & 65535) << 16, t[e - a] = /*(int)*/
o;
}
if (this.size !== n * 32) {
for (var f = n * 32 - this.size, s = t[0] >>> f, a = 1; a < n; a++) {
var u = t[a];
s |= u << 32 - f, t[a - 1] = s, s = u >>> f;
}
t[n - 1] = s;
}
this.bits = t;
}, r.makeArray = function(t) {
return new Int32Array(Math.floor((t + 31) / 32));
}, r.prototype.equals = function(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.size === e.size && rt.equals(this.bits, e.bits);
}, r.prototype.hashCode = function() {
return 31 * this.size + rt.hashCode(this.bits);
}, r.prototype.toString = function() {
for (var t = "", e = 0, n = this.size; e < n; e++)
e & 7 || (t += " "), t += this.get(e) ? "X" : ".";
return t;
}, r.prototype.clone = function() {
return new r(this.size, this.bits.slice());
}, r.prototype.toArray = function() {
for (var t = [], e = 0, n = this.size; e < n; e++)
t.push(this.get(e));
return t;
}, r;
}()
), De;
(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";
})(De || (De = {}));
const q = De;
var Wn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), T = (
/** @class */
function(r) {
Wn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getFormatInstance = function() {
return new t();
}, t.kind = "FormatException", t;
}(gt)
), zn = globalThis && globalThis.__values || function(r) {
var t = typeof Symbol == "function" && Symbol.iterator, e = t && r[t], n = 0;
if (e)
return e.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(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}, X;
(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";
})(X || (X = {}));
var et = (
/** @class */
function() {
function r(t, e, n) {
for (var i, a, o = [], f = 3; f < arguments.length; f++)
o[f - 3] = arguments[f];
this.valueIdentifier = t, this.name = n, typeof e == "number" ? this.values = Int32Array.from([e]) : this.values = e, this.otherEncodingNames = o, r.VALUE_IDENTIFIER_TO_ECI.set(t, this), r.NAME_TO_ECI.set(n, this);
for (var s = this.values, u = 0, c = s.length; u !== c; u++) {
var l = s[u];
r.VALUES_TO_ECI.set(l, this);
}
try {
for (var h = zn(o), d = h.next(); !d.done; d = h.next()) {
var v = d.value;
r.NAME_TO_ECI.set(v, this);
}
} catch (g) {
i = { error: g };
} finally {
try {
d && !d.done && (a = h.return) && a.call(h);
} finally {
if (i)
throw i.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(t) {
if (t < 0 || t >= 900)
throw new T("incorect value");
var e = r.VALUES_TO_ECI.get(t);
if (e === void 0)
throw new T("incorect value");
return e;
}, r.getCharacterSetECIByName = function(t) {
var e = r.NAME_TO_ECI.get(t);
if (e === void 0)
throw new T("incorect value");
return e;
}, r.prototype.equals = function(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.getName() === e.getName();
}, r.VALUE_IDENTIFIER_TO_ECI = /* @__PURE__ */ new Map(), r.VALUES_TO_ECI = /* @__PURE__ */ new Map(), r.NAME_TO_ECI = /* @__PURE__ */ new Map(), r.Cp437 = new r(X.Cp437, Int32Array.from([0, 2]), "Cp437"), r.ISO8859_1 = new r(X.ISO8859_1, Int32Array.from([1, 3]), "ISO-8859-1", "ISO88591", "ISO8859_1"), r.ISO8859_2 = new r(X.ISO8859_2, 4, "ISO-8859-2", "ISO88592", "ISO8859_2"), r.ISO8859_3 = new r(X.ISO8859_3, 5, "ISO-8859-3", "ISO88593", "ISO8859_3"), r.ISO8859_4 = new r(X.ISO8859_4, 6, "ISO-8859-4", "ISO88594", "ISO8859_4"), r.ISO8859_5 = new r(X.ISO8859_5, 7, "ISO-8859-5", "ISO88595", "ISO8859_5"), r.ISO8859_6 = new r(X.ISO8859_6, 8, "ISO-8859-6", "ISO88596", "ISO8859_6"), r.ISO8859_7 = new r(X.ISO8859_7, 9, "ISO-8859-7", "ISO88597", "ISO8859_7"), r.ISO8859_8 = new r(X.ISO8859_8, 10, "ISO-8859-8", "ISO88598", "ISO8859_8"), r.ISO8859_9 = new r(X.ISO8859_9, 11, "ISO-8859-9", "ISO88599", "ISO8859_9"), r.ISO8859_10 = new r(X.ISO8859_10, 12, "ISO-8859-10", "ISO885910", "ISO8859_10"), r.ISO8859_11 = new r(X.ISO8859_11, 13, "ISO-8859-11", "ISO885911", "ISO8859_11"), r.ISO8859_13 = new r(X.ISO8859_13, 15, "ISO-8859-13", "ISO885913", "ISO8859_13"), r.ISO8859_14 = new r(X.ISO8859_14, 16, "ISO-8859-14", "ISO885914", "ISO8859_14"), r.ISO8859_15 = new r(X.ISO8859_15, 17, "ISO-8859-15", "ISO885915", "ISO8859_15"), r.ISO8859_16 = new r(X.ISO8859_16, 18, "ISO-8859-16", "ISO885916", "ISO8859_16"), r.SJIS = new r(X.SJIS, 20, "SJIS", "Shift_JIS"), r.Cp1250 = new r(X.Cp1250, 21, "Cp1250", "windows-1250"), r.Cp1251 = new r(X.Cp1251, 22, "Cp1251", "windows-1251"), r.Cp1252 = new r(X.Cp1252, 23, "Cp1252", "windows-1252"), r.Cp1256 = new r(X.Cp1256, 24, "Cp1256", "windows-1256"), r.UnicodeBigUnmarked = new r(X.UnicodeBigUnmarked, 25, "UnicodeBigUnmarked", "UTF-16BE", "UnicodeBig"), r.UTF8 = new r(X.UTF8, 26, "UTF8", "UTF-8"), r.ASCII = new r(X.ASCII, Int32Array.from([27, 170]), "ASCII", "US-ASCII"), r.Big5 = new r(X.Big5, 28, "Big5"), r.GB18030 = new r(X.GB18030, 29, "GB18030", "GB2312", "EUC_CN", "GBK"), r.EUC_KR = new r(X.EUC_KR, 30, "EUC_KR", "EUC-KR"), r;
}()
), Yn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), se = (
/** @class */
function(r) {
Yn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.kind = "UnsupportedOperationException", t;
}(gt)
), Et = (
/** @class */
function() {
function r() {
}
return r.decode = function(t, e) {
var n = this.encodingName(e);
return this.customDecoder ? this.customDecoder(t, n) : typeof TextDecoder > "u" || this.shouldDecodeOnFallback(n) ? this.decodeFallback(t, n) : new TextDecoder(n).decode(t);
}, r.shouldDecodeOnFallback = function(t) {
return !r.isBrowser() && t === "ISO-8859-1";
}, r.encode = function(t, e) {
var n = this.encodingName(e);
return this.customEncoder ? this.customEncoder(t, n) : typeof TextEncoder > "u" ? this.encodeFallback(t) : new TextEncoder().encode(t);
}, r.isBrowser = function() {
return typeof window < "u" && {}.toString.call(window) === "[object Window]";
}, r.encodingName = function(t) {
return typeof t == "string" ? t : t.getName();
}, r.encodingCharacterSet = function(t) {
return t instanceof et ? t : et.getCharacterSetECIByName(t);
}, r.decodeFallback = function(t, e) {
var n = this.encodingCharacterSet(e);
if (r.isDecodeFallbackSupported(n)) {
for (var i = "", a = 0, o = t.length; a < o; a++) {
var f = t[a].toString(16);
f.length < 2 && (f = "0" + f), i += "%" + f;
}
return decodeURIComponent(i);
}
if (n.equals(et.UnicodeBigUnmarked))
return String.fromCharCode.apply(null, new Uint16Array(t.buffer));
throw new se("Encoding " + this.encodingName(e) + " not supported by fallback.");
}, r.isDecodeFallbackSupported = function(t) {
return t.equals(et.UTF8) || t.equals(et.ISO8859_1) || t.equals(et.ASCII);
}, r.encodeFallback = function(t) {
for (var e = btoa(unescape(encodeURIComponent(t))), n = e.split(""), i = [], a = 0; a < n.length; a++)
i.push(n[a].charCodeAt(0));
return new Uint8Array(i);
}, r;
}()
), L = (
/** @class */
function() {
function r() {
}
return r.castAsNonUtf8Char = function(t, e) {
e === void 0 && (e = null);
var n = e ? e.getName() : this.ISO88591;
return Et.decode(new Uint8Array([t]), n);
}, r.guessEncoding = function(t, e) {
if (e != null && e.get(q.CHARACTER_SET) !== void 0)
return e.get(q.CHARACTER_SET).toString();
for (var n = t.length, i = !0, a = !0, o = !0, f = 0, s = 0, u = 0, c = 0, l = 0, h = 0, d = 0, v = 0, g = 0, x = 0, _ = 0, y = t.length > 3 && t[0] === /*(byte) */
239 && t[1] === /*(byte) */
187 && t[2] === /*(byte) */
191, A = 0; A < n && (i || a || o); A++) {
var E = t[A] & 255;
o && (f > 0 ? E & 128 ? f-- : o = !1 : E & 128 && (E & 64 ? (f++, E & 32 ? (f++, E & 16 ? (f++, E & 8 ? o = !1 : c++) : u++) : s++) : o = !1)), i && (E > 127 && E < 160 ? i = !1 : E > 159 && (E < 192 || E === 215 || E === 247) && _++), a && (l > 0 ? E < 64 || E === 127 || E > 252 ? a = !1 : l-- : E === 128 || E === 160 || E > 239 ? a = !1 : E > 160 && E < 224 ? (h++, v = 0, d++, d > g && (g = d)) : E > 127 ? (l++, d = 0, v++, v > x && (x = v)) : (d = 0, v = 0));
}
return o && f > 0 && (o = !1), a && l > 0 && (a = !1), o && (y || s + u + c > 0) ? r.UTF8 : a && (r.ASSUME_SHIFT_JIS || g >= 3 || x >= 3) ? r.SHIFT_JIS : i && a ? g === 2 && h === 2 || _ * 10 >= n ? r.SHIFT_JIS : r.ISO88591 : i ? r.ISO88591 : a ? r.SHIFT_JIS : o ? r.UTF8 : r.PLATFORM_DEFAULT_ENCODING;
}, r.format = function(t) {
for (var e = [], n = 1; n < arguments.length; n++)
e[n - 1] = arguments[n];
var i = -1;
function a(f, s, u, c, l, h) {
if (f === "%%")
return "%";
if (e[++i] !== void 0) {
f = c ? parseInt(c.substr(1)) : void 0;
var d = l ? parseInt(l.substr(1)) : void 0, v;
switch (h) {
case "s":
v = e[i];
break;
case "c":
v = e[i][0];
break;
case "f":
v = parseFloat(e[i]).toFixed(f);
break;
case "p":
v = parseFloat(e[i]).toPrecision(f);
break;
case "e":
v = parseFloat(e[i]).toExponential(f);
break;
case "x":
v = parseInt(e[i]).toString(d || 16);
break;
case "d":
v = parseFloat(parseInt(e[i], d || 10).toPrecision(f)).toFixed(0);
break;
}
v = typeof v == "object" ? JSON.stringify(v) : (+v).toString(d);
for (var g = parseInt(u), x = u && u[0] + "" == "0" ? "0" : " "; v.length < g; )
v = s !== void 0 ? v + x : x + v;
return v;
}
}
var o = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
return t.replace(o, a);
}, r.getBytes = function(t, e) {
return Et.encode(t, e);
}, r.getCharCode = function(t, e) {
return e === void 0 && (e = 0), t.charCodeAt(e);
}, r.getCharAt = function(t) {
return String.fromCharCode(t);
}, r.SHIFT_JIS = et.SJIS.getName(), r.GB2312 = "GB2312", r.ISO88591 = et.ISO8859_1.getName(), r.EUC_JP = "EUC_JP", r.UTF8 = et.UTF8.getName(), r.PLATFORM_DEFAULT_ENCODING = r.UTF8, r.ASSUME_SHIFT_JIS = !1, r;
}()
), M = (
/** @class */
function() {
function r(t) {
t === void 0 && (t = ""), this.value = t;
}
return r.prototype.enableDecoding = function(t) {
return this.encoding = t, this;
}, r.prototype.append = function(t) {
return typeof t == "string" ? this.value += t.toString() : this.encoding ? this.value += L.castAsNonUtf8Char(t, this.encoding) : this.value += String.fromCharCode(t), this;
}, r.prototype.appendChars = function(t, e, n) {
for (var i = e; e < e + n; i++)
this.append(t[i]);
return this;
}, r.prototype.length = function() {
return this.value.length;
}, r.prototype.charAt = function(t) {
return this.value.charAt(t);
}, r.prototype.deleteCharAt = function(t) {
this.value = this.value.substr(0, t) + this.value.substring(t + 1);
}, r.prototype.setCharAt = function(t, e) {
this.value = this.value.substr(0, t) + e + this.value.substr(t + 1);
}, r.prototype.substring = function(t, e) {
return this.value.substring(t, e);
}, r.prototype.setLengthToZero = function() {
this.value = "";
}, r.prototype.toString = function() {
return this.value;
}, r.prototype.insert = function(t, e) {
this.value = this.value.substring(0, t) + e + this.value.substring(t);
}, r;
}()
), Nt = (
/** @class */
function() {
function r(t, e, n, i) {
if (this.width = t, this.height = e, this.rowSize = n, this.bits = i, e == null && (e = t), this.height = e, t < 1 || e < 1)
throw new P("Both dimensions must be greater than 0");
n == null && (n = Math.floor((t + 31) / 32)), this.rowSize = n, i == null && (this.bits = new Int32Array(this.rowSize * this.height));
}
return r.parseFromBooleanArray = function(t) {
for (var e = t.length, n = t[0].length, i = new r(n, e), a = 0; a < e; a++)
for (var o = t[a], f = 0; f < n; f++)
o[f] && i.set(f, a);
return i;
}, r.parseFromString = function(t, e, n) {
if (t === null)
throw new P("stringRepresentation cannot be null");
for (var i = new Array(t.length), a = 0, o = 0, f = -1, s = 0, u = 0; u < t.length; )
if (t.charAt(u) === `
` || t.charAt(u) === "\r") {
if (a > o) {
if (f === -1)
f = a - o;
else if (a - o !== f)
throw new P("row lengths do not match");
o = a, s++;
}
u++;
} else if (t.substring(u, u + e.length) === e)
u += e.length, i[a] = !0, a++;
else if (t.substring(u, u + n.length) === n)
u += n.length, i[a] = !1, a++;
else
throw new P("illegal character encountered: " + t.substring(u));
if (a > o) {
if (f === -1)
f = a - o;
else if (a - o !== f)
throw new P("row lengths do not match");
s++;
}
for (var c = new r(f, s), l = 0; l < a; l++)
i[l] && c.set(Math.floor(l % f), Math.floor(l / f));
return c;
}, r.prototype.get = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
return (this.bits[n] >>> (t & 31) & 1) !== 0;
}, r.prototype.set = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] |= 1 << (t & 31) & 4294967295;
}, r.prototype.unset = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] &= ~(1 << (t & 31) & 4294967295);
}, r.prototype.flip = function(t, e) {
var n = e * this.rowSize + Math.floor(t / 32);
this.bits[n] ^= 1 << (t & 31) & 4294967295;
}, r.prototype.xor = function(t) {
if (this.width !== t.getWidth() || this.height !== t.getHeight() || this.rowSize !== t.getRowSize())
throw new P("input matrix dimensions do not match");
for (var e = new ft(Math.floor(this.width / 32) + 1), n = this.rowSize, i = this.bits, a = 0, o = this.height; a < o; a++)
for (var f = a * n, s = t.getRow(a, e).getBitArray(), u = 0; u < n; u++)
i[f + u] ^= s[u];
}, r.prototype.clear = function() {
for (var t = this.bits, e = t.length, n = 0; n < e; n++)
t[n] = 0;
}, r.prototype.setRegion = function(t, e, n, i) {
if (e < 0 || t < 0)
throw new P("Left and top must be nonnegative");
if (i < 1 || n < 1)
throw new P("Height and width must be at least 1");
var a = t + n, o = e + i;
if (o > this.height || a > this.width)
throw new P("The region must fit inside the matrix");
for (var f = this.rowSize, s = this.bits, u = e; u < o; u++)
for (var c = u * f, l = t; l < a; l++)
s[c + Math.floor(l / 32)] |= 1 << (l & 31) & 4294967295;
}, r.prototype.getRow = function(t, e) {
e == null || e.getSize() < this.width ? e = new ft(this.width) : e.clear();
for (var n = this.rowSize, i = this.bits, a = t * n, o = 0; o < n; o++)
e.setBulk(o * 32, i[a + o]);
return e;
}, r.prototype.setRow = function(t, e) {
Y.arraycopy(e.getBitArray(), 0, this.bits, t * this.rowSize, this.rowSize);
}, r.prototype.rotate180 = function() {
for (var t = this.getWidth(), e = this.getHeight(), n = new ft(t), i = new ft(t), a = 0, o = Math.floor((e + 1) / 2); a < o; a++)
n = this.getRow(a, n), i = this.getRow(e - 1 - a, i), n.reverse(), i.reverse(), this.setRow(a, i), this.setRow(e - 1 - a, n);
}, r.prototype.getEnclosingRectangle = function() {
for (var t = this.width, e = this.height, n = this.rowSize, i = this.bits, a = t, o = e, f = -1, s = -1, u = 0; u < e; u++)
for (var c = 0; c < n; c++) {
var l = i[u * n + c];
if (l !== 0) {
if (u < o && (o = u), u > s && (s = u), c * 32 < a) {
for (var h = 0; !(l << 31 - h & 4294967295); )
h++;
c * 32 + h < a && (a = c * 32 + h);
}
if (c * 32 + 31 > f) {
for (var h = 31; !(l >>> h); )
h--;
c * 32 + h > f && (f = c * 32 + h);
}
}
}
return f < a || s < o ? null : Int32Array.from([a, o, f - a + 1, s - o + 1]);
}, r.prototype.getTopLeftOnBit = function() {
for (var t = this.rowSize, e = this.bits, n = 0; n < e.length && e[n] === 0; )
n++;
if (n === e.length)
return null;
for (var i = n / t, a = n % t * 32, o = e[n], f = 0; !(o << 31 - f & 4294967295); )
f++;
return a += f, Int32Array.from([a, i]);
}, r.prototype.getBottomRightOnBit = function() {
for (var t = this.rowSize, e = this.bits, n = e.length - 1; n >= 0 && e[n] === 0; )
n--;
if (n < 0)
return null;
for (var i = Math.floor(n / t), a = Math.floor(n % t) * 32, o = e[n], f = 31; !(o >>> f); )
f--;
return a += f, Int32Array.from([a, i]);
}, 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(t) {
if (!(t instanceof r))
return !1;
var e = t;
return this.width === e.width && this.height === e.height && this.rowSize === e.rowSize && rt.equals(this.bits, e.bits);
}, r.prototype.hashCode = function() {
var t = this.width;
return t = 31 * t + this.width, t = 31 * t + this.height, t = 31 * t + this.rowSize, t = 31 * t + rt.hashCode(this.bits), t;
}, r.prototype.toString = function(t, e, n) {
return t === void 0 && (t = "X "), e === void 0 && (e = " "), n === void 0 && (n = `
`), this.buildToString(t, e, n);
}, r.prototype.buildToString = function(t, e, n) {
for (var i = new M(), a = 0, o = this.height; a < o; a++) {
for (var f = 0, s = this.width; f < s; f++)
i.append(this.get(f, a) ? t : e);
i.append(n);
}
return i.toString();
}, r.prototype.clone = function() {
return new r(this.width, this.height, this.rowSize, this.bits.slice());
}, r;
}()
), jn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), C = (
/** @class */
function(r) {
jn(t, r);
function t() {
return r !== null && r.apply(this, arguments) || this;
}
return t.getNotFoundInstance = function() {
return new t();
}, t.kind = "NotFoundException", t;
}(gt)
), Zn = globalThis && globalThis.__extends || function() {
var r = function(t, e) {
return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var a in i)
i.hasOwnProperty(a) && (n[a] = i[a]);
}, r(t, e);
};
return function(t, e) {
r(t, e);
function n() {
this.constructor = t;
}
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
};
}(), $n = (
/** @class */
function(r) {
Zn(t, r);
function t(e) {
var n = r.call(this, e) || this;
return n.luminances = t.EMPTY, n.buckets = new Int32Array(t.LUMINANCE_BUCKETS), n;
}
return t.prototype.getBlackRow = function(e, n) {
var i = this.getLuminanceSource(), a = i.getWidth();
n == null || n.getSize() < a ? n = new ft(a) : n.clear(), this.initArrays(a);
for (var o = i.getRow(e, this.luminances), f = this.buckets, s = 0; s < a; s++)
f[(o[s] & 255) >> t.LUMINANCE_SHIFT]++;
var u = t.estimateBlackPoint(f);
if (a < 3)
for (var s = 0; s < a; s++)
(o[s] & 255) < u && n.set(s);
else
for (var c = o[0] & 255, l = o[1] & 255, s = 1; s < a - 1; s++) {
var h = o[s + 1] & 255;
(l * 4 - c - h) / 2 < u && n.set(s), c = l, l = h;
}
return n;
}, t.prototype.getBlackMatrix = function() {
var e = this.getLuminanceSource(), n = e.getWidth(), i = e.getHeight(), a = new Nt(n, i);
this.initArrays(n);
for (var o = this.buckets, f = 1; f < 5; f++)
for (var s = Math.floor(i * f / 5), u = e.getRow(s, this.luminances), c = Math.floor(n * 4 / 5), l = Math.floor(n / 5); l < c; l++) {
var h = u[l] & 255;
o[h >> t.LUMINANCE_SHIFT]++;
}
for (var d = t.estimateBlackPoint(o), v = e.getMatrix(), f = 0; f < i; f++)
for (var g = f * n, l = 0; l < n; l++) {
var h = v[g + l] & 255;
h < d && a.set(l, f);
}
return a;
}, t.prototype.createBinarizer = function(e) {
return new t(e);
}, t.prototype.initArrays = function(e) {
this.luminances.length < e && (this.luminances = new Uint8ClampedArray(e));
for (var n = this.buckets, i = 0; i < t.LUMINANCE_BUCKETS; i++)