@monaco-neovim-wasm/lib 0.1.7 → 0.1.8

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.
@@ -1,134 +1,1453 @@
1
- import { W as pt, j as rt, k as ht, l as q, m as mt, n as J, o as _t, E as it, p as wt, e as w, g as gt, D as C, F as ot, a as Q, P as Z, b as at, c as ct, R as bt, d as ft, f as Et, h as T, C as At, q as kt, S as St, i as lt } from "./msgpack-BSNDwQ9a.js";
2
- let F = null, _ = null, f = null, u = null, x = null, S = null, B = null, M = 0, G = 0, V = 0;
3
- const vt = new TextDecoder();
4
- let W = "", H = !1, L = null, O = null;
5
- const Y = [];
6
- self.addEventListener("error", (t) => {
7
- if (H) return;
8
- H = !0;
9
- const e = t.message || String(t.error || "worker error"), n = t.error?.stack;
1
+ class fe {
2
+ static read_bytes(e, t) {
3
+ const i = new fe();
4
+ return i.buf = e.getUint32(t, !0), i.buf_len = e.getUint32(t + 4, !0), i;
5
+ }
6
+ static read_bytes_array(e, t, i) {
7
+ const a = [];
8
+ for (let r = 0; r < i; r++)
9
+ a.push(fe.read_bytes(e, t + 8 * r));
10
+ return a;
11
+ }
12
+ }
13
+ class le {
14
+ static read_bytes(e, t) {
15
+ const i = new le();
16
+ return i.buf = e.getUint32(t, !0), i.buf_len = e.getUint32(t + 4, !0), i;
17
+ }
18
+ static read_bytes_array(e, t, i) {
19
+ const a = [];
20
+ for (let r = 0; r < i; r++)
21
+ a.push(le.read_bytes(e, t + 8 * r));
22
+ return a;
23
+ }
24
+ }
25
+ const bt = 0, Ut = 1, at = 2, I = 3, $ = 4;
26
+ class ve {
27
+ head_length() {
28
+ return 24;
29
+ }
30
+ name_length() {
31
+ return this.dir_name.byteLength;
32
+ }
33
+ write_head_bytes(e, t) {
34
+ e.setBigUint64(t, this.d_next, !0), e.setBigUint64(t + 8, this.d_ino, !0), e.setUint32(t + 16, this.dir_name.length, !0), e.setUint8(t + 20, this.d_type);
35
+ }
36
+ write_name_bytes(e, t, i) {
37
+ e.set(this.dir_name.slice(0, Math.min(this.dir_name.byteLength, i)), t);
38
+ }
39
+ constructor(e, t, i, a) {
40
+ const r = new TextEncoder().encode(i);
41
+ this.d_next = e, this.d_ino = t, this.d_namlen = r.byteLength, this.d_type = a, this.dir_name = r;
42
+ }
43
+ }
44
+ const At = 1;
45
+ class Oe {
46
+ write_bytes(e, t) {
47
+ e.setUint8(t, this.fs_filetype), e.setUint16(t + 2, this.fs_flags, !0), e.setBigUint64(t + 8, this.fs_rights_base, !0), e.setBigUint64(t + 16, this.fs_rights_inherited, !0);
48
+ }
49
+ constructor(e, t) {
50
+ this.fs_rights_base = 0n, this.fs_rights_inherited = 0n, this.fs_filetype = e, this.fs_flags = t;
51
+ }
52
+ }
53
+ const De = 1, J = 2, Je = 4, Qe = 8;
54
+ class ot {
55
+ write_bytes(e, t) {
56
+ e.setBigUint64(t, this.dev, !0), e.setBigUint64(t + 8, this.ino, !0), e.setUint8(t + 16, this.filetype), e.setBigUint64(t + 24, this.nlink, !0), e.setBigUint64(t + 32, this.size, !0), e.setBigUint64(t + 38, this.atim, !0), e.setBigUint64(t + 46, this.mtim, !0), e.setBigUint64(t + 52, this.ctim, !0);
57
+ }
58
+ constructor(e, t, i) {
59
+ this.dev = 0n, this.nlink = 0n, this.atim = 0n, this.mtim = 0n, this.ctim = 0n, this.ino = e, this.filetype = t, this.size = i;
60
+ }
61
+ }
62
+ const ft = 0, vt = 1, Ze = 2, lt = 1;
63
+ class Ve {
64
+ static read_bytes(e, t) {
65
+ return new Ve(e.getBigUint64(t, !0), e.getUint8(t + 8), e.getUint32(t + 16, !0), e.getBigUint64(t + 24, !0), e.getUint16(t + 36, !0));
66
+ }
67
+ constructor(e, t, i, a, r) {
68
+ this.userdata = e, this.eventtype = t, this.clockid = i, this.timeout = a, this.flags = r;
69
+ }
70
+ }
71
+ class ct {
72
+ write_bytes(e, t) {
73
+ e.setBigUint64(t, this.userdata, !0), e.setUint16(t + 8, this.error, !0), e.setUint8(t + 10, this.eventtype);
74
+ }
75
+ constructor(e, t, i) {
76
+ this.userdata = e, this.error = t, this.eventtype = i;
77
+ }
78
+ }
79
+ const Dt = 0;
80
+ class Tt {
81
+ write_bytes(e, t) {
82
+ e.setUint32(t, this.pr_name.byteLength, !0);
83
+ }
84
+ constructor(e) {
85
+ this.pr_name = new TextEncoder().encode(e);
86
+ }
87
+ }
88
+ class ze {
89
+ static dir(e) {
90
+ const t = new ze();
91
+ return t.tag = Dt, t.inner = new Tt(e), t;
92
+ }
93
+ write_bytes(e, t) {
94
+ e.setUint32(t, this.tag, !0), this.inner.write_bytes(e, t + 4);
95
+ }
96
+ }
97
+ let Ct = class {
98
+ enable(e) {
99
+ this.log = xt(e === void 0 ? !0 : e, this.prefix);
100
+ }
101
+ get enabled() {
102
+ return this.isEnabled;
103
+ }
104
+ constructor(e) {
105
+ this.isEnabled = e, this.prefix = "wasi:", this.enable(e);
106
+ }
107
+ };
108
+ function xt(n, e) {
109
+ return n ? console.log.bind(console, "%c%s", "color: #265BA0", e) : () => {
110
+ };
111
+ }
112
+ const b = new Ct(!1);
113
+ class ge extends Error {
114
+ constructor(e) {
115
+ super("exit with exit code " + e), this.code = e;
116
+ }
117
+ }
118
+ let It = class {
119
+ start(e) {
120
+ this.inst = e;
121
+ try {
122
+ return e.exports._start(), 0;
123
+ } catch (t) {
124
+ if (t instanceof ge)
125
+ return t.code;
126
+ throw t;
127
+ }
128
+ }
129
+ initialize(e) {
130
+ this.inst = e, e.exports._initialize && e.exports._initialize();
131
+ }
132
+ constructor(e, t, i, a = {}) {
133
+ this.args = [], this.env = [], this.fds = [], b.enable(a.debug), this.args = e, this.env = t, this.fds = i;
134
+ const r = this;
135
+ this.wasiImport = { args_sizes_get(s, o) {
136
+ const f = new DataView(r.inst.exports.memory.buffer);
137
+ f.setUint32(s, r.args.length, !0);
138
+ let l = 0;
139
+ for (const u of r.args)
140
+ l += u.length + 1;
141
+ return f.setUint32(o, l, !0), b.log(f.getUint32(s, !0), f.getUint32(o, !0)), 0;
142
+ }, args_get(s, o) {
143
+ const f = new DataView(r.inst.exports.memory.buffer), l = new Uint8Array(r.inst.exports.memory.buffer), u = o;
144
+ for (let c = 0; c < r.args.length; c++) {
145
+ f.setUint32(s, o, !0), s += 4;
146
+ const _ = new TextEncoder().encode(r.args[c]);
147
+ l.set(_, o), f.setUint8(o + _.length, 0), o += _.length + 1;
148
+ }
149
+ return b.enabled && b.log(new TextDecoder("utf-8").decode(l.slice(u, o))), 0;
150
+ }, environ_sizes_get(s, o) {
151
+ const f = new DataView(r.inst.exports.memory.buffer);
152
+ f.setUint32(s, r.env.length, !0);
153
+ let l = 0;
154
+ for (const u of r.env)
155
+ l += new TextEncoder().encode(u).length + 1;
156
+ return f.setUint32(o, l, !0), b.log(f.getUint32(s, !0), f.getUint32(o, !0)), 0;
157
+ }, environ_get(s, o) {
158
+ const f = new DataView(r.inst.exports.memory.buffer), l = new Uint8Array(r.inst.exports.memory.buffer), u = o;
159
+ for (let c = 0; c < r.env.length; c++) {
160
+ f.setUint32(s, o, !0), s += 4;
161
+ const _ = new TextEncoder().encode(r.env[c]);
162
+ l.set(_, o), f.setUint8(o + _.length, 0), o += _.length + 1;
163
+ }
164
+ return b.enabled && b.log(new TextDecoder("utf-8").decode(l.slice(u, o))), 0;
165
+ }, clock_res_get(s, o) {
166
+ let f;
167
+ switch (s) {
168
+ case 1: {
169
+ f = 5000n;
170
+ break;
171
+ }
172
+ case 0: {
173
+ f = 1000000n;
174
+ break;
175
+ }
176
+ default:
177
+ return 52;
178
+ }
179
+ return new DataView(r.inst.exports.memory.buffer).setBigUint64(o, f, !0), 0;
180
+ }, clock_time_get(s, o, f) {
181
+ const l = new DataView(r.inst.exports.memory.buffer);
182
+ if (s === 0)
183
+ l.setBigUint64(f, BigInt((/* @__PURE__ */ new Date()).getTime()) * 1000000n, !0);
184
+ else if (s == 1) {
185
+ let u;
186
+ try {
187
+ u = BigInt(Math.round(performance.now() * 1e6));
188
+ } catch {
189
+ u = 0n;
190
+ }
191
+ l.setBigUint64(f, u, !0);
192
+ } else
193
+ l.setBigUint64(f, 0n, !0);
194
+ return 0;
195
+ }, fd_advise(s, o, f, l) {
196
+ return r.fds[s] != null ? 0 : 8;
197
+ }, fd_allocate(s, o, f) {
198
+ return r.fds[s] != null ? r.fds[s].fd_allocate(o, f) : 8;
199
+ }, fd_close(s) {
200
+ if (r.fds[s] != null) {
201
+ const o = r.fds[s].fd_close();
202
+ return r.fds[s] = void 0, o;
203
+ } else
204
+ return 8;
205
+ }, fd_datasync(s) {
206
+ return r.fds[s] != null ? r.fds[s].fd_sync() : 8;
207
+ }, fd_fdstat_get(s, o) {
208
+ if (r.fds[s] != null) {
209
+ const { ret: f, fdstat: l } = r.fds[s].fd_fdstat_get();
210
+ return l?.write_bytes(new DataView(r.inst.exports.memory.buffer), o), f;
211
+ } else
212
+ return 8;
213
+ }, fd_fdstat_set_flags(s, o) {
214
+ return r.fds[s] != null ? r.fds[s].fd_fdstat_set_flags(o) : 8;
215
+ }, fd_fdstat_set_rights(s, o, f) {
216
+ return r.fds[s] != null ? r.fds[s].fd_fdstat_set_rights(o, f) : 8;
217
+ }, fd_filestat_get(s, o) {
218
+ if (r.fds[s] != null) {
219
+ const { ret: f, filestat: l } = r.fds[s].fd_filestat_get();
220
+ return l?.write_bytes(new DataView(r.inst.exports.memory.buffer), o), f;
221
+ } else
222
+ return 8;
223
+ }, fd_filestat_set_size(s, o) {
224
+ return r.fds[s] != null ? r.fds[s].fd_filestat_set_size(o) : 8;
225
+ }, fd_filestat_set_times(s, o, f, l) {
226
+ return r.fds[s] != null ? r.fds[s].fd_filestat_set_times(o, f, l) : 8;
227
+ }, fd_pread(s, o, f, l, u) {
228
+ const c = new DataView(r.inst.exports.memory.buffer), _ = new Uint8Array(r.inst.exports.memory.buffer);
229
+ if (r.fds[s] != null) {
230
+ const d = fe.read_bytes_array(c, o, f);
231
+ let p = 0;
232
+ for (const h of d) {
233
+ const { ret: y, data: R } = r.fds[s].fd_pread(h.buf_len, l);
234
+ if (y != 0)
235
+ return c.setUint32(u, p, !0), y;
236
+ if (_.set(R, h.buf), p += R.length, l += BigInt(R.length), R.length != h.buf_len)
237
+ break;
238
+ }
239
+ return c.setUint32(u, p, !0), 0;
240
+ } else
241
+ return 8;
242
+ }, fd_prestat_get(s, o) {
243
+ const f = new DataView(r.inst.exports.memory.buffer);
244
+ if (r.fds[s] != null) {
245
+ const { ret: l, prestat: u } = r.fds[s].fd_prestat_get();
246
+ return u?.write_bytes(f, o), l;
247
+ } else
248
+ return 8;
249
+ }, fd_prestat_dir_name(s, o, f) {
250
+ if (r.fds[s] != null) {
251
+ const { ret: l, prestat: u } = r.fds[s].fd_prestat_get();
252
+ if (u == null)
253
+ return l;
254
+ const c = u.inner.pr_name;
255
+ return new Uint8Array(r.inst.exports.memory.buffer).set(c.slice(0, f), o), c.byteLength > f ? 37 : 0;
256
+ } else
257
+ return 8;
258
+ }, fd_pwrite(s, o, f, l, u) {
259
+ const c = new DataView(r.inst.exports.memory.buffer), _ = new Uint8Array(r.inst.exports.memory.buffer);
260
+ if (r.fds[s] != null) {
261
+ const d = le.read_bytes_array(c, o, f);
262
+ let p = 0;
263
+ for (const h of d) {
264
+ const y = _.slice(h.buf, h.buf + h.buf_len), { ret: R, nwritten: m } = r.fds[s].fd_pwrite(y, l);
265
+ if (R != 0)
266
+ return c.setUint32(u, p, !0), R;
267
+ if (p += m, l += BigInt(m), m != y.byteLength)
268
+ break;
269
+ }
270
+ return c.setUint32(u, p, !0), 0;
271
+ } else
272
+ return 8;
273
+ }, fd_read(s, o, f, l) {
274
+ const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
275
+ if (r.fds[s] != null) {
276
+ const _ = fe.read_bytes_array(u, o, f);
277
+ let d = 0;
278
+ for (const p of _) {
279
+ const { ret: h, data: y } = r.fds[s].fd_read(p.buf_len);
280
+ if (h != 0)
281
+ return u.setUint32(l, d, !0), h;
282
+ if (c.set(y, p.buf), d += y.length, y.length != p.buf_len)
283
+ break;
284
+ }
285
+ return u.setUint32(l, d, !0), 0;
286
+ } else
287
+ return 8;
288
+ }, fd_readdir(s, o, f, l, u) {
289
+ const c = new DataView(r.inst.exports.memory.buffer), _ = new Uint8Array(r.inst.exports.memory.buffer);
290
+ if (r.fds[s] != null) {
291
+ let d = 0;
292
+ for (; ; ) {
293
+ const { ret: p, dirent: h } = r.fds[s].fd_readdir_single(l);
294
+ if (p != 0)
295
+ return c.setUint32(u, d, !0), p;
296
+ if (h == null)
297
+ break;
298
+ if (f - d < h.head_length()) {
299
+ d = f;
300
+ break;
301
+ }
302
+ const y = new ArrayBuffer(h.head_length());
303
+ if (h.write_head_bytes(new DataView(y), 0), _.set(new Uint8Array(y).slice(0, Math.min(y.byteLength, f - d)), o), o += h.head_length(), d += h.head_length(), f - d < h.name_length()) {
304
+ d = f;
305
+ break;
306
+ }
307
+ h.write_name_bytes(_, o, f - d), o += h.name_length(), d += h.name_length(), l = h.d_next;
308
+ }
309
+ return c.setUint32(u, d, !0), 0;
310
+ } else
311
+ return 8;
312
+ }, fd_renumber(s, o) {
313
+ if (r.fds[s] != null && r.fds[o] != null) {
314
+ const f = r.fds[o].fd_close();
315
+ return f != 0 ? f : (r.fds[o] = r.fds[s], r.fds[s] = void 0, 0);
316
+ } else
317
+ return 8;
318
+ }, fd_seek(s, o, f, l) {
319
+ const u = new DataView(r.inst.exports.memory.buffer);
320
+ if (r.fds[s] != null) {
321
+ const { ret: c, offset: _ } = r.fds[s].fd_seek(o, f);
322
+ return u.setBigInt64(l, _, !0), c;
323
+ } else
324
+ return 8;
325
+ }, fd_sync(s) {
326
+ return r.fds[s] != null ? r.fds[s].fd_sync() : 8;
327
+ }, fd_tell(s, o) {
328
+ const f = new DataView(r.inst.exports.memory.buffer);
329
+ if (r.fds[s] != null) {
330
+ const { ret: l, offset: u } = r.fds[s].fd_tell();
331
+ return f.setBigUint64(o, u, !0), l;
332
+ } else
333
+ return 8;
334
+ }, fd_write(s, o, f, l) {
335
+ const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
336
+ if (r.fds[s] != null) {
337
+ const _ = le.read_bytes_array(u, o, f);
338
+ let d = 0;
339
+ for (const p of _) {
340
+ const h = c.slice(p.buf, p.buf + p.buf_len), { ret: y, nwritten: R } = r.fds[s].fd_write(h);
341
+ if (y != 0)
342
+ return u.setUint32(l, d, !0), y;
343
+ if (d += R, R != h.byteLength)
344
+ break;
345
+ }
346
+ return u.setUint32(l, d, !0), 0;
347
+ } else
348
+ return 8;
349
+ }, path_create_directory(s, o, f) {
350
+ const l = new Uint8Array(r.inst.exports.memory.buffer);
351
+ if (r.fds[s] != null) {
352
+ const u = new TextDecoder("utf-8").decode(l.slice(o, o + f));
353
+ return r.fds[s].path_create_directory(u);
354
+ } else
355
+ return 8;
356
+ }, path_filestat_get(s, o, f, l, u) {
357
+ const c = new DataView(r.inst.exports.memory.buffer), _ = new Uint8Array(r.inst.exports.memory.buffer);
358
+ if (r.fds[s] != null) {
359
+ const d = new TextDecoder("utf-8").decode(_.slice(f, f + l)), { ret: p, filestat: h } = r.fds[s].path_filestat_get(o, d);
360
+ return h?.write_bytes(c, u), p;
361
+ } else
362
+ return 8;
363
+ }, path_filestat_set_times(s, o, f, l, u, c, _) {
364
+ const d = new Uint8Array(r.inst.exports.memory.buffer);
365
+ if (r.fds[s] != null) {
366
+ const p = new TextDecoder("utf-8").decode(d.slice(f, f + l));
367
+ return r.fds[s].path_filestat_set_times(o, p, u, c, _);
368
+ } else
369
+ return 8;
370
+ }, path_link(s, o, f, l, u, c, _) {
371
+ const d = new Uint8Array(r.inst.exports.memory.buffer);
372
+ if (r.fds[s] != null && r.fds[u] != null) {
373
+ const p = new TextDecoder("utf-8").decode(d.slice(f, f + l)), h = new TextDecoder("utf-8").decode(d.slice(c, c + _)), { ret: y, inode_obj: R } = r.fds[s].path_lookup(p, o);
374
+ return R == null ? y : r.fds[u].path_link(h, R, !1);
375
+ } else
376
+ return 8;
377
+ }, path_open(s, o, f, l, u, c, _, d, p) {
378
+ const h = new DataView(r.inst.exports.memory.buffer), y = new Uint8Array(r.inst.exports.memory.buffer);
379
+ if (r.fds[s] != null) {
380
+ const R = new TextDecoder("utf-8").decode(y.slice(f, f + l));
381
+ b.log(R);
382
+ const { ret: m, fd_obj: g } = r.fds[s].path_open(o, R, u, c, _, d);
383
+ if (m != 0)
384
+ return m;
385
+ r.fds.push(g);
386
+ const E = r.fds.length - 1;
387
+ return h.setUint32(p, E, !0), 0;
388
+ } else
389
+ return 8;
390
+ }, path_readlink(s, o, f, l, u, c) {
391
+ const _ = new DataView(r.inst.exports.memory.buffer), d = new Uint8Array(r.inst.exports.memory.buffer);
392
+ if (r.fds[s] != null) {
393
+ const p = new TextDecoder("utf-8").decode(d.slice(o, o + f));
394
+ b.log(p);
395
+ const { ret: h, data: y } = r.fds[s].path_readlink(p);
396
+ if (y != null) {
397
+ const R = new TextEncoder().encode(y);
398
+ if (R.length > u)
399
+ return _.setUint32(c, 0, !0), 8;
400
+ d.set(R, l), _.setUint32(c, R.length, !0);
401
+ }
402
+ return h;
403
+ } else
404
+ return 8;
405
+ }, path_remove_directory(s, o, f) {
406
+ const l = new Uint8Array(r.inst.exports.memory.buffer);
407
+ if (r.fds[s] != null) {
408
+ const u = new TextDecoder("utf-8").decode(l.slice(o, o + f));
409
+ return r.fds[s].path_remove_directory(u);
410
+ } else
411
+ return 8;
412
+ }, path_rename(s, o, f, l, u, c) {
413
+ const _ = new Uint8Array(r.inst.exports.memory.buffer);
414
+ if (r.fds[s] != null && r.fds[l] != null) {
415
+ const d = new TextDecoder("utf-8").decode(_.slice(o, o + f)), p = new TextDecoder("utf-8").decode(_.slice(u, u + c));
416
+ let { ret: h, inode_obj: y } = r.fds[s].path_unlink(d);
417
+ if (y == null)
418
+ return h;
419
+ if (h = r.fds[l].path_link(p, y, !0), h != 0 && r.fds[s].path_link(d, y, !0) != 0)
420
+ throw "path_link should always return success when relinking an inode back to the original place";
421
+ return h;
422
+ } else
423
+ return 8;
424
+ }, path_symlink(s, o, f, l, u) {
425
+ const c = new Uint8Array(r.inst.exports.memory.buffer);
426
+ return r.fds[f] != null ? (new TextDecoder("utf-8").decode(c.slice(s, s + o)), new TextDecoder("utf-8").decode(c.slice(l, l + u)), 58) : 8;
427
+ }, path_unlink_file(s, o, f) {
428
+ const l = new Uint8Array(r.inst.exports.memory.buffer);
429
+ if (r.fds[s] != null) {
430
+ const u = new TextDecoder("utf-8").decode(l.slice(o, o + f));
431
+ return r.fds[s].path_unlink_file(u);
432
+ } else
433
+ return 8;
434
+ }, poll_oneoff(s, o, f) {
435
+ if (f === 0)
436
+ return 28;
437
+ if (f > 1)
438
+ return b.log("poll_oneoff: only a single subscription is supported"), 58;
439
+ const l = new DataView(r.inst.exports.memory.buffer), u = Ve.read_bytes(l, s), c = u.eventtype, _ = u.clockid, d = u.timeout;
440
+ if (c !== ft)
441
+ return b.log("poll_oneoff: only clock subscriptions are supported"), 58;
442
+ let p;
443
+ if (_ === 1)
444
+ p = () => BigInt(Math.round(performance.now() * 1e6));
445
+ else if (_ === 0)
446
+ p = () => BigInt((/* @__PURE__ */ new Date()).getTime()) * 1000000n;
447
+ else
448
+ return 28;
449
+ const h = u.flags & lt ? d : p() + d;
450
+ for (; h > p(); )
451
+ ;
452
+ return new ct(u.userdata, 0, c).write_bytes(l, o), 0;
453
+ }, proc_exit(s) {
454
+ throw new ge(s);
455
+ }, proc_raise(s) {
456
+ throw "raised signal " + s;
457
+ }, sched_yield() {
458
+ }, random_get(s, o) {
459
+ const f = new Uint8Array(r.inst.exports.memory.buffer).subarray(s, s + o);
460
+ if ("crypto" in globalThis && (typeof SharedArrayBuffer > "u" || !(r.inst.exports.memory.buffer instanceof SharedArrayBuffer)))
461
+ for (let l = 0; l < o; l += 65536)
462
+ crypto.getRandomValues(f.subarray(l, l + 65536));
463
+ else
464
+ for (let l = 0; l < o; l++)
465
+ f[l] = Math.random() * 256 | 0;
466
+ }, sock_recv(s, o, f) {
467
+ throw "sockets not supported";
468
+ }, sock_send(s, o, f) {
469
+ throw "sockets not supported";
470
+ }, sock_shutdown(s, o) {
471
+ throw "sockets not supported";
472
+ }, sock_accept(s, o) {
473
+ throw "sockets not supported";
474
+ } };
475
+ }
476
+ };
477
+ class Se {
478
+ fd_allocate(e, t) {
479
+ return 58;
480
+ }
481
+ fd_close() {
482
+ return 0;
483
+ }
484
+ fd_fdstat_get() {
485
+ return { ret: 58, fdstat: null };
486
+ }
487
+ fd_fdstat_set_flags(e) {
488
+ return 58;
489
+ }
490
+ fd_fdstat_set_rights(e, t) {
491
+ return 58;
492
+ }
493
+ fd_filestat_get() {
494
+ return { ret: 58, filestat: null };
495
+ }
496
+ fd_filestat_set_size(e) {
497
+ return 58;
498
+ }
499
+ fd_filestat_set_times(e, t, i) {
500
+ return 58;
501
+ }
502
+ fd_pread(e, t) {
503
+ return { ret: 58, data: new Uint8Array() };
504
+ }
505
+ fd_prestat_get() {
506
+ return { ret: 58, prestat: null };
507
+ }
508
+ fd_pwrite(e, t) {
509
+ return { ret: 58, nwritten: 0 };
510
+ }
511
+ fd_read(e) {
512
+ return { ret: 58, data: new Uint8Array() };
513
+ }
514
+ fd_readdir_single(e) {
515
+ return { ret: 58, dirent: null };
516
+ }
517
+ fd_seek(e, t) {
518
+ return { ret: 58, offset: 0n };
519
+ }
520
+ fd_sync() {
521
+ return 0;
522
+ }
523
+ fd_tell() {
524
+ return { ret: 58, offset: 0n };
525
+ }
526
+ fd_write(e) {
527
+ return { ret: 58, nwritten: 0 };
528
+ }
529
+ path_create_directory(e) {
530
+ return 58;
531
+ }
532
+ path_filestat_get(e, t) {
533
+ return { ret: 58, filestat: null };
534
+ }
535
+ path_filestat_set_times(e, t, i, a, r) {
536
+ return 58;
537
+ }
538
+ path_link(e, t, i) {
539
+ return 58;
540
+ }
541
+ path_unlink(e) {
542
+ return { ret: 58, inode_obj: null };
543
+ }
544
+ path_lookup(e, t) {
545
+ return { ret: 58, inode_obj: null };
546
+ }
547
+ path_open(e, t, i, a, r, s) {
548
+ return { ret: 54, fd_obj: null };
549
+ }
550
+ path_readlink(e) {
551
+ return { ret: 58, data: null };
552
+ }
553
+ path_remove_directory(e) {
554
+ return 58;
555
+ }
556
+ path_rename(e, t, i) {
557
+ return 58;
558
+ }
559
+ path_unlink_file(e) {
560
+ return 58;
561
+ }
562
+ }
563
+ class G {
564
+ static issue_ino() {
565
+ return G.next_ino++;
566
+ }
567
+ static root_ino() {
568
+ return 0n;
569
+ }
570
+ constructor() {
571
+ this.ino = G.issue_ino();
572
+ }
573
+ }
574
+ G.next_ino = 1n;
575
+ class Bt extends Se {
576
+ fd_allocate(e, t) {
577
+ if (!(this.file.size > e + t)) {
578
+ const i = new Uint8Array(Number(e + t));
579
+ i.set(this.file.data, 0), this.file.data = i;
580
+ }
581
+ return 0;
582
+ }
583
+ fd_fdstat_get() {
584
+ return { ret: 0, fdstat: new Oe($, 0) };
585
+ }
586
+ fd_filestat_set_size(e) {
587
+ if (this.file.size > e)
588
+ this.file.data = new Uint8Array(this.file.data.buffer.slice(0, Number(e)));
589
+ else {
590
+ const t = new Uint8Array(Number(e));
591
+ t.set(this.file.data, 0), this.file.data = t;
592
+ }
593
+ return 0;
594
+ }
595
+ fd_read(e) {
596
+ const t = this.file.data.slice(Number(this.file_pos), Number(this.file_pos + BigInt(e)));
597
+ return this.file_pos += BigInt(t.length), { ret: 0, data: t };
598
+ }
599
+ fd_pread(e, t) {
600
+ return { ret: 0, data: this.file.data.slice(Number(t), Number(t + BigInt(e))) };
601
+ }
602
+ fd_seek(e, t) {
603
+ let i;
604
+ switch (t) {
605
+ case bt:
606
+ i = e;
607
+ break;
608
+ case Ut:
609
+ i = this.file_pos + e;
610
+ break;
611
+ case at:
612
+ i = BigInt(this.file.data.byteLength) + e;
613
+ break;
614
+ default:
615
+ return { ret: 28, offset: 0n };
616
+ }
617
+ return i < 0 ? { ret: 28, offset: 0n } : (this.file_pos = i, { ret: 0, offset: this.file_pos });
618
+ }
619
+ fd_tell() {
620
+ return { ret: 0, offset: this.file_pos };
621
+ }
622
+ fd_write(e) {
623
+ if (this.file.readonly) return { ret: 8, nwritten: 0 };
624
+ if (this.file_pos + BigInt(e.byteLength) > this.file.size) {
625
+ const t = this.file.data;
626
+ this.file.data = new Uint8Array(Number(this.file_pos + BigInt(e.byteLength))), this.file.data.set(t);
627
+ }
628
+ return this.file.data.set(e, Number(this.file_pos)), this.file_pos += BigInt(e.byteLength), { ret: 0, nwritten: e.byteLength };
629
+ }
630
+ fd_pwrite(e, t) {
631
+ if (this.file.readonly) return { ret: 8, nwritten: 0 };
632
+ if (t + BigInt(e.byteLength) > this.file.size) {
633
+ const i = this.file.data;
634
+ this.file.data = new Uint8Array(Number(t + BigInt(e.byteLength))), this.file.data.set(i);
635
+ }
636
+ return this.file.data.set(e, Number(t)), { ret: 0, nwritten: e.byteLength };
637
+ }
638
+ fd_filestat_get() {
639
+ return { ret: 0, filestat: this.file.stat() };
640
+ }
641
+ constructor(e) {
642
+ super(), this.file_pos = 0n, this.file = e;
643
+ }
644
+ }
645
+ class ut extends Se {
646
+ fd_seek(e, t) {
647
+ return { ret: 8, offset: 0n };
648
+ }
649
+ fd_tell() {
650
+ return { ret: 8, offset: 0n };
651
+ }
652
+ fd_allocate(e, t) {
653
+ return 8;
654
+ }
655
+ fd_fdstat_get() {
656
+ return { ret: 0, fdstat: new Oe(I, 0) };
657
+ }
658
+ fd_readdir_single(e) {
659
+ if (b.enabled && (b.log("readdir_single", e), b.log(e, this.dir.contents.keys())), e == 0n)
660
+ return { ret: 0, dirent: new ve(1n, this.dir.ino, ".", I) };
661
+ if (e == 1n)
662
+ return { ret: 0, dirent: new ve(2n, this.dir.parent_ino(), "..", I) };
663
+ if (e >= BigInt(this.dir.contents.size) + 2n)
664
+ return { ret: 0, dirent: null };
665
+ const [t, i] = Array.from(this.dir.contents.entries())[Number(e - 2n)];
666
+ return { ret: 0, dirent: new ve(e + 1n, i.ino, t, i.stat().filetype) };
667
+ }
668
+ path_filestat_get(e, t) {
669
+ const { ret: i, path: a } = W.from(t);
670
+ if (a == null)
671
+ return { ret: i, filestat: null };
672
+ const { ret: r, entry: s } = this.dir.get_entry_for_path(a);
673
+ return s == null ? { ret: r, filestat: null } : { ret: 0, filestat: s.stat() };
674
+ }
675
+ path_lookup(e, t) {
676
+ const { ret: i, path: a } = W.from(e);
677
+ if (a == null)
678
+ return { ret: i, inode_obj: null };
679
+ const { ret: r, entry: s } = this.dir.get_entry_for_path(a);
680
+ return s == null ? { ret: r, inode_obj: null } : { ret: 0, inode_obj: s };
681
+ }
682
+ path_open(e, t, i, a, r, s) {
683
+ const { ret: o, path: f } = W.from(t);
684
+ if (f == null)
685
+ return { ret: o, fd_obj: null };
686
+ let { ret: l, entry: u } = this.dir.get_entry_for_path(f);
687
+ if (u == null) {
688
+ if (l != 44)
689
+ return { ret: l, fd_obj: null };
690
+ if ((i & De) == De) {
691
+ const { ret: c, entry: _ } = this.dir.create_entry_for_path(t, (i & J) == J);
692
+ if (_ == null)
693
+ return { ret: c, fd_obj: null };
694
+ u = _;
695
+ } else
696
+ return { ret: 44, fd_obj: null };
697
+ } else if ((i & Je) == Je)
698
+ return { ret: 20, fd_obj: null };
699
+ return (i & J) == J && u.stat().filetype !== I ? { ret: 54, fd_obj: null } : u.path_open(i, a, s);
700
+ }
701
+ path_create_directory(e) {
702
+ return this.path_open(0, e, De | J, 0n, 0n, 0).ret;
703
+ }
704
+ path_link(e, t, i) {
705
+ const { ret: a, path: r } = W.from(e);
706
+ if (r == null)
707
+ return a;
708
+ if (r.is_dir)
709
+ return 44;
710
+ const { ret: s, parent_entry: o, filename: f, entry: l } = this.dir.get_parent_dir_and_entry_for_path(r, !0);
711
+ if (o == null || f == null)
712
+ return s;
713
+ if (l != null) {
714
+ const u = t.stat().filetype == I, c = l.stat().filetype == I;
715
+ if (u && c)
716
+ if (i && l instanceof D) {
717
+ if (l.contents.size != 0) return 55;
718
+ } else
719
+ return 20;
720
+ else {
721
+ if (u && !c)
722
+ return 54;
723
+ if (!u && c)
724
+ return 31;
725
+ if (!(t.stat().filetype == $ && l.stat().filetype == $)) return 20;
726
+ }
727
+ }
728
+ return !i && t.stat().filetype == I ? 63 : (o.contents.set(f, t), 0);
729
+ }
730
+ path_unlink(e) {
731
+ const { ret: t, path: i } = W.from(e);
732
+ if (i == null)
733
+ return { ret: t, inode_obj: null };
734
+ const { ret: a, parent_entry: r, filename: s, entry: o } = this.dir.get_parent_dir_and_entry_for_path(i, !0);
735
+ return r == null || s == null ? { ret: a, inode_obj: null } : o == null ? { ret: 44, inode_obj: null } : (r.contents.delete(s), { ret: 0, inode_obj: o });
736
+ }
737
+ path_unlink_file(e) {
738
+ const { ret: t, path: i } = W.from(e);
739
+ if (i == null)
740
+ return t;
741
+ const { ret: a, parent_entry: r, filename: s, entry: o } = this.dir.get_parent_dir_and_entry_for_path(i, !1);
742
+ return r == null || s == null || o == null ? a : o.stat().filetype === I ? 31 : (r.contents.delete(s), 0);
743
+ }
744
+ path_remove_directory(e) {
745
+ const { ret: t, path: i } = W.from(e);
746
+ if (i == null)
747
+ return t;
748
+ const { ret: a, parent_entry: r, filename: s, entry: o } = this.dir.get_parent_dir_and_entry_for_path(i, !1);
749
+ return r == null || s == null || o == null ? a : !(o instanceof D) || o.stat().filetype !== I ? 54 : o.contents.size !== 0 ? 55 : r.contents.delete(s) ? 0 : 44;
750
+ }
751
+ fd_filestat_get() {
752
+ return { ret: 0, filestat: this.dir.stat() };
753
+ }
754
+ fd_filestat_set_size(e) {
755
+ return 8;
756
+ }
757
+ fd_read(e) {
758
+ return { ret: 8, data: new Uint8Array() };
759
+ }
760
+ fd_pread(e, t) {
761
+ return { ret: 8, data: new Uint8Array() };
762
+ }
763
+ fd_write(e) {
764
+ return { ret: 8, nwritten: 0 };
765
+ }
766
+ fd_pwrite(e, t) {
767
+ return { ret: 8, nwritten: 0 };
768
+ }
769
+ constructor(e) {
770
+ super(), this.dir = e;
771
+ }
772
+ }
773
+ class et extends ut {
774
+ fd_prestat_get() {
775
+ return { ret: 0, prestat: ze.dir(this.prestat_name) };
776
+ }
777
+ constructor(e, t) {
778
+ super(new D(t)), this.prestat_name = e;
779
+ }
780
+ }
781
+ class je extends G {
782
+ path_open(e, t, i) {
783
+ if (this.readonly && (t & BigInt(64)) == BigInt(64))
784
+ return { ret: 63, fd_obj: null };
785
+ if ((e & Qe) == Qe) {
786
+ if (this.readonly) return { ret: 63, fd_obj: null };
787
+ this.data = new Uint8Array([]);
788
+ }
789
+ const a = new Bt(this);
790
+ return i & At && a.fd_seek(0n, at), { ret: 0, fd_obj: a };
791
+ }
792
+ get size() {
793
+ return BigInt(this.data.byteLength);
794
+ }
795
+ stat() {
796
+ return new ot(this.ino, $, this.size);
797
+ }
798
+ constructor(e, t) {
799
+ super(), this.data = new Uint8Array(e), this.readonly = !!t?.readonly;
800
+ }
801
+ }
802
+ let W = class _t {
803
+ static from(e) {
804
+ const t = new _t();
805
+ if (t.is_dir = e.endsWith("/"), e.startsWith("/"))
806
+ return { ret: 76, path: null };
807
+ if (e.includes("\0"))
808
+ return { ret: 28, path: null };
809
+ for (const i of e.split("/"))
810
+ if (!(i === "" || i === ".")) {
811
+ if (i === "..") {
812
+ if (t.parts.pop() == null)
813
+ return { ret: 76, path: null };
814
+ continue;
815
+ }
816
+ t.parts.push(i);
817
+ }
818
+ return { ret: 0, path: t };
819
+ }
820
+ to_path_string() {
821
+ let e = this.parts.join("/");
822
+ return this.is_dir && (e += "/"), e;
823
+ }
824
+ constructor() {
825
+ this.parts = [], this.is_dir = !1;
826
+ }
827
+ };
828
+ class D extends G {
829
+ parent_ino() {
830
+ return this.parent == null ? G.root_ino() : this.parent.ino;
831
+ }
832
+ path_open(e, t, i) {
833
+ return { ret: 0, fd_obj: new ut(this) };
834
+ }
835
+ stat() {
836
+ return new ot(this.ino, I, 0n);
837
+ }
838
+ get_entry_for_path(e) {
839
+ let t = this;
840
+ for (const i of e.parts) {
841
+ if (!(t instanceof D))
842
+ return { ret: 54, entry: null };
843
+ const a = t.contents.get(i);
844
+ if (a !== void 0)
845
+ t = a;
846
+ else
847
+ return b.log(i), { ret: 44, entry: null };
848
+ }
849
+ return e.is_dir && t.stat().filetype != I ? { ret: 54, entry: null } : { ret: 0, entry: t };
850
+ }
851
+ get_parent_dir_and_entry_for_path(e, t) {
852
+ const i = e.parts.pop();
853
+ if (i === void 0)
854
+ return { ret: 28, parent_entry: null, filename: null, entry: null };
855
+ const { ret: a, entry: r } = this.get_entry_for_path(e);
856
+ if (r == null)
857
+ return { ret: a, parent_entry: null, filename: null, entry: null };
858
+ if (!(r instanceof D))
859
+ return { ret: 54, parent_entry: null, filename: null, entry: null };
860
+ const s = r.contents.get(i);
861
+ return s === void 0 ? t ? { ret: 0, parent_entry: r, filename: i, entry: null } : { ret: 44, parent_entry: null, filename: null, entry: null } : e.is_dir && s.stat().filetype != I ? { ret: 54, parent_entry: null, filename: null, entry: null } : { ret: 0, parent_entry: r, filename: i, entry: s };
862
+ }
863
+ create_entry_for_path(e, t) {
864
+ const { ret: i, path: a } = W.from(e);
865
+ if (a == null)
866
+ return { ret: i, entry: null };
867
+ let { ret: r, parent_entry: s, filename: o, entry: f } = this.get_parent_dir_and_entry_for_path(a, !0);
868
+ if (s == null || o == null)
869
+ return { ret: r, entry: null };
870
+ if (f != null)
871
+ return { ret: 20, entry: null };
872
+ b.log("create", a);
873
+ let l;
874
+ return t ? l = new D(/* @__PURE__ */ new Map()) : l = new je(new ArrayBuffer(0)), s.contents.set(o, l), f = l, { ret: 0, entry: f };
875
+ }
876
+ constructor(e) {
877
+ super(), this.parent = null, e instanceof Array ? this.contents = new Map(e) : this.contents = e;
878
+ for (const t of this.contents.values())
879
+ t instanceof D && (t.parent = this);
880
+ }
881
+ }
882
+ var v = Uint8Array, X = Uint16Array, kt = Int32Array, dt = new v([
883
+ 0,
884
+ 0,
885
+ 0,
886
+ 0,
887
+ 0,
888
+ 0,
889
+ 0,
890
+ 0,
891
+ 1,
892
+ 1,
893
+ 1,
894
+ 1,
895
+ 2,
896
+ 2,
897
+ 2,
898
+ 2,
899
+ 3,
900
+ 3,
901
+ 3,
902
+ 3,
903
+ 4,
904
+ 4,
905
+ 4,
906
+ 4,
907
+ 5,
908
+ 5,
909
+ 5,
910
+ 5,
911
+ 0,
912
+ /* unused */
913
+ 0,
914
+ 0,
915
+ /* impossible */
916
+ 0
917
+ ]), ht = new v([
918
+ 0,
919
+ 0,
920
+ 0,
921
+ 0,
922
+ 1,
923
+ 1,
924
+ 2,
925
+ 2,
926
+ 3,
927
+ 3,
928
+ 4,
929
+ 4,
930
+ 5,
931
+ 5,
932
+ 6,
933
+ 6,
934
+ 7,
935
+ 7,
936
+ 8,
937
+ 8,
938
+ 9,
939
+ 9,
940
+ 10,
941
+ 10,
942
+ 11,
943
+ 11,
944
+ 12,
945
+ 12,
946
+ 13,
947
+ 13,
948
+ /* unused */
949
+ 0,
950
+ 0
951
+ ]), Ft = new v([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), pt = function(n, e) {
952
+ for (var t = new X(31), i = 0; i < 31; ++i)
953
+ t[i] = e += 1 << n[i - 1];
954
+ for (var a = new kt(t[30]), i = 1; i < 30; ++i)
955
+ for (var r = t[i]; r < t[i + 1]; ++r)
956
+ a[r] = r - t[i] << 5 | i;
957
+ return { b: t, r: a };
958
+ }, yt = pt(dt, 2), Rt = yt.b, Lt = yt.r;
959
+ Rt[28] = 258, Lt[258] = 28;
960
+ var Mt = pt(ht, 0), Pt = Mt.b, Me = new X(32768);
961
+ for (var w = 0; w < 32768; ++w) {
962
+ var j = (w & 43690) >> 1 | (w & 21845) << 1;
963
+ j = (j & 52428) >> 2 | (j & 13107) << 2, j = (j & 61680) >> 4 | (j & 3855) << 4, Me[w] = ((j & 65280) >> 8 | (j & 255) << 8) >> 1;
964
+ }
965
+ var ae = function(n, e, t) {
966
+ for (var i = n.length, a = 0, r = new X(e); a < i; ++a)
967
+ n[a] && ++r[n[a] - 1];
968
+ var s = new X(e);
969
+ for (a = 1; a < e; ++a)
970
+ s[a] = s[a - 1] + r[a - 1] << 1;
971
+ var o;
972
+ if (t) {
973
+ o = new X(1 << e);
974
+ var f = 15 - e;
975
+ for (a = 0; a < i; ++a)
976
+ if (n[a])
977
+ for (var l = a << 4 | n[a], u = e - n[a], c = s[n[a] - 1]++ << u, _ = c | (1 << u) - 1; c <= _; ++c)
978
+ o[Me[c] >> f] = l;
979
+ } else
980
+ for (o = new X(i), a = 0; a < i; ++a)
981
+ n[a] && (o[a] = Me[s[n[a] - 1]++] >> 15 - n[a]);
982
+ return o;
983
+ }, _e = new v(288);
984
+ for (var w = 0; w < 144; ++w)
985
+ _e[w] = 8;
986
+ for (var w = 144; w < 256; ++w)
987
+ _e[w] = 9;
988
+ for (var w = 256; w < 280; ++w)
989
+ _e[w] = 7;
990
+ for (var w = 280; w < 288; ++w)
991
+ _e[w] = 8;
992
+ var gt = new v(32);
993
+ for (var w = 0; w < 32; ++w)
994
+ gt[w] = 5;
995
+ var Vt = /* @__PURE__ */ ae(_e, 9, 1), zt = /* @__PURE__ */ ae(gt, 5, 1), Te = function(n) {
996
+ for (var e = n[0], t = 1; t < n.length; ++t)
997
+ n[t] > e && (e = n[t]);
998
+ return e;
999
+ }, B = function(n, e, t) {
1000
+ var i = e / 8 | 0;
1001
+ return (n[i] | n[i + 1] << 8) >> (e & 7) & t;
1002
+ }, Ce = function(n, e) {
1003
+ var t = e / 8 | 0;
1004
+ return (n[t] | n[t + 1] << 8 | n[t + 2] << 16) >> (e & 7);
1005
+ }, jt = function(n) {
1006
+ return (n + 7) / 8 | 0;
1007
+ }, Wt = function(n, e, t) {
1008
+ return (t == null || t > n.length) && (t = n.length), new v(n.subarray(e, t));
1009
+ }, Gt = [
1010
+ "unexpected EOF",
1011
+ "invalid block type",
1012
+ "invalid length/literal",
1013
+ "invalid distance",
1014
+ "stream finished",
1015
+ "no stream handler",
1016
+ ,
1017
+ "no callback",
1018
+ "invalid UTF-8 data",
1019
+ "extra field too long",
1020
+ "date not in range 1980-2099",
1021
+ "filename too long",
1022
+ "stream finishing",
1023
+ "invalid zip data"
1024
+ // determined by unknown compression method
1025
+ ], k = function(n, e, t) {
1026
+ var i = new Error(e || Gt[n]);
1027
+ if (i.code = n, Error.captureStackTrace && Error.captureStackTrace(i, k), !t)
1028
+ throw i;
1029
+ return i;
1030
+ }, Ht = function(n, e, t, i) {
1031
+ var a = n.length, r = 0;
1032
+ if (!a || e.f && !e.l)
1033
+ return t || new v(0);
1034
+ var s = !t, o = s || e.i != 2, f = e.i;
1035
+ s && (t = new v(a * 3));
1036
+ var l = function(Xe) {
1037
+ var $e = t.length;
1038
+ if (Xe > $e) {
1039
+ var qe = new v(Math.max($e * 2, Xe));
1040
+ qe.set(t), t = qe;
1041
+ }
1042
+ }, u = e.f || 0, c = e.p || 0, _ = e.b || 0, d = e.l, p = e.d, h = e.m, y = e.n, R = a * 8;
1043
+ do {
1044
+ if (!d) {
1045
+ u = B(n, c, 1);
1046
+ var m = B(n, c + 1, 3);
1047
+ if (c += 3, m)
1048
+ if (m == 1)
1049
+ d = Vt, p = zt, h = 9, y = 5;
1050
+ else if (m == 2) {
1051
+ var T = B(n, c, 31) + 257, A = B(n, c + 10, 15) + 4, C = T + B(n, c + 5, 31) + 1;
1052
+ c += 14;
1053
+ for (var F = new v(C), M = new v(19), U = 0; U < A; ++U)
1054
+ M[Ft[U]] = B(n, c + U * 3, 7);
1055
+ c += A * 3;
1056
+ for (var H = Te(M), de = (1 << H) - 1, Et = ae(M, H, 1), U = 0; U < C; ) {
1057
+ var We = Et[B(n, c, de)];
1058
+ c += We & 15;
1059
+ var g = We >> 4;
1060
+ if (g < 16)
1061
+ F[U++] = g;
1062
+ else {
1063
+ var K = 0, he = 0;
1064
+ for (g == 16 ? (he = 3 + B(n, c, 3), c += 2, K = F[U - 1]) : g == 17 ? (he = 3 + B(n, c, 7), c += 3) : g == 18 && (he = 11 + B(n, c, 127), c += 7); he--; )
1065
+ F[U++] = K;
1066
+ }
1067
+ }
1068
+ var Ge = F.subarray(0, T), z = F.subarray(T);
1069
+ h = Te(Ge), y = Te(z), d = ae(Ge, h, 1), p = ae(z, y, 1);
1070
+ } else
1071
+ k(1);
1072
+ else {
1073
+ var g = jt(c) + 4, E = n[g - 4] | n[g - 3] << 8, O = g + E;
1074
+ if (O > a) {
1075
+ f && k(0);
1076
+ break;
1077
+ }
1078
+ o && l(_ + E), t.set(n.subarray(g, O), _), e.b = _ += E, e.p = c = O * 8, e.f = u;
1079
+ continue;
1080
+ }
1081
+ if (c > R) {
1082
+ f && k(0);
1083
+ break;
1084
+ }
1085
+ }
1086
+ o && l(_ + 131072);
1087
+ for (var Nt = (1 << h) - 1, Ot = (1 << y) - 1, be = c; ; be = c) {
1088
+ var K = d[Ce(n, c) & Nt], Y = K >> 4;
1089
+ if (c += K & 15, c > R) {
1090
+ f && k(0);
1091
+ break;
1092
+ }
1093
+ if (K || k(2), Y < 256)
1094
+ t[_++] = Y;
1095
+ else if (Y == 256) {
1096
+ be = c, d = null;
1097
+ break;
1098
+ } else {
1099
+ var He = Y - 254;
1100
+ if (Y > 264) {
1101
+ var U = Y - 257, q = dt[U];
1102
+ He = B(n, c, (1 << q) - 1) + Rt[U], c += q;
1103
+ }
1104
+ var Ue = p[Ce(n, c) & Ot], Ae = Ue >> 4;
1105
+ Ue || k(3), c += Ue & 15;
1106
+ var z = Pt[Ae];
1107
+ if (Ae > 3) {
1108
+ var q = ht[Ae];
1109
+ z += Ce(n, c) & (1 << q) - 1, c += q;
1110
+ }
1111
+ if (c > R) {
1112
+ f && k(0);
1113
+ break;
1114
+ }
1115
+ o && l(_ + 131072);
1116
+ var Ke = _ + He;
1117
+ if (_ < z) {
1118
+ var Ye = r - z, St = Math.min(z, Ke);
1119
+ for (Ye + _ < 0 && k(3); _ < St; ++_)
1120
+ t[_] = i[Ye + _];
1121
+ }
1122
+ for (; _ < Ke; ++_)
1123
+ t[_] = t[_ - z];
1124
+ }
1125
+ }
1126
+ e.l = d, e.p = be, e.b = _, e.f = u, d && (u = 1, e.m = h, e.d = p, e.n = y);
1127
+ } while (!u);
1128
+ return _ != t.length && s ? Wt(t, 0, _) : t.subarray(0, _);
1129
+ }, Kt = /* @__PURE__ */ new v(0), Yt = function(n) {
1130
+ (n[0] != 31 || n[1] != 139 || n[2] != 8) && k(6, "invalid gzip data");
1131
+ var e = n[3], t = 10;
1132
+ e & 4 && (t += (n[10] | n[11] << 8) + 2);
1133
+ for (var i = (e >> 3 & 1) + (e >> 4 & 1); i > 0; i -= !n[t++])
1134
+ ;
1135
+ return t + (e & 2);
1136
+ }, Xt = function(n) {
1137
+ var e = n.length;
1138
+ return (n[e - 4] | n[e - 3] << 8 | n[e - 2] << 16 | n[e - 1] << 24) >>> 0;
1139
+ };
1140
+ function $t(n, e) {
1141
+ var t = Yt(n);
1142
+ return t + 8 > n.length && k(6, "invalid gzip data"), Ht(n.subarray(t, -8), { i: 2 }, new v(Xt(n)), e);
1143
+ }
1144
+ var qt = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Jt = 0;
1145
+ try {
1146
+ qt.decode(Kt, { stream: !0 }), Jt = 1;
1147
+ } catch {
1148
+ }
1149
+ class tt {
1150
+ buffer;
1151
+ onMessage;
1152
+ constructor(e) {
1153
+ this.onMessage = e, this.buffer = new Uint8Array();
1154
+ }
1155
+ push(e) {
1156
+ this.buffer = Qt(this.buffer, e);
1157
+ let t = 0;
1158
+ for (; t < this.buffer.length; )
1159
+ try {
1160
+ const { value: i, nextOffset: a } = we(this.buffer, t);
1161
+ t = a, this.onMessage(i);
1162
+ } catch (i) {
1163
+ if (i.incomplete) break;
1164
+ throw i;
1165
+ }
1166
+ t > 0 && (this.buffer = this.buffer.slice(t));
1167
+ }
1168
+ }
1169
+ function Qt(n, e) {
1170
+ const t = new Uint8Array(n.length + e.length);
1171
+ return t.set(n, 0), t.set(e, n.length), t;
1172
+ }
1173
+ function V() {
1174
+ const n = new Error("incomplete msgpack buffer");
1175
+ return n.incomplete = !0, n;
1176
+ }
1177
+ function we(n, e) {
1178
+ if (e >= n.length) throw V();
1179
+ const t = n[e];
1180
+ if (t <= 127) return { value: t, nextOffset: e + 1 };
1181
+ if (t >= 128 && t <= 143) return Be(n, e, t & 15, 1);
1182
+ if (t >= 144 && t <= 159) return Ie(n, e, t & 15, 1);
1183
+ if (t >= 160 && t <= 191) return pe(n, e, t & 31, 1);
1184
+ if (t >= 224) return { value: t - 256, nextOffset: e + 1 };
1185
+ switch (t) {
1186
+ case 192:
1187
+ return { value: null, nextOffset: e + 1 };
1188
+ case 194:
1189
+ return { value: !1, nextOffset: e + 1 };
1190
+ case 195:
1191
+ return { value: !0, nextOffset: e + 1 };
1192
+ case 199:
1193
+ return ke(n, e, Fe(n, e + 1, 1), 3);
1194
+ case 200:
1195
+ return ke(n, e, Fe(n, e + 1, 2), 4);
1196
+ case 201:
1197
+ return ke(n, e, Fe(n, e + 1, 4), 6);
1198
+ case 204:
1199
+ return ye(n, e, 1, !1);
1200
+ case 205:
1201
+ return ye(n, e, 2, !1);
1202
+ case 206:
1203
+ return ye(n, e, 4, !1);
1204
+ case 207:
1205
+ return ye(n, e, 8, !0);
1206
+ case 208:
1207
+ return Re(n, e, 1);
1208
+ case 209:
1209
+ return Re(n, e, 2);
1210
+ case 210:
1211
+ return Re(n, e, 4);
1212
+ case 211:
1213
+ return Re(n, e, 8);
1214
+ case 212:
1215
+ return Q(n, e, 1);
1216
+ case 213:
1217
+ return Q(n, e, 2);
1218
+ case 214:
1219
+ return Q(n, e, 4);
1220
+ case 215:
1221
+ return Q(n, e, 8);
1222
+ case 216:
1223
+ return Q(n, e, 16);
1224
+ case 217:
1225
+ return pe(n, e, n[e + 1], 2);
1226
+ case 218:
1227
+ return pe(n, e, ne(n, e + 1), 3);
1228
+ case 219:
1229
+ return pe(n, e, re(n, e + 1), 5);
1230
+ case 220:
1231
+ return Ie(n, e, ne(n, e + 1), 3);
1232
+ case 221:
1233
+ return Ie(n, e, re(n, e + 1), 5);
1234
+ case 222:
1235
+ return Be(n, e, ne(n, e + 1), 3);
1236
+ case 223:
1237
+ return Be(n, e, re(n, e + 1), 5);
1238
+ case 196:
1239
+ return xe(n, e, n[e + 1], 2);
1240
+ case 197:
1241
+ return xe(n, e, ne(n, e + 1), 3);
1242
+ case 198:
1243
+ return xe(n, e, re(n, e + 1), 5);
1244
+ case 203:
1245
+ return Zt(n, e, 8);
1246
+ default:
1247
+ throw new Error(`Unsupported msgpack type: 0x${t.toString(16)}`);
1248
+ }
1249
+ }
1250
+ function xe(n, e, t, i) {
1251
+ const a = e + i, r = a + t;
1252
+ if (r > n.length) throw V();
1253
+ return { value: n.slice(a, r), nextOffset: r };
1254
+ }
1255
+ function pe(n, e, t, i) {
1256
+ const a = e + i, r = a + t;
1257
+ if (r > n.length) throw V();
1258
+ return { value: new TextDecoder().decode(n.slice(a, r)), nextOffset: r };
1259
+ }
1260
+ function Ie(n, e, t, i) {
1261
+ let a = e + i;
1262
+ const r = [];
1263
+ for (let s = 0; s < t; s += 1) {
1264
+ const { value: o, nextOffset: f } = we(n, a);
1265
+ r.push(o), a = f;
1266
+ }
1267
+ return { value: r, nextOffset: a };
1268
+ }
1269
+ function Be(n, e, t, i) {
1270
+ let a = e + i;
1271
+ const r = {};
1272
+ for (let s = 0; s < t; s += 1) {
1273
+ const o = we(n, a), f = we(n, o.nextOffset);
1274
+ r[String(o.value)] = f.value, a = f.nextOffset;
1275
+ }
1276
+ return { value: r, nextOffset: a };
1277
+ }
1278
+ function Q(n, e, t) {
1279
+ const i = e + 2, a = i + t;
1280
+ if (a > n.length) throw V();
1281
+ const r = n.slice(i, a);
1282
+ return { value: { type: n[e + 1], data: r }, nextOffset: a };
1283
+ }
1284
+ function ke(n, e, t, i) {
1285
+ const a = n[e + i - 1], r = e + i, s = r + t;
1286
+ if (s > n.length) throw V();
1287
+ const o = n.slice(r, s);
1288
+ return { value: { type: a, data: o }, nextOffset: s };
1289
+ }
1290
+ function ye(n, e, t, i) {
1291
+ const a = e + 1, r = a + t;
1292
+ if (r > n.length) throw V();
1293
+ const s = new DataView(n.slice(a, r).buffer);
1294
+ let o;
1295
+ return t === 1 ? o = s.getUint8(0) : t === 2 ? o = s.getUint16(0) : t === 4 ? o = s.getUint32(0) : o = s.getBigUint64(0), { value: i ? o : Number(o), nextOffset: r };
1296
+ }
1297
+ function Re(n, e, t) {
1298
+ const i = e + 1, a = i + t;
1299
+ if (a > n.length) throw V();
1300
+ const r = new DataView(n.slice(i, a).buffer);
1301
+ let s;
1302
+ return t === 1 ? s = r.getInt8(0) : t === 2 ? s = r.getInt16(0) : t === 4 ? s = r.getInt32(0) : s = r.getBigInt64(0), { value: Number(s), nextOffset: a };
1303
+ }
1304
+ function Zt(n, e, t) {
1305
+ const i = e + 1, a = i + t;
1306
+ if (a > n.length) throw V();
1307
+ const r = new DataView(n.slice(i, a).buffer);
1308
+ return { value: t === 4 ? r.getFloat32(0) : r.getFloat64(0), nextOffset: a };
1309
+ }
1310
+ function Fe(n, e, t) {
1311
+ const i = e;
1312
+ if (i + t > n.length) throw V();
1313
+ return t === 1 ? n[i] : t === 2 ? ne(n, i) : re(n, i);
1314
+ }
1315
+ function ne(n, e) {
1316
+ return n[e] << 8 | n[e + 1];
1317
+ }
1318
+ function re(n, e) {
1319
+ return n[e] * 16777216 + (n[e + 1] << 16 | n[e + 2] << 8 | n[e + 3]);
1320
+ }
1321
+ let se = null, x = null, N = null, S = null, ce = null, L = null, ie = null, P = 0, me = 0, Ee = 0;
1322
+ const en = new TextDecoder();
1323
+ let oe = "", Ne = !1, Z = null, ee = null;
1324
+ const Pe = [];
1325
+ self.addEventListener("error", (n) => {
1326
+ if (Ne) return;
1327
+ Ne = !0;
1328
+ const e = n.message || String(n.error || "worker error"), t = n.error?.stack;
10
1329
  try {
11
- postMessage({ type: "start-error", message: n ? `${e}
12
- ${n}` : e }), postMessage({ type: "exit", code: 1, lastStderr: W });
1330
+ postMessage({ type: "start-error", message: t ? `${e}
1331
+ ${t}` : e }), postMessage({ type: "exit", code: 1, lastStderr: oe });
13
1332
  } catch {
14
1333
  }
15
1334
  });
16
- self.addEventListener("unhandledrejection", (t) => {
17
- if (H) return;
18
- H = !0;
19
- const e = t.reason, n = e && (e.message || String(e)) || "unhandled rejection", s = e?.stack;
1335
+ self.addEventListener("unhandledrejection", (n) => {
1336
+ if (Ne) return;
1337
+ Ne = !0;
1338
+ const e = n.reason, t = e && (e.message || String(e)) || "unhandled rejection", i = e?.stack;
20
1339
  try {
21
- postMessage({ type: "start-error", message: s ? `${n}
22
- ${s}` : n }), postMessage({ type: "exit", code: 1, lastStderr: W });
1340
+ postMessage({ type: "start-error", message: i ? `${t}
1341
+ ${i}` : t }), postMessage({ type: "exit", code: 1, lastStderr: oe });
23
1342
  } catch {
24
1343
  }
25
1344
  });
26
- self.onmessage = (t) => {
27
- const { type: e } = t.data || {};
1345
+ self.onmessage = (n) => {
1346
+ const { type: e } = n.data || {};
28
1347
  if (e === "start")
29
- Dt(t.data).catch((n) => {
30
- postMessage({ type: "start-error", message: n?.message || String(n) }), postMessage({ type: "exit", code: 1 });
1348
+ nn(n.data).catch((t) => {
1349
+ postMessage({ type: "start-error", message: t?.message || String(t) }), postMessage({ type: "exit", code: 1 });
31
1350
  });
32
1351
  else if (e === "stdin") {
33
- const n = ut(t.data?.chunk);
34
- if (!n?.byteLength) return;
35
- f ? f.push(n) : Y.push(n);
1352
+ const t = wt(n.data?.chunk);
1353
+ if (!t?.byteLength) return;
1354
+ N ? N.push(t) : Pe.push(t);
36
1355
  } else if (e === "stop") {
37
1356
  try {
38
- f?.close();
1357
+ N?.close();
39
1358
  } catch {
40
1359
  }
41
1360
  try {
42
- _?.wasiImport?.proc_exit?.(0);
1361
+ x?.wasiImport?.proc_exit?.(0);
43
1362
  } catch {
44
1363
  }
45
- f = null;
1364
+ N = null;
46
1365
  }
47
1366
  };
48
- class Mt extends at {
1367
+ class tn extends Se {
49
1368
  chunks = [];
50
1369
  total = 0;
51
1370
  waiters = [];
52
1371
  closed = !1;
53
1372
  fd_fdstat_get() {
54
- const e = new ct(lt, 0);
55
- return e.fs_rights_base = BigInt(bt | ft), { ret: w, fdstat: e };
1373
+ const e = new Oe($, 0);
1374
+ return e.fs_rights_base = BigInt(66), { ret: 0, fdstat: e };
56
1375
  }
57
1376
  fd_close() {
58
- return this.close(), w;
1377
+ return this.close(), 0;
59
1378
  }
60
1379
  close() {
61
1380
  if (this.closed) return;
62
1381
  this.closed = !0;
63
1382
  const e = this.waiters;
64
1383
  this.waiters = [];
65
- for (const n of e) n();
1384
+ for (const t of e) t();
66
1385
  }
67
1386
  push(e) {
68
1387
  if (this.closed || !e?.byteLength) return;
69
1388
  this.chunks.push(e), this.total += e.byteLength;
70
- const n = this.waiters;
1389
+ const t = this.waiters;
71
1390
  this.waiters = [];
72
- for (const s of n) s();
1391
+ for (const i of t) i();
73
1392
  }
74
1393
  waitForData() {
75
1394
  return this.closed || this.total > 0 ? Promise.resolve() : new Promise((e) => this.waiters.push(e));
76
1395
  }
77
1396
  fd_read(e) {
78
- if (this.closed && this.total === 0) return { ret: w, data: new Uint8Array() };
79
- const n = Math.min(Math.max(0, Number(e) || 0), this.total);
80
- if (n === 0) return { ret: Et, data: new Uint8Array() };
81
- const s = new Uint8Array(n);
82
- let r = 0;
83
- for (; r < n && this.chunks.length; ) {
84
- const o = this.chunks[0], i = Math.min(o.byteLength, n - r);
85
- s.set(o.subarray(0, i), r), r += i, i === o.byteLength ? this.chunks.shift() : this.chunks[0] = o.subarray(i);
1397
+ if (this.closed && this.total === 0) return { ret: 0, data: new Uint8Array() };
1398
+ const t = Math.min(Math.max(0, Number(e) || 0), this.total);
1399
+ if (t === 0) return { ret: 6, data: new Uint8Array() };
1400
+ const i = new Uint8Array(t);
1401
+ let a = 0;
1402
+ for (; a < t && this.chunks.length; ) {
1403
+ const r = this.chunks[0], s = Math.min(r.byteLength, t - a);
1404
+ i.set(r.subarray(0, s), a), a += s, s === r.byteLength ? this.chunks.shift() : this.chunks[0] = r.subarray(s);
86
1405
  }
87
- return this.total -= r, { ret: w, data: s };
1406
+ return this.total -= a, { ret: 0, data: i };
88
1407
  }
89
1408
  fd_write() {
90
- return { ret: T, nwritten: 0 };
1409
+ return { ret: 8, nwritten: 0 };
91
1410
  }
92
1411
  fd_seek() {
93
- return { ret: T, offset: 0n };
1412
+ return { ret: 8, offset: 0n };
94
1413
  }
95
1414
  fd_tell() {
96
- return { ret: T, offset: 0n };
1415
+ return { ret: 8, offset: 0n };
97
1416
  }
98
1417
  fd_pread() {
99
- return { ret: T, data: new Uint8Array() };
1418
+ return { ret: 8, data: new Uint8Array() };
100
1419
  }
101
1420
  fd_pwrite() {
102
- return { ret: T, nwritten: 0 };
1421
+ return { ret: 8, nwritten: 0 };
103
1422
  }
104
1423
  }
105
- class tt extends at {
1424
+ class nt extends Se {
106
1425
  onWrite;
107
1426
  constructor(e) {
108
1427
  super(), this.onWrite = e;
109
1428
  }
110
1429
  fd_fdstat_get() {
111
- const e = new ct(lt, 0);
112
- return e.fs_rights_base = BigInt(ft), { ret: w, fdstat: e };
1430
+ const e = new Oe($, 0);
1431
+ return e.fs_rights_base = BigInt(64), { ret: 0, fdstat: e };
113
1432
  }
114
1433
  fd_write(e) {
115
- return this.onWrite(new Uint8Array(e)), { ret: w, nwritten: e.byteLength };
1434
+ return this.onWrite(new Uint8Array(e)), { ret: 0, nwritten: e.byteLength };
116
1435
  }
117
1436
  fd_close() {
118
- return w;
1437
+ return 0;
119
1438
  }
120
1439
  }
121
- async function Dt({ cols: t, rows: e, wasmPath: n, runtimePath: s, env: r, files: o }) {
122
- let i = 1;
1440
+ async function nn({ cols: n, rows: e, wasmPath: t, runtimePath: i, env: a, files: r }) {
1441
+ let s = 1;
123
1442
  try {
124
- for (F = null, B = null, x = null, S = null, u = null, f = new Mt(); Y.length; ) f.push(Y.shift());
125
- const a = await Lt(n), y = await Ot(s), c = Wt(y, () => {
1443
+ for (se = null, ie = null, ce = null, L = null, S = null, N = new tn(); Pe.length; ) N.push(Pe.shift());
1444
+ const o = await ln(t), f = await cn(i), l = pn(f, () => {
126
1445
  });
127
- o && Array.isArray(o) && o.length && Pt(c, o);
128
- const g = new tt(Ft), E = new tt((k) => {
129
- const v = vt.decode(k);
130
- v && (W = (W + v).slice(-8192)), postMessage({ type: "stderr", message: v });
131
- }), b = new st("nvim", c.contents), N = c.contents.get("tmp")?.contents || /* @__PURE__ */ new Map(), I = new st("tmp", N), A = ["nvim", "--headless", "--embed", "-u", "NORC", "--noplugin", "-i", "NONE", "-n"], R = [
1446
+ r && Array.isArray(r) && r.length && un(l, r);
1447
+ const u = new nt(_n), c = new nt((A) => {
1448
+ const C = en.decode(A);
1449
+ C && (oe = (oe + C).slice(-8192)), postMessage({ type: "stderr", message: C });
1450
+ }), _ = new it("nvim", l.contents), p = l.contents.get("tmp")?.contents || /* @__PURE__ */ new Map(), h = new it("tmp", p), y = ["nvim", "--headless", "--embed", "-u", "NORC", "--noplugin", "-i", "NONE", "-n"], R = [
132
1451
  "VIMRUNTIME=/nvim/runtime",
133
1452
  "HOME=/nvim/home",
134
1453
  "PWD=/nvim",
@@ -137,277 +1456,277 @@ async function Dt({ cols: t, rows: e, wasmPath: n, runtimePath: s, env: r, files
137
1456
  "XDG_STATE_HOME=/nvim/home/.local/state",
138
1457
  "PATH=/usr/bin:/bin",
139
1458
  "TMPDIR=/nvim/tmp",
140
- `COLUMNS=${t || 120}`,
1459
+ `COLUMNS=${n || 120}`,
141
1460
  `LINES=${e || 40}`
142
1461
  ];
143
- if (r && typeof r == "object")
144
- for (const [k, v] of Object.entries(r))
145
- k && R.push(`${k}=${String(v ?? "")}`);
146
- _ = new pt(A, R, [f, g, E, b, I], { debug: !1 }), _.fds[0] = f, _.fds[1] = g, _.fds[2] = E, _.fds[3] = b, _.fds[4] = I, _.preopens = { "/nvim": b, "/tmp": I };
147
- const m = xt(() => _?.wasiImport?.proc_exit?.(1)), l = { ..._.wasiImport };
148
- l.fd_read = _.wasiImport.fd_read, l.poll_oneoff = (k, v, j, U) => It(k, v, j, U);
149
- const d = await WebAssembly.instantiate(a, {
150
- wasi_snapshot_preview1: l,
1462
+ if (a && typeof a == "object")
1463
+ for (const [A, C] of Object.entries(a))
1464
+ A && R.push(`${A}=${String(C ?? "")}`);
1465
+ x = new It(y, R, [N, u, c, _, h], { debug: !1 }), x.fds[0] = N, x.fds[1] = u, x.fds[2] = c, x.fds[3] = _, x.fds[4] = h, x.preopens = { "/nvim": _, "/tmp": h };
1466
+ const m = yn(() => x?.wasiImport?.proc_exit?.(1)), g = { ...x.wasiImport };
1467
+ g.fd_read = x.wasiImport.fd_read, g.poll_oneoff = (A, C, F, M) => rn(A, C, F, M);
1468
+ const E = await WebAssembly.instantiate(o, {
1469
+ wasi_snapshot_preview1: g,
151
1470
  env: m
152
- }), D = d.instance ?? d.instance;
153
- u = D.exports, Nt(u), _.inst = D, i = await Tt(u);
154
- } catch (a) {
155
- if (a instanceof rt)
156
- i = a.code;
1471
+ }), T = E.instance ?? E.instance;
1472
+ S = T.exports, an(S), x.inst = T, s = await fn(S);
1473
+ } catch (o) {
1474
+ if (o instanceof ge)
1475
+ s = o.code;
157
1476
  else {
158
- const y = a?.message || String(a), c = a?.stack;
159
- postMessage({ type: "start-error", message: c ? `${y}
160
- ${c}` : y });
1477
+ const f = o?.message || String(o), l = o?.stack;
1478
+ postMessage({ type: "start-error", message: l ? `${f}
1479
+ ${l}` : f });
161
1480
  }
162
1481
  }
163
- postMessage({ type: "exit", code: i, lastStderr: W });
164
- }
165
- function It(t, e, n, s) {
166
- if (!u?.memory) return ht;
167
- const r = Number(n) >>> 0;
168
- if (r === 0) return q;
169
- const o = u?.asyncify_get_state?.() ?? 0;
170
- o === 0 && S && (S = null);
171
- const i = new DataView(u.memory.buffer), a = 48, y = 32, c = () => BigInt(Math.round(performance.now() * 1e6)), g = () => BigInt(Date.now()) * 1000000n;
172
- let E = !1, b = null;
173
- const h = [], N = new Array(r).fill(null), I = o === 2 && S && S.in_ptr === t >>> 0 && S.nsubscriptions === r;
174
- for (let m = 0; m < r; m += 1) {
175
- const l = t + m * a >>> 0, d = i.getBigUint64(l, !0), p = i.getUint8(l + 8);
176
- if (p === mt || p === J) {
177
- const D = i.getUint32(l + 16, !0);
178
- if (p === J) {
179
- h.push({ userdata: d, eventtype: p });
1482
+ postMessage({ type: "exit", code: s, lastStderr: oe });
1483
+ }
1484
+ function rn(n, e, t, i) {
1485
+ if (!S?.memory) return 21;
1486
+ const a = Number(t) >>> 0;
1487
+ if (a === 0) return 28;
1488
+ const r = S?.asyncify_get_state?.() ?? 0;
1489
+ r === 0 && L && (L = null);
1490
+ const s = new DataView(S.memory.buffer), o = 48, f = 32, l = () => BigInt(Math.round(performance.now() * 1e6)), u = () => BigInt(Date.now()) * 1000000n;
1491
+ let c = !1, _ = null;
1492
+ const d = [], p = new Array(a).fill(null), h = r === 2 && L && L.in_ptr === n >>> 0 && L.nsubscriptions === a;
1493
+ for (let m = 0; m < a; m += 1) {
1494
+ const g = n + m * o >>> 0, E = s.getBigUint64(g, !0), O = s.getUint8(g + 8);
1495
+ if (O === vt || O === Ze) {
1496
+ const T = s.getUint32(g + 16, !0);
1497
+ if (O === Ze) {
1498
+ d.push({ userdata: E, eventtype: O });
180
1499
  continue;
181
1500
  }
182
- if (D === 0) {
183
- !!(f && (f.total > 0 || f.closed)) ? h.push({ userdata: d, eventtype: p }) : E = !0;
1501
+ if (T === 0) {
1502
+ !!(N && (N.total > 0 || N.closed)) ? d.push({ userdata: E, eventtype: O }) : c = !0;
184
1503
  continue;
185
1504
  }
186
- h.push({ userdata: d, eventtype: p });
1505
+ d.push({ userdata: E, eventtype: O });
187
1506
  continue;
188
1507
  }
189
- if (p === _t) {
190
- const D = i.getUint32(l + 16, !0), k = i.getBigUint64(l + 24, !0), v = i.getUint16(l + 36, !0), j = D === At ? c : D === kt ? g : null;
191
- if (!j) return q;
192
- const U = j(), dt = (v & St) !== 0, $ = I && S?.clockDeadlines?.[m] != null ? BigInt(S.clockDeadlines[m]) : dt ? k : U + k;
193
- if (N[m] = $, $ <= U)
194
- h.push({ userdata: d, eventtype: p });
1508
+ if (O === ft) {
1509
+ const T = s.getUint32(g + 16, !0), A = s.getBigUint64(g + 24, !0), C = s.getUint16(g + 36, !0), F = T === 1 ? l : T === 0 ? u : null;
1510
+ if (!F) return 28;
1511
+ const M = F(), U = (C & lt) !== 0, H = h && L?.clockDeadlines?.[m] != null ? BigInt(L.clockDeadlines[m]) : U ? A : M + A;
1512
+ if (p[m] = H, H <= M)
1513
+ d.push({ userdata: E, eventtype: O });
195
1514
  else {
196
- const X = $ - U;
197
- (b === null || X < b) && (b = X);
1515
+ const de = H - M;
1516
+ (_ === null || de < _) && (_ = de);
198
1517
  }
199
1518
  continue;
200
1519
  }
201
- return it;
202
- }
203
- if (h.length > 0) {
204
- o === 2 && et(), S = null;
205
- const m = new DataView(u.memory.buffer), l = Math.min(h.length, r);
206
- for (let d = 0; d < l; d += 1) {
207
- const p = h[d];
208
- new wt(p.userdata, w, p.eventtype).write_bytes(m, e + d * y >>> 0);
1520
+ return 58;
1521
+ }
1522
+ if (d.length > 0) {
1523
+ r === 2 && rt(), L = null;
1524
+ const m = new DataView(S.memory.buffer), g = Math.min(d.length, a);
1525
+ for (let E = 0; E < g; E += 1) {
1526
+ const O = d[E];
1527
+ new ct(O.userdata, 0, O.eventtype).write_bytes(m, e + E * f >>> 0);
209
1528
  }
210
- return typeof s == "number" && m.setUint32(s, l, !0), w;
1529
+ return typeof i == "number" && m.setUint32(i, g, !0), 0;
211
1530
  }
212
- const A = [], R = !!(f && !f.closed && f.total === 0);
213
- if ((E || R) && f && !f.closed && A.push(Rt()), b !== null) {
214
- const l = Number(b / 1000000n), d = Number.isFinite(l) && l > 0 ? l : 0;
215
- A.push(new Promise((p) => setTimeout(p, Math.min(d, 50))));
1531
+ const y = [], R = !!(N && !N.closed && N.total === 0);
1532
+ if ((c || R) && N && !N.closed && y.push(sn()), _ !== null) {
1533
+ const g = Number(_ / 1000000n), E = Number.isFinite(g) && g > 0 ? g : 0;
1534
+ y.push(new Promise((O) => setTimeout(O, Math.min(E, 50))));
216
1535
  }
217
- return A.length === 0 ? (typeof s == "number" && i.setUint32(s, 0, !0), w) : (o === 2 && et(), o === 0 || o === 2 ? (S = { in_ptr: t >>> 0, nsubscriptions: r, clockDeadlines: N }, Ut(A.length === 1 ? A[0] : Promise.race(A)), typeof s == "number" && new DataView(u.memory.buffer).setUint32(s, 0, !0), w) : (typeof s == "number" && i.setUint32(s, 0, !0), w));
1536
+ return y.length === 0 ? (typeof i == "number" && s.setUint32(i, 0, !0), 0) : (r === 2 && rt(), r === 0 || r === 2 ? (L = { in_ptr: n >>> 0, nsubscriptions: a, clockDeadlines: p }, on(y.length === 1 ? y[0] : Promise.race(y)), typeof i == "number" && new DataView(S.memory.buffer).setUint32(i, 0, !0), 0) : (typeof i == "number" && s.setUint32(i, 0, !0), 0));
218
1537
  }
219
- function Rt() {
220
- return !f || f.closed || f.total > 0 ? Promise.resolve() : (B || (B = f.waitForData().finally(() => {
221
- B = null;
222
- })), B);
1538
+ function sn() {
1539
+ return !N || N.closed || N.total > 0 ? Promise.resolve() : (ie || (ie = N.waitForData().finally(() => {
1540
+ ie = null;
1541
+ })), ie);
223
1542
  }
224
- function Nt(t) {
225
- if (!t?.memory) throw new Error("asyncify: missing exported memory");
226
- if (typeof t.asyncify_start_unwind != "function") throw new Error("asyncify: missing exports");
227
- if (typeof t.nvim_asyncify_get_data_ptr == "function" && typeof t.nvim_asyncify_get_stack_start == "function" && typeof t.nvim_asyncify_get_stack_end == "function") {
228
- M = t.nvim_asyncify_get_data_ptr() >>> 0, G = t.nvim_asyncify_get_stack_start() >>> 0, V = t.nvim_asyncify_get_stack_end() >>> 0, z();
1543
+ function an(n) {
1544
+ if (!n?.memory) throw new Error("asyncify: missing exported memory");
1545
+ if (typeof n.asyncify_start_unwind != "function") throw new Error("asyncify: missing exports");
1546
+ if (typeof n.nvim_asyncify_get_data_ptr == "function" && typeof n.nvim_asyncify_get_stack_start == "function" && typeof n.nvim_asyncify_get_stack_end == "function") {
1547
+ P = n.nvim_asyncify_get_data_ptr() >>> 0, me = n.nvim_asyncify_get_stack_start() >>> 0, Ee = n.nvim_asyncify_get_stack_end() >>> 0, ue();
229
1548
  return;
230
1549
  }
231
- const e = 64 * 1024 * 1024, n = 65536, s = e + 64, r = Math.ceil(s / n);
232
- t.memory.grow(r);
233
- const o = t.memory.buffer.byteLength >>> 0;
234
- V = o, M = ((o - e >>> 0) - 8 & -8) >>> 0, G = M + 8 >>> 0, z();
1550
+ const e = 64 * 1024 * 1024, t = 65536, i = e + 64, a = Math.ceil(i / t);
1551
+ n.memory.grow(a);
1552
+ const r = n.memory.buffer.byteLength >>> 0;
1553
+ Ee = r, P = ((r - e >>> 0) - 8 & -8) >>> 0, me = P + 8 >>> 0, ue();
235
1554
  }
236
- function z() {
237
- if (!u?.memory || !M || !G || !V) return;
238
- const t = new DataView(u.memory.buffer);
239
- t.setInt32(M, G, !0), t.setInt32(M + 4, V, !0);
1555
+ function ue() {
1556
+ if (!S?.memory || !P || !me || !Ee) return;
1557
+ const n = new DataView(S.memory.buffer);
1558
+ n.setInt32(P, me, !0), n.setInt32(P + 4, Ee, !0);
240
1559
  }
241
- function Ut(t) {
242
- if (!u || !M) throw new Error("asyncify: not initialized");
243
- if (x) throw new Error("asyncify: overlapping async operation");
244
- z(), x = t, u.asyncify_start_unwind(M);
1560
+ function on(n) {
1561
+ if (!S || !P) throw new Error("asyncify: not initialized");
1562
+ if (ce) throw new Error("asyncify: overlapping async operation");
1563
+ ue(), ce = n, S.asyncify_start_unwind(P);
245
1564
  }
246
- function et() {
247
- !u?.asyncify_get_state || !u?.asyncify_stop_rewind || u.asyncify_get_state() === 2 && (u.asyncify_stop_rewind(), z());
1565
+ function rt() {
1566
+ !S?.asyncify_get_state || !S?.asyncify_stop_rewind || S.asyncify_get_state() === 2 && (S.asyncify_stop_rewind(), ue());
248
1567
  }
249
- async function Tt(t) {
1568
+ async function fn(n) {
250
1569
  for (; ; ) {
251
1570
  try {
252
- t._start();
253
- } catch (s) {
254
- if (s instanceof rt) return s.code;
255
- throw s;
1571
+ n._start();
1572
+ } catch (i) {
1573
+ if (i instanceof ge) return i.code;
1574
+ throw i;
256
1575
  }
257
- const e = t.asyncify_get_state();
1576
+ const e = n.asyncify_get_state();
258
1577
  if (e === 0) return 0;
259
1578
  if (e === 2) {
260
- t.asyncify_stop_rewind(), z();
1579
+ n.asyncify_stop_rewind(), ue();
261
1580
  continue;
262
1581
  }
263
1582
  if (e !== 1) throw new Error(`asyncify: unexpected state ${e}`);
264
- t.asyncify_stop_unwind();
265
- const n = x;
266
- if (x = null, !n) throw new Error("asyncify: missing pending promise");
267
- await n, t.asyncify_start_rewind(M);
268
- }
269
- }
270
- async function Lt(t) {
271
- if (L && L.url === t && L.bytes?.byteLength) return L.bytes;
272
- const e = await yt(t);
273
- return L = { url: t, bytes: e }, e;
274
- }
275
- async function Ot(t) {
276
- if (O && O.url === t && O.entries?.length) return O.entries;
277
- const e = await yt(t);
278
- let n;
279
- if (Bt(e))
1583
+ n.asyncify_stop_unwind();
1584
+ const t = ce;
1585
+ if (ce = null, !t) throw new Error("asyncify: missing pending promise");
1586
+ await t, n.asyncify_start_rewind(P);
1587
+ }
1588
+ }
1589
+ async function ln(n) {
1590
+ if (Z && Z.url === n && Z.bytes?.byteLength) return Z.bytes;
1591
+ const e = await mt(n);
1592
+ return Z = { url: n, bytes: e }, e;
1593
+ }
1594
+ async function cn(n) {
1595
+ if (ee && ee.url === n && ee.entries?.length) return ee.entries;
1596
+ const e = await mt(n);
1597
+ let t;
1598
+ if (dn(e))
280
1599
  try {
281
- n = gt(e);
282
- } catch (r) {
283
- throw new Error(`gunzip runtime failed: ${r?.message ?? r}`);
1600
+ t = $t(e);
1601
+ } catch (a) {
1602
+ throw new Error(`gunzip runtime failed: ${a?.message ?? a}`);
284
1603
  }
285
1604
  else
286
- n = e;
287
- let s;
1605
+ t = e;
1606
+ let i;
288
1607
  try {
289
- s = Ct(n);
290
- } catch (r) {
291
- throw new Error(`untar runtime failed: ${r?.message ?? r}`);
292
- }
293
- return O = { url: t, entries: s }, s;
294
- }
295
- function Pt(t, e) {
296
- for (const n of e) {
297
- const r = String(n?.path ?? "").replace(/^\/+/, "").replace(/^\.\/+/, "");
298
- if (!r || r.endsWith("/")) continue;
299
- const o = ut(n?.data);
300
- if (!o) continue;
301
- const i = r.split("/").filter(Boolean);
302
- if (!i.length) continue;
303
- let a = t;
304
- for (let c = 0; c < i.length - 1; c += 1) {
305
- const g = i[c];
306
- a.contents.has(g) || a.contents.set(g, new C(/* @__PURE__ */ new Map())), a = a.contents.get(g);
1608
+ i = hn(t);
1609
+ } catch (a) {
1610
+ throw new Error(`untar runtime failed: ${a?.message ?? a}`);
1611
+ }
1612
+ return ee = { url: n, entries: i }, i;
1613
+ }
1614
+ function un(n, e) {
1615
+ for (const t of e) {
1616
+ const a = String(t?.path ?? "").replace(/^\/+/, "").replace(/^\.\/+/, "");
1617
+ if (!a || a.endsWith("/")) continue;
1618
+ const r = wt(t?.data);
1619
+ if (!r) continue;
1620
+ const s = a.split("/").filter(Boolean);
1621
+ if (!s.length) continue;
1622
+ let o = n;
1623
+ for (let l = 0; l < s.length - 1; l += 1) {
1624
+ const u = s[l];
1625
+ o.contents.has(u) || o.contents.set(u, new D(/* @__PURE__ */ new Map())), o = o.contents.get(u);
307
1626
  }
308
- const y = i[i.length - 1];
309
- a.contents.set(y, new ot(o, { readonly: !1 }));
1627
+ const f = s[s.length - 1];
1628
+ o.contents.set(f, new je(r, { readonly: !1 }));
310
1629
  }
311
1630
  }
312
- function ut(t) {
313
- if (!t) return new Uint8Array();
314
- if (t instanceof Uint8Array) return t;
315
- if (t instanceof ArrayBuffer) return new Uint8Array(t);
316
- if (t instanceof SharedArrayBuffer) return new Uint8Array(t);
317
- if (Array.isArray(t)) return new Uint8Array(t);
318
- if (t && t.type === "Buffer" && Array.isArray(t.data)) return new Uint8Array(t.data);
1631
+ function wt(n) {
1632
+ if (!n) return new Uint8Array();
1633
+ if (n instanceof Uint8Array) return n;
1634
+ if (n instanceof ArrayBuffer) return new Uint8Array(n);
1635
+ if (n instanceof SharedArrayBuffer) return new Uint8Array(n);
1636
+ if (Array.isArray(n)) return new Uint8Array(n);
1637
+ if (n && n.type === "Buffer" && Array.isArray(n.data)) return new Uint8Array(n.data);
319
1638
  try {
320
- return new TextEncoder().encode(String(t));
1639
+ return new TextEncoder().encode(String(n));
321
1640
  } catch {
322
1641
  return null;
323
1642
  }
324
1643
  }
325
- function Ft(t) {
326
- F || (F = new Q(nt));
1644
+ function _n(n) {
1645
+ se || (se = new tt(st));
327
1646
  try {
328
- F.push(t);
1647
+ se.push(n);
329
1648
  } catch {
330
- F = new Q(nt);
1649
+ se = new tt(st);
331
1650
  }
332
1651
  }
333
- function nt(t) {
334
- if (!Array.isArray(t) || t.length < 1) return;
335
- const e = t[0];
1652
+ function st(n) {
1653
+ if (!Array.isArray(n) || n.length < 1) return;
1654
+ const e = n[0];
336
1655
  if (e === 0) {
337
- const [, n, s, r] = t;
338
- postMessage(s === "wasm-clipboard-paste" ? { type: "clipboard-paste", msgid: n } : { type: "rpc-request", msgid: n, method: s, params: r });
1656
+ const [, t, i, a] = n;
1657
+ postMessage(i === "wasm-clipboard-paste" ? { type: "clipboard-paste", msgid: t } : { type: "rpc-request", msgid: t, method: i, params: a });
339
1658
  } else if (e === 1) {
340
- const [, n, s, r] = t;
341
- postMessage({ type: "rpc-response", msgid: n, error: s, result: r });
1659
+ const [, t, i, a] = n;
1660
+ postMessage({ type: "rpc-response", msgid: t, error: i, result: a });
342
1661
  } else if (e === 2) {
343
- const [, n, s] = t;
344
- if (n === "wasm-clipboard-copy") {
345
- const r = Array.isArray(s?.[0]) ? s[0] : [], o = typeof s?.[1] == "string" ? s[1] : "v";
346
- postMessage({ type: "clipboard-copy", lines: r, regtype: o });
347
- } else (n === "nvim_buf_lines_event" || n === "nvim_buf_detach_event" || n === "redraw" || n === "monaco_cursor" || n === "monaco_mode" || n === "monaco_cursorMove" || n === "monaco_scroll" || n === "monaco_reveal" || n === "monaco_moveCursor" || n === "monaco_scrolloff" || n === "monaco_host_command" || n === "monaco_buf_enter" || n === "monaco_buf_delete") && postMessage({ type: "rpc-notify", method: n, params: s });
348
- }
349
- }
350
- async function yt(t) {
351
- const e = await fetch(t);
352
- if (!e.ok) throw new Error(`fetch ${t} failed (${e.status})`);
353
- if ((e.headers.get("content-type") || "").toLowerCase().includes("text/html")) throw new Error(`fetch ${t} returned HTML (likely wrong path or dev server fallback)`);
354
- const s = new Uint8Array(await e.arrayBuffer());
355
- if (!s.byteLength) throw new Error(`fetch ${t} returned empty body`);
356
- return s;
357
- }
358
- function Bt(t) {
359
- return t && t.length >= 2 && t[0] === 31 && t[1] === 139;
360
- }
361
- function Ct(t) {
362
- const e = [], n = t instanceof Uint8Array ? t : new Uint8Array(t);
363
- let s = 0;
364
- const r = new TextDecoder();
365
- let o = 0;
366
- for (; s + 512 <= n.length; ) {
367
- if (o++ > 1e5) throw new Error("untar safety break");
368
- const i = K(r, n, s, 100), a = K(r, n, s + 124, 12), y = n[s + 156], c = K(r, n, s + 345, 155);
369
- if (!i && !c) break;
370
- const g = a.trim() || "0", E = parseInt(g, 8);
371
- if (!Number.isFinite(E) || E < 0) throw new Error(`invalid tar size: ${g}`);
372
- const b = c ? `${c}/${i}` : i, h = s + 512, N = h + E, I = n.slice(h, N);
373
- e.push({ name: b, type: y === 53 ? "dir" : "file", data: I });
374
- const A = Math.ceil(E / 512), R = h + A * 512;
375
- if (R <= s) throw new Error("tar parse did not advance");
376
- s = R;
1662
+ const [, t, i] = n;
1663
+ if (t === "wasm-clipboard-copy") {
1664
+ const a = Array.isArray(i?.[0]) ? i[0] : [], r = typeof i?.[1] == "string" ? i[1] : "v";
1665
+ postMessage({ type: "clipboard-copy", lines: a, regtype: r });
1666
+ } else (t === "nvim_buf_lines_event" || t === "nvim_buf_detach_event" || t === "redraw" || t === "monaco_cursor" || t === "monaco_mode" || t === "monaco_cursorMove" || t === "monaco_scroll" || t === "monaco_reveal" || t === "monaco_moveCursor" || t === "monaco_scrolloff" || t === "monaco_host_command" || t === "monaco_buf_enter" || t === "monaco_buf_delete") && postMessage({ type: "rpc-notify", method: t, params: i });
1667
+ }
1668
+ }
1669
+ async function mt(n) {
1670
+ const e = await fetch(n);
1671
+ if (!e.ok) throw new Error(`fetch ${n} failed (${e.status})`);
1672
+ if ((e.headers.get("content-type") || "").toLowerCase().includes("text/html")) throw new Error(`fetch ${n} returned HTML (likely wrong path or dev server fallback)`);
1673
+ const i = new Uint8Array(await e.arrayBuffer());
1674
+ if (!i.byteLength) throw new Error(`fetch ${n} returned empty body`);
1675
+ return i;
1676
+ }
1677
+ function dn(n) {
1678
+ return n && n.length >= 2 && n[0] === 31 && n[1] === 139;
1679
+ }
1680
+ function hn(n) {
1681
+ const e = [], t = n instanceof Uint8Array ? n : new Uint8Array(n);
1682
+ let i = 0;
1683
+ const a = new TextDecoder();
1684
+ let r = 0;
1685
+ for (; i + 512 <= t.length; ) {
1686
+ if (r++ > 1e5) throw new Error("untar safety break");
1687
+ const s = Le(a, t, i, 100), o = Le(a, t, i + 124, 12), f = t[i + 156], l = Le(a, t, i + 345, 155);
1688
+ if (!s && !l) break;
1689
+ const u = o.trim() || "0", c = parseInt(u, 8);
1690
+ if (!Number.isFinite(c) || c < 0) throw new Error(`invalid tar size: ${u}`);
1691
+ const _ = l ? `${l}/${s}` : s, d = i + 512, p = d + c, h = t.slice(d, p);
1692
+ e.push({ name: _, type: f === 53 ? "dir" : "file", data: h });
1693
+ const y = Math.ceil(c / 512), R = d + y * 512;
1694
+ if (R <= i) throw new Error("tar parse did not advance");
1695
+ i = R;
377
1696
  }
378
1697
  return e;
379
1698
  }
380
- function K(t, e, n, s) {
381
- let r = n;
382
- const o = n + s;
383
- for (; r < o && e[r] !== 0; ) r += 1;
384
- return t.decode(e.subarray(n, r)).trim();
1699
+ function Le(n, e, t, i) {
1700
+ let a = t;
1701
+ const r = t + i;
1702
+ for (; a < r && e[a] !== 0; ) a += 1;
1703
+ return n.decode(e.subarray(t, a)).trim();
385
1704
  }
386
- function Wt(t, e) {
387
- const n = new C(/* @__PURE__ */ new Map());
388
- for (const s of t) {
389
- const r = s.name.replace(/^\.\/?/, "");
390
- if (!r) continue;
391
- const o = r.split("/").filter(Boolean);
392
- if (!o.length) continue;
393
- let i = n;
394
- for (let y = 0; y < o.length - 1; y += 1) {
395
- const c = o[y];
396
- i.contents.has(c) || i.contents.set(c, new C(/* @__PURE__ */ new Map())), i = i.contents.get(c);
1705
+ function pn(n, e) {
1706
+ const t = new D(/* @__PURE__ */ new Map());
1707
+ for (const i of n) {
1708
+ const a = i.name.replace(/^\.\/?/, "");
1709
+ if (!a) continue;
1710
+ const r = a.split("/").filter(Boolean);
1711
+ if (!r.length) continue;
1712
+ let s = t;
1713
+ for (let f = 0; f < r.length - 1; f += 1) {
1714
+ const l = r[f];
1715
+ s.contents.has(l) || s.contents.set(l, new D(/* @__PURE__ */ new Map())), s = s.contents.get(l);
397
1716
  }
398
- const a = o[o.length - 1];
399
- s.type === "dir" ? i.contents.has(a) || i.contents.set(a, new C(/* @__PURE__ */ new Map())) : i.contents.set(a, new ot(s.data, { readonly: !0 }));
1717
+ const o = r[r.length - 1];
1718
+ i.type === "dir" ? s.contents.has(o) || s.contents.set(o, new D(/* @__PURE__ */ new Map())) : s.contents.set(o, new je(i.data, { readonly: !0 }));
400
1719
  }
401
- return P(n, "home"), P(n, "tmp"), P(n, "home/.config"), P(n, "home/.local/share"), P(n, "home/.local/state"), n;
1720
+ return te(t, "home"), te(t, "tmp"), te(t, "home/.config"), te(t, "home/.local/share"), te(t, "home/.local/state"), t;
402
1721
  }
403
- function P(t, e) {
404
- const n = e.split("/").filter(Boolean);
405
- let s = t;
406
- for (const r of n)
407
- s.contents.has(r) || s.contents.set(r, new C(/* @__PURE__ */ new Map())), s = s.contents.get(r);
1722
+ function te(n, e) {
1723
+ const t = e.split("/").filter(Boolean);
1724
+ let i = n;
1725
+ for (const a of t)
1726
+ i.contents.has(a) || i.contents.set(a, new D(/* @__PURE__ */ new Map())), i = i.contents.get(a);
408
1727
  }
409
- function xt(t) {
410
- const e = WebAssembly, n = new e.Tag({ parameters: ["i32"], results: [] });
1728
+ function yn(n) {
1729
+ const e = WebAssembly, t = new e.Tag({ parameters: ["i32"], results: [] });
411
1730
  return {
412
1731
  flock: () => 0,
413
1732
  getpid: () => 1,
@@ -417,8 +1736,8 @@ function xt(t) {
417
1736
  uv_utf16_length_as_wtf8: () => 0,
418
1737
  uv_utf16_to_wtf8: () => -38,
419
1738
  uv_wtf8_length_as_utf16: () => 0,
420
- __wasm_longjmp: (s) => {
421
- throw t && t(1), new e.Exception(n, [s ?? 0]);
1739
+ __wasm_longjmp: (i) => {
1740
+ throw n && n(1), new e.Exception(t, [i ?? 0]);
422
1741
  },
423
1742
  __wasm_setjmp: () => 0,
424
1743
  __wasm_setjmp_test: () => 0,
@@ -426,36 +1745,36 @@ function xt(t) {
426
1745
  clock: () => 0,
427
1746
  system: () => -1,
428
1747
  tmpnam: () => 0,
429
- __c_longjmp: n
1748
+ __c_longjmp: t
430
1749
  };
431
1750
  }
432
- class st extends Z {
433
- #t(e) {
1751
+ class it extends et {
1752
+ #e(e) {
434
1753
  return e.replace(/^\/+/, "");
435
1754
  }
436
- path_open(e, n, s, r, o, i) {
437
- return super.path_open(e, this.#t(n), s, r, o, i);
1755
+ path_open(e, t, i, a, r, s) {
1756
+ return super.path_open(e, this.#e(t), i, a, r, s);
438
1757
  }
439
- path_filestat_get(e, n) {
440
- return super.path_filestat_get(e, this.#t(n));
1758
+ path_filestat_get(e, t) {
1759
+ return super.path_filestat_get(e, this.#e(t));
441
1760
  }
442
1761
  path_create_directory(e) {
443
- return super.path_create_directory(this.#t(e));
1762
+ return super.path_create_directory(this.#e(e));
444
1763
  }
445
1764
  path_unlink_file(e) {
446
- return super.path_unlink_file(this.#t(e));
1765
+ return super.path_unlink_file(this.#e(e));
447
1766
  }
448
1767
  path_remove_directory(e) {
449
- return super.path_remove_directory(this.#t(e));
1768
+ return super.path_remove_directory(this.#e(e));
450
1769
  }
451
- path_link(e, n, s) {
452
- return super.path_link(this.#t(e), n, s);
1770
+ path_link(e, t, i) {
1771
+ return super.path_link(this.#e(e), t, i);
453
1772
  }
454
1773
  path_readlink(e) {
455
- return super.path_readlink(this.#t(e));
1774
+ return super.path_readlink(this.#e(e));
456
1775
  }
457
- path_symlink(e, n) {
458
- const s = Z.prototype.path_symlink;
459
- return s ? s.call(this, this.#t(e), this.#t(n)) : it;
1776
+ path_symlink(e, t) {
1777
+ const i = et.prototype.path_symlink;
1778
+ return i ? i.call(this, this.#e(e), this.#e(t)) : 58;
460
1779
  }
461
1780
  }