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