@wp-playground/storage 3.0.3 → 3.0.5

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Semaphore as Mt, normalizePath as mt, joinPaths as ge } from "@php-wasm/util";
1
+ import { Semaphore as Mt, normalizePath as yt, joinPaths as ge } from "@php-wasm/util";
2
2
  import { Octokit as be } from "octokit";
3
3
  import xe from "crc-32";
4
4
  import Nt from "pako";
5
- import { StreamedFile as V } from "@php-wasm/stream-compression";
5
+ import { StreamedFile as K } from "@php-wasm/stream-compression";
6
6
  import { ZipReader as kt, BlobReader as Tt, BlobWriter as Ee } from "@zip.js/zip.js";
7
7
  function Dr(i) {
8
8
  return new be({
@@ -251,7 +251,7 @@ function Se(i) {
251
251
  return window.btoa(t.join(""));
252
252
  }
253
253
  async function* Hr(i, t, { exceptPaths: n = [] } = {}) {
254
- if (t = mt(t), !await i.isDir(t)) {
254
+ if (t = yt(t), !await i.isDir(t)) {
255
255
  await i.fileExists(t) && (yield {
256
256
  path: t,
257
257
  read: async () => await i.readFileAsBuffer(t)
@@ -426,7 +426,7 @@ class S {
426
426
  };
427
427
  }
428
428
  }
429
- class Y extends Error {
429
+ class W extends Error {
430
430
  constructor(t) {
431
431
  super(t), this.caller = "";
432
432
  }
@@ -440,14 +440,14 @@ class Y extends Error {
440
440
  };
441
441
  }
442
442
  fromJSON(t) {
443
- const n = new Y(t.message);
443
+ const n = new W(t.message);
444
444
  return n.code = t.code, n.data = t.data, n.caller = t.caller, n.stack = t.stack, n;
445
445
  }
446
446
  get isIsomorphicGitError() {
447
447
  return !0;
448
448
  }
449
449
  }
450
- class _ extends Y {
450
+ class _ extends W {
451
451
  /**
452
452
  * @param {string} message
453
453
  */
@@ -458,15 +458,15 @@ class _ extends Y {
458
458
  }
459
459
  }
460
460
  _.code = "InternalError";
461
- class nt extends Y {
461
+ class rt extends W {
462
462
  /**
463
463
  * @param {string} filepath
464
464
  */
465
465
  constructor(t) {
466
- super(`The filepath "${t}" contains unsafe character sequences`), this.code = this.name = nt.code, this.data = { filepath: t };
466
+ super(`The filepath "${t}" contains unsafe character sequences`), this.code = this.name = rt.code, this.data = { filepath: t };
467
467
  }
468
468
  }
469
- nt.code = "UnsafeFilepathError";
469
+ rt.code = "UnsafeFilepathError";
470
470
  function zt(i, t) {
471
471
  return -(i < t) || +(i > t);
472
472
  }
@@ -512,7 +512,7 @@ function Le(i) {
512
512
  f === "40000" && (f = "040000");
513
513
  const h = Ht(f), a = i.slice(s + 1, c).toString("utf8");
514
514
  if (a.includes("\\") || a.includes("/"))
515
- throw new nt(a);
515
+ throw new rt(a);
516
516
  const d = i.slice(c + 1, c + 21).toString("hex");
517
517
  n = c + 21, t.push({ mode: f, path: a, oid: d, type: h });
518
518
  }
@@ -529,7 +529,7 @@ function Me(i) {
529
529
  function Ne(i) {
530
530
  return !i.oid && i.sha && (i.oid = i.sha), i.mode = Me(i.mode), i.type || (i.type = Ht(i.mode)), i;
531
531
  }
532
- class gt {
532
+ class mt {
533
533
  constructor(t) {
534
534
  if (Buffer.isBuffer(t))
535
535
  this._entries = Le(t);
@@ -540,7 +540,7 @@ class gt {
540
540
  this._entries.sort(Oe);
541
541
  }
542
542
  static from(t) {
543
- return new gt(t);
543
+ return new mt(t);
544
544
  }
545
545
  render() {
546
546
  return this._entries.map((t) => `${t.mode} ${t.type} ${t.oid} ${t.path}`).join(`
@@ -566,7 +566,7 @@ class gt {
566
566
  yield t;
567
567
  }
568
568
  }
569
- function pt({ name: i, email: t, timestamp: n, timezoneOffset: s }) {
569
+ function lt({ name: i, email: t, timestamp: n, timezoneOffset: s }) {
570
570
  return s = Pe(s), `${i} <${t}> ${n} ${s}`;
571
571
  }
572
572
  function Pe(i) {
@@ -587,7 +587,7 @@ function G(i) {
587
587
  return i = i.replace(/\r/g, ""), i = i.replace(/^\n+/, ""), i = i.replace(/\n+$/, "") + `
588
588
  `, i;
589
589
  }
590
- function rt(i) {
590
+ function et(i) {
591
591
  const [, t, n, s, c] = i.match(
592
592
  /^(.*) <(.*)> (.*) (.*)$/
593
593
  );
@@ -605,27 +605,27 @@ function ze(i) {
605
605
  function He(i) {
606
606
  return i === 0 ? i : -i;
607
607
  }
608
- class K {
608
+ class Y {
609
609
  constructor(t) {
610
610
  if (typeof t == "string")
611
611
  this._tag = t;
612
612
  else if (Buffer.isBuffer(t))
613
613
  this._tag = t.toString("utf8");
614
614
  else if (typeof t == "object")
615
- this._tag = K.render(t);
615
+ this._tag = Y.render(t);
616
616
  else
617
617
  throw new _(
618
618
  "invalid type passed to GitAnnotatedTag constructor"
619
619
  );
620
620
  }
621
621
  static from(t) {
622
- return new K(t);
622
+ return new Y(t);
623
623
  }
624
624
  static render(t) {
625
625
  return `object ${t.object}
626
626
  type ${t.type}
627
627
  tag ${t.tag}
628
- tagger ${pt(t.tagger)}
628
+ tagger ${lt(t.tagger)}
629
629
 
630
630
  ${t.message}
631
631
  ${t.gpgsig ? t.gpgsig : ""}`;
@@ -661,7 +661,7 @@ ${t.gpgsig ? t.gpgsig : ""}`;
661
661
  const f = c.slice(0, c.indexOf(" ")), h = c.slice(c.indexOf(" ") + 1);
662
662
  Array.isArray(s[f]) ? s[f].push(h) : s[f] = h;
663
663
  }
664
- return s.tagger && (s.tagger = rt(s.tagger)), s.committer && (s.committer = rt(s.committer)), s;
664
+ return s.tagger && (s.tagger = et(s.tagger)), s.committer && (s.committer = et(s.committer)), s;
665
665
  }
666
666
  withoutSignature() {
667
667
  const t = G(this._tag);
@@ -690,10 +690,10 @@ ${t.gpgsig ? t.gpgsig : ""}`;
690
690
  let { signature: f } = await n({ payload: c, secretKey: s });
691
691
  f = G(f);
692
692
  const h = c + f;
693
- return K.from(h);
693
+ return Y.from(h);
694
694
  }
695
695
  }
696
- function ut(i) {
696
+ function ct(i) {
697
697
  return i.trim().split(`
698
698
  `).map((t) => " " + t).join(`
699
699
  `) + `
@@ -718,7 +718,7 @@ class R {
718
718
  static fromPayloadSignature({ payload: t, signature: n }) {
719
719
  const s = R.justHeaders(t), c = R.justMessage(t), f = G(
720
720
  s + `
721
- gpgsig` + ut(n) + `
721
+ gpgsig` + ct(n) + `
722
722
  ` + c
723
723
  );
724
724
  return new R(f);
@@ -763,7 +763,7 @@ gpgsig` + ut(n) + `
763
763
  const f = c.slice(0, c.indexOf(" ")), h = c.slice(c.indexOf(" ") + 1);
764
764
  Array.isArray(s[f]) ? s[f].push(h) : s[f] = h;
765
765
  }
766
- return s.author && (s.author = rt(s.author)), s.committer && (s.committer = rt(s.committer)), s;
766
+ return s.author && (s.author = et(s.author)), s.committer && (s.committer = et(s.committer)), s;
767
767
  }
768
768
  static renderHeaders(t) {
769
769
  let n = "";
@@ -777,11 +777,11 @@ gpgsig` + ut(n) + `
777
777
  `;
778
778
  }
779
779
  const s = t.author;
780
- n += `author ${pt(s)}
780
+ n += `author ${lt(s)}
781
781
  `;
782
782
  const c = t.committer || t.author;
783
- return n += `committer ${pt(c)}
784
- `, t.gpgsig && (n += "gpgsig" + ut(t.gpgsig)), n;
783
+ return n += `committer ${lt(c)}
784
+ `, t.gpgsig && (n += "gpgsig" + ct(t.gpgsig)), n;
785
785
  }
786
786
  static render(t) {
787
787
  return R.renderHeaders(t) + `
@@ -814,7 +814,7 @@ gpgsig`)), s = t.slice(
814
814
  let { signature: h } = await n({ payload: c, secretKey: s });
815
815
  h = G(h);
816
816
  const d = R.justHeaders(t._commit) + `
817
- gpgsig` + ut(h) + `
817
+ gpgsig` + ct(h) + `
818
818
  ` + f;
819
819
  return R.from(d);
820
820
  }
@@ -838,7 +838,7 @@ class We {
838
838
  };
839
839
  }
840
840
  }
841
- class H {
841
+ class z {
842
842
  constructor(t) {
843
843
  this.buffer = t, this._start = 0;
844
844
  }
@@ -893,7 +893,7 @@ class H {
893
893
  }
894
894
  }
895
895
  function Ye(i, t) {
896
- const n = new H(i), s = Rt(n);
896
+ const n = new z(i), s = Rt(n);
897
897
  if (s !== t.byteLength)
898
898
  throw new _(
899
899
  `applyDelta expected source buffer to be ${s} bytes but the provided buffer was ${t.length} bytes`
@@ -905,7 +905,7 @@ function Ye(i, t) {
905
905
  f = h;
906
906
  else {
907
907
  f = Buffer.alloc(c);
908
- const a = new H(f);
908
+ const a = new z(f);
909
909
  for (a.copy(h); !n.eof(); )
910
910
  a.copy(Dt(n, t));
911
911
  const d = a.tell();
@@ -1003,8 +1003,8 @@ async function Je(i) {
1003
1003
  function Xe(i) {
1004
1004
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
1005
1005
  }
1006
- var dt = { exports: {} };
1007
- typeof Object.create == "function" ? dt.exports = function(t, n) {
1006
+ var pt = { exports: {} };
1007
+ typeof Object.create == "function" ? pt.exports = function(t, n) {
1008
1008
  n && (t.super_ = n, t.prototype = Object.create(n.prototype, {
1009
1009
  constructor: {
1010
1010
  value: t,
@@ -1013,7 +1013,7 @@ typeof Object.create == "function" ? dt.exports = function(t, n) {
1013
1013
  configurable: !0
1014
1014
  }
1015
1015
  }));
1016
- } : dt.exports = function(t, n) {
1016
+ } : pt.exports = function(t, n) {
1017
1017
  if (n) {
1018
1018
  t.super_ = n;
1019
1019
  var s = function() {
@@ -1021,13 +1021,13 @@ typeof Object.create == "function" ? dt.exports = function(t, n) {
1021
1021
  s.prototype = n.prototype, t.prototype = new s(), t.prototype.constructor = t;
1022
1022
  }
1023
1023
  };
1024
- var Ze = dt.exports, wt = { exports: {} }, z = {}, it = {};
1025
- it.byteLength = er;
1026
- it.toByteArray = nr;
1027
- it.fromByteArray = or;
1028
- var M = [], O = [], Qe = typeof Uint8Array < "u" ? Uint8Array : Array, ft = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1029
- for (var W = 0, tr = ft.length; W < tr; ++W)
1030
- M[W] = ft[W], O[ft.charCodeAt(W)] = W;
1024
+ var Ze = pt.exports, dt = { exports: {} }, gt = {}, nt = {};
1025
+ nt.byteLength = er;
1026
+ nt.toByteArray = nr;
1027
+ nt.fromByteArray = or;
1028
+ var M = [], O = [], Qe = typeof Uint8Array < "u" ? Uint8Array : Array, ut = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1029
+ for (var q = 0, tr = ut.length; q < tr; ++q)
1030
+ M[q] = ut[q], O[ut.charCodeAt(q)] = q;
1031
1031
  O[45] = 62;
1032
1032
  O[95] = 63;
1033
1033
  function qt(i) {
@@ -1101,7 +1101,7 @@ bt.write = function(i, t, n, s, c, f) {
1101
1101
  * @license MIT
1102
1102
  */
1103
1103
  (function(i) {
1104
- var t = it, n = bt, s = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
1104
+ var t = nt, n = bt, s = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
1105
1105
  i.Buffer = a, i.SlowBuffer = P, i.INSPECT_MAX_BYTES = 50;
1106
1106
  var c = 2147483647;
1107
1107
  i.kMaxLength = c, a.TYPED_ARRAY_SUPPORT = f(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
@@ -1232,7 +1232,7 @@ bt.write = function(i, t, n, s, c, f) {
1232
1232
  return r.length === 0 || o.copy(r, 0, 0, e), r;
1233
1233
  }
1234
1234
  if (o.length !== void 0)
1235
- return typeof o.length != "number" || ct(o.length) ? h(0) : x(o);
1235
+ return typeof o.length != "number" || at(o.length) ? h(0) : x(o);
1236
1236
  if (o.type === "Buffer" && Array.isArray(o.data))
1237
1237
  return x(o.data);
1238
1238
  }
@@ -1320,7 +1320,7 @@ bt.write = function(i, t, n, s, c, f) {
1320
1320
  return r;
1321
1321
  case "utf8":
1322
1322
  case "utf-8":
1323
- return at(o).length;
1323
+ return ot(o).length;
1324
1324
  case "ucs2":
1325
1325
  case "ucs-2":
1326
1326
  case "utf16le":
@@ -1332,7 +1332,7 @@ bt.write = function(i, t, n, s, c, f) {
1332
1332
  return At(o).length;
1333
1333
  default:
1334
1334
  if (l)
1335
- return u ? -1 : at(o).length;
1335
+ return u ? -1 : ot(o).length;
1336
1336
  e = ("" + e).toLowerCase(), l = !0;
1337
1337
  }
1338
1338
  }
@@ -1423,7 +1423,7 @@ bt.write = function(i, t, n, s, c, f) {
1423
1423
  };
1424
1424
  function xt(o, e, r, u, l) {
1425
1425
  if (o.length === 0) return -1;
1426
- if (typeof r == "string" ? (u = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, ct(r) && (r = l ? 0 : o.length - 1), r < 0 && (r = o.length + r), r >= o.length) {
1426
+ if (typeof r == "string" ? (u = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, at(r) && (r = l ? 0 : o.length - 1), r < 0 && (r = o.length + r), r >= o.length) {
1427
1427
  if (l) return -1;
1428
1428
  r = o.length - 1;
1429
1429
  } else if (r < 0)
@@ -1455,8 +1455,8 @@ bt.write = function(i, t, n, s, c, f) {
1455
1455
  k !== -1 && (v -= v - k), k = -1;
1456
1456
  } else
1457
1457
  for (r + E > w && (r = w - E), v = r; v >= 0; v--) {
1458
- for (var I = !0, et = 0; et < E; et++)
1459
- if (B(o, v + et) !== B(e, et)) {
1458
+ for (var I = !0, tt = 0; tt < E; tt++)
1459
+ if (B(o, v + tt) !== B(e, tt)) {
1460
1460
  I = !1;
1461
1461
  break;
1462
1462
  }
@@ -1479,22 +1479,22 @@ bt.write = function(i, t, n, s, c, f) {
1479
1479
  u > p / 2 && (u = p / 2);
1480
1480
  for (var w = 0; w < u; ++w) {
1481
1481
  var E = parseInt(e.substr(w * 2, 2), 16);
1482
- if (ct(E)) return w;
1482
+ if (at(E)) return w;
1483
1483
  o[r + w] = E;
1484
1484
  }
1485
1485
  return w;
1486
1486
  }
1487
1487
  function ne(o, e, r, u) {
1488
- return tt(at(e, o.length - r), o, r, u);
1488
+ return Q(ot(e, o.length - r), o, r, u);
1489
1489
  }
1490
1490
  function ie(o, e, r, u) {
1491
- return tt(we(e), o, r, u);
1491
+ return Q(we(e), o, r, u);
1492
1492
  }
1493
1493
  function se(o, e, r, u) {
1494
- return tt(At(e), o, r, u);
1494
+ return Q(At(e), o, r, u);
1495
1495
  }
1496
1496
  function oe(o, e, r, u) {
1497
- return tt(ye(e, o.length - r), o, r, u);
1497
+ return Q(ye(e, o.length - r), o, r, u);
1498
1498
  }
1499
1499
  a.prototype.write = function(e, r, u, l) {
1500
1500
  if (r === void 0)
@@ -1798,7 +1798,7 @@ bt.write = function(i, t, n, s, c, f) {
1798
1798
  o = o + "=";
1799
1799
  return o;
1800
1800
  }
1801
- function at(o, e) {
1801
+ function ot(o, e) {
1802
1802
  e = e || 1 / 0;
1803
1803
  for (var r, u = o.length, l = null, p = [], w = 0; w < u; ++w) {
1804
1804
  if (r = o.charCodeAt(w), r > 55295 && r < 57344) {
@@ -1861,7 +1861,7 @@ bt.write = function(i, t, n, s, c, f) {
1861
1861
  function At(o) {
1862
1862
  return t.toByteArray(de(o));
1863
1863
  }
1864
- function tt(o, e, r, u) {
1864
+ function Q(o, e, r, u) {
1865
1865
  for (var l = 0; l < u && !(l + r >= e.length || l >= o.length); ++l)
1866
1866
  e[l + r] = o[l];
1867
1867
  return l;
@@ -1869,7 +1869,7 @@ bt.write = function(i, t, n, s, c, f) {
1869
1869
  function L(o, e) {
1870
1870
  return o instanceof e || o != null && o.constructor != null && o.constructor.name != null && o.constructor.name === e.name;
1871
1871
  }
1872
- function ct(o) {
1872
+ function at(o) {
1873
1873
  return o !== o;
1874
1874
  }
1875
1875
  var me = function() {
@@ -1878,10 +1878,10 @@ bt.write = function(i, t, n, s, c, f) {
1878
1878
  e[u + l] = o[r] + o[l];
1879
1879
  return e;
1880
1880
  }();
1881
- })(z);
1881
+ })(gt);
1882
1882
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1883
1883
  (function(i, t) {
1884
- var n = z, s = n.Buffer;
1884
+ var n = gt, s = n.Buffer;
1885
1885
  function c(h, a) {
1886
1886
  for (var d in h)
1887
1887
  a[d] = h[d];
@@ -1908,12 +1908,12 @@ bt.write = function(i, t, n, s, c, f) {
1908
1908
  throw new TypeError("Argument must be a number");
1909
1909
  return n.SlowBuffer(h);
1910
1910
  };
1911
- })(wt, wt.exports);
1912
- var Wt = wt.exports, Yt = Wt.Buffer;
1913
- function st(i, t) {
1911
+ })(dt, dt.exports);
1912
+ var Wt = dt.exports, Yt = Wt.Buffer;
1913
+ function it(i, t) {
1914
1914
  this._block = Yt.alloc(i), this._finalSize = t, this._blockSize = i, this._len = 0;
1915
1915
  }
1916
- st.prototype.update = function(i, t) {
1916
+ it.prototype.update = function(i, t) {
1917
1917
  typeof i == "string" && (t = t || "utf8", i = Yt.from(i, t));
1918
1918
  for (var n = this._block, s = this._blockSize, c = i.length, f = this._len, h = 0; h < c; ) {
1919
1919
  for (var a = f % s, d = Math.min(c - h, s - a), y = 0; y < d; y++)
@@ -1922,7 +1922,7 @@ st.prototype.update = function(i, t) {
1922
1922
  }
1923
1923
  return this._len += c, this;
1924
1924
  };
1925
- st.prototype.digest = function(i) {
1925
+ it.prototype.digest = function(i) {
1926
1926
  var t = this._len % this._blockSize;
1927
1927
  this._block[t] = 128, this._block.fill(0, t + 1), t >= this._finalSize && (this._update(this._block), this._block.fill(0));
1928
1928
  var n = this._len * 8;
@@ -1936,20 +1936,20 @@ st.prototype.digest = function(i) {
1936
1936
  var f = this._hash();
1937
1937
  return i ? f.toString(i) : f;
1938
1938
  };
1939
- st.prototype._update = function() {
1939
+ it.prototype._update = function() {
1940
1940
  throw new Error("_update must be implemented by subclass");
1941
1941
  };
1942
- var ar = st, cr = Ze, Kt = ar, ur = Wt.Buffer, fr = [
1942
+ var ar = it, cr = Ze, Kt = ar, ur = Wt.Buffer, fr = [
1943
1943
  1518500249,
1944
1944
  1859775393,
1945
1945
  -1894007588,
1946
1946
  -899497514
1947
1947
  ], hr = new Array(80);
1948
- function Q() {
1948
+ function Z() {
1949
1949
  this.init(), this._w = hr, Kt.call(this, 64, 56);
1950
1950
  }
1951
- cr(Q, Kt);
1952
- Q.prototype.init = function() {
1951
+ cr(Z, Kt);
1952
+ Z.prototype.init = function() {
1953
1953
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1954
1954
  };
1955
1955
  function lr(i) {
@@ -1964,7 +1964,7 @@ function dr(i) {
1964
1964
  function wr(i, t, n, s) {
1965
1965
  return i === 0 ? t & n | ~t & s : i === 2 ? t & n | t & s | n & s : t ^ n ^ s;
1966
1966
  }
1967
- Q.prototype._update = function(i) {
1967
+ Z.prototype._update = function(i) {
1968
1968
  for (var t = this._w, n = this._a | 0, s = this._b | 0, c = this._c | 0, f = this._d | 0, h = this._e | 0, a = 0; a < 16; ++a) t[a] = i.readInt32BE(a * 4);
1969
1969
  for (; a < 80; ++a) t[a] = lr(t[a - 3] ^ t[a - 8] ^ t[a - 14] ^ t[a - 16]);
1970
1970
  for (var d = 0; d < 80; ++d) {
@@ -1973,11 +1973,11 @@ Q.prototype._update = function(i) {
1973
1973
  }
1974
1974
  this._a = n + this._a | 0, this._b = s + this._b | 0, this._c = c + this._c | 0, this._d = f + this._d | 0, this._e = h + this._e | 0;
1975
1975
  };
1976
- Q.prototype._hash = function() {
1976
+ Z.prototype._hash = function() {
1977
1977
  var i = ur.allocUnsafe(20);
1978
1978
  return i.writeInt32BE(this._a | 0, 0), i.writeInt32BE(this._b | 0, 4), i.writeInt32BE(this._c | 0, 8), i.writeInt32BE(this._d | 0, 12), i.writeInt32BE(this._e | 0, 16), i;
1979
1979
  };
1980
- var yr = Q;
1980
+ var yr = Z;
1981
1981
  const mr = /* @__PURE__ */ Xe(yr);
1982
1982
  function gr(i) {
1983
1983
  let t = "";
@@ -1985,9 +1985,9 @@ function gr(i) {
1985
1985
  n < 16 && (t += "0"), t += n.toString(16);
1986
1986
  return t;
1987
1987
  }
1988
- let ht = null;
1988
+ let ft = null;
1989
1989
  async function Lt(i) {
1990
- return ht === null && (ht = await xr()), ht ? Vt(i) : br(i);
1990
+ return ft === null && (ft = await xr()), ft ? Vt(i) : br(i);
1991
1991
  }
1992
1992
  function br(i) {
1993
1993
  return new mr().update(i).digest("hex");
@@ -2020,12 +2020,12 @@ function Br(i, t) {
2020
2020
  while (c & 128);
2021
2021
  return n;
2022
2022
  }
2023
- class J {
2023
+ class V {
2024
2024
  constructor(t) {
2025
2025
  Object.assign(this, t), this.offsetCache = {};
2026
2026
  }
2027
2027
  static async fromIdx({ idx: t, getExternalRefDelta: n }) {
2028
- const s = new H(t);
2028
+ const s = new z(t);
2029
2029
  if (s.slice(4).toString("hex") !== "ff744f63")
2030
2030
  return;
2031
2031
  const f = s.readUInt32BE();
@@ -2048,7 +2048,7 @@ class J {
2048
2048
  for (let m = 0; m < h; m++)
2049
2049
  d.set(a[m], s.readUInt32BE());
2050
2050
  const y = s.slice(20).toString("hex");
2051
- return new J({
2051
+ return new V({
2052
2052
  hashes: a,
2053
2053
  crcs: {},
2054
2054
  offsets: d,
@@ -2091,7 +2091,7 @@ class J {
2091
2091
  const P = D + 1 === b.length ? t.byteLength - 20 : b[D + 1], T = f[F], j = xe.buf(t.slice(F, P)) >>> 0;
2092
2092
  T.end = P, T.crc = j;
2093
2093
  }
2094
- const x = new J({
2094
+ const x = new V({
2095
2095
  pack: Promise.resolve(t),
2096
2096
  packfileSha: h,
2097
2097
  crcs: d,
@@ -2129,7 +2129,7 @@ class J {
2129
2129
  t.push(Buffer.from(y, m));
2130
2130
  };
2131
2131
  n("ff744f63", "hex"), n("00000002", "hex");
2132
- const s = new H(Buffer.alloc(256 * 4));
2132
+ const s = new z(Buffer.alloc(256 * 4));
2133
2133
  for (let y = 0; y < 256; y++) {
2134
2134
  let m = 0;
2135
2135
  for (const g of this.hashes)
@@ -2139,11 +2139,11 @@ class J {
2139
2139
  t.push(s.buffer);
2140
2140
  for (const y of this.hashes)
2141
2141
  n(y, "hex");
2142
- const c = new H(Buffer.alloc(this.hashes.length * 4));
2142
+ const c = new z(Buffer.alloc(this.hashes.length * 4));
2143
2143
  for (const y of this.hashes)
2144
2144
  c.writeUInt32BE(this.crcs[y]);
2145
2145
  t.push(c.buffer);
2146
- const f = new H(Buffer.alloc(this.hashes.length * 4));
2146
+ const f = new z(Buffer.alloc(this.hashes.length * 4));
2147
2147
  for (const y of this.hashes)
2148
2148
  f.writeUInt32BE(this.offsets.get(y));
2149
2149
  t.push(f.buffer), n(this.packfileSha, "hex");
@@ -2181,7 +2181,7 @@ class J {
2181
2181
  throw new _(
2182
2182
  "Tried to read from a GitPackIndex with no packfile loaded into memory"
2183
2183
  );
2184
- const s = (await this.pack).slice(t), c = new H(s), f = c.readUInt8(), h = f & 112;
2184
+ const s = (await this.pack).slice(t), c = new z(s), f = c.readUInt8(), h = f & 112;
2185
2185
  let a = n[h];
2186
2186
  if (a === void 0)
2187
2187
  throw new _("Unrecognized type: 0b" + h.toString(2));
@@ -2205,16 +2205,16 @@ class J {
2205
2205
  return g && (b = Buffer.from(Ye(b, g))), this.readDepth > 3 && (this.offsetCache[t] = { type: a, object: b }), { type: a, format: "content", object: b };
2206
2206
  }
2207
2207
  }
2208
- class X extends Y {
2208
+ class J extends W {
2209
2209
  /**
2210
2210
  * @param {string} value
2211
2211
  */
2212
2212
  constructor(t) {
2213
- super(`Expected a 40-char hex object id but saw "${t}".`), this.code = this.name = X.code, this.data = { value: t };
2213
+ super(`Expected a 40-char hex object id but saw "${t}".`), this.code = this.name = J.code, this.data = { value: t };
2214
2214
  }
2215
2215
  }
2216
- X.code = "InvalidOidError";
2217
- class ot extends Y {
2216
+ J.code = "InvalidOidError";
2217
+ class st extends W {
2218
2218
  /**
2219
2219
  * @param {string} oid
2220
2220
  * @param {'blob'|'commit'|'tag'|'tree'} actual
@@ -2224,10 +2224,10 @@ class ot extends Y {
2224
2224
  constructor(t, n, s, c) {
2225
2225
  super(
2226
2226
  `Object ${t} ${c ? `at ${c}` : ""}was anticipated to be a ${s} but it is a ${n}.`
2227
- ), this.code = this.name = ot.code, this.data = { oid: t, actual: n, expected: s, filepath: c };
2227
+ ), this.code = this.name = st.code, this.data = { oid: t, actual: n, expected: s, filepath: c };
2228
2228
  }
2229
2229
  }
2230
- ot.code = "ObjectTypeError";
2230
+ st.code = "ObjectTypeError";
2231
2231
  async function Jt(i, t) {
2232
2232
  const n = jt(i);
2233
2233
  for (; ; ) {
@@ -2236,7 +2236,7 @@ async function Jt(i, t) {
2236
2236
  }
2237
2237
  n.return && n.return();
2238
2238
  }
2239
- async function Z(i) {
2239
+ async function X(i) {
2240
2240
  let t = 0;
2241
2241
  const n = [];
2242
2242
  await Jt(i, (f) => {
@@ -2248,7 +2248,7 @@ async function Z(i) {
2248
2248
  s.set(f, c), c += f.byteLength;
2249
2249
  return s;
2250
2250
  }
2251
- class lt {
2251
+ class ht {
2252
2252
  constructor() {
2253
2253
  this._queue = [];
2254
2254
  }
@@ -2286,7 +2286,7 @@ class lt {
2286
2286
  }
2287
2287
  class vr {
2288
2288
  static demux(t) {
2289
- const n = S.streamReader(t), s = new lt(), c = new lt(), f = new lt(), h = async function() {
2289
+ const n = S.streamReader(t), s = new ht(), c = new ht(), f = new ht(), h = async function() {
2290
2290
  const a = await n();
2291
2291
  if (a === null) return h();
2292
2292
  if (a === !0) {
@@ -2394,10 +2394,10 @@ async function Xt(i) {
2394
2394
  const b = g.toString("utf8").trim();
2395
2395
  if (b.startsWith("shallow")) {
2396
2396
  const x = b.slice(-41).trim();
2397
- x.length !== 40 && m(new X(x)), c.push(x);
2397
+ x.length !== 40 && m(new J(x)), c.push(x);
2398
2398
  } else if (b.startsWith("unshallow")) {
2399
2399
  const x = b.slice(-41).trim();
2400
- x.length !== 40 && m(new X(x)), f.push(x);
2400
+ x.length !== 40 && m(new J(x)), f.push(x);
2401
2401
  } else if (b.startsWith("ACK")) {
2402
2402
  const [, x, U] = b.split(" ");
2403
2403
  h.push({ oid: x, status: U }), U || (d = !0);
@@ -2408,7 +2408,7 @@ async function Xt(i) {
2408
2408
  });
2409
2409
  });
2410
2410
  }
2411
- typeof window < "u" && (window.Buffer = z.Buffer);
2411
+ typeof globalThis.Buffer > "u" && (globalThis.Buffer = gt.Buffer);
2412
2412
  async function Kr(i, t, n) {
2413
2413
  const s = await Qt(i, t), c = await Fr(s, t, n), f = await Ar(
2414
2414
  i,
@@ -2466,8 +2466,8 @@ function Zt(i) {
2466
2466
  }).filter((t) => !!(t != null && t.name));
2467
2467
  }
2468
2468
  async function _r(i, t) {
2469
- const n = z.Buffer.from(
2470
- await Z([
2469
+ const n = Buffer.from(
2470
+ await X([
2471
2471
  S.encode(`command=ls-refs
2472
2472
  `),
2473
2473
  S.encode(`agent=git/2.37.3
@@ -2498,8 +2498,8 @@ async function _r(i, t) {
2498
2498
  return c;
2499
2499
  }
2500
2500
  async function Qt(i, t) {
2501
- const n = z.Buffer.from(
2502
- await Z([
2501
+ const n = Buffer.from(
2502
+ await X([
2503
2503
  S.encode(
2504
2504
  `want ${t} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3 filter
2505
2505
  `
@@ -2524,7 +2524,7 @@ async function Qt(i, t) {
2524
2524
  "Content-Length": `${n.length}`
2525
2525
  },
2526
2526
  body: n
2527
- }), c = ee(s.body), f = await Xt(c), h = z.Buffer.from(await Z(f.packfile)), a = await J.fromPack({
2527
+ }), c = ee(s.body), f = await Xt(c), h = Buffer.from(await X(f.packfile)), a = await V.fromPack({
2528
2528
  pack: h
2529
2529
  }), d = a.read;
2530
2530
  return a.read = async function({ oid: y, ...m }) {
@@ -2536,11 +2536,11 @@ async function Ir(i, t) {
2536
2536
  const n = await i.read({
2537
2537
  oid: t
2538
2538
  });
2539
- q(n);
2539
+ H(n);
2540
2540
  const s = await i.read({ oid: n.object.tree }), c = [s];
2541
2541
  for (; c.length > 0; ) {
2542
2542
  const f = c.pop(), h = await i.read({ oid: f.oid });
2543
- if (q(h), f.object = h.object, h.type === "tree")
2543
+ if (H(h), f.object = h.object, h.type === "tree")
2544
2544
  for (const a of h.object)
2545
2545
  a.type === "tree" && c.push(a);
2546
2546
  }
@@ -2550,9 +2550,9 @@ async function Fr(i, t, n) {
2550
2550
  const s = await i.read({
2551
2551
  oid: t
2552
2552
  });
2553
- q(s);
2553
+ H(s);
2554
2554
  const c = await i.read({ oid: s.object.tree });
2555
- q(c);
2555
+ H(c);
2556
2556
  const f = {};
2557
2557
  for (const h of n) {
2558
2558
  let a = c;
@@ -2564,7 +2564,7 @@ async function Fr(i, t, n) {
2564
2564
  for (const g of a.object)
2565
2565
  if (g.path === y) {
2566
2566
  try {
2567
- a = await i.read({ oid: g.oid }), q(a);
2567
+ a = await i.read({ oid: g.oid }), H(a);
2568
2568
  } catch {
2569
2569
  a = g;
2570
2570
  }
@@ -2579,8 +2579,8 @@ async function Fr(i, t, n) {
2579
2579
  return f;
2580
2580
  }
2581
2581
  async function Ar(i, t) {
2582
- const n = z.Buffer.from(
2583
- await Z([
2582
+ const n = Buffer.from(
2583
+ await X([
2584
2584
  ...t.map(
2585
2585
  (a) => S.encode(
2586
2586
  `want ${a} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3
@@ -2599,40 +2599,40 @@ async function Ar(i, t) {
2599
2599
  "Content-Length": `${n.length}`
2600
2600
  },
2601
2601
  body: n
2602
- }), c = ee(s.body), f = await Xt(c), h = z.Buffer.from(await Z(f.packfile));
2603
- return await J.fromPack({
2602
+ }), c = ee(s.body), f = await Xt(c), h = Buffer.from(await X(f.packfile));
2603
+ return await V.fromPack({
2604
2604
  pack: h
2605
2605
  });
2606
2606
  }
2607
2607
  async function te(i, t) {
2608
2608
  const n = await i.read({ oid: t });
2609
- if (q(n), n.type === "blob")
2609
+ if (H(n), n.type === "blob")
2610
2610
  return n.object;
2611
2611
  const s = {};
2612
2612
  for (const { path: c, oid: f, type: h } of n.object)
2613
2613
  if (h === "blob") {
2614
2614
  const a = await i.read({ oid: f });
2615
- q(a), s[c] = a.object;
2615
+ H(a), s[c] = a.object;
2616
2616
  } else h === "tree" && (s[c] = await te(i, f));
2617
2617
  return s;
2618
2618
  }
2619
- function q(i) {
2620
- if (i.object instanceof z.Buffer)
2619
+ function H(i) {
2620
+ if (i.object instanceof Buffer)
2621
2621
  switch (i.type) {
2622
2622
  case "commit":
2623
2623
  i.object = R.from(i.object).parse();
2624
2624
  break;
2625
2625
  case "tree":
2626
- i.object = gt.from(i.object).entries();
2626
+ i.object = mt.from(i.object).entries();
2627
2627
  break;
2628
2628
  case "blob":
2629
2629
  i.object = new Uint8Array(i.object), i.format = "content";
2630
2630
  break;
2631
2631
  case "tag":
2632
- i.object = K.from(i.object).parse();
2632
+ i.object = Y.from(i.object).parse();
2633
2633
  break;
2634
2634
  default:
2635
- throw new ot(
2635
+ throw new st(
2636
2636
  i.oid,
2637
2637
  i.type,
2638
2638
  "blob|commit|tag|tree"
@@ -2666,7 +2666,7 @@ function ee(i) {
2666
2666
  };
2667
2667
  }
2668
2668
  function Xr(i, t) {
2669
- t = mt(t);
2669
+ t = yt(t);
2670
2670
  const n = ["", ".", "/"].includes(t);
2671
2671
  let s = i;
2672
2672
  if (n)
@@ -2713,7 +2713,7 @@ class Qr {
2713
2713
  c.enqueue(n), c.close();
2714
2714
  }
2715
2715
  });
2716
- return new V(s, t, {
2716
+ return new K(s, t, {
2717
2717
  filesize: n.byteLength
2718
2718
  });
2719
2719
  }
@@ -2730,25 +2730,25 @@ class Qr {
2730
2730
  throw new Error(`File not found at ${t}`);
2731
2731
  }
2732
2732
  }
2733
- class yt {
2733
+ class wt {
2734
2734
  constructor(t) {
2735
2735
  this.entries = /* @__PURE__ */ new Map(), this.zipReader = t;
2736
2736
  }
2737
2737
  static fromStream(t) {
2738
2738
  const n = new kt(
2739
- new Tt(new V(t, "archive.zip"))
2739
+ new Tt(new K(t, "archive.zip"))
2740
2740
  );
2741
- return new yt(n);
2741
+ return new wt(n);
2742
2742
  }
2743
2743
  static fromArrayBuffer(t) {
2744
2744
  const n = new kt(
2745
2745
  new Tt(new Blob([t]))
2746
2746
  );
2747
- return new yt(n);
2747
+ return new wt(n);
2748
2748
  }
2749
2749
  async read(t) {
2750
2750
  const n = await this.getEntry(t), s = await n.getData(new Ee());
2751
- return new V(s.stream(), t, {
2751
+ return new K(s.stream(), t, {
2752
2752
  filesize: n.uncompressedSize
2753
2753
  });
2754
2754
  }
@@ -2823,7 +2823,7 @@ class en {
2823
2823
  throw new Error(
2824
2824
  "FetchFilesystem cannot fetch files from data URLs"
2825
2825
  );
2826
- t = mt(t);
2826
+ t = yt(t);
2827
2827
  const n = t.replace(/^\//, ""), s = new URL(n, this.baseUrl).toString();
2828
2828
  if (!s.startsWith(this.baseUrl))
2829
2829
  throw new Error(
@@ -2835,7 +2835,7 @@ class en {
2835
2835
  `Failed to fetch file at ${t}: ${f.statusText}`
2836
2836
  );
2837
2837
  const h = f.headers.get("content-length") ? parseInt(f.headers.get("content-length"), 10) : void 0;
2838
- return new V(f.body, t, { filesize: h });
2838
+ return new K(f.body, t, { filesize: h });
2839
2839
  }
2840
2840
  }
2841
2841
  class rn {
@@ -2874,7 +2874,7 @@ class rn {
2874
2874
  `Failed to read file at ${t}: ${h.message}`
2875
2875
  )
2876
2876
  ) : n(
2877
- new V(
2877
+ new K(
2878
2878
  Ur(f),
2879
2879
  t,
2880
2880
  {
@@ -2898,7 +2898,7 @@ export {
2898
2898
  Qr as InMemoryFilesystem,
2899
2899
  rn as NodeJsFilesystem,
2900
2900
  tn as OverlayFilesystem,
2901
- yt as ZipFilesystem,
2901
+ wt as ZipFilesystem,
2902
2902
  qr as changeset,
2903
2903
  Yr as clearContentsFromMountDevice,
2904
2904
  Dr as createClient,