opfs-worker 2.1.0 → 2.1.1

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.
Files changed (78) hide show
  1. package/README.md +40 -27
  2. package/dist/{BaseOPFS-Cylz6ijk.js → BaseOPFS-BusBkyJX.js} +436 -358
  3. package/dist/BaseOPFS-BusBkyJX.js.map +1 -0
  4. package/dist/{BaseOPFS-BPw9AIQ-.cjs → BaseOPFS-CYwrD7-q.cjs} +4 -4
  5. package/dist/BaseOPFS-CYwrD7-q.cjs.map +1 -0
  6. package/dist/{OPFSAsync-s2P7y3sw.cjs → OPFSAsync-B2dR-2VR.cjs} +2 -2
  7. package/dist/{OPFSAsync-s2P7y3sw.cjs.map → OPFSAsync-B2dR-2VR.cjs.map} +1 -1
  8. package/dist/{OPFSAsync-BKSAJJeh.js → OPFSAsync-CO44W23e.js} +2 -2
  9. package/dist/{OPFSAsync-BKSAJJeh.js.map → OPFSAsync-CO44W23e.js.map} +1 -1
  10. package/dist/OPFSFacade-CEaSqTut.js +308 -0
  11. package/dist/OPFSFacade-CEaSqTut.js.map +1 -0
  12. package/dist/OPFSFacade-hrNXCn6w.cjs +2 -0
  13. package/dist/OPFSFacade-hrNXCn6w.cjs.map +1 -0
  14. package/dist/{OPFSSync-C7KBepe_.cjs → OPFSSync-BPrNtvFS.cjs} +2 -2
  15. package/dist/{OPFSSync-C7KBepe_.cjs.map → OPFSSync-BPrNtvFS.cjs.map} +1 -1
  16. package/dist/{OPFSSync-CsSQkpk5.js → OPFSSync-D7obTsl3.js} +2 -2
  17. package/dist/{OPFSSync-CsSQkpk5.js.map → OPFSSync-D7obTsl3.js.map} +1 -1
  18. package/dist/assets/dedicated.worker-DW6UqFo0.js.map +1 -0
  19. package/dist/core/BaseOPFS.d.ts +38 -7
  20. package/dist/core/BaseOPFS.d.ts.map +1 -1
  21. package/dist/createOPFSAsync-DdhJYoC0.js +10 -0
  22. package/dist/{createOPFSAsync-Y4Mg6qte.js.map → createOPFSAsync-DdhJYoC0.js.map} +1 -1
  23. package/dist/createOPFSAsync-DyWpvmL-.cjs +2 -0
  24. package/dist/{createOPFSAsync-BwKDmHsy.cjs.map → createOPFSAsync-DyWpvmL-.cjs.map} +1 -1
  25. package/dist/{createOPFSDedicated-CsnV6MLP.js → createOPFSDedicated-BwTc0NV5.js} +289 -215
  26. package/dist/{createOPFSDedicated-CsnV6MLP.js.map → createOPFSDedicated-BwTc0NV5.js.map} +1 -1
  27. package/dist/{createOPFSDedicated-pKTRWLdz.cjs → createOPFSDedicated-CEeRexom.cjs} +286 -212
  28. package/dist/{createOPFSDedicated-pKTRWLdz.cjs.map → createOPFSDedicated-CEeRexom.cjs.map} +1 -1
  29. package/dist/{createOPFSShared-CGdd__PH.js → createOPFSShared-BSFWsoLe.js} +2 -2
  30. package/dist/{createOPFSShared-CGdd__PH.js.map → createOPFSShared-BSFWsoLe.js.map} +1 -1
  31. package/dist/{createOPFSShared-CskROt7U.cjs → createOPFSShared-BoCft_BS.cjs} +2 -2
  32. package/dist/{createOPFSShared-CskROt7U.cjs.map → createOPFSShared-BoCft_BS.cjs.map} +1 -1
  33. package/dist/dedicated.worker.js +282 -208
  34. package/dist/dedicated.worker.js.map +1 -1
  35. package/dist/facade/OPFSFacade.d.ts +21 -3
  36. package/dist/facade/OPFSFacade.d.ts.map +1 -1
  37. package/dist/index.async.cjs +1 -1
  38. package/dist/index.async.js +4 -4
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +7 -7
  41. package/dist/index.pure.cjs +1 -1
  42. package/dist/index.pure.js +3 -3
  43. package/dist/index.sharedworker.cjs +1 -1
  44. package/dist/index.sharedworker.js +4 -4
  45. package/dist/index.sync.cjs +1 -1
  46. package/dist/index.sync.js +4 -4
  47. package/dist/shared.worker.js +430 -356
  48. package/dist/shared.worker.js.map +1 -1
  49. package/dist/types.d.ts +33 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/docs/api/backend.md +3 -3
  52. package/docs/api/create.md +1 -1
  53. package/docs/api/facade.md +28 -27
  54. package/docs/choosing-a-mode.md +6 -6
  55. package/docs/file-descriptors.md +46 -604
  56. package/docs/guides/async.md +2 -2
  57. package/docs/guides/dedicated.md +5 -5
  58. package/docs/guides/hashing.md +2 -2
  59. package/docs/guides/pure.md +3 -3
  60. package/docs/guides/sharedworker.md +1 -1
  61. package/docs/guides/streaming.md +145 -11
  62. package/docs/guides/watching.md +3 -3
  63. package/docs/migration.md +3 -3
  64. package/docs/types.md +92 -154
  65. package/package.json +12 -2
  66. package/src/core/BaseOPFS.ts +148 -25
  67. package/src/facade/OPFSFacade.ts +51 -4
  68. package/src/types.ts +37 -0
  69. package/dist/BaseOPFS-BPw9AIQ-.cjs.map +0 -1
  70. package/dist/BaseOPFS-Cylz6ijk.js.map +0 -1
  71. package/dist/OPFSFacade-DePnNRgt.cjs +0 -2
  72. package/dist/OPFSFacade-DePnNRgt.cjs.map +0 -1
  73. package/dist/OPFSFacade-XohWlHuu.js +0 -281
  74. package/dist/OPFSFacade-XohWlHuu.js.map +0 -1
  75. package/dist/assets/dedicated.worker-nY3tK4zi.js.map +0 -1
  76. package/dist/createOPFSAsync-BwKDmHsy.cjs +0 -2
  77. package/dist/createOPFSAsync-Y4Mg6qte.js +0 -10
  78. package/docs/README.md +0 -30
@@ -1,21 +1,21 @@
1
- import { O as c } from "./OPFSFacade-XohWlHuu.js";
1
+ import { O as c } from "./OPFSFacade-CEaSqTut.js";
2
2
  import { wrap as h } from "comlink";
3
3
  const a = `/**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
6
6
  * SPDX-License-Identifier: Apache-2.0
7
7
  */
8
- const xt = Symbol("Comlink.proxy"), zt = Symbol("Comlink.endpoint"), Wt = Symbol("Comlink.releaseProxy"), X = Symbol("Comlink.finalizer"), j = Symbol("Comlink.thrown"), bt = (s) => typeof s == "object" && s !== null || typeof s == "function", jt = {
9
- canHandle: (s) => bt(s) && s[xt],
8
+ const bt = Symbol("Comlink.proxy"), Wt = Symbol("Comlink.endpoint"), jt = Symbol("Comlink.releaseProxy"), X = Symbol("Comlink.finalizer"), j = Symbol("Comlink.thrown"), Ot = (s) => typeof s == "object" && s !== null || typeof s == "function", _t = {
9
+ canHandle: (s) => Ot(s) && s[bt],
10
10
  serialize(s) {
11
11
  const { port1: t, port2: e } = new MessageChannel();
12
12
  return ot(s, t), [e, [e]];
13
13
  },
14
14
  deserialize(s) {
15
- return s.start(), Gt(s);
15
+ return s.start(), qt(s);
16
16
  }
17
- }, _t = {
18
- canHandle: (s) => bt(s) && j in s,
17
+ }, Bt = {
18
+ canHandle: (s) => Ot(s) && j in s,
19
19
  serialize({ value: s }) {
20
20
  let t;
21
21
  return s instanceof Error ? t = {
@@ -30,11 +30,11 @@ const xt = Symbol("Comlink.proxy"), zt = Symbol("Comlink.endpoint"), Wt = Symbol
30
30
  deserialize(s) {
31
31
  throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
32
32
  }
33
- }, Ot = /* @__PURE__ */ new Map([
34
- ["proxy", jt],
35
- ["throw", _t]
33
+ }, Dt = /* @__PURE__ */ new Map([
34
+ ["proxy", _t],
35
+ ["throw", Bt]
36
36
  ]);
37
- function Bt(s, t) {
37
+ function Ut(s, t) {
38
38
  for (const e of s)
39
39
  if (t === e || e === "*" || e instanceof RegExp && e.test(t))
40
40
  return !0;
@@ -44,7 +44,7 @@ function ot(s, t = globalThis, e = ["*"]) {
44
44
  t.addEventListener("message", function n(r) {
45
45
  if (!r || !r.data)
46
46
  return;
47
- if (!Bt(e, r.origin)) {
47
+ if (!Ut(e, r.origin)) {
48
48
  console.warn(\`Invalid origin '\${r.origin}' for comlink proxy\`);
49
49
  return;
50
50
  }
@@ -65,7 +65,7 @@ function ot(s, t = globalThis, e = ["*"]) {
65
65
  case "CONSTRUCT":
66
66
  {
67
67
  const u = new f(...c);
68
- h = Zt(u);
68
+ h = Xt(u);
69
69
  }
70
70
  break;
71
71
  case "ENDPOINT":
@@ -85,7 +85,7 @@ function ot(s, t = globalThis, e = ["*"]) {
85
85
  }
86
86
  Promise.resolve(h).catch((l) => ({ value: l, [j]: 0 })).then((l) => {
87
87
  const [f, u] = q(l);
88
- t.postMessage(Object.assign(Object.assign({}, f), { id: i }), u), o === "RELEASE" && (t.removeEventListener("message", n), Dt(t), X in s && typeof s[X] == "function" && s[X]());
88
+ t.postMessage(Object.assign(Object.assign({}, f), { id: i }), u), o === "RELEASE" && (t.removeEventListener("message", n), vt(t), X in s && typeof s[X] == "function" && s[X]());
89
89
  }).catch((l) => {
90
90
  const [f, u] = q({
91
91
  value: new TypeError("Unserializable return value"),
@@ -95,13 +95,13 @@ function ot(s, t = globalThis, e = ["*"]) {
95
95
  });
96
96
  }), t.start && t.start();
97
97
  }
98
- function Ut(s) {
98
+ function Gt(s) {
99
99
  return s.constructor.name === "MessagePort";
100
100
  }
101
- function Dt(s) {
102
- Ut(s) && s.close();
101
+ function vt(s) {
102
+ Gt(s) && s.close();
103
103
  }
104
- function Gt(s, t) {
104
+ function qt(s, t) {
105
105
  const e = /* @__PURE__ */ new Map();
106
106
  return s.addEventListener("message", function(r) {
107
107
  const { data: i } = r;
@@ -124,18 +124,18 @@ function At(s) {
124
124
  return F(s, /* @__PURE__ */ new Map(), {
125
125
  type: "RELEASE"
126
126
  }).then(() => {
127
- Dt(s);
127
+ vt(s);
128
128
  });
129
129
  }
130
130
  const U = /* @__PURE__ */ new WeakMap(), G = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
131
131
  const t = (U.get(s) || 0) - 1;
132
132
  U.set(s, t), t === 0 && At(s);
133
133
  });
134
- function qt(s, t) {
134
+ function Vt(s, t) {
135
135
  const e = (U.get(t) || 0) + 1;
136
136
  U.set(t, e), G && G.register(s, t, s);
137
137
  }
138
- function Vt(s) {
138
+ function Yt(s) {
139
139
  G && G.unregister(s);
140
140
  }
141
141
  function et(s, t, e = [], n = function() {
@@ -143,9 +143,9 @@ function et(s, t, e = [], n = function() {
143
143
  let r = !1;
144
144
  const i = new Proxy(n, {
145
145
  get(o, a) {
146
- if (L(r), a === Wt)
146
+ if (L(r), a === jt)
147
147
  return () => {
148
- Vt(i), At(s), t.clear(), r = !0;
148
+ Yt(i), At(s), t.clear(), r = !0;
149
149
  };
150
150
  if (a === "then") {
151
151
  if (e.length === 0)
@@ -170,7 +170,7 @@ function et(s, t, e = [], n = function() {
170
170
  apply(o, a, c) {
171
171
  L(r);
172
172
  const h = e[e.length - 1];
173
- if (h === zt)
173
+ if (h === Wt)
174
174
  return F(s, t, {
175
175
  type: "ENDPOINT"
176
176
  }).then(N);
@@ -193,24 +193,24 @@ function et(s, t, e = [], n = function() {
193
193
  }, h).then(N);
194
194
  }
195
195
  });
196
- return qt(i, s), i;
196
+ return Vt(i, s), i;
197
197
  }
198
- function Yt(s) {
198
+ function Zt(s) {
199
199
  return Array.prototype.concat.apply([], s);
200
200
  }
201
201
  function ht(s) {
202
202
  const t = s.map(q);
203
- return [t.map((e) => e[0]), Yt(t.map((e) => e[1]))];
203
+ return [t.map((e) => e[0]), Zt(t.map((e) => e[1]))];
204
204
  }
205
- const vt = /* @__PURE__ */ new WeakMap();
205
+ const Ct = /* @__PURE__ */ new WeakMap();
206
206
  function _(s, t) {
207
- return vt.set(s, t), s;
207
+ return Ct.set(s, t), s;
208
208
  }
209
- function Zt(s) {
210
- return Object.assign(s, { [xt]: !0 });
209
+ function Xt(s) {
210
+ return Object.assign(s, { [bt]: !0 });
211
211
  }
212
212
  function q(s) {
213
- for (const [t, e] of Ot)
213
+ for (const [t, e] of Dt)
214
214
  if (e.canHandle(s)) {
215
215
  const [n, r] = e.serialize(s);
216
216
  return [
@@ -227,28 +227,28 @@ function q(s) {
227
227
  type: "RAW",
228
228
  value: s
229
229
  },
230
- vt.get(s) || []
230
+ Ct.get(s) || []
231
231
  ];
232
232
  }
233
233
  function N(s) {
234
234
  switch (s.type) {
235
235
  case "HANDLER":
236
- return Ot.get(s.name).deserialize(s.value);
236
+ return Dt.get(s.name).deserialize(s.value);
237
237
  case "RAW":
238
238
  return s.value;
239
239
  }
240
240
  }
241
241
  function F(s, t, e, n) {
242
242
  return new Promise((r) => {
243
- const i = Xt();
243
+ const i = Jt();
244
244
  t.set(i, r), s.start && s.start(), s.postMessage(Object.assign({ id: i }, e), n);
245
245
  });
246
246
  }
247
- function Xt() {
247
+ function Jt() {
248
248
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
249
249
  }
250
- var b = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(b || {});
251
- const Jt = {
250
+ var O = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(O || {});
251
+ const Qt = {
252
252
  ENOENT: -2,
253
253
  // No such file or directory
254
254
  EISDIR: -21,
@@ -285,15 +285,15 @@ class w extends Error {
285
285
  syscall;
286
286
  path;
287
287
  constructor(t, e, n, r, i) {
288
- super(t, { cause: i }), this.name = e, this.errno = Jt[e] || -1, this.path = n, this.syscall = r;
288
+ super(t, { cause: i }), this.name = e, this.errno = Qt[e] || -1, this.path = n, this.syscall = r;
289
289
  }
290
290
  }
291
- class Qt extends w {
291
+ class Kt extends w {
292
292
  constructor(t) {
293
293
  super("OPFS is not supported in this browser", "ENOTSUP", void 0, void 0, t);
294
294
  }
295
295
  }
296
- class Kt extends w {
296
+ class te extends w {
297
297
  constructor(t, e, n) {
298
298
  super(t, "INVALID_PATH", e, "access", n);
299
299
  }
@@ -308,17 +308,17 @@ class B extends w {
308
308
  super(r[t], "ENOENT", e, "access", n);
309
309
  }
310
310
  }
311
- class te extends w {
311
+ class ee extends w {
312
312
  constructor(t, e, n) {
313
313
  super(\`Permission denied for \${e} on: \${t}\`, "EACCES", t, e, n);
314
314
  }
315
315
  }
316
- class ee extends w {
316
+ class se extends w {
317
317
  constructor(t, e, n) {
318
318
  super(t, "ENOSPC", e, "write", n);
319
319
  }
320
320
  }
321
- class se extends w {
321
+ class ne extends w {
322
322
  constructor(t, e) {
323
323
  super(\`File is busy: \${t}\`, "EBUSY", t, "open", e);
324
324
  }
@@ -340,7 +340,7 @@ class C extends w {
340
340
  super(e, i[t], n, "validate", r);
341
341
  }
342
342
  }
343
- class ne extends w {
343
+ class re extends w {
344
344
  constructor(t, e) {
345
345
  super(\`Operation aborted: \${t}\`, "EINTR", t, "interrupt", e);
346
346
  }
@@ -350,7 +350,7 @@ class ut extends w {
350
350
  super(t, "EIO", e, "io", n);
351
351
  }
352
352
  }
353
- class Ct extends w {
353
+ class Nt extends w {
354
354
  constructor(t, e) {
355
355
  super(\`Operation not supported: \${t}\`, "ENOTSUP", t, "operation", e);
356
356
  }
@@ -365,7 +365,7 @@ class nt extends w {
365
365
  super(r[t] || \`Directory operation failed: \${e}\`, t, e, "unlink", n);
366
366
  }
367
367
  }
368
- class re extends w {
368
+ class ie extends w {
369
369
  constructor(t, e) {
370
370
  super("Failed to initialize OPFS", "INIT_FAILED", t, "init", e);
371
371
  }
@@ -384,34 +384,34 @@ function z(s, t, e, n) {
384
384
  const r = \`\${s.toUpperCase()}_FAILED\`;
385
385
  return new w(\`Failed to \${s} file descriptor: \${t}\`, r, e, s, n);
386
386
  }
387
- function A(s, t) {
387
+ function b(s, t) {
388
388
  const e = t?.path, n = t?.isDirectory, r = t?.existenceType ?? "file", i = t?.operation;
389
389
  switch (s.name) {
390
390
  case "InvalidStateError":
391
- return new se(e || "unknown", s);
391
+ return new ne(e || "unknown", s);
392
392
  case "QuotaExceededError":
393
- return new ee(\`No space left on device: \${e || "unknown"}\`, e, s);
393
+ return new se(\`No space left on device: \${e || "unknown"}\`, e, s);
394
394
  case "NotFoundError":
395
395
  return new B(r, e, s);
396
396
  case "TypeMismatchError":
397
397
  return n !== void 0 ? n ? new st("directory", e || "unknown", s) : new st("file", e || "unknown", s) : new C("argument", \`Type mismatch: \${e || "unknown"}\`, e, s);
398
398
  case "NotAllowedError":
399
399
  case "SecurityError":
400
- return new te(e, "unknown", s);
400
+ return new ee(e, "unknown", s);
401
401
  case "InvalidModificationError":
402
402
  return i === "remove" ? new nt("ENOTEMPTY", e, s) : new C("argument", \`Invalid modification: \${e || "unknown"}\`, e, s);
403
403
  case "AbortError":
404
- return new ne(e || "unknown", s);
404
+ return new re(e || "unknown", s);
405
405
  case "OperationError":
406
406
  return new ut(\`Operation failed: \${e || "unknown"}\`, e, s);
407
407
  case "TypeError":
408
- return new Ct(e || "unknown", s);
408
+ return new Nt(e || "unknown", s);
409
409
  default:
410
410
  return i === "remove" ? new nt("RM_FAILED", e, s) : new ut(\`I/O error: \${e || "unknown"}\`, e, s);
411
411
  }
412
412
  }
413
- const Nt = (s, t, e) => {
414
- const n = s instanceof RegExp ? ft(s, e) : s, r = t instanceof RegExp ? ft(t, e) : t, i = n !== null && r != null && ie(n, r, e);
413
+ const Ft = (s, t, e) => {
414
+ const n = s instanceof RegExp ? ft(s, e) : s, r = t instanceof RegExp ? ft(t, e) : t, i = n !== null && r != null && oe(n, r, e);
415
415
  return i && {
416
416
  start: i[0],
417
417
  end: i[1],
@@ -422,7 +422,7 @@ const Nt = (s, t, e) => {
422
422
  }, ft = (s, t) => {
423
423
  const e = t.match(s);
424
424
  return e ? e[0] : null;
425
- }, ie = (s, t, e) => {
425
+ }, oe = (s, t, e) => {
426
426
  let n, r, i, o, a, c = e.indexOf(s), h = e.indexOf(t, c + 1), l = c;
427
427
  if (c >= 0 && h > 0) {
428
428
  if (s === t)
@@ -440,47 +440,47 @@ const Nt = (s, t, e) => {
440
440
  n.length && o !== void 0 && (a = [i, o]);
441
441
  }
442
442
  return a;
443
- }, Ft = "\\0SLASH" + Math.random() + "\\0", $t = "\\0OPEN" + Math.random() + "\\0", at = "\\0CLOSE" + Math.random() + "\\0", Mt = "\\0COMMA" + Math.random() + "\\0", Tt = "\\0PERIOD" + Math.random() + "\\0", oe = new RegExp(Ft, "g"), ae = new RegExp($t, "g"), ce = new RegExp(at, "g"), le = new RegExp(Mt, "g"), he = new RegExp(Tt, "g"), ue = /\\\\\\\\/g, fe = /\\\\{/g, de = /\\\\}/g, pe = /\\\\,/g, ge = /\\\\./g;
443
+ }, Mt = "\\0SLASH" + Math.random() + "\\0", $t = "\\0OPEN" + Math.random() + "\\0", at = "\\0CLOSE" + Math.random() + "\\0", Tt = "\\0COMMA" + Math.random() + "\\0", Pt = "\\0PERIOD" + Math.random() + "\\0", ae = new RegExp(Mt, "g"), ce = new RegExp($t, "g"), le = new RegExp(at, "g"), he = new RegExp(Tt, "g"), ue = new RegExp(Pt, "g"), fe = /\\\\\\\\/g, de = /\\\\{/g, pe = /\\\\}/g, ge = /\\\\,/g, we = /\\\\./g;
444
444
  function Q(s) {
445
445
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
446
446
  }
447
- function we(s) {
448
- return s.replace(ue, Ft).replace(fe, $t).replace(de, at).replace(pe, Mt).replace(ge, Tt);
449
- }
450
447
  function ye(s) {
451
- return s.replace(oe, "\\\\").replace(ae, "{").replace(ce, "}").replace(le, ",").replace(he, ".");
448
+ return s.replace(fe, Mt).replace(de, $t).replace(pe, at).replace(ge, Tt).replace(we, Pt);
449
+ }
450
+ function me(s) {
451
+ return s.replace(ae, "\\\\").replace(ce, "{").replace(le, "}").replace(he, ",").replace(ue, ".");
452
452
  }
453
- function Pt(s) {
453
+ function Rt(s) {
454
454
  if (!s)
455
455
  return [""];
456
- const t = [], e = Nt("{", "}", s);
456
+ const t = [], e = Ft("{", "}", s);
457
457
  if (!e)
458
458
  return s.split(",");
459
459
  const { pre: n, body: r, post: i } = e, o = n.split(",");
460
460
  o[o.length - 1] += "{" + r + "}";
461
- const a = Pt(i);
461
+ const a = Rt(i);
462
462
  return i.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
463
463
  }
464
- function me(s) {
465
- return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), k(we(s), !0).map(ye)) : [];
466
- }
467
464
  function Ee(s) {
468
- return "{" + s + "}";
465
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), I(ye(s), !0).map(me)) : [];
469
466
  }
470
467
  function Se(s) {
468
+ return "{" + s + "}";
469
+ }
470
+ function xe(s) {
471
471
  return /^-?0\\d/.test(s);
472
472
  }
473
- function xe(s, t) {
473
+ function be(s, t) {
474
474
  return s <= t;
475
475
  }
476
- function be(s, t) {
476
+ function Oe(s, t) {
477
477
  return s >= t;
478
478
  }
479
- function k(s, t) {
480
- const e = [], n = Nt("{", "}", s);
479
+ function I(s, t) {
480
+ const e = [], n = Ft("{", "}", s);
481
481
  if (!n)
482
482
  return [s];
483
- const r = n.pre, i = n.post.length ? k(n.post, !1) : [""];
483
+ const r = n.pre, i = n.post.length ? I(n.post, !1) : [""];
484
484
  if (/\\$$/.test(n.pre))
485
485
  for (let o = 0; o < i.length; o++) {
486
486
  const a = r + "{" + n.body + "}" + i[o];
@@ -489,18 +489,18 @@ function k(s, t) {
489
489
  else {
490
490
  const o = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(n.body), a = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(n.body), c = o || a, h = n.body.indexOf(",") >= 0;
491
491
  if (!c && !h)
492
- return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + at + n.post, k(s)) : [s];
492
+ return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + at + n.post, I(s)) : [s];
493
493
  let l;
494
494
  if (c)
495
495
  l = n.body.split(/\\.\\./);
496
- else if (l = Pt(n.body), l.length === 1 && l[0] !== void 0 && (l = k(l[0], !1).map(Ee), l.length === 1))
496
+ else if (l = Rt(n.body), l.length === 1 && l[0] !== void 0 && (l = I(l[0], !1).map(Se), l.length === 1))
497
497
  return i.map((u) => n.pre + l[0] + u);
498
498
  let f;
499
499
  if (c && l[0] !== void 0 && l[1] !== void 0) {
500
500
  const u = Q(l[0]), d = Q(l[1]), g = Math.max(l[0].length, l[1].length);
501
- let p = l.length === 3 && l[2] !== void 0 ? Math.abs(Q(l[2])) : 1, S = xe;
502
- d < u && (p *= -1, S = be);
503
- const T = l.some(Se);
501
+ let p = l.length === 3 && l[2] !== void 0 ? Math.abs(Q(l[2])) : 1, S = be;
502
+ d < u && (p *= -1, S = Oe);
503
+ const T = l.some(xe);
504
504
  f = [];
505
505
  for (let x = u; S(x, d); x += p) {
506
506
  let y;
@@ -518,7 +518,7 @@ function k(s, t) {
518
518
  } else {
519
519
  f = [];
520
520
  for (let u = 0; u < l.length; u++)
521
- f.push.apply(f, k(l[u], !1));
521
+ f.push.apply(f, I(l[u], !1));
522
522
  }
523
523
  for (let u = 0; u < f.length; u++)
524
524
  for (let d = 0; d < i.length; d++) {
@@ -528,12 +528,12 @@ function k(s, t) {
528
528
  }
529
529
  return e;
530
530
  }
531
- const Oe = 1024 * 64, V = (s) => {
531
+ const De = 1024 * 64, V = (s) => {
532
532
  if (typeof s != "string")
533
533
  throw new TypeError("invalid pattern");
534
- if (s.length > Oe)
534
+ if (s.length > De)
535
535
  throw new TypeError("pattern is too long");
536
- }, De = {
536
+ }, ve = {
537
537
  "[:alnum:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}", !0],
538
538
  "[:alpha:]": ["\\\\p{L}\\\\p{Nl}", !0],
539
539
  "[:ascii:]": ["\\\\x00-\\\\x7f", !1],
@@ -548,7 +548,7 @@ const Oe = 1024 * 64, V = (s) => {
548
548
  "[:upper:]": ["\\\\p{Lu}", !0],
549
549
  "[:word:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}", !0],
550
550
  "[:xdigit:]": ["A-Fa-f0-9", !1]
551
- }, R = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), Ae = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), dt = (s) => s.join(""), ve = (s, t) => {
551
+ }, R = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), Ae = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), dt = (s) => s.join(""), Ce = (s, t) => {
552
552
  const e = t;
553
553
  if (s.charAt(e) !== "[")
554
554
  throw new Error("not in a brace expression");
@@ -569,11 +569,11 @@ const Oe = 1024 * 64, V = (s) => {
569
569
  continue;
570
570
  }
571
571
  if (p === "[" && !c) {
572
- for (const [S, [v, T, x]] of Object.entries(De))
572
+ for (const [S, [A, T, x]] of Object.entries(ve))
573
573
  if (s.startsWith(S, i)) {
574
574
  if (f)
575
575
  return ["$.", !1, s.length - e, !0];
576
- i += S.length, x ? r.push(v) : n.push(v), a = a || T;
576
+ i += S.length, x ? r.push(A) : n.push(A), a = a || T;
577
577
  continue t;
578
578
  }
579
579
  }
@@ -601,7 +601,7 @@ const Oe = 1024 * 64, V = (s) => {
601
601
  }
602
602
  const u = "[" + (h ? "^" : "") + dt(n) + "]", d = "[" + (h ? "" : "^") + dt(r) + "]";
603
603
  return [n.length && r.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, l - e, !0];
604
- }, I = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), Ce = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (s) => Ce.has(s), Ne = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", W = "(?!\\\\.)", Fe = /* @__PURE__ */ new Set(["[", "."]), $e = /* @__PURE__ */ new Set(["..", "."]), Me = new Set("().*{}+?[]^$\\\\!"), Te = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), ct = "[^/]", gt = ct + "*?", wt = ct + "+?";
604
+ }, k = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), Ne = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), pt = (s) => Ne.has(s), Fe = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", W = "(?!\\\\.)", Me = /* @__PURE__ */ new Set(["[", "."]), $e = /* @__PURE__ */ new Set(["..", "."]), Te = new Set("().*{}+?[]^$\\\\!"), Pe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), ct = "[^/]", gt = ct + "*?", wt = ct + "+?";
605
605
  class E {
606
606
  type;
607
607
  #s;
@@ -854,23 +854,23 @@ class E {
854
854
  const e = t ?? !!this.#r.dot;
855
855
  if (this.#s === this && this.#d(), !this.type) {
856
856
  const c = this.isStart() && this.isEnd(), h = this.#t.map((d) => {
857
- const [g, p, S, v] = typeof d == "string" ? E.#p(d, this.#n, c) : d.toRegExpSource(t);
858
- return this.#n = this.#n || S, this.#i = this.#i || v, g;
857
+ const [g, p, S, A] = typeof d == "string" ? E.#p(d, this.#n, c) : d.toRegExpSource(t);
858
+ return this.#n = this.#n || S, this.#i = this.#i || A, g;
859
859
  }).join("");
860
860
  let l = "";
861
861
  if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && $e.has(this.#t[0]))) {
862
- const g = Fe, p = (
862
+ const g = Me, p = (
863
863
  // dots are allowed, and the pattern starts with [ or .
864
864
  e && g.has(h.charAt(0)) || // the pattern starts with \\., and then [ or .
865
865
  h.startsWith("\\\\.") && g.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
866
866
  h.startsWith("\\\\.\\\\.") && g.has(h.charAt(4))
867
867
  ), S = !e && !t && g.has(h.charAt(0));
868
- l = p ? Ne : S ? W : "";
868
+ l = p ? Fe : S ? W : "";
869
869
  }
870
870
  let f = "";
871
871
  return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
872
872
  l + h + f,
873
- I(h),
873
+ k(h),
874
874
  this.#n = !!this.#n,
875
875
  this.#i
876
876
  ];
@@ -879,7 +879,7 @@ class E {
879
879
  let i = this.#f(e);
880
880
  if (this.isStart() && this.isEnd() && !i && this.type !== "!") {
881
881
  const c = this.toString();
882
- return this.#t = [c], this.type = null, this.#n = void 0, [c, I(this.toString()), !1, !1];
882
+ return this.#t = [c], this.type = null, this.#n = void 0, [c, k(this.toString()), !1, !1];
883
883
  }
884
884
  let o = !n || t || e || !W ? "" : this.#f(!0);
885
885
  o === i && (o = ""), o && (i = \`(?:\${i})(?:\${o})*?\`);
@@ -895,7 +895,7 @@ class E {
895
895
  }
896
896
  return [
897
897
  a,
898
- I(i),
898
+ k(i),
899
899
  this.#n = !!this.#n,
900
900
  this.#i
901
901
  ];
@@ -913,7 +913,7 @@ class E {
913
913
  for (let a = 0; a < t.length; a++) {
914
914
  const c = t.charAt(a);
915
915
  if (r) {
916
- r = !1, i += (Me.has(c) ? "\\\\" : "") + c;
916
+ r = !1, i += (Te.has(c) ? "\\\\" : "") + c;
917
917
  continue;
918
918
  }
919
919
  if (c === "\\\\") {
@@ -921,7 +921,7 @@ class E {
921
921
  continue;
922
922
  }
923
923
  if (c === "[") {
924
- const [h, l, f, u] = ve(t, a);
924
+ const [h, l, f, u] = Ce(t, a);
925
925
  if (f) {
926
926
  i += h, o = o || l, a += f - 1, e = e || u;
927
927
  continue;
@@ -935,83 +935,83 @@ class E {
935
935
  i += ct, e = !0;
936
936
  continue;
937
937
  }
938
- i += Te(c);
938
+ i += Pe(c);
939
939
  }
940
- return [i, I(t), !!e, o];
940
+ return [i, k(t), !!e, o];
941
941
  }
942
942
  }
943
- const Pe = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), m = (s, t, e = {}) => (V(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new Z(t, e).match(s)), Re = /^\\*+([^+@!?\\*\\[\\(]*)$/, ke = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Ie = (s) => (t) => t.endsWith(s), He = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Le = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), ze = /^\\*+\\.\\*+$/, We = (s) => !s.startsWith(".") && s.includes("."), je = (s) => s !== "." && s !== ".." && s.includes("."), _e = /^\\.\\*+$/, Be = (s) => s !== "." && s !== ".." && s.startsWith("."), Ue = /^\\*+$/, Ge = (s) => s.length !== 0 && !s.startsWith("."), qe = (s) => s.length !== 0 && s !== "." && s !== "..", Ve = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ye = ([s, t = ""]) => {
944
- const e = Rt([s]);
943
+ const Re = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), m = (s, t, e = {}) => (V(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new Z(t, e).match(s)), Ie = /^\\*+([^+@!?\\*\\[\\(]*)$/, ke = (s) => (t) => !t.startsWith(".") && t.endsWith(s), He = (s) => (t) => t.endsWith(s), Le = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), ze = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), We = /^\\*+\\.\\*+$/, je = (s) => !s.startsWith(".") && s.includes("."), _e = (s) => s !== "." && s !== ".." && s.includes("."), Be = /^\\.\\*+$/, Ue = (s) => s !== "." && s !== ".." && s.startsWith("."), Ge = /^\\*+$/, qe = (s) => s.length !== 0 && !s.startsWith("."), Ve = (s) => s.length !== 0 && s !== "." && s !== "..", Ye = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ze = ([s, t = ""]) => {
944
+ const e = It([s]);
945
945
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
946
- }, Ze = ([s, t = ""]) => {
946
+ }, Xe = ([s, t = ""]) => {
947
947
  const e = kt([s]);
948
948
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
949
- }, Xe = ([s, t = ""]) => {
949
+ }, Je = ([s, t = ""]) => {
950
950
  const e = kt([s]);
951
951
  return t ? (n) => e(n) && n.endsWith(t) : e;
952
- }, Je = ([s, t = ""]) => {
953
- const e = Rt([s]);
952
+ }, Qe = ([s, t = ""]) => {
953
+ const e = It([s]);
954
954
  return t ? (n) => e(n) && n.endsWith(t) : e;
955
- }, Rt = ([s]) => {
955
+ }, It = ([s]) => {
956
956
  const t = s.length;
957
957
  return (e) => e.length === t && !e.startsWith(".");
958
958
  }, kt = ([s]) => {
959
959
  const t = s.length;
960
960
  return (e) => e.length === t && e !== "." && e !== "..";
961
- }, It = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", yt = {
961
+ }, Ht = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", yt = {
962
962
  win32: { sep: "\\\\" },
963
963
  posix: { sep: "/" }
964
- }, Qe = It === "win32" ? yt.win32.sep : yt.posix.sep;
965
- m.sep = Qe;
966
- const D = Symbol("globstar **");
967
- m.GLOBSTAR = D;
968
- const Ke = "[^/]", ts = Ke + "*?", es = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", ss = "(?:(?!(?:\\\\/|^)\\\\.).)*?", ns = (s, t = {}) => (e) => m(e, s, t);
969
- m.filter = ns;
970
- const O = (s, t = {}) => Object.assign({}, s, t), rs = (s) => {
964
+ }, Ke = Ht === "win32" ? yt.win32.sep : yt.posix.sep;
965
+ m.sep = Ke;
966
+ const v = Symbol("globstar **");
967
+ m.GLOBSTAR = v;
968
+ const ts = "[^/]", es = ts + "*?", ss = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", ns = "(?:(?!(?:\\\\/|^)\\\\.).)*?", rs = (s, t = {}) => (e) => m(e, s, t);
969
+ m.filter = rs;
970
+ const D = (s, t = {}) => Object.assign({}, s, t), is = (s) => {
971
971
  if (!s || typeof s != "object" || !Object.keys(s).length)
972
972
  return m;
973
973
  const t = m;
974
- return Object.assign((n, r, i = {}) => t(n, r, O(s, i)), {
974
+ return Object.assign((n, r, i = {}) => t(n, r, D(s, i)), {
975
975
  Minimatch: class extends t.Minimatch {
976
976
  constructor(r, i = {}) {
977
- super(r, O(s, i));
977
+ super(r, D(s, i));
978
978
  }
979
979
  static defaults(r) {
980
- return t.defaults(O(s, r)).Minimatch;
980
+ return t.defaults(D(s, r)).Minimatch;
981
981
  }
982
982
  },
983
983
  AST: class extends t.AST {
984
984
  /* c8 ignore start */
985
985
  constructor(r, i, o = {}) {
986
- super(r, i, O(s, o));
986
+ super(r, i, D(s, o));
987
987
  }
988
988
  /* c8 ignore stop */
989
989
  static fromGlob(r, i = {}) {
990
- return t.AST.fromGlob(r, O(s, i));
990
+ return t.AST.fromGlob(r, D(s, i));
991
991
  }
992
992
  },
993
- unescape: (n, r = {}) => t.unescape(n, O(s, r)),
994
- escape: (n, r = {}) => t.escape(n, O(s, r)),
995
- filter: (n, r = {}) => t.filter(n, O(s, r)),
996
- defaults: (n) => t.defaults(O(s, n)),
997
- makeRe: (n, r = {}) => t.makeRe(n, O(s, r)),
998
- braceExpand: (n, r = {}) => t.braceExpand(n, O(s, r)),
999
- match: (n, r, i = {}) => t.match(n, r, O(s, i)),
993
+ unescape: (n, r = {}) => t.unescape(n, D(s, r)),
994
+ escape: (n, r = {}) => t.escape(n, D(s, r)),
995
+ filter: (n, r = {}) => t.filter(n, D(s, r)),
996
+ defaults: (n) => t.defaults(D(s, n)),
997
+ makeRe: (n, r = {}) => t.makeRe(n, D(s, r)),
998
+ braceExpand: (n, r = {}) => t.braceExpand(n, D(s, r)),
999
+ match: (n, r, i = {}) => t.match(n, r, D(s, i)),
1000
1000
  sep: t.sep,
1001
- GLOBSTAR: D
1001
+ GLOBSTAR: v
1002
1002
  });
1003
1003
  };
1004
- m.defaults = rs;
1005
- const Ht = (s, t = {}) => (V(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : me(s));
1006
- m.braceExpand = Ht;
1007
- const is = (s, t = {}) => new Z(s, t).makeRe();
1008
- m.makeRe = is;
1009
- const os = (s, t, e = {}) => {
1004
+ m.defaults = is;
1005
+ const Lt = (s, t = {}) => (V(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : Ee(s));
1006
+ m.braceExpand = Lt;
1007
+ const os = (s, t = {}) => new Z(s, t).makeRe();
1008
+ m.makeRe = os;
1009
+ const as = (s, t, e = {}) => {
1010
1010
  const n = new Z(t, e);
1011
1011
  return s = s.filter((r) => n.match(r)), n.options.nonull && !s.length && s.push(t), s;
1012
1012
  };
1013
- m.match = os;
1014
- const mt = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, as = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
1013
+ m.match = as;
1014
+ const mt = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, cs = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
1015
1015
  class Z {
1016
1016
  options;
1017
1017
  set;
@@ -1031,7 +1031,7 @@ class Z {
1031
1031
  windowsNoMagicRoot;
1032
1032
  regexp;
1033
1033
  constructor(t, e = {}) {
1034
- V(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || It, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
1034
+ V(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ht, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
1035
1035
  }
1036
1036
  hasMagic() {
1037
1037
  if (this.options.magicalBraces && this.set.length > 1)
@@ -1239,7 +1239,7 @@ class Z {
1239
1239
  matchOne(t, e, n = !1) {
1240
1240
  const r = this.options;
1241
1241
  if (this.isWindows) {
1242
- const p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), v = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), T = !v && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, y = T ? 3 : v ? 0 : void 0;
1242
+ const p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), T = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, y = T ? 3 : A ? 0 : void 0;
1243
1243
  if (typeof x == "number" && typeof y == "number") {
1244
1244
  const [P, H] = [t[x], e[y]];
1245
1245
  P.toLowerCase() === H.toLowerCase() && (e[y] = P, y > x ? e = e.slice(y) : x > y && (t = t.slice(x)));
@@ -1252,7 +1252,7 @@ class Z {
1252
1252
  var l = e[a], f = t[o];
1253
1253
  if (this.debug(e, l, f), l === !1)
1254
1254
  return !1;
1255
- if (l === D) {
1255
+ if (l === v) {
1256
1256
  this.debug("GLOBSTAR", [e, l, f]);
1257
1257
  var u = o, d = a + 1;
1258
1258
  if (d === h) {
@@ -1288,17 +1288,17 @@ globstar while\`, t, u, e, d, g), this.matchOne(t.slice(u), e.slice(d), n))
1288
1288
  throw new Error("wtf?");
1289
1289
  }
1290
1290
  braceExpand() {
1291
- return Ht(this.pattern, this.options);
1291
+ return Lt(this.pattern, this.options);
1292
1292
  }
1293
1293
  parse(t) {
1294
1294
  V(t);
1295
1295
  const e = this.options;
1296
1296
  if (t === "**")
1297
- return D;
1297
+ return v;
1298
1298
  if (t === "")
1299
1299
  return "";
1300
1300
  let n, r = null;
1301
- (n = t.match(Ue)) ? r = e.dot ? qe : Ge : (n = t.match(Re)) ? r = (e.nocase ? e.dot ? Le : He : e.dot ? Ie : ke)(n[1]) : (n = t.match(Ve)) ? r = (e.nocase ? e.dot ? Ze : Ye : e.dot ? Xe : Je)(n) : (n = t.match(ze)) ? r = e.dot ? je : We : (n = t.match(_e)) && (r = Be);
1301
+ (n = t.match(Ge)) ? r = e.dot ? Ve : qe : (n = t.match(Ie)) ? r = (e.nocase ? e.dot ? ze : Le : e.dot ? He : ke)(n[1]) : (n = t.match(Ye)) ? r = (e.nocase ? e.dot ? Xe : Ze : e.dot ? Je : Qe)(n) : (n = t.match(We)) ? r = e.dot ? _e : je : (n = t.match(Be)) && (r = Ue);
1302
1302
  const i = E.fromGlob(t, this.options).toMMPattern();
1303
1303
  return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
1304
1304
  }
@@ -1308,18 +1308,18 @@ globstar while\`, t, u, e, d, g), this.matchOne(t.slice(u), e.slice(d), n))
1308
1308
  const t = this.set;
1309
1309
  if (!t.length)
1310
1310
  return this.regexp = !1, this.regexp;
1311
- const e = this.options, n = e.noglobstar ? ts : e.dot ? es : ss, r = new Set(e.nocase ? ["i"] : []);
1311
+ const e = this.options, n = e.noglobstar ? es : e.dot ? ss : ns, r = new Set(e.nocase ? ["i"] : []);
1312
1312
  let i = t.map((c) => {
1313
1313
  const h = c.map((l) => {
1314
1314
  if (l instanceof RegExp)
1315
1315
  for (const f of l.flags.split(""))
1316
1316
  r.add(f);
1317
- return typeof l == "string" ? as(l) : l === D ? D : l._src;
1317
+ return typeof l == "string" ? cs(l) : l === v ? v : l._src;
1318
1318
  });
1319
1319
  return h.forEach((l, f) => {
1320
1320
  const u = h[f + 1], d = h[f - 1];
1321
- l !== D || d === D || (d === void 0 ? u !== void 0 && u !== D ? h[f + 1] = "(?:\\\\/|" + n + "\\\\/)?" + u : h[f] = n : u === void 0 ? h[f - 1] = d + "(?:\\\\/|" + n + ")?" : u !== D && (h[f - 1] = d + "(?:\\\\/|\\\\/" + n + "\\\\/)" + u, h[f + 1] = D));
1322
- }), h.filter((l) => l !== D).join("/");
1321
+ l !== v || d === v || (d === void 0 ? u !== void 0 && u !== v ? h[f + 1] = "(?:\\\\/|" + n + "\\\\/)?" + u : h[f] = n : u === void 0 ? h[f - 1] = d + "(?:\\\\/|" + n + ")?" : u !== v && (h[f - 1] = d + "(?:\\\\/|\\\\/" + n + "\\\\/)" + u, h[f + 1] = v));
1322
+ }), h.filter((l) => l !== v).join("/");
1323
1323
  }).join("|");
1324
1324
  const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1325
1325
  i = "^" + o + i + a + "$", this.negate && (i = "^(?!" + i + ").+$");
@@ -1364,33 +1364,33 @@ globstar while\`, t, u, e, d, g), this.matchOne(t.slice(u), e.slice(d), n))
1364
1364
  }
1365
1365
  m.AST = E;
1366
1366
  m.Minimatch = Z;
1367
- m.escape = Pe;
1368
- m.unescape = I;
1369
- function cs() {
1367
+ m.escape = Re;
1368
+ m.unescape = k;
1369
+ function ls() {
1370
1370
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1371
- throw new Qt();
1371
+ throw new Kt();
1372
1372
  }
1373
- async function $(s, t) {
1373
+ async function M(s, t) {
1374
1374
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/")}\`, { mode: "exclusive" }, t) : t();
1375
1375
  }
1376
- function M(s) {
1376
+ function $(s) {
1377
1377
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1378
1378
  }
1379
1379
  function lt(s) {
1380
1380
  return typeof s == "string" ? s ?? "/" : \`/\${s.join("/")}\`;
1381
1381
  }
1382
1382
  function it(s) {
1383
- const t = M(s);
1383
+ const t = $(s);
1384
1384
  return t[t.length - 1] || "";
1385
1385
  }
1386
1386
  function K(s) {
1387
- const t = M(s);
1387
+ const t = $(s);
1388
1388
  return t.pop(), lt(t);
1389
1389
  }
1390
1390
  function Y(s) {
1391
1391
  return !s || s === "/" ? "/" : s.startsWith("~/") ? \`/\${s.slice(2)}\` : s.startsWith("/") ? s : \`/\${s}\`;
1392
1392
  }
1393
- function ls(s, t = !1) {
1393
+ function hs(s, t = !1) {
1394
1394
  return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1395
1395
  }
1396
1396
  function tt(s, t) {
@@ -1399,8 +1399,8 @@ function tt(s, t) {
1399
1399
  matchBase: !0
1400
1400
  });
1401
1401
  }
1402
- function Lt(s) {
1403
- const t = Y(s), e = M(t), n = [];
1402
+ function zt(s) {
1403
+ const t = Y(s), e = $(t), n = [];
1404
1404
  for (const r of e)
1405
1405
  if (!(r === "." || r === ""))
1406
1406
  if (r === "..") {
@@ -1411,19 +1411,15 @@ function Lt(s) {
1411
1411
  n.push(r);
1412
1412
  return lt(n);
1413
1413
  }
1414
- async function hs(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1414
+ async function us(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1415
1415
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1416
1416
  throw new Error(\`File size \${s.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1417
1417
  const n = new Uint8Array(s), r = await crypto.subtle.digest(t, n);
1418
1418
  return Array.from(new Uint8Array(r)).map((o) => o.toString(16).padStart(2, "0")).join("");
1419
1419
  }
1420
- async function us(s) {
1421
- const t = await s.arrayBuffer();
1422
- return new Uint8Array(t);
1423
- }
1424
1420
  async function fs(s, t, e = {}) {
1425
1421
  const n = it(t);
1426
- return $(t, async () => {
1422
+ return M(t, async () => {
1427
1423
  const r = e.recursive ?? !1, i = e.force ?? !1;
1428
1424
  try {
1429
1425
  await s.removeEntry(n, { recursive: r });
@@ -1431,7 +1427,7 @@ async function fs(s, t, e = {}) {
1431
1427
  if (o.name === "NotFoundError" && i)
1432
1428
  return;
1433
1429
  const a = o.name === "TypeMismatchError" && !r;
1434
- throw A(o, {
1430
+ throw b(o, {
1435
1431
  path: t,
1436
1432
  operation: "remove",
1437
1433
  isDirectory: a
@@ -1466,7 +1462,7 @@ async function ps(s, t) {
1466
1462
  try {
1467
1463
  return await s.createSyncAccessHandle();
1468
1464
  } catch (e) {
1469
- throw A(e, { path: t, isDirectory: !1 });
1465
+ throw b(e, { path: t, isDirectory: !1 });
1470
1466
  }
1471
1467
  }
1472
1468
  class gs {
@@ -1520,7 +1516,7 @@ class gs {
1520
1516
  }
1521
1517
  }
1522
1518
  constructor(t) {
1523
- cs(), t && this.setOptions(t);
1519
+ ls(), t && this.setOptions(t);
1524
1520
  }
1525
1521
  /**
1526
1522
  * Initialize the file system within a given directory.
@@ -1533,7 +1529,7 @@ class gs {
1533
1529
  const r = await navigator.storage.getDirectory();
1534
1530
  this.root = t === "/" ? r : await this.getDirectoryHandle(t, !0, r), e(!0);
1535
1531
  } catch (r) {
1536
- n(new re(t, r));
1532
+ n(new ie(t, r));
1537
1533
  } finally {
1538
1534
  this.mountingPromise = null;
1539
1535
  }
@@ -1571,7 +1567,7 @@ class gs {
1571
1567
  * \`\`\`
1572
1568
  */
1573
1569
  async getDirectoryHandle(t, e = !1, n = this.root) {
1574
- const r = Array.isArray(t) ? t : M(t);
1570
+ const r = Array.isArray(t) ? t : $(t);
1575
1571
  let i = n;
1576
1572
  for (const o of r)
1577
1573
  i = await i.getDirectoryHandle(o, { create: e });
@@ -1597,9 +1593,9 @@ class gs {
1597
1593
  * \`\`\`
1598
1594
  */
1599
1595
  async getFileHandle(t, e = !1, n = this.root) {
1600
- const r = M(t);
1596
+ const r = $(t);
1601
1597
  if (r.length === 0)
1602
- throw new Kt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1598
+ throw new te("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1603
1599
  const i = r.pop();
1604
1600
  return (await this.getDirectoryHandle(r, e, n)).getFileHandle(i, { create: e });
1605
1601
  }
@@ -1667,20 +1663,20 @@ class gs {
1667
1663
  */
1668
1664
  async mkdir(t, e) {
1669
1665
  await this.mount();
1670
- const n = e?.recursive ?? !1, r = M(t);
1666
+ const n = e?.recursive ?? !1, r = $(t);
1671
1667
  let i = this.root;
1672
1668
  for (let o = 0; o < r.length; o++) {
1673
1669
  const a = r[o];
1674
1670
  try {
1675
1671
  i = await i.getDirectoryHandle(a, { create: n || o === r.length - 1 });
1676
1672
  } catch (c) {
1677
- throw c.name === "NotFoundError" ? A(c, {
1673
+ throw c.name === "NotFoundError" ? b(c, {
1678
1674
  path: lt(r.slice(0, o + 1)),
1679
1675
  existenceType: "directory"
1680
- }) : c.name === "TypeMismatchError" ? A(c, { path: a, isDirectory: !1 }) : new J("create directory", a, c);
1676
+ }) : c.name === "TypeMismatchError" ? b(c, { path: a, isDirectory: !1 }) : new J("create directory", a, c);
1681
1677
  }
1682
1678
  }
1683
- await this.notifyChange({ path: t, type: b.Added, isDirectory: !0 });
1679
+ await this.notifyChange({ path: t, type: O.Added, isDirectory: !0 });
1684
1680
  }
1685
1681
  /**
1686
1682
  * Get file or directory statistics
@@ -1730,7 +1726,7 @@ class gs {
1730
1726
  a.hash = \`\${o.lastModified.toString(36)}-\${o.size.toString(36)}\`;
1731
1727
  else if (typeof r == "string")
1732
1728
  try {
1733
- const c = await hs(o, r, this.options.maxFileSize);
1729
+ const c = await us(o, r, this.options.maxFileSize);
1734
1730
  a.hash = c;
1735
1731
  } catch (c) {
1736
1732
  console.warn(\`Failed to calculate hash for \${t}:\`, c);
@@ -1855,9 +1851,9 @@ class gs {
1855
1851
  const r = \`\${t === "/" ? "" : t}/\${n.name}\`;
1856
1852
  await this.remove(r, { recursive: !0 });
1857
1853
  }
1858
- await this.notifyChange({ path: t, type: b.Changed, isDirectory: !0 });
1854
+ await this.notifyChange({ path: t, type: O.Changed, isDirectory: !0 });
1859
1855
  } catch (e) {
1860
- throw e instanceof w ? e : A(e, { path: t, isDirectory: !0 });
1856
+ throw e instanceof w ? e : b(e, { path: t, isDirectory: !0 });
1861
1857
  }
1862
1858
  }
1863
1859
  /**
@@ -1888,7 +1884,7 @@ class gs {
1888
1884
  if (await this.mount(), t === "/")
1889
1885
  throw new nt("EROOT", t);
1890
1886
  const { recursive: n = !1, force: r = !1 } = e || {}, i = await this.getDirectoryHandle(K(t), !1), o = await this.stat(t);
1891
- await fs(i, t, { recursive: n, force: r }), await this.notifyChange({ path: t, type: b.Removed, isDirectory: o.isDirectory });
1887
+ await fs(i, t, { recursive: n, force: r }), await this.notifyChange({ path: t, type: O.Removed, isDirectory: o.isDirectory });
1892
1888
  }
1893
1889
  /**
1894
1890
  * Resolve a path to an absolute path
@@ -1911,12 +1907,12 @@ class gs {
1911
1907
  async realpath(t) {
1912
1908
  await this.mount();
1913
1909
  try {
1914
- const e = Lt(t);
1910
+ const e = zt(t);
1915
1911
  if (!await this.exists(e))
1916
1912
  throw new B("file", e);
1917
1913
  return e;
1918
1914
  } catch (e) {
1919
- throw e instanceof w ? e : A(e, { path: t });
1915
+ throw e instanceof w ? e : b(e, { path: t });
1920
1916
  }
1921
1917
  }
1922
1918
  /**
@@ -1947,9 +1943,9 @@ class gs {
1947
1943
  const r = n?.overwrite ?? !1, i = await this.stat(t);
1948
1944
  if (await this.exists(e) && !r)
1949
1945
  throw new rt(e);
1950
- await this.copy(t, e, { recursive: !0, overwrite: r }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: b.Removed, isDirectory: i.isDirectory }), await this.notifyChange({ path: e, type: b.Added, isDirectory: i.isDirectory });
1946
+ await this.copy(t, e, { recursive: !0, overwrite: r }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: O.Removed, isDirectory: i.isDirectory }), await this.notifyChange({ path: e, type: O.Added, isDirectory: i.isDirectory });
1951
1947
  } catch (r) {
1952
- throw r instanceof w ? r : A(r, { path: t });
1948
+ throw r instanceof w ? r : b(r, { path: t });
1953
1949
  }
1954
1950
  }
1955
1951
  /**
@@ -1999,7 +1995,7 @@ class gs {
1999
1995
  }
2000
1996
  }
2001
1997
  } catch (r) {
2002
- throw r instanceof w ? r : A(r, { path: t });
1998
+ throw r instanceof w ? r : b(r, { path: t });
2003
1999
  }
2004
2000
  }
2005
2001
  /**
@@ -2029,9 +2025,9 @@ class gs {
2029
2025
  */
2030
2026
  async watch(t, e) {
2031
2027
  if (!this.options.broadcastChannel)
2032
- throw new Ct("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.");
2028
+ throw new Nt("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.");
2033
2029
  const n = {
2034
- pattern: ls(t, e?.recursive ?? !0),
2030
+ pattern: hs(t, e?.recursive ?? !0),
2035
2031
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
2036
2032
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
2037
2033
  };
@@ -2044,32 +2040,90 @@ class gs {
2044
2040
  this.watchers.delete(t);
2045
2041
  }
2046
2042
  /**
2047
- * Bulk-create files from \`[path, data]\` entries (strings, bytes, or Blobs).
2043
+ * Read a file as a \`Blob\` without copying its bytes into memory.
2044
+ *
2045
+ * OPFS hands back a disk-backed \`File\`, so the browser can stream it on
2046
+ * demand — pass it to \`URL.createObjectURL()\` for \`<video>\` / \`<audio>\` /
2047
+ * \`<img>\` and only the played range is actually read. Structured clone keeps
2048
+ * the reference intact when the file system runs in a worker.
2049
+ *
2050
+ * @param path - Path to the file
2051
+ * @returns Lazy \`File\` handle backed by OPFS storage
2052
+ * @throws {OPFSError} If the path is missing or is a directory
2053
+ *
2054
+ * @example
2055
+ * \`\`\`typescript
2056
+ * const blob = await fs.readBlob('/media/clip.mp4');
2057
+ * video.src = URL.createObjectURL(blob);
2058
+ * \`\`\`
2059
+ */
2060
+ async readBlob(t) {
2061
+ await this.mount();
2062
+ try {
2063
+ return await (await this.getFileHandle(t, !1)).getFile();
2064
+ } catch (e) {
2065
+ throw e instanceof w ? e : b(e, { path: t, isDirectory: e?.name === "TypeMismatchError" });
2066
+ }
2067
+ }
2068
+ /**
2069
+ * Bulk-import files from \`[path, data]\` entries (strings, bytes, Blobs, or Files).
2070
+ * Each entry is written via {@link writeStream} so large Blobs/Files are not
2071
+ * fully buffered in memory.
2048
2072
  *
2049
- * @param entries - Array of \`[path, data]\` tuples
2073
+ * Accepts an array of tuples, a \`Map\`, or any iterable of \`[path, data]\` pairs.
2074
+ *
2075
+ * @param entries - Files to write
2076
+ * @param onProgress - Per-chunk progress with path, index, and byte counts
2077
+ * @returns Written paths, count, and total bytes
2050
2078
  * @throws {OPFSError} If a write fails
2051
2079
  *
2052
2080
  * @example
2053
2081
  * \`\`\`typescript
2054
- * await fs.createIndex([
2082
+ * const result = await fs.importFiles([
2055
2083
  * ['/config.json', JSON.stringify({ theme: 'dark' })],
2056
2084
  * ['/data/binary.dat', new Uint8Array([1, 2, 3, 4])],
2057
- * ['/upload.txt', new Blob(['file content'], { type: 'text/plain' })],
2058
- * ]);
2085
+ * ['/upload.txt', fileFromInput],
2086
+ * ], (p) => console.log(\`\${p.path}: \${p.bytesWritten}/\${p.bytesTotal}\`));
2087
+ *
2088
+ * console.log(result.count, result.bytesWritten, result.paths);
2059
2089
  * \`\`\`
2060
2090
  */
2061
- async createIndex(t) {
2091
+ async importFiles(t, e) {
2062
2092
  await this.mount();
2093
+ const n = [...t].map(([c, h]) => [Y(c), h]), r = n.length, i = n.map(([c]) => c), o = n.reduce((c, [, h]) => c + ws(h), 0);
2094
+ let a = 0;
2063
2095
  try {
2064
- for (const [e, n] of t) {
2065
- const r = Y(e);
2066
- let i;
2067
- n instanceof Blob ? i = await us(n) : typeof n == "string" ? i = new TextEncoder().encode(n) : i = n, await this.writeFile(r, i);
2096
+ for (let c = 0; c < r; c++) {
2097
+ const [h, l] = n[c], { stream: f, size: u } = ys(l), d = a, g = await this.writeStream(
2098
+ h,
2099
+ f,
2100
+ e ? (p) => e({
2101
+ path: h,
2102
+ index: c,
2103
+ count: r,
2104
+ bytesWritten: p,
2105
+ bytesTotal: u,
2106
+ totalBytesWritten: d + p,
2107
+ totalBytes: o
2108
+ }) : void 0
2109
+ );
2110
+ a += g;
2068
2111
  }
2069
- } catch (e) {
2070
- throw e instanceof w ? e : A(e);
2112
+ return {
2113
+ paths: i,
2114
+ count: r,
2115
+ bytesWritten: a
2116
+ };
2117
+ } catch (c) {
2118
+ throw c instanceof w ? c : b(c);
2071
2119
  }
2072
2120
  }
2121
+ /**
2122
+ * @deprecated Use {@link importFiles} instead.
2123
+ */
2124
+ async createIndex(t) {
2125
+ ms(), await this.importFiles(t);
2126
+ }
2073
2127
  /**
2074
2128
  * Dispose of resources and clean up the file system instance
2075
2129
  */
@@ -2077,7 +2131,27 @@ class gs {
2077
2131
  this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchers.clear();
2078
2132
  }
2079
2133
  }
2080
- class ws extends gs {
2134
+ function ws(s) {
2135
+ return typeof s == "string" ? new TextEncoder().encode(s).byteLength : s instanceof Blob ? s.size : s.byteLength;
2136
+ }
2137
+ function ys(s) {
2138
+ if (s instanceof Blob)
2139
+ return { stream: s.stream(), size: s.size };
2140
+ const t = typeof s == "string" ? new TextEncoder().encode(s) : s;
2141
+ return {
2142
+ size: t.byteLength,
2143
+ stream: new ReadableStream({
2144
+ start(e) {
2145
+ e.enqueue(t), e.close();
2146
+ }
2147
+ })
2148
+ };
2149
+ }
2150
+ let xt = !1;
2151
+ function ms() {
2152
+ xt || (xt = !0, console.warn("[opfs-worker] createIndex() is deprecated; use importFiles() instead"));
2153
+ }
2154
+ class Es extends gs {
2081
2155
  /** Shared sync handles per path (OPFS allows only one handle per file) */
2082
2156
  openHandles = /* @__PURE__ */ new Map();
2083
2157
  /** Map of open file descriptors to their metadata */
@@ -2100,7 +2174,7 @@ class ws extends gs {
2100
2174
  async readFile(t) {
2101
2175
  await this.mount();
2102
2176
  try {
2103
- return await $(t, async () => {
2177
+ return await M(t, async () => {
2104
2178
  const e = await this.open(t);
2105
2179
  try {
2106
2180
  const { size: n } = await this.fstat(e), r = new Uint8Array(n);
@@ -2110,26 +2184,26 @@ class ws extends gs {
2110
2184
  }
2111
2185
  });
2112
2186
  } catch (e) {
2113
- throw e instanceof w ? e : A(e, { path: t, isDirectory: !1 });
2187
+ throw e instanceof w ? e : b(e, { path: t, isDirectory: !1 });
2114
2188
  }
2115
2189
  }
2116
2190
  async writeFile(t, e) {
2117
2191
  await this.mount();
2118
2192
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
2119
- await $(t, async () => {
2193
+ await M(t, async () => {
2120
2194
  const r = await this.exists(t), i = await this.open(t, { create: !0, truncate: !0 });
2121
2195
  try {
2122
2196
  await this.write(i, n, 0, n.length, null, !1), await this.fsync(i);
2123
2197
  } finally {
2124
2198
  await this.close(i);
2125
2199
  }
2126
- await this.notifyChange({ path: t, type: r ? b.Changed : b.Added, isDirectory: !1 });
2200
+ await this.notifyChange({ path: t, type: r ? O.Changed : O.Added, isDirectory: !1 });
2127
2201
  });
2128
2202
  }
2129
2203
  async appendFile(t, e) {
2130
2204
  await this.mount();
2131
2205
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
2132
- await $(t, async () => {
2206
+ await M(t, async () => {
2133
2207
  const r = await this.open(t, { create: !0 });
2134
2208
  try {
2135
2209
  const { size: i } = await this.fstat(r);
@@ -2137,11 +2211,11 @@ class ws extends gs {
2137
2211
  } finally {
2138
2212
  await this.close(r);
2139
2213
  }
2140
- await this.notifyChange({ path: t, type: b.Changed, isDirectory: !1 });
2214
+ await this.notifyChange({ path: t, type: O.Changed, isDirectory: !1 });
2141
2215
  });
2142
2216
  }
2143
2217
  async writeStream(t, e, n) {
2144
- return await this.mount(), $(t, async () => {
2218
+ return await this.mount(), M(t, async () => {
2145
2219
  const r = await this.exists(t), i = await this.open(t, { create: !0, truncate: !0 }), o = e.getReader();
2146
2220
  let a = 0;
2147
2221
  try {
@@ -2170,16 +2244,16 @@ class ws extends gs {
2170
2244
  }
2171
2245
  return await this.notifyChange({
2172
2246
  path: t,
2173
- type: r ? b.Changed : b.Added,
2247
+ type: r ? O.Changed : O.Added,
2174
2248
  isDirectory: !1
2175
2249
  }), a;
2176
2250
  });
2177
2251
  }
2178
2252
  async open(t, e) {
2179
2253
  await this.mount();
2180
- const { create: n = !1, exclusive: r = !1, truncate: i = !1 } = e || {}, o = Y(Lt(t));
2254
+ const { create: n = !1, exclusive: r = !1, truncate: i = !1 } = e || {}, o = Y(zt(t));
2181
2255
  try {
2182
- return n && r ? await $(o, async () => {
2256
+ return n && r ? await M(o, async () => {
2183
2257
  if (await this.exists(o))
2184
2258
  throw new rt(o);
2185
2259
  return this._openFile(o, n, i);
@@ -2188,7 +2262,7 @@ class ws extends gs {
2188
2262
  if (a instanceof w)
2189
2263
  throw a;
2190
2264
  const c = a && a.name === "TypeMismatchError";
2191
- throw A(a, {
2265
+ throw b(a, {
2192
2266
  path: o,
2193
2267
  isDirectory: !!c
2194
2268
  });
@@ -2208,7 +2282,7 @@ class ws extends gs {
2208
2282
  try {
2209
2283
  await o.getFile();
2210
2284
  } catch (c) {
2211
- throw A(c, { path: t, isDirectory: !0 });
2285
+ throw b(c, { path: t, isDirectory: !0 });
2212
2286
  }
2213
2287
  const a = await ps(o, t);
2214
2288
  r = { fileHandle: o, syncHandle: a, refCount: 0 }, this.openHandles.set(t, r);
@@ -2246,7 +2320,7 @@ class ws extends gs {
2246
2320
  Et(e.length, n, c, i);
2247
2321
  try {
2248
2322
  const h = i ?? a.position, l = e.subarray(n, n + c), f = a.syncHandle.write(l, { at: h });
2249
- return (i == null || i === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: b.Changed, isDirectory: !1 }), f;
2323
+ return (i == null || i === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: O.Changed, isDirectory: !1 }), f;
2250
2324
  } catch (h) {
2251
2325
  throw z("write", t, a.path, h);
2252
2326
  }
@@ -2260,7 +2334,7 @@ class ws extends gs {
2260
2334
  if (e < 0 || !Number.isInteger(e))
2261
2335
  throw new C("argument", "Invalid size");
2262
2336
  try {
2263
- n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: b.Changed, isDirectory: !1 });
2337
+ n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: O.Changed, isDirectory: !1 });
2264
2338
  } catch (r) {
2265
2339
  throw z("truncate", t, n.path, r);
2266
2340
  }
@@ -2279,8 +2353,8 @@ class ws extends gs {
2279
2353
  this.openHandles.clear(), this.openFiles.clear(), this.nextFd = 1, super.dispose();
2280
2354
  }
2281
2355
  }
2282
- ot(new ws());
2283
- //# sourceMappingURL=dedicated.worker-nY3tK4zi.js.map
2356
+ ot(new Es());
2357
+ //# sourceMappingURL=dedicated.worker-DW6UqFo0.js.map
2284
2358
  `, o = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", a], { type: "text/javascript;charset=utf-8" });
2285
2359
  function l(t) {
2286
2360
  let n;
@@ -2304,12 +2378,12 @@ function l(t) {
2304
2378
  }
2305
2379
  }
2306
2380
  const p = l;
2307
- function f(t, n) {
2381
+ function d(t, n) {
2308
2382
  n && (n.broadcastChannel instanceof BroadcastChannel && (n.broadcastChannel = n.broadcastChannel.name), t.setOptions(n));
2309
2383
  }
2310
- function d(t = {}) {
2384
+ function u(t = {}) {
2311
2385
  const { url: n, worker: e, ...s } = t, r = e ?? (n ? new Worker(n, { type: "module" }) : new p()), i = h(r);
2312
- return f(i, s), {
2386
+ return d(i, s), {
2313
2387
  fs: i,
2314
2388
  worker: r,
2315
2389
  dispose() {
@@ -2324,10 +2398,10 @@ function d(t = {}) {
2324
2398
  };
2325
2399
  }
2326
2400
  function w(t) {
2327
- const { fs: n, worker: e, dispose: s } = d(t);
2401
+ const { fs: n, worker: e, dispose: s } = u(t);
2328
2402
  return new c({ fs: n, worker: e, dispose: s });
2329
2403
  }
2330
2404
  export {
2331
2405
  w as c
2332
2406
  };
2333
- //# sourceMappingURL=createOPFSDedicated-CsnV6MLP.js.map
2407
+ //# sourceMappingURL=createOPFSDedicated-BwTc0NV5.js.map