libav-wasm 0.6.1 → 0.7.0

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/build/worker.js CHANGED
@@ -1,406 +1,592 @@
1
- const B = [];
2
- for (let c = 0; c < 256; ++c)
3
- B.push((c + 256).toString(16).slice(1));
4
- function Xn(c, _ = 0) {
5
- return (B[c[_ + 0]] + B[c[_ + 1]] + B[c[_ + 2]] + B[c[_ + 3]] + "-" + B[c[_ + 4]] + B[c[_ + 5]] + "-" + B[c[_ + 6]] + B[c[_ + 7]] + "-" + B[c[_ + 8]] + B[c[_ + 9]] + "-" + B[c[_ + 10]] + B[c[_ + 11]] + B[c[_ + 12]] + B[c[_ + 13]] + B[c[_ + 14]] + B[c[_ + 15]]).toLowerCase();
6
- }
7
- let vr;
8
- const qn = new Uint8Array(16);
9
- function Zn() {
10
- if (!vr) {
11
- if (typeof crypto > "u" || !crypto.getRandomValues)
12
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
13
- vr = crypto.getRandomValues.bind(crypto);
14
- }
15
- return vr(qn);
16
- }
17
- const ea = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), rt = { randomUUID: ea };
18
- function ra(c, _, u) {
19
- if (rt.randomUUID && !c)
20
- return rt.randomUUID();
21
- c = c || {};
22
- const b = c.random || (c.rng || Zn)();
23
- return b[6] = b[6] & 15 | 64, b[8] = b[8] & 63 | 128, Xn(b);
24
- }
25
- const Re = "__OSRA__", ta = "__OSRA_DEFAULT_KEY__", be = "__OSRA_PROXY__", tt = (c) => !!(globalThis.SharedArrayBuffer && c instanceof globalThis.SharedArrayBuffer), it = (c) => globalThis.ArrayBuffer && c instanceof globalThis.ArrayBuffer || globalThis.MessagePort && c instanceof globalThis.MessagePort || globalThis.ReadableStream && c instanceof globalThis.ReadableStream || globalThis.WritableStream && c instanceof globalThis.WritableStream || globalThis.TransformStream && c instanceof globalThis.TransformStream ? !0 : !!(globalThis.ImageBitmap && c instanceof globalThis.ImageBitmap), Ge = (c) => {
26
- const _ = [], u = (b) => tt(b) ? void 0 : it(b) ? _.push(b) : Array.isArray(b) ? b.map(u) : b && typeof b == "object" ? Object.values(b).map(u) : void 0;
27
- return u(c), _;
28
- }, ia = (c, _) => {
29
- const u = "portId" in c ? c.portId : void 0, b = "port" in c ? c.port : u ? _.addIncomingProxiedMessagePort(u) : void 0;
30
- if (!b) throw new Error("No ports received for proxied function");
31
- const R = (...D) => new Promise((n, N) => {
32
- const { port1: W, port2: Y } = new MessageChannel(), z = ye([Y, D], _), ae = Ge(z), de = (E) => {
33
- const h = Je(E.data, _);
34
- if (!(h instanceof Promise)) throw new Error("Proxied function did not return a promise");
35
- h.then(n).catch(N).finally(() => W.close());
36
- };
37
- W.addEventListener("message", de, { once: !0 }), W.start(), b.postMessage(z, { transfer: ae });
1
+ const Ke = "__OSRA_KEY__", Ca = "__OSRA_DEFAULT_KEY__", qe = "__OSRA_BOX__", Ta = () => {
2
+ const n = /* @__PURE__ */ new Map(), c = {
3
+ getUniqueUuid: () => {
4
+ let f = globalThis.crypto.randomUUID();
5
+ for (; n.has(f); )
6
+ f = globalThis.crypto.randomUUID();
7
+ return f;
8
+ },
9
+ set: (f, y) => {
10
+ n.set(f, { uuid: f, ...y });
11
+ },
12
+ alloc: (f = c.getUniqueUuid(), y) => {
13
+ if (y)
14
+ return n.set(f, { uuid: f, ...y }), { uuid: f, ...y };
15
+ const b = new MessageChannel(), m = {
16
+ uuid: f,
17
+ port1: b.port1,
18
+ port2: b.port2
19
+ };
20
+ return n.set(f, m), m;
21
+ },
22
+ has: (f) => n.has(f),
23
+ get: (f) => n.get(f),
24
+ free: (f) => n.delete(f),
25
+ getOrAlloc: (f = c.getUniqueUuid(), y) => c.get(f) || c.alloc(f, y)
26
+ };
27
+ return c;
28
+ }, mr = (n, c) => Pa(n) && n[Ke] === c, Ea = ({ listener: n, transport: c, remoteName: f, key: y = Ke, unregisterSignal: b }) => {
29
+ const m = (a) => {
30
+ if (typeof a == "function")
31
+ a(n);
32
+ else if (Qe(a) || mt(a) || ht(a)) {
33
+ const M = (F, H) => {
34
+ const O = (j, V) => {
35
+ mr(j, y) && (f && j.name !== f || n(j, { port: H, sender: V }));
36
+ };
37
+ F.addListener(O), b && b.addEventListener(
38
+ "abort",
39
+ () => F.removeListener(O)
40
+ );
41
+ };
42
+ if (mt(a)) {
43
+ const F = (H) => {
44
+ M(H.onMessage, H);
45
+ };
46
+ a.addListener(F), b && b.addEventListener(
47
+ "abort",
48
+ () => a.removeListener(F)
49
+ );
50
+ } else ht(a) ? M(a) : M(a.onMessage);
51
+ } else {
52
+ const M = (F) => {
53
+ mr(F.data, y) && (f && F.data.name !== f || n(F.data, { receiveTransport: a, source: F.source }));
54
+ };
55
+ a.addEventListener("message", M), b && b.addEventListener(
56
+ "abort",
57
+ () => a.removeEventListener("message", M)
58
+ );
59
+ }
60
+ };
61
+ Pt(c) ? m(c.receive) : m(c);
62
+ }, Aa = (n, c, f = "*", y = []) => {
63
+ const b = (m) => {
64
+ typeof m == "function" ? m(c, y) : Qe(m) ? m.postMessage(c) : $t(m) ? m.postMessage(c, f, y) : Tt(m) ? m.send(JSON.stringify(c)) : Et(m) ? m.port.postMessage(c, y) : m.postMessage(c, y);
65
+ };
66
+ Pt(n) ? b(n.emit) : b(n);
67
+ }, Sa = [
68
+ Int8Array,
69
+ Uint8Array,
70
+ Uint8ClampedArray,
71
+ Int16Array,
72
+ Uint16Array,
73
+ Int32Array,
74
+ Uint32Array,
75
+ Float16Array,
76
+ Float32Array,
77
+ Float64Array,
78
+ BigInt64Array,
79
+ BigUint64Array
80
+ ];
81
+ new Float16Array(), new BigInt64Array(), new BigUint64Array();
82
+ const Fa = (n) => {
83
+ const c = n instanceof Int8Array ? "Int8Array" : n instanceof Uint8Array ? "Uint8Array" : n instanceof Uint8ClampedArray ? "Uint8ClampedArray" : n instanceof Int16Array ? "Int16Array" : n instanceof Uint16Array ? "Uint16Array" : n instanceof Int32Array ? "Int32Array" : n instanceof Uint32Array ? "Uint32Array" : n instanceof Float16Array ? "Float16Array" : n instanceof Float32Array ? "Float32Array" : n instanceof Float64Array ? "Float64Array" : n instanceof BigInt64Array ? "BigInt64Array" : n instanceof BigUint64Array ? "BigUint64Array" : void 0;
84
+ if (c === void 0) throw new Error("Unknown typed array type");
85
+ return c;
86
+ }, Ia = (n) => {
87
+ const c = n === "Int8Array" ? Int8Array : n === "Uint8Array" ? Uint8Array : n === "Uint8ClampedArray" ? Uint8ClampedArray : n === "Int16Array" ? Int16Array : n === "Uint16Array" ? Uint16Array : n === "Int32Array" ? Int32Array : n === "Uint32Array" ? Uint32Array : n === "Float16Array" ? Float16Array : n === "Float32Array" ? Float32Array : n === "Float64Array" ? Float64Array : n === "BigInt64Array" ? BigInt64Array : n === "BigUint64Array" ? BigUint64Array : void 0;
88
+ if (c === void 0) throw new Error("Unknown typed array type");
89
+ return c;
90
+ }, Ct = (n) => Sa.some((c) => n instanceof c), Tt = (n) => n instanceof WebSocket, br = (n) => globalThis.ServiceWorkerContainer && n instanceof ServiceWorkerContainer, wr = (n) => n instanceof Worker, Cr = (n) => globalThis.DedicatedWorkerGlobalScope && n instanceof DedicatedWorkerGlobalScope, Et = (n) => globalThis.SharedWorker && n instanceof SharedWorker, Me = (n) => n instanceof MessagePort, At = (n) => n instanceof Promise, St = (n) => typeof n == "function", _t = (n) => n instanceof ArrayBuffer, Ue = (n) => n instanceof ReadableStream, Ft = (n) => n instanceof Date, It = (n) => n instanceof Error, $a = (n) => St(n) || At(n) || Ct(n) || Ft(n) || It(n), Pa = (n) => !!(n && typeof n == "object" && n[Ke]), ka = (n) => !!(globalThis.SharedArrayBuffer && n instanceof globalThis.SharedArrayBuffer), Tr = (n) => globalThis.ArrayBuffer && n instanceof globalThis.ArrayBuffer || globalThis.MessagePort && n instanceof globalThis.MessagePort || globalThis.ReadableStream && n instanceof globalThis.ReadableStream || globalThis.WritableStream && n instanceof globalThis.WritableStream || globalThis.TransformStream && n instanceof globalThis.TransformStream ? !0 : !!(globalThis.ImageBitmap && n instanceof globalThis.ImageBitmap), Qe = (n, c = !1) => !!(n && typeof n == "object" && n.name && n.disconnect && n.postMessage && (!c || n.sender && n.onMessage && n.onDisconnect)), mt = (n) => !!(n && typeof n == "object" && n.addListener && n.hasListener && n.removeListener), ht = (n) => !!(n && typeof n == "object" && n.addListener && n.hasListener && n.removeListener), $t = (n) => !!(n && typeof n == "object" && n.document && n.location && n.navigator && n.screen && n.history), Er = (n) => Tt(n) || Qe(n), Ar = (n) => Tt(n) || Qe(n) || mt(n) || ht(n), Ua = (n) => Er(n) || Ar(n), Je = (n) => Er(n) || $t(n) || br(n) || wr(n) || Cr(n) || Et(n) || Me(n) || Sr(n), bt = (n) => Ar(n) || $t(n) || br(n) || wr(n) || Cr(n) || Et(n) || Me(n) || Fr(n), Sr = (n) => !!(n && typeof n == "object" && "emit" in n && (Je(n.emit) || typeof n.emit == "function")), Fr = (n) => !!(n && typeof n == "object" && "receive" in n && (bt(n.receive) || typeof n.receive == "function")), Pt = (n) => Sr(n) || Fr(n), Ir = (n) => Me(n) || St(n) || At(n) || Ct(n) || _t(n) || Ue(n) || Ft(n) || It(n), q = (n) => n && typeof n == "object" && qe in n && n[qe] === "revivable", Ma = (n) => q(n) && n.type === "messagePort", kt = (n) => q(n) && n.type === "promise", Ra = (n) => q(n) && n.type === "function", Da = (n) => q(n) && n.type === "typedArray", La = (n) => q(n) && n.type === "arrayBuffer", Oa = (n) => q(n) && n.type === "readableStream", xa = (n) => q(n) && n.type === "error", ja = (n) => q(n) && n.type === "date", ce = (n) => {
91
+ const c = [], f = (y) => ka(y) ? void 0 : Tr(y) ? c.push(y) : Array.isArray(y) ? y.map(f) : y && typeof y == "object" ? Object.values(y).map(f) : void 0;
92
+ return f(n), c;
93
+ }, Xe = (n, c = !1) => {
94
+ const { port1: f, port2: y } = new MessageChannel(), b = new Promise(
95
+ (m) => f.addEventListener(
96
+ "message",
97
+ (a) => m(a.data)
98
+ )
99
+ );
100
+ return f.start(), y.postMessage(n, c ? ce(n) : []), b;
101
+ }, Na = async () => {
102
+ const { port1: n } = new MessageChannel();
103
+ return await Xe(n, !0) instanceof MessagePort;
104
+ }, Wa = async () => {
105
+ const n = new ArrayBuffer(1);
106
+ return await Xe(n) instanceof ArrayBuffer;
107
+ }, Ba = async () => {
108
+ const n = new ArrayBuffer(1);
109
+ return await Xe(n, !0) instanceof ArrayBuffer;
110
+ }, Ha = async () => {
111
+ const n = new ReadableStream({
112
+ start(c) {
113
+ c.enqueue(new Uint8Array(1)), c.close();
114
+ }
38
115
  });
39
- return u && _.finalizationRegistry.register(R, Number(u.split("/")[1])), R;
40
- }, na = (c, _) => {
41
- const u = _.envCheck.supportsPorts && "port" in c ? c.port : "portId" in c ? _.addIncomingProxiedMessagePort(c.portId) : void 0;
42
- if (!u) throw new Error("No ports received for proxied message port");
43
- return u;
44
- }, aa = (c, _) => new Error(c.message, { cause: c.stack }), oa = (c, _) => new Promise((u, b) => {
45
- const R = "port" in c ? c.port : "portId" in c ? _.addIncomingProxiedMessagePort(c.portId) : void 0;
46
- if (!R) throw new Error("No ports received for proxied promise");
47
- const D = async (n) => {
48
- const N = await Je(n.data, _);
49
- N instanceof Error ? b(N) : u(N), R.close();
116
+ return await Xe(n, !0) instanceof ReadableStream;
117
+ }, Va = async () => {
118
+ const [
119
+ n,
120
+ c,
121
+ f,
122
+ y
123
+ ] = await Promise.all([
124
+ Na().catch(() => !1),
125
+ Wa().catch(() => !1),
126
+ Ba().catch(() => !1),
127
+ Ha().catch(() => !1)
128
+ ]);
129
+ return {
130
+ jsonOnly: !n && !c && !f && !y,
131
+ messagePort: n,
132
+ arrayBuffer: c,
133
+ transferable: f,
134
+ transferableStream: y
50
135
  };
51
- R.addEventListener("message", D, { once: !0 }), R.start();
52
- }), Je = (c, _) => ze(
53
- c,
54
- (u) => !!(u && typeof u == "object" && be in u && u[be]),
55
- (u) => {
56
- if (u.type === "function")
57
- return ia(u, _);
58
- if (u.type === "error")
59
- return aa(u);
60
- if (u.type === "messagePort")
61
- return na(u, _);
62
- if (u.type === "promise")
63
- return oa(u, _);
64
- throw new Error(`Unknown incoming proxied type: ${c}`);
65
- }
66
- ), sa = (c, _) => ({
67
- [be]: !0,
68
- type: "error",
69
- message: c.message,
70
- stack: c.stack
71
- }), la = (c, _) => ({
72
- [be]: !0,
73
- type: "messagePort",
74
- ..._.envCheck.supportsPorts ? { port: c } : { portId: _.addOutgoingProxiedMessagePort(c) }
75
- }), da = (c, _) => {
76
- const { port1: u, port2: b } = new MessageChannel(), R = (D) => {
77
- const n = ye(D, _), N = Ge(n);
78
- u.postMessage(n, { transfer: N }), u.close();
136
+ }, Ya = (n, c) => {
137
+ const f = n, { uuid: y } = c.messageChannels.alloc(void 0, { port1: f });
138
+ return f.addEventListener("message", ({ data: b }) => {
139
+ c.sendMessage({
140
+ type: "message",
141
+ remoteUuid: c.remoteUuid,
142
+ data: q(b) ? b : re(b, c),
143
+ portId: y
144
+ });
145
+ }), f.start(), c.eventTarget.addEventListener("message", function b({ detail: m }) {
146
+ if (m.type === "message-port-close") {
147
+ if (m.portId !== y) return;
148
+ c.eventTarget.removeEventListener("message", b), f.close(), c.messageChannels.free(y);
149
+ return;
150
+ }
151
+ m.type !== "message" || m.portId !== y || f.postMessage(m.data, ce(m.data));
152
+ }), {
153
+ type: "messagePort",
154
+ portId: y
79
155
  };
80
- return c.then(R).catch(R), {
81
- [be]: !0,
156
+ }, za = (n, c) => {
157
+ const { port1: f, port2: y } = new MessageChannel();
158
+ y.addEventListener("message", ({ data: a }) => {
159
+ c.sendMessage({
160
+ type: "message",
161
+ remoteUuid: c.remoteUuid,
162
+ data: q(a) ? a : re(a, c),
163
+ portId: n.portId
164
+ });
165
+ }), y.start();
166
+ const b = c.messageChannels.get(n.portId), { port1: m } = b || c.messageChannels.alloc(n.portId);
167
+ return m.addEventListener("message", function a({ data: M }) {
168
+ if (M.type === "message-port-close") {
169
+ if (M.portId !== n.portId) return;
170
+ m.removeEventListener("message", a), y.close(), c.messageChannels.free(n.portId);
171
+ return;
172
+ }
173
+ if (!(M.type !== "message" || M.portId !== n.portId))
174
+ if (c.messagePorts.has(f))
175
+ y.postMessage(M.data);
176
+ else {
177
+ const F = le(M.data, c);
178
+ y.postMessage(F, ce(F));
179
+ }
180
+ }), m.start(), f;
181
+ }, Ga = (n, c) => {
182
+ const { port1: f, port2: y } = new MessageChannel();
183
+ c.messagePorts.add(y);
184
+ const b = (m) => {
185
+ const a = re(m, c);
186
+ f.postMessage(a, ce(a)), f.close();
187
+ };
188
+ return n.then((m) => b({ type: "resolve", data: m })).catch((m) => b({ type: "reject", error: m.stack })), {
82
189
  type: "promise",
83
- port: ye(b, _)
190
+ port: y
84
191
  };
85
- }, ca = (c, _) => {
86
- const { port1: u, port2: b } = new MessageChannel();
87
- return u.addEventListener("message", async (R) => {
88
- const [D, n] = Je(R.data, _), N = (async () => c(...n))(), W = ye(N, _), Y = Ge(W);
89
- D.postMessage(W, { transfer: Y }), D.close();
90
- }), u.start(), {
91
- [be]: !0,
192
+ }, Ja = (n, c) => (c.messagePorts.add(n.port), new Promise((f, y) => {
193
+ n.port.addEventListener("message", ({ data: b }) => {
194
+ const m = le(b, c);
195
+ m.type === "resolve" ? f(m.data) : y(m.error), n.port.close();
196
+ }, { once: !0 }), n.port.start();
197
+ })), qa = (n, c) => {
198
+ const { port1: f, port2: y } = new MessageChannel();
199
+ return c.messagePorts.add(y), f.addEventListener("message", ({ data: b }) => {
200
+ const [m, a] = le(b, c), M = (async () => n(...a))(), F = re(M, c);
201
+ m.postMessage(F, ce(F));
202
+ }), f.start(), {
92
203
  type: "function",
93
- port: ye(b, _)
204
+ port: y
205
+ };
206
+ }, Ka = (n, c) => (...f) => new Promise((y, b) => {
207
+ const { port1: m, port2: a } = new MessageChannel();
208
+ c.messagePorts.add(a);
209
+ const M = re([a, f], c);
210
+ n.port.postMessage(M, ce(M)), m.addEventListener("message", ({ data: F }) => {
211
+ if (!kt(F)) throw new Error("Proxied function did not return a promise");
212
+ le(F, c).then(y).catch(b).finally(() => m.close());
213
+ }), m.start();
214
+ }), Qa = (n, c) => ({
215
+ type: "typedArray",
216
+ typedArrayType: Fa(n),
217
+ arrayBuffer: n.buffer
218
+ }), Xa = (n, c) => {
219
+ const f = Ia(n.typedArrayType);
220
+ return new f(n.arrayBuffer);
221
+ }, Za = (n, c) => ({
222
+ type: "arrayBuffer",
223
+ base64Buffer: new Uint8Array(n).toBase64()
224
+ }), eo = (n, c) => Uint8Array.fromBase64(n.base64Buffer).buffer, to = (n, c) => ({
225
+ type: "error",
226
+ message: n.message,
227
+ stack: n.stack || n.toString()
228
+ }), ro = (n, c) => new Error(n.message, { cause: n.stack }), hr = (n, c) => {
229
+ const { port1: f, port2: y } = new MessageChannel();
230
+ c.messagePorts.add(y);
231
+ const b = n.getReader();
232
+ return f.addEventListener("message", async ({ data: m }) => {
233
+ const { type: a } = le(m, c);
234
+ if (a === "pull") {
235
+ const M = b.read(), F = re(M, c);
236
+ f.postMessage(F, ce(F));
237
+ } else
238
+ b.cancel(), f.close();
239
+ }), f.start(), {
240
+ type: "readableStream",
241
+ port: y
94
242
  };
95
- }, ye = (c, _) => ze(
96
- c,
97
- (u) => typeof u == "function" || u instanceof Error || u instanceof MessagePort || u instanceof Promise,
98
- (u) => {
99
- if (typeof u == "function")
100
- return ca(u, _);
101
- if (u instanceof Error)
102
- return sa(u);
103
- if (u instanceof MessagePort)
104
- return la(u, _);
105
- if (u instanceof Promise)
106
- return da(u, _);
107
- throw new Error(`Unknown outgoing proxied type: ${u}`);
243
+ }, no = (n, c) => (c.messagePorts.add(n.port), n.port.start(), new ReadableStream({
244
+ start(f) {
245
+ },
246
+ pull(f) {
247
+ return new Promise((y, b) => {
248
+ n.port.addEventListener("message", async ({ data: m }) => {
249
+ if (!kt(m)) throw new Error("Proxied function did not return a promise");
250
+ le(m, c).then((a) => {
251
+ a.done ? f.close() : f.enqueue(a.value), y();
252
+ }).catch(b);
253
+ }, { once: !0 }), n.port.postMessage(re({ type: "pull" }, c));
254
+ });
255
+ },
256
+ cancel() {
257
+ n.port.postMessage(re({ type: "cancel" }, c)), n.port.close();
108
258
  }
109
- ), ze = (c, _, u) => tt(c) || it(c) ? c : _(c) ? u(c) : Array.isArray(c) ? c.map((b) => ze(b, _, u)) : c && typeof c == "object" ? Object.fromEntries(
110
- Object.entries(c).map(([b, R]) => [
111
- b,
112
- ze(R, _, u)
113
- ])
114
- ) : c, ua = () => {
115
- let c = 0;
116
- const _ = /* @__PURE__ */ new Set();
117
- return {
118
- alloc: () => {
119
- if (_.size > 0) {
120
- const u = _.values().next().value;
121
- if (u === void 0)
122
- throw new Error("Tried to allocate number from freedUnused but result was undefined");
123
- return _.delete(u), u;
124
- }
125
- return c++, c;
126
- },
127
- free: (u) => {
128
- _.add(u);
129
- }
259
+ })), io = (n, c) => ({
260
+ type: "date",
261
+ ISOString: n.toISOString()
262
+ }), ao = (n, c) => new Date(n.ISOString), oo = (n, c) => $a(n) || Ue(n) && !c.platformCapabilities.transferableStream ? {
263
+ [qe]: "revivable",
264
+ ...St(n) ? qa(n, c) : At(n) ? Ga(n, c) : Ct(n) ? Qa(n) : Ue(n) ? hr(n, c) : Ft(n) ? io(n) : It(n) ? to(n) : n
265
+ } : {
266
+ [qe]: "revivable",
267
+ ..."isJson" in c.transport && c.transport.isJson ? Me(n) ? Ya(n, c) : _t(n) ? Za(n) : Ue(n) ? hr(n, c) : { type: "unknown", value: n } : {
268
+ type: Me(n) ? "messagePort" : _t(n) ? "arrayBuffer" : Ue(n) ? "readableStream" : "unknown",
269
+ value: n
270
+ }
271
+ }, re = (n, c) => {
272
+ const f = Ir(n) ? oo(n, c) : n;
273
+ return Array.isArray(f) ? f.map((y) => re(y, c)) : f && typeof f == "object" && Object.getPrototypeOf(f) === Object.prototype ? Object.fromEntries(
274
+ Object.entries(f).map(([y, b]) => [
275
+ y,
276
+ q(f) && f.type === "messagePort" && f.value instanceof MessagePort || q(f) && f.type === "arrayBuffer" && f.value instanceof ArrayBuffer || q(f) && f.type === "readableStream" && f.value instanceof ReadableStream ? b : re(b, c)
277
+ ])
278
+ ) : f;
279
+ }, so = (n, c) => Ir(n.value) ? n.value : Ma(n) ? za(n, c) : Ra(n) ? Ka(n, c) : kt(n) ? Ja(n, c) : xa(n) ? ro(n) : Da(n) ? Xa(n) : La(n) ? eo(n) : Oa(n) ? no(n, c) : ja(n) ? ao(n) : n, le = (n, c) => {
280
+ const f = Tr(n) ? n : Array.isArray(n) ? n.map((y) => le(y, c)) : n && typeof n == "object" ? Object.fromEntries(
281
+ Object.entries(n).map(([y, b]) => [
282
+ y,
283
+ le(b, c)
284
+ ])
285
+ ) : n;
286
+ return q(f) ? so(f, c) : f;
287
+ }, lo = ({ transport: n, value: c, uuid: f, remoteUuid: y, platformCapabilities: b, eventTarget: m, send: a, close: M }) => {
288
+ const F = {
289
+ platformCapabilities: b,
290
+ transport: n,
291
+ remoteUuid: y,
292
+ messagePorts: /* @__PURE__ */ new Set(),
293
+ messageChannels: Ta(),
294
+ sendMessage: a,
295
+ eventTarget: m
130
296
  };
131
- }, fa = ({ numberAllocator: c }) => {
132
- const _ = /* @__PURE__ */ new Map();
133
- return {
134
- alloc: (u) => {
135
- const b = c.alloc();
136
- return _.set(b, u), b;
297
+ let H;
298
+ const O = new Promise((j, V) => {
299
+ H = j;
300
+ });
301
+ return m.addEventListener("message", ({ detail: j }) => {
302
+ if (j.type === "init") {
303
+ H(j);
304
+ return;
305
+ } else j.type === "message" && F.messageChannels.getOrAlloc(j.portId).port2?.postMessage(j);
306
+ }), a({
307
+ type: "init",
308
+ remoteUuid: y,
309
+ data: re(c, F)
310
+ }), {
311
+ revivableContext: F,
312
+ close: () => {
137
313
  },
138
- get: (u) => _.get(u),
139
- free: (u) => {
140
- _.delete(u), c.free(u);
141
- }
314
+ remoteValue: O.then((j) => le(j.data, F))
142
315
  };
143
- }, va = async (c, {
144
- remote: _,
145
- local: u,
146
- key: b = ta,
147
- origin: R = "*"
316
+ }, co = ({ value: n, uuid: c, platformCapabilities: f, send: y, close: b }) => ({
317
+ close: () => {
318
+ },
319
+ remoteValueProxy: new Proxy(
320
+ new Function(),
321
+ {
322
+ apply: (m, a, M) => {
323
+ },
324
+ get: (m, a) => {
325
+ }
326
+ }
327
+ )
328
+ });
329
+ var uo = class extends EventTarget {
330
+ dispatchTypedEvent(n, c) {
331
+ return super.dispatchEvent(c);
332
+ }
333
+ };
334
+ const fo = async (n, {
335
+ transport: c,
336
+ name: f,
337
+ remoteName: y,
338
+ key: b = Ca,
339
+ origin: m = "*",
340
+ unregisterSignal: a,
341
+ platformCapabilities: M,
342
+ transferAll: F,
343
+ logger: H
148
344
  }) => {
149
- const D = ra();
150
- let n;
151
- const N = new FinalizationRegistry((T) => {
152
- const O = Y.get(T);
153
- if (!O) throw new Error(`Osra received a port-closed message with an invalid portId "${T}".`);
154
- O(), Y.free(T);
155
- }), W = ua(), Y = fa({ numberAllocator: W }), z = /* @__PURE__ */ new Map(), ae = (T) => {
156
- const { port1: O, port2: f } = new MessageChannel();
157
- return z.set(T, O), f;
158
- }, de = (T) => {
159
- const O = Y.alloc(() => {
160
- T.close();
161
- });
162
- return T.addEventListener("message", async (f) => {
163
- L(
164
- {
165
- [Re]: !0,
166
- key: b,
167
- type: "message",
168
- portId: `${D}/${O}`,
169
- data: ye(f.data, E())
170
- },
171
- []
172
- );
173
- }), T.addEventListener("close", () => {
174
- W.free(O), L(
175
- {
176
- [Re]: !0,
177
- key: b,
178
- type: "port-closed",
179
- portId: `${D}/${O}`
180
- },
181
- []
182
- );
183
- }), `${D}/${O}`;
184
- }, E = () => {
185
- if (!n) throw new Error("Osra context was accessed before the ready message was received.");
186
- return {
187
- addIncomingProxiedMessagePort: ae,
188
- addOutgoingProxiedMessagePort: de,
189
- envCheck: n,
190
- finalizationRegistry: N
191
- };
192
- };
193
- let h;
194
- const $ = new Promise((T, O) => {
195
- h = T;
196
- }), I = () => {
197
- const T = new ArrayBuffer(1), { port1: O } = new MessageChannel();
198
- L(
345
+ const O = {
346
+ isJson: "isJson" in c && c.isJson !== void 0 ? c.isJson : Ua(c),
347
+ ...Pt(c) ? c : {
348
+ emit: c,
349
+ receive: c
350
+ }
351
+ }, j = M ?? await Va(), V = /* @__PURE__ */ new Map();
352
+ let P;
353
+ const T = new Promise((C) => {
354
+ P = C;
355
+ });
356
+ let A = globalThis.crypto.randomUUID();
357
+ const I = (C, W) => {
358
+ const N = ce(W);
359
+ Aa(
360
+ C,
199
361
  {
200
- [Re]: !0,
201
- key: b,
202
- type: "ready",
203
- envCheck: { buffer: T, port: O }
362
+ [Ke]: b,
363
+ name: f,
364
+ uuid: A,
365
+ ...W
204
366
  },
205
- [T, O]
367
+ m,
368
+ N
206
369
  );
207
- };
208
- let S = !1;
209
- const x = async (T) => {
210
- if (!T.data || typeof T.data != "object" || !T.data[Re] || T.data.key !== b) return;
211
- const { type: O } = T.data;
212
- if (O === "ready" && !S) {
213
- S = !0, n = {
214
- uuid: D,
215
- supportsPorts: T.data.envCheck.port instanceof MessagePort,
216
- jsonOnly: T.data.envCheck.buffer instanceof ArrayBuffer
217
- }, I();
218
- const f = ye(c, E()), j = Ge(f);
219
- L(
220
- {
221
- [Re]: !0,
222
- key: b,
223
- type: "init",
224
- data: f
225
- },
226
- j
227
- );
228
- return;
229
- }
230
- if (!S || !n) throw new Error("Osra received a message before the ready message.");
231
- if (O === "init") {
232
- h(
233
- Je(
234
- T.data.data,
235
- E()
236
- )
237
- );
238
- return;
239
- }
240
- if (O === "message") {
241
- const { portId: f, data: j } = T.data, H = z.get(f);
242
- if (!H) throw new Error(`Osra received a message with portId set to "${f}" but no port was found.`);
243
- H.postMessage(j);
244
- } else if (O === "port-closed") {
245
- const { portId: f } = T.data, [j, H] = f.split("/"), oe = Number(H);
246
- if (!oe) throw new Error(`Osra received a port-closed message with an invalid portId "${f}".`);
247
- if (j !== D && j !== n.uuid) throw new Error(`Osra received a port-closed message with an invalid portId's uuid "${f}".`);
248
- if (j === D) {
249
- const te = Y.get(oe);
250
- if (!te) throw new Error(`Osra received a port-closed message with an invalid portId "${f}".`);
251
- te();
252
- } else if (j === n.uuid) {
253
- const te = z.get(f);
254
- if (!te) throw new Error(`Osra received a message with portId set to "${f}" but no port was found.`);
255
- te.close(), z.delete(f);
370
+ }, $ = async (C, W) => {
371
+ if (C.uuid !== A) {
372
+ if (!Je(O))
373
+ throw new Error("Unidirectional receiving mode not implemented");
374
+ if (C.type === "announce") {
375
+ if (!C.remoteUuid) {
376
+ I(O, { type: "announce", remoteUuid: C.uuid });
377
+ return;
378
+ }
379
+ if (C.remoteUuid !== A) return;
380
+ if (V.has(C.uuid)) {
381
+ I(
382
+ O,
383
+ { type: "reject-uuid-taken", remoteUuid: C.uuid }
384
+ );
385
+ return;
386
+ }
387
+ const N = new uo(), Re = {
388
+ type: "bidirectional",
389
+ eventTarget: N,
390
+ connection: lo({
391
+ transport: O,
392
+ value: n,
393
+ uuid: A,
394
+ remoteUuid: C.uuid,
395
+ platformCapabilities: j,
396
+ eventTarget: N,
397
+ send: (g) => I(O, g),
398
+ close: () => void V.delete(C.uuid)
399
+ })
400
+ };
401
+ V.set(C.uuid, Re), Re.connection.remoteValue.then(
402
+ (g) => P(g)
403
+ );
404
+ } else if (C.type === "reject-uuid-taken") {
405
+ if (C.remoteUuid !== A) return;
406
+ A = globalThis.crypto.randomUUID(), I(O, { type: "announce" });
407
+ } else if (C.type === "close") {
408
+ if (C.remoteUuid !== A) return;
409
+ const N = V.get(C.uuid);
410
+ if (!N) {
411
+ console.warn(`Connection not found for remoteUuid: ${C.uuid}`);
412
+ return;
413
+ }
414
+ N.connection.close(), V.delete(C.uuid);
415
+ } else {
416
+ if (C.remoteUuid !== A) return;
417
+ const N = V.get(C.uuid);
418
+ if (!N) {
419
+ console.warn(`Connection not found for remoteUuid: ${C.uuid}`);
420
+ return;
421
+ }
422
+ N.type !== "unidirectional-emitting" && N.eventTarget.dispatchTypedEvent(
423
+ "message",
424
+ new CustomEvent("message", { detail: C })
425
+ );
256
426
  }
257
427
  }
258
- }, L = typeof _ == "function" ? _ : (T, O = []) => _.postMessage(T, { targetOrigin: R, transfer: O });
259
- return typeof u == "function" ? u(x) : u.addEventListener("message", x), I(), $;
428
+ };
429
+ if (bt(O) && Ea({
430
+ listener: $,
431
+ transport: O,
432
+ remoteName: y,
433
+ key: b,
434
+ unregisterSignal: a
435
+ }), Je(O) && I(O, { type: "announce" }), Je(O) && !bt(O)) {
436
+ const { remoteValueProxy: C } = co({
437
+ value: n,
438
+ uuid: A,
439
+ platformCapabilities: j,
440
+ send: (W) => I(O, W),
441
+ close: () => V.delete(A)
442
+ });
443
+ return C;
444
+ }
445
+ return T;
260
446
  };
261
- var pr = {}, pa = {
447
+ var wt = {}, po = {
262
448
  get exports() {
263
- return pr;
449
+ return wt;
264
450
  },
265
- set exports(c) {
266
- pr = c;
451
+ set exports(n) {
452
+ wt = n;
267
453
  }
268
454
  };
269
- (function(c, _) {
270
- var u = (() => {
271
- var b = typeof document < "u" ? document.currentScript?.src : void 0;
272
- return async function(R = {}) {
273
- var D, n = R, N, W, Y = new Promise((e, r) => {
274
- N = e, W = r;
275
- }), z = Object.assign({}, n), ae = "./this.program", de = (e, r) => {
276
- throw r;
277
- }, E = "";
278
- function h(e) {
279
- return n.locateFile ? n.locateFile(e, E) : E + e;
455
+ (function(n, c) {
456
+ var f = (() => {
457
+ var y = typeof document < "u" ? document.currentScript?.src : void 0;
458
+ return async function(b = {}) {
459
+ var m, a = b, M, F, H = new Promise((e, t) => {
460
+ M = e, F = t;
461
+ }), O = Object.assign({}, a), j = "./this.program", V = (e, t) => {
462
+ throw t;
463
+ }, P = "";
464
+ function T(e) {
465
+ return a.locateFile ? a.locateFile(e, P) : P + e;
280
466
  }
281
- var $;
467
+ var A;
282
468
  {
283
- if (typeof document < "u" && document.currentScript && (E = document.currentScript.src), b && (E = b), E.startsWith("blob:") ? E = "" : E = E.slice(0, E.replace(/[?#].*/, "").lastIndexOf("/") + 1), !(typeof window == "object" || typeof WorkerGlobalScope < "u")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
284
- $ = async (e) => {
285
- f(!mr(e), "readAsync does not work with file:// URLs");
286
- var r = await fetch(e, { credentials: "same-origin" });
287
- if (r.ok)
288
- return r.arrayBuffer();
289
- throw new Error(r.status + " : " + r.url);
469
+ if (typeof document < "u" && document.currentScript && (P = document.currentScript.src), y && (P = y), P.startsWith("blob:") ? P = "" : P = P.slice(0, P.replace(/[?#].*/, "").lastIndexOf("/") + 1), !(typeof window == "object" || typeof WorkerGlobalScope < "u")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
470
+ A = async (e) => {
471
+ g(!Dt(e), "readAsync does not work with file:// URLs");
472
+ var t = await fetch(e, { credentials: "same-origin" });
473
+ if (t.ok)
474
+ return t.arrayBuffer();
475
+ throw new Error(t.status + " : " + t.url);
290
476
  };
291
477
  }
292
- var I = n.print || console.log.bind(console), S = n.printErr || console.error.bind(console);
293
- Object.assign(n, z), z = null, Ln(), n.arguments && n.arguments, ue("arguments", "arguments_"), n.thisProgram && (ae = n.thisProgram), ue("thisProgram", "thisProgram"), f(typeof n.memoryInitializerPrefixURL > "u", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), f(typeof n.pthreadMainPrefixURL > "u", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), f(typeof n.cdInitializerPrefixURL > "u", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), f(typeof n.filePackagePrefixURL > "u", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), f(typeof n.read > "u", "Module.read option was removed"), f(typeof n.readAsync > "u", "Module.readAsync option was removed (modify readAsync in JS)"), f(typeof n.readBinary > "u", "Module.readBinary option was removed (modify readBinary in JS)"), f(typeof n.setWindowTitle > "u", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"), f(typeof n.TOTAL_MEMORY > "u", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"), ue("asm", "wasmExports"), ue("readAsync", "readAsync"), ue("readBinary", "readBinary"), ue("setWindowTitle", "setWindowTitle"), f(!0, "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."), f(!0, "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."), f(!0, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
294
- var x = n.wasmBinary;
295
- ue("wasmBinary", "wasmBinary"), typeof WebAssembly != "object" && S("no native wasm support detected");
296
- var L, T = !1, O;
297
- function f(e, r) {
298
- e || M("Assertion failed" + (r ? ": " + r : ""));
478
+ var I = a.print || console.log.bind(console), $ = a.printErr || console.error.bind(console);
479
+ Object.assign(a, O), O = null, da(), a.arguments && a.arguments, ue("arguments", "arguments_"), a.thisProgram && (j = a.thisProgram), ue("thisProgram", "thisProgram"), g(typeof a.memoryInitializerPrefixURL > "u", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), g(typeof a.pthreadMainPrefixURL > "u", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), g(typeof a.cdInitializerPrefixURL > "u", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), g(typeof a.filePackagePrefixURL > "u", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), g(typeof a.read > "u", "Module.read option was removed"), g(typeof a.readAsync > "u", "Module.readAsync option was removed (modify readAsync in JS)"), g(typeof a.readBinary > "u", "Module.readBinary option was removed (modify readBinary in JS)"), g(typeof a.setWindowTitle > "u", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"), g(typeof a.TOTAL_MEMORY > "u", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"), ue("asm", "wasmExports"), ue("readAsync", "readAsync"), ue("readBinary", "readBinary"), ue("setWindowTitle", "setWindowTitle"), g(!0, "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."), g(!0, "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."), g(!0, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
480
+ var C = a.wasmBinary;
481
+ ue("wasmBinary", "wasmBinary"), typeof WebAssembly != "object" && $("no native wasm support detected");
482
+ var W, N = !1, Re;
483
+ function g(e, t) {
484
+ e || L("Assertion failed" + (t ? ": " + t : ""));
299
485
  }
300
- var j, H, oe, te, w, F, _r, we, yr, gr, Ke = !1, mr = (e) => e.startsWith("file://");
301
- function nt() {
302
- var e = Ye();
303
- f((e & 3) == 0), e == 0 && (e += 4), F[e >> 2] = 34821223, C(34821223), F[e + 4 >> 2] = 2310721022, C(2310721022), F[0] = 1668509029, C(1668509029);
486
+ var ne, K, ge, De, E, k, Ut, be, Mt, Rt, Ze = !1, Dt = (e) => e.startsWith("file://");
487
+ function $r() {
488
+ var e = Ge();
489
+ g((e & 3) == 0), e == 0 && (e += 4), k[e >> 2] = 34821223, S(34821223), k[e + 4 >> 2] = 2310721022, S(2310721022), k[0] = 1668509029, S(1668509029);
304
490
  }
305
- function De() {
306
- if (!T) {
307
- var e = Ye();
491
+ function Le() {
492
+ if (!N) {
493
+ var e = Ge();
308
494
  e == 0 && (e += 4);
309
- var r = F[e >> 2], t = F[e + 4 >> 2];
310
- (r != 34821223 || t != 2310721022) && M(`Stack overflow! Stack cookie has been overwritten at ${se(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${se(t)} ${se(r)}`), F[0] != 1668509029 && M("Runtime error: The application has corrupted its heap memory area (address zero)!");
495
+ var t = k[e >> 2], r = k[e + 4 >> 2];
496
+ (t != 34821223 || r != 2310721022) && L(`Stack overflow! Stack cookie has been overwritten at ${oe(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${oe(r)} ${oe(t)}`), k[0] != 1668509029 && L("Runtime error: The application has corrupted its heap memory area (address zero)!");
311
497
  }
312
498
  }
313
499
  if ((() => {
314
- var e = new Int16Array(1), r = new Int8Array(e.buffer);
315
- if (e[0] = 25459, r[0] !== 115 || r[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
316
- })(), n.ENVIRONMENT)
500
+ var e = new Int16Array(1), t = new Int8Array(e.buffer);
501
+ if (e[0] = 25459, t[0] !== 115 || t[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
502
+ })(), a.ENVIRONMENT)
317
503
  throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");
318
- function ue(e, r, t = !0) {
319
- Object.getOwnPropertyDescriptor(n, e) || Object.defineProperty(n, e, {
504
+ function ue(e, t, r = !0) {
505
+ Object.getOwnPropertyDescriptor(a, e) || Object.defineProperty(a, e, {
320
506
  configurable: !0,
321
507
  get() {
322
- let i = t ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : "";
323
- M(`\`Module.${e}\` has been replaced by \`${r}\`` + i);
508
+ let i = r ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : "";
509
+ L(`\`Module.${e}\` has been replaced by \`${t}\`` + i);
324
510
  }
325
511
  });
326
512
  }
327
- function at(e) {
328
- Object.getOwnPropertyDescriptor(n, e) && M(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`);
513
+ function Pr(e) {
514
+ Object.getOwnPropertyDescriptor(a, e) && L(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`);
329
515
  }
330
- function ot(e) {
516
+ function kr(e) {
331
517
  return e === "FS_createPath" || e === "FS_createDataFile" || e === "FS_createPreloadedFile" || e === "FS_unlink" || e === "addRunDependency" || // The old FS has some functionality that WasmFS lacks.
332
518
  e === "FS_createLazyFile" || e === "FS_createDevice" || e === "removeRunDependency";
333
519
  }
334
- function st(e) {
335
- hr(e);
520
+ function Ur(e) {
521
+ Lt(e);
336
522
  }
337
- function hr(e) {
338
- Object.getOwnPropertyDescriptor(n, e) || Object.defineProperty(n, e, {
523
+ function Lt(e) {
524
+ Object.getOwnPropertyDescriptor(a, e) || Object.defineProperty(a, e, {
339
525
  configurable: !0,
340
526
  get() {
341
- var r = `'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
342
- ot(e) && (r += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), M(r);
527
+ var t = `'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
528
+ kr(e) && (t += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), L(t);
343
529
  }
344
530
  });
345
531
  }
346
- var lt = 2 ** 8 - 1, dt = 2 ** 16 - 1, ct = 2 ** 32 - 1, ut = 2 ** 64 - 1, ft = -128, vt = -32768, pt = -2147483648, _t = -9223372036854776e3;
347
- function Ue(e, r, t, i) {
348
- f(Number.isInteger(Number(e)), `attempt to write non-integer (${e}) into integer heap`), f(e <= i, `value (${e}) too large to write as ${r}-bit value`), f(e >= t, `value (${e}) too small to write as ${r}-bit value`);
532
+ var Mr = 2 ** 8 - 1, Rr = 2 ** 16 - 1, Dr = 2 ** 32 - 1, Lr = 2 ** 64 - 1, Or = -128, xr = -32768, jr = -2147483648, Nr = -9223372036854776e3;
533
+ function Oe(e, t, r, i) {
534
+ g(Number.isInteger(Number(e)), `attempt to write non-integer (${e}) into integer heap`), g(e <= i, `value (${e}) too large to write as ${t}-bit value`), g(e >= r, `value (${e}) too small to write as ${t}-bit value`);
349
535
  }
350
- var Ce = (e) => Ue(e, 8, ft, lt), Qe = (e) => Ue(e, 16, vt, dt), C = (e) => Ue(e, 32, pt, ct), Xe = (e) => Ue(e, 64, _t, ut);
351
- function yt(...e) {
536
+ var we = (e) => Oe(e, 8, Or, Mr), et = (e) => Oe(e, 16, xr, Rr), S = (e) => Oe(e, 32, jr, Dr), tt = (e) => Oe(e, 64, Nr, Lr);
537
+ function Wr(...e) {
352
538
  console.warn(...e);
353
539
  }
354
- function br() {
355
- var e = L.buffer;
356
- n.HEAP8 = j = new Int8Array(e), n.HEAP16 = oe = new Int16Array(e), n.HEAPU8 = H = new Uint8Array(e), n.HEAPU16 = te = new Uint16Array(e), n.HEAP32 = w = new Int32Array(e), n.HEAPU32 = F = new Uint32Array(e), n.HEAPF32 = _r = new Float32Array(e), n.HEAPF64 = gr = new Float64Array(e), n.HEAP64 = we = new BigInt64Array(e), n.HEAPU64 = yr = new BigUint64Array(e);
540
+ function Ot() {
541
+ var e = W.buffer;
542
+ a.HEAP8 = ne = new Int8Array(e), a.HEAP16 = ge = new Int16Array(e), a.HEAPU8 = K = new Uint8Array(e), a.HEAPU16 = De = new Uint16Array(e), a.HEAP32 = E = new Int32Array(e), a.HEAPU32 = k = new Uint32Array(e), a.HEAPF32 = Ut = new Float32Array(e), a.HEAPF64 = Rt = new Float64Array(e), a.HEAP64 = be = new BigInt64Array(e), a.HEAPU64 = Mt = new BigUint64Array(e);
357
543
  }
358
- f(!n.STACK_SIZE, "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"), f(
544
+ g(!a.STACK_SIZE, "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"), g(
359
545
  typeof Int32Array < "u" && typeof Float64Array < "u" && Int32Array.prototype.subarray != null && Int32Array.prototype.set != null,
360
546
  "JS engine does not provide full typed array support"
361
- ), f(!n.wasmMemory, "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"), f(!n.INITIAL_MEMORY, "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");
362
- function gt() {
363
- if (n.preRun)
364
- for (typeof n.preRun == "function" && (n.preRun = [n.preRun]); n.preRun.length; )
365
- kt(n.preRun.shift());
366
- wr(Tr);
547
+ ), g(!a.wasmMemory, "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"), g(!a.INITIAL_MEMORY, "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");
548
+ function Br() {
549
+ if (a.preRun)
550
+ for (typeof a.preRun == "function" && (a.preRun = [a.preRun]); a.preRun.length; )
551
+ rn(a.preRun.shift());
552
+ xt(Nt);
367
553
  }
368
- function mt() {
369
- f(!Ke), Ke = !0, De(), Mt(), V.__wasm_call_ctors();
554
+ function Hr() {
555
+ g(!Ze), Ze = !0, Le(), nn(), B.__wasm_call_ctors();
370
556
  }
371
- function ht() {
372
- if (De(), n.postRun)
373
- for (typeof n.postRun == "function" && (n.postRun = [n.postRun]); n.postRun.length; )
374
- It(n.postRun.shift());
375
- wr(Cr);
557
+ function Vr() {
558
+ if (Le(), a.postRun)
559
+ for (typeof a.postRun == "function" && (a.postRun = [a.postRun]); a.postRun.length; )
560
+ tn(a.postRun.shift());
561
+ xt(jt);
376
562
  }
377
- var fe = 0, Te = null, Ee = {}, ve = null;
378
- function bt(e) {
379
- fe++, n.monitorRunDependencies?.(fe), f(!Ee[e]), Ee[e] = 1, ve === null && typeof setInterval < "u" && (ve = setInterval(() => {
380
- if (T) {
381
- clearInterval(ve), ve = null;
563
+ var fe = 0, Ce = null, Te = {}, pe = null;
564
+ function Yr(e) {
565
+ fe++, a.monitorRunDependencies?.(fe), g(!Te[e]), Te[e] = 1, pe === null && typeof setInterval < "u" && (pe = setInterval(() => {
566
+ if (N) {
567
+ clearInterval(pe), pe = null;
382
568
  return;
383
569
  }
384
- var r = !1;
385
- for (var t in Ee)
386
- r || (r = !0, S("still waiting on run dependencies:")), S(`dependency: ${t}`);
387
- r && S("(end of list)");
570
+ var t = !1;
571
+ for (var r in Te)
572
+ t || (t = !0, $("still waiting on run dependencies:")), $(`dependency: ${r}`);
573
+ t && $("(end of list)");
388
574
  }, 1e4));
389
575
  }
390
- function wt(e) {
391
- if (fe--, n.monitorRunDependencies?.(fe), f(Ee[e]), delete Ee[e], fe == 0 && (ve !== null && (clearInterval(ve), ve = null), Te)) {
392
- var r = Te;
393
- Te = null, r();
576
+ function zr(e) {
577
+ if (fe--, a.monitorRunDependencies?.(fe), g(Te[e]), delete Te[e], fe == 0 && (pe !== null && (clearInterval(pe), pe = null), Ce)) {
578
+ var t = Ce;
579
+ Ce = null, t();
394
580
  }
395
581
  }
396
- function M(e) {
397
- n.onAbort?.(e), e = "Aborted(" + e + ")", S(e), T = !0, e.indexOf("RuntimeError: unreachable") >= 0 && (e += '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)');
398
- var r = new WebAssembly.RuntimeError(e);
399
- throw W(r), r;
582
+ function L(e) {
583
+ a.onAbort?.(e), e = "Aborted(" + e + ")", $(e), N = !0, e.indexOf("RuntimeError: unreachable") >= 0 && (e += '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)');
584
+ var t = new WebAssembly.RuntimeError(e);
585
+ throw F(t), t;
400
586
  }
401
587
  var Z = {
402
588
  error() {
403
- M("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM");
589
+ L("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM");
404
590
  },
405
591
  init() {
406
592
  Z.error();
@@ -430,370 +616,370 @@ var pr = {}, pa = {
430
616
  Z.error();
431
617
  }
432
618
  };
433
- n.FS_createDataFile = Z.createDataFile, n.FS_createPreloadedFile = Z.createPreloadedFile;
434
- function v(e, r) {
435
- return (...t) => {
436
- f(Ke, `native function \`${e}\` called before runtime initialization`);
437
- var i = V[e];
438
- return f(i, `exported native function \`${e}\` not found`), f(t.length <= r, `native function \`${e}\` called with ${t.length} args but expects ${r}`), i(...t);
619
+ a.FS_createDataFile = Z.createDataFile, a.FS_createPreloadedFile = Z.createPreloadedFile;
620
+ function p(e, t) {
621
+ return (...r) => {
622
+ g(Ze, `native function \`${e}\` called before runtime initialization`);
623
+ var i = B[e];
624
+ return g(i, `exported native function \`${e}\` not found`), g(r.length <= t, `native function \`${e}\` called with ${r.length} args but expects ${t}`), i(...r);
439
625
  };
440
626
  }
441
- var Se;
442
- function Ct() {
443
- return h("libav.wasm");
627
+ var Ee;
628
+ function Gr() {
629
+ return T("libav.wasm");
444
630
  }
445
- function Tt(e) {
446
- if (e == Se && x)
447
- return new Uint8Array(x);
631
+ function Jr(e) {
632
+ if (e == Ee && C)
633
+ return new Uint8Array(C);
448
634
  throw "both async and sync fetching of the wasm failed";
449
635
  }
450
- async function Et(e) {
451
- if (!x)
636
+ async function qr(e) {
637
+ if (!C)
452
638
  try {
453
- var r = await $(e);
454
- return new Uint8Array(r);
639
+ var t = await A(e);
640
+ return new Uint8Array(t);
455
641
  } catch {
456
642
  }
457
- return Tt(e);
643
+ return Jr(e);
458
644
  }
459
- async function St(e, r) {
645
+ async function Kr(e, t) {
460
646
  try {
461
- var t = await Et(e), i = await WebAssembly.instantiate(t, r);
647
+ var r = await qr(e), i = await WebAssembly.instantiate(r, t);
462
648
  return i;
463
- } catch (a) {
464
- S(`failed to asynchronously prepare wasm: ${a}`), mr(Se) && S(`warning: Loading from a file URI (${Se}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`), M(a);
649
+ } catch (o) {
650
+ $(`failed to asynchronously prepare wasm: ${o}`), Dt(Ee) && $(`warning: Loading from a file URI (${Ee}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`), L(o);
465
651
  }
466
652
  }
467
- async function Ft(e, r, t) {
653
+ async function Qr(e, t, r) {
468
654
  if (!e && typeof WebAssembly.instantiateStreaming == "function")
469
655
  try {
470
- var i = fetch(r, { credentials: "same-origin" }), a = await WebAssembly.instantiateStreaming(i, t);
471
- return a;
472
- } catch (s) {
473
- S(`wasm streaming compile failed: ${s}`), S("falling back to ArrayBuffer instantiation");
656
+ var i = fetch(t, { credentials: "same-origin" }), o = await WebAssembly.instantiateStreaming(i, r);
657
+ return o;
658
+ } catch (l) {
659
+ $(`wasm streaming compile failed: ${l}`), $("falling back to ArrayBuffer instantiation");
474
660
  }
475
- return St(r, t);
661
+ return Kr(t, r);
476
662
  }
477
- function At() {
478
- return g.instrumentWasmImports(dr), {
479
- env: dr,
480
- wasi_snapshot_preview1: dr
663
+ function Xr() {
664
+ return h.instrumentWasmImports(pt), {
665
+ env: pt,
666
+ wasi_snapshot_preview1: pt
481
667
  };
482
668
  }
483
- async function $t() {
484
- function e(l, o) {
485
- return V = l.exports, V = g.instrumentWasmExports(V), L = V.memory, f(L, "memory not found in wasm exports"), br(), Ur = V.__indirect_function_table, f(Ur, "table not found in wasm exports"), wt("wasm-instantiate"), V;
669
+ async function Zr() {
670
+ function e(d, s) {
671
+ return B = d.exports, B = h.instrumentWasmExports(B), W = B.memory, g(W, "memory not found in wasm exports"), Ot(), Xt = B.__indirect_function_table, g(Xt, "table not found in wasm exports"), zr("wasm-instantiate"), B;
486
672
  }
487
- bt("wasm-instantiate");
488
- var r = n;
489
- function t(l) {
490
- return f(n === r, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"), r = null, e(l.instance);
673
+ Yr("wasm-instantiate");
674
+ var t = a;
675
+ function r(d) {
676
+ return g(a === t, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"), t = null, e(d.instance);
491
677
  }
492
- var i = At();
493
- if (n.instantiateWasm)
494
- return new Promise((l, o) => {
678
+ var i = Xr();
679
+ if (a.instantiateWasm)
680
+ return new Promise((d, s) => {
495
681
  try {
496
- n.instantiateWasm(i, (d, p) => {
497
- e(d, p), l(d.exports);
682
+ a.instantiateWasm(i, (u, v) => {
683
+ e(u, v), d(u.exports);
498
684
  });
499
- } catch (d) {
500
- S(`Module.instantiateWasm callback failed with error: ${d}`), o(d);
685
+ } catch (u) {
686
+ $(`Module.instantiateWasm callback failed with error: ${u}`), s(u);
501
687
  }
502
688
  });
503
- Se ??= Ct();
689
+ Ee ??= Gr();
504
690
  try {
505
- var a = await Ft(x, Se, i), s = t(a);
506
- return s;
507
- } catch (l) {
508
- return W(l), Promise.reject(l);
691
+ var o = await Qr(C, Ee, i), l = r(o);
692
+ return l;
693
+ } catch (d) {
694
+ return F(d), Promise.reject(d);
509
695
  }
510
696
  }
511
- class Pt {
697
+ class en {
512
698
  name = "ExitStatus";
513
- constructor(r) {
514
- this.message = `Program terminated with exit(${r})`, this.status = r;
699
+ constructor(t) {
700
+ this.message = `Program terminated with exit(${t})`, this.status = t;
515
701
  }
516
702
  }
517
- var wr = (e) => {
703
+ var xt = (e) => {
518
704
  for (; e.length > 0; )
519
- e.shift()(n);
520
- }, Cr = [], It = (e) => Cr.unshift(e), Tr = [], kt = (e) => Tr.unshift(e);
521
- n.noExitRuntime;
522
- var se = (e) => (f(typeof e == "number"), e >>>= 0, "0x" + e.toString(16).padStart(8, "0")), Mt = () => {
523
- var e = Qr(), r = Ye();
524
- Hn(e, r);
525
- }, Fe = (e) => {
526
- Fe.shown ||= {}, Fe.shown[e] || (Fe.shown[e] = 1, S(e));
527
- }, Er = typeof TextDecoder < "u" ? new TextDecoder() : void 0, Sr = (e, r = 0, t = NaN) => {
528
- for (var i = r + t, a = r; e[a] && !(a >= i); ) ++a;
529
- if (a - r > 16 && e.buffer && Er)
530
- return Er.decode(e.subarray(r, a));
531
- for (var s = ""; r < a; ) {
532
- var l = e[r++];
533
- if (!(l & 128)) {
534
- s += String.fromCharCode(l);
705
+ e.shift()(a);
706
+ }, jt = [], tn = (e) => jt.unshift(e), Nt = [], rn = (e) => Nt.unshift(e);
707
+ a.noExitRuntime;
708
+ var oe = (e) => (g(typeof e == "number"), e >>>= 0, "0x" + e.toString(16).padStart(8, "0")), nn = () => {
709
+ var e = pr(), t = Ge();
710
+ pa(e, t);
711
+ }, Ae = (e) => {
712
+ Ae.shown ||= {}, Ae.shown[e] || (Ae.shown[e] = 1, $(e));
713
+ }, Wt = typeof TextDecoder < "u" ? new TextDecoder() : void 0, Bt = (e, t = 0, r = NaN) => {
714
+ for (var i = t + r, o = t; e[o] && !(o >= i); ) ++o;
715
+ if (o - t > 16 && e.buffer && Wt)
716
+ return Wt.decode(e.subarray(t, o));
717
+ for (var l = ""; t < o; ) {
718
+ var d = e[t++];
719
+ if (!(d & 128)) {
720
+ l += String.fromCharCode(d);
535
721
  continue;
536
722
  }
537
- var o = e[r++] & 63;
538
- if ((l & 224) == 192) {
539
- s += String.fromCharCode((l & 31) << 6 | o);
723
+ var s = e[t++] & 63;
724
+ if ((d & 224) == 192) {
725
+ l += String.fromCharCode((d & 31) << 6 | s);
540
726
  continue;
541
727
  }
542
- var d = e[r++] & 63;
543
- if ((l & 240) == 224 ? l = (l & 15) << 12 | o << 6 | d : ((l & 248) != 240 && Fe("Invalid UTF-8 leading byte " + se(l) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"), l = (l & 7) << 18 | o << 12 | d << 6 | e[r++] & 63), l < 65536)
544
- s += String.fromCharCode(l);
728
+ var u = e[t++] & 63;
729
+ if ((d & 240) == 224 ? d = (d & 15) << 12 | s << 6 | u : ((d & 248) != 240 && Ae("Invalid UTF-8 leading byte " + oe(d) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"), d = (d & 7) << 18 | s << 12 | u << 6 | e[t++] & 63), d < 65536)
730
+ l += String.fromCharCode(d);
545
731
  else {
546
- var p = l - 65536;
547
- s += String.fromCharCode(55296 | p >> 10, 56320 | p & 1023);
732
+ var v = d - 65536;
733
+ l += String.fromCharCode(55296 | v >> 10, 56320 | v & 1023);
548
734
  }
549
735
  }
550
- return s;
551
- }, xe = (e, r) => (f(typeof e == "number", `UTF8ToString expects a number (got ${typeof e})`), e ? Sr(H, e, r) : ""), Rt = (e, r, t, i) => M(`Assertion failed: ${xe(e)}, at: ` + [r ? xe(r) : "unknown filename", t, i ? xe(i) : "unknown function"]);
552
- class Dt {
736
+ return l;
737
+ }, xe = (e, t) => (g(typeof e == "number", `UTF8ToString expects a number (got ${typeof e})`), e ? Bt(K, e, t) : ""), an = (e, t, r, i) => L(`Assertion failed: ${xe(e)}, at: ` + [t ? xe(t) : "unknown filename", r, i ? xe(i) : "unknown function"]);
738
+ class on {
553
739
  // excPtr - Thrown object pointer to wrap. Metadata pointer is calculated from it.
554
- constructor(r) {
555
- this.excPtr = r, this.ptr = r - 24;
740
+ constructor(t) {
741
+ this.excPtr = t, this.ptr = t - 24;
556
742
  }
557
- set_type(r) {
558
- F[this.ptr + 4 >> 2] = r;
743
+ set_type(t) {
744
+ k[this.ptr + 4 >> 2] = t;
559
745
  }
560
746
  get_type() {
561
- return F[this.ptr + 4 >> 2];
747
+ return k[this.ptr + 4 >> 2];
562
748
  }
563
- set_destructor(r) {
564
- F[this.ptr + 8 >> 2] = r;
749
+ set_destructor(t) {
750
+ k[this.ptr + 8 >> 2] = t;
565
751
  }
566
752
  get_destructor() {
567
- return F[this.ptr + 8 >> 2];
753
+ return k[this.ptr + 8 >> 2];
568
754
  }
569
- set_caught(r) {
570
- r = r ? 1 : 0, j[this.ptr + 12] = r, Ce(r);
755
+ set_caught(t) {
756
+ t = t ? 1 : 0, ne[this.ptr + 12] = t, we(t);
571
757
  }
572
758
  get_caught() {
573
- return j[this.ptr + 12] != 0;
759
+ return ne[this.ptr + 12] != 0;
574
760
  }
575
- set_rethrown(r) {
576
- r = r ? 1 : 0, j[this.ptr + 13] = r, Ce(r);
761
+ set_rethrown(t) {
762
+ t = t ? 1 : 0, ne[this.ptr + 13] = t, we(t);
577
763
  }
578
764
  get_rethrown() {
579
- return j[this.ptr + 13] != 0;
765
+ return ne[this.ptr + 13] != 0;
580
766
  }
581
767
  // Initialize native structure fields. Should be called once after allocated.
582
- init(r, t) {
583
- this.set_adjusted_ptr(0), this.set_type(r), this.set_destructor(t);
768
+ init(t, r) {
769
+ this.set_adjusted_ptr(0), this.set_type(t), this.set_destructor(r);
584
770
  }
585
- set_adjusted_ptr(r) {
586
- F[this.ptr + 16 >> 2] = r;
771
+ set_adjusted_ptr(t) {
772
+ k[this.ptr + 16 >> 2] = t;
587
773
  }
588
774
  get_adjusted_ptr() {
589
- return F[this.ptr + 16 >> 2];
775
+ return k[this.ptr + 16 >> 2];
590
776
  }
591
777
  }
592
- var Ut = (e, r, t) => {
593
- var i = new Dt(e);
594
- i.init(r, t), f(!1, "Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.");
595
- }, xt = (e) => {
596
- var r = Qr(), t = Ye();
597
- M(`stack overflow (Attempt to set SP to ${se(e)}, with stack limits [${se(t)} - ${se(r)}]). If you require more stack space build with -sSTACK_SIZE=<bytes>`);
598
- }, Ot = (e, r, t, i) => {
599
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
778
+ var sn = (e, t, r) => {
779
+ var i = new on(e);
780
+ i.init(t, r), g(!1, "Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.");
781
+ }, ln = (e) => {
782
+ var t = pr(), r = Ge();
783
+ L(`stack overflow (Attempt to set SP to ${oe(e)}, with stack limits [${oe(r)} - ${oe(t)}]). If you require more stack space build with -sSTACK_SIZE=<bytes>`);
784
+ }, dn = (e, t, r, i) => {
785
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
600
786
  };
601
- function Lt(e, r, t) {
787
+ function cn(e, t, r) {
602
788
  return 0;
603
789
  }
604
- var Nt = (e, r) => {
605
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
606
- }, jt = (e, r, t, i) => {
607
- if (f(typeof e == "string", `stringToUTF8Array expects a string (got ${typeof e})`), !(i > 0))
790
+ var un = (e, t) => {
791
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
792
+ }, fn = (e, t, r, i) => {
793
+ if (g(typeof e == "string", `stringToUTF8Array expects a string (got ${typeof e})`), !(i > 0))
608
794
  return 0;
609
- for (var a = t, s = t + i - 1, l = 0; l < e.length; ++l) {
610
- var o = e.charCodeAt(l);
611
- if (o >= 55296 && o <= 57343) {
612
- var d = e.charCodeAt(++l);
613
- o = 65536 + ((o & 1023) << 10) | d & 1023;
795
+ for (var o = r, l = r + i - 1, d = 0; d < e.length; ++d) {
796
+ var s = e.charCodeAt(d);
797
+ if (s >= 55296 && s <= 57343) {
798
+ var u = e.charCodeAt(++d);
799
+ s = 65536 + ((s & 1023) << 10) | u & 1023;
614
800
  }
615
- if (o <= 127) {
616
- if (t >= s) break;
617
- r[t++] = o;
618
- } else if (o <= 2047) {
619
- if (t + 1 >= s) break;
620
- r[t++] = 192 | o >> 6, r[t++] = 128 | o & 63;
621
- } else if (o <= 65535) {
622
- if (t + 2 >= s) break;
623
- r[t++] = 224 | o >> 12, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63;
801
+ if (s <= 127) {
802
+ if (r >= l) break;
803
+ t[r++] = s;
804
+ } else if (s <= 2047) {
805
+ if (r + 1 >= l) break;
806
+ t[r++] = 192 | s >> 6, t[r++] = 128 | s & 63;
807
+ } else if (s <= 65535) {
808
+ if (r + 2 >= l) break;
809
+ t[r++] = 224 | s >> 12, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | s & 63;
624
810
  } else {
625
- if (t + 3 >= s) break;
626
- o > 1114111 && Fe("Invalid Unicode code point " + se(o) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."), r[t++] = 240 | o >> 18, r[t++] = 128 | o >> 12 & 63, r[t++] = 128 | o >> 6 & 63, r[t++] = 128 | o & 63;
811
+ if (r + 3 >= l) break;
812
+ s > 1114111 && Ae("Invalid Unicode code point " + oe(s) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."), t[r++] = 240 | s >> 18, t[r++] = 128 | s >> 12 & 63, t[r++] = 128 | s >> 6 & 63, t[r++] = 128 | s & 63;
627
813
  }
628
814
  }
629
- return r[t] = 0, t - a;
630
- }, Ae = (e, r, t) => (f(typeof t == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), jt(e, H, r, t)), Wt = (e, r, t) => {
631
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
815
+ return t[r] = 0, r - o;
816
+ }, Se = (e, t, r) => (g(typeof r == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), fn(e, K, t, r)), pn = (e, t, r) => {
817
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
632
818
  };
633
- function Ht(e, r, t) {
819
+ function vn(e, t, r) {
634
820
  return 0;
635
821
  }
636
- var Bt = (e, r) => {
637
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
638
- }, Vt = (e, r, t) => {
639
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
640
- }, Yt = (e, r, t, i) => {
641
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
822
+ var yn = (e, t) => {
823
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
824
+ }, gn = (e, t, r) => {
825
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
826
+ }, _n = (e, t, r, i) => {
827
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
642
828
  };
643
- function zt(e, r, t, i) {
644
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
829
+ function mn(e, t, r, i) {
830
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
645
831
  }
646
- var Gt = (e, r, t, i) => {
647
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
648
- }, Jt = (e) => {
649
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
650
- }, Kt = (e, r) => {
651
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
652
- }, Qt = (e, r, t) => {
653
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
654
- }, Xt = () => M("native code called abort()"), Oe = {}, qe = (e) => {
832
+ var hn = (e, t, r, i) => {
833
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
834
+ }, bn = (e) => {
835
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
836
+ }, wn = (e, t) => {
837
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
838
+ }, Cn = (e, t, r) => {
839
+ L("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
840
+ }, Tn = () => L("native code called abort()"), je = {}, rt = (e) => {
655
841
  for (; e.length; ) {
656
- var r = e.pop(), t = e.pop();
657
- t(r);
842
+ var t = e.pop(), r = e.pop();
843
+ r(t);
658
844
  }
659
845
  };
660
- function $e(e) {
661
- return this.fromWireType(F[e >> 2]);
846
+ function Fe(e) {
847
+ return this.fromWireType(k[e >> 2]);
662
848
  }
663
- var ge = {}, pe = {}, Le = {}, Fr, Ne = (e) => {
664
- throw new Fr(e);
665
- }, me = (e, r, t) => {
666
- e.forEach((o) => Le[o] = r);
667
- function i(o) {
668
- var d = t(o);
669
- d.length !== e.length && Ne("Mismatched type converter count");
670
- for (var p = 0; p < e.length; ++p)
671
- ee(e[p], d[p]);
849
+ var _e = {}, ve = {}, Ne = {}, Ht, We = (e) => {
850
+ throw new Ht(e);
851
+ }, me = (e, t, r) => {
852
+ e.forEach((s) => Ne[s] = t);
853
+ function i(s) {
854
+ var u = r(s);
855
+ u.length !== e.length && We("Mismatched type converter count");
856
+ for (var v = 0; v < e.length; ++v)
857
+ ee(e[v], u[v]);
672
858
  }
673
- var a = new Array(r.length), s = [], l = 0;
674
- r.forEach((o, d) => {
675
- pe.hasOwnProperty(o) ? a[d] = pe[o] : (s.push(o), ge.hasOwnProperty(o) || (ge[o] = []), ge[o].push(() => {
676
- a[d] = pe[o], ++l, l === s.length && i(a);
859
+ var o = new Array(t.length), l = [], d = 0;
860
+ t.forEach((s, u) => {
861
+ ve.hasOwnProperty(s) ? o[u] = ve[s] : (l.push(s), _e.hasOwnProperty(s) || (_e[s] = []), _e[s].push(() => {
862
+ o[u] = ve[s], ++d, d === l.length && i(o);
677
863
  }));
678
- }), s.length === 0 && i(a);
679
- }, qt = (e) => {
680
- var r = Oe[e];
681
- delete Oe[e];
682
- var t = r.rawConstructor, i = r.rawDestructor, a = r.fields, s = a.map((l) => l.getterReturnType).concat(a.map((l) => l.setterArgumentType));
683
- me([e], s, (l) => {
684
- var o = {};
685
- return a.forEach((d, p) => {
686
- var y = d.fieldName, m = l[p], A = d.getter, k = d.getterContext, U = l[p + a.length], J = d.setter, re = d.setterContext;
687
- o[y] = {
688
- read: (Q) => m.fromWireType(A(k, Q)),
689
- write: (Q, Me) => {
690
- var X = [];
691
- J(re, Q, U.toWireType(X, Me)), qe(X);
864
+ }), l.length === 0 && i(o);
865
+ }, En = (e) => {
866
+ var t = je[e];
867
+ delete je[e];
868
+ var r = t.rawConstructor, i = t.rawDestructor, o = t.fields, l = o.map((d) => d.getterReturnType).concat(o.map((d) => d.setterArgumentType));
869
+ me([e], l, (d) => {
870
+ var s = {};
871
+ return o.forEach((u, v) => {
872
+ var _ = u.fieldName, w = d[v], U = u.getter, D = u.getterContext, x = d[v + o.length], z = u.setter, te = u.setterContext;
873
+ s[_] = {
874
+ read: (J) => w.fromWireType(U(D, J)),
875
+ write: (J, ke) => {
876
+ var Q = [];
877
+ z(te, J, x.toWireType(Q, ke)), rt(Q);
692
878
  }
693
879
  };
694
880
  }), [{
695
- name: r.name,
696
- fromWireType: (d) => {
697
- var p = {};
698
- for (var y in o)
699
- p[y] = o[y].read(d);
700
- return i(d), p;
881
+ name: t.name,
882
+ fromWireType: (u) => {
883
+ var v = {};
884
+ for (var _ in s)
885
+ v[_] = s[_].read(u);
886
+ return i(u), v;
701
887
  },
702
- toWireType: (d, p) => {
703
- for (var y in o)
704
- if (!(y in p))
705
- throw new TypeError(`Missing field: "${y}"`);
706
- var m = t();
707
- for (y in o)
708
- o[y].write(m, p[y]);
709
- return d !== null && d.push(i, m), m;
888
+ toWireType: (u, v) => {
889
+ for (var _ in s)
890
+ if (!(_ in v))
891
+ throw new TypeError(`Missing field: "${_}"`);
892
+ var w = r();
893
+ for (_ in s)
894
+ s[_].write(w, v[_]);
895
+ return u !== null && u.push(i, w), w;
710
896
  },
711
897
  argPackAdvance: ie,
712
- readValueFromPointer: $e,
898
+ readValueFromPointer: Fe,
713
899
  destructorFunction: i
714
900
  }];
715
901
  });
716
- }, ce = (e) => {
902
+ }, de = (e) => {
717
903
  if (e === null)
718
904
  return "null";
719
- var r = typeof e;
720
- return r === "object" || r === "array" || r === "function" ? e.toString() : "" + e;
721
- }, Zt = () => {
722
- for (var e = new Array(256), r = 0; r < 256; ++r)
723
- e[r] = String.fromCharCode(r);
724
- Ar = e;
725
- }, Ar, G = (e) => {
726
- for (var r = "", t = e; H[t]; )
727
- r += Ar[H[t++]];
728
- return r;
729
- }, he, P = (e) => {
905
+ var t = typeof e;
906
+ return t === "object" || t === "array" || t === "function" ? e.toString() : "" + e;
907
+ }, An = () => {
908
+ for (var e = new Array(256), t = 0; t < 256; ++t)
909
+ e[t] = String.fromCharCode(t);
910
+ Vt = e;
911
+ }, Vt, Y = (e) => {
912
+ for (var t = "", r = e; K[r]; )
913
+ t += Vt[K[r++]];
914
+ return t;
915
+ }, he, R = (e) => {
730
916
  throw new he(e);
731
917
  };
732
- function ei(e, r, t = {}) {
733
- var i = r.name;
734
- if (e || P(`type "${i}" must have a positive integer typeid pointer`), pe.hasOwnProperty(e)) {
735
- if (t.ignoreDuplicateRegistrations)
918
+ function Sn(e, t, r = {}) {
919
+ var i = t.name;
920
+ if (e || R(`type "${i}" must have a positive integer typeid pointer`), ve.hasOwnProperty(e)) {
921
+ if (r.ignoreDuplicateRegistrations)
736
922
  return;
737
- P(`Cannot register type '${i}' twice`);
923
+ R(`Cannot register type '${i}' twice`);
738
924
  }
739
- if (pe[e] = r, delete Le[e], ge.hasOwnProperty(e)) {
740
- var a = ge[e];
741
- delete ge[e], a.forEach((s) => s());
925
+ if (ve[e] = t, delete Ne[e], _e.hasOwnProperty(e)) {
926
+ var o = _e[e];
927
+ delete _e[e], o.forEach((l) => l());
742
928
  }
743
929
  }
744
- function ee(e, r, t = {}) {
745
- if (r.argPackAdvance === void 0)
930
+ function ee(e, t, r = {}) {
931
+ if (t.argPackAdvance === void 0)
746
932
  throw new TypeError("registerType registeredInstance requires argPackAdvance");
747
- return ei(e, r, t);
933
+ return Sn(e, t, r);
748
934
  }
749
- var $r = (e, r, t) => {
750
- switch (r) {
935
+ var Yt = (e, t, r) => {
936
+ switch (t) {
751
937
  case 1:
752
- return t ? (i) => j[i] : (i) => H[i];
938
+ return r ? (i) => ne[i] : (i) => K[i];
753
939
  case 2:
754
- return t ? (i) => oe[i >> 1] : (i) => te[i >> 1];
940
+ return r ? (i) => ge[i >> 1] : (i) => De[i >> 1];
755
941
  case 4:
756
- return t ? (i) => w[i >> 2] : (i) => F[i >> 2];
942
+ return r ? (i) => E[i >> 2] : (i) => k[i >> 2];
757
943
  case 8:
758
- return t ? (i) => we[i >> 3] : (i) => yr[i >> 3];
944
+ return r ? (i) => be[i >> 3] : (i) => Mt[i >> 3];
759
945
  default:
760
- throw new TypeError(`invalid integer width (${r}): ${e}`);
946
+ throw new TypeError(`invalid integer width (${t}): ${e}`);
761
947
  }
762
- }, ri = (e, r, t, i, a) => {
763
- r = G(r);
764
- var s = r.indexOf("u") != -1;
765
- s && (a = (1n << 64n) - 1n), ee(e, {
766
- name: r,
767
- fromWireType: (l) => l,
768
- toWireType: function(l, o) {
769
- if (typeof o != "bigint" && typeof o != "number")
770
- throw new TypeError(`Cannot convert "${ce(o)}" to ${this.name}`);
771
- if (typeof o == "number" && (o = BigInt(o)), o < i || o > a)
772
- throw new TypeError(`Passing a number "${ce(o)}" from JS side to C/C++ side to an argument of type "${r}", which is outside the valid range [${i}, ${a}]!`);
773
- return o;
948
+ }, Fn = (e, t, r, i, o) => {
949
+ t = Y(t);
950
+ var l = t.indexOf("u") != -1;
951
+ l && (o = (1n << 64n) - 1n), ee(e, {
952
+ name: t,
953
+ fromWireType: (d) => d,
954
+ toWireType: function(d, s) {
955
+ if (typeof s != "bigint" && typeof s != "number")
956
+ throw new TypeError(`Cannot convert "${de(s)}" to ${this.name}`);
957
+ if (typeof s == "number" && (s = BigInt(s)), s < i || s > o)
958
+ throw new TypeError(`Passing a number "${de(s)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${i}, ${o}]!`);
959
+ return s;
774
960
  },
775
961
  argPackAdvance: ie,
776
- readValueFromPointer: $r(r, t, !s),
962
+ readValueFromPointer: Yt(t, r, !l),
777
963
  destructorFunction: null
778
964
  // This type does not need a destructor
779
965
  });
780
- }, ie = 8, ti = (e, r, t, i) => {
781
- r = G(r), ee(e, {
782
- name: r,
783
- fromWireType: function(a) {
784
- return !!a;
966
+ }, ie = 8, In = (e, t, r, i) => {
967
+ t = Y(t), ee(e, {
968
+ name: t,
969
+ fromWireType: function(o) {
970
+ return !!o;
785
971
  },
786
- toWireType: function(a, s) {
787
- return s ? t : i;
972
+ toWireType: function(o, l) {
973
+ return l ? r : i;
788
974
  },
789
975
  argPackAdvance: ie,
790
- readValueFromPointer: function(a) {
791
- return this.fromWireType(H[a]);
976
+ readValueFromPointer: function(o) {
977
+ return this.fromWireType(K[o]);
792
978
  },
793
979
  destructorFunction: null
794
980
  // This type does not need a destructor
795
981
  });
796
- }, ii = (e) => ({
982
+ }, $n = (e) => ({
797
983
  count: e.count,
798
984
  deleteScheduled: e.deleteScheduled,
799
985
  preservePointerOnDelete: e.preservePointerOnDelete,
@@ -801,200 +987,200 @@ var pr = {}, pa = {
801
987
  ptrType: e.ptrType,
802
988
  smartPtr: e.smartPtr,
803
989
  smartPtrType: e.smartPtrType
804
- }), Ze = (e) => {
805
- function r(t) {
806
- return t.$$.ptrType.registeredClass.name;
990
+ }), nt = (e) => {
991
+ function t(r) {
992
+ return r.$$.ptrType.registeredClass.name;
807
993
  }
808
- P(r(e) + " instance already deleted");
809
- }, er = !1, Pr = (e) => {
810
- }, ni = (e) => {
994
+ R(t(e) + " instance already deleted");
995
+ }, it = !1, zt = (e) => {
996
+ }, Pn = (e) => {
811
997
  e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr);
812
- }, Ir = (e) => {
998
+ }, Gt = (e) => {
813
999
  e.count.value -= 1;
814
- var r = e.count.value === 0;
815
- r && ni(e);
816
- }, kr = (e, r, t) => {
817
- if (r === t)
1000
+ var t = e.count.value === 0;
1001
+ t && Pn(e);
1002
+ }, Jt = (e, t, r) => {
1003
+ if (t === r)
818
1004
  return e;
819
- if (t.baseClass === void 0)
1005
+ if (r.baseClass === void 0)
820
1006
  return null;
821
- var i = kr(e, r, t.baseClass);
822
- return i === null ? null : t.downcast(i);
823
- }, Mr = {}, ai = {}, oi = (e, r) => {
824
- for (r === void 0 && P("ptr should not be undefined"); e.baseClass; )
825
- r = e.upcast(r), e = e.baseClass;
826
- return r;
827
- }, si = (e, r) => (r = oi(e, r), ai[r]), je = (e, r) => {
828
- (!r.ptrType || !r.ptr) && Ne("makeClassHandle requires ptr and ptrType");
829
- var t = !!r.smartPtrType, i = !!r.smartPtr;
830
- return t !== i && Ne("Both smartPtrType and smartPtr must be specified"), r.count = { value: 1 }, Pe(Object.create(e, {
1007
+ var i = Jt(e, t, r.baseClass);
1008
+ return i === null ? null : r.downcast(i);
1009
+ }, qt = {}, kn = {}, Un = (e, t) => {
1010
+ for (t === void 0 && R("ptr should not be undefined"); e.baseClass; )
1011
+ t = e.upcast(t), e = e.baseClass;
1012
+ return t;
1013
+ }, Mn = (e, t) => (t = Un(e, t), kn[t]), Be = (e, t) => {
1014
+ (!t.ptrType || !t.ptr) && We("makeClassHandle requires ptr and ptrType");
1015
+ var r = !!t.smartPtrType, i = !!t.smartPtr;
1016
+ return r !== i && We("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, Ie(Object.create(e, {
831
1017
  $$: {
832
- value: r,
1018
+ value: t,
833
1019
  writable: !0
834
1020
  }
835
1021
  }));
836
1022
  };
837
- function Rr(e) {
838
- var r = this.getPointee(e);
839
- if (!r)
1023
+ function Kt(e) {
1024
+ var t = this.getPointee(e);
1025
+ if (!t)
840
1026
  return this.destructor(e), null;
841
- var t = si(this.registeredClass, r);
842
- if (t !== void 0) {
843
- if (t.$$.count.value === 0)
844
- return t.$$.ptr = r, t.$$.smartPtr = e, t.clone();
845
- var i = t.clone();
1027
+ var r = Mn(this.registeredClass, t);
1028
+ if (r !== void 0) {
1029
+ if (r.$$.count.value === 0)
1030
+ return r.$$.ptr = t, r.$$.smartPtr = e, r.clone();
1031
+ var i = r.clone();
846
1032
  return this.destructor(e), i;
847
1033
  }
848
- function a() {
849
- return this.isSmartPointer ? je(this.registeredClass.instancePrototype, {
1034
+ function o() {
1035
+ return this.isSmartPointer ? Be(this.registeredClass.instancePrototype, {
850
1036
  ptrType: this.pointeeType,
851
- ptr: r,
1037
+ ptr: t,
852
1038
  smartPtrType: this,
853
1039
  smartPtr: e
854
- }) : je(this.registeredClass.instancePrototype, {
1040
+ }) : Be(this.registeredClass.instancePrototype, {
855
1041
  ptrType: this,
856
1042
  ptr: e
857
1043
  });
858
1044
  }
859
- var s = this.registeredClass.getActualType(r), l = Mr[s];
860
- if (!l)
861
- return a.call(this);
862
- var o;
863
- this.isConst ? o = l.constPointerType : o = l.pointerType;
864
- var d = kr(
865
- r,
1045
+ var l = this.registeredClass.getActualType(t), d = qt[l];
1046
+ if (!d)
1047
+ return o.call(this);
1048
+ var s;
1049
+ this.isConst ? s = d.constPointerType : s = d.pointerType;
1050
+ var u = Jt(
1051
+ t,
866
1052
  this.registeredClass,
867
- o.registeredClass
1053
+ s.registeredClass
868
1054
  );
869
- return d === null ? a.call(this) : this.isSmartPointer ? je(o.registeredClass.instancePrototype, {
870
- ptrType: o,
871
- ptr: d,
1055
+ return u === null ? o.call(this) : this.isSmartPointer ? Be(s.registeredClass.instancePrototype, {
1056
+ ptrType: s,
1057
+ ptr: u,
872
1058
  smartPtrType: this,
873
1059
  smartPtr: e
874
- }) : je(o.registeredClass.instancePrototype, {
875
- ptrType: o,
876
- ptr: d
1060
+ }) : Be(s.registeredClass.instancePrototype, {
1061
+ ptrType: s,
1062
+ ptr: u
877
1063
  });
878
1064
  }
879
- var Pe = (e) => typeof FinalizationRegistry > "u" ? (Pe = (r) => r, e) : (er = new FinalizationRegistry((r) => {
880
- console.warn(r.leakWarning), Ir(r.$$);
881
- }), Pe = (r) => {
882
- var t = r.$$, i = !!t.smartPtr;
1065
+ var Ie = (e) => typeof FinalizationRegistry > "u" ? (Ie = (t) => t, e) : (it = new FinalizationRegistry((t) => {
1066
+ console.warn(t.leakWarning), Gt(t.$$);
1067
+ }), Ie = (t) => {
1068
+ var r = t.$$, i = !!r.smartPtr;
883
1069
  if (i) {
884
- var a = { $$: t }, s = t.ptrType.registeredClass, l = new Error(`Embind found a leaked C++ instance ${s.name} <${se(t.ptr)}>.
1070
+ var o = { $$: r }, l = r.ptrType.registeredClass, d = new Error(`Embind found a leaked C++ instance ${l.name} <${oe(r.ptr)}>.
885
1071
  We'll free it automatically in this case, but this functionality is not reliable across various environments.
886
1072
  Make sure to invoke .delete() manually once you're done with the instance instead.
887
1073
  Originally allocated`);
888
- "captureStackTrace" in Error && Error.captureStackTrace(l, Rr), a.leakWarning = l.stack.replace(/^Error: /, ""), er.register(r, a, r);
1074
+ "captureStackTrace" in Error && Error.captureStackTrace(d, Kt), o.leakWarning = d.stack.replace(/^Error: /, ""), it.register(t, o, t);
889
1075
  }
890
- return r;
891
- }, Pr = (r) => er.unregister(r), Pe(e)), li = () => {
892
- Object.assign(We.prototype, {
1076
+ return t;
1077
+ }, zt = (t) => it.unregister(t), Ie(e)), Rn = () => {
1078
+ Object.assign(He.prototype, {
893
1079
  isAliasOf(e) {
894
- if (!(this instanceof We) || !(e instanceof We))
1080
+ if (!(this instanceof He) || !(e instanceof He))
895
1081
  return !1;
896
- var r = this.$$.ptrType.registeredClass, t = this.$$.ptr;
1082
+ var t = this.$$.ptrType.registeredClass, r = this.$$.ptr;
897
1083
  e.$$ = /** @type {Object} */
898
1084
  e.$$;
899
- for (var i = e.$$.ptrType.registeredClass, a = e.$$.ptr; r.baseClass; )
900
- t = r.upcast(t), r = r.baseClass;
1085
+ for (var i = e.$$.ptrType.registeredClass, o = e.$$.ptr; t.baseClass; )
1086
+ r = t.upcast(r), t = t.baseClass;
901
1087
  for (; i.baseClass; )
902
- a = i.upcast(a), i = i.baseClass;
903
- return r === i && t === a;
1088
+ o = i.upcast(o), i = i.baseClass;
1089
+ return t === i && r === o;
904
1090
  },
905
1091
  clone() {
906
- if (this.$$.ptr || Ze(this), this.$$.preservePointerOnDelete)
1092
+ if (this.$$.ptr || nt(this), this.$$.preservePointerOnDelete)
907
1093
  return this.$$.count.value += 1, this;
908
- var e = Pe(Object.create(Object.getPrototypeOf(this), {
1094
+ var e = Ie(Object.create(Object.getPrototypeOf(this), {
909
1095
  $$: {
910
- value: ii(this.$$)
1096
+ value: $n(this.$$)
911
1097
  }
912
1098
  }));
913
1099
  return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e;
914
1100
  },
915
1101
  delete() {
916
- this.$$.ptr || Ze(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && P("Object already scheduled for deletion"), Pr(this), Ir(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
1102
+ this.$$.ptr || nt(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && R("Object already scheduled for deletion"), zt(this), Gt(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
917
1103
  },
918
1104
  isDeleted() {
919
1105
  return !this.$$.ptr;
920
1106
  },
921
1107
  deleteLater() {
922
- return this.$$.ptr || Ze(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && P("Object already scheduled for deletion"), this.$$.deleteScheduled = !0, this;
1108
+ return this.$$.ptr || nt(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && R("Object already scheduled for deletion"), this.$$.deleteScheduled = !0, this;
923
1109
  }
924
1110
  });
925
1111
  };
926
- function We() {
1112
+ function He() {
927
1113
  }
928
- var Ie = (e, r) => Object.defineProperty(r, "name", {
1114
+ var $e = (e, t) => Object.defineProperty(t, "name", {
929
1115
  value: e
930
- }), Dr = (e, r, t) => {
931
- if (e[r].overloadTable === void 0) {
932
- var i = e[r];
933
- e[r] = function(...a) {
934
- return e[r].overloadTable.hasOwnProperty(a.length) || P(`Function '${t}' called with an invalid number of arguments (${a.length}) - expects one of (${e[r].overloadTable})!`), e[r].overloadTable[a.length].apply(this, a);
935
- }, e[r].overloadTable = [], e[r].overloadTable[i.argCount] = i;
1116
+ }), Qt = (e, t, r) => {
1117
+ if (e[t].overloadTable === void 0) {
1118
+ var i = e[t];
1119
+ e[t] = function(...o) {
1120
+ return e[t].overloadTable.hasOwnProperty(o.length) || R(`Function '${r}' called with an invalid number of arguments (${o.length}) - expects one of (${e[t].overloadTable})!`), e[t].overloadTable[o.length].apply(this, o);
1121
+ }, e[t].overloadTable = [], e[t].overloadTable[i.argCount] = i;
936
1122
  }
937
- }, di = (e, r, t) => {
938
- n.hasOwnProperty(e) ? (P(`Cannot register public name '${e}' twice`), Dr(n, e, e), n[e].overloadTable.hasOwnProperty(t) && P(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`), n[e].overloadTable[t] = r) : (n[e] = r, n[e].argCount = t);
939
- }, ci = 48, ui = 57, fi = (e) => {
940
- f(typeof e == "string"), e = e.replace(/[^a-zA-Z0-9_]/g, "$");
941
- var r = e.charCodeAt(0);
942
- return r >= ci && r <= ui ? `_${e}` : e;
1123
+ }, Dn = (e, t, r) => {
1124
+ a.hasOwnProperty(e) ? (R(`Cannot register public name '${e}' twice`), Qt(a, e, e), a[e].overloadTable.hasOwnProperty(r) && R(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`), a[e].overloadTable[r] = t) : (a[e] = t, a[e].argCount = r);
1125
+ }, Ln = 48, On = 57, xn = (e) => {
1126
+ g(typeof e == "string"), e = e.replace(/[^a-zA-Z0-9_]/g, "$");
1127
+ var t = e.charCodeAt(0);
1128
+ return t >= Ln && t <= On ? `_${e}` : e;
943
1129
  };
944
- function vi(e, r, t, i, a, s, l, o) {
945
- this.name = e, this.constructor = r, this.instancePrototype = t, this.rawDestructor = i, this.baseClass = a, this.getActualType = s, this.upcast = l, this.downcast = o, this.pureVirtualFunctions = [];
1130
+ function jn(e, t, r, i, o, l, d, s) {
1131
+ this.name = e, this.constructor = t, this.instancePrototype = r, this.rawDestructor = i, this.baseClass = o, this.getActualType = l, this.upcast = d, this.downcast = s, this.pureVirtualFunctions = [];
946
1132
  }
947
- var rr = (e, r, t) => {
948
- for (; r !== t; )
949
- r.upcast || P(`Expected null or instance of ${t.name}, got an instance of ${r.name}`), e = r.upcast(e), r = r.baseClass;
1133
+ var at = (e, t, r) => {
1134
+ for (; t !== r; )
1135
+ t.upcast || R(`Expected null or instance of ${r.name}, got an instance of ${t.name}`), e = t.upcast(e), t = t.baseClass;
950
1136
  return e;
951
1137
  };
952
- function pi(e, r) {
953
- if (r === null)
954
- return this.isReference && P(`null is not a valid ${this.name}`), 0;
955
- r.$$ || P(`Cannot pass "${ce(r)}" as a ${this.name}`), r.$$.ptr || P(`Cannot pass deleted object as a pointer of type ${this.name}`);
956
- var t = r.$$.ptrType.registeredClass, i = rr(r.$$.ptr, t, this.registeredClass);
1138
+ function Nn(e, t) {
1139
+ if (t === null)
1140
+ return this.isReference && R(`null is not a valid ${this.name}`), 0;
1141
+ t.$$ || R(`Cannot pass "${de(t)}" as a ${this.name}`), t.$$.ptr || R(`Cannot pass deleted object as a pointer of type ${this.name}`);
1142
+ var r = t.$$.ptrType.registeredClass, i = at(t.$$.ptr, r, this.registeredClass);
957
1143
  return i;
958
1144
  }
959
- function _i(e, r) {
960
- var t;
961
- if (r === null)
962
- return this.isReference && P(`null is not a valid ${this.name}`), this.isSmartPointer ? (t = this.rawConstructor(), e !== null && e.push(this.rawDestructor, t), t) : 0;
963
- (!r || !r.$$) && P(`Cannot pass "${ce(r)}" as a ${this.name}`), r.$$.ptr || P(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && r.$$.ptrType.isConst && P(`Cannot convert argument of type ${r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name} to parameter type ${this.name}`);
964
- var i = r.$$.ptrType.registeredClass;
965
- if (t = rr(r.$$.ptr, i, this.registeredClass), this.isSmartPointer)
966
- switch (r.$$.smartPtr === void 0 && P("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
1145
+ function Wn(e, t) {
1146
+ var r;
1147
+ if (t === null)
1148
+ return this.isReference && R(`null is not a valid ${this.name}`), this.isSmartPointer ? (r = this.rawConstructor(), e !== null && e.push(this.rawDestructor, r), r) : 0;
1149
+ (!t || !t.$$) && R(`Cannot pass "${de(t)}" as a ${this.name}`), t.$$.ptr || R(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && R(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
1150
+ var i = t.$$.ptrType.registeredClass;
1151
+ if (r = at(t.$$.ptr, i, this.registeredClass), this.isSmartPointer)
1152
+ switch (t.$$.smartPtr === void 0 && R("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
967
1153
  case 0:
968
- r.$$.smartPtrType === this ? t = r.$$.smartPtr : P(`Cannot convert argument of type ${r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name} to parameter type ${this.name}`);
1154
+ t.$$.smartPtrType === this ? r = t.$$.smartPtr : R(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
969
1155
  break;
970
1156
  case 1:
971
- t = r.$$.smartPtr;
1157
+ r = t.$$.smartPtr;
972
1158
  break;
973
1159
  case 2:
974
- if (r.$$.smartPtrType === this)
975
- t = r.$$.smartPtr;
1160
+ if (t.$$.smartPtrType === this)
1161
+ r = t.$$.smartPtr;
976
1162
  else {
977
- var a = r.clone();
978
- t = this.rawShare(
979
- t,
980
- K.toHandle(() => a.delete())
981
- ), e !== null && e.push(this.rawDestructor, t);
1163
+ var o = t.clone();
1164
+ r = this.rawShare(
1165
+ r,
1166
+ G.toHandle(() => o.delete())
1167
+ ), e !== null && e.push(this.rawDestructor, r);
982
1168
  }
983
1169
  break;
984
1170
  default:
985
- P("Unsupporting sharing policy");
1171
+ R("Unsupporting sharing policy");
986
1172
  }
987
- return t;
1173
+ return r;
988
1174
  }
989
- function yi(e, r) {
990
- if (r === null)
991
- return this.isReference && P(`null is not a valid ${this.name}`), 0;
992
- r.$$ || P(`Cannot pass "${ce(r)}" as a ${this.name}`), r.$$.ptr || P(`Cannot pass deleted object as a pointer of type ${this.name}`), r.$$.ptrType.isConst && P(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);
993
- var t = r.$$.ptrType.registeredClass, i = rr(r.$$.ptr, t, this.registeredClass);
1175
+ function Bn(e, t) {
1176
+ if (t === null)
1177
+ return this.isReference && R(`null is not a valid ${this.name}`), 0;
1178
+ t.$$ || R(`Cannot pass "${de(t)}" as a ${this.name}`), t.$$.ptr || R(`Cannot pass deleted object as a pointer of type ${this.name}`), t.$$.ptrType.isConst && R(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);
1179
+ var r = t.$$.ptrType.registeredClass, i = at(t.$$.ptr, r, this.registeredClass);
994
1180
  return i;
995
1181
  }
996
- var gi = () => {
997
- Object.assign(He.prototype, {
1182
+ var Hn = () => {
1183
+ Object.assign(Ve.prototype, {
998
1184
  getPointee(e) {
999
1185
  return this.rawGetPointee && (e = this.rawGetPointee(e)), e;
1000
1186
  },
@@ -1002,233 +1188,233 @@ Originally allocated`);
1002
1188
  this.rawDestructor?.(e);
1003
1189
  },
1004
1190
  argPackAdvance: ie,
1005
- readValueFromPointer: $e,
1006
- fromWireType: Rr
1191
+ readValueFromPointer: Fe,
1192
+ fromWireType: Kt
1007
1193
  });
1008
1194
  };
1009
- function He(e, r, t, i, a, s, l, o, d, p, y) {
1010
- this.name = e, this.registeredClass = r, this.isReference = t, this.isConst = i, this.isSmartPointer = a, this.pointeeType = s, this.sharingPolicy = l, this.rawGetPointee = o, this.rawConstructor = d, this.rawShare = p, this.rawDestructor = y, !a && r.baseClass === void 0 ? i ? (this.toWireType = pi, this.destructorFunction = null) : (this.toWireType = yi, this.destructorFunction = null) : this.toWireType = _i;
1195
+ function Ve(e, t, r, i, o, l, d, s, u, v, _) {
1196
+ this.name = e, this.registeredClass = t, this.isReference = r, this.isConst = i, this.isSmartPointer = o, this.pointeeType = l, this.sharingPolicy = d, this.rawGetPointee = s, this.rawConstructor = u, this.rawShare = v, this.rawDestructor = _, !o && t.baseClass === void 0 ? i ? (this.toWireType = Nn, this.destructorFunction = null) : (this.toWireType = Bn, this.destructorFunction = null) : this.toWireType = Wn;
1011
1197
  }
1012
- var mi = (e, r, t) => {
1013
- n.hasOwnProperty(e) || Ne("Replacing nonexistent public symbol"), n[e].overloadTable !== void 0 && t !== void 0 || (n[e] = r, n[e].argCount = t);
1014
- }, hi = (e, r, t) => {
1015
- e = e.replace(/p/g, "i"), f("dynCall_" + e in n, `bad function pointer type - dynCall function not found for sig '${e}'`), t?.length ? f(t.length === e.length - 1) : f(e.length == 1);
1016
- var i = n["dynCall_" + e];
1017
- return i(r, ...t);
1018
- }, Ur, bi = (e, r, t = []) => {
1019
- var i = hi(e, r, t);
1198
+ var Vn = (e, t, r) => {
1199
+ a.hasOwnProperty(e) || We("Replacing nonexistent public symbol"), a[e].overloadTable !== void 0 && r !== void 0 || (a[e] = t, a[e].argCount = r);
1200
+ }, Yn = (e, t, r) => {
1201
+ e = e.replace(/p/g, "i"), g("dynCall_" + e in a, `bad function pointer type - dynCall function not found for sig '${e}'`), r?.length ? g(r.length === e.length - 1) : g(e.length == 1);
1202
+ var i = a["dynCall_" + e];
1203
+ return i(t, ...r);
1204
+ }, Xt, zn = (e, t, r = []) => {
1205
+ var i = Yn(e, t, r);
1020
1206
  return i;
1021
- }, wi = (e, r) => (...t) => bi(e, r, t), ne = (e, r) => {
1022
- e = G(e);
1023
- function t() {
1024
- return wi(e, r);
1207
+ }, Gn = (e, t) => (...r) => zn(e, t, r), ae = (e, t) => {
1208
+ e = Y(e);
1209
+ function r() {
1210
+ return Gn(e, t);
1025
1211
  }
1026
- var i = t();
1027
- return typeof i != "function" && P(`unknown function pointer with signature ${e}: ${r}`), i;
1028
- }, Ci = (e, r) => {
1029
- var t = Ie(r, function(i) {
1030
- this.name = r, this.message = i;
1031
- var a = new Error(i).stack;
1032
- a !== void 0 && (this.stack = this.toString() + `
1033
- ` + a.replace(/^Error(:[^\n]*)?\n/, ""));
1212
+ var i = r();
1213
+ return typeof i != "function" && R(`unknown function pointer with signature ${e}: ${t}`), i;
1214
+ }, Jn = (e, t) => {
1215
+ var r = $e(t, function(i) {
1216
+ this.name = t, this.message = i;
1217
+ var o = new Error(i).stack;
1218
+ o !== void 0 && (this.stack = this.toString() + `
1219
+ ` + o.replace(/^Error(:[^\n]*)?\n/, ""));
1034
1220
  });
1035
- return t.prototype = Object.create(e.prototype), t.prototype.constructor = t, t.prototype.toString = function() {
1221
+ return r.prototype = Object.create(e.prototype), r.prototype.constructor = r, r.prototype.toString = function() {
1036
1222
  return this.message === void 0 ? this.name : `${this.name}: ${this.message}`;
1037
- }, t;
1038
- }, xr, Or = (e) => {
1039
- var r = Nn(e), t = G(r);
1040
- return le(r), t;
1041
- }, tr = (e, r) => {
1042
- var t = [], i = {};
1043
- function a(s) {
1044
- if (!i[s] && !pe[s]) {
1045
- if (Le[s]) {
1046
- Le[s].forEach(a);
1223
+ }, r;
1224
+ }, Zt, er = (e) => {
1225
+ var t = ca(e), r = Y(t);
1226
+ return se(t), r;
1227
+ }, ot = (e, t) => {
1228
+ var r = [], i = {};
1229
+ function o(l) {
1230
+ if (!i[l] && !ve[l]) {
1231
+ if (Ne[l]) {
1232
+ Ne[l].forEach(o);
1047
1233
  return;
1048
1234
  }
1049
- t.push(s), i[s] = !0;
1235
+ r.push(l), i[l] = !0;
1050
1236
  }
1051
1237
  }
1052
- throw r.forEach(a), new xr(`${e}: ` + t.map(Or).join([", "]));
1053
- }, Ti = (e, r, t, i, a, s, l, o, d, p, y, m, A) => {
1054
- y = G(y), s = ne(a, s), o &&= ne(l, o), p &&= ne(d, p), A = ne(m, A);
1055
- var k = fi(y);
1056
- di(k, function() {
1057
- tr(`Cannot construct ${y} due to unbound types`, [i]);
1238
+ throw t.forEach(o), new Zt(`${e}: ` + r.map(er).join([", "]));
1239
+ }, qn = (e, t, r, i, o, l, d, s, u, v, _, w, U) => {
1240
+ _ = Y(_), l = ae(o, l), s &&= ae(d, s), v &&= ae(u, v), U = ae(w, U);
1241
+ var D = xn(_);
1242
+ Dn(D, function() {
1243
+ ot(`Cannot construct ${_} due to unbound types`, [i]);
1058
1244
  }), me(
1059
- [e, r, t],
1245
+ [e, t, r],
1060
1246
  i ? [i] : [],
1061
- (U) => {
1062
- U = U[0];
1063
- var J, re;
1064
- i ? (J = U.registeredClass, re = J.instancePrototype) : re = We.prototype;
1065
- var Q = Ie(y, function(...fr) {
1066
- if (Object.getPrototypeOf(this) !== Me)
1067
- throw new he("Use 'new' to construct " + y);
1068
- if (X.constructor_body === void 0)
1069
- throw new he(y + " has no accessible constructor");
1070
- var et = X.constructor_body[fr.length];
1071
- if (et === void 0)
1072
- throw new he(`Tried to invoke ctor of ${y} with invalid number of parameters (${fr.length}) - expected (${Object.keys(X.constructor_body).toString()}) parameters instead!`);
1073
- return et.apply(this, fr);
1074
- }), Me = Object.create(re, {
1075
- constructor: { value: Q }
1247
+ (x) => {
1248
+ x = x[0];
1249
+ var z, te;
1250
+ i ? (z = x.registeredClass, te = z.instancePrototype) : te = He.prototype;
1251
+ var J = $e(_, function(...gt) {
1252
+ if (Object.getPrototypeOf(this) !== ke)
1253
+ throw new he("Use 'new' to construct " + _);
1254
+ if (Q.constructor_body === void 0)
1255
+ throw new he(_ + " has no accessible constructor");
1256
+ var _r = Q.constructor_body[gt.length];
1257
+ if (_r === void 0)
1258
+ throw new he(`Tried to invoke ctor of ${_} with invalid number of parameters (${gt.length}) - expected (${Object.keys(Q.constructor_body).toString()}) parameters instead!`);
1259
+ return _r.apply(this, gt);
1260
+ }), ke = Object.create(te, {
1261
+ constructor: { value: J }
1076
1262
  });
1077
- Q.prototype = Me;
1078
- var X = new vi(
1079
- y,
1080
- Q,
1081
- Me,
1082
- A,
1263
+ J.prototype = ke;
1264
+ var Q = new jn(
1265
+ _,
1083
1266
  J,
1267
+ ke,
1268
+ U,
1269
+ z,
1270
+ l,
1084
1271
  s,
1085
- o,
1086
- p
1272
+ v
1087
1273
  );
1088
- X.baseClass && (X.baseClass.__derivedClasses ??= [], X.baseClass.__derivedClasses.push(X));
1089
- var Qn = new He(
1090
- y,
1091
- X,
1274
+ Q.baseClass && (Q.baseClass.__derivedClasses ??= [], Q.baseClass.__derivedClasses.push(Q));
1275
+ var wa = new Ve(
1276
+ _,
1277
+ Q,
1092
1278
  !0,
1093
1279
  !1,
1094
1280
  !1
1095
- ), qr = new He(
1096
- y + "*",
1097
- X,
1281
+ ), yr = new Ve(
1282
+ _ + "*",
1283
+ Q,
1098
1284
  !1,
1099
1285
  !1,
1100
1286
  !1
1101
- ), Zr = new He(
1102
- y + " const*",
1103
- X,
1287
+ ), gr = new Ve(
1288
+ _ + " const*",
1289
+ Q,
1104
1290
  !1,
1105
1291
  !0,
1106
1292
  !1
1107
1293
  );
1108
- return Mr[e] = {
1109
- pointerType: qr,
1110
- constPointerType: Zr
1111
- }, mi(k, Q), [Qn, qr, Zr];
1294
+ return qt[e] = {
1295
+ pointerType: yr,
1296
+ constPointerType: gr
1297
+ }, Vn(D, J), [wa, yr, gr];
1112
1298
  }
1113
1299
  );
1114
- }, Lr = (e, r) => {
1115
- for (var t = [], i = 0; i < e; i++)
1116
- t.push(F[r + i * 4 >> 2]);
1117
- return t;
1300
+ }, tr = (e, t) => {
1301
+ for (var r = [], i = 0; i < e; i++)
1302
+ r.push(k[t + i * 4 >> 2]);
1303
+ return r;
1118
1304
  };
1119
- function Nr(e) {
1120
- for (var r = 1; r < e.length; ++r)
1121
- if (e[r] !== null && e[r].destructorFunction === void 0)
1305
+ function rr(e) {
1306
+ for (var t = 1; t < e.length; ++t)
1307
+ if (e[t] !== null && e[t].destructorFunction === void 0)
1122
1308
  return !0;
1123
1309
  return !1;
1124
1310
  }
1125
- function jr(e, r) {
1311
+ function nr(e, t) {
1126
1312
  if (!(e instanceof Function))
1127
1313
  throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);
1128
- var t = Ie(e.name || "unknownFunctionName", function() {
1314
+ var r = $e(e.name || "unknownFunctionName", function() {
1129
1315
  });
1130
- t.prototype = e.prototype;
1131
- var i = new t(), a = e.apply(i, r);
1132
- return a instanceof Object ? a : i;
1316
+ r.prototype = e.prototype;
1317
+ var i = new r(), o = e.apply(i, t);
1318
+ return o instanceof Object ? o : i;
1133
1319
  }
1134
- function Ei(e, r, t, i, a) {
1135
- if (e < r || e > t) {
1136
- var s = r == t ? r : `${r} to ${t}`;
1137
- a(`function ${i} called with ${e} arguments, expected ${s}`);
1320
+ function Kn(e, t, r, i, o) {
1321
+ if (e < t || e > r) {
1322
+ var l = t == r ? t : `${t} to ${r}`;
1323
+ o(`function ${i} called with ${e} arguments, expected ${l}`);
1138
1324
  }
1139
1325
  }
1140
- function Si(e, r, t, i) {
1141
- var a = Nr(e), s = e.length - 2, l = [], o = ["fn"];
1142
- r && o.push("thisWired");
1143
- for (var d = 0; d < s; ++d)
1144
- l.push(`arg${d}`), o.push(`arg${d}Wired`);
1145
- l = l.join(","), o = o.join(",");
1146
- var p = `return function (${l}) {
1326
+ function Qn(e, t, r, i) {
1327
+ var o = rr(e), l = e.length - 2, d = [], s = ["fn"];
1328
+ t && s.push("thisWired");
1329
+ for (var u = 0; u < l; ++u)
1330
+ d.push(`arg${u}`), s.push(`arg${u}Wired`);
1331
+ d = d.join(","), s = s.join(",");
1332
+ var v = `return function (${d}) {
1147
1333
  `;
1148
- p += `checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
1149
- `, a && (p += `var destructors = [];
1334
+ v += `checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
1335
+ `, o && (v += `var destructors = [];
1150
1336
  `);
1151
- var y = a ? "destructors" : "null", m = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
1152
- r && (p += `var thisWired = classParam['toWireType'](${y}, this);
1337
+ var _ = o ? "destructors" : "null", w = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
1338
+ t && (v += `var thisWired = classParam['toWireType'](${_}, this);
1153
1339
  `);
1154
- for (var d = 0; d < s; ++d)
1155
- p += `var arg${d}Wired = argType${d}['toWireType'](${y}, arg${d});
1156
- `, m.push(`argType${d}`);
1157
- p += (t || i ? "var rv = " : "") + `invoker(${o});
1340
+ for (var u = 0; u < l; ++u)
1341
+ v += `var arg${u}Wired = argType${u}['toWireType'](${_}, arg${u});
1342
+ `, w.push(`argType${u}`);
1343
+ v += (r || i ? "var rv = " : "") + `invoker(${s});
1158
1344
  `;
1159
- var A = t ? "rv" : "";
1160
- if (m.push("Asyncify"), p += `function onDone(${A}) {
1161
- `, a)
1162
- p += `runDestructors(destructors);
1345
+ var U = r ? "rv" : "";
1346
+ if (w.push("Asyncify"), v += `function onDone(${U}) {
1347
+ `, o)
1348
+ v += `runDestructors(destructors);
1163
1349
  `;
1164
1350
  else
1165
- for (var d = r ? 1 : 2; d < e.length; ++d) {
1166
- var k = d === 1 ? "thisWired" : "arg" + (d - 2) + "Wired";
1167
- e[d].destructorFunction !== null && (p += `${k}_dtor(${k});
1168
- `, m.push(`${k}_dtor`));
1351
+ for (var u = t ? 1 : 2; u < e.length; ++u) {
1352
+ var D = u === 1 ? "thisWired" : "arg" + (u - 2) + "Wired";
1353
+ e[u].destructorFunction !== null && (v += `${D}_dtor(${D});
1354
+ `, w.push(`${D}_dtor`));
1169
1355
  }
1170
- return t && (p += `var ret = retType['fromWireType'](rv);
1356
+ return r && (v += `var ret = retType['fromWireType'](rv);
1171
1357
  return ret;
1172
- `), p += `}
1173
- `, p += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${A});
1174
- `, p += `}
1175
- `, m.push("checkArgCount", "minArgs", "maxArgs"), p = `if (arguments.length !== ${m.length}){ throw new Error(humanName + "Expected ${m.length} closure arguments " + arguments.length + " given."); }
1176
- ${p}`, [m, p];
1358
+ `), v += `}
1359
+ `, v += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${U});
1360
+ `, v += `}
1361
+ `, w.push("checkArgCount", "minArgs", "maxArgs"), v = `if (arguments.length !== ${w.length}){ throw new Error(humanName + "Expected ${w.length} closure arguments " + arguments.length + " given."); }
1362
+ ${v}`, [w, v];
1177
1363
  }
1178
- var Be = (e) => {
1364
+ var Ye = (e) => {
1179
1365
  try {
1180
1366
  return e();
1181
- } catch (r) {
1182
- M(r);
1367
+ } catch (t) {
1368
+ L(t);
1183
1369
  }
1184
- }, Fi = (e) => {
1185
- if (e instanceof Pt || e == "unwind")
1186
- return O;
1187
- De(), e instanceof WebAssembly.RuntimeError && Wn() <= 0 && S("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 52428800)"), de(1, e);
1188
- }, Ai = () => {
1189
- }, $i = (e) => {
1190
- if (T) {
1191
- S("user callback triggered after runtime exited or application aborted. Ignoring.");
1370
+ }, Xn = (e) => {
1371
+ if (e instanceof en || e == "unwind")
1372
+ return Re;
1373
+ Le(), e instanceof WebAssembly.RuntimeError && fa() <= 0 && $("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 52428800)"), V(1, e);
1374
+ }, Zn = () => {
1375
+ }, ei = (e) => {
1376
+ if (N) {
1377
+ $("user callback triggered after runtime exited or application aborted. Ignoring.");
1192
1378
  return;
1193
1379
  }
1194
1380
  try {
1195
- e(), Ai();
1196
- } catch (r) {
1197
- Fi(r);
1381
+ e(), Zn();
1382
+ } catch (t) {
1383
+ Xn(t);
1198
1384
  }
1199
- }, g = {
1385
+ }, h = {
1200
1386
  instrumentWasmImports(e) {
1201
- var r = /^(invoke_.*|__asyncjs__.*)$/;
1202
- for (let [t, i] of Object.entries(e))
1387
+ var t = /^(invoke_.*|__asyncjs__.*)$/;
1388
+ for (let [r, i] of Object.entries(e))
1203
1389
  if (typeof i == "function") {
1204
- let a = i.isAsync || r.test(t);
1205
- e[t] = (...s) => {
1206
- var l = g.state;
1390
+ let o = i.isAsync || t.test(r);
1391
+ e[r] = (...l) => {
1392
+ var d = h.state;
1207
1393
  try {
1208
- return i(...s);
1394
+ return i(...l);
1209
1395
  } finally {
1210
- var o = l === g.State.Normal && g.state === g.State.Disabled, d = t.startsWith("invoke_") && !0;
1211
- if (g.state !== l && !a && !o && !d)
1212
- throw new Error(`import ${t} was not in ASYNCIFY_IMPORTS, but changed the state`);
1396
+ var s = d === h.State.Normal && h.state === h.State.Disabled, u = r.startsWith("invoke_") && !0;
1397
+ if (h.state !== d && !o && !s && !u)
1398
+ throw new Error(`import ${r} was not in ASYNCIFY_IMPORTS, but changed the state`);
1213
1399
  }
1214
1400
  };
1215
1401
  }
1216
1402
  },
1217
1403
  instrumentWasmExports(e) {
1218
- var r = {};
1219
- for (let [t, i] of Object.entries(e))
1220
- typeof i == "function" ? r[t] = (...a) => {
1221
- g.exportCallStack.push(t);
1404
+ var t = {};
1405
+ for (let [r, i] of Object.entries(e))
1406
+ typeof i == "function" ? t[r] = (...o) => {
1407
+ h.exportCallStack.push(r);
1222
1408
  try {
1223
- return i(...a);
1409
+ return i(...o);
1224
1410
  } finally {
1225
- if (!T) {
1226
- var s = g.exportCallStack.pop();
1227
- f(s === t), g.maybeStopUnwind();
1411
+ if (!N) {
1412
+ var l = h.exportCallStack.pop();
1413
+ g(l === r), h.maybeStopUnwind();
1228
1414
  }
1229
1415
  }
1230
- } : r[t] = i;
1231
- return r;
1416
+ } : t[r] = i;
1417
+ return t;
1232
1418
  },
1233
1419
  State: {
1234
1420
  Normal: 0,
@@ -1247,126 +1433,126 @@ ${p}`, [m, p];
1247
1433
  asyncPromiseHandlers: null,
1248
1434
  sleepCallbacks: [],
1249
1435
  getCallStackId(e) {
1250
- var r = g.callStackNameToId[e];
1251
- return r === void 0 && (r = g.callStackId++, g.callStackNameToId[e] = r, g.callStackIdToName[r] = e), r;
1436
+ var t = h.callStackNameToId[e];
1437
+ return t === void 0 && (t = h.callStackId++, h.callStackNameToId[e] = t, h.callStackIdToName[t] = e), t;
1252
1438
  },
1253
1439
  maybeStopUnwind() {
1254
- g.currData && g.state === g.State.Unwinding && g.exportCallStack.length === 0 && (g.state = g.State.Normal, Be(Vn), typeof Fibers < "u" && Fibers.trampoline());
1440
+ h.currData && h.state === h.State.Unwinding && h.exportCallStack.length === 0 && (h.state = h.State.Normal, Ye(ya), typeof Fibers < "u" && Fibers.trampoline());
1255
1441
  },
1256
1442
  whenDone() {
1257
- return f(g.currData, "Tried to wait for an async operation when none is in progress."), f(!g.asyncPromiseHandlers, "Cannot have multiple async operations in flight at once"), new Promise((e, r) => {
1258
- g.asyncPromiseHandlers = { resolve: e, reject: r };
1443
+ return g(h.currData, "Tried to wait for an async operation when none is in progress."), g(!h.asyncPromiseHandlers, "Cannot have multiple async operations in flight at once"), new Promise((e, t) => {
1444
+ h.asyncPromiseHandlers = { resolve: e, reject: t };
1259
1445
  });
1260
1446
  },
1261
1447
  allocateData() {
1262
- var e = cr(12 + g.StackSize);
1263
- return g.setDataHeader(e, e + 12, g.StackSize), g.setDataRewindFunc(e), e;
1448
+ var e = vt(12 + h.StackSize);
1449
+ return h.setDataHeader(e, e + 12, h.StackSize), h.setDataRewindFunc(e), e;
1264
1450
  },
1265
- setDataHeader(e, r, t) {
1266
- F[e >> 2] = r, F[e + 4 >> 2] = r + t;
1451
+ setDataHeader(e, t, r) {
1452
+ k[e >> 2] = t, k[e + 4 >> 2] = t + r;
1267
1453
  },
1268
1454
  setDataRewindFunc(e) {
1269
- var r = g.exportCallStack[0], t = g.getCallStackId(r);
1270
- w[e + 8 >> 2] = t, C(t);
1455
+ var t = h.exportCallStack[0], r = h.getCallStackId(t);
1456
+ E[e + 8 >> 2] = r, S(r);
1271
1457
  },
1272
1458
  getDataRewindFuncName(e) {
1273
- var r = w[e + 8 >> 2], t = g.callStackIdToName[r];
1274
- return t;
1459
+ var t = E[e + 8 >> 2], r = h.callStackIdToName[t];
1460
+ return r;
1275
1461
  },
1276
1462
  getDataRewindFunc(e) {
1277
- var r = V[e];
1278
- return r;
1463
+ var t = B[e];
1464
+ return t;
1279
1465
  },
1280
1466
  doRewind(e) {
1281
- var r = g.getDataRewindFuncName(e), t = g.getDataRewindFunc(r);
1282
- return t();
1467
+ var t = h.getDataRewindFuncName(e), r = h.getDataRewindFunc(t);
1468
+ return r();
1283
1469
  },
1284
1470
  handleSleep(e) {
1285
- if (f(g.state !== g.State.Disabled, "Asyncify cannot be done during or after the runtime exits"), !T) {
1286
- if (g.state === g.State.Normal) {
1287
- var r = !1, t = !1;
1471
+ if (g(h.state !== h.State.Disabled, "Asyncify cannot be done during or after the runtime exits"), !N) {
1472
+ if (h.state === h.State.Normal) {
1473
+ var t = !1, r = !1;
1288
1474
  e((i = 0) => {
1289
- if (f(!i || typeof i == "number" || typeof i == "boolean"), !T && (g.handleSleepReturnValue = i, r = !0, !!t)) {
1290
- f(!g.exportCallStack.length, "Waking up (starting to rewind) must be done from JS, without compiled code on the stack."), g.state = g.State.Rewinding, Be(() => Yn(g.currData)), typeof MainLoop < "u" && MainLoop.func && MainLoop.resume();
1291
- var a, s = !1;
1475
+ if (g(!i || typeof i == "number" || typeof i == "boolean"), !N && (h.handleSleepReturnValue = i, t = !0, !!r)) {
1476
+ g(!h.exportCallStack.length, "Waking up (starting to rewind) must be done from JS, without compiled code on the stack."), h.state = h.State.Rewinding, Ye(() => ga(h.currData)), typeof MainLoop < "u" && MainLoop.func && MainLoop.resume();
1477
+ var o, l = !1;
1292
1478
  try {
1293
- a = g.doRewind(g.currData);
1294
- } catch (d) {
1295
- a = d, s = !0;
1479
+ o = h.doRewind(h.currData);
1480
+ } catch (u) {
1481
+ o = u, l = !0;
1296
1482
  }
1297
- var l = !1;
1298
- if (!g.currData) {
1299
- var o = g.asyncPromiseHandlers;
1300
- o && (g.asyncPromiseHandlers = null, (s ? o.reject : o.resolve)(a), l = !0);
1483
+ var d = !1;
1484
+ if (!h.currData) {
1485
+ var s = h.asyncPromiseHandlers;
1486
+ s && (h.asyncPromiseHandlers = null, (l ? s.reject : s.resolve)(o), d = !0);
1301
1487
  }
1302
- if (s && !l)
1303
- throw a;
1488
+ if (l && !d)
1489
+ throw o;
1304
1490
  }
1305
- }), t = !0, r || (g.state = g.State.Unwinding, g.currData = g.allocateData(), typeof MainLoop < "u" && MainLoop.func && MainLoop.pause(), Be(() => Bn(g.currData)));
1306
- } else g.state === g.State.Rewinding ? (g.state = g.State.Normal, Be(zn), le(g.currData), g.currData = null, g.sleepCallbacks.forEach($i)) : M(`invalid state: ${g.state}`);
1307
- return g.handleSleepReturnValue;
1491
+ }), r = !0, t || (h.state = h.State.Unwinding, h.currData = h.allocateData(), typeof MainLoop < "u" && MainLoop.func && MainLoop.pause(), Ye(() => va(h.currData)));
1492
+ } else h.state === h.State.Rewinding ? (h.state = h.State.Normal, Ye(_a), se(h.currData), h.currData = null, h.sleepCallbacks.forEach(ei)) : L(`invalid state: ${h.state}`);
1493
+ return h.handleSleepReturnValue;
1308
1494
  }
1309
1495
  },
1310
1496
  handleAsync(e) {
1311
- return g.handleSleep((r) => {
1312
- e().then(r);
1497
+ return h.handleSleep((t) => {
1498
+ e().then(t);
1313
1499
  });
1314
1500
  }
1315
1501
  };
1316
- function Pi(e) {
1317
- for (var r = e.length - 2, t = e.length - 1; t >= 2 && e[t].optional; --t)
1318
- r--;
1319
- return r;
1502
+ function ti(e) {
1503
+ for (var t = e.length - 2, r = e.length - 1; r >= 2 && e[r].optional; --r)
1504
+ t--;
1505
+ return t;
1320
1506
  }
1321
- function Wr(e, r, t, i, a, s) {
1322
- var l = r.length;
1323
- l < 2 && P("argTypes array size mismatch! Must at least get return value and 'this' types!"), f(!s, "Async bindings are only supported with JSPI.");
1324
- for (var o = r[1] !== null && t !== null, d = Nr(r), p = r[0].name !== "void", y = l - 2, m = Pi(r), A = [e, P, i, a, qe, r[0], r[1]], k = 0; k < l - 2; ++k)
1325
- A.push(r[k + 2]);
1326
- if (A.push(g), !d)
1327
- for (var k = o ? 1 : 2; k < r.length; ++k)
1328
- r[k].destructorFunction !== null && A.push(r[k].destructorFunction);
1329
- A.push(Ei, m, y);
1330
- let [U, J] = Si(r, o, p, s);
1331
- U.push(J);
1332
- var re = jr(Function, U)(...A);
1333
- return Ie(e, re);
1507
+ function ir(e, t, r, i, o, l) {
1508
+ var d = t.length;
1509
+ d < 2 && R("argTypes array size mismatch! Must at least get return value and 'this' types!"), g(!l, "Async bindings are only supported with JSPI.");
1510
+ for (var s = t[1] !== null && r !== null, u = rr(t), v = t[0].name !== "void", _ = d - 2, w = ti(t), U = [e, R, i, o, rt, t[0], t[1]], D = 0; D < d - 2; ++D)
1511
+ U.push(t[D + 2]);
1512
+ if (U.push(h), !u)
1513
+ for (var D = s ? 1 : 2; D < t.length; ++D)
1514
+ t[D].destructorFunction !== null && U.push(t[D].destructorFunction);
1515
+ U.push(Kn, w, _);
1516
+ let [x, z] = Qn(t, s, v, l);
1517
+ x.push(z);
1518
+ var te = nr(Function, x)(...U);
1519
+ return $e(e, te);
1334
1520
  }
1335
- var Ii = (e, r, t, i, a, s) => {
1336
- f(r > 0);
1337
- var l = Lr(r, t);
1338
- a = ne(i, a), me([], [e], (o) => {
1339
- o = o[0];
1340
- var d = `constructor ${o.name}`;
1341
- if (o.registeredClass.constructor_body === void 0 && (o.registeredClass.constructor_body = []), o.registeredClass.constructor_body[r - 1] !== void 0)
1342
- throw new he(`Cannot register multiple constructors with identical number of parameters (${r - 1}) for class '${o.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
1343
- return o.registeredClass.constructor_body[r - 1] = () => {
1344
- tr(`Cannot construct ${o.name} due to unbound types`, l);
1345
- }, me([], l, (p) => (p.splice(1, 0, null), o.registeredClass.constructor_body[r - 1] = Wr(d, p, null, a, s), [])), [];
1521
+ var ri = (e, t, r, i, o, l) => {
1522
+ g(t > 0);
1523
+ var d = tr(t, r);
1524
+ o = ae(i, o), me([], [e], (s) => {
1525
+ s = s[0];
1526
+ var u = `constructor ${s.name}`;
1527
+ if (s.registeredClass.constructor_body === void 0 && (s.registeredClass.constructor_body = []), s.registeredClass.constructor_body[t - 1] !== void 0)
1528
+ throw new he(`Cannot register multiple constructors with identical number of parameters (${t - 1}) for class '${s.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
1529
+ return s.registeredClass.constructor_body[t - 1] = () => {
1530
+ ot(`Cannot construct ${s.name} due to unbound types`, d);
1531
+ }, me([], d, (v) => (v.splice(1, 0, null), s.registeredClass.constructor_body[t - 1] = ir(u, v, null, o, l), [])), [];
1346
1532
  });
1347
- }, ki = (e) => {
1533
+ }, ni = (e) => {
1348
1534
  e = e.trim();
1349
- const r = e.indexOf("(");
1350
- return r === -1 ? e : (f(e.endsWith(")"), "Parentheses for argument names should match."), e.slice(0, r));
1351
- }, Mi = (e, r, t, i, a, s, l, o, d, p) => {
1352
- var y = Lr(t, i);
1353
- r = G(r), r = ki(r), s = ne(a, s), me([], [e], (m) => {
1354
- m = m[0];
1355
- var A = `${m.name}.${r}`;
1356
- r.startsWith("@@") && (r = Symbol[r.substring(2)]), o && m.registeredClass.pureVirtualFunctions.push(r);
1357
- function k() {
1358
- tr(`Cannot call ${A} due to unbound types`, y);
1535
+ const t = e.indexOf("(");
1536
+ return t === -1 ? e : (g(e.endsWith(")"), "Parentheses for argument names should match."), e.slice(0, t));
1537
+ }, ii = (e, t, r, i, o, l, d, s, u, v) => {
1538
+ var _ = tr(r, i);
1539
+ t = Y(t), t = ni(t), l = ae(o, l), me([], [e], (w) => {
1540
+ w = w[0];
1541
+ var U = `${w.name}.${t}`;
1542
+ t.startsWith("@@") && (t = Symbol[t.substring(2)]), s && w.registeredClass.pureVirtualFunctions.push(t);
1543
+ function D() {
1544
+ ot(`Cannot call ${U} due to unbound types`, _);
1359
1545
  }
1360
- var U = m.registeredClass.instancePrototype, J = U[r];
1361
- return J === void 0 || J.overloadTable === void 0 && J.className !== m.name && J.argCount === t - 2 ? (k.argCount = t - 2, k.className = m.name, U[r] = k) : (Dr(U, r, A), U[r].overloadTable[t - 2] = k), me([], y, (re) => {
1362
- var Q = Wr(A, re, m, s, l, d);
1363
- return U[r].overloadTable === void 0 ? (Q.argCount = t - 2, U[r] = Q) : U[r].overloadTable[t - 2] = Q, [];
1546
+ var x = w.registeredClass.instancePrototype, z = x[t];
1547
+ return z === void 0 || z.overloadTable === void 0 && z.className !== w.name && z.argCount === r - 2 ? (D.argCount = r - 2, D.className = w.name, x[t] = D) : (Qt(x, t, U), x[t].overloadTable[r - 2] = D), me([], _, (te) => {
1548
+ var J = ir(U, te, w, l, d, u);
1549
+ return x[t].overloadTable === void 0 ? (J.argCount = r - 2, x[t] = J) : x[t].overloadTable[r - 2] = J, [];
1364
1550
  }), [];
1365
1551
  });
1366
- }, ir = [], q = [], nr = (e) => {
1367
- e > 9 && --q[e + 1] === 0 && (f(q[e] !== void 0, "Decref for unallocated handle."), q[e] = void 0, ir.push(e));
1368
- }, Ri = () => q.length / 2 - 5 - ir.length, Di = () => {
1369
- q.push(
1552
+ }, st = [], X = [], lt = (e) => {
1553
+ e > 9 && --X[e + 1] === 0 && (g(X[e] !== void 0, "Decref for unallocated handle."), X[e] = void 0, st.push(e));
1554
+ }, ai = () => X.length / 2 - 5 - st.length, oi = () => {
1555
+ X.push(
1370
1556
  0,
1371
1557
  1,
1372
1558
  void 0,
@@ -1377,9 +1563,9 @@ ${p}`, [m, p];
1377
1563
  1,
1378
1564
  !1,
1379
1565
  1
1380
- ), f(q.length === 5 * 2), n.count_emval_handles = Ri;
1381
- }, K = {
1382
- toValue: (e) => (e || P("Cannot use deleted val. handle = " + e), f(e === 2 || q[e] !== void 0 && e % 2 === 0, `invalid handle: ${e}`), q[e]),
1566
+ ), g(X.length === 5 * 2), a.count_emval_handles = ai;
1567
+ }, G = {
1568
+ toValue: (e) => (e || R("Cannot use deleted val. handle = " + e), g(e === 2 || X[e] !== void 0 && e % 2 === 0, `invalid handle: ${e}`), X[e]),
1383
1569
  toHandle: (e) => {
1384
1570
  switch (e) {
1385
1571
  case void 0:
@@ -1391,78 +1577,78 @@ ${p}`, [m, p];
1391
1577
  case !1:
1392
1578
  return 8;
1393
1579
  default: {
1394
- const r = ir.pop() || q.length;
1395
- return q[r] = e, q[r + 1] = 1, r;
1580
+ const t = st.pop() || X.length;
1581
+ return X[t] = e, X[t + 1] = 1, t;
1396
1582
  }
1397
1583
  }
1398
1584
  }
1399
- }, Hr = {
1585
+ }, ar = {
1400
1586
  name: "emscripten::val",
1401
1587
  fromWireType: (e) => {
1402
- var r = K.toValue(e);
1403
- return nr(e), r;
1588
+ var t = G.toValue(e);
1589
+ return lt(e), t;
1404
1590
  },
1405
- toWireType: (e, r) => K.toHandle(r),
1591
+ toWireType: (e, t) => G.toHandle(t),
1406
1592
  argPackAdvance: ie,
1407
- readValueFromPointer: $e,
1593
+ readValueFromPointer: Fe,
1408
1594
  destructorFunction: null
1409
1595
  // This type does not need a destructor
1410
1596
  // TODO: do we need a deleteObject here? write a test where
1411
1597
  // emval is passed into JS via an interface
1412
- }, Ui = (e) => ee(e, Hr), xi = (e, r) => {
1413
- switch (r) {
1598
+ }, si = (e) => ee(e, ar), li = (e, t) => {
1599
+ switch (t) {
1414
1600
  case 4:
1415
- return function(t) {
1416
- return this.fromWireType(_r[t >> 2]);
1601
+ return function(r) {
1602
+ return this.fromWireType(Ut[r >> 2]);
1417
1603
  };
1418
1604
  case 8:
1419
- return function(t) {
1420
- return this.fromWireType(gr[t >> 3]);
1605
+ return function(r) {
1606
+ return this.fromWireType(Rt[r >> 3]);
1421
1607
  };
1422
1608
  default:
1423
- throw new TypeError(`invalid float width (${r}): ${e}`);
1609
+ throw new TypeError(`invalid float width (${t}): ${e}`);
1424
1610
  }
1425
- }, Oi = (e, r, t) => {
1426
- r = G(r), ee(e, {
1427
- name: r,
1611
+ }, di = (e, t, r) => {
1612
+ t = Y(t), ee(e, {
1613
+ name: t,
1428
1614
  fromWireType: (i) => i,
1429
- toWireType: (i, a) => {
1430
- if (typeof a != "number" && typeof a != "boolean")
1431
- throw new TypeError(`Cannot convert ${ce(a)} to ${this.name}`);
1432
- return a;
1615
+ toWireType: (i, o) => {
1616
+ if (typeof o != "number" && typeof o != "boolean")
1617
+ throw new TypeError(`Cannot convert ${de(o)} to ${this.name}`);
1618
+ return o;
1433
1619
  },
1434
1620
  argPackAdvance: ie,
1435
- readValueFromPointer: xi(r, t),
1621
+ readValueFromPointer: li(t, r),
1436
1622
  destructorFunction: null
1437
1623
  // This type does not need a destructor
1438
1624
  });
1439
- }, Li = (e, r, t, i, a) => {
1440
- r = G(r), a === -1 && (a = 4294967295);
1441
- var s = (y) => y;
1625
+ }, ci = (e, t, r, i, o) => {
1626
+ t = Y(t), o === -1 && (o = 4294967295);
1627
+ var l = (_) => _;
1442
1628
  if (i === 0) {
1443
- var l = 32 - 8 * t;
1444
- s = (y) => y << l >>> l;
1629
+ var d = 32 - 8 * r;
1630
+ l = (_) => _ << d >>> d;
1445
1631
  }
1446
- var o = r.includes("unsigned"), d = (y, m) => {
1447
- if (typeof y != "number" && typeof y != "boolean")
1448
- throw new TypeError(`Cannot convert "${ce(y)}" to ${m}`);
1449
- if (y < i || y > a)
1450
- throw new TypeError(`Passing a number "${ce(y)}" from JS side to C/C++ side to an argument of type "${r}", which is outside the valid range [${i}, ${a}]!`);
1451
- }, p;
1452
- o ? p = function(y, m) {
1453
- return d(m, this.name), m >>> 0;
1454
- } : p = function(y, m) {
1455
- return d(m, this.name), m;
1632
+ var s = t.includes("unsigned"), u = (_, w) => {
1633
+ if (typeof _ != "number" && typeof _ != "boolean")
1634
+ throw new TypeError(`Cannot convert "${de(_)}" to ${w}`);
1635
+ if (_ < i || _ > o)
1636
+ throw new TypeError(`Passing a number "${de(_)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${i}, ${o}]!`);
1637
+ }, v;
1638
+ s ? v = function(_, w) {
1639
+ return u(w, this.name), w >>> 0;
1640
+ } : v = function(_, w) {
1641
+ return u(w, this.name), w;
1456
1642
  }, ee(e, {
1457
- name: r,
1458
- fromWireType: s,
1459
- toWireType: p,
1643
+ name: t,
1644
+ fromWireType: l,
1645
+ toWireType: v,
1460
1646
  argPackAdvance: ie,
1461
- readValueFromPointer: $r(r, t, i !== 0),
1647
+ readValueFromPointer: Yt(t, r, i !== 0),
1462
1648
  destructorFunction: null
1463
1649
  // This type does not need a destructor
1464
1650
  });
1465
- }, Ni = (e, r, t) => {
1651
+ }, ui = (e, t, r) => {
1466
1652
  var i = [
1467
1653
  Int8Array,
1468
1654
  Uint8Array,
@@ -1474,511 +1660,511 @@ ${p}`, [m, p];
1474
1660
  Float64Array,
1475
1661
  BigInt64Array,
1476
1662
  BigUint64Array
1477
- ], a = i[r];
1478
- function s(l) {
1479
- var o = F[l >> 2], d = F[l + 4 >> 2];
1480
- return new a(j.buffer, d, o);
1663
+ ], o = i[t];
1664
+ function l(d) {
1665
+ var s = k[d >> 2], u = k[d + 4 >> 2];
1666
+ return new o(ne.buffer, u, s);
1481
1667
  }
1482
- t = G(t), ee(e, {
1483
- name: t,
1484
- fromWireType: s,
1668
+ r = Y(r), ee(e, {
1669
+ name: r,
1670
+ fromWireType: l,
1485
1671
  argPackAdvance: ie,
1486
- readValueFromPointer: s
1672
+ readValueFromPointer: l
1487
1673
  }, {
1488
1674
  ignoreDuplicateRegistrations: !0
1489
1675
  });
1490
- }, ji = Object.assign({ optional: !0 }, Hr), Wi = (e, r) => {
1491
- ee(e, ji);
1492
- }, ar = (e) => {
1493
- for (var r = 0, t = 0; t < e.length; ++t) {
1494
- var i = e.charCodeAt(t);
1495
- i <= 127 ? r++ : i <= 2047 ? r += 2 : i >= 55296 && i <= 57343 ? (r += 4, ++t) : r += 3;
1676
+ }, fi = Object.assign({ optional: !0 }, ar), pi = (e, t) => {
1677
+ ee(e, fi);
1678
+ }, dt = (e) => {
1679
+ for (var t = 0, r = 0; r < e.length; ++r) {
1680
+ var i = e.charCodeAt(r);
1681
+ i <= 127 ? t++ : i <= 2047 ? t += 2 : i >= 55296 && i <= 57343 ? (t += 4, ++r) : t += 3;
1496
1682
  }
1497
- return r;
1498
- }, Hi = (e, r) => {
1499
- r = G(r), ee(e, {
1500
- name: r,
1683
+ return t;
1684
+ }, vi = (e, t) => {
1685
+ t = Y(t), ee(e, {
1686
+ name: t,
1501
1687
  // For some method names we use string keys here since they are part of
1502
1688
  // the public/external API and/or used by the runtime-generated code.
1503
- fromWireType(t) {
1504
- for (var i = F[t >> 2], a = t + 4, s, l, o = a, l = 0; l <= i; ++l) {
1505
- var d = a + l;
1506
- if (l == i || H[d] == 0) {
1507
- var p = d - o, y = xe(o, p);
1508
- s === void 0 ? s = y : (s += "\0", s += y), o = d + 1;
1689
+ fromWireType(r) {
1690
+ for (var i = k[r >> 2], o = r + 4, l, d, s = o, d = 0; d <= i; ++d) {
1691
+ var u = o + d;
1692
+ if (d == i || K[u] == 0) {
1693
+ var v = u - s, _ = xe(s, v);
1694
+ l === void 0 ? l = _ : (l += "\0", l += _), s = u + 1;
1509
1695
  }
1510
1696
  }
1511
- return le(t), s;
1697
+ return se(r), l;
1512
1698
  },
1513
- toWireType(t, i) {
1699
+ toWireType(r, i) {
1514
1700
  i instanceof ArrayBuffer && (i = new Uint8Array(i));
1515
- var a, s = typeof i == "string";
1516
- s || i instanceof Uint8Array || i instanceof Uint8ClampedArray || i instanceof Int8Array || P("Cannot pass non-string to std::string"), s ? a = ar(i) : a = i.length;
1517
- var l = cr(4 + a + 1), o = l + 4;
1518
- if (F[l >> 2] = a, C(a), s)
1519
- Ae(i, o, a + 1);
1520
- else if (s)
1521
- for (var d = 0; d < a; ++d) {
1522
- var p = i.charCodeAt(d);
1523
- p > 255 && (le(l), P("String has UTF-16 code units that do not fit in 8 bits")), H[o + d] = p;
1701
+ var o, l = typeof i == "string";
1702
+ l || i instanceof Uint8Array || i instanceof Uint8ClampedArray || i instanceof Int8Array || R("Cannot pass non-string to std::string"), l ? o = dt(i) : o = i.length;
1703
+ var d = vt(4 + o + 1), s = d + 4;
1704
+ if (k[d >> 2] = o, S(o), l)
1705
+ Se(i, s, o + 1);
1706
+ else if (l)
1707
+ for (var u = 0; u < o; ++u) {
1708
+ var v = i.charCodeAt(u);
1709
+ v > 255 && (se(d), R("String has UTF-16 code units that do not fit in 8 bits")), K[s + u] = v;
1524
1710
  }
1525
1711
  else
1526
- for (var d = 0; d < a; ++d)
1527
- H[o + d] = i[d];
1528
- return t !== null && t.push(le, l), l;
1712
+ for (var u = 0; u < o; ++u)
1713
+ K[s + u] = i[u];
1714
+ return r !== null && r.push(se, d), d;
1529
1715
  },
1530
1716
  argPackAdvance: ie,
1531
- readValueFromPointer: $e,
1532
- destructorFunction(t) {
1533
- le(t);
1717
+ readValueFromPointer: Fe,
1718
+ destructorFunction(r) {
1719
+ se(r);
1534
1720
  }
1535
1721
  });
1536
- }, Br = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, Bi = (e, r) => {
1537
- f(e % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
1538
- for (var t = e, i = t >> 1, a = i + r / 2; !(i >= a) && te[i]; ) ++i;
1539
- if (t = i << 1, t - e > 32 && Br)
1540
- return Br.decode(H.subarray(e, t));
1541
- for (var s = "", l = 0; !(l >= r / 2); ++l) {
1542
- var o = oe[e + l * 2 >> 1];
1543
- if (o == 0) break;
1544
- s += String.fromCharCode(o);
1722
+ }, or = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, yi = (e, t) => {
1723
+ g(e % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
1724
+ for (var r = e, i = r >> 1, o = i + t / 2; !(i >= o) && De[i]; ) ++i;
1725
+ if (r = i << 1, r - e > 32 && or)
1726
+ return or.decode(K.subarray(e, r));
1727
+ for (var l = "", d = 0; !(d >= t / 2); ++d) {
1728
+ var s = ge[e + d * 2 >> 1];
1729
+ if (s == 0) break;
1730
+ l += String.fromCharCode(s);
1545
1731
  }
1546
- return s;
1547
- }, Vi = (e, r, t) => {
1548
- if (f(r % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"), f(typeof t == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), t ??= 2147483647, t < 2) return 0;
1549
- t -= 2;
1550
- for (var i = r, a = t < e.length * 2 ? t / 2 : e.length, s = 0; s < a; ++s) {
1551
- var l = e.charCodeAt(s);
1552
- oe[r >> 1] = l, Qe(l), r += 2;
1732
+ return l;
1733
+ }, gi = (e, t, r) => {
1734
+ if (g(t % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"), g(typeof r == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), r ??= 2147483647, r < 2) return 0;
1735
+ r -= 2;
1736
+ for (var i = t, o = r < e.length * 2 ? r / 2 : e.length, l = 0; l < o; ++l) {
1737
+ var d = e.charCodeAt(l);
1738
+ ge[t >> 1] = d, et(d), t += 2;
1553
1739
  }
1554
- return oe[r >> 1] = 0, Qe(0), r - i;
1555
- }, Yi = (e) => e.length * 2, zi = (e, r) => {
1556
- f(e % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
1557
- for (var t = 0, i = ""; !(t >= r / 4); ) {
1558
- var a = w[e + t * 4 >> 2];
1559
- if (a == 0) break;
1560
- if (++t, a >= 65536) {
1561
- var s = a - 65536;
1562
- i += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023);
1740
+ return ge[t >> 1] = 0, et(0), t - i;
1741
+ }, _i = (e) => e.length * 2, mi = (e, t) => {
1742
+ g(e % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
1743
+ for (var r = 0, i = ""; !(r >= t / 4); ) {
1744
+ var o = E[e + r * 4 >> 2];
1745
+ if (o == 0) break;
1746
+ if (++r, o >= 65536) {
1747
+ var l = o - 65536;
1748
+ i += String.fromCharCode(55296 | l >> 10, 56320 | l & 1023);
1563
1749
  } else
1564
- i += String.fromCharCode(a);
1750
+ i += String.fromCharCode(o);
1565
1751
  }
1566
1752
  return i;
1567
- }, Gi = (e, r, t) => {
1568
- if (f(r % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"), f(typeof t == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), t ??= 2147483647, t < 4) return 0;
1569
- for (var i = r, a = i + t - 4, s = 0; s < e.length; ++s) {
1570
- var l = e.charCodeAt(s);
1571
- if (l >= 55296 && l <= 57343) {
1572
- var o = e.charCodeAt(++s);
1573
- l = 65536 + ((l & 1023) << 10) | o & 1023;
1753
+ }, hi = (e, t, r) => {
1754
+ if (g(t % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"), g(typeof r == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), r ??= 2147483647, r < 4) return 0;
1755
+ for (var i = t, o = i + r - 4, l = 0; l < e.length; ++l) {
1756
+ var d = e.charCodeAt(l);
1757
+ if (d >= 55296 && d <= 57343) {
1758
+ var s = e.charCodeAt(++l);
1759
+ d = 65536 + ((d & 1023) << 10) | s & 1023;
1574
1760
  }
1575
- if (w[r >> 2] = l, C(l), r += 4, r + 4 > a) break;
1761
+ if (E[t >> 2] = d, S(d), t += 4, t + 4 > o) break;
1576
1762
  }
1577
- return w[r >> 2] = 0, C(0), r - i;
1578
- }, Ji = (e) => {
1579
- for (var r = 0, t = 0; t < e.length; ++t) {
1580
- var i = e.charCodeAt(t);
1581
- i >= 55296 && i <= 57343 && ++t, r += 4;
1763
+ return E[t >> 2] = 0, S(0), t - i;
1764
+ }, bi = (e) => {
1765
+ for (var t = 0, r = 0; r < e.length; ++r) {
1766
+ var i = e.charCodeAt(r);
1767
+ i >= 55296 && i <= 57343 && ++r, t += 4;
1582
1768
  }
1583
- return r;
1584
- }, Ki = (e, r, t) => {
1585
- t = G(t);
1586
- var i, a, s, l;
1587
- r === 2 ? (i = Bi, a = Vi, l = Yi, s = (o) => te[o >> 1]) : r === 4 && (i = zi, a = Gi, l = Ji, s = (o) => F[o >> 2]), ee(e, {
1588
- name: t,
1589
- fromWireType: (o) => {
1590
- for (var d = F[o >> 2], p, y = o + 4, m = 0; m <= d; ++m) {
1591
- var A = o + 4 + m * r;
1592
- if (m == d || s(A) == 0) {
1593
- var k = A - y, U = i(y, k);
1594
- p === void 0 ? p = U : (p += "\0", p += U), y = A + r;
1769
+ return t;
1770
+ }, wi = (e, t, r) => {
1771
+ r = Y(r);
1772
+ var i, o, l, d;
1773
+ t === 2 ? (i = yi, o = gi, d = _i, l = (s) => De[s >> 1]) : t === 4 && (i = mi, o = hi, d = bi, l = (s) => k[s >> 2]), ee(e, {
1774
+ name: r,
1775
+ fromWireType: (s) => {
1776
+ for (var u = k[s >> 2], v, _ = s + 4, w = 0; w <= u; ++w) {
1777
+ var U = s + 4 + w * t;
1778
+ if (w == u || l(U) == 0) {
1779
+ var D = U - _, x = i(_, D);
1780
+ v === void 0 ? v = x : (v += "\0", v += x), _ = U + t;
1595
1781
  }
1596
1782
  }
1597
- return le(o), p;
1783
+ return se(s), v;
1598
1784
  },
1599
- toWireType: (o, d) => {
1600
- typeof d != "string" && P(`Cannot pass non-string to C++ string type ${t}`);
1601
- var p = l(d), y = cr(4 + p + r);
1602
- return F[y >> 2] = p / r, C(p / r), a(d, y + 4, p + r), o !== null && o.push(le, y), y;
1785
+ toWireType: (s, u) => {
1786
+ typeof u != "string" && R(`Cannot pass non-string to C++ string type ${r}`);
1787
+ var v = d(u), _ = vt(4 + v + t);
1788
+ return k[_ >> 2] = v / t, S(v / t), o(u, _ + 4, v + t), s !== null && s.push(se, _), _;
1603
1789
  },
1604
1790
  argPackAdvance: ie,
1605
- readValueFromPointer: $e,
1606
- destructorFunction(o) {
1607
- le(o);
1791
+ readValueFromPointer: Fe,
1792
+ destructorFunction(s) {
1793
+ se(s);
1608
1794
  }
1609
1795
  });
1610
- }, Qi = (e, r, t, i, a, s) => {
1611
- Oe[e] = {
1612
- name: G(r),
1613
- rawConstructor: ne(t, i),
1614
- rawDestructor: ne(a, s),
1796
+ }, Ci = (e, t, r, i, o, l) => {
1797
+ je[e] = {
1798
+ name: Y(t),
1799
+ rawConstructor: ae(r, i),
1800
+ rawDestructor: ae(o, l),
1615
1801
  fields: []
1616
1802
  };
1617
- }, Xi = (e, r, t, i, a, s, l, o, d, p) => {
1618
- Oe[e].fields.push({
1619
- fieldName: G(r),
1620
- getterReturnType: t,
1621
- getter: ne(i, a),
1622
- getterContext: s,
1623
- setterArgumentType: l,
1624
- setter: ne(o, d),
1625
- setterContext: p
1803
+ }, Ti = (e, t, r, i, o, l, d, s, u, v) => {
1804
+ je[e].fields.push({
1805
+ fieldName: Y(t),
1806
+ getterReturnType: r,
1807
+ getter: ae(i, o),
1808
+ getterContext: l,
1809
+ setterArgumentType: d,
1810
+ setter: ae(s, u),
1811
+ setterContext: v
1626
1812
  });
1627
- }, qi = (e, r) => {
1628
- r = G(r), ee(e, {
1813
+ }, Ei = (e, t) => {
1814
+ t = Y(t), ee(e, {
1629
1815
  isVoid: !0,
1630
1816
  // void return values can be optimized out sometimes
1631
- name: r,
1817
+ name: t,
1632
1818
  argPackAdvance: 0,
1633
1819
  fromWireType: () => {
1634
1820
  },
1635
1821
  // TODO: assert if anything else is given?
1636
- toWireType: (t, i) => {
1822
+ toWireType: (r, i) => {
1637
1823
  }
1638
1824
  });
1639
- }, or = (e, r) => {
1640
- var t = pe[e];
1641
- return t === void 0 && P(`${r} has unknown type ${Or(e)}`), t;
1642
- }, Vr = (e, r, t) => {
1643
- var i = [], a = e.toWireType(i, t);
1644
- return i.length && (F[r >> 2] = K.toHandle(i)), a;
1645
- }, Zi = (e, r, t) => (e = K.toValue(e), r = or(r, "emval::as"), Vr(r, t, e)), Yr = (e) => g.handleAsync(async () => {
1646
- var r = await K.toValue(e);
1647
- return K.toHandle(r);
1825
+ }, ct = (e, t) => {
1826
+ var r = ve[e];
1827
+ return r === void 0 && R(`${t} has unknown type ${er(e)}`), r;
1828
+ }, sr = (e, t, r) => {
1829
+ var i = [], o = e.toWireType(i, r);
1830
+ return i.length && (k[t >> 2] = G.toHandle(i)), o;
1831
+ }, Ai = (e, t, r) => (e = G.toValue(e), t = ct(t, "emval::as"), sr(t, r, e)), lr = (e) => h.handleAsync(async () => {
1832
+ var t = await G.toValue(e);
1833
+ return G.toHandle(t);
1648
1834
  });
1649
- Yr.isAsync = !0;
1650
- var sr = [], en = (e, r, t, i) => (e = sr[e], r = K.toValue(r), e(null, r, t, i)), rn = (e) => {
1651
- var r = sr.length;
1652
- return sr.push(e), r;
1653
- }, tn = (e, r) => {
1654
- for (var t = new Array(e), i = 0; i < e; ++i)
1655
- t[i] = or(
1656
- F[r + i * 4 >> 2],
1835
+ lr.isAsync = !0;
1836
+ var ut = [], Si = (e, t, r, i) => (e = ut[e], t = G.toValue(t), e(null, t, r, i)), Fi = (e) => {
1837
+ var t = ut.length;
1838
+ return ut.push(e), t;
1839
+ }, Ii = (e, t) => {
1840
+ for (var r = new Array(e), i = 0; i < e; ++i)
1841
+ r[i] = ct(
1842
+ k[t + i * 4 >> 2],
1657
1843
  "parameter " + i
1658
1844
  );
1659
- return t;
1660
- }, nn = (e, r, t) => {
1661
- var i = tn(e, r), a = i.shift();
1845
+ return r;
1846
+ }, $i = (e, t, r) => {
1847
+ var i = Ii(e, t), o = i.shift();
1662
1848
  e--;
1663
- var s = `return function (obj, func, destructorsRef, args) {
1664
- `, l = 0, o = [];
1665
- t === /* FUNCTION */
1666
- 0 && o.push("obj");
1667
- for (var d = ["retType"], p = [a], y = 0; y < e; ++y)
1668
- o.push("arg" + y), d.push("argType" + y), p.push(i[y]), s += ` var arg${y} = argType${y}.readValueFromPointer(args${l ? "+" + l : ""});
1669
- `, l += i[y].argPackAdvance;
1670
- var m = t === /* CONSTRUCTOR */
1849
+ var l = `return function (obj, func, destructorsRef, args) {
1850
+ `, d = 0, s = [];
1851
+ r === /* FUNCTION */
1852
+ 0 && s.push("obj");
1853
+ for (var u = ["retType"], v = [o], _ = 0; _ < e; ++_)
1854
+ s.push("arg" + _), u.push("argType" + _), v.push(i[_]), l += ` var arg${_} = argType${_}.readValueFromPointer(args${d ? "+" + d : ""});
1855
+ `, d += i[_].argPackAdvance;
1856
+ var w = r === /* CONSTRUCTOR */
1671
1857
  1 ? "new func" : "func.call";
1672
- s += ` var rv = ${m}(${o.join(", ")});
1673
- `, a.isVoid || (d.push("emval_returnValue"), p.push(Vr), s += ` return emval_returnValue(retType, destructorsRef, rv);
1674
- `), s += `};
1675
- `, d.push(s);
1676
- var A = jr(Function, d)(...p), k = `methodCaller<(${i.map((U) => U.name).join(", ")}) => ${a.name}>`;
1677
- return rn(Ie(k, A));
1678
- }, an = (e, r) => (e = K.toValue(e), r = K.toValue(r), K.toHandle(e[r])), on = (e) => {
1679
- e > 9 && (q[e + 1] += 1);
1680
- }, sn = {}, ln = (e) => {
1681
- var r = sn[e];
1682
- return r === void 0 ? G(e) : r;
1683
- }, dn = (e) => K.toHandle(ln(e)), cn = (e) => {
1684
- var r = K.toValue(e);
1685
- qe(r), nr(e);
1686
- }, un = (e, r) => {
1687
- e = or(e, "_emval_take_value");
1688
- var t = e.readValueFromPointer(r);
1689
- return K.toHandle(t);
1690
- }, fn = 9007199254740992, vn = -9007199254740992, zr = (e) => e < vn || e > fn ? NaN : Number(e);
1691
- function pn(e, r) {
1692
- e = zr(e);
1693
- var t = new Date(e * 1e3);
1694
- w[r >> 2] = t.getUTCSeconds(), C(t.getUTCSeconds()), w[r + 4 >> 2] = t.getUTCMinutes(), C(t.getUTCMinutes()), w[r + 8 >> 2] = t.getUTCHours(), C(t.getUTCHours()), w[r + 12 >> 2] = t.getUTCDate(), C(t.getUTCDate()), w[r + 16 >> 2] = t.getUTCMonth(), C(t.getUTCMonth()), w[r + 20 >> 2] = t.getUTCFullYear() - 1900, C(t.getUTCFullYear() - 1900), w[r + 24 >> 2] = t.getUTCDay(), C(t.getUTCDay());
1695
- var i = Date.UTC(t.getUTCFullYear(), 0, 1, 0, 0, 0, 0), a = (t.getTime() - i) / (1e3 * 60 * 60 * 24) | 0;
1696
- w[r + 28 >> 2] = a, C(a);
1858
+ l += ` var rv = ${w}(${s.join(", ")});
1859
+ `, o.isVoid || (u.push("emval_returnValue"), v.push(sr), l += ` return emval_returnValue(retType, destructorsRef, rv);
1860
+ `), l += `};
1861
+ `, u.push(l);
1862
+ var U = nr(Function, u)(...v), D = `methodCaller<(${i.map((x) => x.name).join(", ")}) => ${o.name}>`;
1863
+ return Fi($e(D, U));
1864
+ }, Pi = (e, t) => (e = G.toValue(e), t = G.toValue(t), G.toHandle(e[t])), ki = (e) => {
1865
+ e > 9 && (X[e + 1] += 1);
1866
+ }, Ui = {}, Mi = (e) => {
1867
+ var t = Ui[e];
1868
+ return t === void 0 ? Y(e) : t;
1869
+ }, Ri = (e) => G.toHandle(Mi(e)), Di = (e) => {
1870
+ var t = G.toValue(e);
1871
+ rt(t), lt(e);
1872
+ }, Li = (e, t) => {
1873
+ e = ct(e, "_emval_take_value");
1874
+ var r = e.readValueFromPointer(t);
1875
+ return G.toHandle(r);
1876
+ }, Oi = 9007199254740992, xi = -9007199254740992, dr = (e) => e < xi || e > Oi ? NaN : Number(e);
1877
+ function ji(e, t) {
1878
+ e = dr(e);
1879
+ var r = new Date(e * 1e3);
1880
+ E[t >> 2] = r.getUTCSeconds(), S(r.getUTCSeconds()), E[t + 4 >> 2] = r.getUTCMinutes(), S(r.getUTCMinutes()), E[t + 8 >> 2] = r.getUTCHours(), S(r.getUTCHours()), E[t + 12 >> 2] = r.getUTCDate(), S(r.getUTCDate()), E[t + 16 >> 2] = r.getUTCMonth(), S(r.getUTCMonth()), E[t + 20 >> 2] = r.getUTCFullYear() - 1900, S(r.getUTCFullYear() - 1900), E[t + 24 >> 2] = r.getUTCDay(), S(r.getUTCDay());
1881
+ var i = Date.UTC(r.getUTCFullYear(), 0, 1, 0, 0, 0, 0), o = (r.getTime() - i) / (1e3 * 60 * 60 * 24) | 0;
1882
+ E[t + 28 >> 2] = o, S(o);
1697
1883
  }
1698
- var _n = (e) => e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0), yn = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335], gn = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], Gr = (e) => {
1699
- var r = _n(e.getFullYear()), t = r ? yn : gn, i = t[e.getMonth()] + e.getDate() - 1;
1884
+ var Ni = (e) => e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0), Wi = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335], Bi = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], cr = (e) => {
1885
+ var t = Ni(e.getFullYear()), r = t ? Wi : Bi, i = r[e.getMonth()] + e.getDate() - 1;
1700
1886
  return i;
1701
1887
  };
1702
- function mn(e, r) {
1703
- e = zr(e);
1704
- var t = new Date(e * 1e3);
1705
- w[r >> 2] = t.getSeconds(), C(t.getSeconds()), w[r + 4 >> 2] = t.getMinutes(), C(t.getMinutes()), w[r + 8 >> 2] = t.getHours(), C(t.getHours()), w[r + 12 >> 2] = t.getDate(), C(t.getDate()), w[r + 16 >> 2] = t.getMonth(), C(t.getMonth()), w[r + 20 >> 2] = t.getFullYear() - 1900, C(t.getFullYear() - 1900), w[r + 24 >> 2] = t.getDay(), C(t.getDay());
1706
- var i = Gr(t) | 0;
1707
- w[r + 28 >> 2] = i, C(i), w[r + 36 >> 2] = -(t.getTimezoneOffset() * 60), C(-(t.getTimezoneOffset() * 60));
1708
- var a = new Date(t.getFullYear(), 0, 1), s = new Date(t.getFullYear(), 6, 1).getTimezoneOffset(), l = a.getTimezoneOffset(), o = (s != l && t.getTimezoneOffset() == Math.min(l, s)) | 0;
1709
- w[r + 32 >> 2] = o, C(o);
1888
+ function Hi(e, t) {
1889
+ e = dr(e);
1890
+ var r = new Date(e * 1e3);
1891
+ E[t >> 2] = r.getSeconds(), S(r.getSeconds()), E[t + 4 >> 2] = r.getMinutes(), S(r.getMinutes()), E[t + 8 >> 2] = r.getHours(), S(r.getHours()), E[t + 12 >> 2] = r.getDate(), S(r.getDate()), E[t + 16 >> 2] = r.getMonth(), S(r.getMonth()), E[t + 20 >> 2] = r.getFullYear() - 1900, S(r.getFullYear() - 1900), E[t + 24 >> 2] = r.getDay(), S(r.getDay());
1892
+ var i = cr(r) | 0;
1893
+ E[t + 28 >> 2] = i, S(i), E[t + 36 >> 2] = -(r.getTimezoneOffset() * 60), S(-(r.getTimezoneOffset() * 60));
1894
+ var o = new Date(r.getFullYear(), 0, 1), l = new Date(r.getFullYear(), 6, 1).getTimezoneOffset(), d = o.getTimezoneOffset(), s = (l != d && r.getTimezoneOffset() == Math.min(d, l)) | 0;
1895
+ E[t + 32 >> 2] = s, S(s);
1710
1896
  }
1711
- var hn = function(e) {
1712
- var r = (() => {
1713
- var t = new Date(
1714
- w[e + 20 >> 2] + 1900,
1715
- w[e + 16 >> 2],
1716
- w[e + 12 >> 2],
1717
- w[e + 8 >> 2],
1718
- w[e + 4 >> 2],
1719
- w[e >> 2],
1897
+ var Vi = function(e) {
1898
+ var t = (() => {
1899
+ var r = new Date(
1900
+ E[e + 20 >> 2] + 1900,
1901
+ E[e + 16 >> 2],
1902
+ E[e + 12 >> 2],
1903
+ E[e + 8 >> 2],
1904
+ E[e + 4 >> 2],
1905
+ E[e >> 2],
1720
1906
  0
1721
- ), i = w[e + 32 >> 2], a = t.getTimezoneOffset(), s = new Date(t.getFullYear(), 0, 1), l = new Date(t.getFullYear(), 6, 1).getTimezoneOffset(), o = s.getTimezoneOffset(), d = Math.min(o, l);
1907
+ ), i = E[e + 32 >> 2], o = r.getTimezoneOffset(), l = new Date(r.getFullYear(), 0, 1), d = new Date(r.getFullYear(), 6, 1).getTimezoneOffset(), s = l.getTimezoneOffset(), u = Math.min(s, d);
1722
1908
  if (i < 0)
1723
- w[e + 32 >> 2] = +(l != o && d == a), C(+(l != o && d == a));
1724
- else if (i > 0 != (d == a)) {
1725
- var p = Math.max(o, l), y = i > 0 ? d : p;
1726
- t.setTime(t.getTime() + (y - a) * 6e4);
1909
+ E[e + 32 >> 2] = +(d != s && u == o), S(+(d != s && u == o));
1910
+ else if (i > 0 != (u == o)) {
1911
+ var v = Math.max(s, d), _ = i > 0 ? u : v;
1912
+ r.setTime(r.getTime() + (_ - o) * 6e4);
1727
1913
  }
1728
- w[e + 24 >> 2] = t.getDay(), C(t.getDay());
1729
- var m = Gr(t) | 0;
1730
- w[e + 28 >> 2] = m, C(m), w[e >> 2] = t.getSeconds(), C(t.getSeconds()), w[e + 4 >> 2] = t.getMinutes(), C(t.getMinutes()), w[e + 8 >> 2] = t.getHours(), C(t.getHours()), w[e + 12 >> 2] = t.getDate(), C(t.getDate()), w[e + 16 >> 2] = t.getMonth(), C(t.getMonth()), w[e + 20 >> 2] = t.getYear(), C(t.getYear());
1731
- var A = t.getTime();
1732
- return isNaN(A) ? -1 : A / 1e3;
1914
+ E[e + 24 >> 2] = r.getDay(), S(r.getDay());
1915
+ var w = cr(r) | 0;
1916
+ E[e + 28 >> 2] = w, S(w), E[e >> 2] = r.getSeconds(), S(r.getSeconds()), E[e + 4 >> 2] = r.getMinutes(), S(r.getMinutes()), E[e + 8 >> 2] = r.getHours(), S(r.getHours()), E[e + 12 >> 2] = r.getDate(), S(r.getDate()), E[e + 16 >> 2] = r.getMonth(), S(r.getMonth()), E[e + 20 >> 2] = r.getYear(), S(r.getYear());
1917
+ var U = r.getTime();
1918
+ return isNaN(U) ? -1 : U / 1e3;
1733
1919
  })();
1734
- return BigInt(r);
1735
- }, bn = (e, r, t, i) => {
1736
- var a = (/* @__PURE__ */ new Date()).getFullYear(), s = new Date(a, 0, 1), l = new Date(a, 6, 1), o = s.getTimezoneOffset(), d = l.getTimezoneOffset(), p = Math.max(o, d);
1737
- F[e >> 2] = p * 60, C(p * 60), w[r >> 2] = +(o != d), C(+(o != d));
1738
- var y = (k) => {
1739
- var U = k >= 0 ? "-" : "+", J = Math.abs(k), re = String(Math.floor(J / 60)).padStart(2, "0"), Q = String(J % 60).padStart(2, "0");
1740
- return `UTC${U}${re}${Q}`;
1741
- }, m = y(o), A = y(d);
1742
- f(m), f(A), f(ar(m) <= 16, `timezone name truncated to fit in TZNAME_MAX (${m})`), f(ar(A) <= 16, `timezone name truncated to fit in TZNAME_MAX (${A})`), d < o ? (Ae(m, t, 17), Ae(A, i, 17)) : (Ae(m, i, 17), Ae(A, t, 17));
1743
- }, Ve = () => performance.now(), Jr = () => Date.now(), wn = (e) => e >= 0 && e <= 3;
1744
- function Cn(e, r, t) {
1745
- if (!wn(e))
1920
+ return BigInt(t);
1921
+ }, Yi = (e, t, r, i) => {
1922
+ var o = (/* @__PURE__ */ new Date()).getFullYear(), l = new Date(o, 0, 1), d = new Date(o, 6, 1), s = l.getTimezoneOffset(), u = d.getTimezoneOffset(), v = Math.max(s, u);
1923
+ k[e >> 2] = v * 60, S(v * 60), E[t >> 2] = +(s != u), S(+(s != u));
1924
+ var _ = (D) => {
1925
+ var x = D >= 0 ? "-" : "+", z = Math.abs(D), te = String(Math.floor(z / 60)).padStart(2, "0"), J = String(z % 60).padStart(2, "0");
1926
+ return `UTC${x}${te}${J}`;
1927
+ }, w = _(s), U = _(u);
1928
+ g(w), g(U), g(dt(w) <= 16, `timezone name truncated to fit in TZNAME_MAX (${w})`), g(dt(U) <= 16, `timezone name truncated to fit in TZNAME_MAX (${U})`), u < s ? (Se(w, r, 17), Se(U, i, 17)) : (Se(w, i, 17), Se(U, r, 17));
1929
+ }, ze = () => performance.now(), ur = () => Date.now(), zi = (e) => e >= 0 && e <= 3;
1930
+ function Gi(e, t, r) {
1931
+ if (!zi(e))
1746
1932
  return 28;
1747
1933
  var i;
1748
- e === 0 ? i = Jr() : i = Ve();
1749
- var a = Math.round(i * 1e3 * 1e3);
1750
- return we[t >> 3] = BigInt(a), Xe(a), 0;
1934
+ e === 0 ? i = ur() : i = ze();
1935
+ var o = Math.round(i * 1e3 * 1e3);
1936
+ return be[r >> 3] = BigInt(o), tt(o), 0;
1751
1937
  }
1752
- var Kr = () => (
1938
+ var fr = () => (
1753
1939
  // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
1754
1940
  // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
1755
1941
  // for any code that deals with heap sizes, which would require special
1756
1942
  // casing all heap size related code to treat 0 specially.
1757
1943
  2147483648
1758
- ), Tn = () => Kr(), En = (e, r) => (f(r, "alignment argument is required"), Math.ceil(e / r) * r), Sn = (e) => {
1759
- var r = L.buffer, t = (e - r.byteLength + 65535) / 65536 | 0;
1944
+ ), Ji = () => fr(), qi = (e, t) => (g(t, "alignment argument is required"), Math.ceil(e / t) * t), Ki = (e) => {
1945
+ var t = W.buffer, r = (e - t.byteLength + 65535) / 65536 | 0;
1760
1946
  try {
1761
- return L.grow(t), br(), 1;
1947
+ return W.grow(r), Ot(), 1;
1762
1948
  } catch (i) {
1763
- S(`growMemory: Attempted to grow heap from ${r.byteLength} bytes to ${e} bytes, but got error: ${i}`);
1949
+ $(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${i}`);
1764
1950
  }
1765
- }, Fn = (e) => {
1766
- var r = H.length;
1767
- e >>>= 0, f(e > r);
1768
- var t = Kr();
1769
- if (e > t)
1770
- return S(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${t} bytes!`), !1;
1951
+ }, Qi = (e) => {
1952
+ var t = K.length;
1953
+ e >>>= 0, g(e > t);
1954
+ var r = fr();
1955
+ if (e > r)
1956
+ return $(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${r} bytes!`), !1;
1771
1957
  for (var i = 1; i <= 4; i *= 2) {
1772
- var a = r * (1 + 0.2 / i);
1773
- a = Math.min(a, e + 100663296);
1774
- var s = Math.min(t, En(Math.max(e, a), 65536)), l = Ve(), o = Sn(s), d = Ve();
1775
- if (yt(`Heap resize call from ${r} to ${s} took ${d - l} msecs. Success: ${!!o}`), o)
1958
+ var o = t * (1 + 0.2 / i);
1959
+ o = Math.min(o, e + 100663296);
1960
+ var l = Math.min(r, qi(Math.max(e, o), 65536)), d = ze(), s = Ki(l), u = ze();
1961
+ if (Wr(`Heap resize call from ${t} to ${l} took ${u - d} msecs. Success: ${!!s}`), s)
1776
1962
  return !0;
1777
1963
  }
1778
- return S(`Failed to grow the heap from ${r} bytes to ${s} bytes, not enough memory!`), !1;
1779
- }, lr = {}, An = () => ae || "./this.program", ke = () => {
1780
- if (!ke.strings) {
1781
- var e = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", r = {
1964
+ return $(`Failed to grow the heap from ${t} bytes to ${l} bytes, not enough memory!`), !1;
1965
+ }, ft = {}, Xi = () => j || "./this.program", Pe = () => {
1966
+ if (!Pe.strings) {
1967
+ var e = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", t = {
1782
1968
  USER: "web_user",
1783
1969
  LOGNAME: "web_user",
1784
1970
  PATH: "/",
1785
1971
  PWD: "/",
1786
1972
  HOME: "/home/web_user",
1787
1973
  LANG: e,
1788
- _: An()
1974
+ _: Xi()
1789
1975
  };
1790
- for (var t in lr)
1791
- lr[t] === void 0 ? delete r[t] : r[t] = lr[t];
1976
+ for (var r in ft)
1977
+ ft[r] === void 0 ? delete t[r] : t[r] = ft[r];
1792
1978
  var i = [];
1793
- for (var t in r)
1794
- i.push(`${t}=${r[t]}`);
1795
- ke.strings = i;
1979
+ for (var r in t)
1980
+ i.push(`${r}=${t[r]}`);
1981
+ Pe.strings = i;
1796
1982
  }
1797
- return ke.strings;
1798
- }, $n = (e, r) => {
1799
- for (var t = 0; t < e.length; ++t)
1800
- f(e.charCodeAt(t) === (e.charCodeAt(t) & 255)), j[r++] = e.charCodeAt(t), Ce(e.charCodeAt(t));
1801
- j[r] = 0, Ce(0);
1802
- }, Pn = (e, r) => {
1803
- var t = 0;
1804
- return ke().forEach((i, a) => {
1805
- var s = r + t;
1806
- F[e + a * 4 >> 2] = s, C(s), $n(i, s), t += i.length + 1;
1983
+ return Pe.strings;
1984
+ }, Zi = (e, t) => {
1985
+ for (var r = 0; r < e.length; ++r)
1986
+ g(e.charCodeAt(r) === (e.charCodeAt(r) & 255)), ne[t++] = e.charCodeAt(r), we(e.charCodeAt(r));
1987
+ ne[t] = 0, we(0);
1988
+ }, ea = (e, t) => {
1989
+ var r = 0;
1990
+ return Pe().forEach((i, o) => {
1991
+ var l = t + r;
1992
+ k[e + o * 4 >> 2] = l, S(l), Zi(i, l), r += i.length + 1;
1807
1993
  }), 0;
1808
- }, In = (e, r) => {
1809
- var t = ke();
1810
- F[e >> 2] = t.length, C(t.length);
1994
+ }, ta = (e, t) => {
1995
+ var r = Pe();
1996
+ k[e >> 2] = r.length, S(r.length);
1811
1997
  var i = 0;
1812
- return t.forEach((a) => i += a.length + 1), F[r >> 2] = i, C(i), 0;
1813
- }, kn = (e) => {
1814
- M("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM");
1815
- }, Mn = (e, r) => {
1816
- var t = 0, i = 0, a = 0;
1998
+ return r.forEach((o) => i += o.length + 1), k[t >> 2] = i, S(i), 0;
1999
+ }, ra = (e) => {
2000
+ L("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM");
2001
+ }, na = (e, t) => {
2002
+ var r = 0, i = 0, o = 0;
1817
2003
  {
1818
- f(e == 0 || e == 1 || e == 2);
1819
- var s = 2;
1820
- e == 0 ? t = 2 : (e == 1 || e == 2) && (t = 64), a = 1;
2004
+ g(e == 0 || e == 1 || e == 2);
2005
+ var l = 2;
2006
+ e == 0 ? r = 2 : (e == 1 || e == 2) && (r = 64), o = 1;
1821
2007
  }
1822
- return j[r] = s, Ce(s), oe[r + 2 >> 1] = a, Qe(a), we[r + 8 >> 3] = BigInt(t), Xe(t), we[r + 16 >> 3] = BigInt(i), Xe(i), 0;
1823
- }, Rn = (e, r, t, i) => {
1824
- M("fd_read called without SYSCALLS_REQUIRE_FILESYSTEM");
2008
+ return ne[t] = l, we(l), ge[t + 2 >> 1] = o, et(o), be[t + 8 >> 3] = BigInt(r), tt(r), be[t + 16 >> 3] = BigInt(i), tt(i), 0;
2009
+ }, ia = (e, t, r, i) => {
2010
+ L("fd_read called without SYSCALLS_REQUIRE_FILESYSTEM");
1825
2011
  };
1826
- function Dn(e, r, t, i) {
2012
+ function aa(e, t, r, i) {
1827
2013
  return 70;
1828
2014
  }
1829
- var Un = [null, [], []], xn = (e, r) => {
1830
- var t = Un[e];
1831
- f(t), r === 0 || r === 10 ? ((e === 1 ? I : S)(Sr(t)), t.length = 0) : t.push(r);
1832
- }, On = (e, r, t, i) => {
1833
- for (var a = 0, s = 0; s < t; s++) {
1834
- var l = F[r >> 2], o = F[r + 4 >> 2];
1835
- r += 8;
1836
- for (var d = 0; d < o; d++)
1837
- xn(e, H[l + d]);
1838
- a += o;
2015
+ var oa = [null, [], []], sa = (e, t) => {
2016
+ var r = oa[e];
2017
+ g(r), t === 0 || t === 10 ? ((e === 1 ? I : $)(Bt(r)), r.length = 0) : r.push(t);
2018
+ }, la = (e, t, r, i) => {
2019
+ for (var o = 0, l = 0; l < r; l++) {
2020
+ var d = k[t >> 2], s = k[t + 4 >> 2];
2021
+ t += 8;
2022
+ for (var u = 0; u < s; u++)
2023
+ sa(e, K[d + u]);
2024
+ o += s;
1839
2025
  }
1840
- return F[i >> 2] = a, C(a), 0;
2026
+ return k[i >> 2] = o, S(o), 0;
1841
2027
  };
1842
- Fr = n.InternalError = class extends Error {
1843
- constructor(r) {
1844
- super(r), this.name = "InternalError";
2028
+ Ht = a.InternalError = class extends Error {
2029
+ constructor(t) {
2030
+ super(t), this.name = "InternalError";
1845
2031
  }
1846
- }, Zt(), he = n.BindingError = class extends Error {
1847
- constructor(r) {
1848
- super(r), this.name = "BindingError";
2032
+ }, An(), he = a.BindingError = class extends Error {
2033
+ constructor(t) {
2034
+ super(t), this.name = "BindingError";
1849
2035
  }
1850
- }, li(), gi(), xr = n.UnboundTypeError = Ci(Error, "UnboundTypeError"), Di();
1851
- function Ln() {
1852
- at("fetchSettings");
2036
+ }, Rn(), Hn(), Zt = a.UnboundTypeError = Jn(Error, "UnboundTypeError"), oi();
2037
+ function da() {
2038
+ Pr("fetchSettings");
1853
2039
  }
1854
- var dr = {
2040
+ var pt = {
1855
2041
  /** @export */
1856
- __assert_fail: Rt,
2042
+ __assert_fail: an,
1857
2043
  /** @export */
1858
- __cxa_throw: Ut,
2044
+ __cxa_throw: sn,
1859
2045
  /** @export */
1860
- __handle_stack_overflow: xt,
2046
+ __handle_stack_overflow: ln,
1861
2047
  /** @export */
1862
- __syscall_faccessat: Ot,
2048
+ __syscall_faccessat: dn,
1863
2049
  /** @export */
1864
- __syscall_fcntl64: Lt,
2050
+ __syscall_fcntl64: cn,
1865
2051
  /** @export */
1866
- __syscall_fstat64: Nt,
2052
+ __syscall_fstat64: un,
1867
2053
  /** @export */
1868
- __syscall_getdents64: Wt,
2054
+ __syscall_getdents64: pn,
1869
2055
  /** @export */
1870
- __syscall_ioctl: Ht,
2056
+ __syscall_ioctl: vn,
1871
2057
  /** @export */
1872
- __syscall_lstat64: Bt,
2058
+ __syscall_lstat64: yn,
1873
2059
  /** @export */
1874
- __syscall_mkdirat: Vt,
2060
+ __syscall_mkdirat: gn,
1875
2061
  /** @export */
1876
- __syscall_newfstatat: Yt,
2062
+ __syscall_newfstatat: _n,
1877
2063
  /** @export */
1878
- __syscall_openat: zt,
2064
+ __syscall_openat: mn,
1879
2065
  /** @export */
1880
- __syscall_renameat: Gt,
2066
+ __syscall_renameat: hn,
1881
2067
  /** @export */
1882
- __syscall_rmdir: Jt,
2068
+ __syscall_rmdir: bn,
1883
2069
  /** @export */
1884
- __syscall_stat64: Kt,
2070
+ __syscall_stat64: wn,
1885
2071
  /** @export */
1886
- __syscall_unlinkat: Qt,
2072
+ __syscall_unlinkat: Cn,
1887
2073
  /** @export */
1888
- _abort_js: Xt,
2074
+ _abort_js: Tn,
1889
2075
  /** @export */
1890
- _embind_finalize_value_object: qt,
2076
+ _embind_finalize_value_object: En,
1891
2077
  /** @export */
1892
- _embind_register_bigint: ri,
2078
+ _embind_register_bigint: Fn,
1893
2079
  /** @export */
1894
- _embind_register_bool: ti,
2080
+ _embind_register_bool: In,
1895
2081
  /** @export */
1896
- _embind_register_class: Ti,
2082
+ _embind_register_class: qn,
1897
2083
  /** @export */
1898
- _embind_register_class_constructor: Ii,
2084
+ _embind_register_class_constructor: ri,
1899
2085
  /** @export */
1900
- _embind_register_class_function: Mi,
2086
+ _embind_register_class_function: ii,
1901
2087
  /** @export */
1902
- _embind_register_emval: Ui,
2088
+ _embind_register_emval: si,
1903
2089
  /** @export */
1904
- _embind_register_float: Oi,
2090
+ _embind_register_float: di,
1905
2091
  /** @export */
1906
- _embind_register_integer: Li,
2092
+ _embind_register_integer: ci,
1907
2093
  /** @export */
1908
- _embind_register_memory_view: Ni,
2094
+ _embind_register_memory_view: ui,
1909
2095
  /** @export */
1910
- _embind_register_optional: Wi,
2096
+ _embind_register_optional: pi,
1911
2097
  /** @export */
1912
- _embind_register_std_string: Hi,
2098
+ _embind_register_std_string: vi,
1913
2099
  /** @export */
1914
- _embind_register_std_wstring: Ki,
2100
+ _embind_register_std_wstring: wi,
1915
2101
  /** @export */
1916
- _embind_register_value_object: Qi,
2102
+ _embind_register_value_object: Ci,
1917
2103
  /** @export */
1918
- _embind_register_value_object_field: Xi,
2104
+ _embind_register_value_object_field: Ti,
1919
2105
  /** @export */
1920
- _embind_register_void: qi,
2106
+ _embind_register_void: Ei,
1921
2107
  /** @export */
1922
- _emval_as: Zi,
2108
+ _emval_as: Ai,
1923
2109
  /** @export */
1924
- _emval_await: Yr,
2110
+ _emval_await: lr,
1925
2111
  /** @export */
1926
- _emval_call: en,
2112
+ _emval_call: Si,
1927
2113
  /** @export */
1928
- _emval_decref: nr,
2114
+ _emval_decref: lt,
1929
2115
  /** @export */
1930
- _emval_get_method_caller: nn,
2116
+ _emval_get_method_caller: $i,
1931
2117
  /** @export */
1932
- _emval_get_property: an,
2118
+ _emval_get_property: Pi,
1933
2119
  /** @export */
1934
- _emval_incref: on,
2120
+ _emval_incref: ki,
1935
2121
  /** @export */
1936
- _emval_new_cstring: dn,
2122
+ _emval_new_cstring: Ri,
1937
2123
  /** @export */
1938
- _emval_run_destructors: cn,
2124
+ _emval_run_destructors: Di,
1939
2125
  /** @export */
1940
- _emval_take_value: un,
2126
+ _emval_take_value: Li,
1941
2127
  /** @export */
1942
- _gmtime_js: pn,
2128
+ _gmtime_js: ji,
1943
2129
  /** @export */
1944
- _localtime_js: mn,
2130
+ _localtime_js: Hi,
1945
2131
  /** @export */
1946
- _mktime_js: hn,
2132
+ _mktime_js: Vi,
1947
2133
  /** @export */
1948
- _tzset_js: bn,
2134
+ _tzset_js: Yi,
1949
2135
  /** @export */
1950
- clock_time_get: Cn,
2136
+ clock_time_get: Gi,
1951
2137
  /** @export */
1952
- emscripten_date_now: Jr,
2138
+ emscripten_date_now: ur,
1953
2139
  /** @export */
1954
- emscripten_get_heap_max: Tn,
2140
+ emscripten_get_heap_max: Ji,
1955
2141
  /** @export */
1956
- emscripten_get_now: Ve,
2142
+ emscripten_get_now: ze,
1957
2143
  /** @export */
1958
- emscripten_resize_heap: Fn,
2144
+ emscripten_resize_heap: Qi,
1959
2145
  /** @export */
1960
- environ_get: Pn,
2146
+ environ_get: ea,
1961
2147
  /** @export */
1962
- environ_sizes_get: In,
2148
+ environ_sizes_get: ta,
1963
2149
  /** @export */
1964
- fd_close: kn,
2150
+ fd_close: ra,
1965
2151
  /** @export */
1966
- fd_fdstat_get: Mn,
2152
+ fd_fdstat_get: na,
1967
2153
  /** @export */
1968
- fd_read: Rn,
2154
+ fd_read: ia,
1969
2155
  /** @export */
1970
- fd_seek: Dn,
2156
+ fd_seek: aa,
1971
2157
  /** @export */
1972
- fd_write: On
1973
- }, V = await $t(), Nn = v("__getTypeName", 1), le = v("free", 1), cr = v("malloc", 1), jn = V.emscripten_stack_init;
1974
- V.emscripten_stack_get_free;
1975
- var Qr = V.emscripten_stack_get_base, Ye = V.emscripten_stack_get_end;
1976
- V._emscripten_stack_restore, V._emscripten_stack_alloc;
1977
- var Wn = V.emscripten_stack_get_current, Hn = n.___set_stack_limits = v("__set_stack_limits", 2);
1978
- n.dynCall_v = v("dynCall_v", 1), n.dynCall_ii = v("dynCall_ii", 2), n.dynCall_viiii = v("dynCall_viiii", 5), n.dynCall_dd = v("dynCall_dd", 2), n.dynCall_vii = v("dynCall_vii", 3), n.dynCall_iii = v("dynCall_iii", 3), n.dynCall_iiii = v("dynCall_iiii", 4), n.dynCall_iiiiii = v("dynCall_iiiiii", 6), n.dynCall_ijii = v("dynCall_ijii", 4), n.dynCall_iiiiiii = v("dynCall_iiiiiii", 7), n.dynCall_vi = v("dynCall_vi", 2), n.dynCall_iiiii = v("dynCall_iiiii", 5), n.dynCall_viiiiii = v("dynCall_viiiiii", 7), n.dynCall_viiiiij = v("dynCall_viiiiij", 7), n.dynCall_viiiii = v("dynCall_viiiii", 6), n.dynCall_viii = v("dynCall_viii", 4), n.dynCall_viiiiiiiiii = v("dynCall_viiiiiiiiii", 11), n.dynCall_viiiiiiiiiii = v("dynCall_viiiiiiiiiii", 12), n.dynCall_viiiiiii = v("dynCall_viiiiiii", 8), n.dynCall_viiiiiiiiiiiiii = v("dynCall_viiiiiiiiiiiiii", 15), n.dynCall_viiiiiiiii = v("dynCall_viiiiiiiii", 10), n.dynCall_iiiiiiiii = v("dynCall_iiiiiiiii", 9), n.dynCall_did = v("dynCall_did", 3), n.dynCall_viiiiiiii = v("dynCall_viiiiiiii", 9), n.dynCall_viifi = v("dynCall_viifi", 5), n.dynCall_diii = v("dynCall_diii", 4), n.dynCall_fiii = v("dynCall_fiii", 4), n.dynCall_viidi = v("dynCall_viidi", 5), n.dynCall_fiiiiiiiiffii = v("dynCall_fiiiiiiiiffii", 13), n.dynCall_viiif = v("dynCall_viiif", 5), n.dynCall_viiiif = v("dynCall_viiiif", 6), n.dynCall_viiiiiiifi = v("dynCall_viiiiiiifi", 10), n.dynCall_iiijiiii = v("dynCall_iiijiiii", 8), n.dynCall_viiiiiiff = v("dynCall_viiiiiiff", 9), n.dynCall_viiiff = v("dynCall_viiiff", 6), n.dynCall_viiiffi = v("dynCall_viiiffi", 7), n.dynCall_fiiii = v("dynCall_fiiii", 5), n.dynCall_iiiiiiiiiiiiiifii = v("dynCall_iiiiiiiiiiiiiifii", 17), n.dynCall_i = v("dynCall_i", 1), n.dynCall_viiiiiiiiiiii = v("dynCall_viiiiiiiiiiii", 13), n.dynCall_iiiiiiii = v("dynCall_iiiiiiii", 8), n.dynCall_viiiifiiiiiiifi = v("dynCall_viiiifiiiiiiifi", 15), n.dynCall_iiiiiiiiiiiiii = v("dynCall_iiiiiiiiiiiiii", 14), n.dynCall_viiiiiiiiiiiii = v("dynCall_viiiiiiiiiiiii", 14), n.dynCall_viiiiiiiiiiiiiiii = v("dynCall_viiiiiiiiiiiiiiii", 17), n.dynCall_viiiiiifi = v("dynCall_viiiiiifi", 9), n.dynCall_viiiifii = v("dynCall_viiiifii", 8), n.dynCall_fii = v("dynCall_fii", 3), n.dynCall_viiiffiii = v("dynCall_viiiffiii", 9), n.dynCall_viiiiiiiiiiif = v("dynCall_viiiiiiiiiiif", 13), n.dynCall_viiiiifi = v("dynCall_viiiiifi", 8), n.dynCall_fiifii = v("dynCall_fiifii", 6), n.dynCall_viiijj = v("dynCall_viiijj", 6), n.dynCall_iiiiiiidiiddii = v("dynCall_iiiiiiidiiddii", 14), n.dynCall_jij = v("dynCall_jij", 3), n.dynCall_jii = v("dynCall_jii", 3), n.dynCall_iiij = v("dynCall_iiij", 4), n.dynCall_jiji = v("dynCall_jiji", 4), n.dynCall_iiiji = v("dynCall_iiiji", 5), n.dynCall_iiijjji = v("dynCall_iiijjji", 7), n.dynCall_jiiij = v("dynCall_jiiij", 5), n.dynCall_iiiiij = v("dynCall_iiiiij", 6), n.dynCall_iiiiiij = v("dynCall_iiiiiij", 7), n.dynCall_jiiji = v("dynCall_jiiji", 5), n.dynCall_viiid = v("dynCall_viiid", 5), n.dynCall_viif = v("dynCall_viif", 4), n.dynCall_dii = v("dynCall_dii", 3), n.dynCall_viid = v("dynCall_viid", 4), n.dynCall_iiiid = v("dynCall_iiiid", 5), n.dynCall_diiii = v("dynCall_diiii", 5), n.dynCall_iidiiii = v("dynCall_iidiiii", 7);
1979
- var Bn = v("asyncify_start_unwind", 1), Vn = v("asyncify_stop_unwind", 0), Yn = v("asyncify_start_rewind", 1), zn = v("asyncify_stop_rewind", 0);
1980
- n._ff_h264_cabac_tables = 1209289;
1981
- var Gn = [
2158
+ fd_write: la
2159
+ }, B = await Zr(), ca = p("__getTypeName", 1), se = p("free", 1), vt = p("malloc", 1), ua = B.emscripten_stack_init;
2160
+ B.emscripten_stack_get_free;
2161
+ var pr = B.emscripten_stack_get_base, Ge = B.emscripten_stack_get_end;
2162
+ B._emscripten_stack_restore, B._emscripten_stack_alloc;
2163
+ var fa = B.emscripten_stack_get_current, pa = a.___set_stack_limits = p("__set_stack_limits", 2);
2164
+ a.dynCall_v = p("dynCall_v", 1), a.dynCall_ii = p("dynCall_ii", 2), a.dynCall_viiii = p("dynCall_viiii", 5), a.dynCall_dd = p("dynCall_dd", 2), a.dynCall_vii = p("dynCall_vii", 3), a.dynCall_iii = p("dynCall_iii", 3), a.dynCall_iiii = p("dynCall_iiii", 4), a.dynCall_iiiiii = p("dynCall_iiiiii", 6), a.dynCall_ijii = p("dynCall_ijii", 4), a.dynCall_iiiiiii = p("dynCall_iiiiiii", 7), a.dynCall_vi = p("dynCall_vi", 2), a.dynCall_iiiii = p("dynCall_iiiii", 5), a.dynCall_viiiiii = p("dynCall_viiiiii", 7), a.dynCall_viiiiij = p("dynCall_viiiiij", 7), a.dynCall_viiiii = p("dynCall_viiiii", 6), a.dynCall_viii = p("dynCall_viii", 4), a.dynCall_viiiiiiiiii = p("dynCall_viiiiiiiiii", 11), a.dynCall_viiiiiiiiiii = p("dynCall_viiiiiiiiiii", 12), a.dynCall_viiiiiii = p("dynCall_viiiiiii", 8), a.dynCall_viiiiiiiiiiiiii = p("dynCall_viiiiiiiiiiiiii", 15), a.dynCall_viiiiiiiii = p("dynCall_viiiiiiiii", 10), a.dynCall_iiiiiiiii = p("dynCall_iiiiiiiii", 9), a.dynCall_did = p("dynCall_did", 3), a.dynCall_viiiiiiii = p("dynCall_viiiiiiii", 9), a.dynCall_viifi = p("dynCall_viifi", 5), a.dynCall_diii = p("dynCall_diii", 4), a.dynCall_fiii = p("dynCall_fiii", 4), a.dynCall_viidi = p("dynCall_viidi", 5), a.dynCall_fiiiiiiiiffii = p("dynCall_fiiiiiiiiffii", 13), a.dynCall_viiif = p("dynCall_viiif", 5), a.dynCall_viiiif = p("dynCall_viiiif", 6), a.dynCall_viiiiiiifi = p("dynCall_viiiiiiifi", 10), a.dynCall_iiijiiii = p("dynCall_iiijiiii", 8), a.dynCall_viiiiiiff = p("dynCall_viiiiiiff", 9), a.dynCall_viiiff = p("dynCall_viiiff", 6), a.dynCall_viiiffi = p("dynCall_viiiffi", 7), a.dynCall_fiiii = p("dynCall_fiiii", 5), a.dynCall_iiiiiiiiiiiiiifii = p("dynCall_iiiiiiiiiiiiiifii", 17), a.dynCall_i = p("dynCall_i", 1), a.dynCall_viiiiiiiiiiii = p("dynCall_viiiiiiiiiiii", 13), a.dynCall_iiiiiiii = p("dynCall_iiiiiiii", 8), a.dynCall_viiiifiiiiiiifi = p("dynCall_viiiifiiiiiiifi", 15), a.dynCall_iiiiiiiiiiiiii = p("dynCall_iiiiiiiiiiiiii", 14), a.dynCall_viiiiiiiiiiiii = p("dynCall_viiiiiiiiiiiii", 14), a.dynCall_viiiiiiiiiiiiiiii = p("dynCall_viiiiiiiiiiiiiiii", 17), a.dynCall_viiiiiifi = p("dynCall_viiiiiifi", 9), a.dynCall_viiiifii = p("dynCall_viiiifii", 8), a.dynCall_fii = p("dynCall_fii", 3), a.dynCall_viiiffiii = p("dynCall_viiiffiii", 9), a.dynCall_viiiiiiiiiiif = p("dynCall_viiiiiiiiiiif", 13), a.dynCall_viiiiifi = p("dynCall_viiiiifi", 8), a.dynCall_fiifii = p("dynCall_fiifii", 6), a.dynCall_viiijj = p("dynCall_viiijj", 6), a.dynCall_iiiiiiidiiddii = p("dynCall_iiiiiiidiiddii", 14), a.dynCall_jij = p("dynCall_jij", 3), a.dynCall_jii = p("dynCall_jii", 3), a.dynCall_iiij = p("dynCall_iiij", 4), a.dynCall_jiji = p("dynCall_jiji", 4), a.dynCall_iiiji = p("dynCall_iiiji", 5), a.dynCall_iiijjji = p("dynCall_iiijjji", 7), a.dynCall_jiiij = p("dynCall_jiiij", 5), a.dynCall_iiiiij = p("dynCall_iiiiij", 6), a.dynCall_iiiiiij = p("dynCall_iiiiiij", 7), a.dynCall_jiiji = p("dynCall_jiiji", 5), a.dynCall_viiid = p("dynCall_viiid", 5), a.dynCall_viif = p("dynCall_viif", 4), a.dynCall_dii = p("dynCall_dii", 3), a.dynCall_viid = p("dynCall_viid", 4), a.dynCall_iiiid = p("dynCall_iiiid", 5), a.dynCall_diiii = p("dynCall_diiii", 5), a.dynCall_iidiiii = p("dynCall_iidiiii", 7);
2165
+ var va = p("asyncify_start_unwind", 1), ya = p("asyncify_stop_unwind", 0), ga = p("asyncify_start_rewind", 1), _a = p("asyncify_stop_rewind", 0);
2166
+ a._ff_h264_cabac_tables = 1209289;
2167
+ var ma = [
1982
2168
  "writeI53ToI64",
1983
2169
  "writeI53ToI64Clamped",
1984
2170
  "writeI53ToI64Signaling",
@@ -2145,8 +2331,8 @@ ${p}`, [m, p];
2145
2331
  "validateThis",
2146
2332
  "emval_get_global"
2147
2333
  ];
2148
- Gn.forEach(st);
2149
- var Jn = [
2334
+ ma.forEach(Ur);
2335
+ var ha = [
2150
2336
  "run",
2151
2337
  "addRunDependency",
2152
2338
  "removeRunDependency",
@@ -2345,202 +2531,202 @@ ${p}`, [m, p];
2345
2531
  "emval_addMethodCaller",
2346
2532
  "reflectConstruct"
2347
2533
  ];
2348
- Jn.forEach(hr);
2349
- var Xr;
2350
- function Kn() {
2351
- jn(), nt();
2534
+ ha.forEach(Lt);
2535
+ var vr;
2536
+ function ba() {
2537
+ ua(), $r();
2352
2538
  }
2353
- function ur() {
2539
+ function yt() {
2354
2540
  if (fe > 0) {
2355
- Te = ur;
2541
+ Ce = yt;
2356
2542
  return;
2357
2543
  }
2358
- if (Kn(), gt(), fe > 0) {
2359
- Te = ur;
2544
+ if (ba(), Br(), fe > 0) {
2545
+ Ce = yt;
2360
2546
  return;
2361
2547
  }
2362
2548
  function e() {
2363
- f(!Xr), Xr = !0, n.calledRun = !0, !T && (mt(), N(n), n.onRuntimeInitialized?.(), f(!n._main, 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'), ht());
2549
+ g(!vr), vr = !0, a.calledRun = !0, !N && (Hr(), M(a), a.onRuntimeInitialized?.(), g(!a._main, 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'), Vr());
2364
2550
  }
2365
- n.setStatus ? (n.setStatus("Running..."), setTimeout(() => {
2366
- setTimeout(() => n.setStatus(""), 1), e();
2367
- }, 1)) : e(), De();
2551
+ a.setStatus ? (a.setStatus("Running..."), setTimeout(() => {
2552
+ setTimeout(() => a.setStatus(""), 1), e();
2553
+ }, 1)) : e(), Le();
2368
2554
  }
2369
- if (n.preInit)
2370
- for (typeof n.preInit == "function" && (n.preInit = [n.preInit]); n.preInit.length > 0; )
2371
- n.preInit.pop()();
2372
- ur(), D = Y;
2373
- for (const e of Object.keys(n))
2374
- e in R || Object.defineProperty(R, e, {
2555
+ if (a.preInit)
2556
+ for (typeof a.preInit == "function" && (a.preInit = [a.preInit]); a.preInit.length > 0; )
2557
+ a.preInit.pop()();
2558
+ yt(), m = H;
2559
+ for (const e of Object.keys(a))
2560
+ e in b || Object.defineProperty(b, e, {
2375
2561
  configurable: !0,
2376
2562
  get() {
2377
- M(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
2563
+ L(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
2378
2564
  }
2379
2565
  });
2380
- return D;
2566
+ return m;
2381
2567
  };
2382
2568
  })();
2383
2569
  (() => {
2384
- var b = u;
2385
- u = function(R) {
2570
+ var y = f;
2571
+ f = function(b) {
2386
2572
  if (new.target) throw new Error("Module() should not be called with `new Module()`");
2387
- return b(R);
2573
+ return y(b);
2388
2574
  };
2389
- })(), c.exports = u, c.exports.default = u;
2390
- })(pa);
2391
- const _a = pr, ya = (c, _) => _a({
2392
- locateFile: (u) => `${c}${u.replace("/dist", "")}`,
2393
- print: (u) => console.log(u),
2394
- printErr: (u) => u.includes("Read error at pos") ? void 0 : console.error(u)
2575
+ })(), n.exports = f, n.exports.default = f;
2576
+ })(po);
2577
+ const vo = wt, yo = (n, c) => vo({
2578
+ locateFile: (f) => `${n}${f.replace("/dist", "")}`,
2579
+ print: (f) => console.log(f),
2580
+ printErr: (f) => f.includes("Read error at pos") ? void 0 : console.error(f)
2395
2581
  // print: (text: string) => log(false, text),
2396
2582
  // printErr: (text: string) => log(true, text),
2397
- }), _e = (c) => Array(c.size()).fill(void 0).map((_, u) => c.get(u)), ga = {
2398
- makeRemuxer: async ({ publicPath: c, length: _, bufferSize: u, log: b }) => {
2399
- const R = await ya(c), D = new R.Remuxer({ resolvedPromise: Promise.resolve(), length: _, bufferSize: u }), n = {
2400
- init: (E) => D.init(E).then((h) => {
2401
- const $ = new Uint8Array(h.data.byteLength);
2402
- return $.set(h.data), {
2403
- data: $.buffer,
2404
- videoExtradata: new Uint8Array(_e(h.videoExtradata)).buffer,
2405
- attachments: _e(h.attachments).map((I) => {
2406
- const S = new Uint8Array(R.HEAPU8.buffer, I.ptr, I.size), x = new Uint8Array(S);
2583
+ }), ye = (n) => Array(n.size()).fill(void 0).map((c, f) => n.get(f)), go = {
2584
+ makeRemuxer: async ({ publicPath: n, length: c, bufferSize: f, log: y }) => {
2585
+ const b = await yo(n), m = new b.Remuxer({ resolvedPromise: Promise.resolve(), length: c, bufferSize: f }), a = {
2586
+ init: (P) => m.init(P).then((T) => {
2587
+ const A = new Uint8Array(T.data.byteLength);
2588
+ return A.set(T.data), {
2589
+ data: A.buffer,
2590
+ videoExtradata: new Uint8Array(ye(T.videoExtradata)).buffer,
2591
+ attachments: ye(T.attachments).map((I) => {
2592
+ const $ = new Uint8Array(b.HEAPU8.buffer, I.ptr, I.size), C = new Uint8Array($);
2407
2593
  return {
2408
2594
  filename: I.filename,
2409
2595
  mimetype: I.mimetype,
2410
- data: x.buffer
2596
+ data: C.buffer
2411
2597
  };
2412
2598
  }),
2413
- subtitles: _e(h.subtitles).map((I) => {
2599
+ subtitles: ye(T.subtitles).map((I) => {
2414
2600
  if (!I.isHeader) throw new Error("Subtitle type is not header");
2415
- const { isHeader: S, data: x, ...L } = I;
2601
+ const { isHeader: $, data: C, ...W } = I;
2416
2602
  return {
2417
- ...L,
2603
+ ...W,
2418
2604
  type: "header",
2419
- content: x
2605
+ content: C
2420
2606
  };
2421
2607
  }),
2422
- indexes: _e(h.indexes).map(({ index: I, timestamp: S, pos: x }) => ({
2608
+ indexes: ye(T.indexes).map(({ index: I, timestamp: $, pos: C }) => ({
2423
2609
  index: I,
2424
- timestamp: S,
2425
- pos: x
2610
+ timestamp: $,
2611
+ pos: C
2426
2612
  })),
2427
- chapters: _e(h.chapters).map(({ index: I, start: S, end: x, title: L }) => ({
2613
+ chapters: ye(T.chapters).map(({ index: I, start: $, end: C, title: W }) => ({
2428
2614
  index: I,
2429
- start: S,
2430
- end: x,
2431
- title: L
2615
+ start: $,
2616
+ end: C,
2617
+ title: W
2432
2618
  })),
2433
2619
  info: {
2434
2620
  input: {
2435
- audioMimeType: h.info.input.audioMimeType,
2436
- duration: h.info.input.duration,
2437
- formatName: h.info.input.formatName,
2438
- mimeType: h.info.input.mimeType,
2439
- videoMimeType: h.info.input.videoMimeType
2621
+ audioMimeType: T.info.input.audioMimeType,
2622
+ duration: T.info.input.duration,
2623
+ formatName: T.info.input.formatName,
2624
+ mimeType: T.info.input.mimeType,
2625
+ videoMimeType: T.info.input.videoMimeType
2440
2626
  },
2441
2627
  output: {
2442
- audioMimeType: h.info.output.audioMimeType,
2443
- duration: h.info.output.duration,
2444
- formatName: h.info.output.formatName,
2445
- mimeType: h.info.output.mimeType,
2446
- videoMimeType: h.info.output.videoMimeType
2628
+ audioMimeType: T.info.output.audioMimeType,
2629
+ duration: T.info.output.duration,
2630
+ formatName: T.info.output.formatName,
2631
+ mimeType: T.info.output.mimeType,
2632
+ videoMimeType: T.info.output.videoMimeType
2447
2633
  }
2448
2634
  }
2449
2635
  };
2450
2636
  }),
2451
- destroy: () => D.destroy(),
2452
- seek: (E, h) => D.seek(E, h * 1e3).then(($) => {
2453
- if ($.cancelled) throw new Error("Cancelled");
2454
- const I = new Uint8Array($.data.byteLength);
2455
- return I.set(new Uint8Array($.data)), {
2637
+ destroy: () => m.destroy(),
2638
+ seek: (P, T) => m.seek(P, T * 1e3).then((A) => {
2639
+ if (A.cancelled) throw new Error("Cancelled");
2640
+ const I = new Uint8Array(A.data.byteLength);
2641
+ return I.set(new Uint8Array(A.data)), {
2456
2642
  data: I.buffer,
2457
- subtitles: _e($.subtitles).map((S) => {
2458
- if (S.isHeader) throw new Error("Subtitle type is header");
2459
- const { isHeader: x, data: L, ...T } = S;
2643
+ subtitles: ye(A.subtitles).map(($) => {
2644
+ if ($.isHeader) throw new Error("Subtitle type is header");
2645
+ const { isHeader: C, data: W, ...N } = $;
2460
2646
  return {
2461
- ...T,
2647
+ ...N,
2462
2648
  type: "dialogue",
2463
- content: L
2649
+ content: W
2464
2650
  };
2465
2651
  }),
2466
- offset: $.offset,
2467
- pts: $.pts,
2468
- duration: $.duration,
2469
- cancelled: $.cancelled,
2470
- finished: $.finished
2652
+ offset: A.offset,
2653
+ pts: A.pts,
2654
+ duration: A.duration,
2655
+ cancelled: A.cancelled,
2656
+ finished: A.finished
2471
2657
  };
2472
2658
  }),
2473
- read: (E) => D.read(E).then((h) => {
2474
- if (h.cancelled) throw new Error("Cancelled");
2475
- const $ = new Uint8Array(h.data.byteLength);
2476
- return $.set(new Uint8Array(h.data)), {
2477
- data: $.buffer,
2478
- subtitles: _e(h.subtitles).map((I) => {
2659
+ read: (P) => m.read(P).then((T) => {
2660
+ if (T.cancelled) throw new Error("Cancelled");
2661
+ const A = new Uint8Array(T.data.byteLength);
2662
+ return A.set(new Uint8Array(T.data)), {
2663
+ data: A.buffer,
2664
+ subtitles: ye(T.subtitles).map((I) => {
2479
2665
  if (I.isHeader) throw new Error("Subtitle type is header");
2480
- const { isHeader: S, data: x, ...L } = I;
2666
+ const { isHeader: $, data: C, ...W } = I;
2481
2667
  return {
2482
- ...L,
2668
+ ...W,
2483
2669
  type: "dialogue",
2484
- content: x
2670
+ content: C
2485
2671
  };
2486
2672
  }),
2487
- offset: h.offset,
2488
- pts: h.pts,
2489
- duration: h.duration,
2490
- cancelled: h.cancelled,
2491
- finished: h.finished
2673
+ offset: T.offset,
2674
+ pts: T.pts,
2675
+ duration: T.duration,
2676
+ cancelled: T.cancelled,
2677
+ finished: T.finished
2492
2678
  };
2493
2679
  }),
2494
- readKeyframe: (E, h) => D.readKeyframe(E, h).then(($) => {
2495
- if ($.cancelled) throw new Error("Cancelled");
2496
- const I = new Uint8Array($.data.byteLength);
2497
- return I.set(new Uint8Array($.data)), {
2680
+ readKeyframe: (P, T) => m.readKeyframe(P, T).then((A) => {
2681
+ if (A.cancelled) throw new Error("Cancelled");
2682
+ const I = new Uint8Array(A.data.byteLength);
2683
+ return I.set(new Uint8Array(A.data)), {
2498
2684
  data: I.buffer,
2499
- pts: $.pts,
2500
- duration: $.duration,
2501
- offset: $.offset,
2502
- cancelled: $.cancelled
2685
+ pts: A.pts,
2686
+ duration: A.duration,
2687
+ offset: A.offset,
2688
+ cancelled: A.cancelled
2503
2689
  };
2504
2690
  })
2505
- }, N = (E) => (h, $) => E(Number(h), Number($)).then(
2506
- ({ resolved: I, rejected: S }) => ({ resolved: new Uint8Array(I), rejected: S }),
2691
+ }, M = (P) => (T, A) => P(Number(T), Number(A)).then(
2692
+ ({ resolved: I, rejected: $ }) => ({ resolved: new Uint8Array(I), rejected: $ }),
2507
2693
  () => ({ resolved: new Uint8Array(0), rejected: !0 })
2508
2694
  );
2509
- let W, Y;
2510
- const z = new VideoDecoder({
2511
- output: (E) => {
2512
- W?.(E), W = void 0, Y = void 0;
2695
+ let F, H;
2696
+ const O = new VideoDecoder({
2697
+ output: (P) => {
2698
+ F?.(P), F = void 0, H = void 0;
2513
2699
  },
2514
- error: (E) => {
2515
- Y?.(E), W = void 0, Y = void 0;
2700
+ error: (P) => {
2701
+ H?.(P), F = void 0, H = void 0;
2516
2702
  }
2517
- }), ae = new OffscreenCanvas(200 * 16 / 9, 200), de = ae.getContext("2d");
2518
- if (!de) throw new Error("OffscreenCanvas not supported");
2703
+ }), j = new OffscreenCanvas(200 * 16 / 9, 200), V = j.getContext("2d");
2704
+ if (!V) throw new Error("OffscreenCanvas not supported");
2519
2705
  return {
2520
- destroy: async () => n.destroy(),
2521
- init: async (E) => {
2522
- const h = await n.init(N(E));
2523
- return z.state === "unconfigured" && z.configure({
2524
- codec: h.info.input.videoMimeType,
2525
- description: h.videoExtradata
2526
- }), h;
2706
+ destroy: async () => a.destroy(),
2707
+ init: async (P) => {
2708
+ const T = await a.init(M(P));
2709
+ return O.state === "unconfigured" && O.configure({
2710
+ codec: T.info.input.videoMimeType,
2711
+ description: T.videoExtradata
2712
+ }), T;
2527
2713
  },
2528
- seek: (E, h) => n.seek(N(E), h),
2529
- read: (E) => n.read(N(E)),
2530
- readKeyframe: async (E, h) => {
2531
- const $ = new Promise((x, L) => {
2532
- W = x, Y = L;
2533
- }), I = await n.readKeyframe(N(E), h);
2534
- z.decode(new EncodedVideoChunk({
2714
+ seek: (P, T) => a.seek(M(P), T),
2715
+ read: (P) => a.read(M(P)),
2716
+ readKeyframe: async (P, T) => {
2717
+ const A = new Promise((C, W) => {
2718
+ F = C, H = W;
2719
+ }), I = await a.readKeyframe(M(P), T);
2720
+ O.decode(new EncodedVideoChunk({
2535
2721
  type: "key",
2536
2722
  timestamp: I.pts,
2537
2723
  duration: I.duration,
2538
2724
  data: I.data
2539
- })), z.flush();
2540
- const S = await $;
2541
- return de.drawImage(S, 0, 0, 200 * 16 / 9, 200), S.close(), ae.convertToBlob().then((x) => x.arrayBuffer());
2725
+ })), O.flush();
2726
+ const $ = await A;
2727
+ return V.drawImage($, 0, 0, 200 * 16 / 9, 200), $.close(), j.convertToBlob().then((C) => C.arrayBuffer());
2542
2728
  }
2543
2729
  };
2544
2730
  }
2545
2731
  };
2546
- va(ga, { remote: globalThis, local: globalThis });
2732
+ fo(go, { transport: globalThis });