@uipath/filesystem 0.1.7 → 0.2.0

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 (2) hide show
  1. package/dist/index.browser.js +1011 -804
  2. package/package.json +5 -6
@@ -300,13 +300,13 @@ function fromByteArray(uint82) {
300
300
  tmp = (uint82[len2 - 2] << 8) + uint82[len2 - 1], parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
301
301
  return parts.join("");
302
302
  }
303
- function read(buffer, offset, isLE, mLen, nBytes) {
304
- var e, m, eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i2 = isLE ? nBytes - 1 : 0, d = isLE ? -1 : 1, s = buffer[offset + i2];
303
+ function read(buffer2, offset, isLE, mLen, nBytes) {
304
+ var e, m, eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i2 = isLE ? nBytes - 1 : 0, d = isLE ? -1 : 1, s = buffer2[offset + i2];
305
305
  i2 += d, e = s & (1 << -nBits) - 1, s >>= -nBits, nBits += eLen;
306
- for (;nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8)
306
+ for (;nBits > 0; e = e * 256 + buffer2[offset + i2], i2 += d, nBits -= 8)
307
307
  ;
308
308
  m = e & (1 << -nBits) - 1, e >>= -nBits, nBits += mLen;
309
- for (;nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8)
309
+ for (;nBits > 0; m = m * 256 + buffer2[offset + i2], i2 += d, nBits -= 8)
310
310
  ;
311
311
  if (e === 0)
312
312
  e = 1 - eBias;
@@ -316,7 +316,7 @@ function read(buffer, offset, isLE, mLen, nBytes) {
316
316
  m = m + Math.pow(2, mLen), e = e - eBias;
317
317
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
318
318
  }
319
- function write(buffer, value, offset, isLE, mLen, nBytes) {
319
+ function write(buffer2, value, offset, isLE, mLen, nBytes) {
320
320
  var e, m, c, eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, i2 = isLE ? 0 : nBytes - 1, d = isLE ? 1 : -1, s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
321
321
  if (value = Math.abs(value), isNaN(value) || value === 1 / 0)
322
322
  m = isNaN(value) ? 1 : 0, e = eMax;
@@ -336,12 +336,12 @@ function write(buffer, value, offset, isLE, mLen, nBytes) {
336
336
  else
337
337
  m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen), e = 0;
338
338
  }
339
- for (;mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8)
339
+ for (;mLen >= 8; buffer2[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8)
340
340
  ;
341
341
  e = e << mLen | m, eLen += mLen;
342
- for (;eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8)
342
+ for (;eLen > 0; buffer2[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8)
343
343
  ;
344
- buffer[offset + i2 - d] |= s * 128;
344
+ buffer2[offset + i2 - d] |= s * 128;
345
345
  }
346
346
  function createBuffer(length) {
347
347
  if (length > kMaxLength)
@@ -423,10 +423,10 @@ function fromString(string2, encoding) {
423
423
  buf = buf.slice(0, actual);
424
424
  return buf;
425
425
  }
426
- function fromArrayLike(array3) {
427
- let length = array3.length < 0 ? 0 : checked(array3.length) | 0, buf = createBuffer(length);
426
+ function fromArrayLike(array4) {
427
+ let length = array4.length < 0 ? 0 : checked(array4.length) | 0, buf = createBuffer(length);
428
428
  for (let i2 = 0;i2 < length; i2 += 1)
429
- buf[i2] = array3[i2] & 255;
429
+ buf[i2] = array4[i2] & 255;
430
430
  return buf;
431
431
  }
432
432
  function fromArrayView(arrayView) {
@@ -436,18 +436,18 @@ function fromArrayView(arrayView) {
436
436
  }
437
437
  return fromArrayLike(arrayView);
438
438
  }
439
- function fromArrayBuffer(array3, byteOffset, length) {
440
- if (byteOffset < 0 || array3.byteLength < byteOffset)
439
+ function fromArrayBuffer(array4, byteOffset, length) {
440
+ if (byteOffset < 0 || array4.byteLength < byteOffset)
441
441
  throw RangeError('"offset" is outside of buffer bounds');
442
- if (array3.byteLength < byteOffset + (length || 0))
442
+ if (array4.byteLength < byteOffset + (length || 0))
443
443
  throw RangeError('"length" is outside of buffer bounds');
444
444
  let buf;
445
445
  if (byteOffset === undefined && length === undefined)
446
- buf = new Uint8Array(array3);
446
+ buf = new Uint8Array(array4);
447
447
  else if (length === undefined)
448
- buf = new Uint8Array(array3, byteOffset);
448
+ buf = new Uint8Array(array4, byteOffset);
449
449
  else
450
- buf = new Uint8Array(array3, byteOffset, length);
450
+ buf = new Uint8Array(array4, byteOffset, length);
451
451
  return Object.setPrototypeOf(buf, Buffer.prototype), buf;
452
452
  }
453
453
  function fromObject(obj) {
@@ -548,8 +548,8 @@ function swap(b, n, m) {
548
548
  let i2 = b[n];
549
549
  b[n] = b[m], b[m] = i2;
550
550
  }
551
- function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
552
- if (buffer.length === 0)
551
+ function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
552
+ if (buffer2.length === 0)
553
553
  return -1;
554
554
  if (typeof byteOffset === "string")
555
555
  encoding = byteOffset, byteOffset = 0;
@@ -558,14 +558,14 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
558
558
  else if (byteOffset < -2147483648)
559
559
  byteOffset = -2147483648;
560
560
  if (byteOffset = +byteOffset, Number.isNaN(byteOffset))
561
- byteOffset = dir ? 0 : buffer.length - 1;
561
+ byteOffset = dir ? 0 : buffer2.length - 1;
562
562
  if (byteOffset < 0)
563
- byteOffset = buffer.length + byteOffset;
564
- if (byteOffset >= buffer.length)
563
+ byteOffset = buffer2.length + byteOffset;
564
+ if (byteOffset >= buffer2.length)
565
565
  if (dir)
566
566
  return -1;
567
567
  else
568
- byteOffset = buffer.length - 1;
568
+ byteOffset = buffer2.length - 1;
569
569
  else if (byteOffset < 0)
570
570
  if (dir)
571
571
  byteOffset = 0;
@@ -576,14 +576,14 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
576
576
  if (Buffer.isBuffer(val)) {
577
577
  if (val.length === 0)
578
578
  return -1;
579
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
579
+ return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
580
580
  } else if (typeof val === "number") {
581
581
  if (val = val & 255, typeof Uint8Array.prototype.indexOf === "function")
582
582
  if (dir)
583
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
583
+ return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
584
584
  else
585
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
586
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
585
+ return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
586
+ return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
587
587
  }
588
588
  throw TypeError("val must be string, number or Buffer");
589
589
  }
@@ -1041,23 +1041,23 @@ var init_buffer = __esm(() => {
1041
1041
  for (i2 = 0;i2 < list2.length; ++i2)
1042
1042
  length += list2[i2].length;
1043
1043
  }
1044
- let buffer = Buffer.allocUnsafe(length), pos = 0;
1044
+ let buffer2 = Buffer.allocUnsafe(length), pos = 0;
1045
1045
  for (i2 = 0;i2 < list2.length; ++i2) {
1046
1046
  let buf = list2[i2];
1047
1047
  if (isInstance(buf, Uint8Array))
1048
- if (pos + buf.length > buffer.length) {
1048
+ if (pos + buf.length > buffer2.length) {
1049
1049
  if (!Buffer.isBuffer(buf))
1050
1050
  buf = Buffer.from(buf);
1051
- buf.copy(buffer, pos);
1051
+ buf.copy(buffer2, pos);
1052
1052
  } else
1053
- Uint8Array.prototype.set.call(buffer, buf, pos);
1053
+ Uint8Array.prototype.set.call(buffer2, buf, pos);
1054
1054
  else if (!Buffer.isBuffer(buf))
1055
1055
  throw TypeError('"list" argument must be an Array of Buffers');
1056
1056
  else
1057
- buf.copy(buffer, pos);
1057
+ buf.copy(buffer2, pos);
1058
1058
  pos += buf.length;
1059
1059
  }
1060
- return buffer;
1060
+ return buffer2;
1061
1061
  };
1062
1062
  Buffer.byteLength = byteLength;
1063
1063
  Buffer.prototype._isBuffer = true;
@@ -2699,9 +2699,9 @@ var require_validators = __commonJS((exports, module) => {
2699
2699
  throw new ERR_UNKNOWN_SIGNAL(signal);
2700
2700
  }
2701
2701
  }
2702
- var validateBuffer = hideStackFrames((buffer, name = "buffer") => {
2703
- if (!isArrayBufferView(buffer)) {
2704
- throw new ERR_INVALID_ARG_TYPE3(name, ["Buffer", "TypedArray", "DataView"], buffer);
2702
+ var validateBuffer = hideStackFrames((buffer2, name = "buffer") => {
2703
+ if (!isArrayBufferView(buffer2)) {
2704
+ throw new ERR_INVALID_ARG_TYPE3(name, ["Buffer", "TypedArray", "DataView"], buffer2);
2705
2705
  }
2706
2706
  });
2707
2707
  function validateEncoding(data, encoding) {
@@ -2916,9 +2916,9 @@ var require_browser2 = __commonJS((exports, module) => {
2916
2916
  runTimeout(drainQueue);
2917
2917
  }
2918
2918
  };
2919
- function Item(fun, array3) {
2919
+ function Item(fun, array4) {
2920
2920
  this.fun = fun;
2921
- this.array = array3;
2921
+ this.array = array4;
2922
2922
  }
2923
2923
  Item.prototype.run = function() {
2924
2924
  this.fun.apply(null, this.array);
@@ -4021,17 +4021,17 @@ var require_state = __commonJS((exports, module) => {
4021
4021
  // ../../node_modules/@zenfs/core/node_modules/readable-stream/node_modules/string_decoder/node_modules/safe-buffer/index.js
4022
4022
  var require_safe_buffer = __commonJS((exports, module) => {
4023
4023
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4024
- var buffer = (init_buffer(), __toCommonJS(exports_buffer));
4025
- var Buffer2 = buffer.Buffer;
4024
+ var buffer2 = (init_buffer(), __toCommonJS(exports_buffer));
4025
+ var Buffer2 = buffer2.Buffer;
4026
4026
  function copyProps(src, dst) {
4027
4027
  for (var key in src) {
4028
4028
  dst[key] = src[key];
4029
4029
  }
4030
4030
  }
4031
4031
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
4032
- module.exports = buffer;
4032
+ module.exports = buffer2;
4033
4033
  } else {
4034
- copyProps(buffer, exports);
4034
+ copyProps(buffer2, exports);
4035
4035
  exports.Buffer = SafeBuffer;
4036
4036
  }
4037
4037
  function SafeBuffer(arg, encodingOrOffset, length) {
@@ -4071,7 +4071,7 @@ var require_safe_buffer = __commonJS((exports, module) => {
4071
4071
  if (typeof size !== "number") {
4072
4072
  throw new TypeError("Argument must be a number");
4073
4073
  }
4074
- return buffer.SlowBuffer(size);
4074
+ return buffer2.SlowBuffer(size);
4075
4075
  };
4076
4076
  });
4077
4077
 
@@ -4680,14 +4680,14 @@ var require_readable = __commonJS((exports, module) => {
4680
4680
  const decoder2 = new StringDecoder(enc);
4681
4681
  this._readableState.decoder = decoder2;
4682
4682
  this._readableState.encoding = this._readableState.decoder.encoding;
4683
- const buffer = this._readableState.buffer;
4683
+ const buffer2 = this._readableState.buffer;
4684
4684
  let content = "";
4685
- for (const data of buffer) {
4685
+ for (const data of buffer2) {
4686
4686
  content += decoder2.write(data);
4687
4687
  }
4688
- buffer.clear();
4688
+ buffer2.clear();
4689
4689
  if (content !== "")
4690
- buffer.push(content);
4690
+ buffer2.push(content);
4691
4691
  this._readableState.length = content.length;
4692
4692
  return this;
4693
4693
  };
@@ -7753,7 +7753,219 @@ var require_browser3 = __commonJS((exports, module) => {
7753
7753
  module.exports.Stream = CustomStream.Stream;
7754
7754
  module.exports.default = module.exports;
7755
7755
  });
7756
-
7756
+ // ../../node_modules/utilium/dist/buffer.js
7757
+ function extendBuffer(buffer, newByteLength) {
7758
+ if (buffer.byteLength >= newByteLength)
7759
+ return buffer;
7760
+ if (ArrayBuffer.isView(buffer)) {
7761
+ const newBuffer = extendBuffer(buffer.buffer, newByteLength);
7762
+ return new buffer.constructor(newBuffer, buffer.byteOffset, newByteLength);
7763
+ }
7764
+ const isShared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
7765
+ if (buffer.maxByteLength > newByteLength) {
7766
+ isShared ? buffer.grow(newByteLength) : buffer.resize(newByteLength);
7767
+ return buffer;
7768
+ }
7769
+ if (isShared) {
7770
+ const newBuffer = new SharedArrayBuffer(newByteLength);
7771
+ new Uint8Array(newBuffer).set(new Uint8Array(buffer));
7772
+ return newBuffer;
7773
+ }
7774
+ try {
7775
+ return buffer.transfer(newByteLength);
7776
+ } catch {
7777
+ const newBuffer = new ArrayBuffer(newByteLength);
7778
+ new Uint8Array(newBuffer).set(new Uint8Array(buffer));
7779
+ return newBuffer;
7780
+ }
7781
+ }
7782
+ class BufferView extends DataView {
7783
+ constructor(_buffer, _byteOffset, _byteLength) {
7784
+ const { buffer, byteOffset, byteLength } = new Uint8Array(_buffer, _byteOffset, _byteLength);
7785
+ super(buffer, byteOffset, byteLength);
7786
+ }
7787
+ }
7788
+ for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
7789
+ if (!key.startsWith("get") && !key.startsWith("set"))
7790
+ continue;
7791
+ Object.defineProperty(BufferView.prototype, key, {
7792
+ value: () => {
7793
+ throw new ReferenceError("Do not use DataView methods on a BufferView.");
7794
+ },
7795
+ writable: false,
7796
+ enumerable: false,
7797
+ configurable: false
7798
+ });
7799
+ }
7800
+ // ../../node_modules/utilium/dist/cache.js
7801
+ class Resource {
7802
+ id;
7803
+ _size;
7804
+ options;
7805
+ regions = [];
7806
+ get size() {
7807
+ return this._size;
7808
+ }
7809
+ set size(value) {
7810
+ if (value >= this._size) {
7811
+ this._size = value;
7812
+ return;
7813
+ }
7814
+ this._size = value;
7815
+ for (let i = this.regions.length - 1;i >= 0; i--) {
7816
+ const region = this.regions[i];
7817
+ if (region.offset >= value) {
7818
+ this.regions.splice(i, 1);
7819
+ continue;
7820
+ }
7821
+ const maxLength = value - region.offset;
7822
+ if (region.data.byteLength > maxLength) {
7823
+ region.data = region.data.subarray(0, maxLength);
7824
+ }
7825
+ region.ranges = region.ranges.filter((range) => range.start < value).map((range) => {
7826
+ if (range.end > value) {
7827
+ return { start: range.start, end: value };
7828
+ }
7829
+ return range;
7830
+ });
7831
+ }
7832
+ }
7833
+ constructor(id, _size, options, resources) {
7834
+ this.id = id;
7835
+ this._size = _size;
7836
+ this.options = options;
7837
+ options.sparse ??= true;
7838
+ if (!options.sparse)
7839
+ this.regions.push({ offset: 0, data: new Uint8Array(_size), ranges: [] });
7840
+ resources?.set(id, this);
7841
+ }
7842
+ collect() {
7843
+ if (!this.options.sparse)
7844
+ return;
7845
+ const { regionGapThreshold = 4095 } = this.options;
7846
+ for (let i = 0;i < this.regions.length - 1; ) {
7847
+ const current = this.regions[i];
7848
+ const next = this.regions[i + 1];
7849
+ if (next.offset - (current.offset + current.data.byteLength) > regionGapThreshold) {
7850
+ i++;
7851
+ continue;
7852
+ }
7853
+ current.ranges.push(...next.ranges);
7854
+ current.ranges.sort((a, b) => a.start - b.start);
7855
+ current.ranges = current.ranges.reduce((acc, range) => {
7856
+ if (!acc.length || acc.at(-1).end < range.start) {
7857
+ acc.push(range);
7858
+ } else {
7859
+ acc.at(-1).end = Math.max(acc.at(-1).end, range.end);
7860
+ }
7861
+ return acc;
7862
+ }, []);
7863
+ current.data = extendBuffer(current.data, next.offset + next.data.byteLength);
7864
+ current.data.set(next.data, next.offset - current.offset);
7865
+ this.regions.splice(i + 1, 1);
7866
+ }
7867
+ }
7868
+ missing(start, end) {
7869
+ const missingRanges = [];
7870
+ for (const region of this.regions) {
7871
+ if (region.offset >= end)
7872
+ break;
7873
+ for (const range of region.ranges) {
7874
+ if (range.end <= start)
7875
+ continue;
7876
+ if (range.start >= end)
7877
+ break;
7878
+ if (range.start > start) {
7879
+ missingRanges.push({ start, end: Math.min(range.start, end) });
7880
+ }
7881
+ if (range.end > start)
7882
+ start = Math.max(start, range.end);
7883
+ if (start >= end)
7884
+ break;
7885
+ }
7886
+ if (start >= end)
7887
+ break;
7888
+ }
7889
+ if (start < end)
7890
+ missingRanges.push({ start, end });
7891
+ return missingRanges;
7892
+ }
7893
+ cached(start, end) {
7894
+ const cachedRanges = [];
7895
+ for (const region of this.regions) {
7896
+ if (region.offset >= end)
7897
+ break;
7898
+ for (const range of region.ranges) {
7899
+ if (range.end <= start)
7900
+ continue;
7901
+ if (range.start >= end)
7902
+ break;
7903
+ cachedRanges.push({
7904
+ start: Math.max(start, range.start),
7905
+ end: Math.min(end, range.end)
7906
+ });
7907
+ }
7908
+ }
7909
+ cachedRanges.sort((a, b) => a.start - b.start);
7910
+ const merged = [];
7911
+ for (const curr of cachedRanges) {
7912
+ const last = merged.at(-1);
7913
+ if (last && curr.start <= last.end) {
7914
+ last.end = Math.max(last.end, curr.end);
7915
+ } else {
7916
+ merged.push(curr);
7917
+ }
7918
+ }
7919
+ return merged;
7920
+ }
7921
+ regionAt(offset) {
7922
+ if (!this.regions.length)
7923
+ return;
7924
+ for (const region of this.regions) {
7925
+ if (region.offset > offset)
7926
+ break;
7927
+ if (offset >= region.offset && offset < region.offset + region.data.byteLength)
7928
+ return region;
7929
+ }
7930
+ }
7931
+ add(data, offset) {
7932
+ const end = offset + data.byteLength;
7933
+ const region = this.regionAt(offset);
7934
+ if (region) {
7935
+ region.data = extendBuffer(region.data, end);
7936
+ region.data.set(data, offset);
7937
+ region.ranges.push({ start: offset, end });
7938
+ region.ranges.sort((a, b) => a.start - b.start);
7939
+ this.collect();
7940
+ return this;
7941
+ }
7942
+ const newRegion = { data, offset, ranges: [{ start: offset, end }] };
7943
+ const insertIndex = this.regions.findIndex((region2) => region2.offset > offset);
7944
+ if (insertIndex == -1) {
7945
+ this.regions.push(newRegion);
7946
+ } else {
7947
+ this.regions.splice(insertIndex, 0, newRegion);
7948
+ }
7949
+ this.collect();
7950
+ return this;
7951
+ }
7952
+ }
7953
+ // ../../node_modules/utilium/dist/checksum.js
7954
+ var crc32cTable = new Uint32Array(256);
7955
+ for (let i = 0;i < 256; i++) {
7956
+ let value = i;
7957
+ for (let j = 0;j < 8; j++) {
7958
+ value = value & 1 ? 2197175160 ^ value >>> 1 : value >>> 1;
7959
+ }
7960
+ crc32cTable[i] = value;
7961
+ }
7962
+ function crc32c(data) {
7963
+ let crc = 4294967295;
7964
+ for (let i = 0;i < data.length; i++) {
7965
+ crc = crc >>> 8 ^ crc32cTable[(crc ^ data[i]) & 255];
7966
+ }
7967
+ return (crc ^ 4294967295) >>> 0;
7968
+ }
7757
7969
  // ../../node_modules/eventemitter3/index.mjs
7758
7970
  var import__ = __toESM(require_eventemitter3(), 1);
7759
7971
 
@@ -8639,80 +8851,14 @@ var S_IXOTH = 1;
8639
8851
  var UV_FS_O_FILEMAP = 0;
8640
8852
  var size_max = 4294967295;
8641
8853
 
8642
- // ../../node_modules/memium/dist/array.js
8643
- function StructArray(type) {
8644
- class StructArray2 extends DataView {
8645
- length;
8646
- type = type;
8647
- *[Symbol.iterator]() {
8648
- for (let i = 0;i < this.length; i++)
8649
- yield this[i];
8650
- }
8651
- constructor(lengthOrBuffer, byteOffset, byteLength) {
8652
- const buffer = typeof lengthOrBuffer === "object" ? lengthOrBuffer : new ArrayBuffer((lengthOrBuffer ?? 0) * type.size);
8653
- super(buffer, byteOffset, byteLength);
8654
- this.length = typeof lengthOrBuffer === "number" ? lengthOrBuffer : Math.floor(this.byteLength / type.size);
8655
- return new Proxy(this, {
8656
- get(target, index) {
8657
- if (index in target)
8658
- return target[index];
8659
- const i = parseInt(index.toString());
8660
- if (!Number.isSafeInteger(i))
8661
- throw withErrno("EINVAL", "Invalid index: " + index.toString());
8662
- return type.get(target.buffer, target.byteOffset + i * type.size);
8663
- },
8664
- set(target, index, value) {
8665
- const i = parseInt(index.toString());
8666
- if (!Number.isSafeInteger(i))
8667
- throw withErrno("EINVAL", "Invalid index: " + index.toString());
8668
- type.set(target.buffer, target.byteOffset + i * type.size, value);
8669
- return true;
8670
- }
8671
- });
8672
- }
8673
- }
8674
- for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
8675
- if (!key.startsWith("get") && !key.startsWith("set"))
8676
- continue;
8677
- Object.defineProperty(StructArray2.prototype, key, {
8678
- enumerable: false,
8679
- configurable: false,
8680
- writable: false,
8681
- value: undefined
8682
- });
8683
- }
8684
- return StructArray2;
8854
+ // ../../node_modules/memium/dist/types.js
8855
+ function isArrayType(type) {
8856
+ return "__isArrayType" in type && type.__isArrayType === true;
8685
8857
  }
8686
-
8687
- class ArrayType {
8688
- type;
8689
- length;
8690
- name;
8691
- size;
8692
- __arrayType;
8693
- constructor(type, length) {
8694
- this.type = type;
8695
- this.length = length;
8696
- this.name = `${type.name}[${length}]`;
8697
- this.size = type.size * length;
8698
- this.array = StructArray(this);
8699
- this.__arrayType = type.array ? type.array : StructArray(type);
8700
- }
8701
- get = (buffer, offset) => {
8702
- return new this.__arrayType(buffer, offset, this.size);
8703
- };
8704
- set = (buffer, offset, value) => {
8705
- for (let i = 0;i < this.length; i++) {
8706
- this.type.set(buffer, offset + i * this.type.size, value[i]);
8707
- }
8708
- };
8709
- array;
8710
- }
8711
- // ../../node_modules/memium/dist/types.js
8712
8858
  function isType(type) {
8713
8859
  if (typeof type != "object" && typeof type != "function" || type === null || type === undefined)
8714
8860
  return false;
8715
- if (type instanceof ArrayType)
8861
+ if (isArrayType(type))
8716
8862
  return isType(type.type);
8717
8863
  return "name" in type && "size" in type && "get" in type && "set" in type && typeof type.name == "string" && typeof type.size == "number" && typeof type.get == "function" && typeof type.set == "function" && typeRegistry.has(type.name) && typeRegistry.get(type.name)?.name === type.name;
8718
8864
  }
@@ -8723,168 +8869,81 @@ function registerType(t) {
8723
8869
  typeRegistry.set(t.name, t);
8724
8870
  }
8725
8871
 
8726
- // ../../node_modules/memium/dist/fields.js
8727
- function parseFieldConfig(init) {
8728
- if (isType(init))
8729
- return { type: init };
8730
- if (init instanceof FieldBuilder)
8731
- return init.toInit();
8732
- return init;
8733
- }
8734
-
8735
- class FieldBuilder {
8736
- type;
8737
- init;
8738
- constructor(type, init) {
8739
- this.type = type;
8740
- this.init = init;
8741
- const _toArray = (length) => {
8742
- return new FieldBuilder(new ArrayType(type, length), init);
8743
- };
8744
- Object.setPrototypeOf(_toArray, new.target.prototype);
8745
- Object.assign(_toArray, { type, init });
8746
- return _toArray;
8747
- }
8748
- align(align) {
8749
- return new FieldBuilder(this.type, { ...this.init, align });
8750
- }
8751
- countedBy(field) {
8752
- return new FieldBuilder(this.type, { ...this.init, countedBy: field });
8753
- }
8754
- bigEndian() {
8755
- return new FieldBuilder(this.type, { ...this.init, bigEndian: true });
8756
- }
8757
- toInit() {
8758
- return { type: this.type, ...this.init };
8759
- }
8760
- $type() {
8761
- return new FieldBuilder(this.type, this.init);
8762
- }
8763
- }
8764
- function array(type, length = 0) {
8765
- return new FieldBuilder(new ArrayType(type, length), {});
8766
- }
8767
-
8768
- // ../../node_modules/memium/dist/fields.internal.js
8769
- function __fieldInit(_name, init, extraOpts = {}) {
8770
- if (!_name)
8771
- throw withErrno("EINVAL", "Invalid name for struct field");
8772
- if (typeof _name == "symbol")
8773
- console.warn("Symbol used for struct field name will be coerced to string: " + _name.toString());
8774
- const name = _name.toString();
8775
- const opt = Object.assign(parseFieldConfig(init), extraOpts);
8776
- if (!isType(opt.type))
8777
- throw withErrno("EINVAL", `Invalid type for struct field "${name}"`);
8778
- return {
8779
- name,
8780
- offset: 0,
8781
- type: opt.type,
8782
- countedBy: opt.countedBy,
8783
- alignment: opt.align ?? opt.type.size,
8784
- decl: opt.type instanceof ArrayType ? `${opt.typeName ?? opt.type.type.name} ${name}[${opt.type.length}]${opt.countedBy ? ` counted_by(${opt.countedBy})` : ""}` : `${opt.typeName ?? opt.type.name} ${name}`,
8785
- littleEndian: !opt.bigEndian
8786
- };
8787
- }
8788
- function __fault(err2) {
8789
- if (err2.message !== "offset is outside the bounds of the DataView")
8790
- throw err2;
8791
- else
8792
- throw withErrno("EFAULT", "Segmentation fault");
8793
- }
8794
- function __fieldSet(instance, field, value, index) {
8795
- try {
8796
- if (typeof value == "string")
8797
- value = value.charCodeAt(0);
8798
- const offset = instance.byteOffset + field.offset + (index ?? 0) * field.type.size;
8799
- field.type.set(instance.buffer, offset, value);
8800
- return;
8801
- } catch (err2) {
8802
- __fault(err2);
8803
- }
8804
- }
8805
- function __fieldGet(instance, field) {
8806
- try {
8807
- return field.type.get(instance.buffer, instance.byteOffset + field.offset);
8808
- } catch (err2) {
8809
- __fault(err2);
8810
- }
8811
- }
8812
-
8813
8872
  // ../../node_modules/memium/dist/primitives.js
8814
8873
  var __view__ = Symbol("DataView");
8815
- function view(buffer) {
8816
- buffer[__view__] ??= new DataView(buffer);
8817
- return buffer[__view__];
8874
+ function view(buffer2) {
8875
+ buffer2[__view__] ??= new DataView(buffer2);
8876
+ return buffer2[__view__];
8818
8877
  }
8819
8878
  var int8 = {
8820
8879
  name: "int8",
8821
8880
  size: 1,
8822
8881
  array: Int8Array,
8823
- get: (buffer, offset) => view(buffer).getInt8(offset),
8824
- set: (buffer, offset, value) => view(buffer).setInt8(offset, value)
8882
+ get: (buffer2, offset) => view(buffer2).getInt8(offset),
8883
+ set: (buffer2, offset, value) => view(buffer2).setInt8(offset, value)
8825
8884
  };
8826
8885
  var uint8 = {
8827
8886
  name: "uint8",
8828
8887
  size: 1,
8829
8888
  array: Uint8Array,
8830
- get: (buffer, offset) => view(buffer).getUint8(offset),
8831
- set: (buffer, offset, value) => view(buffer).setUint8(offset, value)
8889
+ get: (buffer2, offset) => view(buffer2).getUint8(offset),
8890
+ set: (buffer2, offset, value) => view(buffer2).setUint8(offset, value)
8832
8891
  };
8833
8892
  var int16 = {
8834
8893
  name: "int16",
8835
8894
  size: 2,
8836
8895
  array: Int16Array,
8837
- get: (buffer, offset) => view(buffer).getInt16(offset, true),
8838
- set: (buffer, offset, value) => view(buffer).setInt16(offset, value, true)
8896
+ get: (buffer2, offset) => view(buffer2).getInt16(offset, true),
8897
+ set: (buffer2, offset, value) => view(buffer2).setInt16(offset, value, true)
8839
8898
  };
8840
8899
  var uint16 = {
8841
8900
  name: "uint16",
8842
8901
  size: 2,
8843
8902
  array: Uint16Array,
8844
- get: (buffer, offset) => view(buffer).getUint16(offset, true),
8845
- set: (buffer, offset, value) => view(buffer).setUint16(offset, value, true)
8903
+ get: (buffer2, offset) => view(buffer2).getUint16(offset, true),
8904
+ set: (buffer2, offset, value) => view(buffer2).setUint16(offset, value, true)
8846
8905
  };
8847
8906
  var int32 = {
8848
8907
  name: "int32",
8849
8908
  size: 4,
8850
8909
  array: Int32Array,
8851
- get: (buffer, offset) => view(buffer).getInt32(offset, true),
8852
- set: (buffer, offset, value) => view(buffer).setInt32(offset, value, true)
8910
+ get: (buffer2, offset) => view(buffer2).getInt32(offset, true),
8911
+ set: (buffer2, offset, value) => view(buffer2).setInt32(offset, value, true)
8853
8912
  };
8854
8913
  var uint32 = {
8855
8914
  name: "uint32",
8856
8915
  size: 4,
8857
8916
  array: Uint32Array,
8858
- get: (buffer, offset) => view(buffer).getUint32(offset, true),
8859
- set: (buffer, offset, value) => view(buffer).setUint32(offset, value, true)
8917
+ get: (buffer2, offset) => view(buffer2).getUint32(offset, true),
8918
+ set: (buffer2, offset, value) => view(buffer2).setUint32(offset, value, true)
8860
8919
  };
8861
8920
  var int64 = {
8862
8921
  name: "int64",
8863
8922
  size: 8,
8864
8923
  array: BigInt64Array,
8865
- get: (buffer, offset) => view(buffer).getBigInt64(offset, true),
8866
- set: (buffer, offset, value) => view(buffer).setBigInt64(offset, value, true)
8924
+ get: (buffer2, offset) => view(buffer2).getBigInt64(offset, true),
8925
+ set: (buffer2, offset, value) => view(buffer2).setBigInt64(offset, value, true)
8867
8926
  };
8868
8927
  var uint64 = {
8869
8928
  name: "uint64",
8870
8929
  size: 8,
8871
8930
  array: BigUint64Array,
8872
- get: (buffer, offset) => view(buffer).getBigUint64(offset, true),
8873
- set: (buffer, offset, value) => view(buffer).setBigUint64(offset, value, true)
8931
+ get: (buffer2, offset) => view(buffer2).getBigUint64(offset, true),
8932
+ set: (buffer2, offset, value) => view(buffer2).setBigUint64(offset, value, true)
8874
8933
  };
8875
8934
  var float32 = {
8876
8935
  name: "float32",
8877
8936
  size: 4,
8878
8937
  array: Float32Array,
8879
- get: (buffer, offset) => view(buffer).getFloat32(offset, true),
8880
- set: (buffer, offset, value) => view(buffer).setFloat32(offset, value, true)
8938
+ get: (buffer2, offset) => view(buffer2).getFloat32(offset, true),
8939
+ set: (buffer2, offset, value) => view(buffer2).setFloat32(offset, value, true)
8881
8940
  };
8882
8941
  var float64 = {
8883
8942
  name: "float64",
8884
8943
  size: 8,
8885
8944
  array: Float64Array,
8886
- get: (buffer, offset) => view(buffer).getFloat64(offset, true),
8887
- set: (buffer, offset, value) => view(buffer).setFloat64(offset, value, true)
8945
+ get: (buffer2, offset) => view(buffer2).getFloat64(offset, true),
8946
+ set: (buffer2, offset, value) => view(buffer2).setFloat64(offset, value, true)
8888
8947
  };
8889
8948
  var types2 = {
8890
8949
  int8,
@@ -8918,6 +8977,294 @@ function normalize(type) {
8918
8977
  return type == "char" ? "uint8" : type.toLowerCase();
8919
8978
  }
8920
8979
 
8980
+ // ../../node_modules/memium/dist/fields.internal.js
8981
+ function _isBuilder(init) {
8982
+ return (typeof init == "object" || typeof init == "function") && init !== null && "toInit" in init && typeof init.toInit == "function";
8983
+ }
8984
+ function _parseConfig(init) {
8985
+ if (_isBuilder(init))
8986
+ return init.toInit();
8987
+ if (isType(init))
8988
+ return { type: init };
8989
+ return init;
8990
+ }
8991
+ function init(_name, init2, extraOpts = {}) {
8992
+ if (!_name)
8993
+ throw withErrno("EINVAL", "Invalid name for struct field");
8994
+ if (typeof _name == "symbol")
8995
+ console.warn("Symbol used for struct field name will be coerced to string: " + _name.toString());
8996
+ const name = _name.toString();
8997
+ const opt = Object.assign(_parseConfig(init2), extraOpts);
8998
+ if (!isType(opt.type))
8999
+ throw withErrno("EINVAL", `Invalid type for struct field "${name}"`);
9000
+ const countedBy = !opt.countedBy ? "" : ` counted_by(${typeof opt.countedBy == "string" ? opt.countedBy : "<function>"})`;
9001
+ return {
9002
+ name,
9003
+ offset: 0,
9004
+ type: opt.type,
9005
+ countedBy: opt.countedBy,
9006
+ alignment: opt.align ?? opt.type.size,
9007
+ decl: opt.type instanceof ArrayType ? `${opt.typeName ?? opt.type.type.name} ${name}[${opt.type.length}]${countedBy}` : `${opt.typeName ?? opt.type.name} ${name}`,
9008
+ littleEndian: !opt.bigEndian
9009
+ };
9010
+ }
9011
+ function __fault(err2, offset) {
9012
+ if (!(err2 instanceof Error) || err2.message.toLowerCase() !== "offset is outside the bounds of the dataview")
9013
+ throw err2;
9014
+ const ex = withErrno("EFAULT", `Segmentation fault (at 0x${offset.toString(16)})`);
9015
+ Error.captureStackTrace(ex, __fault);
9016
+ throw ex;
9017
+ }
9018
+ function isDynamicArray(instance, field) {
9019
+ return field.type instanceof ArrayType && field.type.length == 0 && !!field.countedBy?.length && !!instance.constructor.isDynamic;
9020
+ }
9021
+ function _count(instance, field) {
9022
+ let value = typeof field.countedBy == "function" ? field.countedBy(instance) : instance[field.countedBy];
9023
+ if (typeof value == "bigint") {
9024
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
9025
+ throw withErrno("EOVERFLOW", "countedBy field value exceeds max safe integer");
9026
+ }
9027
+ value = Number(value);
9028
+ }
9029
+ if (typeof value != "number")
9030
+ throw withErrno("EINVAL", "countedBy field value is not a number");
9031
+ return value;
9032
+ }
9033
+ function dynamicArraySize(instance, field) {
9034
+ let size = field.type.type.size * _count(instance, field);
9035
+ if (isStructConstructor(field.type.type) && field.type.type.isDynamic) {
9036
+ for (const item of instance[field.name]) {
9037
+ size += dynamicStructSize(item);
9038
+ }
9039
+ }
9040
+ return size;
9041
+ }
9042
+ var kOffsets = Symbol("kOffsets");
9043
+ function offsetOf(instance, targetField, cache) {
9044
+ let { offset, name } = targetField;
9045
+ instance[kOffsets] ||= Object.create(null);
9046
+ const offsetCache = instance[kOffsets];
9047
+ if (offsetCache[name] !== undefined) {
9048
+ if (cache)
9049
+ return offsetCache[name];
9050
+ else
9051
+ delete offsetCache[name];
9052
+ }
9053
+ const { fields } = instance.constructor;
9054
+ const index = fields.indexOf(targetField);
9055
+ for (const field of fields.slice(0, index)) {
9056
+ if (isDynamicArray(instance, field)) {
9057
+ offset += dynamicArraySize(instance, field);
9058
+ }
9059
+ const value = instance[field.name];
9060
+ if (isStructInstance(value) && value.constructor.isDynamic) {
9061
+ offset += dynamicStructSize(value);
9062
+ }
9063
+ }
9064
+ if (cache)
9065
+ offsetCache[name] = offset;
9066
+ else {
9067
+ for (const field of fields.slice(index))
9068
+ if (offsetCache[field.name] !== undefined)
9069
+ delete offsetCache[field.name];
9070
+ }
9071
+ return offset;
9072
+ }
9073
+ function set(instance, field, value, index) {
9074
+ if (typeof value == "string")
9075
+ value = value.charCodeAt(0);
9076
+ const offset = instance.byteOffset + offsetOf(instance, field, false) + (index ?? 0) * field.type.size;
9077
+ try {
9078
+ field.type.set(instance.buffer, offset, value);
9079
+ return;
9080
+ } catch (err2) {
9081
+ __fault(err2, offset);
9082
+ }
9083
+ }
9084
+ function get(instance, field) {
9085
+ let type = field.type;
9086
+ if (isDynamicArray(instance, field)) {
9087
+ const inner = field.type.type;
9088
+ type = new ArrayType(inner, _count(instance, field));
9089
+ }
9090
+ const offset = instance.byteOffset + offsetOf(instance, field, true);
9091
+ try {
9092
+ return type.get(instance.buffer, offset);
9093
+ } catch (err2) {
9094
+ __fault(err2, offset);
9095
+ }
9096
+ }
9097
+
9098
+ // ../../node_modules/memium/dist/structs.shared.js
9099
+ function isStructInstance(arg) {
9100
+ return typeof arg == "object" && arg !== null && "constructor" in arg && isStructConstructor(arg.constructor);
9101
+ }
9102
+ function isStructConstructor(arg) {
9103
+ return typeof arg == "function" && "prototype" in arg && "fields" in arg && typeof arg.fields == "object" && isType(arg);
9104
+ }
9105
+ function dynamicStructSize(instance) {
9106
+ let size = 0;
9107
+ for (const field of instance.constructor.fields) {
9108
+ const value = instance[field.name];
9109
+ if (isDynamicArray(instance, field)) {
9110
+ size += dynamicArraySize(instance, field);
9111
+ }
9112
+ if (isStructInstance(value) && value.constructor.isDynamic) {
9113
+ size += dynamicStructSize(value);
9114
+ }
9115
+ }
9116
+ return size;
9117
+ }
9118
+
9119
+ // ../../node_modules/memium/dist/misc.js
9120
+ function static_sizeof(type) {
9121
+ if (isType(type))
9122
+ return type.size;
9123
+ if (type === undefined || type === null)
9124
+ return 0;
9125
+ if (typeof type == "object" && isType(type.constructor))
9126
+ return type.constructor.size;
9127
+ if (Array.isArray(type)) {
9128
+ let size = 0;
9129
+ for (let i = 0;i < type.length; i++)
9130
+ size += static_sizeof(type[i]);
9131
+ return size;
9132
+ }
9133
+ if (typeof type == "string") {
9134
+ checkValid(type);
9135
+ return types2[normalize(type)].size;
9136
+ }
9137
+ throw new TypeError(`Unable to resolve size of \`${type.toString()}\``);
9138
+ }
9139
+ function sizeof(type) {
9140
+ const size = static_sizeof(type);
9141
+ if (isStructInstance(type) && type.constructor.isDynamic) {
9142
+ return size + dynamicStructSize(type);
9143
+ }
9144
+ return size;
9145
+ }
9146
+ function offsetof(type, fieldName) {
9147
+ let constructor;
9148
+ if (isStructConstructor(type)) {
9149
+ if (type.isDynamic)
9150
+ throw withErrno("EINVAL", "Cannot get offset of field in dynamic struct from the constructor");
9151
+ constructor = type;
9152
+ } else if (isStructInstance(type))
9153
+ constructor = type.constructor;
9154
+ else
9155
+ throw withErrno("EINVAL", "Type is not a struct or struct constructor");
9156
+ const { fields } = constructor;
9157
+ const field = fields.find((f) => f.name === fieldName);
9158
+ if (!field)
9159
+ throw withErrno("EINVAL", "Struct does not have field: " + fieldName);
9160
+ return isStructConstructor(type) ? field.offset : offsetOf(type, field, true);
9161
+ }
9162
+
9163
+ // ../../node_modules/memium/dist/array.js
9164
+ var _strictIndexes = false;
9165
+ function StructArray(type, __length) {
9166
+ class StructArray2 extends DataView {
9167
+ length;
9168
+ type = type;
9169
+ *[Symbol.iterator]() {
9170
+ for (let i = 0;i < this.length; i++)
9171
+ yield this[i];
9172
+ }
9173
+ _offsets = [0];
9174
+ offsetOf(index) {
9175
+ if (!type.isDynamic)
9176
+ return index * type.size;
9177
+ if (index < this._offsets.length)
9178
+ return this._offsets[index];
9179
+ for (let i = this._offsets.length;i <= index; i++) {
9180
+ this._offsets[i] = this._offsets[i - 1] + sizeof(type.get(this.buffer, this.byteOffset + this._offsets[i - 1]));
9181
+ }
9182
+ return this._offsets[index];
9183
+ }
9184
+ constructor(lengthOrBuffer, byteOffset, byteLength) {
9185
+ const buffer2 = typeof lengthOrBuffer === "object" ? lengthOrBuffer : new ArrayBuffer((lengthOrBuffer ?? 0) * type.size);
9186
+ super(buffer2, byteOffset, byteLength);
9187
+ this.length = typeof lengthOrBuffer === "number" ? lengthOrBuffer : type.isDynamic ? __length ?? _throw(`Unknown length of StructArray<${type.name}>`) : Math.floor(this.byteLength / type.size);
9188
+ const offset = (i) => this.byteOffset + this.offsetOf(i);
9189
+ return new Proxy(this, {
9190
+ get(target, index) {
9191
+ if (index in target)
9192
+ return target[index];
9193
+ const i = parseInt(index.toString());
9194
+ if (!Number.isSafeInteger(i))
9195
+ if (_strictIndexes)
9196
+ throw withErrno("EINVAL", "Invalid index: " + index.toString());
9197
+ else
9198
+ return;
9199
+ return type.get(target.buffer, offset(i));
9200
+ },
9201
+ set(target, index, value) {
9202
+ const i = parseInt(index.toString());
9203
+ if (!Number.isSafeInteger(i))
9204
+ if (_strictIndexes)
9205
+ throw withErrno("EINVAL", "Invalid index: " + index.toString());
9206
+ else
9207
+ return false;
9208
+ type.set(target.buffer, offset(i), value);
9209
+ return true;
9210
+ }
9211
+ });
9212
+ }
9213
+ }
9214
+ for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
9215
+ if (!key.startsWith("get") && !key.startsWith("set"))
9216
+ continue;
9217
+ Object.defineProperty(StructArray2.prototype, key, {
9218
+ enumerable: false,
9219
+ configurable: false,
9220
+ writable: false,
9221
+ value: undefined
9222
+ });
9223
+ }
9224
+ return StructArray2;
9225
+ }
9226
+ function _isStructConstructor(arg) {
9227
+ return typeof arg == "function" && "prototype" in arg && "fields" in arg && typeof arg.fields == "object" && isType(arg);
9228
+ }
9229
+
9230
+ class ArrayType {
9231
+ type;
9232
+ length;
9233
+ name;
9234
+ size;
9235
+ __structArray;
9236
+ __arrayType;
9237
+ __isArrayType = true;
9238
+ constructor(type, length) {
9239
+ this.type = type;
9240
+ this.length = length;
9241
+ this.name = `${type.name}[${length}]`;
9242
+ this.size = type.size * length;
9243
+ this.array = StructArray(this);
9244
+ this.__structArray = StructArray(type, length);
9245
+ this.__arrayType = type.array ? type.array : this.__structArray;
9246
+ }
9247
+ get = (buffer2, offset) => {
9248
+ if (isValid(this.type.name) && offset % this.type.size !== 0) {
9249
+ return new this.__structArray(buffer2, offset, this.size);
9250
+ }
9251
+ return new this.__arrayType(buffer2, offset, this.size);
9252
+ };
9253
+ set = (buffer2, offset, value) => {
9254
+ if (this.length)
9255
+ for (let i = 0;i < this.length; i++) {
9256
+ this.type.set(buffer2, offset + i * this.type.size, value[i]);
9257
+ }
9258
+ else {
9259
+ let pointer = offset;
9260
+ for (let i = 0;i < value.length; i++) {
9261
+ this.type.set(buffer2, pointer, value[i]);
9262
+ pointer += _isStructConstructor(this.type) && this.type.isDynamic ? sizeof(value[i]) : this.type.size;
9263
+ }
9264
+ }
9265
+ };
9266
+ array;
9267
+ }
8921
9268
  // ../../node_modules/memium/dist/decorators.js
8922
9269
  Symbol.metadata ??= Symbol.for("Symbol.metadata");
8923
9270
  function initMetadata(context) {
@@ -8928,19 +9275,19 @@ function initMetadata(context) {
8928
9275
  };
8929
9276
  return context.metadata.structInit;
8930
9277
  }
8931
- function struct(name, ...options) {
9278
+ function struct(...options) {
8932
9279
  const opts = options.reduce((acc, opt) => ({ ...acc, ...opt }), {});
8933
9280
  if (typeof this == "object")
8934
9281
  Object.assign(opts, this);
8935
9282
  return function __decorateStruct(target, context) {
8936
- const init = initMetadata(context);
9283
+ const init2 = initMetadata(context);
8937
9284
  let fieldAlignment = 1;
8938
- const fields = {};
9285
+ const fields = [];
8939
9286
  let size = 0;
8940
9287
  const align = (to) => {
8941
9288
  size = Math.ceil(size / to) * to;
8942
9289
  };
8943
- for (const field of init.fields) {
9290
+ for (const field of init2.fields) {
8944
9291
  if (!opts.isPacked)
8945
9292
  align(field.alignment);
8946
9293
  if (opts.isUnion)
@@ -8949,20 +9296,32 @@ function struct(name, ...options) {
8949
9296
  field.offset = size;
8950
9297
  size += field.type.size;
8951
9298
  }
8952
- fields[field.name] = field;
9299
+ fields.push(field);
8953
9300
  fieldAlignment = Math.max(fieldAlignment, field.alignment);
8954
9301
  }
8955
9302
  opts.alignment ??= fieldAlignment;
8956
9303
  if (!opts.isPacked)
8957
9304
  align(opts.alignment);
8958
- context.metadata.struct = {
8959
- fields,
8960
- size,
8961
- alignment: opts.isPacked ? 1 : opts.alignment,
8962
- isUnion: opts.isUnion ?? false
8963
- };
8964
9305
 
8965
9306
  class _struct extends target {
9307
+ static name = target.name;
9308
+ static size = size;
9309
+ static alignment = opts.alignment;
9310
+ static isUnion = !!opts.isUnion;
9311
+ static isDynamic = !!opts.isDynamic;
9312
+ static fields = fields;
9313
+ static get(buffer2, offset) {
9314
+ return new this(buffer2, offset);
9315
+ }
9316
+ static set(buffer2, offset, value) {
9317
+ const source = new Uint8Array(value.buffer, value.byteOffset, this.size);
9318
+ const target2 = new Uint8Array(buffer2, offset, this.size);
9319
+ if (value.buffer === buffer2 && value.byteOffset === offset)
9320
+ return;
9321
+ for (let i = 0;i < this.size; i++)
9322
+ target2[i] = source[i];
9323
+ }
9324
+ static [Symbol.toStringTag] = `[struct ${target.name}]`;
8966
9325
  constructor(...args) {
8967
9326
  if (!args.length)
8968
9327
  args = [new ArrayBuffer(size), 0, size];
@@ -8972,39 +9331,19 @@ function struct(name, ...options) {
8972
9331
  enumerable: true,
8973
9332
  configurable: true,
8974
9333
  get() {
8975
- return __fieldGet(this, field);
9334
+ return get(this, field);
8976
9335
  },
8977
9336
  set(value) {
8978
- __fieldSet(this, field, value);
9337
+ set(this, field, value);
8979
9338
  }
8980
9339
  });
8981
9340
  }
8982
9341
  }
8983
9342
  }
8984
- const fix = (value) => ({
8985
- writable: false,
8986
- enumerable: false,
8987
- configurable: false,
8988
- value
8989
- });
8990
- Object.defineProperties(_struct, {
8991
- name: fix(name),
8992
- size: fix(size),
8993
- alignment: fix(opts.alignment),
8994
- isUnion: fix(!!opts.isUnion),
8995
- fields: fix(fields),
8996
- get: fix((buffer, offset) => new _struct(buffer, offset)),
8997
- set: fix((buffer, offset, value) => {
8998
- const source = new Uint8Array(value.buffer, value.byteOffset, size);
8999
- const target2 = new Uint8Array(buffer, offset, size);
9000
- if (value.buffer === buffer && value.byteOffset === offset)
9001
- return;
9002
- for (let i = 0;i < size; i++)
9003
- target2[i] = source[i];
9004
- }),
9005
- [Symbol.toStringTag]: fix(`[struct ${name}]`)
9343
+ context.addInitializer(function() {
9344
+ Object.defineProperty(_struct, "name", { value: target.name });
9345
+ registerType(_struct);
9006
9346
  });
9007
- registerType(_struct);
9008
9347
  return _struct;
9009
9348
  };
9010
9349
  }
@@ -9016,15 +9355,15 @@ function field(type, opt = {}) {
9016
9355
  return function __decorateField(value, context) {
9017
9356
  if (context.kind != "accessor")
9018
9357
  throw withErrno("EINVAL", "Field must be an accessor");
9019
- const init = initMetadata(context);
9020
- const field2 = __fieldInit(context.name, type, opt);
9021
- init.fields.push(field2);
9358
+ const init2 = initMetadata(context);
9359
+ const field2 = init(context.name, type, opt);
9360
+ init2.fields.push(field2);
9022
9361
  return {
9023
9362
  get() {
9024
- return __fieldGet(this, field2);
9363
+ return get(this, field2);
9025
9364
  },
9026
9365
  set(value2) {
9027
- __fieldSet(this, field2, value2);
9366
+ set(this, field2, value2);
9028
9367
  }
9029
9368
  };
9030
9369
  };
@@ -9043,10 +9382,40 @@ function $from(t) {
9043
9382
  $from.typed = function(t) {
9044
9383
  return t;
9045
9384
  };
9046
- // ../../node_modules/memium/dist/structs.js
9047
- function isStructConstructor(arg) {
9048
- return typeof arg == "function" && "prototype" in arg && "fields" in arg && typeof arg.fields == "object" && isType(arg);
9385
+ // ../../node_modules/memium/dist/fields.js
9386
+ class FieldBuilder {
9387
+ type;
9388
+ init;
9389
+ constructor(type, init2) {
9390
+ this.type = type;
9391
+ this.init = init2;
9392
+ const _toArray = (length) => {
9393
+ return new FieldBuilder(new ArrayType(type, length), init2);
9394
+ };
9395
+ Object.setPrototypeOf(_toArray, new.target.prototype);
9396
+ Object.assign(_toArray, { type, init: init2 });
9397
+ return _toArray;
9398
+ }
9399
+ align(align) {
9400
+ return new FieldBuilder(this.type, { ...this.init, align });
9401
+ }
9402
+ countedBy(countedBy) {
9403
+ return new FieldBuilder(this.type, { ...this.init, countedBy });
9404
+ }
9405
+ bigEndian() {
9406
+ return new FieldBuilder(this.type, { ...this.init, bigEndian: true });
9407
+ }
9408
+ toInit() {
9409
+ return { type: this.type, ...this.init };
9410
+ }
9411
+ $type() {
9412
+ return new FieldBuilder(this.type, this.init);
9413
+ }
9049
9414
  }
9415
+ function array2(type, length = 0) {
9416
+ return new FieldBuilder(new ArrayType(type, length), {});
9417
+ }
9418
+ // ../../node_modules/memium/dist/structs.js
9050
9419
  function struct2(structName, fieldDecls, ...options) {
9051
9420
  const opts = options.reduce((acc, opt) => ({ ...acc, ...opt }), {});
9052
9421
  if (typeof this == "object")
@@ -9056,11 +9425,11 @@ function struct2(structName, fieldDecls, ...options) {
9056
9425
  const align = (to) => {
9057
9426
  size = Math.ceil(size / to) * to;
9058
9427
  };
9059
- const fields = Object.create(null);
9060
- for (const [name, init] of Object.entries(fieldDecls)) {
9428
+ const fields = [];
9429
+ for (const [name, init2] of Object.entries(fieldDecls)) {
9061
9430
  if (typeof name == "number")
9062
9431
  throw new TypeError("Field names can not be numbers");
9063
- const field2 = __fieldInit(name, init);
9432
+ const field2 = init(name, init2);
9064
9433
  if (!opts.isPacked)
9065
9434
  align(field2.alignment);
9066
9435
  if (opts.isUnion)
@@ -9069,26 +9438,43 @@ function struct2(structName, fieldDecls, ...options) {
9069
9438
  field2.offset = size;
9070
9439
  size += field2.type.size;
9071
9440
  }
9072
- fields[field2.name] = field2;
9441
+ fields.push(field2);
9073
9442
  fieldAlignment = Math.max(fieldAlignment, field2.alignment);
9074
9443
  }
9075
9444
  opts.alignment ??= fieldAlignment;
9076
9445
  if (!opts.isPacked)
9077
9446
  align(opts.alignment);
9078
9447
 
9079
- class __struct extends DataView {
9448
+ class _struct extends DataView {
9080
9449
  static name = structName;
9081
- constructor(buffer = new ArrayBuffer(size), byteOffset, byteLength) {
9082
- super(buffer, byteOffset, byteLength ?? size);
9083
- for (const field2 of Object.values(fields)) {
9450
+ static size = size;
9451
+ static alignment = opts.alignment;
9452
+ static isUnion = !!opts.isUnion;
9453
+ static isDynamic = !!opts.isDynamic;
9454
+ static fields = fields;
9455
+ static get(buffer2, offset) {
9456
+ return new this(buffer2, offset);
9457
+ }
9458
+ static set(buffer2, offset, value) {
9459
+ const source = new Uint8Array(value.buffer, value.byteOffset, this.size);
9460
+ const target = new Uint8Array(buffer2, offset, this.size);
9461
+ if (value.buffer === buffer2 && value.byteOffset === offset)
9462
+ return;
9463
+ for (let i = 0;i < this.size; i++)
9464
+ target[i] = source[i];
9465
+ }
9466
+ static [Symbol.toStringTag] = `[struct ${structName}]`;
9467
+ constructor(buffer2 = new ArrayBuffer(size), byteOffset, byteLength) {
9468
+ super(buffer2, byteOffset, byteLength ?? buffer2.byteLength - (byteOffset ?? 0));
9469
+ for (const field2 of Object.values(this.constructor.fields ?? fields)) {
9084
9470
  Object.defineProperty(this, field2.name, {
9085
9471
  enumerable: true,
9086
9472
  configurable: true,
9087
9473
  get() {
9088
- return __fieldGet(this, field2);
9474
+ return get(this, field2);
9089
9475
  },
9090
9476
  set(value) {
9091
- __fieldSet(this, field2, value);
9477
+ set(this, field2, value);
9092
9478
  }
9093
9479
  });
9094
9480
  }
@@ -9097,129 +9483,63 @@ function struct2(structName, fieldDecls, ...options) {
9097
9483
  for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
9098
9484
  if (!key.startsWith("get") && !key.startsWith("set"))
9099
9485
  continue;
9100
- Object.defineProperty(__struct.prototype, key, {
9486
+ Object.defineProperty(_struct.prototype, key, {
9101
9487
  enumerable: false,
9102
9488
  configurable: false,
9103
9489
  writable: false,
9104
9490
  value: undefined
9105
9491
  });
9106
9492
  }
9107
- const _struct = __struct;
9108
- const fix = (value) => ({
9109
- writable: false,
9110
- enumerable: false,
9111
- configurable: false,
9112
- value
9113
- });
9114
- Object.defineProperties(_struct, {
9115
- size: fix(size),
9116
- alignment: fix(opts.alignment),
9117
- isUnion: fix(!!opts.isUnion),
9118
- fields: fix(fields),
9119
- get: fix((buffer, offset) => new _struct(buffer, offset)),
9120
- set: fix((buffer, offset, value) => {
9121
- const source = new Uint8Array(value.buffer, value.byteOffset, size);
9122
- const target = new Uint8Array(buffer, offset, size);
9123
- if (value.buffer === buffer && value.byteOffset === offset)
9124
- return;
9125
- for (let i = 0;i < size; i++)
9126
- target[i] = source[i];
9127
- }),
9128
- [Symbol.toStringTag]: fix(`[struct ${structName}]`)
9129
- });
9130
9493
  registerType(_struct);
9131
9494
  return _struct;
9132
9495
  }
9133
9496
  struct2.extend = function(base, structName, fieldDecls, ...options) {
9134
- return struct2(structName, { ...base.fields, ...fieldDecls }, ...options);
9135
- };
9136
- struct2.packed = struct2.bind({ isPacked: true });
9137
- struct2.align = function(alignment) {
9138
- return struct2.bind({ alignment });
9139
- };
9140
- var types4 = Object.fromEntries(Object.entries(rawTypes).map(([typeName, type]) => [
9141
- typeName,
9142
- new FieldBuilder(type, { typeName })
9143
- ]));
9144
-
9145
- // ../../node_modules/memium/dist/misc.js
9146
- function sizeof(type) {
9147
- if (isType(type))
9148
- return type.size;
9149
- if (type === undefined || type === null)
9150
- return 0;
9151
- if (typeof type == "object" && isType(type.constructor))
9152
- return type.constructor.size;
9153
- if (Array.isArray(type)) {
9154
- let size = 0;
9155
- for (let i = 0;i < type.length; i++)
9156
- size += sizeof(type[i]);
9157
- return size;
9158
- }
9159
- if (typeof type == "string") {
9160
- checkValid(type);
9161
- return types2[normalize(type)].size;
9162
- }
9163
- throw new TypeError(`Unable to resolve size of \`${type.toString()}\``);
9164
- }
9165
- function offsetof(type, fieldName) {
9166
- let constructor;
9167
- if (isStructConstructor(type))
9168
- constructor = type;
9169
- else if (isStructConstructor(type.constructor))
9170
- constructor = type.constructor;
9171
- else
9172
- throw withErrno("EINVAL", "Type is not a struct or struct constructor");
9173
- const { fields } = constructor;
9174
- if (!(fieldName in fields))
9175
- throw withErrno("EINVAL", "Struct does not have field: " + fieldName);
9176
- return fields[fieldName].offset;
9177
- }
9178
- // ../../node_modules/utilium/dist/buffer.js
9179
- function extendBuffer(buffer, newByteLength) {
9180
- if (buffer.byteLength >= newByteLength)
9181
- return buffer;
9182
- if (ArrayBuffer.isView(buffer)) {
9183
- const newBuffer = extendBuffer(buffer.buffer, newByteLength);
9184
- return new buffer.constructor(newBuffer, buffer.byteOffset, newByteLength);
9185
- }
9186
- const isShared = typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
9187
- if (buffer.maxByteLength > newByteLength) {
9188
- isShared ? buffer.grow(newByteLength) : buffer.resize(newByteLength);
9189
- return buffer;
9190
- }
9191
- if (isShared) {
9192
- const newBuffer = new SharedArrayBuffer(newByteLength);
9193
- new Uint8Array(newBuffer).set(new Uint8Array(buffer));
9194
- return newBuffer;
9195
- }
9196
- try {
9197
- return buffer.transfer(newByteLength);
9198
- } catch {
9199
- const newBuffer = new ArrayBuffer(newByteLength);
9200
- new Uint8Array(newBuffer).set(new Uint8Array(buffer));
9201
- return newBuffer;
9202
- }
9203
- }
9204
- class BufferView extends DataView {
9205
- constructor(_buffer, _byteOffset, _byteLength) {
9206
- const { buffer, byteOffset, byteLength } = new Uint8Array(_buffer, _byteOffset, _byteLength);
9207
- super(buffer, byteOffset, byteLength);
9497
+ const opts = options.reduce((acc, opt) => ({ ...acc, ...opt }), {});
9498
+ if (typeof this == "object")
9499
+ Object.assign(opts, this);
9500
+ let fieldAlignment = 1;
9501
+ let size = base.size;
9502
+ const align = (to) => {
9503
+ size = Math.ceil(size / to) * to;
9504
+ };
9505
+ const fields = base.fields;
9506
+ for (const [name, init2] of Object.entries(fieldDecls)) {
9507
+ if (typeof name == "number")
9508
+ throw new TypeError("Field names can not be numbers");
9509
+ const field2 = init(name, init2);
9510
+ if (!opts.isPacked)
9511
+ align(field2.alignment);
9512
+ if (opts.isUnion)
9513
+ size = Math.max(size, field2.type.size);
9514
+ else {
9515
+ field2.offset = size;
9516
+ size += field2.type.size;
9517
+ }
9518
+ fields.push(field2);
9519
+ fieldAlignment = Math.max(fieldAlignment, field2.alignment);
9208
9520
  }
9209
- }
9210
- for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
9211
- if (!key.startsWith("get") && !key.startsWith("set"))
9212
- continue;
9213
- Object.defineProperty(BufferView.prototype, key, {
9214
- value: () => {
9215
- throw new ReferenceError("Do not use DataView methods on a BufferView.");
9216
- },
9217
- writable: false,
9218
- enumerable: false,
9219
- configurable: false
9220
- });
9221
- }
9521
+ opts.alignment ??= fieldAlignment;
9522
+ if (!opts.isPacked)
9523
+ align(opts.alignment);
9222
9524
 
9525
+ class _struct extends base {
9526
+ static name = structName;
9527
+ static size = size;
9528
+ static alignment = opts.alignment;
9529
+ static isUnion = !!opts.isUnion;
9530
+ static isDynamic = !!opts.isDynamic;
9531
+ static fields = fields;
9532
+ static [Symbol.toStringTag] = `[struct ${structName}]`;
9533
+ }
9534
+ registerType(_struct);
9535
+ return _struct;
9536
+ };
9537
+ struct2.packed = struct2.bind({ isPacked: true });
9538
+ struct2.align = function(alignment) {
9539
+ return struct2.bind({ alignment });
9540
+ };
9541
+ struct2.dynamic = struct2.bind({ isDynamic: true });
9542
+ var types4 = Object.fromEntries(Object.entries(rawTypes).map(([typeName, type]) => [typeName, new FieldBuilder(type, { typeName })]));
9223
9543
  // ../../node_modules/@zenfs/core/dist/utils.js
9224
9544
  function decodeDirListing(data) {
9225
9545
  return JSON.parse(decodeUTF8(data), (k, v) => k == "" ? v : typeof v == "string" ? BigInt(v).toString(16).slice(0, Math.min(v.length, 8)) : v);
@@ -9280,7 +9600,9 @@ function normalizeOptions(options, encoding = "utf8", flag, mode = 0) {
9280
9600
  };
9281
9601
  }
9282
9602
  function globToRegex(pattern) {
9283
- pattern = pattern.replace(/([.?+^$(){}|[\]/])/g, "$1").replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*").replace(/\?/g, ".");
9603
+ const GLOBSTAR = "\x00GS\x00";
9604
+ const STAR = "\x00S\x00";
9605
+ pattern = pattern.replace(/\*\*/g, GLOBSTAR).replace(/\*/g, STAR).replace(/[.+^$(){}|[\]\\]/g, "\\$&").replace(/\?/g, ".").replaceAll("/" + GLOBSTAR + "/", "(?:/.*)?/").replaceAll(GLOBSTAR, ".*").replaceAll(STAR, "[^/]*");
9284
9606
  return new RegExp(`^${pattern}$`);
9285
9607
  }
9286
9608
  function _tempDirName(prefix) {
@@ -9754,7 +10076,7 @@ var rootIno = 0;
9754
10076
  var maxDynamicData = 3968;
9755
10077
  var Attribute = (() => {
9756
10078
  var _a, _b;
9757
- let _classDecorators = [struct.packed("Attribute")];
10079
+ let _classDecorators = [struct.packed()];
9758
10080
  let _classDescriptor;
9759
10081
  let _classExtraInitializers = [];
9760
10082
  let _classThis;
@@ -9783,8 +10105,8 @@ var Attribute = (() => {
9783
10105
  Attribute2 = _classThis = _classDescriptor.value;
9784
10106
  if (_metadata)
9785
10107
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
9786
- __runInitializers(_classThis, _classExtraInitializers);
9787
10108
  }
10109
+ static name = "Attribute";
9788
10110
  #keySize_accessor_storage = __runInitializers(this, _keySize_initializers, undefined);
9789
10111
  get keySize() {
9790
10112
  return this.#keySize_accessor_storage;
@@ -9825,12 +10147,15 @@ var Attribute = (() => {
9825
10147
  super(...arguments);
9826
10148
  __runInitializers(this, _valueSize_extraInitializers);
9827
10149
  }
10150
+ static {
10151
+ __runInitializers(_classThis, _classExtraInitializers);
10152
+ }
9828
10153
  };
9829
10154
  return Attribute2 = _classThis;
9830
10155
  })();
9831
10156
  var Attributes = (() => {
9832
10157
  var _a;
9833
- let _classDecorators = [struct.packed("Attributes")];
10158
+ let _classDecorators = [struct.packed()];
9834
10159
  let _classDescriptor;
9835
10160
  let _classExtraInitializers = [];
9836
10161
  let _classThis;
@@ -9852,8 +10177,8 @@ var Attributes = (() => {
9852
10177
  Attributes2 = _classThis = _classDescriptor.value;
9853
10178
  if (_metadata)
9854
10179
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
9855
- __runInitializers(_classThis, _classExtraInitializers);
9856
10180
  }
10181
+ static name = "Attributes";
9857
10182
  #size_accessor_storage = __runInitializers(this, _size_initializers, undefined);
9858
10183
  get size() {
9859
10184
  return this.#size_accessor_storage;
@@ -9960,6 +10285,9 @@ var Attributes = (() => {
9960
10285
  super(...arguments);
9961
10286
  __runInitializers(this, _size_extraInitializers);
9962
10287
  }
10288
+ static {
10289
+ __runInitializers(_classThis, _classExtraInitializers);
10290
+ }
9963
10291
  };
9964
10292
  return Attributes2 = _classThis;
9965
10293
  })();
@@ -10002,7 +10330,7 @@ var InodeFlags;
10002
10330
  })(InodeFlags || (InodeFlags = {}));
10003
10331
  var Inode = (() => {
10004
10332
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
10005
- let _classDecorators = [struct.packed("Inode")];
10333
+ let _classDecorators = [struct.packed()];
10006
10334
  let _classDescriptor;
10007
10335
  let _classExtraInitializers = [];
10008
10336
  let _classThis;
@@ -10150,8 +10478,8 @@ var Inode = (() => {
10150
10478
  Inode2 = _classThis = _classDescriptor.value;
10151
10479
  if (_metadata)
10152
10480
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
10153
- __runInitializers(_classThis, _classExtraInitializers);
10154
10481
  }
10482
+ static name = "Inode";
10155
10483
  constructor(...args) {
10156
10484
  let data = {};
10157
10485
  if (typeof args[0] === "object" && args[0] !== null && !ArrayBuffer.isView(args[0])) {
@@ -10341,6 +10669,9 @@ var Inode = (() => {
10341
10669
  this.ctimeMs = Date.now();
10342
10670
  return hasChanged;
10343
10671
  }
10672
+ static {
10673
+ __runInitializers(_classThis, _classExtraInitializers);
10674
+ }
10344
10675
  };
10345
10676
  return Inode2 = _classThis;
10346
10677
  })();
@@ -10554,9 +10885,9 @@ class FileSystem {
10554
10885
  const { start = 0, end = size } = options;
10555
10886
  for (let offset = start;offset < end; offset += _chunkSize) {
10556
10887
  const bytesRead = offset + _chunkSize > end ? end - offset : _chunkSize;
10557
- const buffer = new Uint8Array(bytesRead);
10558
- await this.read(path, buffer, offset, offset + bytesRead).catch(controller.error.bind(controller));
10559
- controller.enqueue(buffer);
10888
+ const buffer2 = new Uint8Array(bytesRead);
10889
+ await this.read(path, buffer2, offset, offset + bytesRead).catch(controller.error.bind(controller));
10890
+ controller.enqueue(buffer2);
10560
10891
  }
10561
10892
  controller.close();
10562
10893
  },
@@ -10583,160 +10914,6 @@ class FileSystem {
10583
10914
  }
10584
10915
  }
10585
10916
 
10586
- // ../../node_modules/utilium/dist/cache.js
10587
- class Resource {
10588
- id;
10589
- _size;
10590
- options;
10591
- regions = [];
10592
- get size() {
10593
- return this._size;
10594
- }
10595
- set size(value) {
10596
- if (value >= this._size) {
10597
- this._size = value;
10598
- return;
10599
- }
10600
- this._size = value;
10601
- for (let i = this.regions.length - 1;i >= 0; i--) {
10602
- const region = this.regions[i];
10603
- if (region.offset >= value) {
10604
- this.regions.splice(i, 1);
10605
- continue;
10606
- }
10607
- const maxLength = value - region.offset;
10608
- if (region.data.byteLength > maxLength) {
10609
- region.data = region.data.subarray(0, maxLength);
10610
- }
10611
- region.ranges = region.ranges.filter((range) => range.start < value).map((range) => {
10612
- if (range.end > value) {
10613
- return { start: range.start, end: value };
10614
- }
10615
- return range;
10616
- });
10617
- }
10618
- }
10619
- constructor(id, _size, options, resources) {
10620
- this.id = id;
10621
- this._size = _size;
10622
- this.options = options;
10623
- options.sparse ??= true;
10624
- if (!options.sparse)
10625
- this.regions.push({ offset: 0, data: new Uint8Array(_size), ranges: [] });
10626
- resources?.set(id, this);
10627
- }
10628
- collect() {
10629
- if (!this.options.sparse)
10630
- return;
10631
- const { regionGapThreshold = 4095 } = this.options;
10632
- for (let i = 0;i < this.regions.length - 1; ) {
10633
- const current = this.regions[i];
10634
- const next = this.regions[i + 1];
10635
- if (next.offset - (current.offset + current.data.byteLength) > regionGapThreshold) {
10636
- i++;
10637
- continue;
10638
- }
10639
- current.ranges.push(...next.ranges);
10640
- current.ranges.sort((a, b) => a.start - b.start);
10641
- current.ranges = current.ranges.reduce((acc, range) => {
10642
- if (!acc.length || acc.at(-1).end < range.start) {
10643
- acc.push(range);
10644
- } else {
10645
- acc.at(-1).end = Math.max(acc.at(-1).end, range.end);
10646
- }
10647
- return acc;
10648
- }, []);
10649
- current.data = extendBuffer(current.data, next.offset + next.data.byteLength);
10650
- current.data.set(next.data, next.offset - current.offset);
10651
- this.regions.splice(i + 1, 1);
10652
- }
10653
- }
10654
- missing(start, end) {
10655
- const missingRanges = [];
10656
- for (const region of this.regions) {
10657
- if (region.offset >= end)
10658
- break;
10659
- for (const range of region.ranges) {
10660
- if (range.end <= start)
10661
- continue;
10662
- if (range.start >= end)
10663
- break;
10664
- if (range.start > start) {
10665
- missingRanges.push({ start, end: Math.min(range.start, end) });
10666
- }
10667
- if (range.end > start)
10668
- start = Math.max(start, range.end);
10669
- if (start >= end)
10670
- break;
10671
- }
10672
- if (start >= end)
10673
- break;
10674
- }
10675
- if (start < end)
10676
- missingRanges.push({ start, end });
10677
- return missingRanges;
10678
- }
10679
- cached(start, end) {
10680
- const cachedRanges = [];
10681
- for (const region of this.regions) {
10682
- if (region.offset >= end)
10683
- break;
10684
- for (const range of region.ranges) {
10685
- if (range.end <= start)
10686
- continue;
10687
- if (range.start >= end)
10688
- break;
10689
- cachedRanges.push({
10690
- start: Math.max(start, range.start),
10691
- end: Math.min(end, range.end)
10692
- });
10693
- }
10694
- }
10695
- cachedRanges.sort((a, b) => a.start - b.start);
10696
- const merged = [];
10697
- for (const curr of cachedRanges) {
10698
- const last = merged.at(-1);
10699
- if (last && curr.start <= last.end) {
10700
- last.end = Math.max(last.end, curr.end);
10701
- } else {
10702
- merged.push(curr);
10703
- }
10704
- }
10705
- return merged;
10706
- }
10707
- regionAt(offset) {
10708
- if (!this.regions.length)
10709
- return;
10710
- for (const region of this.regions) {
10711
- if (region.offset > offset)
10712
- break;
10713
- if (offset >= region.offset && offset < region.offset + region.data.byteLength)
10714
- return region;
10715
- }
10716
- }
10717
- add(data, offset) {
10718
- const end = offset + data.byteLength;
10719
- const region = this.regionAt(offset);
10720
- if (region) {
10721
- region.data = extendBuffer(region.data, end);
10722
- region.data.set(data, offset);
10723
- region.ranges.push({ start: offset, end });
10724
- region.ranges.sort((a, b) => a.start - b.start);
10725
- this.collect();
10726
- return this;
10727
- }
10728
- const newRegion = { data, offset, ranges: [{ start: offset, end }] };
10729
- const insertIndex = this.regions.findIndex((region2) => region2.offset > offset);
10730
- if (insertIndex == -1) {
10731
- this.regions.push(newRegion);
10732
- } else {
10733
- this.regions.splice(insertIndex, 0, newRegion);
10734
- }
10735
- this.collect();
10736
- return this;
10737
- }
10738
- }
10739
-
10740
10917
  // ../../node_modules/@zenfs/core/dist/polyfills.js
10741
10918
  Promise.withResolvers ??= (warn("Using a polyfill of Promise.withResolvers"), function() {
10742
10919
  let _resolve, _reject;
@@ -10866,13 +11043,13 @@ class WrappedTransaction {
10866
11043
  }
10867
11044
  async set(id, view2, offset = 0) {
10868
11045
  await this.markModified(id, offset, view2.byteLength);
10869
- const buffer = view2 instanceof Uint8Array ? view2 : new Uint8Array(view2.buffer, view2.byteOffset, view2.byteLength);
10870
- await this.raw.set(id, buffer, offset);
11046
+ const buffer2 = view2 instanceof Uint8Array ? view2 : new Uint8Array(view2.buffer, view2.byteOffset, view2.byteLength);
11047
+ await this.raw.set(id, buffer2, offset);
10871
11048
  }
10872
11049
  setSync(id, view2, offset = 0) {
10873
11050
  this.markModifiedSync(id, offset, view2.byteLength);
10874
- const buffer = view2 instanceof Uint8Array ? view2 : new Uint8Array(view2.buffer, view2.byteOffset, view2.byteLength);
10875
- this.raw.setSync(id, buffer, offset);
11051
+ const buffer2 = view2 instanceof Uint8Array ? view2 : new Uint8Array(view2.buffer, view2.byteOffset, view2.byteLength);
11052
+ this.raw.setSync(id, buffer2, offset);
10876
11053
  }
10877
11054
  async remove(id) {
10878
11055
  await this.markModified(id, 0, undefined);
@@ -11455,7 +11632,7 @@ class StoreFS extends FileSystem {
11455
11632
  __disposeResources(env_14);
11456
11633
  }
11457
11634
  }
11458
- async read(path, buffer, offset, end) {
11635
+ async read(path, buffer2, offset, end) {
11459
11636
  const env_15 = { stack: [], error: undefined, hasError: false };
11460
11637
  try {
11461
11638
  const tx = __addDisposableResource(env_15, this.transaction(), true);
@@ -11464,9 +11641,9 @@ class StoreFS extends FileSystem {
11464
11641
  return;
11465
11642
  const data = await tx.get(inode.data, offset, end) ?? _throw(withErrno("ENODATA"));
11466
11643
  const _ = tx.flag("partial") ? data : data.subarray(offset, end);
11467
- if (_.byteLength > buffer.byteLength)
11468
- err(`Trying to place ${_.byteLength} bytes into a ${buffer.byteLength} byte buffer on read`);
11469
- buffer.set(_);
11644
+ if (_.byteLength > buffer2.byteLength)
11645
+ err(`Trying to place ${_.byteLength} bytes into a ${buffer2.byteLength} byte buffer on read`);
11646
+ buffer2.set(_);
11470
11647
  } catch (e_15) {
11471
11648
  env_15.error = e_15;
11472
11649
  env_15.hasError = true;
@@ -11476,7 +11653,7 @@ class StoreFS extends FileSystem {
11476
11653
  await result_8;
11477
11654
  }
11478
11655
  }
11479
- readSync(path, buffer, offset, end) {
11656
+ readSync(path, buffer2, offset, end) {
11480
11657
  const env_16 = { stack: [], error: undefined, hasError: false };
11481
11658
  try {
11482
11659
  const tx = __addDisposableResource(env_16, this.transaction(), false);
@@ -11485,9 +11662,9 @@ class StoreFS extends FileSystem {
11485
11662
  return;
11486
11663
  const data = tx.getSync(inode.data, offset, end) ?? _throw(withErrno("ENODATA"));
11487
11664
  const _ = tx.flag("partial") ? data : data.subarray(offset, end);
11488
- if (_.byteLength > buffer.byteLength)
11489
- err(`Trying to place ${_.byteLength} bytes into a ${buffer.byteLength} byte buffer on read`);
11490
- buffer.set(_);
11665
+ if (_.byteLength > buffer2.byteLength)
11666
+ err(`Trying to place ${_.byteLength} bytes into a ${buffer2.byteLength} byte buffer on read`);
11667
+ buffer2.set(_);
11491
11668
  } catch (e_16) {
11492
11669
  env_16.error = e_16;
11493
11670
  env_16.hasError = true;
@@ -11500,13 +11677,13 @@ class StoreFS extends FileSystem {
11500
11677
  try {
11501
11678
  const tx = __addDisposableResource(env_17, this.transaction(), true);
11502
11679
  const inode = await this.findInode(tx, path);
11503
- let buffer = data;
11680
+ let buffer2 = data;
11504
11681
  if (!tx.flag("partial")) {
11505
- buffer = extendBuffer(await tx.get(inode.data) ?? new Uint8Array, offset + data.byteLength);
11506
- buffer.set(data, offset);
11682
+ buffer2 = extendBuffer(await tx.get(inode.data) ?? new Uint8Array, offset + data.byteLength);
11683
+ buffer2.set(data, offset);
11507
11684
  offset = 0;
11508
11685
  }
11509
- await tx.set(inode.data, buffer, offset);
11686
+ await tx.set(inode.data, buffer2, offset);
11510
11687
  this._add(inode.ino, path);
11511
11688
  await tx.commit();
11512
11689
  } catch (e_17) {
@@ -11523,13 +11700,13 @@ class StoreFS extends FileSystem {
11523
11700
  try {
11524
11701
  const tx = __addDisposableResource(env_18, this.transaction(), false);
11525
11702
  const inode = this.findInodeSync(tx, path);
11526
- let buffer = data;
11703
+ let buffer2 = data;
11527
11704
  if (!tx.flag("partial")) {
11528
- buffer = extendBuffer(tx.getSync(inode.data) ?? new Uint8Array, offset + data.byteLength);
11529
- buffer.set(data, offset);
11705
+ buffer2 = extendBuffer(tx.getSync(inode.data) ?? new Uint8Array, offset + data.byteLength);
11706
+ buffer2.set(data, offset);
11530
11707
  offset = 0;
11531
11708
  }
11532
- tx.setSync(inode.data, buffer, offset);
11709
+ tx.setSync(inode.data, buffer2, offset);
11533
11710
  this._add(inode.ino, path);
11534
11711
  tx.commitSync();
11535
11712
  } catch (e_18) {
@@ -11968,16 +12145,16 @@ class DeviceFS extends StoreFS {
11968
12145
  const lastDev = Array.from(this.devices.values()).at(-1);
11969
12146
  while (this.store.has(ino) || lastDev?.inode.ino == ino)
11970
12147
  ino++;
11971
- const init = driver.init?.(ino, options);
12148
+ const init2 = driver.init?.(ino, options);
11972
12149
  const dev = {
11973
12150
  data: {},
11974
12151
  minor: 0,
11975
12152
  major: 0,
11976
- ...omit(init ?? {}, "metadata"),
12153
+ ...omit(init2 ?? {}, "metadata"),
11977
12154
  driver,
11978
12155
  inode: new Inode({
11979
12156
  mode: S_IFCHR | 438,
11980
- ...init?.metadata
12157
+ ...init2?.metadata
11981
12158
  })
11982
12159
  };
11983
12160
  const path = "/" + (dev.name || driver.name) + (driver.singleton ? "" : this.devicesWithDriver(driver).length);
@@ -12118,21 +12295,21 @@ class DeviceFS extends StoreFS {
12118
12295
  }
12119
12296
  return super.syncSync();
12120
12297
  }
12121
- async read(path, buffer, offset, end) {
12298
+ async read(path, buffer2, offset, end) {
12122
12299
  const device = this.devices.get(path);
12123
12300
  if (!device) {
12124
- await super.read(path, buffer, offset, end);
12301
+ await super.read(path, buffer2, offset, end);
12125
12302
  return;
12126
12303
  }
12127
- device.driver.read(device, buffer, offset, end);
12304
+ device.driver.read(device, buffer2, offset, end);
12128
12305
  }
12129
- readSync(path, buffer, offset, end) {
12306
+ readSync(path, buffer2, offset, end) {
12130
12307
  const device = this.devices.get(path);
12131
12308
  if (!device) {
12132
- super.readSync(path, buffer, offset, end);
12309
+ super.readSync(path, buffer2, offset, end);
12133
12310
  return;
12134
12311
  }
12135
- device.driver.read(device, buffer, offset, end);
12312
+ device.driver.read(device, buffer2, offset, end);
12136
12313
  }
12137
12314
  async write(path, data, offset) {
12138
12315
  const device = this.devices.get(path);
@@ -12169,8 +12346,8 @@ var zeroDevice = {
12169
12346
  init() {
12170
12347
  return { major: 1, minor: 5 };
12171
12348
  },
12172
- read(device, buffer, offset, end) {
12173
- buffer.fill(0, offset, end);
12349
+ read(device, buffer2, offset, end) {
12350
+ buffer2.fill(0, offset, end);
12174
12351
  },
12175
12352
  write() {
12176
12353
  return;
@@ -12182,8 +12359,8 @@ var fullDevice = {
12182
12359
  init() {
12183
12360
  return { major: 1, minor: 7 };
12184
12361
  },
12185
- read(device, buffer, offset, end) {
12186
- buffer.fill(0, offset, end);
12362
+ read(device, buffer2, offset, end) {
12363
+ buffer2.fill(0, offset, end);
12187
12364
  },
12188
12365
  write() {
12189
12366
  throw withErrno("ENOSPC");
@@ -12195,9 +12372,9 @@ var randomDevice = {
12195
12372
  init() {
12196
12373
  return { major: 1, minor: 8 };
12197
12374
  },
12198
- read(device, buffer) {
12199
- for (let i = 0;i < buffer.length; i++) {
12200
- buffer[i] = Math.floor(Math.random() * 256);
12375
+ read(device, buffer2) {
12376
+ for (let i = 0;i < buffer2.length; i++) {
12377
+ buffer2[i] = Math.floor(Math.random() * 256);
12201
12378
  }
12202
12379
  },
12203
12380
  write() {
@@ -12213,8 +12390,8 @@ var consoleDevice = {
12213
12390
  read() {
12214
12391
  return emptyBuffer;
12215
12392
  },
12216
- write(device, buffer, offset) {
12217
- const text = decodeUTF8(buffer);
12393
+ write(device, buffer2, offset) {
12394
+ const text = decodeUTF8(buffer2);
12218
12395
  device.data.output(text, offset);
12219
12396
  }
12220
12397
  };
@@ -12230,7 +12407,7 @@ __export(exports_promises, {
12230
12407
  truncate: () => truncate,
12231
12408
  symlink: () => symlink,
12232
12409
  statfs: () => statfs,
12233
- stat: () => stat,
12410
+ stat: () => stat3,
12234
12411
  rmdir: () => rmdir,
12235
12412
  rm: () => rm,
12236
12413
  rename: () => rename3,
@@ -12367,7 +12544,7 @@ class Handle {
12367
12544
  if (this._isSync)
12368
12545
  this.syncSync();
12369
12546
  }
12370
- writeSync(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
12547
+ writeSync(buffer2, offset = 0, length = buffer2.byteLength - offset, position = this.position) {
12371
12548
  if (this.closed)
12372
12549
  throw UV("EBADF", "write", this.path);
12373
12550
  if (!(this.flag & O_WRONLY || this.flag & O_RDWR))
@@ -12378,7 +12555,7 @@ class Handle {
12378
12555
  throw UV("EPERM", "write", this.path);
12379
12556
  this.dirty = true;
12380
12557
  const end = position + length;
12381
- const slice = buffer.subarray(offset, offset + length);
12558
+ const slice = buffer2.subarray(offset, offset + length);
12382
12559
  if (!isCharacterDevice(this.inode) && !isBlockDevice(this.inode) && end > this.inode.size)
12383
12560
  this.inode.size = end;
12384
12561
  this.inode.mtimeMs = Date.now();
@@ -12389,7 +12566,7 @@ class Handle {
12389
12566
  this.syncSync();
12390
12567
  return slice.byteLength;
12391
12568
  }
12392
- readSync(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
12569
+ readSync(buffer2, offset = 0, length = buffer2.byteLength - offset, position = this.position) {
12393
12570
  if (this.closed)
12394
12571
  throw UV("EBADF", "read", this.path);
12395
12572
  if (this.flag & O_WRONLY)
@@ -12403,7 +12580,7 @@ class Handle {
12403
12580
  end = position + Math.max(this.inode.size - position, 0);
12404
12581
  }
12405
12582
  this._position = end;
12406
- const uint82 = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
12583
+ const uint82 = new Uint8Array(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength);
12407
12584
  this.fs.readSync(this.internalPath, uint82.subarray(offset, offset + length), position, end);
12408
12585
  if (this._isSync)
12409
12586
  this.syncSync();
@@ -12485,7 +12662,7 @@ class Handle {
12485
12662
  if (this._isSync)
12486
12663
  await this.sync();
12487
12664
  }
12488
- async write(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
12665
+ async write(buffer2, offset = 0, length = buffer2.byteLength - offset, position = this.position) {
12489
12666
  if (this.closed)
12490
12667
  throw UV("EBADF", "write", this.path);
12491
12668
  if (!(this.flag & O_WRONLY || this.flag & O_RDWR))
@@ -12496,7 +12673,7 @@ class Handle {
12496
12673
  throw UV("EPERM", "write", this.path);
12497
12674
  this.dirty = true;
12498
12675
  const end = position + length;
12499
- const slice = buffer.subarray(offset, offset + length);
12676
+ const slice = buffer2.subarray(offset, offset + length);
12500
12677
  if (!isCharacterDevice(this.inode) && !isBlockDevice(this.inode) && end > this.inode.size)
12501
12678
  this.inode.size = end;
12502
12679
  this.inode.mtimeMs = Date.now();
@@ -12507,7 +12684,7 @@ class Handle {
12507
12684
  await this.sync();
12508
12685
  return slice.byteLength;
12509
12686
  }
12510
- async read(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
12687
+ async read(buffer2, offset = 0, length = buffer2.byteLength - offset, position = this.position) {
12511
12688
  if (this.closed)
12512
12689
  throw UV("EBADF", "read", this.path);
12513
12690
  if (this.flag & O_WRONLY)
@@ -12521,7 +12698,7 @@ class Handle {
12521
12698
  end = position + Math.max(this.inode.size - position, 0);
12522
12699
  }
12523
12700
  this._position = end;
12524
- const uint82 = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
12701
+ const uint82 = new Uint8Array(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength);
12525
12702
  await this.fs.read(this.internalPath, uint82.subarray(offset, offset + length), position, end);
12526
12703
  if (this._isSync)
12527
12704
  await this.sync();
@@ -12761,7 +12938,7 @@ function resolve2($, path, preserveSymlinks, extra) {
12761
12938
  const target2 = resolve.call($, dirname(path), readlink.call($, path));
12762
12939
  return resolve2($, target2, preserveSymlinks, extra);
12763
12940
  } catch (e) {
12764
- setUVMessage(Object.assign(e, { syscall: "stat", path }));
12941
+ setUVMessage(Object.assign(e, { syscall: "stat", path, ...extra }));
12765
12942
  if (preserveSymlinks)
12766
12943
  throw e;
12767
12944
  }
@@ -12775,7 +12952,7 @@ function resolve2($, path, preserveSymlinks, extra) {
12775
12952
  } catch (e) {
12776
12953
  if (e.code === "ENOENT")
12777
12954
  return { ...resolved, fullPath: path };
12778
- throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath }));
12955
+ throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath, ...extra }));
12779
12956
  }
12780
12957
  if (!isSymbolicLink(stats)) {
12781
12958
  return { ...resolved, fullPath: maybePath, stats };
@@ -12962,6 +13139,28 @@ function link(target, link2) {
12962
13139
  }
12963
13140
  return fs.linkSync(resolved, dst.path);
12964
13141
  }
13142
+ function stat(path, lstat) {
13143
+ path = normalizePath.call(this, path);
13144
+ const extra = { syscall: lstat ? "lstat" : "stat", path };
13145
+ let stats;
13146
+ if (!lstat)
13147
+ stats = resolve2(this, path, false, extra).stats;
13148
+ else {
13149
+ const { base, dir } = parse(path);
13150
+ const { fs, path: parent } = resolve2(this, dir, false, extra);
13151
+ try {
13152
+ stats = fs.statSync(base ? join(parent, base) : parent);
13153
+ } catch (e) {
13154
+ setUVMessage(Object.assign(e, extra));
13155
+ throw e;
13156
+ }
13157
+ }
13158
+ if (!stats)
13159
+ throw UV("ENOENT", extra);
13160
+ if (checkAccess && !hasAccess(this, stats, R_OK))
13161
+ throw UV("EACCES", extra);
13162
+ return stats;
13163
+ }
12965
13164
 
12966
13165
  // ../../node_modules/@zenfs/core/dist/node/dir.js
12967
13166
  init_buffer();
@@ -13168,25 +13367,11 @@ function existsSync(path) {
13168
13367
  }
13169
13368
  }
13170
13369
  function statSync(path, options) {
13171
- path = normalizePath(path);
13172
- const { fs, path: resolved } = resolve2(this, path);
13173
- let stats;
13174
- try {
13175
- stats = fs.statSync(resolved);
13176
- } catch (e) {
13177
- throw setUVMessage(Object.assign(e, { path }));
13178
- }
13179
- if (checkAccess && !hasAccess(this, stats, R_OK))
13180
- throw UV("EACCES", { syscall: "stat", path });
13370
+ const stats = stat.call(this, path, false);
13181
13371
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
13182
13372
  }
13183
13373
  function lstatSync(path, options) {
13184
- path = normalizePath(path);
13185
- const { base, dir } = parse(path);
13186
- const { fs, path: parent } = resolve2(this, dir);
13187
- const stats = wrap(fs, "statSync", path)(base ? join(parent, base) : parent);
13188
- if (checkAccess && !hasAccess(this, stats, R_OK))
13189
- throw UV("EACCES", { syscall: "lstat", path });
13374
+ const stats = stat.call(this, path, true);
13190
13375
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
13191
13376
  }
13192
13377
  function truncateSync(path, len2 = 0) {
@@ -13312,26 +13497,26 @@ function fdatasyncSync(fd) {
13312
13497
  fromFD(this, fd).datasyncSync();
13313
13498
  }
13314
13499
  function writeSync(fd, data, posOrOff, lenOrEnc, pos) {
13315
- let buffer, offset, length, position;
13500
+ let buffer2, offset, length, position;
13316
13501
  if (typeof data === "string") {
13317
13502
  position = typeof posOrOff === "number" ? posOrOff : null;
13318
13503
  const encoding = typeof lenOrEnc === "string" ? lenOrEnc : "utf8";
13319
13504
  offset = 0;
13320
- buffer = Buffer.from(data, encoding);
13321
- length = buffer.byteLength;
13505
+ buffer2 = Buffer.from(data, encoding);
13506
+ length = buffer2.byteLength;
13322
13507
  } else {
13323
- buffer = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
13508
+ buffer2 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
13324
13509
  offset = posOrOff;
13325
13510
  length = lenOrEnc;
13326
13511
  position = typeof pos === "number" ? pos : null;
13327
13512
  }
13328
13513
  const file = fromFD(this, fd);
13329
13514
  position ??= file.position;
13330
- const bytesWritten = file.writeSync(buffer, offset, length, position);
13515
+ const bytesWritten = file.writeSync(buffer2, offset, length, position);
13331
13516
  emitChange(this, "change", file.path);
13332
13517
  return bytesWritten;
13333
13518
  }
13334
- function readSync(fd, buffer, options, length, position) {
13519
+ function readSync(fd, buffer2, options, length, position) {
13335
13520
  const file = fromFD(this, fd);
13336
13521
  const offset = typeof options == "object" ? options.offset : options;
13337
13522
  if (typeof options == "object") {
@@ -13343,7 +13528,7 @@ function readSync(fd, buffer, options, length, position) {
13343
13528
  if (typeof position == "bigint")
13344
13529
  position = Number(position);
13345
13530
  position = Number.isSafeInteger(position) ? position : file.position;
13346
- return file.readSync(buffer, offset, length, position);
13531
+ return file.readSync(buffer2, offset, length, position);
13347
13532
  }
13348
13533
  function fchownSync(fd, uid, gid) {
13349
13534
  fromFD(this, fd).chownSync(uid, gid);
@@ -13527,16 +13712,16 @@ function copyFileSync(source, destination, flags) {
13527
13712
  function readvSync(fd, buffers, position) {
13528
13713
  const file = fromFD(this, fd);
13529
13714
  let bytesRead = 0;
13530
- for (const buffer of buffers) {
13531
- bytesRead += file.readSync(buffer, 0, buffer.byteLength, position + bytesRead);
13715
+ for (const buffer2 of buffers) {
13716
+ bytesRead += file.readSync(buffer2, 0, buffer2.byteLength, position + bytesRead);
13532
13717
  }
13533
13718
  return bytesRead;
13534
13719
  }
13535
13720
  function writevSync(fd, buffers, position) {
13536
13721
  const file = fromFD(this, fd);
13537
13722
  let bytesWritten = 0;
13538
- for (const buffer of buffers) {
13539
- bytesWritten += file.writeSync(new Uint8Array(buffer.buffer), 0, buffer.byteLength, position + bytesWritten);
13723
+ for (const buffer2 of buffers) {
13724
+ bytesWritten += file.writeSync(new Uint8Array(buffer2.buffer), 0, buffer2.byteLength, position + bytesWritten);
13540
13725
  }
13541
13726
  return bytesWritten;
13542
13727
  }
@@ -13585,23 +13770,35 @@ function statfsSync(path, options) {
13585
13770
  function globSync(pattern2, options = {}) {
13586
13771
  pattern2 = Array.isArray(pattern2) ? pattern2 : [pattern2];
13587
13772
  const { cwd = "/", withFileTypes = false, exclude = () => false } = options;
13588
- const regexPatterns = pattern2.map(globToRegex);
13773
+ const normalizedPatterns = pattern2.map((p) => p.replace(/^\/+/g, ""));
13774
+ const hasGlobStar = normalizedPatterns.some((p) => p.includes("**"));
13775
+ const patternBases = normalizedPatterns.map((p) => {
13776
+ const firstGlob = p.search(/[*?[\]{]/);
13777
+ if (firstGlob === -1)
13778
+ return p;
13779
+ const lastSlash = p.lastIndexOf("/", firstGlob);
13780
+ return lastSlash === -1 ? "" : p.slice(0, lastSlash);
13781
+ });
13782
+ const regexPatterns = normalizedPatterns.map(globToRegex);
13589
13783
  const results = [];
13590
13784
  function recursiveList(dir) {
13591
13785
  const entries2 = readdirSync(dir, { withFileTypes, encoding: "utf8" });
13592
13786
  for (const entry of entries2) {
13593
- const fullPath = withFileTypes ? join(entry.parentPath, entry.name) : dir + "/" + entry;
13787
+ const fullPath = join(dir, withFileTypes ? entry.name : entry);
13594
13788
  if (typeof exclude != "function" ? exclude.some((p) => matchesGlob(p, fullPath)) : exclude(withFileTypes ? entry : fullPath))
13595
13789
  continue;
13596
- if (statSync(fullPath).isDirectory() && regexPatterns.some((pattern3) => pattern3.source.includes(".*"))) {
13597
- recursiveList(fullPath);
13790
+ const relativePath = fullPath.replace(/^\/+/g, "");
13791
+ if (statSync(fullPath).isDirectory()) {
13792
+ if (hasGlobStar || patternBases.some((base) => relativePath === base || base.startsWith(relativePath + "/"))) {
13793
+ recursiveList(fullPath);
13794
+ }
13598
13795
  }
13599
- if (regexPatterns.some((pattern3) => pattern3.test(fullPath.replace(/^\/+/g, "")))) {
13600
- results.push(withFileTypes ? entry : fullPath.replace(/^\/+/g, ""));
13796
+ if (regexPatterns.some((rx) => rx.test(relativePath))) {
13797
+ results.push(withFileTypes ? entry : relativePath);
13601
13798
  }
13602
13799
  }
13603
13800
  }
13604
- recursiveList(cwd);
13801
+ recursiveList(cwd instanceof URL ? cwd.pathname : cwd);
13605
13802
  return results;
13606
13803
  }
13607
13804
 
@@ -13761,7 +13958,7 @@ async function resolve3($, path, preserveSymlinks, extra) {
13761
13958
  const stats = await resolved.fs.stat(resolved.path).catch((e) => {
13762
13959
  if (e.code == "ENOENT")
13763
13960
  return;
13764
- throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath }));
13961
+ throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath, ...extra }));
13765
13962
  });
13766
13963
  if (!stats)
13767
13964
  return { ...resolved, fullPath: path };
@@ -13939,6 +14136,23 @@ async function link2(target, link3) {
13939
14136
  }
13940
14137
  return await fs.link(resolved, dst.path);
13941
14138
  }
14139
+ async function stat2(path, lstat) {
14140
+ path = normalizePath.call(this, path);
14141
+ const extra = { syscall: lstat ? "lstat" : "stat", path };
14142
+ let stats;
14143
+ if (!lstat)
14144
+ stats = (await resolve3(this, path, false, extra)).stats;
14145
+ else {
14146
+ const { base, dir } = parse(path);
14147
+ const { fs, path: parent } = await resolve3(this, dir, false, extra);
14148
+ stats = await fs.stat(base ? join(parent, base) : parent).catch(rethrow(extra));
14149
+ }
14150
+ if (!stats)
14151
+ throw UV("ENOENT", extra);
14152
+ if (checkAccess && !hasAccess(this, stats, R_OK))
14153
+ throw UV("EACCES", extra);
14154
+ return stats;
14155
+ }
13942
14156
 
13943
14157
  // ../../node_modules/@zenfs/core/dist/node/readline.js
13944
14158
  class Interface extends import__.default {
@@ -14546,27 +14760,27 @@ class FileHandle {
14546
14760
  await this.vfs.write(encodedData, 0, encodedData.length);
14547
14761
  this._emitChange();
14548
14762
  }
14549
- async read(buffer, offset, length, position) {
14763
+ async read(buffer2, offset, length, position) {
14550
14764
  if (typeof offset == "object" && offset != null) {
14551
14765
  position = offset.position;
14552
14766
  length = offset.length;
14553
14767
  offset = offset.offset;
14554
14768
  }
14555
- if (!ArrayBuffer.isView(buffer) && typeof buffer == "object") {
14556
- position = buffer.position;
14557
- length = buffer.length;
14558
- offset = buffer.offset;
14559
- buffer = buffer.buffer;
14769
+ if (!ArrayBuffer.isView(buffer2) && typeof buffer2 == "object") {
14770
+ position = buffer2.position;
14771
+ length = buffer2.length;
14772
+ offset = buffer2.offset;
14773
+ buffer2 = buffer2.buffer;
14560
14774
  }
14561
14775
  if (position && position > Number.MAX_SAFE_INTEGER)
14562
14776
  throw UV("EINVAL");
14563
14777
  if (typeof position == "bigint")
14564
14778
  position = Number(position);
14565
14779
  position = Number.isSafeInteger(position) ? position : this.vfs.position;
14566
- buffer ||= new Uint8Array(this.vfs.inode.size);
14780
+ buffer2 ||= new Uint8Array(this.vfs.inode.size);
14567
14781
  offset ??= 0;
14568
- const bytesRead = await this.vfs.read(buffer, offset, length ?? buffer.byteLength - offset, position);
14569
- return { bytesRead, buffer };
14782
+ const bytesRead = await this.vfs.read(buffer2, offset, length ?? buffer2.byteLength - offset, position);
14783
+ return { bytesRead, buffer: buffer2 };
14570
14784
  }
14571
14785
  async readFile(_options) {
14572
14786
  const options = normalizeOptions(_options, null, "r", 292);
@@ -14576,8 +14790,8 @@ class FileHandle {
14576
14790
  const { size } = await this.stat();
14577
14791
  const data = new Uint8Array(size);
14578
14792
  await this.vfs.read(data, 0, size, 0);
14579
- const buffer = Buffer.from(data);
14580
- return options.encoding ? buffer.toString(options.encoding) : buffer;
14793
+ const buffer2 = Buffer.from(data);
14794
+ return options.encoding ? buffer2.toString(options.encoding) : buffer2;
14581
14795
  }
14582
14796
  readableWebStream(options = {}) {
14583
14797
  if (this.vfs.isClosed)
@@ -14607,7 +14821,7 @@ class FileHandle {
14607
14821
  return opts?.bigint ? new BigIntStats(this.vfs.inode) : new Stats(this.vfs.inode);
14608
14822
  }
14609
14823
  async write(data, options, lenOrEnc, position) {
14610
- let buffer, offset, length;
14824
+ let buffer2, offset, length;
14611
14825
  if (typeof options == "object" && options != null) {
14612
14826
  lenOrEnc = options.length;
14613
14827
  position = options.position;
@@ -14616,16 +14830,16 @@ class FileHandle {
14616
14830
  if (typeof data === "string") {
14617
14831
  position = typeof options === "number" ? options : null;
14618
14832
  offset = 0;
14619
- buffer = Buffer.from(data, typeof lenOrEnc === "string" ? lenOrEnc : "utf8");
14620
- length = buffer.length;
14833
+ buffer2 = Buffer.from(data, typeof lenOrEnc === "string" ? lenOrEnc : "utf8");
14834
+ length = buffer2.length;
14621
14835
  } else {
14622
- buffer = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
14836
+ buffer2 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
14623
14837
  offset = options ?? 0;
14624
- length = typeof lenOrEnc == "number" ? lenOrEnc : buffer.byteLength;
14838
+ length = typeof lenOrEnc == "number" ? lenOrEnc : buffer2.byteLength;
14625
14839
  position = typeof position === "number" ? position : null;
14626
14840
  }
14627
14841
  position ??= this.vfs.position;
14628
- const bytesWritten = await this.vfs.write(buffer, offset, length, position);
14842
+ const bytesWritten = await this.vfs.write(buffer2, offset, length, position);
14629
14843
  this._emitChange();
14630
14844
  return { buffer: data, bytesWritten };
14631
14845
  }
@@ -14646,8 +14860,8 @@ class FileHandle {
14646
14860
  if (typeof position == "number")
14647
14861
  this.vfs.position = position;
14648
14862
  let bytesWritten = 0;
14649
- for (const buffer of buffers) {
14650
- bytesWritten += (await this.write(buffer)).bytesWritten;
14863
+ for (const buffer2 of buffers) {
14864
+ bytesWritten += (await this.write(buffer2)).bytesWritten;
14651
14865
  }
14652
14866
  return { bytesWritten, buffers };
14653
14867
  }
@@ -14655,8 +14869,8 @@ class FileHandle {
14655
14869
  if (typeof position == "number")
14656
14870
  this.vfs.position = position;
14657
14871
  let bytesRead = 0;
14658
- for (const buffer of buffers) {
14659
- bytesRead += (await this.read(buffer)).bytesRead;
14872
+ for (const buffer2 of buffers) {
14873
+ bytesRead += (await this.read(buffer2)).bytesRead;
14660
14874
  }
14661
14875
  return { bytesRead, buffers };
14662
14876
  }
@@ -14690,23 +14904,12 @@ async function exists(path) {
14690
14904
  throw e;
14691
14905
  }
14692
14906
  }
14693
- async function stat(path, options) {
14694
- path = normalizePath(path);
14695
- const { fs, path: resolved } = await resolve3(this, path);
14696
- const $ex = { syscall: "stat", path };
14697
- const stats = await fs.stat(resolved).catch(rethrow($ex));
14698
- if (checkAccess && !hasAccess(this, stats, R_OK))
14699
- throw UV("EACCES", $ex);
14907
+ async function stat3(path, options) {
14908
+ const stats = await stat2.call(this, path, false);
14700
14909
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
14701
14910
  }
14702
14911
  async function lstat(path, options) {
14703
- path = normalizePath(path);
14704
- const $ex = { syscall: "lstat", path };
14705
- const { base, dir } = parse(path);
14706
- const { fs, path: parent } = await resolve3(this, dir);
14707
- const stats = await fs.stat(base ? join(parent, base) : parent).catch(rethrow($ex));
14708
- if (checkAccess && !hasAccess(this, stats, R_OK))
14709
- throw UV("EACCES", $ex);
14912
+ const stats = await stat2.call(this, path, true);
14710
14913
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
14711
14914
  }
14712
14915
  async function truncate(path, len2 = 0) {
@@ -15006,7 +15209,7 @@ function watch(filename, options = {}) {
15006
15209
  async function access(path, mode = F_OK) {
15007
15210
  if (!checkAccess)
15008
15211
  return;
15009
- const stats = await stat.call(this, path);
15212
+ const stats = await stat3.call(this, path);
15010
15213
  if (!stats.hasAccess(mode, this))
15011
15214
  throw UV("EACCES", "access", path.toString());
15012
15215
  }
@@ -15110,22 +15313,34 @@ async function statfs(path, opts) {
15110
15313
  function glob(pattern2, opt) {
15111
15314
  pattern2 = Array.isArray(pattern2) ? pattern2 : [pattern2];
15112
15315
  const { cwd = "/", withFileTypes = false, exclude = () => false } = opt || {};
15113
- const regexPatterns = pattern2.map(globToRegex);
15316
+ const normalizedPatterns = pattern2.map((p) => p.replace(/^\/+/g, ""));
15317
+ const hasGlobStar = normalizedPatterns.some((p) => p.includes("**"));
15318
+ const patternBases = normalizedPatterns.map((p) => {
15319
+ const firstGlob = p.search(/[*?[\]{]/);
15320
+ if (firstGlob === -1)
15321
+ return p;
15322
+ const lastSlash = p.lastIndexOf("/", firstGlob);
15323
+ return lastSlash === -1 ? "" : p.slice(0, lastSlash);
15324
+ });
15325
+ const regexPatterns = normalizedPatterns.map(globToRegex);
15114
15326
  async function* recursiveList(dir) {
15115
15327
  const entries2 = await readdir2(dir, { withFileTypes, encoding: "utf8" });
15116
15328
  for (const entry of entries2) {
15117
- const fullPath = withFileTypes ? join(entry.parentPath, entry.name) : dir + "/" + entry;
15329
+ const fullPath = join(dir, withFileTypes ? entry.name : entry);
15118
15330
  if (typeof exclude != "function" ? exclude.some((p) => matchesGlob(p, fullPath)) : exclude(withFileTypes ? entry : fullPath))
15119
15331
  continue;
15120
- if ((await stat(fullPath)).isDirectory() && regexPatterns.some((pattern3) => pattern3.source.includes(".*"))) {
15121
- yield* recursiveList(fullPath);
15332
+ const relativePath = fullPath.replace(/^\/+/g, "");
15333
+ if ((await stat3(fullPath)).isDirectory()) {
15334
+ if (hasGlobStar || patternBases.some((base) => relativePath === base || base.startsWith(relativePath + "/"))) {
15335
+ yield* recursiveList(fullPath);
15336
+ }
15122
15337
  }
15123
- if (regexPatterns.some((pattern3) => pattern3.test(fullPath.replace(/^\/+/g, "")))) {
15124
- yield withFileTypes ? entry : fullPath.replace(/^\/+/g, "");
15338
+ if (regexPatterns.some((rx) => rx.test(relativePath))) {
15339
+ yield withFileTypes ? entry : relativePath;
15125
15340
  }
15126
15341
  }
15127
15342
  }
15128
- return recursiveList(cwd);
15343
+ return recursiveList(cwd instanceof URL ? cwd.pathname : cwd);
15129
15344
  }
15130
15345
 
15131
15346
  // ../../node_modules/@zenfs/core/dist/config.js
@@ -15178,7 +15393,7 @@ async function mountWithMkdir(path, fs) {
15178
15393
  mount(path, fs);
15179
15394
  return;
15180
15395
  }
15181
- const stats = await stat(path).catch(() => null);
15396
+ const stats = await stat3(path).catch(() => null);
15182
15397
  if (!stats) {
15183
15398
  await mkdir3(path, { recursive: true });
15184
15399
  } else if (!stats.isDirectory()) {
@@ -15219,7 +15434,7 @@ async function configure2(configuration) {
15219
15434
  if (configuration.defaultDirectories) {
15220
15435
  for (const dir of _defaultDirectories) {
15221
15436
  if (await exists(dir)) {
15222
- const stats = await stat(dir);
15437
+ const stats = await stat3(dir);
15223
15438
  if (!stats.isDirectory())
15224
15439
  exports_log.warn("Default directory exists but is not a directory: " + dir);
15225
15440
  } else
@@ -15233,8 +15448,8 @@ var journalOperations = new Set(["delete"]);
15233
15448
  var maxOpLength = Math.max(...journalOperations.values().map((op) => op.length));
15234
15449
  // ../../node_modules/utilium/dist/requests.js
15235
15450
  var resourcesCache = new Map;
15236
- async function _fetch(input, init = {}, bodyOptional = false) {
15237
- const response = await fetch(input, init).catch((error2) => {
15451
+ async function _fetch(input, init2 = {}, bodyOptional = false) {
15452
+ const response = await fetch(input, init2).catch((error2) => {
15238
15453
  throw { tag: "fetch", message: error2.message };
15239
15454
  });
15240
15455
  if (!response.ok)
@@ -15246,10 +15461,10 @@ async function _fetch(input, init = {}, bodyOptional = false) {
15246
15461
  });
15247
15462
  return { response, data: raw ? new Uint8Array(raw) : undefined };
15248
15463
  }
15249
- async function get(url, options, init = {}) {
15250
- const req = new Request(url, init);
15464
+ async function get2(url, options, init2 = {}) {
15465
+ const req = new Request(url, init2);
15251
15466
  if (typeof options.start != "number" || typeof options.end != "number") {
15252
- const { data } = await _fetch(url, init);
15467
+ const { data } = await _fetch(url, init2);
15253
15468
  new Resource(url, data.byteLength, options, resourcesCache).add(data, 0);
15254
15469
  return data;
15255
15470
  }
@@ -15310,14 +15525,14 @@ function getCached(url, options) {
15310
15525
  }
15311
15526
  return { data, missing: cache.missing(start, end) };
15312
15527
  }
15313
- async function set(url, data, options, init = {}) {
15528
+ async function set2(url, data, options, init2 = {}) {
15314
15529
  if (!resourcesCache.has(url)) {
15315
15530
  new Resource(url, options.size ?? data.byteLength, options, resourcesCache);
15316
15531
  }
15317
15532
  const resource = resourcesCache.get(url);
15318
15533
  const { offset = 0, method = "POST" } = options;
15319
15534
  if (!options.cacheOnly) {
15320
- const headers = new Headers(init.headers || {});
15535
+ const headers = new Headers(init2.headers || {});
15321
15536
  if (!headers.get("Content-Type")) {
15322
15537
  headers.set("Content-Type", "application/octet-stream");
15323
15538
  }
@@ -15328,7 +15543,7 @@ async function set(url, data, options, init = {}) {
15328
15543
  headers.set("Content-Range", `bytes ${start}-${end}/${total}`);
15329
15544
  }
15330
15545
  await _fetch(new Request(url, {
15331
- ...init,
15546
+ ...init2,
15332
15547
  method,
15333
15548
  headers,
15334
15549
  body: data.buffer instanceof ArrayBuffer ? data : Uint8Array.from(data)
@@ -15336,9 +15551,9 @@ async function set(url, data, options, init = {}) {
15336
15551
  }
15337
15552
  resource.add(data, offset);
15338
15553
  }
15339
- async function remove(url, options = {}, init = {}) {
15554
+ async function remove(url, options = {}, init2 = {}) {
15340
15555
  if (!options.cacheOnly)
15341
- await _fetch(new Request(url, init), { method: "DELETE" }, true);
15556
+ await _fetch(new Request(url, init2), { method: "DELETE" }, true);
15342
15557
  resourcesCache.delete(url);
15343
15558
  }
15344
15559
 
@@ -15564,20 +15779,20 @@ class FetchFS extends IndexFS {
15564
15779
  removeSync(path) {
15565
15780
  this._async(remove(this.baseUrl + path, { warn, cacheOnly: !this.remoteWrite }, this.requestInit));
15566
15781
  }
15567
- async read(path, buffer, offset = 0, end) {
15782
+ async read(path, buffer2, offset = 0, end) {
15568
15783
  const inode = this.index.get(path);
15569
15784
  if (!inode)
15570
15785
  throw withErrno("ENOENT");
15571
15786
  if (end - offset == 0)
15572
15787
  return;
15573
- const data = await get(this.baseUrl + path, { start: offset, end, size: inode.size, warn }, this.requestInit).catch(parseError).catch(() => {
15788
+ const data = await get2(this.baseUrl + path, { start: offset, end, size: inode.size, warn }, this.requestInit).catch(parseError).catch(() => {
15574
15789
  return;
15575
15790
  });
15576
15791
  if (!data)
15577
15792
  throw withErrno("ENODATA");
15578
- buffer.set(data);
15793
+ buffer2.set(data);
15579
15794
  }
15580
- readSync(path, buffer, offset = 0, end) {
15795
+ readSync(path, buffer2, offset = 0, end) {
15581
15796
  const inode = this.index.get(path);
15582
15797
  if (!inode)
15583
15798
  throw withErrno("ENOENT");
@@ -15587,24 +15802,24 @@ class FetchFS extends IndexFS {
15587
15802
  if (!data)
15588
15803
  throw withErrno("ENODATA");
15589
15804
  if (missing.length) {
15590
- this._async(get(this.baseUrl + path, { start: offset, end, size: inode.size, warn }));
15805
+ this._async(get2(this.baseUrl + path, { start: offset, end, size: inode.size, warn }));
15591
15806
  throw withErrno("EAGAIN");
15592
15807
  }
15593
- buffer.set(data);
15808
+ buffer2.set(data);
15594
15809
  }
15595
15810
  async write(path, data, offset) {
15596
15811
  const inode = this.index.get(path);
15597
15812
  if (!inode)
15598
15813
  throw withErrno("ENOENT");
15599
15814
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
15600
- await set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError);
15815
+ await set2(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError);
15601
15816
  }
15602
15817
  writeSync(path, data, offset) {
15603
15818
  const inode = this.index.get(path);
15604
15819
  if (!inode)
15605
15820
  throw withErrno("ENOENT");
15606
15821
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
15607
- this._async(set(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError));
15822
+ this._async(set2(this.baseUrl + path, data, { offset, warn, cacheOnly: !this.remoteWrite }, this.requestInit).catch(parseError));
15608
15823
  }
15609
15824
  }
15610
15825
  // ../../node_modules/@zenfs/core/dist/backends/passthrough.js
@@ -15921,14 +16136,14 @@ function Async(FS) {
15921
16136
  this.checkSync();
15922
16137
  return this._sync.existsSync(path);
15923
16138
  }
15924
- readSync(path, buffer, offset, end) {
16139
+ readSync(path, buffer2, offset, end) {
15925
16140
  this.checkSync();
15926
- this._sync.readSync(path, buffer, offset, end);
16141
+ this._sync.readSync(path, buffer2, offset, end);
15927
16142
  }
15928
- writeSync(path, buffer, offset) {
16143
+ writeSync(path, buffer2, offset) {
15929
16144
  this.checkSync();
15930
- this._sync.writeSync(path, buffer, offset);
15931
- this._async(() => this.write(path, buffer, offset));
16145
+ this._sync.writeSync(path, buffer2, offset);
16146
+ this._async(() => this.write(path, buffer2, offset));
15932
16147
  }
15933
16148
  streamWrite(path, options) {
15934
16149
  this.checkSync();
@@ -15951,9 +16166,9 @@ function Async(FS) {
15951
16166
  const stats = await this.stat(path);
15952
16167
  if (!isDirectory(stats)) {
15953
16168
  this._sync.createFileSync(path, stats);
15954
- const buffer = new Uint8Array(stats.size);
15955
- await this.read(path, buffer, 0, stats.size);
15956
- this._sync.writeSync(path, buffer, 0);
16169
+ const buffer2 = new Uint8Array(stats.size);
16170
+ await this.read(path, buffer2, 0, stats.size);
16171
+ this._sync.writeSync(path, buffer2, 0);
15957
16172
  this._sync.touchSync(path, stats);
15958
16173
  return;
15959
16174
  }
@@ -16075,30 +16290,13 @@ class PortFS extends Async(FileSystem) {
16075
16290
  link(srcpath, dstpath) {
16076
16291
  return this.rpc("link", srcpath, dstpath);
16077
16292
  }
16078
- async read(path, buffer, start, end) {
16079
- buffer.set(await this.rpc("read", path, buffer, start, end));
16293
+ async read(path, buffer2, start, end) {
16294
+ buffer2.set(await this.rpc("read", path, buffer2, start, end));
16080
16295
  }
16081
- write(path, buffer, offset) {
16082
- return this.rpc("write", path, buffer, offset);
16083
- }
16084
- }
16085
- // ../../node_modules/utilium/dist/checksum.js
16086
- var crc32cTable = new Uint32Array(256);
16087
- for (let i2 = 0;i2 < 256; i2++) {
16088
- let value = i2;
16089
- for (let j = 0;j < 8; j++) {
16090
- value = value & 1 ? 2197175160 ^ value >>> 1 : value >>> 1;
16091
- }
16092
- crc32cTable[i2] = value;
16093
- }
16094
- function crc32c(data) {
16095
- let crc = 4294967295;
16096
- for (let i2 = 0;i2 < data.length; i2++) {
16097
- crc = crc >>> 8 ^ crc32cTable[(crc ^ data[i2]) & 255];
16296
+ write(path, buffer2, offset) {
16297
+ return this.rpc("write", path, buffer2, offset);
16098
16298
  }
16099
- return (crc ^ 4294967295) >>> 0;
16100
16299
  }
16101
-
16102
16300
  // ../../node_modules/@zenfs/core/dist/backends/single_buffer.js
16103
16301
  var __esDecorate2 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
16104
16302
  function accept(f) {
@@ -16196,7 +16394,7 @@ var { format: format2 } = new Intl.NumberFormat("en-US", {
16196
16394
  });
16197
16395
  var MetadataEntry = (() => {
16198
16396
  var _a, _b, _c, _d;
16199
- let _classDecorators = [struct.packed("MetadataEntry")];
16397
+ let _classDecorators = [struct.packed()];
16200
16398
  let _classDescriptor;
16201
16399
  let _classExtraInitializers = [];
16202
16400
  let _classThis;
@@ -16239,8 +16437,8 @@ var MetadataEntry = (() => {
16239
16437
  MetadataEntry2 = _classThis = _classDescriptor.value;
16240
16438
  if (_metadata)
16241
16439
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16242
- __runInitializers2(_classThis, _classExtraInitializers);
16243
16440
  }
16441
+ static name = "MetadataEntry";
16244
16442
  #id_accessor_storage = __runInitializers2(this, _id_initializers, undefined);
16245
16443
  get id() {
16246
16444
  return this.#id_accessor_storage;
@@ -16276,6 +16474,9 @@ var MetadataEntry = (() => {
16276
16474
  super(...arguments);
16277
16475
  __runInitializers2(this, _size_extraInitializers);
16278
16476
  }
16477
+ static {
16478
+ __runInitializers2(_classThis, _classExtraInitializers);
16479
+ }
16279
16480
  };
16280
16481
  return MetadataEntry2 = _classThis;
16281
16482
  })();
@@ -16283,7 +16484,7 @@ var entries_per_block = 255;
16283
16484
  var max_lock_attempts = 5;
16284
16485
  var MetadataBlock = (() => {
16285
16486
  var _a, _b, _c, _d;
16286
- let _classDecorators = [struct.packed("MetadataBlock")];
16487
+ let _classDecorators = [struct.packed()];
16287
16488
  let _classDescriptor;
16288
16489
  let _classExtraInitializers = [];
16289
16490
  let _classThis;
@@ -16312,7 +16513,7 @@ var MetadataBlock = (() => {
16312
16513
  _checksum_decorators = [(_a = types3).uint32.bind(_a)];
16313
16514
  _timestamp_decorators = [(_b = types3).uint64.bind(_b)];
16314
16515
  _previous_offset_decorators = [(_c = types3).uint32.bind(_c)];
16315
- _items_decorators = [field(array(MetadataEntry, entries_per_block))];
16516
+ _items_decorators = [field(array2(MetadataEntry, entries_per_block))];
16316
16517
  _locked_decorators = [(_d = types3).int32.bind(_d)];
16317
16518
  __esDecorate2(this, null, _checksum_decorators, { kind: "accessor", name: "checksum", static: false, private: false, access: { has: (obj) => ("checksum" in obj), get: (obj) => obj.checksum, set: (obj, value) => {
16318
16519
  obj.checksum = value;
@@ -16334,7 +16535,8 @@ var MetadataBlock = (() => {
16334
16535
  if (_metadata)
16335
16536
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16336
16537
  }
16337
- static lockIndex = offsetof(MetadataBlock2, "locked") / Int32Array.BYTES_PER_ELEMENT;
16538
+ static name = "MetadataBlock";
16539
+ static lockIndex;
16338
16540
  #checksum_accessor_storage = __runInitializers2(this, _checksum_initializers, undefined);
16339
16541
  get checksum() {
16340
16542
  return this.#checksum_accessor_storage;
@@ -16432,11 +16634,12 @@ var MetadataBlock = (() => {
16432
16634
  };
16433
16635
  return MetadataBlock2 = _classThis;
16434
16636
  })();
16637
+ Object.assign(MetadataBlock, { lockIndex: offsetof(MetadataBlock, "locked") / Int32Array.BYTES_PER_ELEMENT });
16435
16638
  var sb_magic = 1651715706;
16436
16639
  var usedBytes = 2;
16437
16640
  var SuperBlock = (() => {
16438
16641
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16439
- let _classDecorators = [struct.packed("Superblock")];
16642
+ let _classDecorators = [struct.packed()];
16440
16643
  let _classDescriptor;
16441
16644
  let _classExtraInitializers = [];
16442
16645
  let _classThis;
@@ -16542,8 +16745,8 @@ var SuperBlock = (() => {
16542
16745
  SuperBlock2 = _classThis = _classDescriptor.value;
16543
16746
  if (_metadata)
16544
16747
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16545
- __runInitializers2(_classThis, _classExtraInitializers);
16546
16748
  }
16749
+ static name = "SuperBlock";
16547
16750
  constructor(...args) {
16548
16751
  super(...args);
16549
16752
  __runInitializers2(this, __padding_extraInitializers);
@@ -16565,11 +16768,11 @@ var SuperBlock = (() => {
16565
16768
  _update(md);
16566
16769
  return;
16567
16770
  }
16568
- if (this.checksum !== checksum(this))
16771
+ if (this.checksum !== checksum2(this))
16569
16772
  throw crit(withErrno("EIO", "sbfs: checksum mismatch for super block"));
16570
16773
  this.metadata = new MetadataBlock(this.buffer, this.metadata_offset);
16571
- if (this.metadata.checksum !== checksum(this.metadata))
16572
- throw crit(withErrno("EIO", `sbfs: checksum mismatch for metadata block (saved ${hex(this.metadata.checksum)}, computed ${hex(checksum(this.metadata))})`));
16774
+ if (this.metadata.checksum !== checksum2(this.metadata))
16775
+ throw crit(withErrno("EIO", `sbfs: checksum mismatch for metadata block (saved ${hex(this.metadata.checksum)}, computed ${hex(checksum2(this.metadata))})`));
16573
16776
  if (this.inode_format != _inode_version)
16574
16777
  throw crit(withErrno("EIO", "sbfs: inode format mismatch"));
16575
16778
  if (this.metadata_block_size != sizeof(MetadataBlock))
@@ -16698,10 +16901,13 @@ var SuperBlock = (() => {
16698
16901
  }
16699
16902
  return true;
16700
16903
  }
16904
+ static {
16905
+ __runInitializers2(_classThis, _classExtraInitializers);
16906
+ }
16701
16907
  };
16702
16908
  return SuperBlock2 = _classThis;
16703
16909
  })();
16704
- function checksum(value) {
16910
+ function checksum2(value) {
16705
16911
  let length = sizeof(value) - 4;
16706
16912
  if (value instanceof MetadataBlock)
16707
16913
  length -= Int32Array.BYTES_PER_ELEMENT;
@@ -16710,7 +16916,7 @@ function checksum(value) {
16710
16916
  function _update(value) {
16711
16917
  if (value instanceof MetadataBlock)
16712
16918
  value.timestamp = BigInt(Date.now());
16713
- value.checksum = checksum(value);
16919
+ value.checksum = checksum2(value);
16714
16920
  }
16715
16921
  // ../../node_modules/@zenfs/core/dist/node/async.js
16716
16922
  init_buffer();
@@ -16728,9 +16934,9 @@ function rename4(oldPath, newPath, cb = nop) {
16728
16934
  function exists2(path, cb = nop) {
16729
16935
  exists.call(this, path).then(cb).catch(() => cb(false));
16730
16936
  }
16731
- function stat2(path, options, callback = nop) {
16937
+ function stat4(path, options, callback = nop) {
16732
16938
  callback = typeof options == "function" ? options : callback;
16733
- stat.call(this, path, typeof options != "function" ? options : {}).then((stats) => callback(null, stats)).catch(callback);
16939
+ stat3.call(this, path, typeof options != "function" ? options : {}).then((stats) => callback(null, stats)).catch(callback);
16734
16940
  }
16735
16941
  function lstat2(path, options, callback = nop) {
16736
16942
  callback = typeof options == "function" ? options : callback;
@@ -16784,7 +16990,7 @@ function fdatasync(fd, cb = nop) {
16784
16990
  new FileHandle(this, fd).datasync().then(() => cb(null)).catch(cb);
16785
16991
  }
16786
16992
  function write2(fd, data, cbPosOff, cbLenEnc, cbPosEnc, cb = nop) {
16787
- let buffer, offset, length, position, encoding;
16993
+ let buffer2, offset, length, position, encoding;
16788
16994
  const handle = new FileHandle(this, fd);
16789
16995
  if (typeof data === "string") {
16790
16996
  encoding = "utf8";
@@ -16802,22 +17008,22 @@ function write2(fd, data, cbPosOff, cbLenEnc, cbPosEnc, cb = nop) {
16802
17008
  cb(withErrno("EINVAL"));
16803
17009
  return;
16804
17010
  }
16805
- buffer = Buffer.from(data);
17011
+ buffer2 = Buffer.from(data);
16806
17012
  offset = 0;
16807
- length = buffer.length;
17013
+ length = buffer2.length;
16808
17014
  const _cb = cb;
16809
- handle.write(buffer, offset, length, position).then(({ bytesWritten }) => _cb(null, bytesWritten, buffer.toString(encoding))).catch(_cb);
17015
+ handle.write(buffer2, offset, length, position).then(({ bytesWritten }) => _cb(null, bytesWritten, buffer2.toString(encoding))).catch(_cb);
16810
17016
  } else {
16811
- buffer = Buffer.from(data.buffer);
17017
+ buffer2 = Buffer.from(data.buffer);
16812
17018
  offset = cbPosOff;
16813
17019
  length = cbLenEnc;
16814
17020
  position = typeof cbPosEnc === "number" ? cbPosEnc : null;
16815
17021
  const _cb = typeof cbPosEnc === "function" ? cbPosEnc : cb;
16816
- handle.write(buffer, offset, length, position).then(({ bytesWritten }) => _cb(null, bytesWritten, buffer)).catch(_cb);
17022
+ handle.write(buffer2, offset, length, position).then(({ bytesWritten }) => _cb(null, bytesWritten, buffer2)).catch(_cb);
16817
17023
  }
16818
17024
  }
16819
- function read2(fd, buffer, offset, length, position, cb = nop) {
16820
- new FileHandle(this, fd).read(buffer, offset, length, position).then(({ bytesRead, buffer: buffer2 }) => cb(null, bytesRead, buffer2)).catch(cb);
17025
+ function read2(fd, buffer2, offset, length, position, cb = nop) {
17026
+ new FileHandle(this, fd).read(buffer2, offset, length, position).then(({ bytesRead, buffer: buffer3 }) => cb(null, bytesRead, buffer3)).catch(cb);
16821
17027
  }
16822
17028
  function fchown(fd, uid, gid, cb = nop) {
16823
17029
  new FileHandle(this, fd).chown(uid, gid).then(() => cb(null)).catch(cb);
@@ -16971,9 +17177,9 @@ function statfs2(path, options, callback = nop) {
16971
17177
  }
16972
17178
  async function openAsBlob(path, options) {
16973
17179
  const handle = await open3.call(this, path.toString(), "r");
16974
- const buffer = await handle.readFile();
17180
+ const buffer2 = await handle.readFile();
16975
17181
  await handle.close();
16976
- return new Blob([buffer], options);
17182
+ return new Blob([buffer2], options);
16977
17183
  }
16978
17184
  function glob2(pattern2, options, callback = nop) {
16979
17185
  callback = typeof options == "function" ? options : callback;
@@ -16985,20 +17191,20 @@ init_buffer();
16985
17191
  var exports_xattr = {};
16986
17192
  __export(exports_xattr, {
16987
17193
  setSync: () => setSync,
16988
- set: () => set2,
17194
+ set: () => set3,
16989
17195
  removeSync: () => removeSync,
16990
17196
  remove: () => remove2,
16991
17197
  listSync: () => listSync,
16992
17198
  list: () => list2,
16993
17199
  getSync: () => getSync,
16994
- get: () => get2
17200
+ get: () => get3
16995
17201
  });
16996
17202
  var _allowedRestrictedNames = [];
16997
17203
  function checkName($, name, path, syscall) {
16998
17204
  if (!name.startsWith("user.") && !_allowedRestrictedNames.includes(name))
16999
17205
  throw UV("ENOTSUP", syscall, path);
17000
17206
  }
17001
- async function get2(path, name, opt = {}) {
17207
+ async function get3(path, name, opt = {}) {
17002
17208
  path = normalizePath(path);
17003
17209
  const { fs: fs2, path: resolved } = resolveMount(path, this);
17004
17210
  checkName(this, name, path, "xattr.get");
@@ -17009,8 +17215,8 @@ async function get2(path, name, opt = {}) {
17009
17215
  const value = inode.attributes.get(name);
17010
17216
  if (!value)
17011
17217
  throw UV("ENODATA", "xattr.get", path);
17012
- const buffer = Buffer.from(value);
17013
- return opt.encoding == "buffer" || !opt.encoding ? buffer : buffer.toString(opt.encoding);
17218
+ const buffer2 = Buffer.from(value);
17219
+ return opt.encoding == "buffer" || !opt.encoding ? buffer2 : buffer2.toString(opt.encoding);
17014
17220
  }
17015
17221
  function getSync(path, name, opt = {}) {
17016
17222
  path = normalizePath(path);
@@ -17028,10 +17234,10 @@ function getSync(path, name, opt = {}) {
17028
17234
  const value = inode.attributes.get(name);
17029
17235
  if (!value)
17030
17236
  throw UV("ENODATA", "xattr.get", path);
17031
- const buffer = Buffer.from(value);
17032
- return opt.encoding == "buffer" || !opt.encoding ? buffer : buffer.toString(opt.encoding);
17237
+ const buffer2 = Buffer.from(value);
17238
+ return opt.encoding == "buffer" || !opt.encoding ? buffer2 : buffer2.toString(opt.encoding);
17033
17239
  }
17034
- async function set2(path, name, value, opt = {}) {
17240
+ async function set3(path, name, value, opt = {}) {
17035
17241
  path = normalizePath(path);
17036
17242
  const { fs: fs2, path: resolved } = resolveMount(path, this);
17037
17243
  checkName(this, name, path, "xattr.set");
@@ -17229,11 +17435,11 @@ function Sync(FS) {
17229
17435
  async sync() {
17230
17436
  return this.syncSync();
17231
17437
  }
17232
- async read(path, buffer, offset, end) {
17233
- return this.readSync(path, buffer, offset, end);
17438
+ async read(path, buffer2, offset, end) {
17439
+ return this.readSync(path, buffer2, offset, end);
17234
17440
  }
17235
- async write(path, buffer, offset) {
17236
- return this.writeSync(path, buffer, offset);
17441
+ async write(path, buffer2, offset) {
17442
+ return this.writeSync(path, buffer2, offset);
17237
17443
  }
17238
17444
  }
17239
17445
  return SyncFS;
@@ -17263,7 +17469,7 @@ __export(exports_compat, {
17263
17469
  statfsSync: () => statfsSync,
17264
17470
  statfs: () => statfs2,
17265
17471
  statSync: () => statSync,
17266
- stat: () => stat2,
17472
+ stat: () => stat4,
17267
17473
  rmdirSync: () => rmdirSync,
17268
17474
  rmdir: () => rmdir2,
17269
17475
  rmSync: () => rmSync,
@@ -17428,7 +17634,7 @@ var XFlag;
17428
17634
  })(XFlag || (XFlag = {}));
17429
17635
  var fsxattr = (() => {
17430
17636
  var _a, _b, _c, _d, _e;
17431
- let _classDecorators = [struct("fsxattr")];
17637
+ let _classDecorators = [struct()];
17432
17638
  let _classDescriptor;
17433
17639
  let _classExtraInitializers = [];
17434
17640
  let _classThis;
@@ -17485,8 +17691,8 @@ var fsxattr = (() => {
17485
17691
  fsxattr2 = _classThis = _classDescriptor.value;
17486
17692
  if (_metadata)
17487
17693
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17488
- __runInitializers3(_classThis, _classExtraInitializers);
17489
17694
  }
17695
+ static name = "fsxattr";
17490
17696
  #xflags_accessor_storage = __runInitializers3(this, _xflags_initializers, undefined);
17491
17697
  get xflags() {
17492
17698
  return this.#xflags_accessor_storage;
@@ -17543,6 +17749,9 @@ var fsxattr = (() => {
17543
17749
  this.xflags |= XFlag[name];
17544
17750
  }
17545
17751
  }
17752
+ static {
17753
+ __runInitializers3(_classThis, _classExtraInitializers);
17754
+ }
17546
17755
  };
17547
17756
  return fsxattr2 = _classThis;
17548
17757
  })();
@@ -17689,7 +17898,7 @@ function ioctlSync(path, command, ...args) {
17689
17898
  // ../../node_modules/@zenfs/core/package.json
17690
17899
  var package_default = {
17691
17900
  name: "@zenfs/core",
17692
- version: "2.5.0",
17901
+ version: "2.5.6",
17693
17902
  description: "A filesystem, anywhere",
17694
17903
  funding: {
17695
17904
  type: "individual",
@@ -17760,26 +17969,24 @@ var package_default = {
17760
17969
  prepublishOnly: "npm run build"
17761
17970
  },
17762
17971
  dependencies: {
17763
- "@types/node": "^24.1.0",
17972
+ "@types/node": "^25.2.0",
17764
17973
  buffer: "^6.0.3",
17765
17974
  eventemitter3: "^5.0.1",
17766
17975
  kerium: "^1.3.4",
17767
- memium: "^0.3.10",
17976
+ memium: "^0.4.0",
17768
17977
  "readable-stream": "^4.5.2",
17769
- utilium: "^2.5.0"
17978
+ utilium: "^3.0.0"
17770
17979
  },
17771
17980
  devDependencies: {
17772
- "@eslint/js": "^9.8.0",
17773
- "@octokit/action": "^7.0.0",
17774
- "@types/eslint__js": "^8.42.3",
17775
- c8: "^10.1.2",
17981
+ "@octokit/action": "^8.0.4",
17982
+ c8: "^10.1.3",
17776
17983
  eslint: "^9.15.0",
17777
- globals: "^16.0.0",
17984
+ globals: "^17.3.0",
17778
17985
  prettier: "^3.2.5",
17779
17986
  tsx: "^4.19.1",
17780
- typedoc: "^0.28.0",
17781
- typescript: "^5.7.2",
17782
- "typescript-eslint": "^8.16.0"
17987
+ typedoc: "^0.28.18",
17988
+ typescript: "^6.0.0",
17989
+ "typescript-eslint": "^8.58.0"
17783
17990
  }
17784
17991
  };
17785
17992
 
@@ -17854,14 +18061,14 @@ function convertException(ex, path) {
17854
18061
  }
17855
18062
 
17856
18063
  // ../../node_modules/@zenfs/dom/dist/access.js
17857
- function _isShared(buffer) {
17858
- return typeof buffer == "object" && buffer !== null && buffer.constructor.name == "SharedArrayBuffer";
17859
- }
17860
- function isResizable(buffer) {
17861
- if (buffer instanceof ArrayBuffer)
17862
- return buffer.resizable;
17863
- if (_isShared(buffer))
17864
- return buffer.growable;
18064
+ function _isShared(buffer2) {
18065
+ return typeof buffer2 == "object" && buffer2 !== null && buffer2.constructor.name == "SharedArrayBuffer";
18066
+ }
18067
+ function isResizable(buffer2) {
18068
+ if (buffer2 instanceof ArrayBuffer)
18069
+ return buffer2.resizable;
18070
+ if (_isShared(buffer2))
18071
+ return buffer2.growable;
17865
18072
  return false;
17866
18073
  }
17867
18074
  function isKind(handle, kind) {
@@ -17949,7 +18156,7 @@ class WebAccessFS extends Async(IndexFS) {
17949
18156
  removeSync() {
17950
18157
  throw exports_log.crit(withErrno("ENOSYS"));
17951
18158
  }
17952
- async read(path, buffer, offset, end) {
18159
+ async read(path, buffer2, offset, end) {
17953
18160
  if (end <= offset)
17954
18161
  return;
17955
18162
  const handle = await this.get("file", path);
@@ -17962,13 +18169,13 @@ class WebAccessFS extends Async(IndexFS) {
17962
18169
  `path: ${path}`
17963
18170
  ].join(`
17964
18171
  ` + " ".repeat(24))));
17965
- buffer.set(new Uint8Array(data, offset, end - offset));
18172
+ buffer2.set(new Uint8Array(data, offset, end - offset));
17966
18173
  }
17967
- async write(path, buffer, offset) {
17968
- if (isResizable(buffer.buffer) || _isShared(buffer.buffer)) {
17969
- const newBuffer = new Uint8Array(new ArrayBuffer(buffer.byteLength), buffer.byteOffset, buffer.byteLength);
17970
- newBuffer.set(buffer);
17971
- buffer = newBuffer;
18174
+ async write(path, buffer2, offset) {
18175
+ if (isResizable(buffer2.buffer) || _isShared(buffer2.buffer)) {
18176
+ const newBuffer = new Uint8Array(new ArrayBuffer(buffer2.byteLength), buffer2.byteOffset, buffer2.byteLength);
18177
+ newBuffer.set(buffer2);
18178
+ buffer2 = newBuffer;
17972
18179
  }
17973
18180
  const inode2 = this.index.get(path);
17974
18181
  if (!inode2)
@@ -17996,7 +18203,7 @@ class WebAccessFS extends Async(IndexFS) {
17996
18203
  } catch {
17997
18204
  await writable.write({ type: "seek", position: offset });
17998
18205
  }
17999
- await writable.write(buffer);
18206
+ await writable.write(buffer2);
18000
18207
  await writable.close();
18001
18208
  const { size, lastModified } = await handle.getFile();
18002
18209
  inode2.update({ size, mtimeMs: lastModified });
@@ -18287,14 +18494,14 @@ class XMLFS extends Sync(FileSystem) {
18287
18494
  set_stats(node, metadata);
18288
18495
  }
18289
18496
  syncSync() {}
18290
- readSync(path, buffer, offset, end) {
18497
+ readSync(path, buffer2, offset, end) {
18291
18498
  const node = this.get("read", path);
18292
18499
  const raw = encodeASCII(node.textContent.slice(offset, end));
18293
- buffer.set(raw);
18500
+ buffer2.set(raw);
18294
18501
  }
18295
- writeSync(path, buffer, offset) {
18502
+ writeSync(path, buffer2, offset) {
18296
18503
  const node = this.get("write", path);
18297
- const data = decodeASCII(buffer);
18504
+ const data = decodeASCII(buffer2);
18298
18505
  const after = node.textContent.slice(offset + data.length);
18299
18506
  node.textContent = node.textContent.slice(0, offset) + data + after;
18300
18507
  }