opfs-worker 0.5.0 → 0.5.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.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { wrap as i } from "comlink";
2
- import { D as p, F as f, O as d, b as u, a as g, P as m, c as w, S as y, T as b, e as v, q as S, p as x, d as E, t as P, k as A, x as F, f as O, v as C, h as T, i as R, j as $, m as _, g as D, n as I, l as M, u as j, r as N, s as k, w as L, o as U } from "./helpers-Bm2TWyPQ.js";
2
+ import { B as p, D as f, F as d, O as u, b as g, a as m, P as w, c as y, S as b, T as v, e as x, t as S, q as E, d as A, u as P, l as F, y as O, f as C, x as T, k as R, i as $, h as _, j as D, m as I, g as j, n as N, o as M, v as k, r as L, s as z, w as U, p as W } from "./helpers-DcIl7KL0.js";
3
3
  const r = `/**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
6
6
  * SPDX-License-Identifier: Apache-2.0
7
7
  */
8
- const ht = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Ot = Symbol("Comlink.releaseProxy"), U = Symbol("Comlink.finalizer"), L = Symbol("Comlink.thrown"), ut = (s) => typeof s == "object" && s !== null || typeof s == "function", Nt = {
9
- canHandle: (s) => ut(s) && s[ht],
8
+ const ut = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Nt = Symbol("Comlink.releaseProxy"), U = Symbol("Comlink.finalizer"), L = Symbol("Comlink.thrown"), ft = (s) => typeof s == "object" && s !== null || typeof s == "function", Ft = {
9
+ canHandle: (s) => ft(s) && s[ut],
10
10
  serialize(s) {
11
11
  const { port1: t, port2: e } = new MessageChannel();
12
- return Y(s, t), [e, [e]];
12
+ return J(s, t), [e, [e]];
13
13
  },
14
14
  deserialize(s) {
15
- return s.start(), $t(s);
15
+ return s.start(), Pt(s);
16
16
  }
17
- }, Ft = {
18
- canHandle: (s) => ut(s) && L in s,
17
+ }, Tt = {
18
+ canHandle: (s) => ft(s) && L in s,
19
19
  serialize({ value: s }) {
20
20
  let t;
21
21
  return s instanceof Error ? t = {
@@ -30,21 +30,21 @@ const ht = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Ot = Symbol
30
30
  deserialize(s) {
31
31
  throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
32
32
  }
33
- }, ft = /* @__PURE__ */ new Map([
34
- ["proxy", Nt],
35
- ["throw", Ft]
33
+ }, dt = /* @__PURE__ */ new Map([
34
+ ["proxy", Ft],
35
+ ["throw", Tt]
36
36
  ]);
37
- function Tt(s, t) {
37
+ function Mt(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;
41
41
  return !1;
42
42
  }
43
- function Y(s, t = globalThis, e = ["*"]) {
43
+ function J(s, t = globalThis, e = ["*"]) {
44
44
  t.addEventListener("message", function n(i) {
45
45
  if (!i || !i.data)
46
46
  return;
47
- if (!Tt(e, i.origin)) {
47
+ if (!Mt(e, i.origin)) {
48
48
  console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
49
49
  return;
50
50
  }
@@ -65,13 +65,13 @@ function Y(s, t = globalThis, e = ["*"]) {
65
65
  case "CONSTRUCT":
66
66
  {
67
67
  const u = new f(...l);
68
- h = It(u);
68
+ h = zt(u);
69
69
  }
70
70
  break;
71
71
  case "ENDPOINT":
72
72
  {
73
73
  const { port1: u, port2: d } = new MessageChannel();
74
- Y(s, d), h = Lt(u, [u]);
74
+ J(s, d), h = It(u, [u]);
75
75
  }
76
76
  break;
77
77
  case "RELEASE":
@@ -85,7 +85,7 @@ function Y(s, t = globalThis, e = ["*"]) {
85
85
  }
86
86
  Promise.resolve(h).catch((c) => ({ value: c, [L]: 0 })).then((c) => {
87
87
  const [f, u] = H(c);
88
- t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), dt(t), U in s && typeof s[U] == "function" && s[U]());
88
+ t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), pt(t), U in s && typeof s[U] == "function" && s[U]());
89
89
  }).catch((c) => {
90
90
  const [f, u] = H({
91
91
  value: new TypeError("Unserializable return value"),
@@ -95,13 +95,13 @@ function Y(s, t = globalThis, e = ["*"]) {
95
95
  });
96
96
  }), t.start && t.start();
97
97
  }
98
- function Mt(s) {
98
+ function $t(s) {
99
99
  return s.constructor.name === "MessagePort";
100
100
  }
101
- function dt(s) {
102
- Mt(s) && s.close();
101
+ function pt(s) {
102
+ $t(s) && s.close();
103
103
  }
104
- function $t(s, t) {
104
+ function Pt(s, t) {
105
105
  const e = /* @__PURE__ */ new Map();
106
106
  return s.addEventListener("message", function(i) {
107
107
  const { data: r } = i;
@@ -114,54 +114,54 @@ function $t(s, t) {
114
114
  } finally {
115
115
  e.delete(r.id);
116
116
  }
117
- }), V(s, e, [], t);
117
+ }), X(s, e, [], t);
118
118
  }
119
119
  function R(s) {
120
120
  if (s)
121
121
  throw new Error("Proxy has been released and is not useable");
122
122
  }
123
- function pt(s) {
124
- return D(s, /* @__PURE__ */ new Map(), {
123
+ function gt(s) {
124
+ return O(s, /* @__PURE__ */ new Map(), {
125
125
  type: "RELEASE"
126
126
  }).then(() => {
127
- dt(s);
127
+ pt(s);
128
128
  });
129
129
  }
130
130
  const I = /* @__PURE__ */ new WeakMap(), z = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
131
131
  const t = (I.get(s) || 0) - 1;
132
- I.set(s, t), t === 0 && pt(s);
132
+ I.set(s, t), t === 0 && gt(s);
133
133
  });
134
- function Pt(s, t) {
134
+ function Rt(s, t) {
135
135
  const e = (I.get(t) || 0) + 1;
136
136
  I.set(t, e), z && z.register(s, t, s);
137
137
  }
138
- function Rt(s) {
138
+ function kt(s) {
139
139
  z && z.unregister(s);
140
140
  }
141
- function V(s, t, e = [], n = function() {
141
+ function X(s, t, e = [], n = function() {
142
142
  }) {
143
143
  let i = !1;
144
144
  const r = new Proxy(n, {
145
145
  get(o, a) {
146
- if (R(i), a === Ot)
146
+ if (R(i), a === Nt)
147
147
  return () => {
148
- Rt(r), pt(s), t.clear(), i = !0;
148
+ kt(r), gt(s), t.clear(), i = !0;
149
149
  };
150
150
  if (a === "then") {
151
151
  if (e.length === 0)
152
152
  return { then: () => r };
153
- const l = D(s, t, {
153
+ const l = O(s, t, {
154
154
  type: "GET",
155
155
  path: e.map((h) => h.toString())
156
156
  }).then(C);
157
157
  return l.then.bind(l);
158
158
  }
159
- return V(s, t, [...e, a]);
159
+ return X(s, t, [...e, a]);
160
160
  },
161
161
  set(o, a, l) {
162
162
  R(i);
163
163
  const [h, c] = H(l);
164
- return D(s, t, {
164
+ return O(s, t, {
165
165
  type: "SET",
166
166
  path: [...e, a].map((f) => f.toString()),
167
167
  value: h
@@ -171,13 +171,13 @@ function V(s, t, e = [], n = function() {
171
171
  R(i);
172
172
  const h = e[e.length - 1];
173
173
  if (h === Dt)
174
- return D(s, t, {
174
+ return O(s, t, {
175
175
  type: "ENDPOINT"
176
176
  }).then(C);
177
177
  if (h === "bind")
178
- return V(s, t, e.slice(0, -1));
179
- const [c, f] = et(l);
180
- return D(s, t, {
178
+ return X(s, t, e.slice(0, -1));
179
+ const [c, f] = st(l);
180
+ return O(s, t, {
181
181
  type: "APPLY",
182
182
  path: e.map((u) => u.toString()),
183
183
  argumentList: c
@@ -185,32 +185,32 @@ function V(s, t, e = [], n = function() {
185
185
  },
186
186
  construct(o, a) {
187
187
  R(i);
188
- const [l, h] = et(a);
189
- return D(s, t, {
188
+ const [l, h] = st(a);
189
+ return O(s, t, {
190
190
  type: "CONSTRUCT",
191
191
  path: e.map((c) => c.toString()),
192
192
  argumentList: l
193
193
  }, h).then(C);
194
194
  }
195
195
  });
196
- return Pt(r, s), r;
196
+ return Rt(r, s), r;
197
197
  }
198
- function kt(s) {
198
+ function Lt(s) {
199
199
  return Array.prototype.concat.apply([], s);
200
200
  }
201
- function et(s) {
201
+ function st(s) {
202
202
  const t = s.map(H);
203
- return [t.map((e) => e[0]), kt(t.map((e) => e[1]))];
203
+ return [t.map((e) => e[0]), Lt(t.map((e) => e[1]))];
204
204
  }
205
- const gt = /* @__PURE__ */ new WeakMap();
206
- function Lt(s, t) {
207
- return gt.set(s, t), s;
205
+ const mt = /* @__PURE__ */ new WeakMap();
206
+ function It(s, t) {
207
+ return mt.set(s, t), s;
208
208
  }
209
- function It(s) {
210
- return Object.assign(s, { [ht]: !0 });
209
+ function zt(s) {
210
+ return Object.assign(s, { [ut]: !0 });
211
211
  }
212
212
  function H(s) {
213
- for (const [t, e] of ft)
213
+ for (const [t, e] of dt)
214
214
  if (e.canHandle(s)) {
215
215
  const [n, i] = e.serialize(s);
216
216
  return [
@@ -227,24 +227,24 @@ function H(s) {
227
227
  type: "RAW",
228
228
  value: s
229
229
  },
230
- gt.get(s) || []
230
+ mt.get(s) || []
231
231
  ];
232
232
  }
233
233
  function C(s) {
234
234
  switch (s.type) {
235
235
  case "HANDLER":
236
- return ft.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
- function D(s, t, e, n) {
241
+ function O(s, t, e, n) {
242
242
  return new Promise((i) => {
243
- const r = zt();
243
+ const r = Ht();
244
244
  t.set(r, i), s.start && s.start(), s.postMessage(Object.assign({ id: r }, e), n);
245
245
  });
246
246
  }
247
- function zt() {
247
+ function Ht() {
248
248
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
249
249
  }
250
250
  class g extends Error {
@@ -252,12 +252,12 @@ class g extends Error {
252
252
  super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
253
253
  }
254
254
  }
255
- class Ht extends g {
255
+ class Wt extends g {
256
256
  constructor(t) {
257
257
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
258
258
  }
259
259
  }
260
- class Wt extends g {
260
+ class jt extends g {
261
261
  constructor(t, e, n) {
262
262
  super(t, "INVALID_PATH", e, n);
263
263
  }
@@ -267,7 +267,7 @@ class _ extends g {
267
267
  super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t, e);
268
268
  }
269
269
  }
270
- function jt(s, t = "utf-8") {
270
+ function Ut(s, t = "utf-8") {
271
271
  switch (t) {
272
272
  case "utf8":
273
273
  case "utf-8":
@@ -275,11 +275,11 @@ function jt(s, t = "utf-8") {
275
275
  case "utf16le":
276
276
  case "ucs2":
277
277
  case "ucs-2":
278
- return _t(s);
278
+ return Bt(s);
279
279
  case "ascii":
280
- return qt(s);
280
+ return Vt(s);
281
281
  case "latin1":
282
- return Gt(s);
282
+ return qt(s);
283
283
  case "binary":
284
284
  return Uint8Array.from(s, (e) => e.charCodeAt(0));
285
285
  case "base64":
@@ -292,7 +292,7 @@ function jt(s, t = "utf-8") {
292
292
  return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
293
293
  }
294
294
  }
295
- function Ut(s, t = "utf-8") {
295
+ function _t(s, t = "utf-8") {
296
296
  switch (t) {
297
297
  case "utf8":
298
298
  case "utf-8":
@@ -300,7 +300,7 @@ function Ut(s, t = "utf-8") {
300
300
  case "utf16le":
301
301
  case "ucs2":
302
302
  case "ucs-2":
303
- return Bt(s);
303
+ return Gt(s);
304
304
  case "latin1":
305
305
  return String.fromCharCode(...s);
306
306
  case "binary":
@@ -315,7 +315,7 @@ function Ut(s, t = "utf-8") {
315
315
  return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
316
316
  }
317
317
  }
318
- function _t(s) {
318
+ function Bt(s) {
319
319
  const t = new Uint8Array(s.length * 2);
320
320
  for (let e = 0; e < s.length; e++) {
321
321
  const n = s.charCodeAt(e);
@@ -323,25 +323,25 @@ function _t(s) {
323
323
  }
324
324
  return t;
325
325
  }
326
- function Bt(s) {
326
+ function Gt(s) {
327
327
  s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
328
328
  const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
329
329
  return String.fromCharCode(...t);
330
330
  }
331
- function Gt(s) {
331
+ function qt(s) {
332
332
  const t = new Uint8Array(s.length);
333
333
  for (let e = 0; e < s.length; e++)
334
334
  t[e] = s.charCodeAt(e) & 255;
335
335
  return t;
336
336
  }
337
- function qt(s) {
337
+ function Vt(s) {
338
338
  const t = new Uint8Array(s.length);
339
339
  for (let e = 0; e < s.length; e++)
340
340
  t[e] = s.charCodeAt(e) & 127;
341
341
  return t;
342
342
  }
343
- const mt = (s, t, e) => {
344
- const n = s instanceof RegExp ? st(s, e) : s, i = t instanceof RegExp ? st(t, e) : t, r = n !== null && i != null && Vt(n, i, e);
343
+ const wt = (s, t, e) => {
344
+ const n = s instanceof RegExp ? nt(s, e) : s, i = t instanceof RegExp ? nt(t, e) : t, r = n !== null && i != null && Xt(n, i, e);
345
345
  return r && {
346
346
  start: r[0],
347
347
  end: r[1],
@@ -349,10 +349,10 @@ const mt = (s, t, e) => {
349
349
  body: e.slice(r[0] + n.length, r[1]),
350
350
  post: e.slice(r[1] + i.length)
351
351
  };
352
- }, st = (s, t) => {
352
+ }, nt = (s, t) => {
353
353
  const e = t.match(s);
354
354
  return e ? e[0] : null;
355
- }, Vt = (s, t, e) => {
355
+ }, Xt = (s, t, e) => {
356
356
  let n, i, r, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
357
357
  if (l >= 0 && h > 0) {
358
358
  if (s === t)
@@ -370,20 +370,20 @@ const mt = (s, t, e) => {
370
370
  n.length && o !== void 0 && (a = [r, o]);
371
371
  }
372
372
  return a;
373
- }, wt = "\\0SLASH" + Math.random() + "\\0", yt = "\\0OPEN" + Math.random() + "\\0", J = "\\0CLOSE" + Math.random() + "\\0", Et = "\\0COMMA" + Math.random() + "\\0", St = "\\0PERIOD" + Math.random() + "\\0", Zt = new RegExp(wt, "g"), Xt = new RegExp(yt, "g"), Yt = new RegExp(J, "g"), Jt = new RegExp(Et, "g"), Kt = new RegExp(St, "g"), Qt = /\\\\\\\\/g, te = /\\\\{/g, ee = /\\\\}/g, se = /\\\\,/g, ne = /\\\\./g;
373
+ }, yt = "\\0SLASH" + Math.random() + "\\0", Et = "\\0OPEN" + Math.random() + "\\0", K = "\\0CLOSE" + Math.random() + "\\0", St = "\\0COMMA" + Math.random() + "\\0", bt = "\\0PERIOD" + Math.random() + "\\0", Yt = new RegExp(yt, "g"), Zt = new RegExp(Et, "g"), Jt = new RegExp(K, "g"), Kt = new RegExp(St, "g"), Qt = new RegExp(bt, "g"), te = /\\\\\\\\/g, ee = /\\\\{/g, se = /\\\\}/g, ne = /\\\\,/g, ie = /\\\\./g;
374
374
  function B(s) {
375
375
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
376
376
  }
377
- function ie(s) {
378
- return s.replace(Qt, wt).replace(te, yt).replace(ee, J).replace(se, Et).replace(ne, St);
379
- }
380
377
  function re(s) {
381
- return s.replace(Zt, "\\\\").replace(Xt, "{").replace(Yt, "}").replace(Jt, ",").replace(Kt, ".");
378
+ return s.replace(te, yt).replace(ee, Et).replace(se, K).replace(ne, St).replace(ie, bt);
379
+ }
380
+ function oe(s) {
381
+ return s.replace(Yt, "\\\\").replace(Zt, "{").replace(Jt, "}").replace(Kt, ",").replace(Qt, ".");
382
382
  }
383
383
  function xt(s) {
384
384
  if (!s)
385
385
  return [""];
386
- const t = [], e = mt("{", "}", s);
386
+ const t = [], e = wt("{", "}", s);
387
387
  if (!e)
388
388
  return s.split(",");
389
389
  const { pre: n, body: i, post: r } = e, o = n.split(",");
@@ -391,23 +391,23 @@ function xt(s) {
391
391
  const a = xt(r);
392
392
  return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
393
393
  }
394
- function oe(s) {
395
- return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), M(ie(s), !0).map(re)) : [];
396
- }
397
394
  function ae(s) {
398
- return "{" + s + "}";
395
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), M(re(s), !0).map(oe)) : [];
399
396
  }
400
397
  function ce(s) {
398
+ return "{" + s + "}";
399
+ }
400
+ function le(s) {
401
401
  return /^-?0\\d/.test(s);
402
402
  }
403
- function le(s, t) {
403
+ function he(s, t) {
404
404
  return s <= t;
405
405
  }
406
- function he(s, t) {
406
+ function ue(s, t) {
407
407
  return s >= t;
408
408
  }
409
409
  function M(s, t) {
410
- const e = [], n = mt("{", "}", s);
410
+ const e = [], n = wt("{", "}", s);
411
411
  if (!n)
412
412
  return [s];
413
413
  const i = n.pre, r = n.post.length ? M(n.post, !1) : [""];
@@ -419,28 +419,28 @@ function M(s, t) {
419
419
  else {
420
420
  const o = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(n.body), a = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(n.body), l = o || a, h = n.body.indexOf(",") >= 0;
421
421
  if (!l && !h)
422
- return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + J + n.post, M(s)) : [s];
422
+ return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + K + n.post, M(s)) : [s];
423
423
  let c;
424
424
  if (l)
425
425
  c = n.body.split(/\\.\\./);
426
- else if (c = xt(n.body), c.length === 1 && c[0] !== void 0 && (c = M(c[0], !1).map(ae), c.length === 1))
426
+ else if (c = xt(n.body), c.length === 1 && c[0] !== void 0 && (c = M(c[0], !1).map(ce), c.length === 1))
427
427
  return r.map((u) => n.pre + c[0] + u);
428
428
  let f;
429
429
  if (l && c[0] !== void 0 && c[1] !== void 0) {
430
430
  const u = B(c[0]), d = B(c[1]), m = Math.max(c[0].length, c[1].length);
431
- let p = c.length === 3 && c[2] !== void 0 ? Math.abs(B(c[2])) : 1, S = le;
432
- d < u && (p *= -1, S = he);
433
- const N = c.some(ce);
431
+ let p = c.length === 3 && c[2] !== void 0 ? Math.abs(B(c[2])) : 1, S = he;
432
+ d < u && (p *= -1, S = ue);
433
+ const N = c.some(le);
434
434
  f = [];
435
- for (let x = u; S(x, d); x += p) {
435
+ for (let b = u; S(b, d); b += p) {
436
436
  let w;
437
437
  if (a)
438
- w = String.fromCharCode(x), w === "\\\\" && (w = "");
439
- else if (w = String(x), N) {
438
+ w = String.fromCharCode(b), w === "\\\\" && (w = "");
439
+ else if (w = String(b), N) {
440
440
  const F = m - w.length;
441
441
  if (F > 0) {
442
442
  const P = new Array(F + 1).join("0");
443
- x < 0 ? w = "-" + P + w.slice(1) : w = P + w;
443
+ b < 0 ? w = "-" + P + w.slice(1) : w = P + w;
444
444
  }
445
445
  }
446
446
  f.push(w);
@@ -458,12 +458,12 @@ function M(s, t) {
458
458
  }
459
459
  return e;
460
460
  }
461
- const ue = 1024 * 64, W = (s) => {
461
+ const fe = 1024 * 64, W = (s) => {
462
462
  if (typeof s != "string")
463
463
  throw new TypeError("invalid pattern");
464
- if (s.length > ue)
464
+ if (s.length > fe)
465
465
  throw new TypeError("pattern is too long");
466
- }, fe = {
466
+ }, de = {
467
467
  "[:alnum:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}", !0],
468
468
  "[:alpha:]": ["\\\\p{L}\\\\p{Nl}", !0],
469
469
  "[:ascii:]": ["\\\\x00-\\\\x7f", !1],
@@ -478,7 +478,7 @@ const ue = 1024 * 64, W = (s) => {
478
478
  "[:upper:]": ["\\\\p{Lu}", !0],
479
479
  "[:word:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}", !0],
480
480
  "[:xdigit:]": ["A-Fa-f0-9", !1]
481
- }, T = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), de = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), nt = (s) => s.join(""), pe = (s, t) => {
481
+ }, T = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), pe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), it = (s) => s.join(""), ge = (s, t) => {
482
482
  const e = t;
483
483
  if (s.charAt(e) !== "[")
484
484
  throw new Error("not in a brace expression");
@@ -499,11 +499,11 @@ const ue = 1024 * 64, W = (s) => {
499
499
  continue;
500
500
  }
501
501
  if (p === "[" && !l) {
502
- for (const [S, [v, N, x]] of Object.entries(fe))
502
+ for (const [S, [v, N, b]] of Object.entries(de))
503
503
  if (s.startsWith(S, r)) {
504
504
  if (f)
505
505
  return ["$.", !1, s.length - e, !0];
506
- r += S.length, x ? i.push(v) : n.push(v), a = a || N;
506
+ r += S.length, b ? i.push(v) : n.push(v), a = a || N;
507
507
  continue t;
508
508
  }
509
509
  }
@@ -527,11 +527,11 @@ const ue = 1024 * 64, W = (s) => {
527
527
  return ["$.", !1, s.length - e, !0];
528
528
  if (i.length === 0 && n.length === 1 && /^\\\\?.$/.test(n[0]) && !h) {
529
529
  const p = n[0].length === 2 ? n[0].slice(-1) : n[0];
530
- return [de(p), !1, c - e, !1];
530
+ return [pe(p), !1, c - e, !1];
531
531
  }
532
- const u = "[" + (h ? "^" : "") + nt(n) + "]", d = "[" + (h ? "" : "^") + nt(i) + "]";
532
+ const u = "[" + (h ? "^" : "") + it(n) + "]", d = "[" + (h ? "" : "^") + it(i) + "]";
533
533
  return [n.length && i.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
534
- }, $ = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), ge = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), it = (s) => ge.has(s), me = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", k = "(?!\\\\.)", we = /* @__PURE__ */ new Set(["[", "."]), ye = /* @__PURE__ */ new Set(["..", "."]), Ee = new Set("().*{}+?[]^$\\\\!"), Se = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), K = "[^/]", rt = K + "*?", ot = K + "+?";
534
+ }, $ = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), me = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), rt = (s) => me.has(s), we = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", k = "(?!\\\\.)", ye = /* @__PURE__ */ new Set(["[", "."]), Ee = /* @__PURE__ */ new Set(["..", "."]), Se = new Set("().*{}+?[]^$\\\\!"), be = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), Q = "[^/]", ot = Q + "*?", at = Q + "+?";
535
535
  class E {
536
536
  type;
537
537
  #s;
@@ -648,7 +648,7 @@ class E {
648
648
  o = !0, a = d, l = !1, m += p;
649
649
  continue;
650
650
  }
651
- if (!i.noext && it(p) && t.charAt(d) === "(") {
651
+ if (!i.noext && rt(p) && t.charAt(d) === "(") {
652
652
  e.push(m), m = "";
653
653
  const S = new E(p, e);
654
654
  d = E.#h(t, S, d, i), e.push(S);
@@ -674,7 +674,7 @@ class E {
674
674
  o = !0, a = h, l = !1, u += d;
675
675
  continue;
676
676
  }
677
- if (it(d) && t.charAt(h) === "(") {
677
+ if (rt(d) && t.charAt(h) === "(") {
678
678
  c.push(u), u = "";
679
679
  const m = new E(d, c);
680
680
  c.push(m), h = E.#h(t, m, h, i);
@@ -788,14 +788,14 @@ class E {
788
788
  return this.#n = this.#n || S, this.#r = this.#r || v, m;
789
789
  }).join("");
790
790
  let c = "";
791
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && ye.has(this.#t[0]))) {
792
- const m = we, p = (
791
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Ee.has(this.#t[0]))) {
792
+ const m = ye, p = (
793
793
  // dots are allowed, and the pattern starts with [ or .
794
794
  e && m.has(h.charAt(0)) || // the pattern starts with \\., and then [ or .
795
795
  h.startsWith("\\\\.") && m.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
796
796
  h.startsWith("\\\\.\\\\.") && m.has(h.charAt(4))
797
797
  ), S = !e && !t && m.has(h.charAt(0));
798
- c = p ? me : S ? k : "";
798
+ c = p ? we : S ? k : "";
799
799
  }
800
800
  let f = "";
801
801
  return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
@@ -815,11 +815,11 @@ class E {
815
815
  o === r && (o = ""), o && (r = \`(?:\${r})(?:\${o})*?\`);
816
816
  let a = "";
817
817
  if (this.type === "!" && this.#u)
818
- a = (this.isStart() && !e ? k : "") + ot;
818
+ a = (this.isStart() && !e ? k : "") + at;
819
819
  else {
820
820
  const l = this.type === "!" ? (
821
821
  // !() must match something,but !(x) can match ''
822
- "))" + (this.isStart() && !e && !t ? k : "") + rt + ")"
822
+ "))" + (this.isStart() && !e && !t ? k : "") + ot + ")"
823
823
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : \`)\${this.type}\`;
824
824
  a = i + r + l;
825
825
  }
@@ -843,7 +843,7 @@ class E {
843
843
  for (let a = 0; a < t.length; a++) {
844
844
  const l = t.charAt(a);
845
845
  if (i) {
846
- i = !1, r += (Ee.has(l) ? "\\\\" : "") + l;
846
+ i = !1, r += (Se.has(l) ? "\\\\" : "") + l;
847
847
  continue;
848
848
  }
849
849
  if (l === "\\\\") {
@@ -851,97 +851,97 @@ class E {
851
851
  continue;
852
852
  }
853
853
  if (l === "[") {
854
- const [h, c, f, u] = pe(t, a);
854
+ const [h, c, f, u] = ge(t, a);
855
855
  if (f) {
856
856
  r += h, o = o || c, a += f - 1, e = e || u;
857
857
  continue;
858
858
  }
859
859
  }
860
860
  if (l === "*") {
861
- n && t === "*" ? r += ot : r += rt, e = !0;
861
+ n && t === "*" ? r += at : r += ot, e = !0;
862
862
  continue;
863
863
  }
864
864
  if (l === "?") {
865
- r += K, e = !0;
865
+ r += Q, e = !0;
866
866
  continue;
867
867
  }
868
- r += Se(l);
868
+ r += be(l);
869
869
  }
870
870
  return [r, $(t), !!e, o];
871
871
  }
872
872
  }
873
- const xe = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (W(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new j(t, e).match(s)), be = /^\\*+([^+@!?\\*\\[\\(]*)$/, Ae = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ve = (s) => (t) => t.endsWith(s), Ce = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), De = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Oe = /^\\*+\\.\\*+$/, Ne = (s) => !s.startsWith(".") && s.includes("."), Fe = (s) => s !== "." && s !== ".." && s.includes("."), Te = /^\\.\\*+$/, Me = (s) => s !== "." && s !== ".." && s.startsWith("."), $e = /^\\*+$/, Pe = (s) => s.length !== 0 && !s.startsWith("."), Re = (s) => s.length !== 0 && s !== "." && s !== "..", ke = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Le = ([s, t = ""]) => {
874
- const e = bt([s]);
875
- return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
876
- }, Ie = ([s, t = ""]) => {
873
+ const xe = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (W(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new j(t, e).match(s)), Ae = /^\\*+([^+@!?\\*\\[\\(]*)$/, ve = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Ce = (s) => (t) => t.endsWith(s), Oe = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), De = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Ne = /^\\*+\\.\\*+$/, Fe = (s) => !s.startsWith(".") && s.includes("."), Te = (s) => s !== "." && s !== ".." && s.includes("."), Me = /^\\.\\*+$/, $e = (s) => s !== "." && s !== ".." && s.startsWith("."), Pe = /^\\*+$/, Re = (s) => s.length !== 0 && !s.startsWith("."), ke = (s) => s.length !== 0 && s !== "." && s !== "..", Le = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ie = ([s, t = ""]) => {
877
874
  const e = At([s]);
878
875
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
879
876
  }, ze = ([s, t = ""]) => {
880
- const e = At([s]);
881
- return t ? (n) => e(n) && n.endsWith(t) : e;
877
+ const e = vt([s]);
878
+ return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
882
879
  }, He = ([s, t = ""]) => {
883
- const e = bt([s]);
880
+ const e = vt([s]);
881
+ return t ? (n) => e(n) && n.endsWith(t) : e;
882
+ }, We = ([s, t = ""]) => {
883
+ const e = At([s]);
884
884
  return t ? (n) => e(n) && n.endsWith(t) : e;
885
- }, bt = ([s]) => {
885
+ }, At = ([s]) => {
886
886
  const t = s.length;
887
887
  return (e) => e.length === t && !e.startsWith(".");
888
- }, At = ([s]) => {
888
+ }, vt = ([s]) => {
889
889
  const t = s.length;
890
890
  return (e) => e.length === t && e !== "." && e !== "..";
891
- }, vt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", at = {
891
+ }, Ct = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", ct = {
892
892
  win32: { sep: "\\\\" },
893
893
  posix: { sep: "/" }
894
- }, We = vt === "win32" ? at.win32.sep : at.posix.sep;
895
- y.sep = We;
894
+ }, je = Ct === "win32" ? ct.win32.sep : ct.posix.sep;
895
+ y.sep = je;
896
896
  const A = Symbol("globstar **");
897
897
  y.GLOBSTAR = A;
898
- const je = "[^/]", Ue = je + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Be = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Ge = (s, t = {}) => (e) => y(e, s, t);
899
- y.filter = Ge;
900
- const b = (s, t = {}) => Object.assign({}, s, t), qe = (s) => {
898
+ const Ue = "[^/]", _e = Ue + "*?", Be = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Ge = "(?:(?!(?:\\\\/|^)\\\\.).)*?", qe = (s, t = {}) => (e) => y(e, s, t);
899
+ y.filter = qe;
900
+ const x = (s, t = {}) => Object.assign({}, s, t), Ve = (s) => {
901
901
  if (!s || typeof s != "object" || !Object.keys(s).length)
902
902
  return y;
903
903
  const t = y;
904
- return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
904
+ return Object.assign((n, i, r = {}) => t(n, i, x(s, r)), {
905
905
  Minimatch: class extends t.Minimatch {
906
906
  constructor(i, r = {}) {
907
- super(i, b(s, r));
907
+ super(i, x(s, r));
908
908
  }
909
909
  static defaults(i) {
910
- return t.defaults(b(s, i)).Minimatch;
910
+ return t.defaults(x(s, i)).Minimatch;
911
911
  }
912
912
  },
913
913
  AST: class extends t.AST {
914
914
  /* c8 ignore start */
915
915
  constructor(i, r, o = {}) {
916
- super(i, r, b(s, o));
916
+ super(i, r, x(s, o));
917
917
  }
918
918
  /* c8 ignore stop */
919
919
  static fromGlob(i, r = {}) {
920
- return t.AST.fromGlob(i, b(s, r));
920
+ return t.AST.fromGlob(i, x(s, r));
921
921
  }
922
922
  },
923
- unescape: (n, i = {}) => t.unescape(n, b(s, i)),
924
- escape: (n, i = {}) => t.escape(n, b(s, i)),
925
- filter: (n, i = {}) => t.filter(n, b(s, i)),
926
- defaults: (n) => t.defaults(b(s, n)),
927
- makeRe: (n, i = {}) => t.makeRe(n, b(s, i)),
928
- braceExpand: (n, i = {}) => t.braceExpand(n, b(s, i)),
929
- match: (n, i, r = {}) => t.match(n, i, b(s, r)),
923
+ unescape: (n, i = {}) => t.unescape(n, x(s, i)),
924
+ escape: (n, i = {}) => t.escape(n, x(s, i)),
925
+ filter: (n, i = {}) => t.filter(n, x(s, i)),
926
+ defaults: (n) => t.defaults(x(s, n)),
927
+ makeRe: (n, i = {}) => t.makeRe(n, x(s, i)),
928
+ braceExpand: (n, i = {}) => t.braceExpand(n, x(s, i)),
929
+ match: (n, i, r = {}) => t.match(n, i, x(s, r)),
930
930
  sep: t.sep,
931
931
  GLOBSTAR: A
932
932
  });
933
933
  };
934
- y.defaults = qe;
935
- const Ct = (s, t = {}) => (W(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : oe(s));
936
- y.braceExpand = Ct;
937
- const Ve = (s, t = {}) => new j(s, t).makeRe();
938
- y.makeRe = Ve;
939
- const Ze = (s, t, e = {}) => {
934
+ y.defaults = Ve;
935
+ const Ot = (s, t = {}) => (W(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ae(s));
936
+ y.braceExpand = Ot;
937
+ const Xe = (s, t = {}) => new j(s, t).makeRe();
938
+ y.makeRe = Xe;
939
+ const Ye = (s, t, e = {}) => {
940
940
  const n = new j(t, e);
941
941
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
942
942
  };
943
- y.match = Ze;
944
- const ct = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Xe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
943
+ y.match = Ye;
944
+ const lt = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Ze = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
945
945
  class j {
946
946
  options;
947
947
  set;
@@ -961,7 +961,7 @@ class j {
961
961
  windowsNoMagicRoot;
962
962
  regexp;
963
963
  constructor(t, e = {}) {
964
- W(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || vt, 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();
964
+ W(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ct, 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();
965
965
  }
966
966
  hasMagic() {
967
967
  if (this.options.magicalBraces && this.set.length > 1)
@@ -989,7 +989,7 @@ class j {
989
989
  this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
990
990
  let i = this.globParts.map((r, o, a) => {
991
991
  if (this.isWindows && this.windowsNoMagicRoot) {
992
- const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !ct.test(r[2])) && !ct.test(r[3]), h = /^[a-z]:/i.test(r[0]);
992
+ const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !lt.test(r[2])) && !lt.test(r[3]), h = /^[a-z]:/i.test(r[0]);
993
993
  if (l)
994
994
  return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
995
995
  if (h)
@@ -1169,10 +1169,10 @@ class j {
1169
1169
  matchOne(t, e, n = !1) {
1170
1170
  const i = this.options;
1171
1171
  if (this.isWindows) {
1172
- 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]), N = !v && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, w = N ? 3 : v ? 0 : void 0;
1173
- if (typeof x == "number" && typeof w == "number") {
1174
- const [F, P] = [t[x], e[w]];
1175
- F.toLowerCase() === P.toLowerCase() && (e[w] = F, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
1172
+ 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]), N = !v && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), b = S ? 3 : p ? 0 : void 0, w = N ? 3 : v ? 0 : void 0;
1173
+ if (typeof b == "number" && typeof w == "number") {
1174
+ const [F, P] = [t[b], e[w]];
1175
+ F.toLowerCase() === P.toLowerCase() && (e[w] = F, w > b ? e = e.slice(w) : b > w && (t = t.slice(b)));
1176
1176
  }
1177
1177
  }
1178
1178
  const { optimizationLevel: r = 1 } = this.options;
@@ -1218,7 +1218,7 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1218
1218
  throw new Error("wtf?");
1219
1219
  }
1220
1220
  braceExpand() {
1221
- return Ct(this.pattern, this.options);
1221
+ return Ot(this.pattern, this.options);
1222
1222
  }
1223
1223
  parse(t) {
1224
1224
  W(t);
@@ -1228,7 +1228,7 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1228
1228
  if (t === "")
1229
1229
  return "";
1230
1230
  let n, i = null;
1231
- (n = t.match($e)) ? i = e.dot ? Re : Pe : (n = t.match(be)) ? i = (e.nocase ? e.dot ? De : Ce : e.dot ? ve : Ae)(n[1]) : (n = t.match(ke)) ? i = (e.nocase ? e.dot ? Ie : Le : e.dot ? ze : He)(n) : (n = t.match(Oe)) ? i = e.dot ? Fe : Ne : (n = t.match(Te)) && (i = Me);
1231
+ (n = t.match(Pe)) ? i = e.dot ? ke : Re : (n = t.match(Ae)) ? i = (e.nocase ? e.dot ? De : Oe : e.dot ? Ce : ve)(n[1]) : (n = t.match(Le)) ? i = (e.nocase ? e.dot ? ze : Ie : e.dot ? He : We)(n) : (n = t.match(Ne)) ? i = e.dot ? Te : Fe : (n = t.match(Me)) && (i = $e);
1232
1232
  const r = E.fromGlob(t, this.options).toMMPattern();
1233
1233
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1234
1234
  }
@@ -1238,13 +1238,13 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1238
1238
  const t = this.set;
1239
1239
  if (!t.length)
1240
1240
  return this.regexp = !1, this.regexp;
1241
- const e = this.options, n = e.noglobstar ? Ue : e.dot ? _e : Be, i = new Set(e.nocase ? ["i"] : []);
1241
+ const e = this.options, n = e.noglobstar ? _e : e.dot ? Be : Ge, i = new Set(e.nocase ? ["i"] : []);
1242
1242
  let r = t.map((l) => {
1243
1243
  const h = l.map((c) => {
1244
1244
  if (c instanceof RegExp)
1245
1245
  for (const f of c.flags.split(""))
1246
1246
  i.add(f);
1247
- return typeof c == "string" ? Xe(c) : c === A ? A : c._src;
1247
+ return typeof c == "string" ? Ze(c) : c === A ? A : c._src;
1248
1248
  });
1249
1249
  return h.forEach((c, f) => {
1250
1250
  const u = h[f + 1], d = h[f - 1];
@@ -1296,41 +1296,104 @@ y.AST = E;
1296
1296
  y.Minimatch = j;
1297
1297
  y.escape = xe;
1298
1298
  y.unescape = $;
1299
- function Ye() {
1299
+ const Je = [
1300
+ // Images
1301
+ ".jpg",
1302
+ ".jpeg",
1303
+ ".png",
1304
+ ".gif",
1305
+ ".bmp",
1306
+ ".webp",
1307
+ ".svg",
1308
+ ".ico",
1309
+ ".tiff",
1310
+ ".tga",
1311
+ // Audio
1312
+ ".mp3",
1313
+ ".wav",
1314
+ ".ogg",
1315
+ ".flac",
1316
+ ".aac",
1317
+ ".wma",
1318
+ ".m4a",
1319
+ // Video
1320
+ ".mp4",
1321
+ ".avi",
1322
+ ".mov",
1323
+ ".wmv",
1324
+ ".flv",
1325
+ ".webm",
1326
+ ".mkv",
1327
+ ".m4v",
1328
+ // Documents
1329
+ ".pdf",
1330
+ ".doc",
1331
+ ".docx",
1332
+ ".xls",
1333
+ ".xlsx",
1334
+ ".ppt",
1335
+ ".pptx",
1336
+ // Archives
1337
+ ".zip",
1338
+ ".rar",
1339
+ ".7z",
1340
+ ".tar",
1341
+ ".gz",
1342
+ ".bz2",
1343
+ // Executables
1344
+ ".exe",
1345
+ ".dll",
1346
+ ".so",
1347
+ ".dylib",
1348
+ ".bin",
1349
+ // Other binary formats
1350
+ ".dat",
1351
+ ".db",
1352
+ ".sqlite",
1353
+ ".bin",
1354
+ ".obj",
1355
+ ".fbx",
1356
+ ".3ds"
1357
+ ];
1358
+ function G(s) {
1359
+ const t = s.toLowerCase().substring(s.lastIndexOf("."));
1360
+ return Je.includes(t);
1361
+ }
1362
+ function Ke() {
1300
1363
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1301
- throw new Ht();
1364
+ throw new Wt();
1302
1365
  }
1303
- async function Q(s, t, e) {
1366
+ async function tt(s, t, e) {
1304
1367
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/").toLowerCase()}\`, { mode: t }, e) : e();
1305
1368
  }
1306
- function O(s) {
1369
+ function D(s) {
1307
1370
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1308
1371
  }
1309
- function tt(s) {
1372
+ function et(s) {
1310
1373
  return typeof s == "string" ? s ?? "/" : \`/\${s.join("/")}\`;
1311
1374
  }
1312
- function Z(s) {
1313
- const t = O(s);
1375
+ function Y(s) {
1376
+ const t = D(s);
1314
1377
  return t[t.length - 1] || "";
1315
1378
  }
1316
- function G(s) {
1317
- const t = O(s);
1318
- return t.pop(), tt(t);
1379
+ function q(s) {
1380
+ const t = D(s);
1381
+ return t.pop(), et(t);
1319
1382
  }
1320
- function X(s) {
1383
+ function Z(s) {
1321
1384
  return !s || s === "/" ? "/" : s.startsWith("~/") ? \`/\${s.slice(2)}\` : s.startsWith("/") ? s : \`/\${s}\`;
1322
1385
  }
1323
- function Je(s, t = !1) {
1386
+ function Qe(s, t = !1) {
1324
1387
  return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1325
1388
  }
1326
- function q(s, t) {
1389
+ function V(s, t) {
1327
1390
  return y(s, t, {
1328
1391
  dot: !0,
1329
1392
  matchBase: !0
1330
1393
  });
1331
1394
  }
1332
- function Ke(s) {
1333
- const t = X(s), e = O(t), n = [];
1395
+ function ts(s) {
1396
+ const t = Z(s), e = D(t), n = [];
1334
1397
  for (const i of e)
1335
1398
  if (!(i === "." || i === ""))
1336
1399
  if (i === "..") {
@@ -1339,24 +1402,24 @@ function Ke(s) {
1339
1402
  n.pop();
1340
1403
  } else
1341
1404
  n.push(i);
1342
- return tt(n);
1405
+ return et(n);
1343
1406
  }
1344
- function Qe(s, t = "utf-8") {
1345
- return typeof s == "string" ? jt(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1407
+ function es(s, t = "utf-8") {
1408
+ return typeof s == "string" ? Ut(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1346
1409
  }
1347
- async function ts(s, t) {
1348
- return Q(t, "shared", async () => {
1410
+ async function ss(s, t) {
1411
+ return tt(t, "shared", async () => {
1349
1412
  const n = await (await s.getFile()).arrayBuffer();
1350
1413
  return new Uint8Array(n);
1351
1414
  });
1352
1415
  }
1353
- async function lt(s, t, e, n = {}, i) {
1416
+ async function ht(s, t, e, n, i = {}) {
1354
1417
  const r = async () => {
1355
1418
  let o = null;
1356
- const a = n.append || !1, l = !a && (n.truncate ?? !0);
1419
+ const a = i.append || !1, l = !a && (i.truncate ?? !0);
1357
1420
  try {
1358
1421
  o = await s.createSyncAccessHandle();
1359
- const h = Qe(t, e), c = a ? o.getSize() : 0;
1422
+ const h = es(t, e), c = a ? o.getSize() : 0;
1360
1423
  o.write(h, { at: c }), l && o.truncate(h.byteLength), o.flush();
1361
1424
  } catch (h) {
1362
1425
  console.error(h);
@@ -1369,21 +1432,21 @@ async function lt(s, t, e, n = {}, i) {
1369
1432
  }
1370
1433
  }
1371
1434
  };
1372
- return i ? Q(i, "exclusive", r) : r();
1435
+ return n ? tt(n, "exclusive", r) : r();
1373
1436
  }
1374
- async function es(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1437
+ async function ns(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1375
1438
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1376
1439
  throw new Error(\`File size \${s.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1377
1440
  const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1378
1441
  return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1379
1442
  }
1380
- async function ss(s) {
1443
+ async function is(s) {
1381
1444
  const t = await s.arrayBuffer();
1382
1445
  return new Uint8Array(t);
1383
1446
  }
1384
- async function ns(s, t, e = {}) {
1385
- const n = Z(t);
1386
- return Q(t, "exclusive", async () => {
1447
+ async function rs(s, t, e = {}) {
1448
+ const n = Y(t);
1449
+ return tt(t, "exclusive", async () => {
1387
1450
  const i = e.recursive ?? !1, r = e.force ?? !1;
1388
1451
  try {
1389
1452
  await s.removeEntry(n, { recursive: i });
@@ -1395,7 +1458,7 @@ async function ns(s, t, e = {}) {
1395
1458
  }
1396
1459
  });
1397
1460
  }
1398
- class is {
1461
+ class os {
1399
1462
  /** Root directory handle for the file system */
1400
1463
  root = null;
1401
1464
  /** Map of watched paths and options */
@@ -1425,7 +1488,7 @@ class is {
1425
1488
  if (!this.options.broadcastChannel)
1426
1489
  return;
1427
1490
  const e = t.path;
1428
- if (![...this.watchers.values()].some((r) => q(e, r.pattern) && r.include.some((o) => o && q(e, o)) && !r.exclude.some((o) => o && q(e, o))))
1491
+ if (![...this.watchers.values()].some((r) => V(e, r.pattern) && r.include.some((o) => o && V(e, o)) && !r.exclude.some((o) => o && V(e, o))))
1429
1492
  return;
1430
1493
  let i;
1431
1494
  if (this.options.hashAlgorithm)
@@ -1457,7 +1520,7 @@ class is {
1457
1520
  * @throws {OPFSError} If OPFS is not supported in the current browser
1458
1521
  */
1459
1522
  constructor(t) {
1460
- Ye(), t && this.setOptions(t);
1523
+ Ke(), t && this.setOptions(t);
1461
1524
  }
1462
1525
  /**
1463
1526
  * Initialize the file system within a given directory
@@ -1481,7 +1544,7 @@ class is {
1481
1544
  * \`\`\`
1482
1545
  */
1483
1546
  async mount(t = this.options.root) {
1484
- return this.mountingPromise && await this.mountingPromise, t = X(t), this.mountingPromise = new Promise(async (e, n) => {
1547
+ return this.mountingPromise && await this.mountingPromise, t = Z(t), this.mountingPromise = new Promise(async (e, n) => {
1485
1548
  try {
1486
1549
  const i = await navigator.storage.getDirectory();
1487
1550
  t === "/" ? this.root = i : this.root = await this.getDirectoryHandle(t, !0, i), e(!0);
@@ -1524,7 +1587,7 @@ class is {
1524
1587
  * \`\`\`
1525
1588
  */
1526
1589
  async getDirectoryHandle(t, e = !1, n = this.root) {
1527
- const i = Array.isArray(t) ? t : O(t);
1590
+ const i = Array.isArray(t) ? t : D(t);
1528
1591
  let r = n;
1529
1592
  for (const o of i)
1530
1593
  r = await r.getDirectoryHandle(o, { create: e });
@@ -1550,9 +1613,9 @@ class is {
1550
1613
  * \`\`\`
1551
1614
  */
1552
1615
  async getFileHandle(t, e = !1, n = this.root) {
1553
- const i = O(t);
1616
+ const i = D(t);
1554
1617
  if (i.length === 0)
1555
- throw new Wt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1618
+ throw new jt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1556
1619
  const r = i.pop();
1557
1620
  return (await this.getDirectoryHandle(i, e, n)).getFileHandle(r, { create: e });
1558
1621
  }
@@ -1597,11 +1660,11 @@ class is {
1597
1660
  isDirectory: !0
1598
1661
  }), await e("/"), t;
1599
1662
  }
1600
- async readFile(t, e = "utf-8") {
1601
- await this.mount();
1663
+ async readFile(t, e) {
1664
+ await this.mount(), e || (e = G(t) ? "binary" : "utf-8");
1602
1665
  try {
1603
- const n = await this.getFileHandle(t, !1), i = await ts(n, t);
1604
- return e === "binary" ? i : Ut(i, e);
1666
+ const n = await this.getFileHandle(t, !1), i = await ss(n, t);
1667
+ return e === "binary" ? i : _t(i, e);
1605
1668
  } catch (n) {
1606
1669
  throw new _(t, n);
1607
1670
  }
@@ -1634,7 +1697,7 @@ class is {
1634
1697
  async writeFile(t, e, n) {
1635
1698
  await this.mount();
1636
1699
  const i = await this.exists(t), r = await this.getFileHandle(t, !0);
1637
- await lt(r, e, n, {}, t), i ? await this.notifyChange({ path: t, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: t, type: "added", isDirectory: !1 });
1700
+ n || (n = typeof e != "string" || G(t) ? "binary" : "utf-8"), await ht(r, e, n, t), i ? await this.notifyChange({ path: t, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: t, type: "added", isDirectory: !1 });
1638
1701
  }
1639
1702
  /**
1640
1703
  * Append data to a file
@@ -1661,7 +1724,7 @@ class is {
1661
1724
  async appendFile(t, e, n) {
1662
1725
  await this.mount();
1663
1726
  const i = await this.getFileHandle(t, !0);
1664
- await lt(i, e, n, { append: !0 }, t), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1727
+ n || (n = typeof e != "string" || G(t) ? "binary" : "utf-8"), await ht(i, e, n, t, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1665
1728
  }
1666
1729
  /**
1667
1730
  * Create a directory
@@ -1686,7 +1749,7 @@ class is {
1686
1749
  */
1687
1750
  async mkdir(t, e) {
1688
1751
  await this.mount();
1689
- const n = e?.recursive ?? !1, i = O(t);
1752
+ const n = e?.recursive ?? !1, i = D(t);
1690
1753
  let r = this.root;
1691
1754
  for (let o = 0; o < i.length; o++) {
1692
1755
  const a = i[o];
@@ -1694,7 +1757,7 @@ class is {
1694
1757
  r = await r.getDirectoryHandle(a, { create: n || o === i.length - 1 });
1695
1758
  } catch (l) {
1696
1759
  throw l.name === "NotFoundError" ? new g(
1697
- \`Parent directory does not exist: \${tt(i.slice(0, o + 1))}\`,
1760
+ \`Parent directory does not exist: \${et(i.slice(0, o + 1))}\`,
1698
1761
  "ENOENT",
1699
1762
  void 0,
1700
1763
  l
@@ -1735,7 +1798,7 @@ class is {
1735
1798
  isFile: !1,
1736
1799
  isDirectory: !0
1737
1800
  };
1738
- const e = Z(t), n = await this.getDirectoryHandle(G(t), !1), i = this.options.hashAlgorithm !== null;
1801
+ const e = Y(t), n = await this.getDirectoryHandle(q(t), !1), i = this.options.hashAlgorithm !== null;
1739
1802
  try {
1740
1803
  const o = await (await n.getFileHandle(e, { create: !1 })).getFile(), a = {
1741
1804
  kind: "file",
@@ -1747,7 +1810,7 @@ class is {
1747
1810
  };
1748
1811
  if (i && this.options.hashAlgorithm)
1749
1812
  try {
1750
- const l = await es(o, this.options.hashAlgorithm, this.options.maxFileSize);
1813
+ const l = await ns(o, this.options.hashAlgorithm, this.options.maxFileSize);
1751
1814
  a.hash = l;
1752
1815
  } catch (l) {
1753
1816
  console.warn(\`Failed to calculate hash for \${t}:\`, l);
@@ -1819,10 +1882,10 @@ class is {
1819
1882
  async exists(t) {
1820
1883
  if (await this.mount(), t === "/")
1821
1884
  return !0;
1822
- const e = Z(t);
1885
+ const e = Y(t);
1823
1886
  let n = null;
1824
1887
  try {
1825
- n = await this.getDirectoryHandle(G(t), !1);
1888
+ n = await this.getDirectoryHandle(q(t), !1);
1826
1889
  } catch (i) {
1827
1890
  throw (i.name === "NotFoundError" || i.name === "TypeMismatchError") && (n = null), i;
1828
1891
  }
@@ -1901,8 +1964,8 @@ class is {
1901
1964
  async remove(t, e) {
1902
1965
  if (await this.mount(), t === "/")
1903
1966
  throw new g("Cannot remove root directory", "EROOT");
1904
- const n = await this.getDirectoryHandle(G(t), !1);
1905
- await ns(n, t, e), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
1967
+ const n = await this.getDirectoryHandle(q(t), !1);
1968
+ await rs(n, t, e), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
1906
1969
  }
1907
1970
  /**
1908
1971
  * Resolve a path to an absolute path
@@ -1925,7 +1988,7 @@ class is {
1925
1988
  async realpath(t) {
1926
1989
  await this.mount();
1927
1990
  try {
1928
- const e = Ke(t);
1991
+ const e = ts(t);
1929
1992
  if (!await this.exists(e))
1930
1993
  throw new _(e);
1931
1994
  return e;
@@ -2038,7 +2101,7 @@ class is {
2038
2101
  if (!this.options.broadcastChannel)
2039
2102
  throw new g("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.", "ENOENT");
2040
2103
  const n = {
2041
- pattern: Je(t, e?.recursive ?? !0),
2104
+ pattern: Qe(t, e?.recursive ?? !0),
2042
2105
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
2043
2106
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
2044
2107
  };
@@ -2092,17 +2155,17 @@ class is {
2092
2155
  try {
2093
2156
  (e?.cleanBefore ?? !1) && await this.clear("/");
2094
2157
  for (const [i, r] of t) {
2095
- const o = X(i);
2158
+ const o = Z(i);
2096
2159
  let a;
2097
- r instanceof Blob ? a = await ss(r) : a = r, await this.writeFile(o, a);
2160
+ r instanceof Blob ? a = await is(r) : a = r, await this.writeFile(o, a);
2098
2161
  }
2099
2162
  } catch (n) {
2100
2163
  throw n instanceof g ? n : new g("Failed to sync file system", "SYNC_FAILED", void 0, n);
2101
2164
  }
2102
2165
  }
2103
2166
  }
2104
- typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && Y(new is());
2105
- //# sourceMappingURL=worker-3SMz_DAt.js.map
2167
+ typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && J(new os());
2168
+ //# sourceMappingURL=worker-DYhMhDRt.js.map
2106
2169
  `, s = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", r], { type: "text/javascript;charset=utf-8" });
2107
2170
  function o(n) {
2108
2171
  let t;
@@ -2130,36 +2193,38 @@ async function h(n) {
2130
2193
  return n && (n.broadcastChannel && n.broadcastChannel instanceof BroadcastChannel && (n.broadcastChannel = n.broadcastChannel.name), await t.setOptions(n)), t;
2131
2194
  }
2132
2195
  export {
2133
- p as DirectoryNotFoundError,
2134
- f as FileNotFoundError,
2135
- d as OPFSError,
2136
- u as OPFSNotMountedError,
2137
- g as OPFSNotSupportedError,
2138
- m as PathError,
2139
- w as PermissionError,
2140
- y as StorageError,
2141
- b as TimeoutError,
2142
- v as basename,
2196
+ p as BINARY_FILE_EXTENSIONS,
2197
+ f as DirectoryNotFoundError,
2198
+ d as FileNotFoundError,
2199
+ u as OPFSError,
2200
+ g as OPFSNotMountedError,
2201
+ m as OPFSNotSupportedError,
2202
+ w as PathError,
2203
+ y as PermissionError,
2204
+ b as StorageError,
2205
+ v as TimeoutError,
2206
+ x as basename,
2143
2207
  S as buffersEqual,
2144
- x as calculateFileHash,
2145
- E as checkOPFSSupport,
2208
+ E as calculateFileHash,
2209
+ A as checkOPFSSupport,
2146
2210
  P as convertBlobToUint8Array,
2147
- A as createBuffer,
2211
+ F as createBuffer,
2148
2212
  h as createWorker,
2149
- F as decodeBuffer,
2150
- O as dirname,
2151
- C as encodeString,
2152
- T as extname,
2153
- R as isPathExcluded,
2154
- $ as joinPath,
2155
- _ as matchMinimatch,
2156
- D as normalizeMinimatch,
2157
- I as normalizePath,
2213
+ O as decodeBuffer,
2214
+ C as dirname,
2215
+ T as encodeString,
2216
+ R as extname,
2217
+ $ as isBinaryFileExtension,
2218
+ _ as isPathExcluded,
2219
+ D as joinPath,
2220
+ I as matchMinimatch,
2221
+ j as normalizeMinimatch,
2222
+ N as normalizePath,
2158
2223
  M as readFileData,
2159
- j as removeEntry,
2160
- N as resolvePath,
2161
- k as splitPath,
2162
- L as withLock,
2163
- U as writeFileData
2224
+ k as removeEntry,
2225
+ L as resolvePath,
2226
+ z as splitPath,
2227
+ U as withLock,
2228
+ W as writeFileData
2164
2229
  };
2165
2230
  //# sourceMappingURL=index.js.map