@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
2,042 lines • 1.59 MB
JavaScript
try {
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e1655ef2-c08c-41e2-a23f-68e638faf0ed", e._sentryDebugIdIdentifier = "sentry-dbid-e1655ef2-c08c-41e2-a23f-68e638faf0ed");
} catch (e) {}
var e = !("object" != typeof process || process + "" != "[object process]" || process.versions.nw || process.versions.electron && process.type && "browser" !== process.type), t = [
Infinity,
Infinity,
-Infinity,
-Infinity
], a = new Float32Array(t), n = [
.001,
0,
0,
.001,
0,
0
], s = 1.35, r = .35, i = .25925925925925924, o = 1, l = 2, f = 4, c = 8, h = 16, u = 64, m = 128, p = 256, d = "pdfjs_internal_editor_", g = 3, b = 9, w = 13, j = 15, k = 101, y = {
PRINT: 4,
MODIFY_CONTENTS: 8,
COPY: 16,
MODIFY_ANNOTATIONS: 32,
FILL_INTERACTIVE_FORMS: 256,
COPY_FOR_ACCESSIBILITY: 512,
ASSEMBLE: 1024,
PRINT_HIGH_QUALITY: 2048
}, q = 1, v = 2, S = 3, x = 0, C = 4, F = 1, T = 2, O = 3, R = {
TEXT: 1,
LINK: 2,
FREETEXT: 3,
LINE: 4,
SQUARE: 5,
CIRCLE: 6,
POLYGON: 7,
POLYLINE: 8,
HIGHLIGHT: 9,
UNDERLINE: 10,
SQUIGGLY: 11,
STRIKEOUT: 12,
STAMP: 13,
CARET: 14,
INK: 15,
POPUP: 16,
FILEATTACHMENT: 17,
SOUND: 18,
MOVIE: 19,
WIDGET: 20,
SCREEN: 21,
PRINTERMARK: 22,
TRAPNET: 23,
WATERMARK: 24,
THREED: 25,
REDACT: 26
}, H = "Group", D = "R", M = 1, N = 2, E = 4, _ = 16, z = 32, L = 128, U = 512, X = 1, W = 2, K = 4096, G = 8192, V = 32768, $ = 65536, Y = 131072, J = 1048576, Q = 2097152, Z = 8388608, ee = 16777216, te = 1, ae = 2, ne = 3, se = 4, re = 5, ie = {
E: "Mouse Enter",
X: "Mouse Exit",
D: "Mouse Down",
U: "Mouse Up",
Fo: "Focus",
Bl: "Blur",
PO: "PageOpen",
PC: "PageClose",
PV: "PageVisible",
PI: "PageInvisible",
K: "Keystroke",
F: "Format",
V: "Validate",
C: "Calculate"
}, oe = {
WC: "WillClose",
WS: "WillSave",
DS: "DidSave",
WP: "WillPrint",
DP: "DidPrint"
}, le = {
O: "PageOpen",
C: "PageClose"
}, fe = 1, ce = 5, he = 1, ue = 2, me = 3, pe = 4, de = 5, ge = 6, be = 7, we = 8, je = 9, ke = 10, ye = 11, qe = 12, ve = 13, Se = 14, Ae = 15, xe = 16, Ce = 17, Ie = 18, Fe = 19, Te = 20, Oe = 21, Re = 22, He = 23, Be = 24, De = 25, Me = 26, Ne = 27, Pe = 28, Ee = 29, _e = 30, ze = 31, Le = 32, Ue = 33, Xe = 34, We = 35, Ke = 36, Ge = 37, Ve = 38, $e = 39, Ye = 40, Je = 41, Qe = 42, Ze = 43, et = 44, tt = 45, at = 46, nt = 47, st = 48, rt = 49, it = 50, ot = 51, lt = 52, ft = 53, ct = 54, ht = 55, ut = 56, mt = 57, pt = 58, dt = 59, gt = 60, bt = 61, wt = 62, jt = 63, kt = 64, yt = 65, qt = 66, vt = 67, St = 68, At = 69, xt = 70, Ct = 71, It = 72, Ft = 73, Tt = 74, Ot = 75, Rt = 76, Ht = 77, Bt = 80, Dt = 81, Mt = 83, Nt = 84, Pt = 85, Et = 86, _t = 87, zt = 88, Lt = 89, Ut = 90, Xt = 91, Wt = 92, Kt = 93, Gt = 94, Vt = 0, $t = 1, Yt = 2, Jt = 3, Qt = 4, Zt = 1, ea = 2;
var ta = fe;
function getVerbosityLevel() {
return ta;
}
function info(e) {
ta >= ce && console.info(`Info: ${e}`);
}
function warn(e) {
ta >= fe && console.warn(`Warning: ${e}`);
}
function unreachable(e) {
throw new Error(e);
}
function assert(e, t) {
e || unreachable(t);
}
function createValidAbsoluteUrl(e, t = null, a = null) {
if (!e) return null;
if (a && "string" == typeof e) {
if (a.addDefaultProtocol && e.startsWith("www.")) e.match(/\./g)?.length >= 2 && (e = `http://${e}`);
if (a.tryConvertEncoding) try {
e = stringToUTF8String(e);
} catch {}
}
const n = t ? URL.parse(e, t) : URL.parse(e);
return function _isValidProtocol(e) {
switch (e?.protocol) {
case "http:":
case "https:":
case "ftp:":
case "mailto:":
case "tel:": return !0;
default: return !1;
}
}(n) ? n : null;
}
function shadow(e, t, a, n = !1) {
Object.defineProperty(e, t, {
value: a,
enumerable: !n,
configurable: !0,
writable: !1
});
return a;
}
var aa = function BaseExceptionClosure() {
function BaseException(e, t) {
this.message = e;
this.name = t;
}
BaseException.prototype = /* @__PURE__ */ new Error();
BaseException.constructor = BaseException;
return BaseException;
}();
var PasswordException = class extends aa {
constructor(e, t) {
super(e, "PasswordException");
this.code = t;
}
};
var UnknownErrorException = class extends aa {
constructor(e, t) {
super(e, "UnknownErrorException");
this.details = t;
}
};
var InvalidPDFException = class extends aa {
constructor(e) {
super(e, "InvalidPDFException");
}
};
var ResponseException = class extends aa {
constructor(e, t, a) {
super(e, "ResponseException");
this.status = t;
this.missing = a;
}
};
var FormatError = class extends aa {
constructor(e) {
super(e, "FormatError");
}
};
var AbortException = class extends aa {
constructor(e) {
super(e, "AbortException");
}
};
function bytesToString(e) {
"object" == typeof e && void 0 !== e?.length || unreachable("Invalid argument for bytesToString");
const t = e.length, a = 8192;
if (t < a) return String.fromCharCode.apply(null, e);
const n = [];
for (let s = 0; s < t; s += a) {
const r = Math.min(s + a, t), i = e.subarray(s, r);
n.push(String.fromCharCode.apply(null, i));
}
return n.join("");
}
function stringToBytes(e) {
"string" != typeof e && unreachable("Invalid argument for stringToBytes");
const t = e.length, a = new Uint8Array(t);
for (let n = 0; n < t; ++n) a[n] = 255 & e.charCodeAt(n);
return a;
}
function objectSize(e) {
return Object.keys(e).length;
}
var FeatureTest = class {
static get isLittleEndian() {
return shadow(this, "isLittleEndian", function isLittleEndian() {
const e = new Uint8Array(4);
e[0] = 1;
return 1 === new Uint32Array(e.buffer, 0, 1)[0];
}());
}
static get isOffscreenCanvasSupported() {
return shadow(this, "isOffscreenCanvasSupported", "undefined" != typeof OffscreenCanvas);
}
static get isImageDecoderSupported() {
return shadow(this, "isImageDecoderSupported", "undefined" != typeof ImageDecoder);
}
static get isFloat16ArraySupported() {
return shadow(this, "isFloat16ArraySupported", "undefined" != typeof Float16Array);
}
static get isSanitizerSupported() {
return shadow(this, "isSanitizerSupported", "undefined" != typeof Sanitizer);
}
static get platform() {
const { platform: e, userAgent: t } = navigator;
return shadow(this, "platform", {
isAndroid: t.includes("Android"),
isLinux: e.includes("Linux"),
isMac: e.includes("Mac"),
isWindows: e.includes("Win"),
isFirefox: t.includes("Firefox")
});
}
static get isCSSRoundSupported() {
return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
}
static get isAlphaColorInputSupported() {
return shadow(this, "isAlphaColorInputSupported", (() => {
if ("undefined" == typeof document) return !1;
const e = document.createElement("input");
e.type = "color";
e.setAttribute("alpha", "");
e.value = "#ff000080";
return "#ff0000" !== e.value;
})());
}
};
var Util = class {
static get hexNums() {
return shadow(this, "hexNums", Array.from(Array(256).keys(), (e) => e.toString(16).padStart(2, "0")));
}
static makeHexColor(e, t, a) {
return `#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[a]}`;
}
static domMatrixToTransform(e) {
return [
e.a,
e.b,
e.c,
e.d,
e.e,
e.f
];
}
static scaleMinMax(e, t) {
let a;
if (e[0]) {
if (e[0] < 0) {
a = t[0];
t[0] = t[2];
t[2] = a;
}
t[0] *= e[0];
t[2] *= e[0];
if (e[3] < 0) {
a = t[1];
t[1] = t[3];
t[3] = a;
}
t[1] *= e[3];
t[3] *= e[3];
} else {
a = t[0];
t[0] = t[1];
t[1] = a;
a = t[2];
t[2] = t[3];
t[3] = a;
if (e[1] < 0) {
a = t[1];
t[1] = t[3];
t[3] = a;
}
t[1] *= e[1];
t[3] *= e[1];
if (e[2] < 0) {
a = t[0];
t[0] = t[2];
t[2] = a;
}
t[0] *= e[2];
t[2] *= e[2];
}
t[0] += e[4];
t[1] += e[5];
t[2] += e[4];
t[3] += e[5];
}
static transform(e, t) {
return [
e[0] * t[0] + e[2] * t[1],
e[1] * t[0] + e[3] * t[1],
e[0] * t[2] + e[2] * t[3],
e[1] * t[2] + e[3] * t[3],
e[0] * t[4] + e[2] * t[5] + e[4],
e[1] * t[4] + e[3] * t[5] + e[5]
];
}
static multiplyByDOMMatrix(e, t) {
return [
e[0] * t.a + e[2] * t.b,
e[1] * t.a + e[3] * t.b,
e[0] * t.c + e[2] * t.d,
e[1] * t.c + e[3] * t.d,
e[0] * t.e + e[2] * t.f + e[4],
e[1] * t.e + e[3] * t.f + e[5]
];
}
static applyTransform(e, t, a = 0) {
const n = e[a], s = e[a + 1];
e[a] = n * t[0] + s * t[2] + t[4];
e[a + 1] = n * t[1] + s * t[3] + t[5];
}
static applyTransformToBezier(e, t, a = 0) {
const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], l = t[5];
for (let t = 0; t < 6; t += 2) {
const f = e[a + t], c = e[a + t + 1];
e[a + t] = f * n + c * r + o;
e[a + t + 1] = f * s + c * i + l;
}
}
static applyInverseTransform(e, t) {
const a = e[0], n = e[1], s = t[0] * t[3] - t[1] * t[2];
e[0] = (a * t[3] - n * t[2] + t[2] * t[5] - t[4] * t[3]) / s;
e[1] = (-a * t[1] + n * t[0] + t[4] * t[1] - t[5] * t[0]) / s;
}
static axialAlignedBoundingBox(e, t, a) {
const n = t[0], s = t[1], r = t[2], i = t[3], o = t[4], l = t[5], f = e[0], c = e[1], h = e[2], u = e[3];
let m = n * f + o, p = m, d = n * h + o, g = d, b = i * c + l, w = b, j = i * u + l, k = j;
if (0 !== s || 0 !== r) {
const e = s * f, t = s * h, a = r * c, n = r * u;
m += a;
g += a;
d += n;
p += n;
b += e;
k += e;
j += t;
w += t;
}
a[0] = Math.min(a[0], m, d, p, g);
a[1] = Math.min(a[1], b, j, w, k);
a[2] = Math.max(a[2], m, d, p, g);
a[3] = Math.max(a[3], b, j, w, k);
}
static inverseTransform(e) {
const t = e[0] * e[3] - e[1] * e[2];
return [
e[3] / t,
-e[1] / t,
-e[2] / t,
e[0] / t,
(e[2] * e[5] - e[4] * e[3]) / t,
(e[4] * e[1] - e[5] * e[0]) / t
];
}
static singularValueDecompose2dScale(e, t) {
const a = e[0], n = e[1], s = e[2], r = e[3], i = a ** 2 + n ** 2, o = a * s + n * r, l = s ** 2 + r ** 2, f = (i + l) / 2, c = Math.sqrt(f ** 2 - (i * l - o ** 2));
t[0] = Math.sqrt(f + c || 1);
t[1] = Math.sqrt(f - c || 1);
}
static normalizeRect(e) {
const t = e.slice(0);
if (e[0] > e[2]) {
t[0] = e[2];
t[2] = e[0];
}
if (e[1] > e[3]) {
t[1] = e[3];
t[3] = e[1];
}
return t;
}
static intersect(e, t) {
const a = Math.max(Math.min(e[0], e[2]), Math.min(t[0], t[2])), n = Math.min(Math.max(e[0], e[2]), Math.max(t[0], t[2]));
if (a > n) return null;
const s = Math.max(Math.min(e[1], e[3]), Math.min(t[1], t[3])), r = Math.min(Math.max(e[1], e[3]), Math.max(t[1], t[3]));
return s > r ? null : [
a,
s,
n,
r
];
}
static pointBoundingBox(e, t, a) {
a[0] = Math.min(a[0], e);
a[1] = Math.min(a[1], t);
a[2] = Math.max(a[2], e);
a[3] = Math.max(a[3], t);
}
static rectBoundingBox(e, t, a, n, s) {
s[0] = Math.min(s[0], e, a);
s[1] = Math.min(s[1], t, n);
s[2] = Math.max(s[2], e, a);
s[3] = Math.max(s[3], t, n);
}
static #e(e, t, a, n, s, r, i, o, l, f) {
if (l <= 0 || l >= 1) return;
const c = 1 - l, h = l * l, u = h * l, m = c * (c * (c * e + 3 * l * t) + 3 * h * a) + u * n, p = c * (c * (c * s + 3 * l * r) + 3 * h * i) + u * o;
f[0] = Math.min(f[0], m);
f[1] = Math.min(f[1], p);
f[2] = Math.max(f[2], m);
f[3] = Math.max(f[3], p);
}
static #t(e, t, a, n, s, r, i, o, l, f, c, h) {
if (Math.abs(l) < 1e-12) {
Math.abs(f) >= 1e-12 && this.#e(e, t, a, n, s, r, i, o, -c / f, h);
return;
}
const u = f ** 2 - 4 * c * l;
if (u < 0) return;
const m = Math.sqrt(u), p = 2 * l;
this.#e(e, t, a, n, s, r, i, o, (-f + m) / p, h);
this.#e(e, t, a, n, s, r, i, o, (-f - m) / p, h);
}
static bezierBoundingBox(e, t, a, n, s, r, i, o, l) {
l[0] = Math.min(l[0], e, i);
l[1] = Math.min(l[1], t, o);
l[2] = Math.max(l[2], e, i);
l[3] = Math.max(l[3], t, o);
this.#t(e, a, s, i, t, n, r, o, 3 * (3 * (a - s) - e + i), 6 * (e - 2 * a + s), 3 * (a - e), l);
this.#t(e, a, s, i, t, n, r, o, 3 * (3 * (n - r) - t + o), 6 * (t - 2 * n + r), 3 * (n - t), l);
}
};
var na = [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
728,
711,
710,
729,
733,
731,
730,
732,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
8226,
8224,
8225,
8230,
8212,
8211,
402,
8260,
8249,
8250,
8722,
8240,
8222,
8220,
8221,
8216,
8217,
8218,
8482,
64257,
64258,
321,
338,
352,
376,
381,
305,
322,
339,
353,
382,
0,
8364
];
function stringToPDFString(e, t = !1) {
if (e[0] >= "ï") {
let a;
if ("þ" === e[0] && "ÿ" === e[1]) {
a = "utf-16be";
e.length % 2 == 1 && (e = e.slice(0, -1));
} else if ("ÿ" === e[0] && "þ" === e[1]) {
a = "utf-16le";
e.length % 2 == 1 && (e = e.slice(0, -1));
} else "ï" === e[0] && "»" === e[1] && "¿" === e[2] && (a = "utf-8");
if (a) try {
const n = new TextDecoder(a, { fatal: !0 }), s = stringToBytes(e), r = n.decode(s);
return t || !r.includes("\x1B") ? r : r.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
} catch (e) {
warn(`stringToPDFString: "${e}".`);
}
}
const a = [];
for (let n = 0, s = e.length; n < s; n++) {
const r = e.charCodeAt(n);
if (!t && 27 === r) {
for (; ++n < s && 27 !== e.charCodeAt(n););
continue;
}
const i = na[r];
a.push(i ? String.fromCharCode(i) : e.charAt(n));
}
return a.join("");
}
function stringToUTF8String(e) {
return decodeURIComponent(escape(e));
}
function utf8StringToString(e) {
return unescape(encodeURIComponent(e));
}
function isArrayEqual(e, t) {
if (e.length !== t.length) return !1;
for (let a = 0, n = e.length; a < n; a++) if (e[a] !== t[a]) return !1;
return !0;
}
function getModificationDate(e = /* @__PURE__ */ new Date()) {
e instanceof Date || (e = new Date(e));
return [
e.getUTCFullYear().toString(),
(e.getUTCMonth() + 1).toString().padStart(2, "0"),
e.getUTCDate().toString().padStart(2, "0"),
e.getUTCHours().toString().padStart(2, "0"),
e.getUTCMinutes().toString().padStart(2, "0"),
e.getUTCSeconds().toString().padStart(2, "0")
].join("");
}
var sa = null, ra = null;
var makeArr = () => [], makeMap = () => /* @__PURE__ */ new Map(), makeObj = () => Object.create(null), ia = Symbol("CIRCULAR_REF"), oa = Symbol("EOF");
var la = Object.create(null), fa = Object.create(null), ca = Object.create(null);
var Name = class Name {
constructor(e) {
this.name = e;
}
static get(e) {
return fa[e] ||= new Name(e);
}
};
var Cmd = class Cmd {
constructor(e) {
this.cmd = e;
}
static get(e) {
return la[e] ||= new Cmd(e);
}
};
var ha = function nonSerializableClosure() {
return ha;
};
var Dict = class Dict {
__nonSerializable__ = ha;
#a = /* @__PURE__ */ new Map();
objId = null;
suppressEncryption = !1;
xref;
constructor(e = null) {
this.xref = e;
}
assignXref(e) {
this.xref = e;
}
get size() {
return this.#a.size;
}
#n(e, t, a, n) {
let s = this.#a.get(t);
if (void 0 === s && void 0 !== a) {
s = this.#a.get(a);
void 0 === s && void 0 !== n && (s = this.#a.get(n));
}
return s instanceof Ref && this.xref ? e ? this.xref.fetchAsync(s, this.suppressEncryption) : this.xref.fetch(s, this.suppressEncryption) : s;
}
get(e, t, a) {
return this.#n(!1, e, t, a);
}
async getAsync(e, t, a) {
return this.#n(!0, e, t, a);
}
getArray(e, t, a) {
let n = this.#n(!1, e, t, a);
if (Array.isArray(n)) {
n = n.slice();
for (let e = 0, t = n.length; e < t; e++) n[e] instanceof Ref && this.xref && (n[e] = this.xref.fetch(n[e], this.suppressEncryption));
}
return n;
}
getRaw(e) {
return this.#a.get(e);
}
getKeys() {
return this.#a.keys();
}
getRawValues() {
return this.#a.values();
}
getRawEntries() {
return this.#a.entries();
}
set(e, t) {
this.#a.set(e, t);
}
setIfNotExists(e, t) {
this.has(e) || this.set(e, t);
}
setIfNumber(e, t) {
"number" == typeof t && this.set(e, t);
}
setIfArray(e, t) {
(Array.isArray(t) || ArrayBuffer.isView(t)) && this.set(e, t);
}
setIfDefined(e, t) {
null != t && this.set(e, t);
}
setIfName(e, t) {
"string" == typeof t ? this.set(e, Name.get(t)) : t instanceof Name && this.set(e, t);
}
setIfDict(e, t) {
t instanceof Dict && this.set(e, t);
}
has(e) {
return this.#a.has(e);
}
*[Symbol.iterator]() {
for (const [e, t] of this.#a) yield [e, t instanceof Ref && this.xref ? this.xref.fetch(t, this.suppressEncryption) : t];
}
static get empty() {
const e = new Dict(null);
e.set = (e, t) => {
unreachable("Should not call `set` on the empty dictionary.");
};
return shadow(this, "empty", e);
}
static merge({ xref: e, dictArray: t, mergeSubDicts: a = !1 }) {
const n = new Dict(e), s = /* @__PURE__ */ new Map();
for (const e of t) if (e instanceof Dict) for (const [t, n] of e.getRawEntries()) {
let e = s.get(t);
if (void 0 === e) {
e = [];
s.set(t, e);
} else if (!(a && n instanceof Dict)) continue;
e.push(n);
}
for (const [t, a] of s) {
if (1 === a.length || !(a[0] instanceof Dict)) {
n.set(t, a[0]);
continue;
}
const s = new Dict(e);
for (const e of a) for (const [t, a] of e.getRawEntries()) s.setIfNotExists(t, a);
s.size > 0 && n.set(t, s);
}
s.clear();
return n.size > 0 ? n : Dict.empty;
}
clone() {
const e = new Dict(this.xref);
for (const [t, a] of this.#a) e.set(t, a);
return e;
}
delete(e) {
this.#a.delete(e);
}
};
var Ref = class Ref {
constructor(e, t) {
this.num = e;
this.gen = t;
}
toString() {
return 0 === this.gen ? `${this.num}R` : `${this.num}R${this.gen}`;
}
static fromString(e) {
const t = ca[e];
if (t) return t;
const a = /^(\d+)R(\d*)$/.exec(e);
return a && "0" !== a[1] ? ca[e] = new Ref(parseInt(a[1], 10), a[2] ? parseInt(a[2], 10) : 0) : null;
}
static get(e, t) {
const a = 0 === t ? `${e}R` : `${e}R${t}`;
return ca[a] ||= new Ref(e, t);
}
};
var RefSet = class {
constructor(e = null) {
this._set = new Set(e?._set);
}
has(e) {
return this._set.has(e.toString());
}
put(e) {
this._set.add(e.toString());
}
remove(e) {
this._set.delete(e.toString());
}
[Symbol.iterator]() {
return this._set.values();
}
clear() {
this._set.clear();
}
};
var RefSetCache = class {
_map = /* @__PURE__ */ new Map();
get size() {
return this._map.size;
}
get(e) {
return this._map.get(e.toString());
}
has(e) {
return this._map.has(e.toString());
}
put(e, t) {
this._map.set(e.toString(), t);
}
putAlias(e, t) {
this._map.set(e.toString(), this.get(t));
}
[Symbol.iterator]() {
return this._map.values();
}
clear() {
this._map.clear();
}
*values() {
yield* this._map.values();
}
*items() {
for (const [e, t] of this._map) yield [Ref.fromString(e), t];
}
*keys() {
for (const e of this._map.keys()) yield Ref.fromString(e);
}
};
function isName(e, t) {
return e instanceof Name && (void 0 === t || e.name === t);
}
function isCmd(e, t) {
return e instanceof Cmd && (void 0 === t || e.cmd === t);
}
function isDict(e, t) {
return e instanceof Dict && (void 0 === t || isName(e.get("Type"), t));
}
function isRefsEqual(e, t) {
return e.num === t.num && e.gen === t.gen;
}
var BaseStream = class {
get length() {
unreachable("Abstract getter `length` accessed");
}
get isEmpty() {
unreachable("Abstract getter `isEmpty` accessed");
}
get isDataLoaded() {
return shadow(this, "isDataLoaded", !0);
}
getByte() {
unreachable("Abstract method `getByte` called");
}
getBytes(e) {
unreachable("Abstract method `getBytes` called");
}
async getImageData(e, t) {
return this.getBytes(e, t);
}
async asyncGetBytes() {
unreachable("Abstract method `asyncGetBytes` called");
}
get isAsync() {
return !1;
}
get isAsyncDecoder() {
return !1;
}
get isImageStream() {
return !1;
}
get canAsyncDecodeImageFromBuffer() {
return !1;
}
async getTransferableImage() {
return null;
}
peekByte() {
const e = this.getByte();
-1 !== e && this.pos--;
return e;
}
peekBytes(e) {
const t = this.getBytes(e);
this.pos -= t.length;
return t;
}
getUint16() {
const e = this.getByte(), t = this.getByte();
return -1 === e || -1 === t ? -1 : (e << 8) + t;
}
getInt32() {
return (this.getByte() << 24) + (this.getByte() << 16) + (this.getByte() << 8) + this.getByte();
}
getByteRange(e, t) {
unreachable("Abstract method `getByteRange` called");
}
getString(e) {
return bytesToString(this.getBytes(e));
}
skip(e) {
this.pos += e || 1;
}
reset() {
unreachable("Abstract method `reset` called");
}
moveStart() {
unreachable("Abstract method `moveStart` called");
}
makeSubStream(e, t, a = null) {
unreachable("Abstract method `makeSubStream` called");
}
getBaseStreams() {
return null;
}
getOriginalStream() {
return this.stream?.getOriginalStream() || this;
}
};
var ua = /^[1-9]\.\d$/, ma = 2 ** 31 - 1, pa = [
1,
0,
0,
1,
0,
0
], da = [
"ColorSpace",
"ExtGState",
"Font",
"Pattern",
"Properties",
"Shading",
"XObject"
], ga = [
"ExtGState",
"Font",
"Properties",
"XObject"
];
function getLookupTableFactory(e) {
let t;
return function() {
if (e) {
t = Object.create(null);
e(t);
e = null;
}
return t;
};
}
var MissingDataException = class extends aa {
constructor(e, t) {
super(`Missing data [${e}, ${t})`, "MissingDataException");
this.begin = e;
this.end = t;
}
};
var ParserEOFException = class extends aa {
constructor(e) {
super(e, "ParserEOFException");
}
};
var XRefEntryException = class extends aa {
constructor(e) {
super(e, "XRefEntryException");
}
};
var XRefParseException = class extends aa {
constructor(e) {
super(e, "XRefParseException");
}
};
function arrayBuffersToBytes(e) {
const t = e.length;
if (0 === t) return new Uint8Array(0);
if (1 === t) return new Uint8Array(e[0]);
let a = 0;
for (let n = 0; n < t; n++) a += e[n].byteLength;
const n = new Uint8Array(a);
let s = 0;
for (let a = 0; a < t; a++) {
const t = new Uint8Array(e[a]);
n.set(t, s);
s += t.byteLength;
}
return n;
}
async function fetchBinaryData(e) {
const t = await fetch(e);
if (!t.ok) throw new Error(`Failed to fetch file "${e}" with "${t.statusText}".`);
return t.bytes();
}
function getInheritableProperty({ dict: e, key: t, getArray: a = !1, stopWhenFound: n = !0 }) {
let s;
const r = new RefSet();
for (; e instanceof Dict && (!e.objId || !r.has(e.objId));) {
e.objId && r.put(e.objId);
const i = a ? e.getArray(t) : e.get(t);
if (void 0 !== i) {
if (n) return i;
(s ||= []).push(i);
}
e = e.get("Parent");
}
return s;
}
function deepCompare(e, t) {
if (e === t) return !0;
if (e instanceof Dict && t instanceof Dict) {
if (e.size !== t.size) return !1;
for (const [a, n] of e.getRawEntries()) {
const e = t.getRaw(a);
if (void 0 === e || !deepCompare(n, e)) return !1;
}
return !0;
}
if (Array.isArray(e) && Array.isArray(t)) {
if (e.length !== t.length) return !1;
for (let a = 0, n = e.length; a < n; a++) if (!deepCompare(e[a], t[a])) return !1;
return !0;
}
return !1;
}
var ba = [
"",
"C",
"CC",
"CCC",
"CD",
"D",
"DC",
"DCC",
"DCCC",
"CM",
"",
"X",
"XX",
"XXX",
"XL",
"L",
"LX",
"LXX",
"LXXX",
"XC",
"",
"I",
"II",
"III",
"IV",
"V",
"VI",
"VII",
"VIII",
"IX"
];
function toRomanNumerals(e, t = !1) {
assert(Number.isInteger(e) && e > 0, "The number should be a positive integer.");
const a = "M".repeat(e / 1e3 | 0) + ba[e % 1e3 / 100 | 0] + ba[10 + (e % 100 / 10 | 0)] + ba[20 + e % 10];
return t ? a.toLowerCase() : a;
}
function isWhiteSpace(e) {
return 32 === e || 9 === e || 13 === e || 10 === e;
}
function isNumberArray(e, t) {
return Array.isArray(e) ? (null === t || e.length === t) && e.every((e) => "number" == typeof e) : ArrayBuffer.isView(e) && !(e instanceof BigInt64Array || e instanceof BigUint64Array) && (null === t || e.length === t);
}
function lookupMatrix(e, t) {
return isNumberArray(e, 6) ? e : t;
}
function lookupRect(e, t) {
return isNumberArray(e, 4) ? e : t;
}
function lookupNormalRect(e, t) {
return isNumberArray(e, 4) ? Util.normalizeRect(e) : t;
}
function parseXFAPath(e) {
const t = /(.+)\[(\d+)\]$/;
return e.split(".").map((e) => {
const a = e.match(t);
return a ? {
name: a[1],
pos: parseInt(a[2], 10)
} : {
name: e,
pos: 0
};
});
}
function escapePDFName(e) {
const t = [];
let a = 0;
for (let n = 0, s = e.length; n < s; n++) {
const s = e.charCodeAt(n);
if (s < 33 || s > 126 || 35 === s || 40 === s || 41 === s || 60 === s || 62 === s || 91 === s || 93 === s || 123 === s || 125 === s || 47 === s || 37 === s) {
a < n && t.push(e.substring(a, n));
t.push(`#${s.toString(16)}`);
a = n + 1;
}
}
if (0 === t.length) return e;
a < e.length && t.push(e.substring(a, e.length));
return t.join("");
}
function escapeString(e) {
return e.replaceAll(/([()\\\n\r])/g, (e) => "\n" === e ? "\\n" : "\r" === e ? "\\r" : `\\${e}`);
}
function _collectJS(e, t, a, n) {
if (!e) return;
let s = null;
if (e instanceof Ref) {
if (n.has(e)) return;
s = e;
n.put(s);
e = t.fetch(e);
}
if (Array.isArray(e)) for (const s of e) _collectJS(s, t, a, n);
else if (e instanceof Dict) {
if (isName(e.get("S"), "JavaScript")) {
const t = e.get("JS");
let n;
t instanceof BaseStream ? n = t.getString() : "string" == typeof t && (n = t);
n &&= stringToPDFString(n, !0).replaceAll("\0", "");
n && a.push(n.trim());
}
_collectJS(e.getRaw("Next"), t, a, n);
}
s && n.remove(s);
}
function collectActions(e, t, a) {
const n = Object.create(null), s = getInheritableProperty({
dict: t,
key: "AA",
stopWhenFound: !1
});
if (s) for (let t = s.length - 1; t >= 0; t--) {
const r = s[t];
if (r instanceof Dict) for (const [t, s] of r.getRawEntries()) {
const r = a[t];
if (!r) continue;
const i = [];
_collectJS(s, e, i, new RefSet());
i.length > 0 && (n[r] = i);
}
}
if (t.has("A")) {
const a = [];
_collectJS(t.get("A"), e, a, new RefSet());
a.length > 0 && (n.Action = a);
}
return objectSize(n) > 0 ? n : null;
}
var wa = {
60: "<",
62: ">",
38: "&",
34: """,
39: "'"
};
function* codePointIter(e) {
for (let t = 0, a = e.length; t < a; t++) {
const a = e.codePointAt(t);
a > 55295 && (a < 57344 || a > 65533) && t++;
yield a;
}
}
function encodeToXmlString(e) {
const t = [];
let a = 0;
for (let n = 0, s = e.length; n < s; n++) {
const s = e.codePointAt(n);
if (32 <= s && s <= 126) {
const r = wa[s];
if (r) {
a < n && t.push(e.substring(a, n));
t.push(r);
a = n + 1;
}
} else {
a < n && t.push(e.substring(a, n));
t.push(`&#x${s.toString(16).toUpperCase()};`);
s > 55295 && (s < 57344 || s > 65533) && n++;
a = n + 1;
}
}
if (0 === t.length) return e;
a < e.length && t.push(e.substring(a, e.length));
return t.join("");
}
function validateFontName(e, t = !1) {
const a = /^("|').*("|')$/.exec(e);
if (a && a[1] === a[2]) {
if (new RegExp(`[^\\\\]${a[1]}`).test(e.slice(1, -1))) {
t && warn(`FontFamily contains unescaped ${a[1]}: ${e}.`);
return !1;
}
} else for (const a of e.split(/[ \t]+/)) if (/^(\d|(-(\d|-)))/.test(a) || !/^[\w-\\]+$/.test(a)) {
t && warn(`FontFamily contains invalid <custom-ident>: ${e}.`);
return !1;
}
return !0;
}
function validateCSSFont(e) {
const t = new Set([
"100",
"200",
"300",
"400",
"500",
"600",
"700",
"800",
"900",
"1000",
"normal",
"bold",
"bolder",
"lighter"
]), { fontFamily: a, fontWeight: n, italicAngle: s } = e;
if (!validateFontName(a, !0)) return !1;
const r = n ? n.toString() : "";
e.fontWeight = t.has(r) ? r : "400";
const i = parseFloat(s);
e.italicAngle = isNaN(i) || i < -90 || i > 90 ? "14" : s.toString();
return !0;
}
function recoverJsURL(e) {
const t = new RegExp("^\\s*(" + [
"app.launchURL",
"window.open",
"xfa.host.gotoURL"
].join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i").exec(e);
return t?.[2] ? {
url: t[2],
newWindow: "app.launchURL" === t[1] && "true" === t[3]
} : null;
}
function numberToString(e) {
if (Number.isInteger(e)) return e.toString();
const t = Math.round(100 * e);
return t % 100 == 0 ? (t / 100).toString() : t % 10 == 0 ? e.toFixed(1) : e.toFixed(2);
}
function getNewAnnotationsMap(e) {
if (!e) return null;
const t = /* @__PURE__ */ new Map();
for (const [a, n] of e) a.startsWith(d) && t.getOrInsertComputed(n.pageIndex, makeArr).push(n);
return t.size > 0 ? t : null;
}
function stringToAsciiOrUTF16BE(e) {
return null == e || function isAscii(e) {
if ("string" != typeof e) return !1;
return !e || /^[\x00-\x7F]*$/.test(e);
}(e) ? e : stringToUTF16String(e, !0);
}
function stringToUTF16HexString(e) {
const t = [];
for (let a = 0, n = e.length; a < n; a++) {
const n = e.charCodeAt(a);
t.push(Util.hexNums[n >> 8 & 255], Util.hexNums[255 & n]);
}
return t.join("");
}
function stringToUTF16String(e, t = !1) {
const a = [];
t && a.push("þÿ");
for (let t = 0, n = e.length; t < n; t++) {
const n = e.charCodeAt(t);
a.push(String.fromCharCode(n >> 8 & 255), String.fromCharCode(255 & n));
}
return a.join("");
}
function getRotationMatrix(e, t, a) {
switch (e) {
case 90: return [
0,
1,
-1,
0,
t,
0
];
case 180: return [
-1,
0,
0,
-1,
t,
a
];
case 270: return [
0,
-1,
1,
0,
0,
a
];
default: throw new Error("Invalid rotation");
}
}
function getSizeInBytes(e) {
return Math.ceil(Math.ceil(Math.log2(1 + e)) / 8);
}
var QCMS = class {
static #s = null;
static _memory = null;
static _mustAddAlpha = !1;
static _destBuffer = null;
static _destOffset = 0;
static _destLength = 0;
static _cssColor = "";
static _makeHexColor = null;
static get _memoryArray() {
const e = this.#s;
return e?.byteLength ? e : this.#s = new Uint8Array(this._memory.buffer);
}
};
var ja = Object.freeze({
RGB8: 0,
0: "RGB8",
RGBA8: 1,
1: "RGBA8",
BGRA8: 2,
2: "BGRA8",
Gray8: 3,
3: "Gray8",
GrayA8: 4,
4: "GrayA8",
CMYK: 5,
5: "CMYK"
}), ka = Object.freeze({
Perceptual: 0,
0: "Perceptual",
RelativeColorimetric: 1,
1: "RelativeColorimetric",
Saturation: 2,
2: "Saturation",
AbsoluteColorimetric: 3,
3: "AbsoluteColorimetric"
});
function __wbg_get_imports() {
return {
__proto__: null,
"./qcms_bg.js": {
__proto__: null,
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
throw new Error(function getStringFromWasm0(e, t) {
return function decodeText(e, t) {
Sa += t;
if (Sa >= va) {
qa = new TextDecoder("utf-8", {
ignoreBOM: !0,
fatal: !0
});
qa.decode();
Sa = t;
}
return qa.decode(getUint8ArrayMemory0().subarray(e, e + t));
}(e >>>= 0, t);
}(e, t));
},
__wbg_copy_result_0d15f3bf9d9012ae: function(e, t) {
(function copy_result(e, t) {
const { _mustAddAlpha: a, _destBuffer: n, _destOffset: s, _destLength: r, _memoryArray: i } = QCMS;
if (t !== r) if (a) for (let a = e, r = e + t, o = s; a < r; a += 3, o += 4) {
n[o] = i[a];
n[o + 1] = i[a + 1];
n[o + 2] = i[a + 2];
n[o + 3] = 255;
}
else for (let a = e, r = e + t, o = s; a < r; a += 3, o += 4) {
n[o] = i[a];
n[o + 1] = i[a + 1];
n[o + 2] = i[a + 2];
}
else n.set(i.subarray(e, e + t), s);
})(e >>> 0, t >>> 0);
},
__wbg_copy_rgb_0106d9d9464fce43: function(e) {
(function copy_rgb(e) {
const { _destBuffer: t, _destOffset: a, _memoryArray: n } = QCMS;
t[a] = n[e];
t[a + 1] = n[e + 1];
t[a + 2] = n[e + 2];
})(e >>> 0);
},
__wbg_make_cssRGB_8e24b34f71f5363e: function(e) {
(function make_cssRGB(e) {
const { _memoryArray: t } = QCMS;
QCMS._cssColor = QCMS._makeHexColor(t[e], t[e + 1], t[e + 2]);
})(e >>> 0);
},
__wbindgen_init_externref_table: function() {
const e = xa.__wbindgen_externrefs, t = e.grow(4);
e.set(0, void 0);
e.set(t + 0, void 0);
e.set(t + 1, null);
e.set(t + 2, !0);
e.set(t + 3, !1);
}
}
};
}
var ya = null;
function getUint8ArrayMemory0() {
null !== ya && 0 !== ya.byteLength || (ya = new Uint8Array(xa.memory.buffer));
return ya;
}
function passArray8ToWasm0(e, t) {
const a = t(1 * e.length, 1) >>> 0;
getUint8ArrayMemory0().set(e, a / 1);
Ca = e.length;
return a;
}
var qa = new TextDecoder("utf-8", {
ignoreBOM: !0,
fatal: !0
});
qa.decode();
var va = 2146435072;
var Sa = 0, xa, Ca = 0;
function __wbg_finalize_init(e, t) {
xa = e.exports;
ya = null;
xa.__wbindgen_start();
return xa;
}
function MathClamp(e, t, a) {
return Math.min(Math.max(e, t), a);
}
function isDefaultDecodeHelper(e, t) {
if (!Array.isArray(e)) return !0;
const a = e.length;
if (a < t) {
warn("Decode map length is too short.");
return !0;
}
if (a > t) {
info("Truncating too long decode map.");
e.length = t;
}
return !1;
}
var ColorSpace = class ColorSpace {
static #r = new Uint8ClampedArray(3);
constructor(e, t) {
this.name = e;
this.numComps = t;
}
getRgb(e, t, a = new Uint8ClampedArray(3)) {
this.getRgbItem(e, t, a, 0);
return a;
}
getRgbHex(e, t) {
const a = this.getRgb(e, t, ColorSpace.#r);
return Util.makeHexColor(a[0], a[1], a[2]);
}
getRgbItem(e, t, a, n) {
unreachable("Should not call ColorSpace.getRgbItem");
}
getRgbBuffer(e, t, a, n, s, r, i) {
unreachable("Should not call ColorSpace.getRgbBuffer");
}
getOutputLength(e, t) {
unreachable("Should not call ColorSpace.getOutputLength");
}
isPassthrough(e) {
return !1;
}
isDefaultDecode(e, t) {
return ColorSpace.isDefaultDecode(e, this.numComps);
}
fillRgb(e, t, a, n, s, r, i, o, l) {
const f = t * a;
let c = null;
const h = 1 << i, u = a !== s || t !== n;
if (this.isPassthrough(i)) c = o;
else if (1 === this.numComps && f > h && "DeviceGray" !== this.name && "DeviceRGB" !== this.name) {
const t = i <= 8 ? new Uint8Array(h) : new Uint16Array(h);
for (let e = 0; e < h; e++) t[e] = e;
const a = new Uint8ClampedArray(3 * h);
this.getRgbBuffer(t, 0, h, a, 0, i, 0);
if (u) {
c = new Uint8Array(3 * f);
let e = 0;
for (let t = 0; t < f; ++t) {
const n = 3 * o[t];
c[e++] = a[n];
c[e++] = a[n + 1];
c[e++] = a[n + 2];
}
} else {
let t = 0;
for (let n = 0; n < f; ++n) {
const s = 3 * o[n];
e[t++] = a[s];
e[t++] = a[s + 1];
e[t++] = a[s + 2];
t += l;
}
}
} else if (u) {
c = new Uint8ClampedArray(3 * f);
this.getRgbBuffer(o, 0, f, c, 0, i, 0);
} else this.getRgbBuffer(o, 0, n * r, e, 0, i, l);
if (c) if (u) (function resizeRgbImage(e, t, a, n, s, r, i) {
i = 1 !== i ? 0 : i;
const o = a / s, l = n / r;
let f, c = 0;
const h = new Uint16Array(s), u = 3 * a;
for (let e = 0; e < s; e++) h[e] = 3 * Math.floor(e * o);
for (let a = 0; a < r; a++) {
const n = Math.floor(a * l) * u;
for (let a = 0; a < s; a++) {
f = n + h[a];
t[c++] = e[f++];
t[c++] = e[f++];
t[c++] = e[f++];
c += i;
}
}
})(c, e, t, a, n, s, l);
else {
let t = 0, a = 0;
for (let s = 0, i = n * r; s < i; s++) {
e[t++] = c[a++];
e[t++] = c[a++];
e[t++] = c[a++];
t += l;
}
}
}
get usesZeroToOneRange() {
return shadow(this, "usesZeroToOneRange", !0);
}
static isDefaultDecode(e, t) {
if (isDefaultDecodeHelper(e, 2 * t)) return !0;
for (let t = 0, a = e.length; t < a; t += 2) if (0 !== e[t] || 1 !== e[t + 1]) return !1;
return !0;
}
};
var AlternateCS = class extends ColorSpace {
constructor(e, t, a) {
super("Alternate", e);
this.base = t;
this.tintFn = a;
this.tmpBuf = new Float32Array(t.numComps);
}
getRgbItem(e, t, a, n) {
const s = this.tmpBuf;
this.tintFn(e, t, s, 0);
this.base.getRgbItem(s, 0, a, n);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = this.tintFn, l = this.base, f = 1 / ((1 << r) - 1), c = l.numComps, h = l.usesZeroToOneRange, u = (l.isPassthrough(8) || !h) && 0 === i;
let m = u ? s : 0;
const p = u ? n : new Uint8ClampedArray(c * a), d = this.numComps, g = new Float32Array(d), b = new Float32Array(c);
let w, j;
for (w = 0; w < a; w++) {
for (j = 0; j < d; j++) g[j] = e[t++] * f;
o(g, 0, b, 0);
if (h) for (j = 0; j < c; j++) p[m++] = 255 * b[j];
else {
l.getRgbItem(b, 0, p, m);
m += c;
}
}
u || l.getRgbBuffer(p, 0, a, n, s, 8, i);
}
getOutputLength(e, t) {
return this.base.getOutputLength(e * this.base.numComps / this.numComps, t);
}
};
var PatternCS = class extends ColorSpace {
constructor(e) {
super("Pattern", null);
this.base = e;
}
isDefaultDecode(e, t) {
unreachable("Should not call PatternCS.isDefaultDecode");
}
};
var IndexedCS = class extends ColorSpace {
constructor(e, t, a) {
super("Indexed", 1);
this.base = e;
this.highVal = t;
const n = e.numComps * (t + 1);
this.lookup = new Uint8Array(n);
if (a instanceof BaseStream) {
const e = a.getBytes(n);
this.lookup.set(e);
} else {
if ("string" != typeof a) throw new FormatError(`IndexedCS - unrecognized lookup table: ${a}`);
for (let e = 0; e < n; ++e) this.lookup[e] = 255 & a.charCodeAt(e);
}
}
getRgbItem(e, t, a, n) {
const { base: s, highVal: r, lookup: i } = this, o = MathClamp(Math.round(e[t]), 0, r) * s.numComps;
s.getRgbBuffer(i, o, 1, a, n, 8, 0);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const { base: o, highVal: l, lookup: f } = this, { numComps: c } = o, h = o.getOutputLength(c, i);
for (let r = 0; r < a; ++r) {
const a = MathClamp(Math.round(e[t++]), 0, l) * c;
o.getRgbBuffer(f, a, 1, n, s, 8, i);
s += h;
}
}
getOutputLength(e, t) {
return this.base.getOutputLength(e * this.base.numComps, t);
}
isDefaultDecode(e, t) {
if (isDefaultDecodeHelper(e, 2)) return !0;
if (!Number.isInteger(t) || t < 1) {
warn("Bits per component is not correct");
return !0;
}
return 0 === e[0] && e[1] === (1 << t) - 1;
}
};
var DeviceGrayCS = class extends ColorSpace {
constructor() {
super("DeviceGray", 1);
}
getRgbItem(e, t, a, n) {
const s = 255 * e[t];
a[n] = a[n + 1] = a[n + 2] = s;
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = 255 / ((1 << r) - 1);
let l = t, f = s;
for (let t = 0; t < a; ++t) {
const t = o * e[l++];
n[f++] = t;
n[f++] = t;
n[f++] = t;
f += i;
}
}
getOutputLength(e, t) {
return e * (3 + t);
}
};
var DeviceRgbCS = class extends ColorSpace {
constructor() {
super("DeviceRGB", 3);
}
getRgbItem(e, t, a, n) {
a[n] = 255 * e[t];
a[n + 1] = 255 * e[t + 1];
a[n + 2] = 255 * e[t + 2];
}
getRgbBuffer(e, t, a, n, s, r, i) {
if (8 === r && 0 === i) {
n.set(e.subarray(t, t + 3 * a), s);
return;
}
const o = 255 / ((1 << r) - 1);
let l = t, f = s;
for (let t = 0; t < a; ++t) {
n[f++] = o * e[l++];
n[f++] = o * e[l++];
n[f++] = o * e[l++];
f += i;
}
}
getOutputLength(e, t) {
return e * (3 + t) / 3 | 0;
}
isPassthrough(e) {
return 8 === e;
}
};
var DeviceRgbaCS = class extends ColorSpace {
constructor() {
super("DeviceRGBA", 4);
}
getOutputLength(e, t) {
return 4 * e;
}
isPassthrough(e) {
return 8 === e;
}
fillRgb(e, t, a, n, s, r, i, o, l) {
a !== s || t !== n ? function resizeRgbaImage(e, t, a, n, s, r, i) {
const o = a / s, l = n / r;
let f = 0;
const c = new Uint16Array(s);
if (1 === i) {
for (let e = 0; e < s; e++) c[e] = Math.floor(e * o);
const n = new Uint32Array(e.buffer), i = new Uint32Array(t.buffer), h = FeatureTest.isLittleEndian ? 16777215 : 4294967040;
for (let e = 0; e < r; e++) {
const t = n.subarray(Math.floor(e * l) * a);
for (let e = 0; e < s; e++) i[f++] |= t[c[e]] & h;
}
} else {
const n = 4, i = a * n;
for (let e = 0; e < s; e++) c[e] = Math.floor(e * o) * n;
for (let a = 0; a < r; a++) {
const n = e.subarray(Math.floor(a * l) * i);
for (let e = 0; e < s; e++) {
const a = c[e];
t[f++] = n[a];
t[f++] = n[a + 1];
t[f++] = n[a + 2];
}
}
}
}(o, e, t, a, n, s, l) : function copyRgbaImage(e, t, a) {
if (1 === a) {
const a = new Uint32Array(e.buffer), n = new Uint32Array(t.buffer), s = FeatureTest.isLittleEndian ? 16777215 : 4294967040;
for (let e = 0, t = a.length; e < t; e++) n[e] |= a[e] & s;
} else {
let a = 0;
for (let n = 0, s = e.length; n < s; n += 4) {
t[a++] = e[n];
t[a++] = e[n + 1];
t[a++] = e[n + 2];
}
}
}(o, e, l);
}
};
var DeviceCmykCS = class extends ColorSpace {
constructor() {
super("DeviceCMYK", 4);
}
#i(e, t, a, n, s) {
const r = e[t] * a, i = e[t + 1] * a, o = e[t + 2] * a, l = e[t + 3] * a;
n[s] = 255 + r * (-4.387332384609988 * r + 54.48615194189176 * i + 18.82290502165302 * o + 212.25662451639585 * l - 285.2331026137004) + i * (1.7149763477362134 * i - 5.6096736904047315 * o + -17.873870861415444 * l - 5.497006427196366) + o * (-2.5217340131683033 * o - 21.248923337353073 * l + 17.5119270841813) + l * (-21.86122147463605 * l - 189.48180835922747);
n[s + 1] = 255 + r * (8.841041422036149 * r + 60.118027045597366 * i + 6.871425592049007 * o + 31.159100130055922 * l - 79.2970844816548) + i * (-15.310361306967817 * i + 17.575251261109482 * o + 131.35250912493976 * l - 190.9453302588951) + o * (4.444339102852739 * o + 9.8632861493405 * l - 24.86741582555878) + l * (-20.737325471181034 * l - 187.80453709719578);
n[s + 2] = 255 + r * (.8842522430003296 * r + 8.078677503112928 * i + 30.89978309703729 * o - .23883238689178934 * l - 14.183576799673286) + i * (10.49593273432072 * i + 63.02378494754052 * o + 50.606957656360734 * l - 112.23884253719248) + o * (.03296041114873217 * o + 115.60384449646641 * l - 193.58209356861505) + l * (-22.33816807309886 * l - 180.12613974708367);
}
getRgbItem(e, t, a, n) {
this.#i(e, t, 1, a, n);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = 1 / ((1 << r) - 1);
for (let r = 0; r < a; r++) {
this.#i(e, t, o, n, s);
t += 4;
s += 3 + i;
}
}
getOutputLength(e, t) {
return e / 4 * (3 + t) | 0;
}
};
var CalGrayCS = class extends ColorSpace {
constructor(e, t, a) {
super("CalGray", 1);
if (!e) throw new FormatError("WhitePoint missing - required for color space CalGray");
[this.XW, this.YW, this.ZW] = e;
[this.XB, this.YB, this.ZB] = t || [
0,
0,
0
];
this.G = a || 1;
if (this.XW < 0 || this.ZW < 0 || 1 !== this.YW) throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
info(`Invalid BlackPoint for ${this.name}, falling back to default.`);
this.XB = this.YB = this.ZB = 0;
}
0 === this.XB && 0 === this.YB && 0 === this.ZB || warn(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ZB: ${this.ZB}, only default values are supported.`);
if (this.G < 1) {
info(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`);
this.G = 1;
}
}
#i(e, t, a, n, s) {
const r = (e[t] * s) ** this.G, i = this.YW * r, o = Math.max(295.8 * i ** .3333333333333333 - 40.8, 0);
a[n] = o;
a[n + 1] = o;
a[n + 2] = o;
}
getRgbItem(e, t, a, n) {
this.#i(e, t, a, n, 1);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = 1 / ((1 << r) - 1);
for (let r = 0; r < a; ++r) {
this.#i(e, t, n, s, o);
t += 1;
s += 3 + i;
}
}
getOutputLength(e, t) {
return e * (3 + t);
}
};
var CalRGBCS = class CalRGBCS extends ColorSpace {
static #o = new Float32Array([
.8951,
.2664,
-.1614,
-.7502,
1.7135,
.0367,
.0389,
-.0685,
1.0296
]);
static #l = new Float32Array([
.9869929,
-.1470543,
.1599627,
.4323053,
.5183603,
.0492912,
-.0085287,
.0400428,
.9684867
]);
static #f = new Float32Array([
3.2404542,
-1.5371385,
-.4985314,
-.969266,
1.8760108,
.041556,
.0556434,
-.2040259,
1.0572252
]);
static #c = new Float32Array([
1,
1,
1
]);
static #h = new Float32Array(3);
static #u = new Float32Array(3);
static #m = new Float32Array(3);
static #p = (24 / 116) ** 3 / 8;
constructor(e, t, a, n) {
super("CalRGB", 3);
if (!e) throw new FormatError("WhitePoint missing - required for color space CalRGB");
const [s, r, i] = this.whitePoint = e, [o, l, f] = this.blackPoint = t || new Float32Array(3);
[this.GR, this.GG, this.GB] = a || new Float32Array([
1,
1,
1
]);
[this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = n || new Float32Array([
1,
0,
0,
0,
1,
0,
0,
0,
1
]);
if (s < 0 || i < 0 || 1 !== r) throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
if (o < 0 || l < 0 || f < 0) {
info(`Invalid BlackPoint for ${this.name} [${o}, ${l}, ${f}], falling back to default.`);
this.blackPoint = new Float32Array(3);
}
if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
info(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ${this.name}, falling back to default.`);
this.GR = this.GG = this.GB = 1;
}
}
#d(e, t, a) {
a[0] = e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
a[1] = e[3] * t[0] + e[4] * t[1] + e[5] * t[2];
a[2] = e[6] * t[0] + e[7] * t[1] + e[8] * t[2];
}
#g(e, t, a) {
a[0] = 1 * t[0] / e[0];
a[1] = 1 * t[1] / e[1];
a[2] = 1 * t[2] / e[2];
}
#b(e, t, a) {
a[0] = .95047 * t[0] / e[0];
a[1] = 1 * t[1] / e[1];
a[2] = 1.08883 * t[2] / e[2];
}
#w(e) {
return e <= .0031308 ? MathClamp(12.92 * e, 0, 1) : e >= .99554525 ? 1 : MathClamp(1.055 * e ** (1 / 2.4) - .055, 0, 1);
}
#j(e) {
return e < 0 ? -this.#j(-e) : e > 8 ? ((e + 16) / 116) ** 3 : e * CalRGBCS.#p;
}
#k(e, t, a) {
if (0 === e[0] && 0 === e[1] && 0 === e[2]) {
a[0] = t[0];
a[1] = t[1];
a[2] = t[2];
return;
}
const n = this.#j(0), s = (1 - n) / (1 - this.#j(e[0])), r = 1 - s, i = (1 - n) / (1 - this.#j(e[1])), o = 1 - i, l = (1 - n) / (1 - this.#j(e[2])), f = 1 - l;
a[0] = t[0] * s + r;
a[1] = t[1] * i + o;
a[2] = t[2] * l + f;
}
#y(e, t, a) {
if (1 === e[0] && 1 === e[2]) {
a[0] = t[0];
a[1] = t[1];
a[2] = t[2];
return;
}
const n = a;
this.#d(CalRGBCS.#o, t, n);
const s = CalRGBCS.#h;
this.#g(e, n, s);
this.#d(CalRGBCS.#l, s, a);
}
#q(e, t, a) {
const n = a;
this.#d(CalRGBCS.#o, t, n);
const s = CalRGBCS.#h;
this.#b(e, n, s);
this.#d(CalRGBCS.#l, s, a);
}
#i(e, t, a, n, s) {
const r = MathClamp(e[t] * s, 0, 1), i = MathClamp(e[t + 1] * s, 0, 1), o = MathClamp(e[t + 2] * s, 0, 1), l = 1 === r ? 1 : r ** this.GR, f = 1 === i ? 1 : i ** this.GG, c = 1 === o ? 1 : o ** this.GB, h = this.MXA * l + this.MXB * f + this.MXC * c, u = this.MYA * l + this.MYB * f + this.MYC * c, m = this.MZA * l + this.MZB * f + this.MZC * c, p = CalRGBCS.#u;
p[0] = h;
p[1] = u;
p[2] = m;
const d = CalRGBCS.#m;
this.#y(this.whitePoint, p, d);
const g = CalRGBCS.#u;
this.#k(this.blackPoint, d, g);
const b = CalRGBCS.#m;
this.#q(CalRGBCS.#c, g, b);
const w = CalRGBCS.#u;
this.#d(CalRGBCS.#f, b, w);
a[n] = 255 * this.#w(w[0]);
a[n + 1] = 255 * this.#w(w[1]);
a[n + 2] = 255 * this.#w(w[2]);
}
getRgbItem(e, t, a, n) {
this.#i(e, t, a, n, 1);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = 1 / ((1 << r) - 1);
for (let r = 0; r < a; ++r) {
this.#i(e, t, n, s, o);
t += 3;
s += 3 + i;
}
}
getOutputLength(e, t) {
return e * (3 + t) / 3 | 0;
}
};
var LabCS = class extends ColorSpace {
constructor(e, t, a) {
super("Lab", 3);
if (!e) throw new FormatError("WhitePoint missing - required for color space Lab");
[this.XW, this.YW, this.ZW] = e;
[this.amin, this.amax, this.bmin, this.bmax] = a || [
-100,
100,
-100,
100
];
[this.XB, this.YB, this.ZB] = t || [
0,
0,
0
];
if (this.XW < 0 || this.ZW < 0 || 1 !== this.YW) throw new FormatError("Invalid WhitePoint components, no fallback available");
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
info("Invalid BlackPoint, falling back to default");
this.XB = this.YB = this.ZB = 0;
}
if (this.amin > this.amax || this.bmin > this.bmax) {
info("Invalid Range, falling back to defaults");
this.amin = -100;
this.amax = 100;
this.bmin = -100;
this.bmax = 100;
}
}
#v(e) {
return e >= 6 / 29 ? e ** 3 : 108 / 841 * (e - 4 / 29);
}
#S(e, t, a, n) {
return a + e * (n - a) / t;
}
#i(e, t, a, n, s) {
let r = e[t], i = e[t + 1], o = e[t + 2];
if (!1 !== a) {
r = this.#S(r, a, 0, 100);
i = this.#S(i, a, this.amin, this.amax);
o = this.#S(o, a, this.bmin, this.bmax);
}
i > this.amax ? i = this.amax : i < this.amin && (i = this.amin);
o > this.bmax ? o = this.bmax : o < this.bmin && (o = this.bmin);
const l = (r + 16) / 116, f = l + i / 500, c = l - o / 200, h = this.XW * this.#v(f), u = this.YW * this.#v(l), m = this.ZW * this.#v(c);
let p, d, g;
if (this.ZW < 1) {
p = 3.1339 * h + -1.617 * u + -.4906 * m;
d = -.9785 * h + 1.916 * u + .0333 * m;
g = .072 * h + -.229 * u + 1.4057 * m;
} else {
p = 3.2406 * h + -1.5372 * u + -.4986 * m;
d = -.9689 * h + 1.8758 * u + .0415 * m;
g = .0557 * h + -.204 * u + 1.057 * m;
}
n[s] = 255 * Math.sqrt(p);
n[s + 1] = 255 * Math.sqrt(d);
n[s + 2] = 255 * Math.sqrt(g);
}
getRgbItem(e, t, a, n) {
this.#i(e, t, !1, a, n);
}
getRgbBuffer(e, t, a, n, s, r, i) {
const o = (1 << r) - 1;
for (let r = 0; r < a; r++) {
this.#i(e, t, o, n, s);
t += 3;
s += 3 + i;
}
}
getOutputLength(e, t) {
return e