libav-wasm 0.6.2 → 0.8.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,1233 +1,2329 @@
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);
1
+ var Br = Object.defineProperty, H = (e, i) => {
2
+ let s = {};
3
+ for (var u in e) Br(s, u, {
4
+ get: e[u],
5
+ enumerable: !0
6
+ });
7
+ return Br(s, Symbol.toStringTag, { value: "Module" }), s;
8
+ }, jo = "__OSRA_KEY__", en = "__OSRA_DEFAULT_KEY__", Wo = "__OSRA_BOX__", No = () => globalThis.browser ?? globalThis.chrome, tn = () => No()?.runtime, It = (e, i) => Qo(e) && e.__OSRA_KEY__ === i, it = (e, i) => {
9
+ if (e) {
10
+ if (e.aborted) {
11
+ i();
12
+ return;
13
+ }
14
+ e.addEventListener("abort", i, { once: !0 });
14
15
  }
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());
16
+ }, Bo = ({ listener: e, transport: i, remoteName: s, key: u = en, origin: d = "*", unregisterSignal: y }) => {
17
+ if (y?.aborted) return;
18
+ let a = Gt(i) ? i.receive : i;
19
+ if (typeof a == "function") {
20
+ let S = a((M, P) => {
21
+ y?.aborted || It(M, u) && (s && M.name !== s || e(M, P));
22
+ });
23
+ typeof S == "function" && it(y, S);
24
+ return;
25
+ }
26
+ if (Ne(a) || ct(a) || Rt(a) || xt(a)) {
27
+ let S = (M, P) => {
28
+ let R = ($, T) => {
29
+ It($, u) && (s && $.name !== s || e($, {
30
+ port: P,
31
+ sender: T
32
+ }));
33
+ };
34
+ M.addListener(R), it(y, () => M.removeListener(R));
36
35
  };
37
- W.addEventListener("message", de, { once: !0 }), W.start(), b.postMessage(z, { transfer: ae });
38
- });
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();
36
+ if (Ne(a)) S(a.onMessage);
37
+ else if (Rt(a)) {
38
+ let M = (P) => S(P.onMessage, P);
39
+ a.addListener(M), it(y, () => a.removeListener(M));
40
+ } else xt(a) ? S(a) : S(a.onMessage);
41
+ return;
42
+ }
43
+ let _ = dt(a) ? a.port : a, C = d !== "*" && ye(a), E = (S) => {
44
+ let M = S.data;
45
+ if (typeof M == "string") try {
46
+ M = JSON.parse(M);
47
+ } catch {
48
+ return;
49
+ }
50
+ It(M, u) && (s && M.name !== s || C && S.origin && S.origin !== d || e(M, {
51
+ receiveTransport: a,
52
+ source: S.source,
53
+ origin: S.origin
54
+ }));
50
55
  };
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}`);
56
+ _.addEventListener("message", E), _ instanceof MessagePort && _.start(), it(y, () => _.removeEventListener("message", E));
57
+ }, Ho = (e, i, s = "*", u = []) => {
58
+ let d = Gt(e) ? e.emit : e;
59
+ if (typeof d == "function") d(i, u);
60
+ else if (ye(d)) d.postMessage(i, s, u);
61
+ else if (ct(d)) d.postMessage(i);
62
+ else if (Ne(d)) d.sendMessage(i);
63
+ else if (Vt(d)) {
64
+ let y = JSON.stringify(i);
65
+ d.readyState === WebSocket.CONNECTING ? d.addEventListener("open", () => d.send(y), { once: !0 }) : d.send(y);
66
+ } else dt(d) ? d.port.postMessage(i, u) : d.postMessage(i, u);
67
+ }, Vo = globalThis.Float16Array, at = {
68
+ Int8Array,
69
+ Uint8Array,
70
+ Uint8ClampedArray,
71
+ Int16Array,
72
+ Uint16Array,
73
+ Int32Array,
74
+ Uint32Array,
75
+ Float16Array: Vo,
76
+ Float32Array,
77
+ Float64Array,
78
+ BigInt64Array,
79
+ BigUint64Array
80
+ }, Yo = Object.values(at), zo = (e) => {
81
+ let i = e.constructor.name;
82
+ if (i in at) return i;
83
+ for (let [s, u] of Object.entries(at)) if (u && e instanceof u) return s;
84
+ throw Error("Unknown typed array type");
85
+ }, Go = (e) => {
86
+ let i = at[e];
87
+ if (!i) throw Error("Unknown typed array type");
88
+ return i;
89
+ }, Jo = (e) => Yo.some((i) => !!i && e instanceof i), Vt = (e) => e instanceof WebSocket, qo = (e) => !!globalThis.ServiceWorkerContainer && e instanceof ServiceWorkerContainer, Ko = (e) => !!globalThis.ServiceWorker && e instanceof ServiceWorker, rn = (e) => !!globalThis.Worker && e instanceof Worker, nn = (e) => {
90
+ let i = globalThis.DedicatedWorkerGlobalScope;
91
+ return !!i && e instanceof i;
92
+ }, dt = (e) => !!globalThis.SharedWorker && e instanceof SharedWorker, an = (e) => e instanceof MessagePort, Qo = (e) => !!e && typeof e == "object" && "__OSRA_KEY__" in e && !!e.__OSRA_KEY__, pe = (e, i) => {
93
+ for (let s of i) if (s && e instanceof s) return !0;
94
+ return !1;
95
+ }, Xo = (e) => pe(e, [globalThis.SharedArrayBuffer]), Zo = (e) => pe(e, [
96
+ globalThis.ArrayBuffer,
97
+ globalThis.MessagePort,
98
+ globalThis.ReadableStream,
99
+ globalThis.WritableStream,
100
+ globalThis.TransformStream,
101
+ globalThis.ImageBitmap,
102
+ globalThis.OffscreenCanvas,
103
+ globalThis.AudioData,
104
+ globalThis.VideoFrame,
105
+ globalThis.MediaSourceHandle,
106
+ globalThis.MediaStreamTrack,
107
+ globalThis.MIDIAccess,
108
+ globalThis.RTCDataChannel,
109
+ globalThis.WebTransportReceiveStream,
110
+ globalThis.WebTransportSendStream
111
+ ]), Ne = (e) => {
112
+ let i = tn();
113
+ return i ? e === i : !1;
114
+ }, ct = (e, i = !1) => !e || typeof e != "object" || ye(e) || !("name" in e) || !("disconnect" in e) || !("postMessage" in e) ? !1 : i ? "sender" in e && "onMessage" in e && "onDisconnect" in e : !0, es = (e) => !!e && typeof e == "object" && !ye(e) && "addListener" in e && "hasListener" in e && "removeListener" in e, Rt = (e) => {
115
+ let i = tn();
116
+ return i ? e === i.onConnect || e === i.onConnectExternal : !1;
117
+ }, xt = (e) => es(e), ye = (e) => {
118
+ if (!e || typeof e != "object") return !1;
119
+ try {
120
+ return "window" in e && e.window === e;
121
+ } catch {
122
+ try {
123
+ return "closed" in e && typeof e.closed == "boolean" && "close" in e && typeof e.close == "function";
124
+ } catch {
125
+ return !1;
126
+ }
65
127
  }
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();
128
+ }, on = (e) => Vt(e) || ct(e) || Ne(e), sn = (e) => Vt(e) || ct(e) || Rt(e) || xt(e) || Ne(e), ve = (e) => !!e && typeof e == "object" && !ye(e) && "isJson" in e && e.isJson === !0 || on(e) || sn(e), Yt = (e) => ye(e) || on(e) || Ko(e) || rn(e) || nn(e) || dt(e) || an(e) || dn(e), zt = (e) => ye(e) || sn(e) || qo(e) || rn(e) || nn(e) || dt(e) || an(e) || cn(e), ln = (e) => {
129
+ if (!e || typeof e != "object" || ye(e)) return !1;
130
+ let i = Object.getPrototypeOf(e);
131
+ return i === Object.prototype || i === null;
132
+ }, dn = (e) => !ln(e) || !("emit" in e) ? !1 : Yt(e.emit) || typeof e.emit == "function", cn = (e) => !ln(e) || !("receive" in e) ? !1 : zt(e.receive) || typeof e.receive == "function", Gt = (e) => dn(e) || cn(e), O = { [Wo]: "revivable" }, Jt = (e) => !!e && typeof e == "object" && "__OSRA_BOX__" in e && e.__OSRA_BOX__ === "revivable", un = (e, i) => ve(i.transport) ? { base64Buffer: new Uint8Array(e).toBase64() } : { arrayBuffer: e }, fn = (e) => "arrayBuffer" in e ? e.arrayBuffer : Uint8Array.fromBase64(e.base64Buffer).buffer, ts = /* @__PURE__ */ H({
133
+ box: () => ns,
134
+ isType: () => rs,
135
+ revive: () => is,
136
+ type: () => pn
137
+ }), pn = "arrayBuffer", rs = (e) => e instanceof ArrayBuffer, ns = (e, i) => ({
138
+ ...O,
139
+ type: pn,
140
+ ...un(e, i)
141
+ }), is = (e, i) => fn(e), as = /* @__PURE__ */ H({
142
+ box: () => ss,
143
+ isType: () => os,
144
+ revive: () => ls,
145
+ type: () => vn
146
+ }), vn = "date", os = (e) => e instanceof Date, ss = (e, i) => ({
147
+ ...O,
148
+ type: vn,
149
+ ISOString: e.toISOString()
150
+ }), ls = (e, i) => new Date(e.ISOString), ds = /* @__PURE__ */ H({
151
+ box: () => qt,
152
+ isType: () => cs,
153
+ revive: () => Kt,
154
+ type: () => yn
155
+ }), yn = "headers", cs = (e) => e instanceof Headers, qt = (e, i) => ({
156
+ ...O,
157
+ type: yn,
158
+ entries: [...e.entries()]
159
+ }), Kt = (e, i) => new Headers(e.entries), us = /* @__PURE__ */ H({
160
+ box: () => vs,
161
+ isType: () => ps,
162
+ revive: () => ys,
163
+ type: () => gn
164
+ }), gn = "error", fs = {
165
+ Error,
166
+ TypeError,
167
+ RangeError,
168
+ SyntaxError,
169
+ ReferenceError,
170
+ EvalError,
171
+ URIError
172
+ }, ps = (e) => e instanceof Error, vs = (e, i) => {
173
+ let s = "cause" in e && e.cause !== void 0, u = typeof AggregateError < "u" && e instanceof AggregateError, d = typeof DOMException < "u" && e instanceof DOMException;
174
+ return {
175
+ ...O,
176
+ type: gn,
177
+ name: e.name,
178
+ message: e.message,
179
+ stack: e.stack || e.toString(),
180
+ ...s ? { cause: G(e.cause, i) } : {},
181
+ ...u ? { errors: G(e.errors, i) } : {},
182
+ ...d ? { isDOMException: !0 } : {}
79
183
  };
80
- return c.then(R).catch(R), {
81
- [be]: !0,
82
- type: "promise",
83
- port: ye(b, _)
184
+ }, ys = (e, i) => {
185
+ let s = e.cause === void 0 ? void 0 : K(e.cause, i), u = s === void 0 ? void 0 : { cause: s };
186
+ if (e.isDOMException && typeof DOMException < "u") {
187
+ let y = new DOMException(e.message, e.name);
188
+ if (e.stack) try {
189
+ Object.defineProperty(y, "stack", {
190
+ value: e.stack,
191
+ configurable: !0
192
+ });
193
+ } catch {
194
+ }
195
+ return y;
196
+ }
197
+ let d;
198
+ if (e.errors !== void 0 && typeof AggregateError < "u") d = AggregateError(K(e.errors, i), e.message, u);
199
+ else {
200
+ let y = fs[e.name] ?? Error;
201
+ d = u === void 0 ? new y(e.message) : new y(e.message, u);
202
+ }
203
+ return e.name && d.name !== e.name && (d.name = e.name), e.stack && (d.stack = e.stack), d;
204
+ }, gs = /* @__PURE__ */ H({
205
+ box: () => _s,
206
+ isType: () => ms,
207
+ revive: () => hs,
208
+ type: () => mn
209
+ }), mn = "typedArray", ms = Jo, _s = (e, i) => {
210
+ let s = e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
211
+ return {
212
+ ...O,
213
+ type: mn,
214
+ typedArrayType: zo(e),
215
+ ...un(s, i)
84
216
  };
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,
92
- type: "function",
93
- port: ye(b, _)
217
+ }, hs = (e, i) => new (Go(e.typedArrayType))(fn(e)), ot = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakSet(), Be = (e, i) => {
218
+ if (Ut.has(e)) return i(), () => {
94
219
  };
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}`);
220
+ let s = ot.get(e);
221
+ return s || ot.set(e, s = /* @__PURE__ */ new Set()), s.add(i), () => s.delete(i);
222
+ }, _n = (e) => {
223
+ if (Ut.has(e)) return;
224
+ Ut.add(e);
225
+ let i = ot.get(e);
226
+ if (i) {
227
+ ot.delete(e);
228
+ for (let s of i) try {
229
+ s();
230
+ } catch {
231
+ }
108
232
  }
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);
233
+ }, bs = /* @__PURE__ */ H({
234
+ box: () => Ss,
235
+ isType: () => Es,
236
+ revive: () => As,
237
+ transfer: () => Cs,
238
+ type: () => hn
239
+ }), hn = "transfer", Dt = Symbol.for("osra.transfer"), bn = (e) => typeof e == "object" && !!e, Ts = (e) => bn(e) && Dt in e && e[Dt] === !0, ws = (e) => bn(e) ? ArrayBuffer.isView(e) ? !0 : pe(e, [
240
+ globalThis.ArrayBuffer,
241
+ globalThis.MessagePort,
242
+ globalThis.ReadableStream,
243
+ globalThis.WritableStream,
244
+ globalThis.TransformStream,
245
+ globalThis.ImageBitmap,
246
+ globalThis.OffscreenCanvas
247
+ ]) : !1, Cs = (e) => ws(e) ? {
248
+ [Dt]: !0,
249
+ value: e
250
+ } : e, Es = (e) => Ts(e), Ss = (e, i) => ({
251
+ ...O,
252
+ type: hn,
253
+ inner: G(e.value, i),
254
+ degraded: ve(i.transport)
255
+ }), As = (e, i) => K(e.inner, i), Fs = (e) => pe(e, [
256
+ globalThis.MessagePort,
257
+ globalThis.ReadableStream,
258
+ globalThis.WritableStream,
259
+ globalThis.TransformStream,
260
+ globalThis.OffscreenCanvas,
261
+ globalThis.MediaSourceHandle,
262
+ globalThis.MediaStreamTrack,
263
+ globalThis.MIDIAccess,
264
+ globalThis.RTCDataChannel,
265
+ globalThis.WebTransportReceiveStream,
266
+ globalThis.WebTransportSendStream
267
+ ]), Ms = (e) => Jt(e) && e.type === "transfer", He = (e) => {
268
+ let i = [], s = /* @__PURE__ */ new WeakSet(), u = (d, y) => {
269
+ if (!(!d || typeof d != "object") && !s.has(d) && (s.add(d), !Xo(d))) {
270
+ if (Ms(d)) {
271
+ u(d.inner, y || !d.degraded);
272
+ return;
273
+ }
274
+ if (Fs(d)) {
275
+ i.push(d);
276
+ return;
277
+ }
278
+ if (Zo(d)) {
279
+ y && i.push(d);
280
+ return;
281
+ }
282
+ if (!ArrayBuffer.isView(d)) {
283
+ if (Array.isArray(d)) {
284
+ for (let a of d) u(a, y);
285
+ return;
286
+ }
287
+ for (let a of Object.values(d)) u(a, y);
288
+ }
129
289
  }
130
290
  };
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;
137
- },
138
- get: (u) => _.get(u),
139
- free: (u) => {
140
- _.delete(u), c.free(u);
291
+ return u(e, !1), i;
292
+ }, be = class {
293
+ _listeners = /* @__PURE__ */ new Map();
294
+ _onceListeners = /* @__PURE__ */ new WeakSet();
295
+ addEventListener(e, i, s) {
296
+ if (!i) return;
297
+ let u = this._listeners.get(e);
298
+ u || (u = /* @__PURE__ */ new Set(), this._listeners.set(e, u)), u.add(i), typeof s == "object" && s?.once && this._onceListeners.add(i);
299
+ }
300
+ removeEventListener(e, i, s) {
301
+ i && (this._listeners.get(e)?.delete(i), this._onceListeners.delete(i));
302
+ }
303
+ _peer;
304
+ _queue = [];
305
+ _started = !1;
306
+ _closed = !1;
307
+ _onClose;
308
+ _onmessage = null;
309
+ get onmessage() {
310
+ return this._onmessage;
311
+ }
312
+ set onmessage(e) {
313
+ this._onmessage = e, e !== null && this.start();
314
+ }
315
+ onmessageerror = null;
316
+ dispatchEvent(e) {
317
+ e.type === "message" ? this._onmessage?.call(this, e) : e.type === "messageerror" && this.onmessageerror?.call(this, e);
318
+ let i = this._listeners.get(e.type);
319
+ if (i) for (let s of [...i]) this._onceListeners.has(s) && (i.delete(s), this._onceListeners.delete(s)), typeof s == "function" ? s.call(this, e) : s.handleEvent(e);
320
+ return !0;
321
+ }
322
+ postMessage(e, i) {
323
+ let s = this._peer;
324
+ !s || s._closed || queueMicrotask(() => {
325
+ if (s._closed) return;
326
+ let u = new MessageEvent("message", { data: e });
327
+ s._started ? s.dispatchEvent(u) : s._queue.push(u);
328
+ });
329
+ }
330
+ start() {
331
+ if (!this._started) {
332
+ this._started = !0;
333
+ for (let e of this._queue.splice(0)) this.dispatchEvent(e);
141
334
  }
335
+ }
336
+ close() {
337
+ if (this._closed) return;
338
+ this._closed = !0, this._queue.length = 0, this._onClose?.();
339
+ let e = this._peer;
340
+ e && !e._closed && queueMicrotask(() => {
341
+ e._closed || e.dispatchEvent(new Event("close"));
342
+ });
343
+ }
344
+ }, ut = class {
345
+ port1;
346
+ port2;
347
+ constructor() {
348
+ let e = new be(), i = new be();
349
+ e._peer = i, i._peer = e, this.port1 = e, this.port2 = i;
350
+ }
351
+ }, Hr = new FinalizationRegistry((e) => {
352
+ try {
353
+ e();
354
+ } catch {
355
+ }
356
+ }), Qt = (e, i) => {
357
+ let s = {};
358
+ return Hr.register(e, i, s), () => Hr.unregister(s);
359
+ }, ks = /* @__PURE__ */ H({
360
+ box: () => lt,
361
+ createRevivableChannel: () => Ve,
362
+ init: () => Is,
363
+ isType: () => Ps,
364
+ revive: () => Me,
365
+ type: () => Ot
366
+ }), Ot = "messagePort", Tn = /* @__PURE__ */ new WeakMap(), wn = (e) => {
367
+ let i = Tn.get(e);
368
+ if (!i) throw Error("osra message-port: connection state missing; did init() run?");
369
+ return i;
370
+ }, Is = (e) => {
371
+ let i = { portHandlers: /* @__PURE__ */ new Map() };
372
+ Tn.set(e, i), e.eventTarget.addEventListener("message", ({ detail: s }) => {
373
+ s.type !== "message" && s.type !== "message-port-close" || i.portHandlers.get(s.portId)?.(s);
374
+ }), Be(e, () => {
375
+ for (let [s, u] of [...i.portHandlers]) u({
376
+ type: "message-port-close",
377
+ remoteUuid: e.remoteUuid,
378
+ portId: s
379
+ });
380
+ i.portHandlers.clear();
381
+ });
382
+ }, Ps = (e) => e instanceof MessagePort || e instanceof be, st = (e, i) => {
383
+ try {
384
+ e.sendMessage({
385
+ type: "message-port-close",
386
+ remoteUuid: e.remoteUuid,
387
+ portId: i
388
+ });
389
+ } catch {
390
+ }
391
+ }, Cn = (e, i, s) => {
392
+ s ? e.postMessage(i) : e.postMessage(i, He(i));
393
+ }, lt = (e, i, s) => {
394
+ let u = e instanceof be;
395
+ if (!u && !ve(i.transport)) return {
396
+ ...O,
397
+ type: Ot,
398
+ port: e,
399
+ ...s?.autoBox ? { autoBox: !0 } : {}
142
400
  };
143
- }, va = async (c, {
144
- remote: _,
145
- local: u,
146
- key: b = ta,
147
- origin: R = "*"
148
- }) => {
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();
401
+ let { portHandlers: d } = wn(i), y = e, a = globalThis.crypto.randomUUID(), _ = new WeakRef(y), C = new WeakRef(i), E = new WeakRef(d), S = !1, M = () => {
402
+ if (S) return;
403
+ S = !0, E.deref()?.delete(a), $?.();
404
+ let T = _.deref();
405
+ T?.removeEventListener("message", R), T instanceof be && (T._onClose = void 0);
406
+ }, P = (T) => {
407
+ if (T.type === "message-port-close") {
408
+ M(), y.dispatchEvent(new Event("close")), y.close();
409
+ return;
410
+ }
411
+ Cn(y, K(T.data, i), !1);
412
+ };
413
+ function R({ data: T }) {
414
+ i.sendMessage({
415
+ type: "message",
416
+ remoteUuid: i.remoteUuid,
417
+ data: G(T, i),
418
+ portId: a
161
419
  });
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.");
420
+ }
421
+ let $ = Qt(y, () => {
422
+ let T = C.deref();
423
+ T && st(T, a), M();
424
+ });
425
+ return y.addEventListener("message", R), y.start(), y instanceof be && (y._onClose = () => {
426
+ S || (st(i, a), M());
427
+ }), d.set(a, P), {
428
+ ...O,
429
+ type: Ot,
430
+ portId: a,
431
+ synthetic: u
432
+ };
433
+ }, Me = (e, i) => "port" in e ? e.autoBox ? En(e.port, i) : e.port : $s(e.portId, i, e.synthetic), En = (e, i) => {
434
+ let s = new EventTarget(), u = ({ data: y }) => {
435
+ s.dispatchEvent(new MessageEvent("message", { data: K(y, i) }));
436
+ }, d = () => {
437
+ s.dispatchEvent(new Event("close"));
438
+ };
439
+ return e.addEventListener("message", u), e.addEventListener("close", d), s.postMessage = (y, a) => {
440
+ let _ = G(y, i), C = He(_), E = Array.isArray(a) ? a : [];
441
+ e.postMessage(_, E.length ? [...C, ...E] : C);
442
+ }, s.start = () => e.start(), s.close = () => {
443
+ e.removeEventListener("message", u), e.removeEventListener("close", d), e.close();
444
+ }, s;
445
+ }, Ve = (e) => {
446
+ if (ve(e.transport)) {
447
+ let { port1: u, port2: d } = new ut();
186
448
  return {
187
- addIncomingProxiedMessagePort: ae,
188
- addOutgoingProxiedMessagePort: de,
189
- envCheck: n,
190
- finalizationRegistry: N
449
+ localPort: u,
450
+ boxedRemote: lt(d, e)
191
451
  };
452
+ }
453
+ let { port1: i, port2: s } = new MessageChannel();
454
+ return {
455
+ localPort: En(i, e),
456
+ boxedRemote: lt(s, e, { autoBox: !0 })
192
457
  };
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(
199
- {
200
- [Re]: !0,
201
- key: b,
202
- type: "ready",
203
- envCheck: { buffer: T, port: O }
204
- },
205
- [T, O]
206
- );
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
- );
458
+ }, $s = (e, i, s) => {
459
+ let { portHandlers: u } = wn(i), { port1: d, port2: y } = s ? new ut() : new MessageChannel(), a = new WeakRef(d), _ = new WeakRef(y), C = !1, E = () => {
460
+ if (C) return;
461
+ C = !0, u.delete(e);
462
+ let R = _.deref();
463
+ R?.removeEventListener("message", M), R?.close(), P?.();
464
+ }, S = (R) => {
465
+ if (R.type === "message-port-close") {
466
+ E();
467
+ let T = a.deref();
468
+ T?.dispatchEvent(new Event("close")), T?.close();
228
469
  return;
229
470
  }
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
- );
471
+ if (!a.deref()) {
472
+ E();
238
473
  return;
239
474
  }
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);
475
+ let $ = _.deref();
476
+ $ && Cn($, K(R.data, i), s);
477
+ }, M = ({ data: R }) => {
478
+ i.sendMessage({
479
+ type: "message",
480
+ remoteUuid: i.remoteUuid,
481
+ data: G(R, i),
482
+ portId: e
483
+ });
484
+ }, P = Qt(d, () => {
485
+ st(i, e), E();
486
+ });
487
+ return d instanceof be && (d._onClose = () => {
488
+ C || (st(i, e), E());
489
+ }), y.addEventListener("message", M), y.start(), u.set(e, S), d;
490
+ }, Rs = /* @__PURE__ */ H({
491
+ box: () => An,
492
+ isType: () => Us,
493
+ revive: () => Fn,
494
+ type: () => Sn
495
+ }), Sn = "promise", xs = (e) => e instanceof Promise, Vr = /* @__PURE__ */ new Set(), Us = (e) => e instanceof Promise, An = (e, i) => {
496
+ if (!xs(e)) throw TypeError("Expected Promise");
497
+ let { localPort: s, boxedRemote: u } = Ve(i), d = (y) => {
498
+ s.postMessage(y), s.close();
499
+ };
500
+ return e.then((y) => d({
501
+ type: "resolve",
502
+ data: y
503
+ })).catch((y) => d({
504
+ type: "reject",
505
+ error: y
506
+ })), {
507
+ ...O,
508
+ type: Sn,
509
+ port: u
510
+ };
511
+ }, Fn = (e, i) => {
512
+ let s = Me(e.port, i);
513
+ Vr.add(s);
514
+ let u = "portId" in e.port;
515
+ return new Promise((d, y) => {
516
+ let a = () => {
517
+ s.close(), Vr.delete(s), _();
518
+ }, _ = u ? Be(i, () => {
519
+ y(/* @__PURE__ */ Error("osra: connection closed")), a();
520
+ }) : () => {
521
+ };
522
+ s.addEventListener("message", ({ data: C }) => {
523
+ C.type === "resolve" ? d(C.data) : y(C.error), a();
524
+ }, { once: !0 }), s.start();
525
+ });
526
+ }, Ds = /* @__PURE__ */ H({
527
+ box: () => Te,
528
+ isType: () => Os,
529
+ revive: () => we,
530
+ type: () => Mn
531
+ }), Mn = "function", Yr = /* @__PURE__ */ new Set(), Os = (e) => typeof e == "function", Te = (e, i) => {
532
+ let { port1: s, port2: u } = new ut();
533
+ return s.addEventListener("message", ({ data: d }) => {
534
+ let [y, a] = d;
535
+ (async () => {
536
+ let _;
537
+ try {
538
+ _ = {
539
+ type: "return",
540
+ value: await e(...a)
541
+ };
542
+ } catch (E) {
543
+ _ = {
544
+ type: "throw",
545
+ error: E
546
+ };
256
547
  }
548
+ let C = G(_, i);
549
+ y.postMessage(C, He(C)), queueMicrotask(() => {
550
+ try {
551
+ y.close();
552
+ } catch {
553
+ }
554
+ });
555
+ })();
556
+ }), s.start(), {
557
+ ...O,
558
+ type: Mn,
559
+ port: lt(u, i)
560
+ };
561
+ }, we = (e, i) => {
562
+ let s = Me(e.port, i);
563
+ return (...u) => new Promise((d, y) => {
564
+ let { port1: a, port2: _ } = new ut();
565
+ Yr.add(a);
566
+ let C = () => {
567
+ a.close(), Yr.delete(a), E();
568
+ }, E = Be(i, () => {
569
+ y(/* @__PURE__ */ Error("osra: connection closed")), C();
570
+ });
571
+ a.addEventListener("message", ({ data: M }) => {
572
+ let P = M;
573
+ P.type === "return" ? d(P.value) : y(P.error), C();
574
+ }, { once: !0 }), a.start();
575
+ let S = G([_, u], i);
576
+ s.postMessage(S, He(S));
577
+ });
578
+ }, Ls = /* @__PURE__ */ H({
579
+ box: () => Xt,
580
+ isType: () => js,
581
+ revive: () => Zt,
582
+ type: () => kn
583
+ }), kn = "readableStream", js = (e) => e instanceof ReadableStream, Xt = (e, i) => {
584
+ let { localPort: s, boxedRemote: u } = Ve(i), d = e.getReader();
585
+ return s.addEventListener("message", ({ data: y }) => {
586
+ "type" in y && y.type === "pull" ? s.postMessage(d.read()) : (d.cancel("type" in y ? y.reason : void 0).catch(() => {
587
+ }), s.close());
588
+ }), s.addEventListener("close", () => {
589
+ d.cancel(/* @__PURE__ */ Error("osra: connection closed")).catch(() => {
590
+ });
591
+ }, { once: !0 }), s.start(), {
592
+ ...O,
593
+ type: kn,
594
+ port: u
595
+ };
596
+ }, Zt = (e, i) => {
597
+ let s = Me(e.port, i);
598
+ s.start();
599
+ let u = !1;
600
+ return new ReadableStream({
601
+ start: (d) => {
602
+ s.addEventListener("close", () => {
603
+ if (!u) {
604
+ u = !0;
605
+ try {
606
+ d.error(/* @__PURE__ */ Error("osra: connection closed"));
607
+ } catch {
608
+ }
609
+ }
610
+ }, { once: !0 });
611
+ },
612
+ pull: (d) => new Promise((y, a) => {
613
+ s.addEventListener("message", ({ data: _ }) => {
614
+ _ instanceof Promise && _.then((C) => {
615
+ C.done ? (u = !0, d.close(), s.postMessage({ type: "cancel" }), queueMicrotask(() => s.close())) : d.enqueue(C.value), y();
616
+ }).catch((C) => {
617
+ u = !0, a(C);
618
+ });
619
+ }, { once: !0 }), s.postMessage({ type: "pull" });
620
+ }),
621
+ cancel: (d) => {
622
+ u = !0, s.postMessage({
623
+ type: "cancel",
624
+ reason: d
625
+ }), queueMicrotask(() => s.close());
257
626
  }
258
- }, L = typeof _ == "function" ? _ : (T, O = []) => _.postMessage(T, { targetOrigin: R, transfer: O });
259
- return typeof u == "function" ? u(x) : u.addEventListener("message", x), I(), $;
260
- };
261
- var pr = {}, pa = {
627
+ });
628
+ }, Ws = /* @__PURE__ */ H({
629
+ box: () => Bs,
630
+ isType: () => Ns,
631
+ revive: () => Hs,
632
+ type: () => In
633
+ }), In = "writableStream", Ns = (e) => e instanceof WritableStream, Bs = (e, i) => {
634
+ let { localPort: s, boxedRemote: u } = Ve(i), d = e.getWriter(), y = !1, a = (_, C) => _.then(() => s.postMessage({ type: "ack" })).catch((E) => s.postMessage({
635
+ type: "err",
636
+ error: E?.message ?? String(E)
637
+ })).then(() => {
638
+ C && (y = !0, queueMicrotask(() => s.close()));
639
+ });
640
+ return s.addEventListener("message", ({ data: _ }) => {
641
+ !_ || typeof _ != "object" || !("type" in _) || (_.type === "write" ? a(d.write(_.chunk), !1) : _.type === "close" ? a(d.close(), !0) : _.type === "abort" && a(d.abort(_.reason), !0));
642
+ }), s.addEventListener("close", () => {
643
+ y || (y = !0, d.abort(/* @__PURE__ */ Error("osra: connection closed")).catch(() => {
644
+ }));
645
+ }, { once: !0 }), s.start(), {
646
+ ...O,
647
+ type: In,
648
+ port: u
649
+ };
650
+ }, Hs = (e, i) => {
651
+ let s = Me(e.port, i);
652
+ s.start();
653
+ let u = /* @__PURE__ */ new Set(), d = !1;
654
+ s.addEventListener("close", () => {
655
+ d = !0;
656
+ let _ = /* @__PURE__ */ Error("osra: connection closed");
657
+ for (let C of [...u]) C(_);
658
+ u.clear();
659
+ }, { once: !0 });
660
+ let y = Promise.resolve(), a = (_) => {
661
+ let C = y.then(() => new Promise((E, S) => {
662
+ if (d) {
663
+ S(/* @__PURE__ */ Error("osra: connection closed"));
664
+ return;
665
+ }
666
+ let M = (P) => {
667
+ u.delete(S), P();
668
+ };
669
+ u.add(S), s.addEventListener("message", ({ data: P }) => {
670
+ !P || typeof P != "object" || !("type" in P) || (P.type === "ack" ? M(E) : P.type === "err" && M(() => S(Error(P.error))));
671
+ }, { once: !0 }), s.postMessage(_);
672
+ }));
673
+ return y = C.catch(() => {
674
+ }), C;
675
+ };
676
+ return new WritableStream({
677
+ write: (_) => a({
678
+ type: "write",
679
+ chunk: _
680
+ }),
681
+ close: () => a({ type: "close" }),
682
+ abort: (_) => a({
683
+ type: "abort",
684
+ reason: _
685
+ })
686
+ });
687
+ }, Vs = /* @__PURE__ */ H({
688
+ box: () => Pn,
689
+ isType: () => Ys,
690
+ revive: () => $n,
691
+ type: () => Lt
692
+ }), Lt = "abortSignal", Ys = (e) => e instanceof AbortSignal, zr = /* @__PURE__ */ new WeakMap(), Pn = (e, i) => {
693
+ if (e.aborted) return {
694
+ ...O,
695
+ type: Lt,
696
+ aborted: !0,
697
+ reason: G(e.reason, i)
698
+ };
699
+ let { localPort: s, boxedRemote: u } = Ve(i), d = () => {
700
+ s.postMessage({
701
+ type: "abort",
702
+ reason: e.reason
703
+ }), s.close(), y();
704
+ }, y = Be(i, () => {
705
+ e.removeEventListener("abort", d), s.close();
706
+ });
707
+ return e.addEventListener("abort", d, { once: !0 }), {
708
+ ...O,
709
+ type: Lt,
710
+ aborted: !1,
711
+ reason: void 0,
712
+ port: u
713
+ };
714
+ }, $n = (e, i) => {
715
+ let s = new AbortController();
716
+ if (e.aborted || e.port === void 0) return s.abort(K(e.reason, i)), s.signal;
717
+ let u = Me(e.port, i);
718
+ return zr.set(s.signal, u), u.start(), u.addEventListener("message", ({ data: d }) => {
719
+ d.type === "abort" && (s.abort(K(d.reason, i)), zr.delete(s.signal), u.close());
720
+ }), s.signal;
721
+ }, zs = /* @__PURE__ */ H({
722
+ box: () => Js,
723
+ isType: () => Gs,
724
+ revive: () => qs,
725
+ type: () => Rn
726
+ }), Rn = "response", Gs = (e) => e instanceof Response, Js = (e, i) => ({
727
+ ...O,
728
+ type: Rn,
729
+ status: e.status,
730
+ statusText: e.statusText,
731
+ headers: qt(e.headers),
732
+ body: e.body ? Xt(e.body, i) : null,
733
+ url: e.url,
734
+ redirected: e.redirected
735
+ }), qs = (e, i) => {
736
+ if (e.status === 0) return Response.error();
737
+ let s = Kt(e.headers), u = e.body ? Zt(e.body, i) : null, d = new Response(u, {
738
+ status: e.status,
739
+ statusText: e.statusText,
740
+ headers: s
741
+ });
742
+ return e.url && Object.defineProperty(d, "url", {
743
+ value: e.url,
744
+ configurable: !0
745
+ }), e.redirected && Object.defineProperty(d, "redirected", {
746
+ value: !0,
747
+ configurable: !0
748
+ }), d;
749
+ }, Ks = /* @__PURE__ */ H({
750
+ box: () => Xs,
751
+ isType: () => Qs,
752
+ revive: () => Zs,
753
+ type: () => xn
754
+ }), xn = "request", Qs = (e) => e instanceof Request, Xs = (e, i) => ({
755
+ ...O,
756
+ type: xn,
757
+ method: e.method,
758
+ url: e.url,
759
+ headers: qt(e.headers),
760
+ body: e.body ? Xt(e.body, i) : null,
761
+ credentials: e.credentials,
762
+ cache: e.cache,
763
+ mode: e.mode,
764
+ redirect: e.redirect,
765
+ referrer: e.referrer,
766
+ referrerPolicy: e.referrerPolicy,
767
+ integrity: e.integrity,
768
+ keepalive: e.keepalive,
769
+ signal: Pn(e.signal, i)
770
+ }), Zs = (e, i) => {
771
+ let s = Kt(e.headers), u = {
772
+ method: e.method,
773
+ headers: s,
774
+ credentials: e.credentials,
775
+ cache: e.cache,
776
+ redirect: e.redirect,
777
+ referrer: e.referrer,
778
+ referrerPolicy: e.referrerPolicy,
779
+ integrity: e.integrity,
780
+ keepalive: e.keepalive,
781
+ signal: $n(e.signal, i)
782
+ };
783
+ return e.mode !== "navigate" && (u.mode = e.mode), e.body && (u.body = Zt(e.body, i), u.duplex = "half"), new Request(e.url, u);
784
+ }, el = /* @__PURE__ */ H({
785
+ box: () => il,
786
+ boxByReference: () => Ln,
787
+ identity: () => Wt,
788
+ isType: () => nl,
789
+ revive: () => al,
790
+ type: () => Fe
791
+ }), Fe = "identity", jt = Symbol.for("osra.identity"), Un = (e) => e !== null && (typeof e == "object" || typeof e == "function"), er = (e) => {
792
+ if (e === null) return !1;
793
+ let i = typeof e;
794
+ return i === "object" || i === "function" ? !0 : i === "symbol" ? Symbol.keyFor(e) === void 0 : !1;
795
+ }, Dn = (e) => Un(e) && jt in e && e[jt] === !0, Gr = /* @__PURE__ */ new WeakMap(), tl = (e) => {
796
+ if (Dn(e)) return e;
797
+ let i = Gr.get(e);
798
+ if (i) return i;
799
+ let s = {
800
+ [jt]: !0,
801
+ value: e
802
+ };
803
+ return Gr.set(e, s), s;
804
+ }, Wt = (e) => Un(e) ? tl(e) : e, Jr = /* @__PURE__ */ new WeakMap(), tr = (e) => {
805
+ let i = Jr.get(e);
806
+ if (i) return i;
807
+ let s = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new WeakMap(), a = {
808
+ sendIds: s,
809
+ idToSent: u,
810
+ sendRegistry: new FinalizationRegistry((_) => {
811
+ u.delete(_);
812
+ try {
813
+ e.sendMessage({
814
+ type: "identity-dispose",
815
+ remoteUuid: e.remoteUuid,
816
+ id: _
817
+ });
818
+ } catch {
819
+ }
820
+ }),
821
+ receiveCache: d,
822
+ revivedToId: y,
823
+ listenerInstalled: !1
824
+ };
825
+ return Jr.set(e, a), rl(e, a), Be(e, () => {
826
+ a.receiveCache.clear(), a.idToSent.clear();
827
+ }), a;
828
+ }, rl = (e, i) => {
829
+ i.listenerInstalled || (i.listenerInstalled = !0, e.eventTarget.addEventListener("message", ({ detail: s }) => {
830
+ if (s?.type !== "identity-dispose") return;
831
+ let u = i.receiveCache.get(s.id);
832
+ i.receiveCache.delete(s.id), u !== void 0 && er(u) && i.revivedToId.delete(u);
833
+ }));
834
+ }, nl = (e) => Dn(e), On = (e, i) => {
835
+ let s = i.sendIds.get(e);
836
+ if (s !== void 0) return {
837
+ id: s,
838
+ isExisting: !0
839
+ };
840
+ let u = i.revivedToId.get(e);
841
+ if (u !== void 0) return {
842
+ id: u,
843
+ isExisting: !0
844
+ };
845
+ let d = globalThis.crypto.randomUUID();
846
+ return i.sendIds.set(e, d), i.idToSent.set(d, new WeakRef(e)), i.sendRegistry.register(e, d), {
847
+ id: d,
848
+ isExisting: !1
849
+ };
850
+ }, il = (e, i) => {
851
+ let s = tr(i), u = e.value, d = G(u, i);
852
+ if (!er(u)) return {
853
+ ...O,
854
+ type: Fe,
855
+ id: globalThis.crypto.randomUUID(),
856
+ inner: d
857
+ };
858
+ let { id: y, isExisting: a } = On(u, s);
859
+ return a ? {
860
+ ...O,
861
+ type: Fe,
862
+ id: y
863
+ } : {
864
+ ...O,
865
+ type: Fe,
866
+ id: y,
867
+ inner: d
868
+ };
869
+ }, Ln = (e, i, s) => {
870
+ let { id: u, isExisting: d } = On(e, tr(s));
871
+ return d ? {
872
+ ...O,
873
+ type: Fe,
874
+ id: u
875
+ } : {
876
+ ...O,
877
+ type: Fe,
878
+ id: u,
879
+ inner: i
880
+ };
881
+ }, al = (e, i) => {
882
+ let s = tr(i), u = s.receiveCache.get(e.id);
883
+ if (u !== void 0) return u;
884
+ let d = s.idToSent.get(e.id)?.deref();
885
+ if (d !== void 0) return d;
886
+ if (!("inner" in e) || e.inner === void 0) throw Error(`osra identity: received id=${e.id} with no inner payload and no cached value`);
887
+ let y = K(e.inner, i);
888
+ return s.receiveCache.set(e.id, y), er(y) && s.revivedToId.set(y, e.id), y;
889
+ }, ol = /* @__PURE__ */ H({
890
+ box: () => ll,
891
+ isType: () => sl,
892
+ revive: () => dl,
893
+ type: () => "map"
894
+ }), sl = (e) => e instanceof Map, ll = (e, i) => ({
895
+ ...O,
896
+ type: "map",
897
+ entries: Array.from(e, ([s, u]) => [G(s, i), G(u, i)])
898
+ }), dl = (e, i) => new Map(e.entries.map(([s, u]) => [K(s, i), K(u, i)])), cl = /* @__PURE__ */ H({
899
+ box: () => fl,
900
+ isType: () => ul,
901
+ revive: () => pl,
902
+ type: () => "set"
903
+ }), ul = (e) => e instanceof Set, fl = (e, i) => ({
904
+ ...O,
905
+ type: "set",
906
+ values: Array.from(e, (s) => G(s, i))
907
+ }), pl = (e, i) => new Set(e.values.map((s) => K(s, i))), vl = /* @__PURE__ */ H({
908
+ box: () => gl,
909
+ isType: () => yl,
910
+ revive: () => ml,
911
+ type: () => jn
912
+ }), jn = "bigint", yl = (e) => typeof e == "bigint", gl = (e, i) => ({
913
+ ...O,
914
+ type: jn,
915
+ value: e.toString()
916
+ }), ml = (e, i) => BigInt(e.value), _l = /* @__PURE__ */ H({
917
+ box: () => bl,
918
+ isType: () => hl,
919
+ revive: () => Tl,
920
+ type: () => Wn
921
+ }), Wn = "event", hl = (e) => e instanceof Event, bl = (e, i) => ({
922
+ ...O,
923
+ type: Wn,
924
+ eventType: e.type,
925
+ bubbles: e.bubbles,
926
+ cancelable: e.cancelable,
927
+ composed: e.composed,
928
+ ...e instanceof CustomEvent ? { detail: G(e.detail, i) } : {}
929
+ }), Tl = (e, i) => {
930
+ let s = {
931
+ bubbles: e.bubbles,
932
+ cancelable: e.cancelable,
933
+ composed: e.composed
934
+ };
935
+ return "detail" in e ? new CustomEvent(e.eventType, {
936
+ ...s,
937
+ detail: K(e.detail, i)
938
+ }) : new Event(e.eventType, s);
939
+ }, wl = /* @__PURE__ */ H({
940
+ box: () => El,
941
+ isType: () => Cl,
942
+ revive: () => Sl,
943
+ type: () => Nn
944
+ }), Nn = "eventTarget", Cl = (e) => e instanceof EventTarget, El = (e, i) => {
945
+ let s = [], u = (d) => typeof d == "boolean" ? d : !!d?.capture;
946
+ return {
947
+ ...O,
948
+ type: Nn,
949
+ addListener: Te((d, y, a) => {
950
+ s.push({
951
+ eventType: d,
952
+ listener: y,
953
+ capture: u(a)
954
+ }), e.addEventListener(d, y, a);
955
+ }, i),
956
+ removeListener: Te((d, y, a) => {
957
+ let _ = u(a), C = s.findIndex((E) => E.eventType === d && E.listener === y && E.capture === _);
958
+ C !== -1 && s.splice(C, 1), e.removeEventListener(d, y, a);
959
+ }, i),
960
+ removeAllListeners: Te(() => {
961
+ for (let { eventType: d, listener: y, capture: a } of s.splice(0)) e.removeEventListener(d, y, { capture: a });
962
+ }, i)
963
+ };
964
+ }, qr = /* @__PURE__ */ new WeakMap(), Kr = (e) => {
965
+ if (typeof e == "function") return e;
966
+ let i = qr.get(e);
967
+ return i || qr.set(e, i = (s) => e.handleEvent(s)), i;
968
+ }, Qr = (e, i, s, u) => e.find((d) => d.eventType === i && d.listener === s && d.capture === u), Sl = (e, i) => {
969
+ let s = we(e.addListener, i), u = we(e.removeListener, i), d = we(e.removeAllListeners, i), y = new EventTarget(), a = [], _ = (C) => {
970
+ let E = a.indexOf(C);
971
+ E !== -1 && a.splice(E, 1);
972
+ };
973
+ return Object.defineProperty(y, "addEventListener", { value: (C, E, S) => {
974
+ if (E === null) return;
975
+ let M = Kr(E), P = typeof S == "boolean" ? S : !!S?.capture;
976
+ if (Qr(a, C, M, P)) return;
977
+ let R = typeof S == "object" && S?.once ? (T) => (_($), M(T)) : M, $ = {
978
+ eventType: C,
979
+ listener: M,
980
+ capture: P,
981
+ wire: R
982
+ };
983
+ a.push($), (typeof S == "object" ? S?.signal : void 0)?.addEventListener("abort", () => _($), { once: !0 }), s(C, Wt(R), S).catch(() => {
984
+ });
985
+ } }), Object.defineProperty(y, "removeEventListener", { value: (C, E, S) => {
986
+ if (E === null) return;
987
+ let M = Kr(E), P = typeof S == "boolean" ? S : !!S?.capture, R = Qr(a, C, M, P);
988
+ R && (_(R), u(C, Wt(R.wire), { capture: P }).catch(() => {
989
+ }));
990
+ } }), Qt(y, () => {
991
+ d().catch(() => {
992
+ });
993
+ }), y;
994
+ }, Al = /* @__PURE__ */ H({
995
+ box: () => kl,
996
+ isType: () => Fl,
997
+ revive: () => Il,
998
+ type: () => Bn
999
+ }), Bn = "blob", Fl = (e) => e instanceof Blob, Ml = (e) => typeof File < "u" && e instanceof File, kl = (e, i) => ({
1000
+ ...O,
1001
+ type: Bn,
1002
+ mimeType: e.type,
1003
+ buffer: An(e.arrayBuffer(), i),
1004
+ ...Ml(e) ? {
1005
+ fileName: e.name,
1006
+ lastModified: e.lastModified
1007
+ } : {}
1008
+ }), Il = (e, i) => Fn(e.buffer, i).then((s) => e.fileName !== void 0 && typeof File < "u" ? new File([s], e.fileName, {
1009
+ type: e.mimeType,
1010
+ lastModified: e.lastModified
1011
+ }) : new Blob([s], { type: e.mimeType })), Pl = /* @__PURE__ */ H({
1012
+ box: () => Rl,
1013
+ isType: () => $l,
1014
+ revive: () => xl,
1015
+ type: () => Nt
1016
+ }), Nt = "symbol", $l = (e) => typeof e == "symbol", Rl = (e, i) => {
1017
+ let s = Symbol.keyFor(e);
1018
+ return s === void 0 ? Ln(e, {
1019
+ ...O,
1020
+ type: Nt,
1021
+ description: e.description
1022
+ }, i) : {
1023
+ ...O,
1024
+ type: Nt,
1025
+ registryKey: s
1026
+ };
1027
+ }, xl = (e, i) => "registryKey" in e ? Symbol.for(e.registryKey) : Symbol(e.description), Ul = /* @__PURE__ */ H({
1028
+ box: () => Ol,
1029
+ isType: () => Dl,
1030
+ revive: () => Ll,
1031
+ type: () => Hn
1032
+ }), Hn = "asyncIterator", Dl = (e) => !e || typeof e != "object" || typeof ReadableStream < "u" && e instanceof ReadableStream ? !1 : typeof e[Symbol.asyncIterator] == "function", Ol = (e, i) => {
1033
+ let s = e[Symbol.asyncIterator]();
1034
+ return {
1035
+ ...O,
1036
+ type: Hn,
1037
+ next: Te((u) => s.next(u), i),
1038
+ return: Te((u) => s.return?.(u) ?? Promise.resolve({
1039
+ done: !0,
1040
+ value: u
1041
+ }), i),
1042
+ throw: Te((u) => s.throw?.(u) ?? Promise.reject(u), i)
1043
+ };
1044
+ }, Ll = (e, i) => {
1045
+ let s = we(e.next, i), u = we(e.return, i), d = we(e.throw, i), y = {
1046
+ next: (...a) => s(...a),
1047
+ return: (a) => u(a),
1048
+ throw: (a) => d(a),
1049
+ [Symbol.asyncIterator]: () => y
1050
+ };
1051
+ return y;
1052
+ }, jl = [
1053
+ globalThis.File,
1054
+ globalThis.FileList,
1055
+ globalThis.RegExp,
1056
+ globalThis.DataView,
1057
+ globalThis.ImageData,
1058
+ globalThis.FormData,
1059
+ globalThis.DOMException,
1060
+ globalThis.DOMMatrix,
1061
+ globalThis.DOMMatrixReadOnly,
1062
+ globalThis.DOMPoint,
1063
+ globalThis.DOMPointReadOnly,
1064
+ globalThis.DOMQuad,
1065
+ globalThis.DOMRect,
1066
+ globalThis.DOMRectReadOnly,
1067
+ globalThis.CryptoKey,
1068
+ globalThis.FileSystemHandle,
1069
+ globalThis.FileSystemFileHandle,
1070
+ globalThis.FileSystemDirectoryHandle,
1071
+ globalThis.RTCCertificate
1072
+ ], Wl = [
1073
+ globalThis.CropTarget,
1074
+ globalThis.EncodedAudioChunk,
1075
+ globalThis.EncodedVideoChunk,
1076
+ globalThis.FencedFrameConfig,
1077
+ globalThis.GPUCompilationInfo,
1078
+ globalThis.GPUCompilationMessage,
1079
+ globalThis.GPUPipelineError,
1080
+ globalThis.RTCEncodedAudioFrame,
1081
+ globalThis.RTCEncodedVideoFrame,
1082
+ globalThis.WebTransportError
1083
+ ], Nl = {
1084
+ type: "clonable",
1085
+ capableOnly: !0,
1086
+ isType: (e) => pe(e, jl) || pe(e, Wl),
1087
+ box: (e, i) => e,
1088
+ revive: (e, i) => e
1089
+ }, Bl = [
1090
+ globalThis.ImageBitmap,
1091
+ globalThis.OffscreenCanvas,
1092
+ globalThis.WritableStream,
1093
+ globalThis.TransformStream,
1094
+ globalThis.MediaStreamTrack,
1095
+ globalThis.RTCDataChannel
1096
+ ], Hl = [
1097
+ globalThis.AudioData,
1098
+ globalThis.VideoFrame,
1099
+ globalThis.MediaSourceHandle,
1100
+ globalThis.MIDIAccess,
1101
+ globalThis.WebTransportReceiveStream,
1102
+ globalThis.WebTransportSendStream
1103
+ ], Vl = {
1104
+ type: "transferable",
1105
+ capableOnly: !0,
1106
+ isType: (e) => pe(e, Bl) || pe(e, Hl),
1107
+ box: (e, i) => e,
1108
+ revive: (e, i) => e
1109
+ }, Yl = (e) => {
1110
+ if (typeof e != "object" || !e) return !1;
1111
+ let i = Object.getPrototypeOf(e);
1112
+ return i === Object.prototype || i === null;
1113
+ }, Xr = [
1114
+ bs,
1115
+ el,
1116
+ ts,
1117
+ as,
1118
+ ds,
1119
+ us,
1120
+ gs,
1121
+ Al,
1122
+ Rs,
1123
+ Ds,
1124
+ ks,
1125
+ Ls,
1126
+ Ws,
1127
+ Vs,
1128
+ zs,
1129
+ Ks,
1130
+ ol,
1131
+ cl,
1132
+ vl,
1133
+ Pl,
1134
+ _l,
1135
+ Ul,
1136
+ {
1137
+ type: "nonFiniteNumber",
1138
+ isType: (e) => typeof e == "number" && !Number.isFinite(e),
1139
+ box: (e, i) => ve(i.transport) ? {
1140
+ ...O,
1141
+ type: "nonFiniteNumber",
1142
+ value: String(e)
1143
+ } : e,
1144
+ revive: (e, i) => Number(e.value)
1145
+ },
1146
+ {
1147
+ type: "undefined",
1148
+ isType: (e) => e === void 0,
1149
+ box: (e, i) => ve(i.transport) ? {
1150
+ ...O,
1151
+ type: "undefined"
1152
+ } : e,
1153
+ revive: (e, i) => {
1154
+ }
1155
+ },
1156
+ Nl,
1157
+ Vl,
1158
+ wl,
1159
+ {
1160
+ type: "unclonable",
1161
+ isType: (e) => {
1162
+ if (typeof e != "object" || !e || Array.isArray(e) || Yl(e)) return !1;
1163
+ try {
1164
+ return structuredClone(e), !1;
1165
+ } catch {
1166
+ return !0;
1167
+ }
1168
+ },
1169
+ box: (e, i) => ({
1170
+ ...O,
1171
+ type: "unclonable"
1172
+ }),
1173
+ revive: (e, i) => ({})
1174
+ }
1175
+ ], zl = (e, i) => i.find((s) => s.isType(e)), Gl = (e, i) => i.find((s) => s.type === e.type), Jl = (e) => !!e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype, Vn = (e, i) => Array.isArray(e) ? e.map((s) => i(s)) : Jl(e) ? Object.fromEntries(Object.entries(e).map(([s, u]) => [s, i(u)])) : e, Pt = /* @__PURE__ */ new WeakSet(), $t = /* @__PURE__ */ new WeakSet(), Yn = (e) => e !== null && (typeof e == "object" || typeof e == "function"), G = (e, i) => {
1176
+ if (Jt(e)) return e;
1177
+ let s = Yn(e);
1178
+ if (s) {
1179
+ if (Pt.has(e)) throw TypeError("osra: cannot serialize a circular structure - break the cycle or send the container by reference");
1180
+ Pt.add(e);
1181
+ }
1182
+ try {
1183
+ let u = zl(e, i.revivableModules);
1184
+ return u ? u.box(e, i) : Vn(e, (d) => G(d, i));
1185
+ } finally {
1186
+ s && Pt.delete(e);
1187
+ }
1188
+ }, K = (e, i) => {
1189
+ let s = Yn(e);
1190
+ if (s) {
1191
+ if ($t.has(e)) throw TypeError("osra: cannot revive a circular structure");
1192
+ $t.add(e);
1193
+ }
1194
+ try {
1195
+ if (Jt(e)) {
1196
+ let u = Gl(e, i.revivableModules);
1197
+ if (u) return u.revive(e, i);
1198
+ }
1199
+ return Vn(e, (u) => K(u, i));
1200
+ } finally {
1201
+ s && $t.delete(e);
1202
+ }
1203
+ }, ql = /* @__PURE__ */ H({
1204
+ init: () => Ql,
1205
+ startBidirectionalConnection: () => Bt,
1206
+ type: () => Kl
1207
+ }), Kl = "bidirectional", Bt = ({ transport: e, value: i, remoteUuid: s, eventTarget: u, send: d, revivableModules: y }) => {
1208
+ let a = {
1209
+ transport: e,
1210
+ remoteUuid: s,
1211
+ sendMessage: d,
1212
+ eventTarget: u,
1213
+ revivableModules: y
1214
+ };
1215
+ for (let E of y) E.init?.(a);
1216
+ let { promise: _, resolve: C } = Promise.withResolvers();
1217
+ return u.addEventListener("message", function E({ detail: S }) {
1218
+ S.type === "init" && (C(S.data), u.removeEventListener("message", E));
1219
+ }), d({
1220
+ type: "init",
1221
+ remoteUuid: s,
1222
+ data: G(i, a)
1223
+ }), {
1224
+ revivableContext: a,
1225
+ remoteValue: _.then((E) => K(E, a))
1226
+ };
1227
+ }, Ql = (e) => {
1228
+ if (!(Yt(e.transport) && zt(e.transport))) return;
1229
+ if (e.protocolEventTarget.addEventListener("message", ({ detail: d }) => {
1230
+ if (d.type === "announce") {
1231
+ if (!d.remoteUuid) {
1232
+ e.sendMessage({
1233
+ type: "announce",
1234
+ remoteUuid: d.uuid
1235
+ });
1236
+ return;
1237
+ }
1238
+ if (d.remoteUuid !== e.getUuid() || e.connectionContexts.has(d.uuid)) return;
1239
+ e.sendMessage({
1240
+ type: "announce",
1241
+ remoteUuid: d.uuid
1242
+ });
1243
+ let a = e.createConnectionEventTarget(), _;
1244
+ try {
1245
+ _ = Bt({
1246
+ transport: e.transport,
1247
+ value: e.value,
1248
+ remoteUuid: d.uuid,
1249
+ eventTarget: a,
1250
+ send: (E) => e.sendMessage(E),
1251
+ revivableModules: e.revivableModules
1252
+ });
1253
+ } catch (E) {
1254
+ e.rejectRemoteValue(E);
1255
+ return;
1256
+ }
1257
+ let C = {
1258
+ type: "bidirectional",
1259
+ eventTarget: a,
1260
+ connection: _
1261
+ };
1262
+ e.connectionContexts.set(d.uuid, C), C.connection.remoteValue.then((E) => e.resolveRemoteValue(E), (E) => e.rejectRemoteValue(E));
1263
+ return;
1264
+ }
1265
+ if (d.type === "close") {
1266
+ if (d.remoteUuid !== e.getUuid()) return;
1267
+ let a = e.connectionContexts.get(d.uuid);
1268
+ if (!a) return;
1269
+ e.connectionContexts.delete(d.uuid), _n(a.connection.revivableContext), e.rejectRemoteValue(/* @__PURE__ */ Error("osra: peer closed the connection"));
1270
+ return;
1271
+ }
1272
+ if (d.remoteUuid !== e.getUuid()) return;
1273
+ let y = e.connectionContexts.get(d.uuid);
1274
+ y && y.eventTarget.dispatchEvent(new CustomEvent("message", { detail: d }));
1275
+ }), e.presetRemoteUuid !== void 0) {
1276
+ let d = e.createConnectionEventTarget(), y;
1277
+ try {
1278
+ y = Bt({
1279
+ transport: e.transport,
1280
+ value: e.value,
1281
+ remoteUuid: e.presetRemoteUuid,
1282
+ eventTarget: d,
1283
+ send: (_) => e.sendMessage(_),
1284
+ revivableModules: e.revivableModules
1285
+ });
1286
+ } catch (_) {
1287
+ e.rejectRemoteValue(_);
1288
+ return;
1289
+ }
1290
+ let a = {
1291
+ type: "bidirectional",
1292
+ eventTarget: d,
1293
+ connection: y
1294
+ };
1295
+ e.connectionContexts.set(e.presetRemoteUuid, a), a.connection.remoteValue.then((_) => e.resolveRemoteValue(_), (_) => e.rejectRemoteValue(_));
1296
+ return;
1297
+ }
1298
+ let i = 50, s, u = () => {
1299
+ e.unregisterSignal?.aborted || e.connectionContexts.size > 0 || (e.sendMessage({ type: "announce" }), s = setTimeout(u, i), i = Math.min(i * 2, 1e3));
1300
+ };
1301
+ e.unregisterSignal?.addEventListener("abort", () => clearTimeout(s), { once: !0 }), u();
1302
+ }, Zr = () => new EventTarget(), Xl = (e) => {
1303
+ let i = Gt(e), s = i ? e.emit : e, u = i ? e.receive : e;
1304
+ return {
1305
+ isJson: i && "isJson" in e && e.isJson !== void 0 ? e.isJson : s !== void 0 && ve(s) || u !== void 0 && ve(u),
1306
+ ...s === void 0 ? {} : { emit: s },
1307
+ ...u === void 0 ? {} : { receive: u }
1308
+ };
1309
+ }, Zl = (e) => e ? e(Xr) : Xr, ed = [ql], td = (e, { transport: i, name: s, remoteName: u, key: d = en, origin: y = "*", unregisterSignal: a, revivableModules: _, uuid: C, remoteUuid: E }) => {
1310
+ let S = Xl(i);
1311
+ if (!(Yt(S) && zt(S))) throw Error("osra: transport must be able to both emit and receive to establish a connection; pass a bidirectional platform transport or a custom { emit, receive } pair");
1312
+ let M = Zl(_), P = /* @__PURE__ */ new Map(), { promise: R, resolve: $, reject: T } = Promise.withResolvers();
1313
+ R.catch(() => {
1314
+ });
1315
+ let U = C ?? globalThis.crypto.randomUUID(), F = (Q) => {
1316
+ let h = {
1317
+ [jo]: d,
1318
+ name: s,
1319
+ uuid: U,
1320
+ ...Q
1321
+ };
1322
+ Ho(S, h, y, He(h));
1323
+ }, B = (Q) => {
1324
+ a?.aborted || F(Q);
1325
+ }, N = Zr(), Y = {
1326
+ transport: S,
1327
+ value: e,
1328
+ revivableModules: M,
1329
+ connectionContexts: P,
1330
+ getUuid: () => U,
1331
+ presetRemoteUuid: E,
1332
+ sendMessage: B,
1333
+ protocolEventTarget: N,
1334
+ resolveRemoteValue: $,
1335
+ rejectRemoteValue: T,
1336
+ createConnectionEventTarget: Zr,
1337
+ unregisterSignal: a
1338
+ };
1339
+ Bo({
1340
+ listener: (Q, h) => {
1341
+ Q.uuid !== U && N.dispatchEvent(new CustomEvent("message", { detail: Q }));
1342
+ },
1343
+ transport: S,
1344
+ remoteName: u,
1345
+ key: d,
1346
+ origin: y,
1347
+ unregisterSignal: a
1348
+ }), a?.addEventListener("abort", () => {
1349
+ for (let [Q, h] of P) F({
1350
+ type: "close",
1351
+ remoteUuid: Q
1352
+ }), _n(h.connection.revivableContext);
1353
+ P.clear(), T(a.reason);
1354
+ }, { once: !0 });
1355
+ for (let Q of ed) Q.init(Y);
1356
+ return R;
1357
+ }, rd = async (e, i) => td(e, i), Ht = {}, nd = {
262
1358
  get exports() {
263
- return pr;
1359
+ return Ht;
264
1360
  },
265
- set exports(c) {
266
- pr = c;
1361
+ set exports(e) {
1362
+ Ht = e;
267
1363
  }
268
1364
  };
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) => {
1365
+ (function(e, i) {
1366
+ var s = (() => {
1367
+ var u = typeof document < "u" ? document.currentScript?.src : void 0;
1368
+ return async function(d = {}) {
1369
+ var y, a = d, _, C, E = new Promise((t, r) => {
1370
+ _ = t, C = r;
1371
+ }), S = Object.assign({}, a), M = "./this.program", P = (t, r) => {
276
1372
  throw r;
277
- }, E = "";
278
- function h(e) {
279
- return n.locateFile ? n.locateFile(e, E) : E + e;
1373
+ }, R = "";
1374
+ function $(t) {
1375
+ return a.locateFile ? a.locateFile(t, R) : R + t;
280
1376
  }
281
- var $;
1377
+ var T;
282
1378
  {
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" });
1379
+ if (typeof document < "u" && document.currentScript && (R = document.currentScript.src), u && (R = u), R.startsWith("blob:") ? R = "" : R = R.slice(0, R.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?)");
1380
+ T = async (t) => {
1381
+ h(!ar(t), "readAsync does not work with file:// URLs");
1382
+ var r = await fetch(t, { credentials: "same-origin" });
287
1383
  if (r.ok)
288
1384
  return r.arrayBuffer();
289
1385
  throw new Error(r.status + " : " + r.url);
290
1386
  };
291
1387
  }
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 : ""));
299
- }
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);
304
- }
305
- function De() {
306
- if (!T) {
307
- var e = Ye();
308
- 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)!");
1388
+ var U = a.print || console.log.bind(console), F = a.printErr || console.error.bind(console);
1389
+ Object.assign(a, S), S = null, Ao(), a.arguments && a.arguments, ge("arguments", "arguments_"), a.thisProgram && (M = a.thisProgram), ge("thisProgram", "thisProgram"), h(typeof a.memoryInitializerPrefixURL > "u", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), h(typeof a.pthreadMainPrefixURL > "u", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), h(typeof a.cdInitializerPrefixURL > "u", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), h(typeof a.filePackagePrefixURL > "u", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), h(typeof a.read > "u", "Module.read option was removed"), h(typeof a.readAsync > "u", "Module.readAsync option was removed (modify readAsync in JS)"), h(typeof a.readBinary > "u", "Module.readBinary option was removed (modify readBinary in JS)"), h(typeof a.setWindowTitle > "u", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"), h(typeof a.TOTAL_MEMORY > "u", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"), ge("asm", "wasmExports"), ge("readAsync", "readAsync"), ge("readBinary", "readBinary"), ge("setWindowTitle", "setWindowTitle"), h(!0, "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."), h(!0, "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."), h(!0, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
1390
+ var B = a.wasmBinary;
1391
+ ge("wasmBinary", "wasmBinary"), typeof WebAssembly != "object" && F("no native wasm support detected");
1392
+ var N, Y = !1, Q;
1393
+ function h(t, r) {
1394
+ t || W("Assertion failed" + (r ? ": " + r : ""));
1395
+ }
1396
+ var oe, ee, Ce, Ye, k, x, rr, ke, nr, ir, ft = !1, ar = (t) => t.startsWith("file://");
1397
+ function zn() {
1398
+ var t = nt();
1399
+ h((t & 3) == 0), t == 0 && (t += 4), x[t >> 2] = 34821223, I(34821223), x[t + 4 >> 2] = 2310721022, I(2310721022), x[0] = 1668509029, I(1668509029);
1400
+ }
1401
+ function ze() {
1402
+ if (!Y) {
1403
+ var t = nt();
1404
+ t == 0 && (t += 4);
1405
+ var r = x[t >> 2], n = x[t + 4 >> 2];
1406
+ (r != 34821223 || n != 2310721022) && W(`Stack overflow! Stack cookie has been overwritten at ${de(t)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${de(n)} ${de(r)}`), x[0] != 1668509029 && W("Runtime error: The application has corrupted its heap memory area (address zero)!");
311
1407
  }
312
1408
  }
313
1409
  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)
1410
+ var t = new Int16Array(1), r = new Int8Array(t.buffer);
1411
+ if (t[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)";
1412
+ })(), a.ENVIRONMENT)
317
1413
  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, {
1414
+ function ge(t, r, n = !0) {
1415
+ Object.getOwnPropertyDescriptor(a, t) || Object.defineProperty(a, t, {
320
1416
  configurable: !0,
321
1417
  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);
1418
+ let o = n ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : "";
1419
+ W(`\`Module.${t}\` has been replaced by \`${r}\`` + o);
324
1420
  }
325
1421
  });
326
1422
  }
327
- function at(e) {
328
- Object.getOwnPropertyDescriptor(n, e) && M(`\`Module.${e}\` was supplied but \`${e}\` not included in INCOMING_MODULE_JS_API`);
1423
+ function Gn(t) {
1424
+ Object.getOwnPropertyDescriptor(a, t) && W(`\`Module.${t}\` was supplied but \`${t}\` not included in INCOMING_MODULE_JS_API`);
329
1425
  }
330
- function ot(e) {
331
- 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
- e === "FS_createLazyFile" || e === "FS_createDevice" || e === "removeRunDependency";
1426
+ function Jn(t) {
1427
+ return t === "FS_createPath" || t === "FS_createDataFile" || t === "FS_createPreloadedFile" || t === "FS_unlink" || t === "addRunDependency" || // The old FS has some functionality that WasmFS lacks.
1428
+ t === "FS_createLazyFile" || t === "FS_createDevice" || t === "removeRunDependency";
333
1429
  }
334
- function st(e) {
335
- hr(e);
1430
+ function qn(t) {
1431
+ or(t);
336
1432
  }
337
- function hr(e) {
338
- Object.getOwnPropertyDescriptor(n, e) || Object.defineProperty(n, e, {
1433
+ function or(t) {
1434
+ Object.getOwnPropertyDescriptor(a, t) || Object.defineProperty(a, t, {
339
1435
  configurable: !0,
340
1436
  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);
1437
+ var r = `'${t}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
1438
+ Jn(t) && (r += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), W(r);
343
1439
  }
344
1440
  });
345
1441
  }
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`);
1442
+ var Kn = 2 ** 8 - 1, Qn = 2 ** 16 - 1, Xn = 2 ** 32 - 1, Zn = 2 ** 64 - 1, ei = -128, ti = -32768, ri = -2147483648, ni = -9223372036854776e3;
1443
+ function Ge(t, r, n, o) {
1444
+ h(Number.isInteger(Number(t)), `attempt to write non-integer (${t}) into integer heap`), h(t <= o, `value (${t}) too large to write as ${r}-bit value`), h(t >= n, `value (${t}) too small to write as ${r}-bit value`);
349
1445
  }
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) {
352
- console.warn(...e);
1446
+ var Ie = (t) => Ge(t, 8, ei, Kn), pt = (t) => Ge(t, 16, ti, Qn), I = (t) => Ge(t, 32, ri, Xn), vt = (t) => Ge(t, 64, ni, Zn);
1447
+ function ii(...t) {
1448
+ console.warn(...t);
353
1449
  }
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);
1450
+ function sr() {
1451
+ var t = N.buffer;
1452
+ a.HEAP8 = oe = new Int8Array(t), a.HEAP16 = Ce = new Int16Array(t), a.HEAPU8 = ee = new Uint8Array(t), a.HEAPU16 = Ye = new Uint16Array(t), a.HEAP32 = k = new Int32Array(t), a.HEAPU32 = x = new Uint32Array(t), a.HEAPF32 = rr = new Float32Array(t), a.HEAPF64 = ir = new Float64Array(t), a.HEAP64 = ke = new BigInt64Array(t), a.HEAPU64 = nr = new BigUint64Array(t);
357
1453
  }
358
- f(!n.STACK_SIZE, "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"), f(
1454
+ h(!a.STACK_SIZE, "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"), h(
359
1455
  typeof Int32Array < "u" && typeof Float64Array < "u" && Int32Array.prototype.subarray != null && Int32Array.prototype.set != null,
360
1456
  "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);
367
- }
368
- function mt() {
369
- f(!Ke), Ke = !0, De(), Mt(), V.__wasm_call_ctors();
370
- }
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);
376
- }
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;
1457
+ ), h(!a.wasmMemory, "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"), h(!a.INITIAL_MEMORY, "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");
1458
+ function ai() {
1459
+ if (a.preRun)
1460
+ for (typeof a.preRun == "function" && (a.preRun = [a.preRun]); a.preRun.length; )
1461
+ hi(a.preRun.shift());
1462
+ lr(cr);
1463
+ }
1464
+ function oi() {
1465
+ h(!ft), ft = !0, ze(), bi(), z.__wasm_call_ctors();
1466
+ }
1467
+ function si() {
1468
+ if (ze(), a.postRun)
1469
+ for (typeof a.postRun == "function" && (a.postRun = [a.postRun]); a.postRun.length; )
1470
+ _i(a.postRun.shift());
1471
+ lr(dr);
1472
+ }
1473
+ var me = 0, Pe = null, $e = {}, _e = null;
1474
+ function li(t) {
1475
+ me++, a.monitorRunDependencies?.(me), h(!$e[t]), $e[t] = 1, _e === null && typeof setInterval < "u" && (_e = setInterval(() => {
1476
+ if (Y) {
1477
+ clearInterval(_e), _e = null;
382
1478
  return;
383
1479
  }
384
1480
  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)");
1481
+ for (var n in $e)
1482
+ r || (r = !0, F("still waiting on run dependencies:")), F(`dependency: ${n}`);
1483
+ r && F("(end of list)");
388
1484
  }, 1e4));
389
1485
  }
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();
1486
+ function di(t) {
1487
+ if (me--, a.monitorRunDependencies?.(me), h($e[t]), delete $e[t], me == 0 && (_e !== null && (clearInterval(_e), _e = null), Pe)) {
1488
+ var r = Pe;
1489
+ Pe = null, r();
394
1490
  }
395
1491
  }
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;
1492
+ function W(t) {
1493
+ a.onAbort?.(t), t = "Aborted(" + t + ")", F(t), Y = !0, t.indexOf("RuntimeError: unreachable") >= 0 && (t += '. "unreachable" may be due to ASYNCIFY_STACK_SIZE not being large enough (try increasing it)');
1494
+ var r = new WebAssembly.RuntimeError(t);
1495
+ throw C(r), r;
400
1496
  }
401
- var Z = {
1497
+ var ne = {
402
1498
  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");
1499
+ W("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
1500
  },
405
1501
  init() {
406
- Z.error();
1502
+ ne.error();
407
1503
  },
408
1504
  createDataFile() {
409
- Z.error();
1505
+ ne.error();
410
1506
  },
411
1507
  createPreloadedFile() {
412
- Z.error();
1508
+ ne.error();
413
1509
  },
414
1510
  createLazyFile() {
415
- Z.error();
1511
+ ne.error();
416
1512
  },
417
1513
  open() {
418
- Z.error();
1514
+ ne.error();
419
1515
  },
420
1516
  mkdev() {
421
- Z.error();
1517
+ ne.error();
422
1518
  },
423
1519
  registerDevice() {
424
- Z.error();
1520
+ ne.error();
425
1521
  },
426
1522
  analyzePath() {
427
- Z.error();
1523
+ ne.error();
428
1524
  },
429
1525
  ErrnoError() {
430
- Z.error();
1526
+ ne.error();
431
1527
  }
432
1528
  };
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);
1529
+ a.FS_createDataFile = ne.createDataFile, a.FS_createPreloadedFile = ne.createPreloadedFile;
1530
+ function g(t, r) {
1531
+ return (...n) => {
1532
+ h(ft, `native function \`${t}\` called before runtime initialization`);
1533
+ var o = z[t];
1534
+ return h(o, `exported native function \`${t}\` not found`), h(n.length <= r, `native function \`${t}\` called with ${n.length} args but expects ${r}`), o(...n);
439
1535
  };
440
1536
  }
441
- var Se;
442
- function Ct() {
443
- return h("libav.wasm");
1537
+ var Re;
1538
+ function ci() {
1539
+ return $("libav.wasm");
444
1540
  }
445
- function Tt(e) {
446
- if (e == Se && x)
447
- return new Uint8Array(x);
1541
+ function ui(t) {
1542
+ if (t == Re && B)
1543
+ return new Uint8Array(B);
448
1544
  throw "both async and sync fetching of the wasm failed";
449
1545
  }
450
- async function Et(e) {
451
- if (!x)
1546
+ async function fi(t) {
1547
+ if (!B)
452
1548
  try {
453
- var r = await $(e);
1549
+ var r = await T(t);
454
1550
  return new Uint8Array(r);
455
1551
  } catch {
456
1552
  }
457
- return Tt(e);
1553
+ return ui(t);
458
1554
  }
459
- async function St(e, r) {
1555
+ async function pi(t, r) {
460
1556
  try {
461
- var t = await Et(e), i = await WebAssembly.instantiate(t, r);
462
- 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);
1557
+ var n = await fi(t), o = await WebAssembly.instantiate(n, r);
1558
+ return o;
1559
+ } catch (l) {
1560
+ F(`failed to asynchronously prepare wasm: ${l}`), ar(Re) && F(`warning: Loading from a file URI (${Re}) 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`), W(l);
465
1561
  }
466
1562
  }
467
- async function Ft(e, r, t) {
468
- if (!e && typeof WebAssembly.instantiateStreaming == "function")
1563
+ async function vi(t, r, n) {
1564
+ if (!t && typeof WebAssembly.instantiateStreaming == "function")
469
1565
  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");
1566
+ var o = fetch(r, { credentials: "same-origin" }), l = await WebAssembly.instantiateStreaming(o, n);
1567
+ return l;
1568
+ } catch (f) {
1569
+ F(`wasm streaming compile failed: ${f}`), F("falling back to ArrayBuffer instantiation");
474
1570
  }
475
- return St(r, t);
1571
+ return pi(r, n);
476
1572
  }
477
- function At() {
478
- return g.instrumentWasmImports(dr), {
479
- env: dr,
480
- wasi_snapshot_preview1: dr
1573
+ function yi() {
1574
+ return w.instrumentWasmImports(At), {
1575
+ env: At,
1576
+ wasi_snapshot_preview1: At
481
1577
  };
482
1578
  }
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;
1579
+ async function gi() {
1580
+ function t(p, c) {
1581
+ return z = p.exports, z = w.instrumentWasmExports(z), N = z.memory, h(N, "memory not found in wasm exports"), sr(), wr = z.__indirect_function_table, h(wr, "table not found in wasm exports"), di("wasm-instantiate"), z;
486
1582
  }
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);
1583
+ li("wasm-instantiate");
1584
+ var r = a;
1585
+ function n(p) {
1586
+ return h(a === r, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"), r = null, t(p.instance);
491
1587
  }
492
- var i = At();
493
- if (n.instantiateWasm)
494
- return new Promise((l, o) => {
1588
+ var o = yi();
1589
+ if (a.instantiateWasm)
1590
+ return new Promise((p, c) => {
495
1591
  try {
496
- n.instantiateWasm(i, (d, p) => {
497
- e(d, p), l(d.exports);
1592
+ a.instantiateWasm(o, (v, m) => {
1593
+ t(v, m), p(v.exports);
498
1594
  });
499
- } catch (d) {
500
- S(`Module.instantiateWasm callback failed with error: ${d}`), o(d);
1595
+ } catch (v) {
1596
+ F(`Module.instantiateWasm callback failed with error: ${v}`), c(v);
501
1597
  }
502
1598
  });
503
- Se ??= Ct();
1599
+ Re ??= ci();
504
1600
  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);
1601
+ var l = await vi(B, Re, o), f = n(l);
1602
+ return f;
1603
+ } catch (p) {
1604
+ return C(p), Promise.reject(p);
509
1605
  }
510
1606
  }
511
- class Pt {
1607
+ class mi {
512
1608
  name = "ExitStatus";
513
1609
  constructor(r) {
514
1610
  this.message = `Program terminated with exit(${r})`, this.status = r;
515
1611
  }
516
1612
  }
517
- var wr = (e) => {
518
- 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);
1613
+ var lr = (t) => {
1614
+ for (; t.length > 0; )
1615
+ t.shift()(a);
1616
+ }, dr = [], _i = (t) => dr.unshift(t), cr = [], hi = (t) => cr.unshift(t);
1617
+ a.noExitRuntime;
1618
+ var de = (t) => (h(typeof t == "number"), t >>>= 0, "0x" + t.toString(16).padStart(8, "0")), bi = () => {
1619
+ var t = Or(), r = nt();
1620
+ Io(t, r);
1621
+ }, xe = (t) => {
1622
+ xe.shown ||= {}, xe.shown[t] || (xe.shown[t] = 1, F(t));
1623
+ }, ur = typeof TextDecoder < "u" ? new TextDecoder() : void 0, fr = (t, r = 0, n = NaN) => {
1624
+ for (var o = r + n, l = r; t[l] && !(l >= o); ) ++l;
1625
+ if (l - r > 16 && t.buffer && ur)
1626
+ return ur.decode(t.subarray(r, l));
1627
+ for (var f = ""; r < l; ) {
1628
+ var p = t[r++];
1629
+ if (!(p & 128)) {
1630
+ f += String.fromCharCode(p);
535
1631
  continue;
536
1632
  }
537
- var o = e[r++] & 63;
538
- if ((l & 224) == 192) {
539
- s += String.fromCharCode((l & 31) << 6 | o);
1633
+ var c = t[r++] & 63;
1634
+ if ((p & 224) == 192) {
1635
+ f += String.fromCharCode((p & 31) << 6 | c);
540
1636
  continue;
541
1637
  }
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);
1638
+ var v = t[r++] & 63;
1639
+ if ((p & 240) == 224 ? p = (p & 15) << 12 | c << 6 | v : ((p & 248) != 240 && xe("Invalid UTF-8 leading byte " + de(p) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"), p = (p & 7) << 18 | c << 12 | v << 6 | t[r++] & 63), p < 65536)
1640
+ f += String.fromCharCode(p);
545
1641
  else {
546
- var p = l - 65536;
547
- s += String.fromCharCode(55296 | p >> 10, 56320 | p & 1023);
1642
+ var m = p - 65536;
1643
+ f += String.fromCharCode(55296 | m >> 10, 56320 | m & 1023);
548
1644
  }
549
1645
  }
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 {
1646
+ return f;
1647
+ }, Je = (t, r) => (h(typeof t == "number", `UTF8ToString expects a number (got ${typeof t})`), t ? fr(ee, t, r) : ""), Ti = (t, r, n, o) => W(`Assertion failed: ${Je(t)}, at: ` + [r ? Je(r) : "unknown filename", n, o ? Je(o) : "unknown function"]);
1648
+ class wi {
553
1649
  // excPtr - Thrown object pointer to wrap. Metadata pointer is calculated from it.
554
1650
  constructor(r) {
555
1651
  this.excPtr = r, this.ptr = r - 24;
556
1652
  }
557
1653
  set_type(r) {
558
- F[this.ptr + 4 >> 2] = r;
1654
+ x[this.ptr + 4 >> 2] = r;
559
1655
  }
560
1656
  get_type() {
561
- return F[this.ptr + 4 >> 2];
1657
+ return x[this.ptr + 4 >> 2];
562
1658
  }
563
1659
  set_destructor(r) {
564
- F[this.ptr + 8 >> 2] = r;
1660
+ x[this.ptr + 8 >> 2] = r;
565
1661
  }
566
1662
  get_destructor() {
567
- return F[this.ptr + 8 >> 2];
1663
+ return x[this.ptr + 8 >> 2];
568
1664
  }
569
1665
  set_caught(r) {
570
- r = r ? 1 : 0, j[this.ptr + 12] = r, Ce(r);
1666
+ r = r ? 1 : 0, oe[this.ptr + 12] = r, Ie(r);
571
1667
  }
572
1668
  get_caught() {
573
- return j[this.ptr + 12] != 0;
1669
+ return oe[this.ptr + 12] != 0;
574
1670
  }
575
1671
  set_rethrown(r) {
576
- r = r ? 1 : 0, j[this.ptr + 13] = r, Ce(r);
1672
+ r = r ? 1 : 0, oe[this.ptr + 13] = r, Ie(r);
577
1673
  }
578
1674
  get_rethrown() {
579
- return j[this.ptr + 13] != 0;
1675
+ return oe[this.ptr + 13] != 0;
580
1676
  }
581
1677
  // 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);
1678
+ init(r, n) {
1679
+ this.set_adjusted_ptr(0), this.set_type(r), this.set_destructor(n);
584
1680
  }
585
1681
  set_adjusted_ptr(r) {
586
- F[this.ptr + 16 >> 2] = r;
1682
+ x[this.ptr + 16 >> 2] = r;
587
1683
  }
588
1684
  get_adjusted_ptr() {
589
- return F[this.ptr + 16 >> 2];
1685
+ return x[this.ptr + 16 >> 2];
590
1686
  }
591
1687
  }
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");
1688
+ var Ci = (t, r, n) => {
1689
+ var o = new wi(t);
1690
+ o.init(r, n), h(!1, "Exception thrown, but exception catching is not enabled. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch.");
1691
+ }, Ei = (t) => {
1692
+ var r = Or(), n = nt();
1693
+ W(`stack overflow (Attempt to set SP to ${de(t)}, with stack limits [${de(n)} - ${de(r)}]). If you require more stack space build with -sSTACK_SIZE=<bytes>`);
1694
+ }, Si = (t, r, n, o) => {
1695
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
600
1696
  };
601
- function Lt(e, r, t) {
1697
+ function Ai(t, r, n) {
602
1698
  return 0;
603
1699
  }
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))
1700
+ var Fi = (t, r) => {
1701
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1702
+ }, Mi = (t, r, n, o) => {
1703
+ if (h(typeof t == "string", `stringToUTF8Array expects a string (got ${typeof t})`), !(o > 0))
608
1704
  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;
1705
+ for (var l = n, f = n + o - 1, p = 0; p < t.length; ++p) {
1706
+ var c = t.charCodeAt(p);
1707
+ if (c >= 55296 && c <= 57343) {
1708
+ var v = t.charCodeAt(++p);
1709
+ c = 65536 + ((c & 1023) << 10) | v & 1023;
614
1710
  }
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;
1711
+ if (c <= 127) {
1712
+ if (n >= f) break;
1713
+ r[n++] = c;
1714
+ } else if (c <= 2047) {
1715
+ if (n + 1 >= f) break;
1716
+ r[n++] = 192 | c >> 6, r[n++] = 128 | c & 63;
1717
+ } else if (c <= 65535) {
1718
+ if (n + 2 >= f) break;
1719
+ r[n++] = 224 | c >> 12, r[n++] = 128 | c >> 6 & 63, r[n++] = 128 | c & 63;
624
1720
  } 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;
1721
+ if (n + 3 >= f) break;
1722
+ c > 1114111 && xe("Invalid Unicode code point " + de(c) + " 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[n++] = 240 | c >> 18, r[n++] = 128 | c >> 12 & 63, r[n++] = 128 | c >> 6 & 63, r[n++] = 128 | c & 63;
627
1723
  }
628
1724
  }
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");
1725
+ return r[n] = 0, n - l;
1726
+ }, Ue = (t, r, n) => (h(typeof n == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), Mi(t, ee, r, n)), ki = (t, r, n) => {
1727
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
632
1728
  };
633
- function Ht(e, r, t) {
1729
+ function Ii(t, r, n) {
634
1730
  return 0;
635
1731
  }
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");
1732
+ var Pi = (t, r) => {
1733
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1734
+ }, $i = (t, r, n) => {
1735
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1736
+ }, Ri = (t, r, n, o) => {
1737
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
642
1738
  };
643
- function zt(e, r, t, i) {
644
- M("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
645
- }
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) => {
655
- for (; e.length; ) {
656
- var r = e.pop(), t = e.pop();
657
- t(r);
1739
+ function xi(t, r, n, o) {
1740
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1741
+ }
1742
+ var Ui = (t, r, n, o) => {
1743
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1744
+ }, Di = (t) => {
1745
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1746
+ }, Oi = (t, r) => {
1747
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1748
+ }, Li = (t, r, n) => {
1749
+ W("it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM");
1750
+ }, ji = () => W("native code called abort()"), qe = {}, yt = (t) => {
1751
+ for (; t.length; ) {
1752
+ var r = t.pop(), n = t.pop();
1753
+ n(r);
658
1754
  }
659
1755
  };
660
- function $e(e) {
661
- return this.fromWireType(F[e >> 2]);
662
- }
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]);
1756
+ function De(t) {
1757
+ return this.fromWireType(x[t >> 2]);
1758
+ }
1759
+ var Ee = {}, he = {}, Ke = {}, pr, Qe = (t) => {
1760
+ throw new pr(t);
1761
+ }, Se = (t, r, n) => {
1762
+ t.forEach((c) => Ke[c] = r);
1763
+ function o(c) {
1764
+ var v = n(c);
1765
+ v.length !== t.length && Qe("Mismatched type converter count");
1766
+ for (var m = 0; m < t.length; ++m)
1767
+ ie(t[m], v[m]);
672
1768
  }
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);
1769
+ var l = new Array(r.length), f = [], p = 0;
1770
+ r.forEach((c, v) => {
1771
+ he.hasOwnProperty(c) ? l[v] = he[c] : (f.push(c), Ee.hasOwnProperty(c) || (Ee[c] = []), Ee[c].push(() => {
1772
+ l[v] = he[c], ++p, p === f.length && o(l);
677
1773
  }));
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);
1774
+ }), f.length === 0 && o(l);
1775
+ }, Wi = (t) => {
1776
+ var r = qe[t];
1777
+ delete qe[t];
1778
+ var n = r.rawConstructor, o = r.rawDestructor, l = r.fields, f = l.map((p) => p.getterReturnType).concat(l.map((p) => p.setterArgumentType));
1779
+ Se([t], f, (p) => {
1780
+ var c = {};
1781
+ return l.forEach((v, m) => {
1782
+ var b = v.fieldName, A = p[m], D = v.getter, j = v.getterContext, V = p[m + l.length], q = v.setter, ae = v.setterContext;
1783
+ c[b] = {
1784
+ read: (Z) => A.fromWireType(D(j, Z)),
1785
+ write: (Z, We) => {
1786
+ var te = [];
1787
+ q(ae, Z, V.toWireType(te, We)), yt(te);
692
1788
  }
693
1789
  };
694
1790
  }), [{
695
1791
  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;
1792
+ fromWireType: (v) => {
1793
+ var m = {};
1794
+ for (var b in c)
1795
+ m[b] = c[b].read(v);
1796
+ return o(v), m;
701
1797
  },
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;
1798
+ toWireType: (v, m) => {
1799
+ for (var b in c)
1800
+ if (!(b in m))
1801
+ throw new TypeError(`Missing field: "${b}"`);
1802
+ var A = n();
1803
+ for (b in c)
1804
+ c[b].write(A, m[b]);
1805
+ return v !== null && v.push(o, A), A;
710
1806
  },
711
- argPackAdvance: ie,
712
- readValueFromPointer: $e,
713
- destructorFunction: i
1807
+ argPackAdvance: se,
1808
+ readValueFromPointer: De,
1809
+ destructorFunction: o
714
1810
  }];
715
1811
  });
716
- }, ce = (e) => {
717
- if (e === null)
1812
+ }, ue = (t) => {
1813
+ if (t === null)
718
1814
  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++]];
1815
+ var r = typeof t;
1816
+ return r === "object" || r === "array" || r === "function" ? t.toString() : "" + t;
1817
+ }, Ni = () => {
1818
+ for (var t = new Array(256), r = 0; r < 256; ++r)
1819
+ t[r] = String.fromCharCode(r);
1820
+ vr = t;
1821
+ }, vr, J = (t) => {
1822
+ for (var r = "", n = t; ee[n]; )
1823
+ r += vr[ee[n++]];
728
1824
  return r;
729
- }, he, P = (e) => {
730
- throw new he(e);
1825
+ }, Ae, L = (t) => {
1826
+ throw new Ae(t);
731
1827
  };
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)
1828
+ function Bi(t, r, n = {}) {
1829
+ var o = r.name;
1830
+ if (t || L(`type "${o}" must have a positive integer typeid pointer`), he.hasOwnProperty(t)) {
1831
+ if (n.ignoreDuplicateRegistrations)
736
1832
  return;
737
- P(`Cannot register type '${i}' twice`);
1833
+ L(`Cannot register type '${o}' twice`);
738
1834
  }
739
- if (pe[e] = r, delete Le[e], ge.hasOwnProperty(e)) {
740
- var a = ge[e];
741
- delete ge[e], a.forEach((s) => s());
1835
+ if (he[t] = r, delete Ke[t], Ee.hasOwnProperty(t)) {
1836
+ var l = Ee[t];
1837
+ delete Ee[t], l.forEach((f) => f());
742
1838
  }
743
1839
  }
744
- function ee(e, r, t = {}) {
1840
+ function ie(t, r, n = {}) {
745
1841
  if (r.argPackAdvance === void 0)
746
1842
  throw new TypeError("registerType registeredInstance requires argPackAdvance");
747
- return ei(e, r, t);
1843
+ return Bi(t, r, n);
748
1844
  }
749
- var $r = (e, r, t) => {
1845
+ var yr = (t, r, n) => {
750
1846
  switch (r) {
751
1847
  case 1:
752
- return t ? (i) => j[i] : (i) => H[i];
1848
+ return n ? (o) => oe[o] : (o) => ee[o];
753
1849
  case 2:
754
- return t ? (i) => oe[i >> 1] : (i) => te[i >> 1];
1850
+ return n ? (o) => Ce[o >> 1] : (o) => Ye[o >> 1];
755
1851
  case 4:
756
- return t ? (i) => w[i >> 2] : (i) => F[i >> 2];
1852
+ return n ? (o) => k[o >> 2] : (o) => x[o >> 2];
757
1853
  case 8:
758
- return t ? (i) => we[i >> 3] : (i) => yr[i >> 3];
1854
+ return n ? (o) => ke[o >> 3] : (o) => nr[o >> 3];
759
1855
  default:
760
- throw new TypeError(`invalid integer width (${r}): ${e}`);
1856
+ throw new TypeError(`invalid integer width (${r}): ${t}`);
761
1857
  }
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, {
1858
+ }, Hi = (t, r, n, o, l) => {
1859
+ r = J(r);
1860
+ var f = r.indexOf("u") != -1;
1861
+ f && (l = (1n << 64n) - 1n), ie(t, {
766
1862
  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;
1863
+ fromWireType: (p) => p,
1864
+ toWireType: function(p, c) {
1865
+ if (typeof c != "bigint" && typeof c != "number")
1866
+ throw new TypeError(`Cannot convert "${ue(c)}" to ${this.name}`);
1867
+ if (typeof c == "number" && (c = BigInt(c)), c < o || c > l)
1868
+ throw new TypeError(`Passing a number "${ue(c)}" from JS side to C/C++ side to an argument of type "${r}", which is outside the valid range [${o}, ${l}]!`);
1869
+ return c;
774
1870
  },
775
- argPackAdvance: ie,
776
- readValueFromPointer: $r(r, t, !s),
1871
+ argPackAdvance: se,
1872
+ readValueFromPointer: yr(r, n, !f),
777
1873
  destructorFunction: null
778
1874
  // This type does not need a destructor
779
1875
  });
780
- }, ie = 8, ti = (e, r, t, i) => {
781
- r = G(r), ee(e, {
1876
+ }, se = 8, Vi = (t, r, n, o) => {
1877
+ r = J(r), ie(t, {
782
1878
  name: r,
783
- fromWireType: function(a) {
784
- return !!a;
1879
+ fromWireType: function(l) {
1880
+ return !!l;
785
1881
  },
786
- toWireType: function(a, s) {
787
- return s ? t : i;
1882
+ toWireType: function(l, f) {
1883
+ return f ? n : o;
788
1884
  },
789
- argPackAdvance: ie,
790
- readValueFromPointer: function(a) {
791
- return this.fromWireType(H[a]);
1885
+ argPackAdvance: se,
1886
+ readValueFromPointer: function(l) {
1887
+ return this.fromWireType(ee[l]);
792
1888
  },
793
1889
  destructorFunction: null
794
1890
  // This type does not need a destructor
795
1891
  });
796
- }, ii = (e) => ({
797
- count: e.count,
798
- deleteScheduled: e.deleteScheduled,
799
- preservePointerOnDelete: e.preservePointerOnDelete,
800
- ptr: e.ptr,
801
- ptrType: e.ptrType,
802
- smartPtr: e.smartPtr,
803
- smartPtrType: e.smartPtrType
804
- }), Ze = (e) => {
805
- function r(t) {
806
- return t.$$.ptrType.registeredClass.name;
1892
+ }, Yi = (t) => ({
1893
+ count: t.count,
1894
+ deleteScheduled: t.deleteScheduled,
1895
+ preservePointerOnDelete: t.preservePointerOnDelete,
1896
+ ptr: t.ptr,
1897
+ ptrType: t.ptrType,
1898
+ smartPtr: t.smartPtr,
1899
+ smartPtrType: t.smartPtrType
1900
+ }), gt = (t) => {
1901
+ function r(n) {
1902
+ return n.$$.ptrType.registeredClass.name;
807
1903
  }
808
- P(r(e) + " instance already deleted");
809
- }, er = !1, Pr = (e) => {
810
- }, ni = (e) => {
811
- e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr);
812
- }, Ir = (e) => {
813
- e.count.value -= 1;
814
- var r = e.count.value === 0;
815
- r && ni(e);
816
- }, kr = (e, r, t) => {
817
- if (r === t)
818
- return e;
819
- if (t.baseClass === void 0)
1904
+ L(r(t) + " instance already deleted");
1905
+ }, mt = !1, gr = (t) => {
1906
+ }, zi = (t) => {
1907
+ t.smartPtr ? t.smartPtrType.rawDestructor(t.smartPtr) : t.ptrType.registeredClass.rawDestructor(t.ptr);
1908
+ }, mr = (t) => {
1909
+ t.count.value -= 1;
1910
+ var r = t.count.value === 0;
1911
+ r && zi(t);
1912
+ }, _r = (t, r, n) => {
1913
+ if (r === n)
1914
+ return t;
1915
+ if (n.baseClass === void 0)
820
1916
  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;
1917
+ var o = _r(t, r, n.baseClass);
1918
+ return o === null ? null : n.downcast(o);
1919
+ }, hr = {}, Gi = {}, Ji = (t, r) => {
1920
+ for (r === void 0 && L("ptr should not be undefined"); t.baseClass; )
1921
+ r = t.upcast(r), t = t.baseClass;
826
1922
  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, {
1923
+ }, qi = (t, r) => (r = Ji(t, r), Gi[r]), Xe = (t, r) => {
1924
+ (!r.ptrType || !r.ptr) && Qe("makeClassHandle requires ptr and ptrType");
1925
+ var n = !!r.smartPtrType, o = !!r.smartPtr;
1926
+ return n !== o && Qe("Both smartPtrType and smartPtr must be specified"), r.count = { value: 1 }, Oe(Object.create(t, {
831
1927
  $$: {
832
1928
  value: r,
833
1929
  writable: !0
834
1930
  }
835
1931
  }));
836
1932
  };
837
- function Rr(e) {
838
- var r = this.getPointee(e);
1933
+ function br(t) {
1934
+ var r = this.getPointee(t);
839
1935
  if (!r)
840
- 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();
846
- return this.destructor(e), i;
1936
+ return this.destructor(t), null;
1937
+ var n = qi(this.registeredClass, r);
1938
+ if (n !== void 0) {
1939
+ if (n.$$.count.value === 0)
1940
+ return n.$$.ptr = r, n.$$.smartPtr = t, n.clone();
1941
+ var o = n.clone();
1942
+ return this.destructor(t), o;
847
1943
  }
848
- function a() {
849
- return this.isSmartPointer ? je(this.registeredClass.instancePrototype, {
1944
+ function l() {
1945
+ return this.isSmartPointer ? Xe(this.registeredClass.instancePrototype, {
850
1946
  ptrType: this.pointeeType,
851
1947
  ptr: r,
852
1948
  smartPtrType: this,
853
- smartPtr: e
854
- }) : je(this.registeredClass.instancePrototype, {
1949
+ smartPtr: t
1950
+ }) : Xe(this.registeredClass.instancePrototype, {
855
1951
  ptrType: this,
856
- ptr: e
1952
+ ptr: t
857
1953
  });
858
1954
  }
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(
1955
+ var f = this.registeredClass.getActualType(r), p = hr[f];
1956
+ if (!p)
1957
+ return l.call(this);
1958
+ var c;
1959
+ this.isConst ? c = p.constPointerType : c = p.pointerType;
1960
+ var v = _r(
865
1961
  r,
866
1962
  this.registeredClass,
867
- o.registeredClass
1963
+ c.registeredClass
868
1964
  );
869
- return d === null ? a.call(this) : this.isSmartPointer ? je(o.registeredClass.instancePrototype, {
870
- ptrType: o,
871
- ptr: d,
1965
+ return v === null ? l.call(this) : this.isSmartPointer ? Xe(c.registeredClass.instancePrototype, {
1966
+ ptrType: c,
1967
+ ptr: v,
872
1968
  smartPtrType: this,
873
- smartPtr: e
874
- }) : je(o.registeredClass.instancePrototype, {
875
- ptrType: o,
876
- ptr: d
1969
+ smartPtr: t
1970
+ }) : Xe(c.registeredClass.instancePrototype, {
1971
+ ptrType: c,
1972
+ ptr: v
877
1973
  });
878
1974
  }
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;
883
- if (i) {
884
- var a = { $$: t }, s = t.ptrType.registeredClass, l = new Error(`Embind found a leaked C++ instance ${s.name} <${se(t.ptr)}>.
1975
+ var Oe = (t) => typeof FinalizationRegistry > "u" ? (Oe = (r) => r, t) : (mt = new FinalizationRegistry((r) => {
1976
+ console.warn(r.leakWarning), mr(r.$$);
1977
+ }), Oe = (r) => {
1978
+ var n = r.$$, o = !!n.smartPtr;
1979
+ if (o) {
1980
+ var l = { $$: n }, f = n.ptrType.registeredClass, p = new Error(`Embind found a leaked C++ instance ${f.name} <${de(n.ptr)}>.
885
1981
  We'll free it automatically in this case, but this functionality is not reliable across various environments.
886
1982
  Make sure to invoke .delete() manually once you're done with the instance instead.
887
1983
  Originally allocated`);
888
- "captureStackTrace" in Error && Error.captureStackTrace(l, Rr), a.leakWarning = l.stack.replace(/^Error: /, ""), er.register(r, a, r);
1984
+ "captureStackTrace" in Error && Error.captureStackTrace(p, br), l.leakWarning = p.stack.replace(/^Error: /, ""), mt.register(r, l, r);
889
1985
  }
890
1986
  return r;
891
- }, Pr = (r) => er.unregister(r), Pe(e)), li = () => {
892
- Object.assign(We.prototype, {
893
- isAliasOf(e) {
894
- if (!(this instanceof We) || !(e instanceof We))
1987
+ }, gr = (r) => mt.unregister(r), Oe(t)), Ki = () => {
1988
+ Object.assign(Ze.prototype, {
1989
+ isAliasOf(t) {
1990
+ if (!(this instanceof Ze) || !(t instanceof Ze))
895
1991
  return !1;
896
- var r = this.$$.ptrType.registeredClass, t = this.$$.ptr;
897
- e.$$ = /** @type {Object} */
898
- e.$$;
899
- for (var i = e.$$.ptrType.registeredClass, a = e.$$.ptr; r.baseClass; )
900
- t = r.upcast(t), r = r.baseClass;
901
- for (; i.baseClass; )
902
- a = i.upcast(a), i = i.baseClass;
903
- return r === i && t === a;
1992
+ var r = this.$$.ptrType.registeredClass, n = this.$$.ptr;
1993
+ t.$$ = /** @type {Object} */
1994
+ t.$$;
1995
+ for (var o = t.$$.ptrType.registeredClass, l = t.$$.ptr; r.baseClass; )
1996
+ n = r.upcast(n), r = r.baseClass;
1997
+ for (; o.baseClass; )
1998
+ l = o.upcast(l), o = o.baseClass;
1999
+ return r === o && n === l;
904
2000
  },
905
2001
  clone() {
906
- if (this.$$.ptr || Ze(this), this.$$.preservePointerOnDelete)
2002
+ if (this.$$.ptr || gt(this), this.$$.preservePointerOnDelete)
907
2003
  return this.$$.count.value += 1, this;
908
- var e = Pe(Object.create(Object.getPrototypeOf(this), {
2004
+ var t = Oe(Object.create(Object.getPrototypeOf(this), {
909
2005
  $$: {
910
- value: ii(this.$$)
2006
+ value: Yi(this.$$)
911
2007
  }
912
2008
  }));
913
- return e.$$.count.value += 1, e.$$.deleteScheduled = !1, e;
2009
+ return t.$$.count.value += 1, t.$$.deleteScheduled = !1, t;
914
2010
  },
915
2011
  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);
2012
+ this.$$.ptr || gt(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && L("Object already scheduled for deletion"), gr(this), mr(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
917
2013
  },
918
2014
  isDeleted() {
919
2015
  return !this.$$.ptr;
920
2016
  },
921
2017
  deleteLater() {
922
- return this.$$.ptr || Ze(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && P("Object already scheduled for deletion"), this.$$.deleteScheduled = !0, this;
2018
+ return this.$$.ptr || gt(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && L("Object already scheduled for deletion"), this.$$.deleteScheduled = !0, this;
923
2019
  }
924
2020
  });
925
2021
  };
926
- function We() {
927
- }
928
- var Ie = (e, r) => Object.defineProperty(r, "name", {
929
- 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;
2022
+ function Ze() {
2023
+ }
2024
+ var Le = (t, r) => Object.defineProperty(r, "name", {
2025
+ value: t
2026
+ }), Tr = (t, r, n) => {
2027
+ if (t[r].overloadTable === void 0) {
2028
+ var o = t[r];
2029
+ t[r] = function(...l) {
2030
+ return t[r].overloadTable.hasOwnProperty(l.length) || L(`Function '${n}' called with an invalid number of arguments (${l.length}) - expects one of (${t[r].overloadTable})!`), t[r].overloadTable[l.length].apply(this, l);
2031
+ }, t[r].overloadTable = [], t[r].overloadTable[o.argCount] = o;
936
2032
  }
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;
2033
+ }, Qi = (t, r, n) => {
2034
+ a.hasOwnProperty(t) ? (L(`Cannot register public name '${t}' twice`), Tr(a, t, t), a[t].overloadTable.hasOwnProperty(n) && L(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`), a[t].overloadTable[n] = r) : (a[t] = r, a[t].argCount = n);
2035
+ }, Xi = 48, Zi = 57, ea = (t) => {
2036
+ h(typeof t == "string"), t = t.replace(/[^a-zA-Z0-9_]/g, "$");
2037
+ var r = t.charCodeAt(0);
2038
+ return r >= Xi && r <= Zi ? `_${t}` : t;
943
2039
  };
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 = [];
2040
+ function ta(t, r, n, o, l, f, p, c) {
2041
+ this.name = t, this.constructor = r, this.instancePrototype = n, this.rawDestructor = o, this.baseClass = l, this.getActualType = f, this.upcast = p, this.downcast = c, this.pureVirtualFunctions = [];
946
2042
  }
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;
950
- return e;
2043
+ var _t = (t, r, n) => {
2044
+ for (; r !== n; )
2045
+ r.upcast || L(`Expected null or instance of ${n.name}, got an instance of ${r.name}`), t = r.upcast(t), r = r.baseClass;
2046
+ return t;
951
2047
  };
952
- function pi(e, r) {
2048
+ function ra(t, r) {
953
2049
  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);
957
- return i;
2050
+ return this.isReference && L(`null is not a valid ${this.name}`), 0;
2051
+ r.$$ || L(`Cannot pass "${ue(r)}" as a ${this.name}`), r.$$.ptr || L(`Cannot pass deleted object as a pointer of type ${this.name}`);
2052
+ var n = r.$$.ptrType.registeredClass, o = _t(r.$$.ptr, n, this.registeredClass);
2053
+ return o;
958
2054
  }
959
- function _i(e, r) {
960
- var t;
2055
+ function na(t, r) {
2056
+ var n;
961
2057
  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) {
2058
+ return this.isReference && L(`null is not a valid ${this.name}`), this.isSmartPointer ? (n = this.rawConstructor(), t !== null && t.push(this.rawDestructor, n), n) : 0;
2059
+ (!r || !r.$$) && L(`Cannot pass "${ue(r)}" as a ${this.name}`), r.$$.ptr || L(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && r.$$.ptrType.isConst && L(`Cannot convert argument of type ${r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name} to parameter type ${this.name}`);
2060
+ var o = r.$$.ptrType.registeredClass;
2061
+ if (n = _t(r.$$.ptr, o, this.registeredClass), this.isSmartPointer)
2062
+ switch (r.$$.smartPtr === void 0 && L("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
967
2063
  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}`);
2064
+ r.$$.smartPtrType === this ? n = r.$$.smartPtr : L(`Cannot convert argument of type ${r.$$.smartPtrType ? r.$$.smartPtrType.name : r.$$.ptrType.name} to parameter type ${this.name}`);
969
2065
  break;
970
2066
  case 1:
971
- t = r.$$.smartPtr;
2067
+ n = r.$$.smartPtr;
972
2068
  break;
973
2069
  case 2:
974
2070
  if (r.$$.smartPtrType === this)
975
- t = r.$$.smartPtr;
2071
+ n = r.$$.smartPtr;
976
2072
  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);
2073
+ var l = r.clone();
2074
+ n = this.rawShare(
2075
+ n,
2076
+ X.toHandle(() => l.delete())
2077
+ ), t !== null && t.push(this.rawDestructor, n);
982
2078
  }
983
2079
  break;
984
2080
  default:
985
- P("Unsupporting sharing policy");
2081
+ L("Unsupporting sharing policy");
986
2082
  }
987
- return t;
2083
+ return n;
988
2084
  }
989
- function yi(e, r) {
2085
+ function ia(t, r) {
990
2086
  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);
994
- return i;
995
- }
996
- var gi = () => {
997
- Object.assign(He.prototype, {
998
- getPointee(e) {
999
- return this.rawGetPointee && (e = this.rawGetPointee(e)), e;
2087
+ return this.isReference && L(`null is not a valid ${this.name}`), 0;
2088
+ r.$$ || L(`Cannot pass "${ue(r)}" as a ${this.name}`), r.$$.ptr || L(`Cannot pass deleted object as a pointer of type ${this.name}`), r.$$.ptrType.isConst && L(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);
2089
+ var n = r.$$.ptrType.registeredClass, o = _t(r.$$.ptr, n, this.registeredClass);
2090
+ return o;
2091
+ }
2092
+ var aa = () => {
2093
+ Object.assign(et.prototype, {
2094
+ getPointee(t) {
2095
+ return this.rawGetPointee && (t = this.rawGetPointee(t)), t;
1000
2096
  },
1001
- destructor(e) {
1002
- this.rawDestructor?.(e);
2097
+ destructor(t) {
2098
+ this.rawDestructor?.(t);
1003
2099
  },
1004
- argPackAdvance: ie,
1005
- readValueFromPointer: $e,
1006
- fromWireType: Rr
2100
+ argPackAdvance: se,
2101
+ readValueFromPointer: De,
2102
+ fromWireType: br
1007
2103
  });
1008
2104
  };
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;
1011
- }
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);
1020
- 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);
2105
+ function et(t, r, n, o, l, f, p, c, v, m, b) {
2106
+ this.name = t, this.registeredClass = r, this.isReference = n, this.isConst = o, this.isSmartPointer = l, this.pointeeType = f, this.sharingPolicy = p, this.rawGetPointee = c, this.rawConstructor = v, this.rawShare = m, this.rawDestructor = b, !l && r.baseClass === void 0 ? o ? (this.toWireType = ra, this.destructorFunction = null) : (this.toWireType = ia, this.destructorFunction = null) : this.toWireType = na;
2107
+ }
2108
+ var oa = (t, r, n) => {
2109
+ a.hasOwnProperty(t) || Qe("Replacing nonexistent public symbol"), a[t].overloadTable !== void 0 && n !== void 0 || (a[t] = r, a[t].argCount = n);
2110
+ }, sa = (t, r, n) => {
2111
+ t = t.replace(/p/g, "i"), h("dynCall_" + t in a, `bad function pointer type - dynCall function not found for sig '${t}'`), n?.length ? h(n.length === t.length - 1) : h(t.length == 1);
2112
+ var o = a["dynCall_" + t];
2113
+ return o(r, ...n);
2114
+ }, wr, la = (t, r, n = []) => {
2115
+ var o = sa(t, r, n);
2116
+ return o;
2117
+ }, da = (t, r) => (...n) => la(t, r, n), le = (t, r) => {
2118
+ t = J(t);
2119
+ function n() {
2120
+ return da(t, r);
1025
2121
  }
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/, ""));
2122
+ var o = n();
2123
+ return typeof o != "function" && L(`unknown function pointer with signature ${t}: ${r}`), o;
2124
+ }, ca = (t, r) => {
2125
+ var n = Le(r, function(o) {
2126
+ this.name = r, this.message = o;
2127
+ var l = new Error(o).stack;
2128
+ l !== void 0 && (this.stack = this.toString() + `
2129
+ ` + l.replace(/^Error(:[^\n]*)?\n/, ""));
1034
2130
  });
1035
- return t.prototype = Object.create(e.prototype), t.prototype.constructor = t, t.prototype.toString = function() {
2131
+ return n.prototype = Object.create(t.prototype), n.prototype.constructor = n, n.prototype.toString = function() {
1036
2132
  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);
2133
+ }, n;
2134
+ }, Cr, Er = (t) => {
2135
+ var r = Fo(t), n = J(r);
2136
+ return ce(r), n;
2137
+ }, ht = (t, r) => {
2138
+ var n = [], o = {};
2139
+ function l(f) {
2140
+ if (!o[f] && !he[f]) {
2141
+ if (Ke[f]) {
2142
+ Ke[f].forEach(l);
1047
2143
  return;
1048
2144
  }
1049
- t.push(s), i[s] = !0;
2145
+ n.push(f), o[f] = !0;
1050
2146
  }
1051
2147
  }
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]);
1058
- }), me(
1059
- [e, r, t],
1060
- 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 }
2148
+ throw r.forEach(l), new Cr(`${t}: ` + n.map(Er).join([", "]));
2149
+ }, ua = (t, r, n, o, l, f, p, c, v, m, b, A, D) => {
2150
+ b = J(b), f = le(l, f), c &&= le(p, c), m &&= le(v, m), D = le(A, D);
2151
+ var j = ea(b);
2152
+ Qi(j, function() {
2153
+ ht(`Cannot construct ${b} due to unbound types`, [o]);
2154
+ }), Se(
2155
+ [t, r, n],
2156
+ o ? [o] : [],
2157
+ (V) => {
2158
+ V = V[0];
2159
+ var q, ae;
2160
+ o ? (q = V.registeredClass, ae = q.instancePrototype) : ae = Ze.prototype;
2161
+ var Z = Le(b, function(...kt) {
2162
+ if (Object.getPrototypeOf(this) !== We)
2163
+ throw new Ae("Use 'new' to construct " + b);
2164
+ if (te.constructor_body === void 0)
2165
+ throw new Ae(b + " has no accessible constructor");
2166
+ var Nr = te.constructor_body[kt.length];
2167
+ if (Nr === void 0)
2168
+ throw new Ae(`Tried to invoke ctor of ${b} with invalid number of parameters (${kt.length}) - expected (${Object.keys(te.constructor_body).toString()}) parameters instead!`);
2169
+ return Nr.apply(this, kt);
2170
+ }), We = Object.create(ae, {
2171
+ constructor: { value: Z }
1076
2172
  });
1077
- Q.prototype = Me;
1078
- var X = new vi(
1079
- y,
1080
- Q,
1081
- Me,
1082
- A,
1083
- J,
1084
- s,
1085
- o,
1086
- p
2173
+ Z.prototype = We;
2174
+ var te = new ta(
2175
+ b,
2176
+ Z,
2177
+ We,
2178
+ D,
2179
+ q,
2180
+ f,
2181
+ c,
2182
+ m
1087
2183
  );
1088
- X.baseClass && (X.baseClass.__derivedClasses ??= [], X.baseClass.__derivedClasses.push(X));
1089
- var Qn = new He(
1090
- y,
1091
- X,
2184
+ te.baseClass && (te.baseClass.__derivedClasses ??= [], te.baseClass.__derivedClasses.push(te));
2185
+ var Lo = new et(
2186
+ b,
2187
+ te,
1092
2188
  !0,
1093
2189
  !1,
1094
2190
  !1
1095
- ), qr = new He(
1096
- y + "*",
1097
- X,
2191
+ ), jr = new et(
2192
+ b + "*",
2193
+ te,
1098
2194
  !1,
1099
2195
  !1,
1100
2196
  !1
1101
- ), Zr = new He(
1102
- y + " const*",
1103
- X,
2197
+ ), Wr = new et(
2198
+ b + " const*",
2199
+ te,
1104
2200
  !1,
1105
2201
  !0,
1106
2202
  !1
1107
2203
  );
1108
- return Mr[e] = {
1109
- pointerType: qr,
1110
- constPointerType: Zr
1111
- }, mi(k, Q), [Qn, qr, Zr];
2204
+ return hr[t] = {
2205
+ pointerType: jr,
2206
+ constPointerType: Wr
2207
+ }, oa(j, Z), [Lo, jr, Wr];
1112
2208
  }
1113
2209
  );
1114
- }, Lr = (e, r) => {
1115
- for (var t = [], i = 0; i < e; i++)
1116
- t.push(F[r + i * 4 >> 2]);
1117
- return t;
2210
+ }, Sr = (t, r) => {
2211
+ for (var n = [], o = 0; o < t; o++)
2212
+ n.push(x[r + o * 4 >> 2]);
2213
+ return n;
1118
2214
  };
1119
- function Nr(e) {
1120
- for (var r = 1; r < e.length; ++r)
1121
- if (e[r] !== null && e[r].destructorFunction === void 0)
2215
+ function Ar(t) {
2216
+ for (var r = 1; r < t.length; ++r)
2217
+ if (t[r] !== null && t[r].destructorFunction === void 0)
1122
2218
  return !0;
1123
2219
  return !1;
1124
2220
  }
1125
- function jr(e, r) {
1126
- if (!(e instanceof Function))
1127
- throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);
1128
- var t = Ie(e.name || "unknownFunctionName", function() {
2221
+ function Fr(t, r) {
2222
+ if (!(t instanceof Function))
2223
+ throw new TypeError(`new_ called with constructor type ${typeof t} which is not a function`);
2224
+ var n = Le(t.name || "unknownFunctionName", function() {
1129
2225
  });
1130
- t.prototype = e.prototype;
1131
- var i = new t(), a = e.apply(i, r);
1132
- return a instanceof Object ? a : i;
1133
- }
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}`);
2226
+ n.prototype = t.prototype;
2227
+ var o = new n(), l = t.apply(o, r);
2228
+ return l instanceof Object ? l : o;
2229
+ }
2230
+ function fa(t, r, n, o, l) {
2231
+ if (t < r || t > n) {
2232
+ var f = r == n ? r : `${r} to ${n}`;
2233
+ l(`function ${o} called with ${t} arguments, expected ${f}`);
1138
2234
  }
1139
2235
  }
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}) {
2236
+ function pa(t, r, n, o) {
2237
+ var l = Ar(t), f = t.length - 2, p = [], c = ["fn"];
2238
+ r && c.push("thisWired");
2239
+ for (var v = 0; v < f; ++v)
2240
+ p.push(`arg${v}`), c.push(`arg${v}Wired`);
2241
+ p = p.join(","), c = c.join(",");
2242
+ var m = `return function (${p}) {
1147
2243
  `;
1148
- p += `checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
1149
- `, a && (p += `var destructors = [];
2244
+ m += `checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
2245
+ `, l && (m += `var destructors = [];
1150
2246
  `);
1151
- var y = a ? "destructors" : "null", m = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
1152
- r && (p += `var thisWired = classParam['toWireType'](${y}, this);
2247
+ var b = l ? "destructors" : "null", A = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
2248
+ r && (m += `var thisWired = classParam['toWireType'](${b}, this);
1153
2249
  `);
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});
2250
+ for (var v = 0; v < f; ++v)
2251
+ m += `var arg${v}Wired = argType${v}['toWireType'](${b}, arg${v});
2252
+ `, A.push(`argType${v}`);
2253
+ m += (n || o ? "var rv = " : "") + `invoker(${c});
1158
2254
  `;
1159
- var A = t ? "rv" : "";
1160
- if (m.push("Asyncify"), p += `function onDone(${A}) {
1161
- `, a)
1162
- p += `runDestructors(destructors);
2255
+ var D = n ? "rv" : "";
2256
+ if (A.push("Asyncify"), m += `function onDone(${D}) {
2257
+ `, l)
2258
+ m += `runDestructors(destructors);
1163
2259
  `;
1164
2260
  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`));
2261
+ for (var v = r ? 1 : 2; v < t.length; ++v) {
2262
+ var j = v === 1 ? "thisWired" : "arg" + (v - 2) + "Wired";
2263
+ t[v].destructorFunction !== null && (m += `${j}_dtor(${j});
2264
+ `, A.push(`${j}_dtor`));
1169
2265
  }
1170
- return t && (p += `var ret = retType['fromWireType'](rv);
2266
+ return n && (m += `var ret = retType['fromWireType'](rv);
1171
2267
  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];
2268
+ `), m += `}
2269
+ `, m += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${D});
2270
+ `, m += `}
2271
+ `, A.push("checkArgCount", "minArgs", "maxArgs"), m = `if (arguments.length !== ${A.length}){ throw new Error(humanName + "Expected ${A.length} closure arguments " + arguments.length + " given."); }
2272
+ ${m}`, [A, m];
1177
2273
  }
1178
- var Be = (e) => {
2274
+ var tt = (t) => {
1179
2275
  try {
1180
- return e();
2276
+ return t();
1181
2277
  } catch (r) {
1182
- M(r);
2278
+ W(r);
1183
2279
  }
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.");
2280
+ }, va = (t) => {
2281
+ if (t instanceof mi || t == "unwind")
2282
+ return Q;
2283
+ ze(), t instanceof WebAssembly.RuntimeError && ko() <= 0 && F("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 52428800)"), P(1, t);
2284
+ }, ya = () => {
2285
+ }, ga = (t) => {
2286
+ if (Y) {
2287
+ F("user callback triggered after runtime exited or application aborted. Ignoring.");
1192
2288
  return;
1193
2289
  }
1194
2290
  try {
1195
- e(), Ai();
2291
+ t(), ya();
1196
2292
  } catch (r) {
1197
- Fi(r);
2293
+ va(r);
1198
2294
  }
1199
- }, g = {
1200
- instrumentWasmImports(e) {
2295
+ }, w = {
2296
+ instrumentWasmImports(t) {
1201
2297
  var r = /^(invoke_.*|__asyncjs__.*)$/;
1202
- for (let [t, i] of Object.entries(e))
1203
- if (typeof i == "function") {
1204
- let a = i.isAsync || r.test(t);
1205
- e[t] = (...s) => {
1206
- var l = g.state;
2298
+ for (let [n, o] of Object.entries(t))
2299
+ if (typeof o == "function") {
2300
+ let l = o.isAsync || r.test(n);
2301
+ t[n] = (...f) => {
2302
+ var p = w.state;
1207
2303
  try {
1208
- return i(...s);
2304
+ return o(...f);
1209
2305
  } 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`);
2306
+ var c = p === w.State.Normal && w.state === w.State.Disabled, v = n.startsWith("invoke_") && !0;
2307
+ if (w.state !== p && !l && !c && !v)
2308
+ throw new Error(`import ${n} was not in ASYNCIFY_IMPORTS, but changed the state`);
1213
2309
  }
1214
2310
  };
1215
2311
  }
1216
2312
  },
1217
- instrumentWasmExports(e) {
2313
+ instrumentWasmExports(t) {
1218
2314
  var r = {};
1219
- for (let [t, i] of Object.entries(e))
1220
- typeof i == "function" ? r[t] = (...a) => {
1221
- g.exportCallStack.push(t);
2315
+ for (let [n, o] of Object.entries(t))
2316
+ typeof o == "function" ? r[n] = (...l) => {
2317
+ w.exportCallStack.push(n);
1222
2318
  try {
1223
- return i(...a);
2319
+ return o(...l);
1224
2320
  } finally {
1225
- if (!T) {
1226
- var s = g.exportCallStack.pop();
1227
- f(s === t), g.maybeStopUnwind();
2321
+ if (!Y) {
2322
+ var f = w.exportCallStack.pop();
2323
+ h(f === n), w.maybeStopUnwind();
1228
2324
  }
1229
2325
  }
1230
- } : r[t] = i;
2326
+ } : r[n] = o;
1231
2327
  return r;
1232
2328
  },
1233
2329
  State: {
@@ -1246,127 +2342,127 @@ ${p}`, [m, p];
1246
2342
  callStackId: 0,
1247
2343
  asyncPromiseHandlers: null,
1248
2344
  sleepCallbacks: [],
1249
- 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;
2345
+ getCallStackId(t) {
2346
+ var r = w.callStackNameToId[t];
2347
+ return r === void 0 && (r = w.callStackId++, w.callStackNameToId[t] = r, w.callStackIdToName[r] = t), r;
1252
2348
  },
1253
2349
  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());
2350
+ w.currData && w.state === w.State.Unwinding && w.exportCallStack.length === 0 && (w.state = w.State.Normal, tt($o), typeof Fibers < "u" && Fibers.trampoline());
1255
2351
  },
1256
2352
  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 };
2353
+ return h(w.currData, "Tried to wait for an async operation when none is in progress."), h(!w.asyncPromiseHandlers, "Cannot have multiple async operations in flight at once"), new Promise((t, r) => {
2354
+ w.asyncPromiseHandlers = { resolve: t, reject: r };
1259
2355
  });
1260
2356
  },
1261
2357
  allocateData() {
1262
- var e = cr(12 + g.StackSize);
1263
- return g.setDataHeader(e, e + 12, g.StackSize), g.setDataRewindFunc(e), e;
2358
+ var t = Ft(12 + w.StackSize);
2359
+ return w.setDataHeader(t, t + 12, w.StackSize), w.setDataRewindFunc(t), t;
1264
2360
  },
1265
- setDataHeader(e, r, t) {
1266
- F[e >> 2] = r, F[e + 4 >> 2] = r + t;
2361
+ setDataHeader(t, r, n) {
2362
+ x[t >> 2] = r, x[t + 4 >> 2] = r + n;
1267
2363
  },
1268
- setDataRewindFunc(e) {
1269
- var r = g.exportCallStack[0], t = g.getCallStackId(r);
1270
- w[e + 8 >> 2] = t, C(t);
2364
+ setDataRewindFunc(t) {
2365
+ var r = w.exportCallStack[0], n = w.getCallStackId(r);
2366
+ k[t + 8 >> 2] = n, I(n);
1271
2367
  },
1272
- getDataRewindFuncName(e) {
1273
- var r = w[e + 8 >> 2], t = g.callStackIdToName[r];
1274
- return t;
2368
+ getDataRewindFuncName(t) {
2369
+ var r = k[t + 8 >> 2], n = w.callStackIdToName[r];
2370
+ return n;
1275
2371
  },
1276
- getDataRewindFunc(e) {
1277
- var r = V[e];
2372
+ getDataRewindFunc(t) {
2373
+ var r = z[t];
1278
2374
  return r;
1279
2375
  },
1280
- doRewind(e) {
1281
- var r = g.getDataRewindFuncName(e), t = g.getDataRewindFunc(r);
1282
- return t();
2376
+ doRewind(t) {
2377
+ var r = w.getDataRewindFuncName(t), n = w.getDataRewindFunc(r);
2378
+ return n();
1283
2379
  },
1284
- 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;
1288
- 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;
2380
+ handleSleep(t) {
2381
+ if (h(w.state !== w.State.Disabled, "Asyncify cannot be done during or after the runtime exits"), !Y) {
2382
+ if (w.state === w.State.Normal) {
2383
+ var r = !1, n = !1;
2384
+ t((o = 0) => {
2385
+ if (h(!o || typeof o == "number" || typeof o == "boolean"), !Y && (w.handleSleepReturnValue = o, r = !0, !!n)) {
2386
+ h(!w.exportCallStack.length, "Waking up (starting to rewind) must be done from JS, without compiled code on the stack."), w.state = w.State.Rewinding, tt(() => Ro(w.currData)), typeof MainLoop < "u" && MainLoop.func && MainLoop.resume();
2387
+ var l, f = !1;
1292
2388
  try {
1293
- a = g.doRewind(g.currData);
1294
- } catch (d) {
1295
- a = d, s = !0;
2389
+ l = w.doRewind(w.currData);
2390
+ } catch (v) {
2391
+ l = v, f = !0;
1296
2392
  }
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);
2393
+ var p = !1;
2394
+ if (!w.currData) {
2395
+ var c = w.asyncPromiseHandlers;
2396
+ c && (w.asyncPromiseHandlers = null, (f ? c.reject : c.resolve)(l), p = !0);
1301
2397
  }
1302
- if (s && !l)
1303
- throw a;
2398
+ if (f && !p)
2399
+ throw l;
1304
2400
  }
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;
2401
+ }), n = !0, r || (w.state = w.State.Unwinding, w.currData = w.allocateData(), typeof MainLoop < "u" && MainLoop.func && MainLoop.pause(), tt(() => Po(w.currData)));
2402
+ } else w.state === w.State.Rewinding ? (w.state = w.State.Normal, tt(xo), ce(w.currData), w.currData = null, w.sleepCallbacks.forEach(ga)) : W(`invalid state: ${w.state}`);
2403
+ return w.handleSleepReturnValue;
1308
2404
  }
1309
2405
  },
1310
- handleAsync(e) {
1311
- return g.handleSleep((r) => {
1312
- e().then(r);
2406
+ handleAsync(t) {
2407
+ return w.handleSleep((r) => {
2408
+ t().then(r);
1313
2409
  });
1314
2410
  }
1315
2411
  };
1316
- function Pi(e) {
1317
- for (var r = e.length - 2, t = e.length - 1; t >= 2 && e[t].optional; --t)
2412
+ function ma(t) {
2413
+ for (var r = t.length - 2, n = t.length - 1; n >= 2 && t[n].optional; --n)
1318
2414
  r--;
1319
2415
  return r;
1320
2416
  }
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);
1334
- }
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), [])), [];
2417
+ function Mr(t, r, n, o, l, f) {
2418
+ var p = r.length;
2419
+ p < 2 && L("argTypes array size mismatch! Must at least get return value and 'this' types!"), h(!f, "Async bindings are only supported with JSPI.");
2420
+ for (var c = r[1] !== null && n !== null, v = Ar(r), m = r[0].name !== "void", b = p - 2, A = ma(r), D = [t, L, o, l, yt, r[0], r[1]], j = 0; j < p - 2; ++j)
2421
+ D.push(r[j + 2]);
2422
+ if (D.push(w), !v)
2423
+ for (var j = c ? 1 : 2; j < r.length; ++j)
2424
+ r[j].destructorFunction !== null && D.push(r[j].destructorFunction);
2425
+ D.push(fa, A, b);
2426
+ let [V, q] = pa(r, c, m, f);
2427
+ V.push(q);
2428
+ var ae = Fr(Function, V)(...D);
2429
+ return Le(t, ae);
2430
+ }
2431
+ var _a = (t, r, n, o, l, f) => {
2432
+ h(r > 0);
2433
+ var p = Sr(r, n);
2434
+ l = le(o, l), Se([], [t], (c) => {
2435
+ c = c[0];
2436
+ var v = `constructor ${c.name}`;
2437
+ if (c.registeredClass.constructor_body === void 0 && (c.registeredClass.constructor_body = []), c.registeredClass.constructor_body[r - 1] !== void 0)
2438
+ throw new Ae(`Cannot register multiple constructors with identical number of parameters (${r - 1}) for class '${c.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
2439
+ return c.registeredClass.constructor_body[r - 1] = () => {
2440
+ ht(`Cannot construct ${c.name} due to unbound types`, p);
2441
+ }, Se([], p, (m) => (m.splice(1, 0, null), c.registeredClass.constructor_body[r - 1] = Mr(v, m, null, l, f), [])), [];
1346
2442
  });
1347
- }, ki = (e) => {
1348
- 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);
2443
+ }, ha = (t) => {
2444
+ t = t.trim();
2445
+ const r = t.indexOf("(");
2446
+ return r === -1 ? t : (h(t.endsWith(")"), "Parentheses for argument names should match."), t.slice(0, r));
2447
+ }, ba = (t, r, n, o, l, f, p, c, v, m) => {
2448
+ var b = Sr(n, o);
2449
+ r = J(r), r = ha(r), f = le(l, f), Se([], [t], (A) => {
2450
+ A = A[0];
2451
+ var D = `${A.name}.${r}`;
2452
+ r.startsWith("@@") && (r = Symbol[r.substring(2)]), c && A.registeredClass.pureVirtualFunctions.push(r);
2453
+ function j() {
2454
+ ht(`Cannot call ${D} due to unbound types`, b);
1359
2455
  }
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, [];
2456
+ var V = A.registeredClass.instancePrototype, q = V[r];
2457
+ return q === void 0 || q.overloadTable === void 0 && q.className !== A.name && q.argCount === n - 2 ? (j.argCount = n - 2, j.className = A.name, V[r] = j) : (Tr(V, r, D), V[r].overloadTable[n - 2] = j), Se([], b, (ae) => {
2458
+ var Z = Mr(D, ae, A, f, p, v);
2459
+ return V[r].overloadTable === void 0 ? (Z.argCount = n - 2, V[r] = Z) : V[r].overloadTable[n - 2] = Z, [];
1364
2460
  }), [];
1365
2461
  });
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(
2462
+ }, bt = [], re = [], Tt = (t) => {
2463
+ t > 9 && --re[t + 1] === 0 && (h(re[t] !== void 0, "Decref for unallocated handle."), re[t] = void 0, bt.push(t));
2464
+ }, Ta = () => re.length / 2 - 5 - bt.length, wa = () => {
2465
+ re.push(
1370
2466
  0,
1371
2467
  1,
1372
2468
  void 0,
@@ -1377,11 +2473,11 @@ ${p}`, [m, p];
1377
2473
  1,
1378
2474
  !1,
1379
2475
  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]),
1383
- toHandle: (e) => {
1384
- switch (e) {
2476
+ ), h(re.length === 5 * 2), a.count_emval_handles = Ta;
2477
+ }, X = {
2478
+ toValue: (t) => (t || L("Cannot use deleted val. handle = " + t), h(t === 2 || re[t] !== void 0 && t % 2 === 0, `invalid handle: ${t}`), re[t]),
2479
+ toHandle: (t) => {
2480
+ switch (t) {
1385
2481
  case void 0:
1386
2482
  return 2;
1387
2483
  case null:
@@ -1391,79 +2487,79 @@ ${p}`, [m, p];
1391
2487
  case !1:
1392
2488
  return 8;
1393
2489
  default: {
1394
- const r = ir.pop() || q.length;
1395
- return q[r] = e, q[r + 1] = 1, r;
2490
+ const r = bt.pop() || re.length;
2491
+ return re[r] = t, re[r + 1] = 1, r;
1396
2492
  }
1397
2493
  }
1398
2494
  }
1399
- }, Hr = {
2495
+ }, kr = {
1400
2496
  name: "emscripten::val",
1401
- fromWireType: (e) => {
1402
- var r = K.toValue(e);
1403
- return nr(e), r;
2497
+ fromWireType: (t) => {
2498
+ var r = X.toValue(t);
2499
+ return Tt(t), r;
1404
2500
  },
1405
- toWireType: (e, r) => K.toHandle(r),
1406
- argPackAdvance: ie,
1407
- readValueFromPointer: $e,
2501
+ toWireType: (t, r) => X.toHandle(r),
2502
+ argPackAdvance: se,
2503
+ readValueFromPointer: De,
1408
2504
  destructorFunction: null
1409
2505
  // This type does not need a destructor
1410
2506
  // TODO: do we need a deleteObject here? write a test where
1411
2507
  // emval is passed into JS via an interface
1412
- }, Ui = (e) => ee(e, Hr), xi = (e, r) => {
2508
+ }, Ca = (t) => ie(t, kr), Ea = (t, r) => {
1413
2509
  switch (r) {
1414
2510
  case 4:
1415
- return function(t) {
1416
- return this.fromWireType(_r[t >> 2]);
2511
+ return function(n) {
2512
+ return this.fromWireType(rr[n >> 2]);
1417
2513
  };
1418
2514
  case 8:
1419
- return function(t) {
1420
- return this.fromWireType(gr[t >> 3]);
2515
+ return function(n) {
2516
+ return this.fromWireType(ir[n >> 3]);
1421
2517
  };
1422
2518
  default:
1423
- throw new TypeError(`invalid float width (${r}): ${e}`);
2519
+ throw new TypeError(`invalid float width (${r}): ${t}`);
1424
2520
  }
1425
- }, Oi = (e, r, t) => {
1426
- r = G(r), ee(e, {
2521
+ }, Sa = (t, r, n) => {
2522
+ r = J(r), ie(t, {
1427
2523
  name: r,
1428
- 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;
2524
+ fromWireType: (o) => o,
2525
+ toWireType: (o, l) => {
2526
+ if (typeof l != "number" && typeof l != "boolean")
2527
+ throw new TypeError(`Cannot convert ${ue(l)} to ${this.name}`);
2528
+ return l;
1433
2529
  },
1434
- argPackAdvance: ie,
1435
- readValueFromPointer: xi(r, t),
2530
+ argPackAdvance: se,
2531
+ readValueFromPointer: Ea(r, n),
1436
2532
  destructorFunction: null
1437
2533
  // This type does not need a destructor
1438
2534
  });
1439
- }, Li = (e, r, t, i, a) => {
1440
- r = G(r), a === -1 && (a = 4294967295);
1441
- var s = (y) => y;
1442
- if (i === 0) {
1443
- var l = 32 - 8 * t;
1444
- s = (y) => y << l >>> l;
2535
+ }, Aa = (t, r, n, o, l) => {
2536
+ r = J(r), l === -1 && (l = 4294967295);
2537
+ var f = (b) => b;
2538
+ if (o === 0) {
2539
+ var p = 32 - 8 * n;
2540
+ f = (b) => b << p >>> p;
1445
2541
  }
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;
1456
- }, ee(e, {
2542
+ var c = r.includes("unsigned"), v = (b, A) => {
2543
+ if (typeof b != "number" && typeof b != "boolean")
2544
+ throw new TypeError(`Cannot convert "${ue(b)}" to ${A}`);
2545
+ if (b < o || b > l)
2546
+ throw new TypeError(`Passing a number "${ue(b)}" from JS side to C/C++ side to an argument of type "${r}", which is outside the valid range [${o}, ${l}]!`);
2547
+ }, m;
2548
+ c ? m = function(b, A) {
2549
+ return v(A, this.name), A >>> 0;
2550
+ } : m = function(b, A) {
2551
+ return v(A, this.name), A;
2552
+ }, ie(t, {
1457
2553
  name: r,
1458
- fromWireType: s,
1459
- toWireType: p,
1460
- argPackAdvance: ie,
1461
- readValueFromPointer: $r(r, t, i !== 0),
2554
+ fromWireType: f,
2555
+ toWireType: m,
2556
+ argPackAdvance: se,
2557
+ readValueFromPointer: yr(r, n, o !== 0),
1462
2558
  destructorFunction: null
1463
2559
  // This type does not need a destructor
1464
2560
  });
1465
- }, Ni = (e, r, t) => {
1466
- var i = [
2561
+ }, Fa = (t, r, n) => {
2562
+ var o = [
1467
2563
  Int8Array,
1468
2564
  Uint8Array,
1469
2565
  Int16Array,
@@ -1474,158 +2570,158 @@ ${p}`, [m, p];
1474
2570
  Float64Array,
1475
2571
  BigInt64Array,
1476
2572
  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);
2573
+ ], l = o[r];
2574
+ function f(p) {
2575
+ var c = x[p >> 2], v = x[p + 4 >> 2];
2576
+ return new l(oe.buffer, v, c);
1481
2577
  }
1482
- t = G(t), ee(e, {
1483
- name: t,
1484
- fromWireType: s,
1485
- argPackAdvance: ie,
1486
- readValueFromPointer: s
2578
+ n = J(n), ie(t, {
2579
+ name: n,
2580
+ fromWireType: f,
2581
+ argPackAdvance: se,
2582
+ readValueFromPointer: f
1487
2583
  }, {
1488
2584
  ignoreDuplicateRegistrations: !0
1489
2585
  });
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;
2586
+ }, Ma = Object.assign({ optional: !0 }, kr), ka = (t, r) => {
2587
+ ie(t, Ma);
2588
+ }, wt = (t) => {
2589
+ for (var r = 0, n = 0; n < t.length; ++n) {
2590
+ var o = t.charCodeAt(n);
2591
+ o <= 127 ? r++ : o <= 2047 ? r += 2 : o >= 55296 && o <= 57343 ? (r += 4, ++n) : r += 3;
1496
2592
  }
1497
2593
  return r;
1498
- }, Hi = (e, r) => {
1499
- r = G(r), ee(e, {
2594
+ }, Ia = (t, r) => {
2595
+ r = J(r), ie(t, {
1500
2596
  name: r,
1501
2597
  // For some method names we use string keys here since they are part of
1502
2598
  // 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;
2599
+ fromWireType(n) {
2600
+ for (var o = x[n >> 2], l = n + 4, f, p, c = l, p = 0; p <= o; ++p) {
2601
+ var v = l + p;
2602
+ if (p == o || ee[v] == 0) {
2603
+ var m = v - c, b = Je(c, m);
2604
+ f === void 0 ? f = b : (f += "\0", f += b), c = v + 1;
1509
2605
  }
1510
2606
  }
1511
- return le(t), s;
2607
+ return ce(n), f;
1512
2608
  },
1513
- toWireType(t, i) {
1514
- 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;
2609
+ toWireType(n, o) {
2610
+ o instanceof ArrayBuffer && (o = new Uint8Array(o));
2611
+ var l, f = typeof o == "string";
2612
+ f || o instanceof Uint8Array || o instanceof Uint8ClampedArray || o instanceof Int8Array || L("Cannot pass non-string to std::string"), f ? l = wt(o) : l = o.length;
2613
+ var p = Ft(4 + l + 1), c = p + 4;
2614
+ if (x[p >> 2] = l, I(l), f)
2615
+ Ue(o, c, l + 1);
2616
+ else if (f)
2617
+ for (var v = 0; v < l; ++v) {
2618
+ var m = o.charCodeAt(v);
2619
+ m > 255 && (ce(p), L("String has UTF-16 code units that do not fit in 8 bits")), ee[c + v] = m;
1524
2620
  }
1525
2621
  else
1526
- for (var d = 0; d < a; ++d)
1527
- H[o + d] = i[d];
1528
- return t !== null && t.push(le, l), l;
2622
+ for (var v = 0; v < l; ++v)
2623
+ ee[c + v] = o[v];
2624
+ return n !== null && n.push(ce, p), p;
1529
2625
  },
1530
- argPackAdvance: ie,
1531
- readValueFromPointer: $e,
1532
- destructorFunction(t) {
1533
- le(t);
2626
+ argPackAdvance: se,
2627
+ readValueFromPointer: De,
2628
+ destructorFunction(n) {
2629
+ ce(n);
1534
2630
  }
1535
2631
  });
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);
2632
+ }, Ir = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, Pa = (t, r) => {
2633
+ h(t % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
2634
+ for (var n = t, o = n >> 1, l = o + r / 2; !(o >= l) && Ye[o]; ) ++o;
2635
+ if (n = o << 1, n - t > 32 && Ir)
2636
+ return Ir.decode(ee.subarray(t, n));
2637
+ for (var f = "", p = 0; !(p >= r / 2); ++p) {
2638
+ var c = Ce[t + p * 2 >> 1];
2639
+ if (c == 0) break;
2640
+ f += String.fromCharCode(c);
1545
2641
  }
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;
2642
+ return f;
2643
+ }, $a = (t, r, n) => {
2644
+ if (h(r % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"), h(typeof n == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), n ??= 2147483647, n < 2) return 0;
2645
+ n -= 2;
2646
+ for (var o = r, l = n < t.length * 2 ? n / 2 : t.length, f = 0; f < l; ++f) {
2647
+ var p = t.charCodeAt(f);
2648
+ Ce[r >> 1] = p, pt(p), r += 2;
1553
2649
  }
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);
2650
+ return Ce[r >> 1] = 0, pt(0), r - o;
2651
+ }, Ra = (t) => t.length * 2, xa = (t, r) => {
2652
+ h(t % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
2653
+ for (var n = 0, o = ""; !(n >= r / 4); ) {
2654
+ var l = k[t + n * 4 >> 2];
2655
+ if (l == 0) break;
2656
+ if (++n, l >= 65536) {
2657
+ var f = l - 65536;
2658
+ o += String.fromCharCode(55296 | f >> 10, 56320 | f & 1023);
1563
2659
  } else
1564
- i += String.fromCharCode(a);
2660
+ o += String.fromCharCode(l);
1565
2661
  }
1566
- 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;
2662
+ return o;
2663
+ }, Ua = (t, r, n) => {
2664
+ if (h(r % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"), h(typeof n == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), n ??= 2147483647, n < 4) return 0;
2665
+ for (var o = r, l = o + n - 4, f = 0; f < t.length; ++f) {
2666
+ var p = t.charCodeAt(f);
2667
+ if (p >= 55296 && p <= 57343) {
2668
+ var c = t.charCodeAt(++f);
2669
+ p = 65536 + ((p & 1023) << 10) | c & 1023;
1574
2670
  }
1575
- if (w[r >> 2] = l, C(l), r += 4, r + 4 > a) break;
2671
+ if (k[r >> 2] = p, I(p), r += 4, r + 4 > l) break;
1576
2672
  }
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;
2673
+ return k[r >> 2] = 0, I(0), r - o;
2674
+ }, Da = (t) => {
2675
+ for (var r = 0, n = 0; n < t.length; ++n) {
2676
+ var o = t.charCodeAt(n);
2677
+ o >= 55296 && o <= 57343 && ++n, r += 4;
1582
2678
  }
1583
2679
  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;
2680
+ }, Oa = (t, r, n) => {
2681
+ n = J(n);
2682
+ var o, l, f, p;
2683
+ r === 2 ? (o = Pa, l = $a, p = Ra, f = (c) => Ye[c >> 1]) : r === 4 && (o = xa, l = Ua, p = Da, f = (c) => x[c >> 2]), ie(t, {
2684
+ name: n,
2685
+ fromWireType: (c) => {
2686
+ for (var v = x[c >> 2], m, b = c + 4, A = 0; A <= v; ++A) {
2687
+ var D = c + 4 + A * r;
2688
+ if (A == v || f(D) == 0) {
2689
+ var j = D - b, V = o(b, j);
2690
+ m === void 0 ? m = V : (m += "\0", m += V), b = D + r;
1595
2691
  }
1596
2692
  }
1597
- return le(o), p;
2693
+ return ce(c), m;
1598
2694
  },
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;
2695
+ toWireType: (c, v) => {
2696
+ typeof v != "string" && L(`Cannot pass non-string to C++ string type ${n}`);
2697
+ var m = p(v), b = Ft(4 + m + r);
2698
+ return x[b >> 2] = m / r, I(m / r), l(v, b + 4, m + r), c !== null && c.push(ce, b), b;
1603
2699
  },
1604
- argPackAdvance: ie,
1605
- readValueFromPointer: $e,
1606
- destructorFunction(o) {
1607
- le(o);
2700
+ argPackAdvance: se,
2701
+ readValueFromPointer: De,
2702
+ destructorFunction(c) {
2703
+ ce(c);
1608
2704
  }
1609
2705
  });
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),
2706
+ }, La = (t, r, n, o, l, f) => {
2707
+ qe[t] = {
2708
+ name: J(r),
2709
+ rawConstructor: le(n, o),
2710
+ rawDestructor: le(l, f),
1615
2711
  fields: []
1616
2712
  };
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
2713
+ }, ja = (t, r, n, o, l, f, p, c, v, m) => {
2714
+ qe[t].fields.push({
2715
+ fieldName: J(r),
2716
+ getterReturnType: n,
2717
+ getter: le(o, l),
2718
+ getterContext: f,
2719
+ setterArgumentType: p,
2720
+ setter: le(c, v),
2721
+ setterContext: m
1626
2722
  });
1627
- }, qi = (e, r) => {
1628
- r = G(r), ee(e, {
2723
+ }, Wa = (t, r) => {
2724
+ r = J(r), ie(t, {
1629
2725
  isVoid: !0,
1630
2726
  // void return values can be optimized out sometimes
1631
2727
  name: r,
@@ -1633,352 +2729,352 @@ ${p}`, [m, p];
1633
2729
  fromWireType: () => {
1634
2730
  },
1635
2731
  // TODO: assert if anything else is given?
1636
- toWireType: (t, i) => {
2732
+ toWireType: (n, o) => {
1637
2733
  }
1638
2734
  });
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);
2735
+ }, Ct = (t, r) => {
2736
+ var n = he[t];
2737
+ return n === void 0 && L(`${r} has unknown type ${Er(t)}`), n;
2738
+ }, Pr = (t, r, n) => {
2739
+ var o = [], l = t.toWireType(o, n);
2740
+ return o.length && (x[r >> 2] = X.toHandle(o)), l;
2741
+ }, Na = (t, r, n) => (t = X.toValue(t), r = Ct(r, "emval::as"), Pr(r, n, t)), $r = (t) => w.handleAsync(async () => {
2742
+ var r = await X.toValue(t);
2743
+ return X.toHandle(r);
1648
2744
  });
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],
1657
- "parameter " + i
2745
+ $r.isAsync = !0;
2746
+ var Et = [], Ba = (t, r, n, o) => (t = Et[t], r = X.toValue(r), t(null, r, n, o)), Ha = (t) => {
2747
+ var r = Et.length;
2748
+ return Et.push(t), r;
2749
+ }, Va = (t, r) => {
2750
+ for (var n = new Array(t), o = 0; o < t; ++o)
2751
+ n[o] = Ct(
2752
+ x[r + o * 4 >> 2],
2753
+ "parameter " + o
1658
2754
  );
1659
- return t;
1660
- }, nn = (e, r, t) => {
1661
- var i = tn(e, r), a = i.shift();
1662
- 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 */
2755
+ return n;
2756
+ }, Ya = (t, r, n) => {
2757
+ var o = Va(t, r), l = o.shift();
2758
+ t--;
2759
+ var f = `return function (obj, func, destructorsRef, args) {
2760
+ `, p = 0, c = [];
2761
+ n === /* FUNCTION */
2762
+ 0 && c.push("obj");
2763
+ for (var v = ["retType"], m = [l], b = 0; b < t; ++b)
2764
+ c.push("arg" + b), v.push("argType" + b), m.push(o[b]), f += ` var arg${b} = argType${b}.readValueFromPointer(args${p ? "+" + p : ""});
2765
+ `, p += o[b].argPackAdvance;
2766
+ var A = n === /* CONSTRUCTOR */
1671
2767
  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);
1697
- }
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;
1700
- return i;
2768
+ f += ` var rv = ${A}(${c.join(", ")});
2769
+ `, l.isVoid || (v.push("emval_returnValue"), m.push(Pr), f += ` return emval_returnValue(retType, destructorsRef, rv);
2770
+ `), f += `};
2771
+ `, v.push(f);
2772
+ var D = Fr(Function, v)(...m), j = `methodCaller<(${o.map((V) => V.name).join(", ")}) => ${l.name}>`;
2773
+ return Ha(Le(j, D));
2774
+ }, za = (t, r) => (t = X.toValue(t), r = X.toValue(r), X.toHandle(t[r])), Ga = (t) => {
2775
+ t > 9 && (re[t + 1] += 1);
2776
+ }, Ja = {}, qa = (t) => {
2777
+ var r = Ja[t];
2778
+ return r === void 0 ? J(t) : r;
2779
+ }, Ka = (t) => X.toHandle(qa(t)), Qa = (t) => {
2780
+ var r = X.toValue(t);
2781
+ yt(r), Tt(t);
2782
+ }, Xa = (t, r) => {
2783
+ t = Ct(t, "_emval_take_value");
2784
+ var n = t.readValueFromPointer(r);
2785
+ return X.toHandle(n);
2786
+ }, Za = 9007199254740992, eo = -9007199254740992, Rr = (t) => t < eo || t > Za ? NaN : Number(t);
2787
+ function to(t, r) {
2788
+ t = Rr(t);
2789
+ var n = new Date(t * 1e3);
2790
+ k[r >> 2] = n.getUTCSeconds(), I(n.getUTCSeconds()), k[r + 4 >> 2] = n.getUTCMinutes(), I(n.getUTCMinutes()), k[r + 8 >> 2] = n.getUTCHours(), I(n.getUTCHours()), k[r + 12 >> 2] = n.getUTCDate(), I(n.getUTCDate()), k[r + 16 >> 2] = n.getUTCMonth(), I(n.getUTCMonth()), k[r + 20 >> 2] = n.getUTCFullYear() - 1900, I(n.getUTCFullYear() - 1900), k[r + 24 >> 2] = n.getUTCDay(), I(n.getUTCDay());
2791
+ var o = Date.UTC(n.getUTCFullYear(), 0, 1, 0, 0, 0, 0), l = (n.getTime() - o) / (1e3 * 60 * 60 * 24) | 0;
2792
+ k[r + 28 >> 2] = l, I(l);
2793
+ }
2794
+ var ro = (t) => t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0), no = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335], io = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], xr = (t) => {
2795
+ var r = ro(t.getFullYear()), n = r ? no : io, o = n[t.getMonth()] + t.getDate() - 1;
2796
+ return o;
1701
2797
  };
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);
1710
- }
1711
- var hn = function(e) {
2798
+ function ao(t, r) {
2799
+ t = Rr(t);
2800
+ var n = new Date(t * 1e3);
2801
+ k[r >> 2] = n.getSeconds(), I(n.getSeconds()), k[r + 4 >> 2] = n.getMinutes(), I(n.getMinutes()), k[r + 8 >> 2] = n.getHours(), I(n.getHours()), k[r + 12 >> 2] = n.getDate(), I(n.getDate()), k[r + 16 >> 2] = n.getMonth(), I(n.getMonth()), k[r + 20 >> 2] = n.getFullYear() - 1900, I(n.getFullYear() - 1900), k[r + 24 >> 2] = n.getDay(), I(n.getDay());
2802
+ var o = xr(n) | 0;
2803
+ k[r + 28 >> 2] = o, I(o), k[r + 36 >> 2] = -(n.getTimezoneOffset() * 60), I(-(n.getTimezoneOffset() * 60));
2804
+ var l = new Date(n.getFullYear(), 0, 1), f = new Date(n.getFullYear(), 6, 1).getTimezoneOffset(), p = l.getTimezoneOffset(), c = (f != p && n.getTimezoneOffset() == Math.min(p, f)) | 0;
2805
+ k[r + 32 >> 2] = c, I(c);
2806
+ }
2807
+ var oo = function(t) {
1712
2808
  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],
2809
+ var n = new Date(
2810
+ k[t + 20 >> 2] + 1900,
2811
+ k[t + 16 >> 2],
2812
+ k[t + 12 >> 2],
2813
+ k[t + 8 >> 2],
2814
+ k[t + 4 >> 2],
2815
+ k[t >> 2],
1720
2816
  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);
1722
- 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);
2817
+ ), o = k[t + 32 >> 2], l = n.getTimezoneOffset(), f = new Date(n.getFullYear(), 0, 1), p = new Date(n.getFullYear(), 6, 1).getTimezoneOffset(), c = f.getTimezoneOffset(), v = Math.min(c, p);
2818
+ if (o < 0)
2819
+ k[t + 32 >> 2] = +(p != c && v == l), I(+(p != c && v == l));
2820
+ else if (o > 0 != (v == l)) {
2821
+ var m = Math.max(c, p), b = o > 0 ? v : m;
2822
+ n.setTime(n.getTime() + (b - l) * 6e4);
1727
2823
  }
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;
2824
+ k[t + 24 >> 2] = n.getDay(), I(n.getDay());
2825
+ var A = xr(n) | 0;
2826
+ k[t + 28 >> 2] = A, I(A), k[t >> 2] = n.getSeconds(), I(n.getSeconds()), k[t + 4 >> 2] = n.getMinutes(), I(n.getMinutes()), k[t + 8 >> 2] = n.getHours(), I(n.getHours()), k[t + 12 >> 2] = n.getDate(), I(n.getDate()), k[t + 16 >> 2] = n.getMonth(), I(n.getMonth()), k[t + 20 >> 2] = n.getYear(), I(n.getYear());
2827
+ var D = n.getTime();
2828
+ return isNaN(D) ? -1 : D / 1e3;
1733
2829
  })();
1734
2830
  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))
2831
+ }, so = (t, r, n, o) => {
2832
+ var l = (/* @__PURE__ */ new Date()).getFullYear(), f = new Date(l, 0, 1), p = new Date(l, 6, 1), c = f.getTimezoneOffset(), v = p.getTimezoneOffset(), m = Math.max(c, v);
2833
+ x[t >> 2] = m * 60, I(m * 60), k[r >> 2] = +(c != v), I(+(c != v));
2834
+ var b = (j) => {
2835
+ var V = j >= 0 ? "-" : "+", q = Math.abs(j), ae = String(Math.floor(q / 60)).padStart(2, "0"), Z = String(q % 60).padStart(2, "0");
2836
+ return `UTC${V}${ae}${Z}`;
2837
+ }, A = b(c), D = b(v);
2838
+ h(A), h(D), h(wt(A) <= 16, `timezone name truncated to fit in TZNAME_MAX (${A})`), h(wt(D) <= 16, `timezone name truncated to fit in TZNAME_MAX (${D})`), v < c ? (Ue(A, n, 17), Ue(D, o, 17)) : (Ue(A, o, 17), Ue(D, n, 17));
2839
+ }, rt = () => performance.now(), Ur = () => Date.now(), lo = (t) => t >= 0 && t <= 3;
2840
+ function co(t, r, n) {
2841
+ if (!lo(t))
1746
2842
  return 28;
1747
- 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;
2843
+ var o;
2844
+ t === 0 ? o = Ur() : o = rt();
2845
+ var l = Math.round(o * 1e3 * 1e3);
2846
+ return ke[n >> 3] = BigInt(l), vt(l), 0;
1751
2847
  }
1752
- var Kr = () => (
2848
+ var Dr = () => (
1753
2849
  // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
1754
2850
  // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
1755
2851
  // for any code that deals with heap sizes, which would require special
1756
2852
  // casing all heap size related code to treat 0 specially.
1757
2853
  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;
2854
+ ), uo = () => Dr(), fo = (t, r) => (h(r, "alignment argument is required"), Math.ceil(t / r) * r), po = (t) => {
2855
+ var r = N.buffer, n = (t - r.byteLength + 65535) / 65536 | 0;
1760
2856
  try {
1761
- return L.grow(t), br(), 1;
1762
- } catch (i) {
1763
- S(`growMemory: Attempted to grow heap from ${r.byteLength} bytes to ${e} bytes, but got error: ${i}`);
2857
+ return N.grow(n), sr(), 1;
2858
+ } catch (o) {
2859
+ F(`growMemory: Attempted to grow heap from ${r.byteLength} bytes to ${t} bytes, but got error: ${o}`);
1764
2860
  }
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;
1771
- 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)
2861
+ }, vo = (t) => {
2862
+ var r = ee.length;
2863
+ t >>>= 0, h(t > r);
2864
+ var n = Dr();
2865
+ if (t > n)
2866
+ return F(`Cannot enlarge memory, requested ${t} bytes, but the limit is ${n} bytes!`), !1;
2867
+ for (var o = 1; o <= 4; o *= 2) {
2868
+ var l = r * (1 + 0.2 / o);
2869
+ l = Math.min(l, t + 100663296);
2870
+ var f = Math.min(n, fo(Math.max(t, l), 65536)), p = rt(), c = po(f), v = rt();
2871
+ if (ii(`Heap resize call from ${r} to ${f} took ${v - p} msecs. Success: ${!!c}`), c)
1776
2872
  return !0;
1777
2873
  }
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 = {
2874
+ return F(`Failed to grow the heap from ${r} bytes to ${f} bytes, not enough memory!`), !1;
2875
+ }, St = {}, yo = () => M || "./this.program", je = () => {
2876
+ if (!je.strings) {
2877
+ var t = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", r = {
1782
2878
  USER: "web_user",
1783
2879
  LOGNAME: "web_user",
1784
2880
  PATH: "/",
1785
2881
  PWD: "/",
1786
2882
  HOME: "/home/web_user",
1787
- LANG: e,
1788
- _: An()
2883
+ LANG: t,
2884
+ _: yo()
1789
2885
  };
1790
- for (var t in lr)
1791
- lr[t] === void 0 ? delete r[t] : r[t] = lr[t];
1792
- var i = [];
1793
- for (var t in r)
1794
- i.push(`${t}=${r[t]}`);
1795
- ke.strings = i;
2886
+ for (var n in St)
2887
+ St[n] === void 0 ? delete r[n] : r[n] = St[n];
2888
+ var o = [];
2889
+ for (var n in r)
2890
+ o.push(`${n}=${r[n]}`);
2891
+ je.strings = o;
1796
2892
  }
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;
2893
+ return je.strings;
2894
+ }, go = (t, r) => {
2895
+ for (var n = 0; n < t.length; ++n)
2896
+ h(t.charCodeAt(n) === (t.charCodeAt(n) & 255)), oe[r++] = t.charCodeAt(n), Ie(t.charCodeAt(n));
2897
+ oe[r] = 0, Ie(0);
2898
+ }, mo = (t, r) => {
2899
+ var n = 0;
2900
+ return je().forEach((o, l) => {
2901
+ var f = r + n;
2902
+ x[t + l * 4 >> 2] = f, I(f), go(o, f), n += o.length + 1;
1807
2903
  }), 0;
1808
- }, In = (e, r) => {
1809
- var t = ke();
1810
- F[e >> 2] = t.length, C(t.length);
1811
- 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;
2904
+ }, _o = (t, r) => {
2905
+ var n = je();
2906
+ x[t >> 2] = n.length, I(n.length);
2907
+ var o = 0;
2908
+ return n.forEach((l) => o += l.length + 1), x[r >> 2] = o, I(o), 0;
2909
+ }, ho = (t) => {
2910
+ W("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM");
2911
+ }, bo = (t, r) => {
2912
+ var n = 0, o = 0, l = 0;
1817
2913
  {
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;
2914
+ h(t == 0 || t == 1 || t == 2);
2915
+ var f = 2;
2916
+ t == 0 ? n = 2 : (t == 1 || t == 2) && (n = 64), l = 1;
1821
2917
  }
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");
2918
+ return oe[r] = f, Ie(f), Ce[r + 2 >> 1] = l, pt(l), ke[r + 8 >> 3] = BigInt(n), vt(n), ke[r + 16 >> 3] = BigInt(o), vt(o), 0;
2919
+ }, To = (t, r, n, o) => {
2920
+ W("fd_read called without SYSCALLS_REQUIRE_FILESYSTEM");
1825
2921
  };
1826
- function Dn(e, r, t, i) {
2922
+ function wo(t, r, n, o) {
1827
2923
  return 70;
1828
2924
  }
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];
2925
+ var Co = [null, [], []], Eo = (t, r) => {
2926
+ var n = Co[t];
2927
+ h(n), r === 0 || r === 10 ? ((t === 1 ? U : F)(fr(n)), n.length = 0) : n.push(r);
2928
+ }, So = (t, r, n, o) => {
2929
+ for (var l = 0, f = 0; f < n; f++) {
2930
+ var p = x[r >> 2], c = x[r + 4 >> 2];
1835
2931
  r += 8;
1836
- for (var d = 0; d < o; d++)
1837
- xn(e, H[l + d]);
1838
- a += o;
2932
+ for (var v = 0; v < c; v++)
2933
+ Eo(t, ee[p + v]);
2934
+ l += c;
1839
2935
  }
1840
- return F[i >> 2] = a, C(a), 0;
2936
+ return x[o >> 2] = l, I(l), 0;
1841
2937
  };
1842
- Fr = n.InternalError = class extends Error {
2938
+ pr = a.InternalError = class extends Error {
1843
2939
  constructor(r) {
1844
2940
  super(r), this.name = "InternalError";
1845
2941
  }
1846
- }, Zt(), he = n.BindingError = class extends Error {
2942
+ }, Ni(), Ae = a.BindingError = class extends Error {
1847
2943
  constructor(r) {
1848
2944
  super(r), this.name = "BindingError";
1849
2945
  }
1850
- }, li(), gi(), xr = n.UnboundTypeError = Ci(Error, "UnboundTypeError"), Di();
1851
- function Ln() {
1852
- at("fetchSettings");
2946
+ }, Ki(), aa(), Cr = a.UnboundTypeError = ca(Error, "UnboundTypeError"), wa();
2947
+ function Ao() {
2948
+ Gn("fetchSettings");
1853
2949
  }
1854
- var dr = {
2950
+ var At = {
1855
2951
  /** @export */
1856
- __assert_fail: Rt,
2952
+ __assert_fail: Ti,
1857
2953
  /** @export */
1858
- __cxa_throw: Ut,
2954
+ __cxa_throw: Ci,
1859
2955
  /** @export */
1860
- __handle_stack_overflow: xt,
2956
+ __handle_stack_overflow: Ei,
1861
2957
  /** @export */
1862
- __syscall_faccessat: Ot,
2958
+ __syscall_faccessat: Si,
1863
2959
  /** @export */
1864
- __syscall_fcntl64: Lt,
2960
+ __syscall_fcntl64: Ai,
1865
2961
  /** @export */
1866
- __syscall_fstat64: Nt,
2962
+ __syscall_fstat64: Fi,
1867
2963
  /** @export */
1868
- __syscall_getdents64: Wt,
2964
+ __syscall_getdents64: ki,
1869
2965
  /** @export */
1870
- __syscall_ioctl: Ht,
2966
+ __syscall_ioctl: Ii,
1871
2967
  /** @export */
1872
- __syscall_lstat64: Bt,
2968
+ __syscall_lstat64: Pi,
1873
2969
  /** @export */
1874
- __syscall_mkdirat: Vt,
2970
+ __syscall_mkdirat: $i,
1875
2971
  /** @export */
1876
- __syscall_newfstatat: Yt,
2972
+ __syscall_newfstatat: Ri,
1877
2973
  /** @export */
1878
- __syscall_openat: zt,
2974
+ __syscall_openat: xi,
1879
2975
  /** @export */
1880
- __syscall_renameat: Gt,
2976
+ __syscall_renameat: Ui,
1881
2977
  /** @export */
1882
- __syscall_rmdir: Jt,
2978
+ __syscall_rmdir: Di,
1883
2979
  /** @export */
1884
- __syscall_stat64: Kt,
2980
+ __syscall_stat64: Oi,
1885
2981
  /** @export */
1886
- __syscall_unlinkat: Qt,
2982
+ __syscall_unlinkat: Li,
1887
2983
  /** @export */
1888
- _abort_js: Xt,
2984
+ _abort_js: ji,
1889
2985
  /** @export */
1890
- _embind_finalize_value_object: qt,
2986
+ _embind_finalize_value_object: Wi,
1891
2987
  /** @export */
1892
- _embind_register_bigint: ri,
2988
+ _embind_register_bigint: Hi,
1893
2989
  /** @export */
1894
- _embind_register_bool: ti,
2990
+ _embind_register_bool: Vi,
1895
2991
  /** @export */
1896
- _embind_register_class: Ti,
2992
+ _embind_register_class: ua,
1897
2993
  /** @export */
1898
- _embind_register_class_constructor: Ii,
2994
+ _embind_register_class_constructor: _a,
1899
2995
  /** @export */
1900
- _embind_register_class_function: Mi,
2996
+ _embind_register_class_function: ba,
1901
2997
  /** @export */
1902
- _embind_register_emval: Ui,
2998
+ _embind_register_emval: Ca,
1903
2999
  /** @export */
1904
- _embind_register_float: Oi,
3000
+ _embind_register_float: Sa,
1905
3001
  /** @export */
1906
- _embind_register_integer: Li,
3002
+ _embind_register_integer: Aa,
1907
3003
  /** @export */
1908
- _embind_register_memory_view: Ni,
3004
+ _embind_register_memory_view: Fa,
1909
3005
  /** @export */
1910
- _embind_register_optional: Wi,
3006
+ _embind_register_optional: ka,
1911
3007
  /** @export */
1912
- _embind_register_std_string: Hi,
3008
+ _embind_register_std_string: Ia,
1913
3009
  /** @export */
1914
- _embind_register_std_wstring: Ki,
3010
+ _embind_register_std_wstring: Oa,
1915
3011
  /** @export */
1916
- _embind_register_value_object: Qi,
3012
+ _embind_register_value_object: La,
1917
3013
  /** @export */
1918
- _embind_register_value_object_field: Xi,
3014
+ _embind_register_value_object_field: ja,
1919
3015
  /** @export */
1920
- _embind_register_void: qi,
3016
+ _embind_register_void: Wa,
1921
3017
  /** @export */
1922
- _emval_as: Zi,
3018
+ _emval_as: Na,
1923
3019
  /** @export */
1924
- _emval_await: Yr,
3020
+ _emval_await: $r,
1925
3021
  /** @export */
1926
- _emval_call: en,
3022
+ _emval_call: Ba,
1927
3023
  /** @export */
1928
- _emval_decref: nr,
3024
+ _emval_decref: Tt,
1929
3025
  /** @export */
1930
- _emval_get_method_caller: nn,
3026
+ _emval_get_method_caller: Ya,
1931
3027
  /** @export */
1932
- _emval_get_property: an,
3028
+ _emval_get_property: za,
1933
3029
  /** @export */
1934
- _emval_incref: on,
3030
+ _emval_incref: Ga,
1935
3031
  /** @export */
1936
- _emval_new_cstring: dn,
3032
+ _emval_new_cstring: Ka,
1937
3033
  /** @export */
1938
- _emval_run_destructors: cn,
3034
+ _emval_run_destructors: Qa,
1939
3035
  /** @export */
1940
- _emval_take_value: un,
3036
+ _emval_take_value: Xa,
1941
3037
  /** @export */
1942
- _gmtime_js: pn,
3038
+ _gmtime_js: to,
1943
3039
  /** @export */
1944
- _localtime_js: mn,
3040
+ _localtime_js: ao,
1945
3041
  /** @export */
1946
- _mktime_js: hn,
3042
+ _mktime_js: oo,
1947
3043
  /** @export */
1948
- _tzset_js: bn,
3044
+ _tzset_js: so,
1949
3045
  /** @export */
1950
- clock_time_get: Cn,
3046
+ clock_time_get: co,
1951
3047
  /** @export */
1952
- emscripten_date_now: Jr,
3048
+ emscripten_date_now: Ur,
1953
3049
  /** @export */
1954
- emscripten_get_heap_max: Tn,
3050
+ emscripten_get_heap_max: uo,
1955
3051
  /** @export */
1956
- emscripten_get_now: Ve,
3052
+ emscripten_get_now: rt,
1957
3053
  /** @export */
1958
- emscripten_resize_heap: Fn,
3054
+ emscripten_resize_heap: vo,
1959
3055
  /** @export */
1960
- environ_get: Pn,
3056
+ environ_get: mo,
1961
3057
  /** @export */
1962
- environ_sizes_get: In,
3058
+ environ_sizes_get: _o,
1963
3059
  /** @export */
1964
- fd_close: kn,
3060
+ fd_close: ho,
1965
3061
  /** @export */
1966
- fd_fdstat_get: Mn,
3062
+ fd_fdstat_get: bo,
1967
3063
  /** @export */
1968
- fd_read: Rn,
3064
+ fd_read: To,
1969
3065
  /** @export */
1970
- fd_seek: Dn,
3066
+ fd_seek: wo,
1971
3067
  /** @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 = [
3068
+ fd_write: So
3069
+ }, z = await gi(), Fo = g("__getTypeName", 1), ce = g("free", 1), Ft = g("malloc", 1), Mo = z.emscripten_stack_init;
3070
+ z.emscripten_stack_get_free;
3071
+ var Or = z.emscripten_stack_get_base, nt = z.emscripten_stack_get_end;
3072
+ z._emscripten_stack_restore, z._emscripten_stack_alloc;
3073
+ var ko = z.emscripten_stack_get_current, Io = a.___set_stack_limits = g("__set_stack_limits", 2);
3074
+ a.dynCall_v = g("dynCall_v", 1), a.dynCall_ii = g("dynCall_ii", 2), a.dynCall_viiii = g("dynCall_viiii", 5), a.dynCall_dd = g("dynCall_dd", 2), a.dynCall_vii = g("dynCall_vii", 3), a.dynCall_iii = g("dynCall_iii", 3), a.dynCall_iiii = g("dynCall_iiii", 4), a.dynCall_iiiiii = g("dynCall_iiiiii", 6), a.dynCall_ijii = g("dynCall_ijii", 4), a.dynCall_iiiiiii = g("dynCall_iiiiiii", 7), a.dynCall_vi = g("dynCall_vi", 2), a.dynCall_iiiii = g("dynCall_iiiii", 5), a.dynCall_viiiiii = g("dynCall_viiiiii", 7), a.dynCall_viiiiij = g("dynCall_viiiiij", 7), a.dynCall_viiiii = g("dynCall_viiiii", 6), a.dynCall_viii = g("dynCall_viii", 4), a.dynCall_viiiiiiiiii = g("dynCall_viiiiiiiiii", 11), a.dynCall_viiiiiiiiiii = g("dynCall_viiiiiiiiiii", 12), a.dynCall_viiiiiii = g("dynCall_viiiiiii", 8), a.dynCall_viiiiiiiiiiiiii = g("dynCall_viiiiiiiiiiiiii", 15), a.dynCall_viiiiiiiii = g("dynCall_viiiiiiiii", 10), a.dynCall_iiiiiiiii = g("dynCall_iiiiiiiii", 9), a.dynCall_did = g("dynCall_did", 3), a.dynCall_viiiiiiii = g("dynCall_viiiiiiii", 9), a.dynCall_viifi = g("dynCall_viifi", 5), a.dynCall_diii = g("dynCall_diii", 4), a.dynCall_fiii = g("dynCall_fiii", 4), a.dynCall_viidi = g("dynCall_viidi", 5), a.dynCall_fiiiiiiiiffii = g("dynCall_fiiiiiiiiffii", 13), a.dynCall_viiif = g("dynCall_viiif", 5), a.dynCall_viiiif = g("dynCall_viiiif", 6), a.dynCall_viiiiiiifi = g("dynCall_viiiiiiifi", 10), a.dynCall_iiijiiii = g("dynCall_iiijiiii", 8), a.dynCall_viiiiiiff = g("dynCall_viiiiiiff", 9), a.dynCall_viiiff = g("dynCall_viiiff", 6), a.dynCall_viiiffi = g("dynCall_viiiffi", 7), a.dynCall_fiiii = g("dynCall_fiiii", 5), a.dynCall_iiiiiiiiiiiiiifii = g("dynCall_iiiiiiiiiiiiiifii", 17), a.dynCall_iiiiiiii = g("dynCall_iiiiiiii", 8), a.dynCall_jii = g("dynCall_jii", 3), a.dynCall_iiiiiiiiii = g("dynCall_iiiiiiiiii", 10), a.dynCall_iij = g("dynCall_iij", 3), a.dynCall_i = g("dynCall_i", 1), a.dynCall_viiiiiiiiiiii = g("dynCall_viiiiiiiiiiii", 13), a.dynCall_viiiifiiiiiiifi = g("dynCall_viiiifiiiiiiifi", 15), a.dynCall_iiiiiiiiiiiiii = g("dynCall_iiiiiiiiiiiiii", 14), a.dynCall_viiiiiiiiiiiii = g("dynCall_viiiiiiiiiiiii", 14), a.dynCall_viiiiiiiiiiiiiiii = g("dynCall_viiiiiiiiiiiiiiii", 17), a.dynCall_viiiiiifi = g("dynCall_viiiiiifi", 9), a.dynCall_viiiifii = g("dynCall_viiiifii", 8), a.dynCall_fii = g("dynCall_fii", 3), a.dynCall_viiiffiii = g("dynCall_viiiffiii", 9), a.dynCall_viiiiiiiiiiif = g("dynCall_viiiiiiiiiiif", 13), a.dynCall_viiiiifi = g("dynCall_viiiiifi", 8), a.dynCall_fiifii = g("dynCall_fiifii", 6), a.dynCall_viiijj = g("dynCall_viiijj", 6), a.dynCall_iiiiiiidiiddii = g("dynCall_iiiiiiidiiddii", 14), a.dynCall_jij = g("dynCall_jij", 3), a.dynCall_iiij = g("dynCall_iiij", 4), a.dynCall_jiji = g("dynCall_jiji", 4), a.dynCall_iiiji = g("dynCall_iiiji", 5), a.dynCall_iiijjji = g("dynCall_iiijjji", 7), a.dynCall_jiiij = g("dynCall_jiiij", 5), a.dynCall_iiiiij = g("dynCall_iiiiij", 6), a.dynCall_iiiiiij = g("dynCall_iiiiiij", 7), a.dynCall_jiiji = g("dynCall_jiiji", 5), a.dynCall_viiid = g("dynCall_viiid", 5), a.dynCall_viif = g("dynCall_viif", 4), a.dynCall_dii = g("dynCall_dii", 3), a.dynCall_viid = g("dynCall_viid", 4), a.dynCall_iiiid = g("dynCall_iiiid", 5), a.dynCall_diiii = g("dynCall_diiii", 5), a.dynCall_iidiiii = g("dynCall_iidiiii", 7);
3075
+ var Po = g("asyncify_start_unwind", 1), $o = g("asyncify_stop_unwind", 0), Ro = g("asyncify_start_rewind", 1), xo = g("asyncify_stop_rewind", 0);
3076
+ a._ff_h264_cabac_tables = 1257737;
3077
+ var Uo = [
1982
3078
  "writeI53ToI64",
1983
3079
  "writeI53ToI64Clamped",
1984
3080
  "writeI53ToI64Signaling",
@@ -2145,8 +3241,8 @@ ${p}`, [m, p];
2145
3241
  "validateThis",
2146
3242
  "emval_get_global"
2147
3243
  ];
2148
- Gn.forEach(st);
2149
- var Jn = [
3244
+ Uo.forEach(qn);
3245
+ var Do = [
2150
3246
  "run",
2151
3247
  "addRunDependency",
2152
3248
  "removeRunDependency",
@@ -2345,202 +3441,207 @@ ${p}`, [m, p];
2345
3441
  "emval_addMethodCaller",
2346
3442
  "reflectConstruct"
2347
3443
  ];
2348
- Jn.forEach(hr);
2349
- var Xr;
2350
- function Kn() {
2351
- jn(), nt();
2352
- }
2353
- function ur() {
2354
- if (fe > 0) {
2355
- Te = ur;
3444
+ Do.forEach(or);
3445
+ var Lr;
3446
+ function Oo() {
3447
+ Mo(), zn();
3448
+ }
3449
+ function Mt() {
3450
+ if (me > 0) {
3451
+ Pe = Mt;
2356
3452
  return;
2357
3453
  }
2358
- if (Kn(), gt(), fe > 0) {
2359
- Te = ur;
3454
+ if (Oo(), ai(), me > 0) {
3455
+ Pe = Mt;
2360
3456
  return;
2361
3457
  }
2362
- 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());
3458
+ function t() {
3459
+ h(!Lr), Lr = !0, a.calledRun = !0, !Y && (oi(), _(a), a.onRuntimeInitialized?.(), h(!a._main, 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'), si());
2364
3460
  }
2365
- n.setStatus ? (n.setStatus("Running..."), setTimeout(() => {
2366
- setTimeout(() => n.setStatus(""), 1), e();
2367
- }, 1)) : e(), De();
2368
- }
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, {
3461
+ a.setStatus ? (a.setStatus("Running..."), setTimeout(() => {
3462
+ setTimeout(() => a.setStatus(""), 1), t();
3463
+ }, 1)) : t(), ze();
3464
+ }
3465
+ if (a.preInit)
3466
+ for (typeof a.preInit == "function" && (a.preInit = [a.preInit]); a.preInit.length > 0; )
3467
+ a.preInit.pop()();
3468
+ Mt(), y = E;
3469
+ for (const t of Object.keys(a))
3470
+ t in d || Object.defineProperty(d, t, {
2375
3471
  configurable: !0,
2376
3472
  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.`);
3473
+ W(`Access to module property ('${t}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
2378
3474
  }
2379
3475
  });
2380
- return D;
3476
+ return y;
2381
3477
  };
2382
3478
  })();
2383
3479
  (() => {
2384
- var b = u;
2385
- u = function(R) {
3480
+ var u = s;
3481
+ s = function(d) {
2386
3482
  if (new.target) throw new Error("Module() should not be called with `new Module()`");
2387
- return b(R);
3483
+ return u(d);
2388
3484
  };
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)
3485
+ })(), e.exports = s, e.exports.default = s;
3486
+ })(nd);
3487
+ const id = Ht, ad = (e, i) => id({
3488
+ locateFile: (s) => `${e}${s.replace("/dist", "")}`,
3489
+ print: (s) => console.log(s),
3490
+ printErr: (s) => s.includes("Read error at pos") ? void 0 : console.error(s)
2395
3491
  // print: (text: string) => log(false, text),
2396
3492
  // 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);
3493
+ }), fe = (e) => Array(e.size()).fill(void 0).map((i, s) => e.get(s)), od = {
3494
+ makeRemuxer: async ({ publicPath: e, length: i, bufferSize: s, audioStreamIndex: u, log: d }) => {
3495
+ const y = await ad(e), a = new y.Remuxer({ resolvedPromise: Promise.resolve(), length: i, bufferSize: s, audioStreamIndex: u }), _ = {
3496
+ init: ($) => a.init($).then((T) => {
3497
+ const U = new Uint8Array(T.data.byteLength);
3498
+ return U.set(T.data), {
3499
+ data: U.buffer,
3500
+ videoExtradata: new Uint8Array(fe(T.videoExtradata)).buffer,
3501
+ attachments: fe(T.attachments).map((F) => {
3502
+ const B = new Uint8Array(y.HEAPU8.buffer, F.ptr, F.size), N = new Uint8Array(B);
2407
3503
  return {
2408
- filename: I.filename,
2409
- mimetype: I.mimetype,
2410
- data: x.buffer
3504
+ filename: F.filename,
3505
+ mimetype: F.mimetype,
3506
+ data: N.buffer
2411
3507
  };
2412
3508
  }),
2413
- subtitles: _e(h.subtitles).map((I) => {
2414
- if (!I.isHeader) throw new Error("Subtitle type is not header");
2415
- const { isHeader: S, data: x, ...L } = I;
3509
+ subtitles: fe(T.subtitles).map((F) => {
3510
+ if (!F.isHeader) throw new Error("Subtitle type is not header");
3511
+ const { isHeader: B, data: N, ...Y } = F;
2416
3512
  return {
2417
- ...L,
3513
+ ...Y,
2418
3514
  type: "header",
2419
- content: x
3515
+ content: N
2420
3516
  };
2421
3517
  }),
2422
- indexes: _e(h.indexes).map(({ index: I, timestamp: S, pos: x }) => ({
2423
- index: I,
2424
- timestamp: S,
2425
- pos: x
3518
+ audioStreams: fe(T.audioStreams).map(({ streamIndex: F, language: B, title: N }) => ({
3519
+ streamIndex: F,
3520
+ language: B,
3521
+ title: N
3522
+ })),
3523
+ indexes: fe(T.indexes).map(({ index: F, timestamp: B, pos: N }) => ({
3524
+ index: F,
3525
+ timestamp: B,
3526
+ pos: N
2426
3527
  })),
2427
- chapters: _e(h.chapters).map(({ index: I, start: S, end: x, title: L }) => ({
2428
- index: I,
2429
- start: S,
2430
- end: x,
2431
- title: L
3528
+ chapters: fe(T.chapters).map(({ index: F, start: B, end: N, title: Y }) => ({
3529
+ index: F,
3530
+ start: B,
3531
+ end: N,
3532
+ title: Y
2432
3533
  })),
2433
3534
  info: {
2434
3535
  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
3536
+ audioMimeType: T.info.input.audioMimeType,
3537
+ duration: T.info.input.duration,
3538
+ formatName: T.info.input.formatName,
3539
+ mimeType: T.info.input.mimeType,
3540
+ videoMimeType: T.info.input.videoMimeType
2440
3541
  },
2441
3542
  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
3543
+ audioMimeType: T.info.output.audioMimeType,
3544
+ duration: T.info.output.duration,
3545
+ formatName: T.info.output.formatName,
3546
+ mimeType: T.info.output.mimeType,
3547
+ videoMimeType: T.info.output.videoMimeType
2447
3548
  }
2448
3549
  }
2449
3550
  };
2450
3551
  }),
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)), {
2456
- 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;
3552
+ destroy: () => a.destroy(),
3553
+ seek: ($, T) => a.seek($, T * 1e3).then((U) => {
3554
+ if (U.cancelled) throw new Error("Cancelled");
3555
+ const F = new Uint8Array(U.data.byteLength);
3556
+ return F.set(new Uint8Array(U.data)), {
3557
+ data: F.buffer,
3558
+ subtitles: fe(U.subtitles).map((B) => {
3559
+ if (B.isHeader) throw new Error("Subtitle type is header");
3560
+ const { isHeader: N, data: Y, ...Q } = B;
2460
3561
  return {
2461
- ...T,
3562
+ ...Q,
2462
3563
  type: "dialogue",
2463
- content: L
3564
+ content: Y
2464
3565
  };
2465
3566
  }),
2466
- offset: $.offset,
2467
- pts: $.pts,
2468
- duration: $.duration,
2469
- cancelled: $.cancelled,
2470
- finished: $.finished
3567
+ offset: U.offset,
3568
+ pts: U.pts,
3569
+ duration: U.duration,
3570
+ cancelled: U.cancelled,
3571
+ finished: U.finished
2471
3572
  };
2472
3573
  }),
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) => {
2479
- if (I.isHeader) throw new Error("Subtitle type is header");
2480
- const { isHeader: S, data: x, ...L } = I;
3574
+ read: ($) => a.read($).then((T) => {
3575
+ if (T.cancelled) throw new Error("Cancelled");
3576
+ const U = new Uint8Array(T.data.byteLength);
3577
+ return U.set(new Uint8Array(T.data)), {
3578
+ data: U.buffer,
3579
+ subtitles: fe(T.subtitles).map((F) => {
3580
+ if (F.isHeader) throw new Error("Subtitle type is header");
3581
+ const { isHeader: B, data: N, ...Y } = F;
2481
3582
  return {
2482
- ...L,
3583
+ ...Y,
2483
3584
  type: "dialogue",
2484
- content: x
3585
+ content: N
2485
3586
  };
2486
3587
  }),
2487
- offset: h.offset,
2488
- pts: h.pts,
2489
- duration: h.duration,
2490
- cancelled: h.cancelled,
2491
- finished: h.finished
3588
+ offset: T.offset,
3589
+ pts: T.pts,
3590
+ duration: T.duration,
3591
+ cancelled: T.cancelled,
3592
+ finished: T.finished
2492
3593
  };
2493
3594
  }),
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)), {
2498
- data: I.buffer,
2499
- pts: $.pts,
2500
- duration: $.duration,
2501
- offset: $.offset,
2502
- cancelled: $.cancelled
3595
+ readKeyframe: ($, T) => a.readKeyframe($, T).then((U) => {
3596
+ if (U.cancelled) throw new Error("Cancelled");
3597
+ const F = new Uint8Array(U.data.byteLength);
3598
+ return F.set(new Uint8Array(U.data)), {
3599
+ data: F.buffer,
3600
+ pts: U.pts,
3601
+ duration: U.duration,
3602
+ offset: U.offset,
3603
+ cancelled: U.cancelled
2503
3604
  };
2504
3605
  })
2505
- }, N = (E) => (h, $) => E(Number(h), Number($)).then(
2506
- ({ resolved: I, rejected: S }) => ({ resolved: new Uint8Array(I), rejected: S }),
3606
+ }, C = ($) => (T, U) => $(Number(T), Number(U)).then(
3607
+ ({ resolved: F, rejected: B }) => ({ resolved: new Uint8Array(F), rejected: B }),
2507
3608
  () => ({ resolved: new Uint8Array(0), rejected: !0 })
2508
3609
  );
2509
- let W, Y;
2510
- const z = new VideoDecoder({
2511
- output: (E) => {
2512
- W?.(E), W = void 0, Y = void 0;
3610
+ let E, S;
3611
+ const M = new VideoDecoder({
3612
+ output: ($) => {
3613
+ E?.($), E = void 0, S = void 0;
2513
3614
  },
2514
- error: (E) => {
2515
- Y?.(E), W = void 0, Y = void 0;
3615
+ error: ($) => {
3616
+ S?.($), E = void 0, S = void 0;
2516
3617
  }
2517
- }), ae = new OffscreenCanvas(200 * 16 / 9, 200), de = ae.getContext("2d");
2518
- if (!de) throw new Error("OffscreenCanvas not supported");
3618
+ }), P = new OffscreenCanvas(200 * 16 / 9, 200), R = P.getContext("2d");
3619
+ if (!R) throw new Error("OffscreenCanvas not supported");
2519
3620
  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;
3621
+ destroy: async () => _.destroy(),
3622
+ init: async ($) => {
3623
+ const T = await _.init(C($));
3624
+ return M.state === "unconfigured" && M.configure({
3625
+ codec: T.info.input.videoMimeType,
3626
+ description: T.videoExtradata
3627
+ }), T;
2527
3628
  },
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({
3629
+ seek: ($, T) => _.seek(C($), T),
3630
+ read: ($) => _.read(C($)),
3631
+ readKeyframe: async ($, T) => {
3632
+ const U = new Promise((N, Y) => {
3633
+ E = N, S = Y;
3634
+ }), F = await _.readKeyframe(C($), T);
3635
+ M.decode(new EncodedVideoChunk({
2535
3636
  type: "key",
2536
- timestamp: I.pts,
2537
- duration: I.duration,
2538
- 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());
3637
+ timestamp: F.pts,
3638
+ duration: F.duration,
3639
+ data: F.data
3640
+ })), M.flush();
3641
+ const B = await U;
3642
+ return R.drawImage(B, 0, 0, 200 * 16 / 9, 200), B.close(), P.convertToBlob().then((N) => N.arrayBuffer());
2542
3643
  }
2543
3644
  };
2544
3645
  }
2545
3646
  };
2546
- va(ga, { remote: globalThis, local: globalThis });
3647
+ rd(od, { transport: globalThis });