@uipath/filesystem 0.1.6 → 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.
@@ -4,39 +4,60 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
- var __moduleCache = /* @__PURE__ */ new WeakMap;
19
32
  var __toCommonJS = (from) => {
20
- var entry = __moduleCache.get(from), desc;
33
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
21
34
  if (entry)
22
35
  return entry;
23
36
  entry = __defProp({}, "__esModule", { value: true });
24
- if (from && typeof from === "object" || typeof from === "function")
25
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
26
- get: () => from[key],
27
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
- }));
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (var key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(entry, key))
40
+ __defProp(entry, key, {
41
+ get: __accessProp.bind(from, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
29
45
  __moduleCache.set(from, entry);
30
46
  return entry;
31
47
  };
48
+ var __moduleCache;
32
49
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
50
+ var __returnValue = (v) => v;
51
+ function __exportSetter(name, newValue) {
52
+ this[name] = __returnValue.bind(null, newValue);
53
+ }
33
54
  var __export = (target, all) => {
34
55
  for (var name in all)
35
56
  __defProp(target, name, {
36
57
  get: all[name],
37
58
  enumerable: true,
38
59
  configurable: true,
39
- set: (newValue) => all[name] = () => newValue
60
+ set: __exportSetter.bind(all, name)
40
61
  });
41
62
  };
42
63
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -1555,7 +1576,7 @@ var init_buffer = __esm(() => {
1555
1576
  buffer_default = Buffer;
1556
1577
  });
1557
1578
 
1558
- // ../../node_modules/readable-stream/lib/ours/primordials.js
1579
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/ours/primordials.js
1559
1580
  var require_primordials = __commonJS((exports, module) => {
1560
1581
  class AggregateError extends Error {
1561
1582
  constructor(errors) {
@@ -1673,7 +1694,7 @@ var require_primordials = __commonJS((exports, module) => {
1673
1694
  };
1674
1695
  });
1675
1696
 
1676
- // ../../node_modules/readable-stream/lib/ours/util/inspect.js
1697
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/ours/util/inspect.js
1677
1698
  var require_inspect = __commonJS((exports, module) => {
1678
1699
  module.exports = {
1679
1700
  format(format2, ...args) {
@@ -1721,7 +1742,7 @@ var require_inspect = __commonJS((exports, module) => {
1721
1742
  };
1722
1743
  });
1723
1744
 
1724
- // ../../node_modules/readable-stream/lib/ours/errors.js
1745
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/ours/errors.js
1725
1746
  var require_errors = __commonJS((exports, module) => {
1726
1747
  var { format: format2, inspect } = require_inspect();
1727
1748
  var { AggregateError: CustomAggregateError } = require_primordials();
@@ -2391,7 +2412,7 @@ var init_events = __esm(() => {
2391
2412
  events_default = EventEmitter2;
2392
2413
  });
2393
2414
 
2394
- // ../../node_modules/readable-stream/lib/ours/util.js
2415
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/ours/util.js
2395
2416
  var require_util = __commonJS((exports, module) => {
2396
2417
  var bufferModule = (init_buffer(), __toCommonJS(exports_buffer));
2397
2418
  var { format: format2, inspect } = require_inspect();
@@ -2403,9 +2424,9 @@ var require_util = __commonJS((exports, module) => {
2403
2424
  var AbortController = globalThis.AbortController || require_browser().AbortController;
2404
2425
  var AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
2405
2426
  var Blob3 = globalThis.Blob || bufferModule.Blob;
2406
- var isBlob = typeof Blob3 !== "undefined" ? function isBlob(b) {
2427
+ var isBlob = typeof Blob3 !== "undefined" ? function isBlob2(b) {
2407
2428
  return b instanceof Blob3;
2408
- } : function isBlob(b) {
2429
+ } : function isBlob2(b) {
2409
2430
  return false;
2410
2431
  };
2411
2432
  var validateAbortSignal2 = (signal, name) => {
@@ -2471,7 +2492,7 @@ var require_util = __commonJS((exports, module) => {
2471
2492
  deprecate(fn, message) {
2472
2493
  return fn;
2473
2494
  },
2474
- addAbortListener: (init_events(), __toCommonJS(exports_events)).addAbortListener || function addAbortListener(signal, listener) {
2495
+ addAbortListener: (init_events(), __toCommonJS(exports_events)).addAbortListener || function addAbortListener2(signal, listener) {
2475
2496
  if (signal === undefined) {
2476
2497
  throw new ERR_INVALID_ARG_TYPE3("signal", "AbortSignal", signal);
2477
2498
  }
@@ -2521,7 +2542,7 @@ var require_util = __commonJS((exports, module) => {
2521
2542
  module.exports.promisify.custom = Symbol.for("nodejs.util.promisify.custom");
2522
2543
  });
2523
2544
 
2524
- // ../../node_modules/readable-stream/lib/internal/validators.js
2545
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/validators.js
2525
2546
  var require_validators = __commonJS((exports, module) => {
2526
2547
  var {
2527
2548
  ArrayIsArray,
@@ -2935,7 +2956,7 @@ var require_browser2 = __commonJS((exports, module) => {
2935
2956
  };
2936
2957
  });
2937
2958
 
2938
- // ../../node_modules/readable-stream/lib/internal/streams/utils.js
2959
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/utils.js
2939
2960
  var require_utils = __commonJS((exports, module) => {
2940
2961
  var { SymbolAsyncIterator, SymbolIterator, SymbolFor: SymbolFor2 } = require_primordials();
2941
2962
  var kIsDestroyed = SymbolFor2("nodejs.stream.destroyed");
@@ -3166,7 +3187,7 @@ var require_utils = __commonJS((exports, module) => {
3166
3187
  };
3167
3188
  });
3168
3189
 
3169
- // ../../node_modules/readable-stream/lib/internal/streams/end-of-stream.js
3190
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
3170
3191
  var require_end_of_stream = __commonJS((exports, module) => {
3171
3192
  var process = require_browser2();
3172
3193
  var { AbortError: AbortError2, codes } = require_errors();
@@ -3411,7 +3432,7 @@ var require_end_of_stream = __commonJS((exports, module) => {
3411
3432
  module.exports.finished = finished;
3412
3433
  });
3413
3434
 
3414
- // ../../node_modules/readable-stream/lib/internal/streams/destroy.js
3435
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/destroy.js
3415
3436
  var require_destroy = __commonJS((exports, module) => {
3416
3437
  var process = require_browser2();
3417
3438
  var {
@@ -3673,7 +3694,7 @@ var require_destroy = __commonJS((exports, module) => {
3673
3694
  };
3674
3695
  });
3675
3696
 
3676
- // ../../node_modules/readable-stream/lib/internal/streams/legacy.js
3697
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/legacy.js
3677
3698
  var require_legacy = __commonJS((exports, module) => {
3678
3699
  var { ArrayIsArray, ObjectSetPrototypeOf } = require_primordials();
3679
3700
  var { EventEmitter: EE } = (init_events(), __toCommonJS(exports_events));
@@ -3755,7 +3776,7 @@ var require_legacy = __commonJS((exports, module) => {
3755
3776
  };
3756
3777
  });
3757
3778
 
3758
- // ../../node_modules/readable-stream/lib/internal/streams/add-abort-signal.js
3779
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js
3759
3780
  var require_add_abort_signal = __commonJS((exports, module) => {
3760
3781
  var { SymbolDispose } = require_primordials();
3761
3782
  var { AbortError: AbortError2, codes } = require_errors();
@@ -3799,7 +3820,7 @@ var require_add_abort_signal = __commonJS((exports, module) => {
3799
3820
  };
3800
3821
  });
3801
3822
 
3802
- // ../../node_modules/readable-stream/lib/internal/streams/buffer_list.js
3823
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/buffer_list.js
3803
3824
  var require_buffer_list = __commonJS((exports, module) => {
3804
3825
  var { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array: Uint8Array2 } = require_primordials();
3805
3826
  var { Buffer: Buffer2 } = (init_buffer(), __toCommonJS(exports_buffer));
@@ -3958,7 +3979,7 @@ var require_buffer_list = __commonJS((exports, module) => {
3958
3979
  };
3959
3980
  });
3960
3981
 
3961
- // ../../node_modules/readable-stream/lib/internal/streams/state.js
3982
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/state.js
3962
3983
  var require_state = __commonJS((exports, module) => {
3963
3984
  var { MathFloor, NumberIsInteger } = require_primordials();
3964
3985
  var { validateInteger } = require_validators();
@@ -3997,7 +4018,7 @@ var require_state = __commonJS((exports, module) => {
3997
4018
  };
3998
4019
  });
3999
4020
 
4000
- // ../../node_modules/safe-buffer/index.js
4021
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/node_modules/string_decoder/node_modules/safe-buffer/index.js
4001
4022
  var require_safe_buffer = __commonJS((exports, module) => {
4002
4023
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4003
4024
  var buffer2 = (init_buffer(), __toCommonJS(exports_buffer));
@@ -4054,7 +4075,7 @@ var require_safe_buffer = __commonJS((exports, module) => {
4054
4075
  };
4055
4076
  });
4056
4077
 
4057
- // ../../node_modules/string_decoder/lib/string_decoder.js
4078
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/node_modules/string_decoder/lib/string_decoder.js
4058
4079
  var require_string_decoder = __commonJS((exports) => {
4059
4080
  var Buffer2 = require_safe_buffer().Buffer;
4060
4081
  var isEncoding = Buffer2.isEncoding || function(encoding) {
@@ -4311,7 +4332,7 @@ var require_string_decoder = __commonJS((exports) => {
4311
4332
  }
4312
4333
  });
4313
4334
 
4314
- // ../../node_modules/readable-stream/lib/internal/streams/from.js
4335
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/from.js
4315
4336
  var require_from = __commonJS((exports, module) => {
4316
4337
  var process = require_browser2();
4317
4338
  var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
@@ -4397,7 +4418,7 @@ var require_from = __commonJS((exports, module) => {
4397
4418
  module.exports = from2;
4398
4419
  });
4399
4420
 
4400
- // ../../node_modules/readable-stream/lib/internal/streams/readable.js
4421
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/readable.js
4401
4422
  var require_readable = __commonJS((exports, module) => {
4402
4423
  var process = require_browser2();
4403
4424
  var {
@@ -5387,7 +5408,7 @@ var require_readable = __commonJS((exports, module) => {
5387
5408
  };
5388
5409
  });
5389
5410
 
5390
- // ../../node_modules/readable-stream/lib/internal/streams/writable.js
5411
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/writable.js
5391
5412
  var require_writable = __commonJS((exports, module) => {
5392
5413
  var process = require_browser2();
5393
5414
  var {
@@ -6013,7 +6034,7 @@ var require_writable = __commonJS((exports, module) => {
6013
6034
  };
6014
6035
  });
6015
6036
 
6016
- // ../../node_modules/readable-stream/lib/internal/streams/duplexify.js
6037
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/duplexify.js
6017
6038
  var require_duplexify = __commonJS((exports, module) => {
6018
6039
  var process = require_browser2();
6019
6040
  var bufferModule = (init_buffer(), __toCommonJS(exports_buffer));
@@ -6040,9 +6061,9 @@ var require_duplexify = __commonJS((exports, module) => {
6040
6061
  var { createDeferredPromise } = require_util();
6041
6062
  var from2 = require_from();
6042
6063
  var Blob3 = globalThis.Blob || bufferModule.Blob;
6043
- var isBlob = typeof Blob3 !== "undefined" ? function isBlob(b) {
6064
+ var isBlob = typeof Blob3 !== "undefined" ? function isBlob2(b) {
6044
6065
  return b instanceof Blob3;
6045
- } : function isBlob(b) {
6066
+ } : function isBlob2(b) {
6046
6067
  return false;
6047
6068
  };
6048
6069
  var AbortController = globalThis.AbortController || require_browser().AbortController;
@@ -6338,7 +6359,7 @@ var require_duplexify = __commonJS((exports, module) => {
6338
6359
  }
6339
6360
  });
6340
6361
 
6341
- // ../../node_modules/readable-stream/lib/internal/streams/duplex.js
6362
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/duplex.js
6342
6363
  var require_duplex = __commonJS((exports, module) => {
6343
6364
  var {
6344
6365
  ObjectDefineProperties,
@@ -6455,7 +6476,7 @@ var require_duplex = __commonJS((exports, module) => {
6455
6476
  };
6456
6477
  });
6457
6478
 
6458
- // ../../node_modules/readable-stream/lib/internal/streams/transform.js
6479
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/transform.js
6459
6480
  var require_transform = __commonJS((exports, module) => {
6460
6481
  var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials();
6461
6482
  module.exports = Transform;
@@ -6551,7 +6572,7 @@ var require_transform = __commonJS((exports, module) => {
6551
6572
  };
6552
6573
  });
6553
6574
 
6554
- // ../../node_modules/readable-stream/lib/internal/streams/passthrough.js
6575
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/passthrough.js
6555
6576
  var require_passthrough = __commonJS((exports, module) => {
6556
6577
  var { ObjectSetPrototypeOf } = require_primordials();
6557
6578
  module.exports = PassThrough;
@@ -6568,7 +6589,7 @@ var require_passthrough = __commonJS((exports, module) => {
6568
6589
  };
6569
6590
  });
6570
6591
 
6571
- // ../../node_modules/readable-stream/lib/internal/streams/pipeline.js
6592
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/pipeline.js
6572
6593
  var require_pipeline = __commonJS((exports, module) => {
6573
6594
  var process = require_browser2();
6574
6595
  var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
@@ -6965,7 +6986,7 @@ var require_pipeline = __commonJS((exports, module) => {
6965
6986
  };
6966
6987
  });
6967
6988
 
6968
- // ../../node_modules/readable-stream/lib/internal/streams/compose.js
6989
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/compose.js
6969
6990
  var require_compose = __commonJS((exports, module) => {
6970
6991
  var { pipeline } = require_pipeline();
6971
6992
  var Duplex = require_duplex();
@@ -7152,7 +7173,7 @@ var require_compose = __commonJS((exports, module) => {
7152
7173
  };
7153
7174
  });
7154
7175
 
7155
- // ../../node_modules/readable-stream/lib/internal/streams/operators.js
7176
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/internal/streams/operators.js
7156
7177
  var require_operators = __commonJS((exports, module) => {
7157
7178
  var AbortController = globalThis.AbortController || require_browser().AbortController;
7158
7179
  var {
@@ -7218,7 +7239,7 @@ var require_operators = __commonJS((exports, module) => {
7218
7239
  validateInteger(concurrency, "options.concurrency", 1);
7219
7240
  validateInteger(highWaterMark, "options.highWaterMark", 0);
7220
7241
  highWaterMark += concurrency;
7221
- return async function* map() {
7242
+ return async function* map2() {
7222
7243
  const signal = require_util().AbortSignalAny([options === null || options === undefined ? undefined : options.signal].filter(Boolean2));
7223
7244
  const stream = this;
7224
7245
  const queue = [];
@@ -7324,7 +7345,7 @@ var require_operators = __commonJS((exports, module) => {
7324
7345
  if ((options === null || options === undefined ? undefined : options.signal) != null) {
7325
7346
  validateAbortSignal2(options.signal, "options.signal");
7326
7347
  }
7327
- return async function* asIndexedPairs() {
7348
+ return async function* asIndexedPairs2() {
7328
7349
  let index = 0;
7329
7350
  for await (const val of this) {
7330
7351
  var _options$signal;
@@ -7463,7 +7484,7 @@ var require_operators = __commonJS((exports, module) => {
7463
7484
  }
7464
7485
  function flatMap(fn, options) {
7465
7486
  const values = map.call(this, fn, options);
7466
- return async function* flatMap() {
7487
+ return async function* flatMap2() {
7467
7488
  for await (const val of values) {
7468
7489
  yield* val;
7469
7490
  }
@@ -7487,7 +7508,7 @@ var require_operators = __commonJS((exports, module) => {
7487
7508
  validateAbortSignal2(options.signal, "options.signal");
7488
7509
  }
7489
7510
  number = toIntegerOrInfinity(number);
7490
- return async function* drop() {
7511
+ return async function* drop2() {
7491
7512
  var _options$signal5;
7492
7513
  if (options !== null && options !== undefined && (_options$signal5 = options.signal) !== null && _options$signal5 !== undefined && _options$signal5.aborted) {
7493
7514
  throw new AbortError2;
@@ -7511,7 +7532,7 @@ var require_operators = __commonJS((exports, module) => {
7511
7532
  validateAbortSignal2(options.signal, "options.signal");
7512
7533
  }
7513
7534
  number = toIntegerOrInfinity(number);
7514
- return async function* take() {
7535
+ return async function* take2() {
7515
7536
  var _options$signal7;
7516
7537
  if (options !== null && options !== undefined && (_options$signal7 = options.signal) !== null && _options$signal7 !== undefined && _options$signal7.aborted) {
7517
7538
  throw new AbortError2;
@@ -7549,7 +7570,7 @@ var require_operators = __commonJS((exports, module) => {
7549
7570
  };
7550
7571
  });
7551
7572
 
7552
- // ../../node_modules/readable-stream/lib/stream/promises.js
7573
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/stream/promises.js
7553
7574
  var require_promises = __commonJS((exports, module) => {
7554
7575
  var { ArrayPrototypePop, Promise: Promise2 } = require_primordials();
7555
7576
  var { isIterable, isNodeStream, isWebStream } = require_utils();
@@ -7584,7 +7605,7 @@ var require_promises = __commonJS((exports, module) => {
7584
7605
  };
7585
7606
  });
7586
7607
 
7587
- // ../../node_modules/readable-stream/lib/stream.js
7608
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/stream.js
7588
7609
  var require_stream = __commonJS((exports, module) => {
7589
7610
  var { Buffer: Buffer2 } = (init_buffer(), __toCommonJS(exports_buffer));
7590
7611
  var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials();
@@ -7700,7 +7721,7 @@ var require_stream = __commonJS((exports, module) => {
7700
7721
  };
7701
7722
  });
7702
7723
 
7703
- // ../../node_modules/readable-stream/lib/ours/browser.js
7724
+ // ../../node_modules/@zenfs/core/node_modules/readable-stream/lib/ours/browser.js
7704
7725
  var require_browser3 = __commonJS((exports, module) => {
7705
7726
  var CustomStream = require_stream();
7706
7727
  var promises = require_promises();
@@ -8830,80 +8851,14 @@ var S_IXOTH = 1;
8830
8851
  var UV_FS_O_FILEMAP = 0;
8831
8852
  var size_max = 4294967295;
8832
8853
 
8833
- // ../../node_modules/memium/dist/array.js
8834
- function StructArray(type) {
8835
- class StructArray2 extends DataView {
8836
- length;
8837
- type = type;
8838
- *[Symbol.iterator]() {
8839
- for (let i = 0;i < this.length; i++)
8840
- yield this[i];
8841
- }
8842
- constructor(lengthOrBuffer, byteOffset, byteLength) {
8843
- const buffer2 = typeof lengthOrBuffer === "object" ? lengthOrBuffer : new ArrayBuffer((lengthOrBuffer ?? 0) * type.size);
8844
- super(buffer2, byteOffset, byteLength);
8845
- this.length = typeof lengthOrBuffer === "number" ? lengthOrBuffer : Math.floor(this.byteLength / type.size);
8846
- return new Proxy(this, {
8847
- get(target, index) {
8848
- if (index in target)
8849
- return target[index];
8850
- const i = parseInt(index.toString());
8851
- if (!Number.isSafeInteger(i))
8852
- throw withErrno("EINVAL", "Invalid index: " + index.toString());
8853
- return type.get(target.buffer, target.byteOffset + i * type.size);
8854
- },
8855
- set(target, index, value) {
8856
- const i = parseInt(index.toString());
8857
- if (!Number.isSafeInteger(i))
8858
- throw withErrno("EINVAL", "Invalid index: " + index.toString());
8859
- type.set(target.buffer, target.byteOffset + i * type.size, value);
8860
- return true;
8861
- }
8862
- });
8863
- }
8864
- }
8865
- for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
8866
- if (!key.startsWith("get") && !key.startsWith("set"))
8867
- continue;
8868
- Object.defineProperty(StructArray2.prototype, key, {
8869
- enumerable: false,
8870
- configurable: false,
8871
- writable: false,
8872
- value: undefined
8873
- });
8874
- }
8875
- return StructArray2;
8876
- }
8877
-
8878
- class ArrayType {
8879
- type;
8880
- length;
8881
- name;
8882
- size;
8883
- __arrayType;
8884
- constructor(type, length) {
8885
- this.type = type;
8886
- this.length = length;
8887
- this.name = `${type.name}[${length}]`;
8888
- this.size = type.size * length;
8889
- this.array = StructArray(this);
8890
- this.__arrayType = type.array ? type.array : StructArray(type);
8891
- }
8892
- get = (buffer2, offset) => {
8893
- return new this.__arrayType(buffer2, offset, this.size);
8894
- };
8895
- set = (buffer2, offset, value) => {
8896
- for (let i = 0;i < this.length; i++) {
8897
- this.type.set(buffer2, offset + i * this.type.size, value[i]);
8898
- }
8899
- };
8900
- array;
8901
- }
8902
8854
  // ../../node_modules/memium/dist/types.js
8855
+ function isArrayType(type) {
8856
+ return "__isArrayType" in type && type.__isArrayType === true;
8857
+ }
8903
8858
  function isType(type) {
8904
8859
  if (typeof type != "object" && typeof type != "function" || type === null || type === undefined)
8905
8860
  return false;
8906
- if (type instanceof ArrayType)
8861
+ if (isArrayType(type))
8907
8862
  return isType(type.type);
8908
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;
8909
8864
  }
@@ -8914,93 +8869,6 @@ function registerType(t) {
8914
8869
  typeRegistry.set(t.name, t);
8915
8870
  }
8916
8871
 
8917
- // ../../node_modules/memium/dist/fields.js
8918
- function parseFieldConfig(init) {
8919
- if (isType(init))
8920
- return { type: init };
8921
- if (init instanceof FieldBuilder)
8922
- return init.toInit();
8923
- return init;
8924
- }
8925
-
8926
- class FieldBuilder {
8927
- type;
8928
- init;
8929
- constructor(type, init) {
8930
- this.type = type;
8931
- this.init = init;
8932
- const _toArray = (length) => {
8933
- return new FieldBuilder(new ArrayType(type, length), init);
8934
- };
8935
- Object.setPrototypeOf(_toArray, new.target.prototype);
8936
- Object.assign(_toArray, { type, init });
8937
- return _toArray;
8938
- }
8939
- align(align) {
8940
- return new FieldBuilder(this.type, { ...this.init, align });
8941
- }
8942
- countedBy(field) {
8943
- return new FieldBuilder(this.type, { ...this.init, countedBy: field });
8944
- }
8945
- bigEndian() {
8946
- return new FieldBuilder(this.type, { ...this.init, bigEndian: true });
8947
- }
8948
- toInit() {
8949
- return { type: this.type, ...this.init };
8950
- }
8951
- $type() {
8952
- return new FieldBuilder(this.type, this.init);
8953
- }
8954
- }
8955
- function array2(type, length = 0) {
8956
- return new FieldBuilder(new ArrayType(type, length), {});
8957
- }
8958
-
8959
- // ../../node_modules/memium/dist/fields.internal.js
8960
- function __fieldInit(_name, init, extraOpts = {}) {
8961
- if (!_name)
8962
- throw withErrno("EINVAL", "Invalid name for struct field");
8963
- if (typeof _name == "symbol")
8964
- console.warn("Symbol used for struct field name will be coerced to string: " + _name.toString());
8965
- const name = _name.toString();
8966
- const opt = Object.assign(parseFieldConfig(init), extraOpts);
8967
- if (!isType(opt.type))
8968
- throw withErrno("EINVAL", `Invalid type for struct field "${name}"`);
8969
- return {
8970
- name,
8971
- offset: 0,
8972
- type: opt.type,
8973
- countedBy: opt.countedBy,
8974
- alignment: opt.align ?? opt.type.size,
8975
- 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}`,
8976
- littleEndian: !opt.bigEndian
8977
- };
8978
- }
8979
- function __fault(err2) {
8980
- if (err2.message !== "offset is outside the bounds of the DataView")
8981
- throw err2;
8982
- else
8983
- throw withErrno("EFAULT", "Segmentation fault");
8984
- }
8985
- function __fieldSet(instance, field, value, index) {
8986
- try {
8987
- if (typeof value == "string")
8988
- value = value.charCodeAt(0);
8989
- const offset = instance.byteOffset + field.offset + (index ?? 0) * field.type.size;
8990
- field.type.set(instance.buffer, offset, value);
8991
- return;
8992
- } catch (err2) {
8993
- __fault(err2);
8994
- }
8995
- }
8996
- function __fieldGet(instance, field) {
8997
- try {
8998
- return field.type.get(instance.buffer, instance.byteOffset + field.offset);
8999
- } catch (err2) {
9000
- __fault(err2);
9001
- }
9002
- }
9003
-
9004
8872
  // ../../node_modules/memium/dist/primitives.js
9005
8873
  var __view__ = Symbol("DataView");
9006
8874
  function view(buffer2) {
@@ -9109,6 +8977,294 @@ function normalize(type) {
9109
8977
  return type == "char" ? "uint8" : type.toLowerCase();
9110
8978
  }
9111
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
+ }
9112
9268
  // ../../node_modules/memium/dist/decorators.js
9113
9269
  Symbol.metadata ??= Symbol.for("Symbol.metadata");
9114
9270
  function initMetadata(context) {
@@ -9119,19 +9275,19 @@ function initMetadata(context) {
9119
9275
  };
9120
9276
  return context.metadata.structInit;
9121
9277
  }
9122
- function struct(name, ...options) {
9278
+ function struct(...options) {
9123
9279
  const opts = options.reduce((acc, opt) => ({ ...acc, ...opt }), {});
9124
9280
  if (typeof this == "object")
9125
9281
  Object.assign(opts, this);
9126
9282
  return function __decorateStruct(target, context) {
9127
- const init = initMetadata(context);
9283
+ const init2 = initMetadata(context);
9128
9284
  let fieldAlignment = 1;
9129
- const fields = {};
9285
+ const fields = [];
9130
9286
  let size = 0;
9131
9287
  const align = (to) => {
9132
9288
  size = Math.ceil(size / to) * to;
9133
9289
  };
9134
- for (const field of init.fields) {
9290
+ for (const field of init2.fields) {
9135
9291
  if (!opts.isPacked)
9136
9292
  align(field.alignment);
9137
9293
  if (opts.isUnion)
@@ -9140,20 +9296,32 @@ function struct(name, ...options) {
9140
9296
  field.offset = size;
9141
9297
  size += field.type.size;
9142
9298
  }
9143
- fields[field.name] = field;
9299
+ fields.push(field);
9144
9300
  fieldAlignment = Math.max(fieldAlignment, field.alignment);
9145
9301
  }
9146
9302
  opts.alignment ??= fieldAlignment;
9147
9303
  if (!opts.isPacked)
9148
9304
  align(opts.alignment);
9149
- context.metadata.struct = {
9150
- fields,
9151
- size,
9152
- alignment: opts.isPacked ? 1 : opts.alignment,
9153
- isUnion: opts.isUnion ?? false
9154
- };
9155
9305
 
9156
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}]`;
9157
9325
  constructor(...args) {
9158
9326
  if (!args.length)
9159
9327
  args = [new ArrayBuffer(size), 0, size];
@@ -9163,39 +9331,19 @@ function struct(name, ...options) {
9163
9331
  enumerable: true,
9164
9332
  configurable: true,
9165
9333
  get() {
9166
- return __fieldGet(this, field);
9334
+ return get(this, field);
9167
9335
  },
9168
9336
  set(value) {
9169
- __fieldSet(this, field, value);
9337
+ set(this, field, value);
9170
9338
  }
9171
9339
  });
9172
9340
  }
9173
9341
  }
9174
9342
  }
9175
- const fix = (value) => ({
9176
- writable: false,
9177
- enumerable: false,
9178
- configurable: false,
9179
- value
9343
+ context.addInitializer(function() {
9344
+ Object.defineProperty(_struct, "name", { value: target.name });
9345
+ registerType(_struct);
9180
9346
  });
9181
- Object.defineProperties(_struct, {
9182
- name: fix(name),
9183
- size: fix(size),
9184
- alignment: fix(opts.alignment),
9185
- isUnion: fix(!!opts.isUnion),
9186
- fields: fix(fields),
9187
- get: fix((buffer2, offset) => new _struct(buffer2, offset)),
9188
- set: fix((buffer2, offset, value) => {
9189
- const source = new Uint8Array(value.buffer, value.byteOffset, size);
9190
- const target2 = new Uint8Array(buffer2, offset, size);
9191
- if (value.buffer === buffer2 && value.byteOffset === offset)
9192
- return;
9193
- for (let i = 0;i < size; i++)
9194
- target2[i] = source[i];
9195
- }),
9196
- [Symbol.toStringTag]: fix(`[struct ${name}]`)
9197
- });
9198
- registerType(_struct);
9199
9347
  return _struct;
9200
9348
  };
9201
9349
  }
@@ -9207,15 +9355,15 @@ function field(type, opt = {}) {
9207
9355
  return function __decorateField(value, context) {
9208
9356
  if (context.kind != "accessor")
9209
9357
  throw withErrno("EINVAL", "Field must be an accessor");
9210
- const init = initMetadata(context);
9211
- const field2 = __fieldInit(context.name, type, opt);
9212
- init.fields.push(field2);
9358
+ const init2 = initMetadata(context);
9359
+ const field2 = init(context.name, type, opt);
9360
+ init2.fields.push(field2);
9213
9361
  return {
9214
9362
  get() {
9215
- return __fieldGet(this, field2);
9363
+ return get(this, field2);
9216
9364
  },
9217
9365
  set(value2) {
9218
- __fieldSet(this, field2, value2);
9366
+ set(this, field2, value2);
9219
9367
  }
9220
9368
  };
9221
9369
  };
@@ -9234,10 +9382,40 @@ function $from(t) {
9234
9382
  $from.typed = function(t) {
9235
9383
  return t;
9236
9384
  };
9237
- // ../../node_modules/memium/dist/structs.js
9238
- function isStructConstructor(arg) {
9239
- 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
+ }
9240
9414
  }
9415
+ function array2(type, length = 0) {
9416
+ return new FieldBuilder(new ArrayType(type, length), {});
9417
+ }
9418
+ // ../../node_modules/memium/dist/structs.js
9241
9419
  function struct2(structName, fieldDecls, ...options) {
9242
9420
  const opts = options.reduce((acc, opt) => ({ ...acc, ...opt }), {});
9243
9421
  if (typeof this == "object")
@@ -9247,11 +9425,11 @@ function struct2(structName, fieldDecls, ...options) {
9247
9425
  const align = (to) => {
9248
9426
  size = Math.ceil(size / to) * to;
9249
9427
  };
9250
- const fields = Object.create(null);
9251
- for (const [name, init] of Object.entries(fieldDecls)) {
9428
+ const fields = [];
9429
+ for (const [name, init2] of Object.entries(fieldDecls)) {
9252
9430
  if (typeof name == "number")
9253
9431
  throw new TypeError("Field names can not be numbers");
9254
- const field2 = __fieldInit(name, init);
9432
+ const field2 = init(name, init2);
9255
9433
  if (!opts.isPacked)
9256
9434
  align(field2.alignment);
9257
9435
  if (opts.isUnion)
@@ -9260,26 +9438,43 @@ function struct2(structName, fieldDecls, ...options) {
9260
9438
  field2.offset = size;
9261
9439
  size += field2.type.size;
9262
9440
  }
9263
- fields[field2.name] = field2;
9441
+ fields.push(field2);
9264
9442
  fieldAlignment = Math.max(fieldAlignment, field2.alignment);
9265
9443
  }
9266
9444
  opts.alignment ??= fieldAlignment;
9267
9445
  if (!opts.isPacked)
9268
9446
  align(opts.alignment);
9269
9447
 
9270
- class __struct extends DataView {
9448
+ class _struct extends DataView {
9271
9449
  static name = structName;
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}]`;
9272
9467
  constructor(buffer2 = new ArrayBuffer(size), byteOffset, byteLength) {
9273
- super(buffer2, byteOffset, byteLength ?? size);
9274
- for (const field2 of Object.values(fields)) {
9468
+ super(buffer2, byteOffset, byteLength ?? buffer2.byteLength - (byteOffset ?? 0));
9469
+ for (const field2 of Object.values(this.constructor.fields ?? fields)) {
9275
9470
  Object.defineProperty(this, field2.name, {
9276
9471
  enumerable: true,
9277
9472
  configurable: true,
9278
9473
  get() {
9279
- return __fieldGet(this, field2);
9474
+ return get(this, field2);
9280
9475
  },
9281
9476
  set(value) {
9282
- __fieldSet(this, field2, value);
9477
+ set(this, field2, value);
9283
9478
  }
9284
9479
  });
9285
9480
  }
@@ -9288,84 +9483,63 @@ function struct2(structName, fieldDecls, ...options) {
9288
9483
  for (const key of Object.getOwnPropertyNames(DataView.prototype)) {
9289
9484
  if (!key.startsWith("get") && !key.startsWith("set"))
9290
9485
  continue;
9291
- Object.defineProperty(__struct.prototype, key, {
9486
+ Object.defineProperty(_struct.prototype, key, {
9292
9487
  enumerable: false,
9293
9488
  configurable: false,
9294
9489
  writable: false,
9295
9490
  value: undefined
9296
9491
  });
9297
9492
  }
9298
- const _struct = __struct;
9299
- const fix = (value) => ({
9300
- writable: false,
9301
- enumerable: false,
9302
- configurable: false,
9303
- value
9304
- });
9305
- Object.defineProperties(_struct, {
9306
- size: fix(size),
9307
- alignment: fix(opts.alignment),
9308
- isUnion: fix(!!opts.isUnion),
9309
- fields: fix(fields),
9310
- get: fix((buffer2, offset) => new _struct(buffer2, offset)),
9311
- set: fix((buffer2, offset, value) => {
9312
- const source = new Uint8Array(value.buffer, value.byteOffset, size);
9313
- const target = new Uint8Array(buffer2, offset, size);
9314
- if (value.buffer === buffer2 && value.byteOffset === offset)
9315
- return;
9316
- for (let i = 0;i < size; i++)
9317
- target[i] = source[i];
9318
- }),
9319
- [Symbol.toStringTag]: fix(`[struct ${structName}]`)
9320
- });
9321
9493
  registerType(_struct);
9322
9494
  return _struct;
9323
9495
  }
9324
9496
  struct2.extend = function(base, structName, fieldDecls, ...options) {
9325
- return struct2(structName, { ...base.fields, ...fieldDecls }, ...options);
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);
9520
+ }
9521
+ opts.alignment ??= fieldAlignment;
9522
+ if (!opts.isPacked)
9523
+ align(opts.alignment);
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;
9326
9536
  };
9327
9537
  struct2.packed = struct2.bind({ isPacked: true });
9328
9538
  struct2.align = function(alignment) {
9329
9539
  return struct2.bind({ alignment });
9330
9540
  };
9331
- var types4 = Object.fromEntries(Object.entries(rawTypes).map(([typeName, type]) => [
9332
- typeName,
9333
- new FieldBuilder(type, { typeName })
9334
- ]));
9335
-
9336
- // ../../node_modules/memium/dist/misc.js
9337
- function sizeof(type) {
9338
- if (isType(type))
9339
- return type.size;
9340
- if (type === undefined || type === null)
9341
- return 0;
9342
- if (typeof type == "object" && isType(type.constructor))
9343
- return type.constructor.size;
9344
- if (Array.isArray(type)) {
9345
- let size = 0;
9346
- for (let i = 0;i < type.length; i++)
9347
- size += sizeof(type[i]);
9348
- return size;
9349
- }
9350
- if (typeof type == "string") {
9351
- checkValid(type);
9352
- return types2[normalize(type)].size;
9353
- }
9354
- throw new TypeError(`Unable to resolve size of \`${type.toString()}\``);
9355
- }
9356
- function offsetof(type, fieldName) {
9357
- let constructor;
9358
- if (isStructConstructor(type))
9359
- constructor = type;
9360
- else if (isStructConstructor(type.constructor))
9361
- constructor = type.constructor;
9362
- else
9363
- throw withErrno("EINVAL", "Type is not a struct or struct constructor");
9364
- const { fields } = constructor;
9365
- if (!(fieldName in fields))
9366
- throw withErrno("EINVAL", "Struct does not have field: " + fieldName);
9367
- return fields[fieldName].offset;
9368
- }
9541
+ struct2.dynamic = struct2.bind({ isDynamic: true });
9542
+ var types4 = Object.fromEntries(Object.entries(rawTypes).map(([typeName, type]) => [typeName, new FieldBuilder(type, { typeName })]));
9369
9543
  // ../../node_modules/@zenfs/core/dist/utils.js
9370
9544
  function decodeDirListing(data) {
9371
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);
@@ -9902,7 +10076,7 @@ var rootIno = 0;
9902
10076
  var maxDynamicData = 3968;
9903
10077
  var Attribute = (() => {
9904
10078
  var _a, _b;
9905
- let _classDecorators = [struct.packed("Attribute")];
10079
+ let _classDecorators = [struct.packed()];
9906
10080
  let _classDescriptor;
9907
10081
  let _classExtraInitializers = [];
9908
10082
  let _classThis;
@@ -9931,8 +10105,8 @@ var Attribute = (() => {
9931
10105
  Attribute2 = _classThis = _classDescriptor.value;
9932
10106
  if (_metadata)
9933
10107
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
9934
- __runInitializers(_classThis, _classExtraInitializers);
9935
10108
  }
10109
+ static name = "Attribute";
9936
10110
  #keySize_accessor_storage = __runInitializers(this, _keySize_initializers, undefined);
9937
10111
  get keySize() {
9938
10112
  return this.#keySize_accessor_storage;
@@ -9973,12 +10147,15 @@ var Attribute = (() => {
9973
10147
  super(...arguments);
9974
10148
  __runInitializers(this, _valueSize_extraInitializers);
9975
10149
  }
10150
+ static {
10151
+ __runInitializers(_classThis, _classExtraInitializers);
10152
+ }
9976
10153
  };
9977
10154
  return Attribute2 = _classThis;
9978
10155
  })();
9979
10156
  var Attributes = (() => {
9980
10157
  var _a;
9981
- let _classDecorators = [struct.packed("Attributes")];
10158
+ let _classDecorators = [struct.packed()];
9982
10159
  let _classDescriptor;
9983
10160
  let _classExtraInitializers = [];
9984
10161
  let _classThis;
@@ -10000,8 +10177,8 @@ var Attributes = (() => {
10000
10177
  Attributes2 = _classThis = _classDescriptor.value;
10001
10178
  if (_metadata)
10002
10179
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
10003
- __runInitializers(_classThis, _classExtraInitializers);
10004
10180
  }
10181
+ static name = "Attributes";
10005
10182
  #size_accessor_storage = __runInitializers(this, _size_initializers, undefined);
10006
10183
  get size() {
10007
10184
  return this.#size_accessor_storage;
@@ -10108,6 +10285,9 @@ var Attributes = (() => {
10108
10285
  super(...arguments);
10109
10286
  __runInitializers(this, _size_extraInitializers);
10110
10287
  }
10288
+ static {
10289
+ __runInitializers(_classThis, _classExtraInitializers);
10290
+ }
10111
10291
  };
10112
10292
  return Attributes2 = _classThis;
10113
10293
  })();
@@ -10150,7 +10330,7 @@ var InodeFlags;
10150
10330
  })(InodeFlags || (InodeFlags = {}));
10151
10331
  var Inode = (() => {
10152
10332
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
10153
- let _classDecorators = [struct.packed("Inode")];
10333
+ let _classDecorators = [struct.packed()];
10154
10334
  let _classDescriptor;
10155
10335
  let _classExtraInitializers = [];
10156
10336
  let _classThis;
@@ -10298,8 +10478,8 @@ var Inode = (() => {
10298
10478
  Inode2 = _classThis = _classDescriptor.value;
10299
10479
  if (_metadata)
10300
10480
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
10301
- __runInitializers(_classThis, _classExtraInitializers);
10302
10481
  }
10482
+ static name = "Inode";
10303
10483
  constructor(...args) {
10304
10484
  let data = {};
10305
10485
  if (typeof args[0] === "object" && args[0] !== null && !ArrayBuffer.isView(args[0])) {
@@ -10489,6 +10669,9 @@ var Inode = (() => {
10489
10669
  this.ctimeMs = Date.now();
10490
10670
  return hasChanged;
10491
10671
  }
10672
+ static {
10673
+ __runInitializers(_classThis, _classExtraInitializers);
10674
+ }
10492
10675
  };
10493
10676
  return Inode2 = _classThis;
10494
10677
  })();
@@ -11962,16 +12145,16 @@ class DeviceFS extends StoreFS {
11962
12145
  const lastDev = Array.from(this.devices.values()).at(-1);
11963
12146
  while (this.store.has(ino) || lastDev?.inode.ino == ino)
11964
12147
  ino++;
11965
- const init = driver.init?.(ino, options);
12148
+ const init2 = driver.init?.(ino, options);
11966
12149
  const dev = {
11967
12150
  data: {},
11968
12151
  minor: 0,
11969
12152
  major: 0,
11970
- ...omit(init ?? {}, "metadata"),
12153
+ ...omit(init2 ?? {}, "metadata"),
11971
12154
  driver,
11972
12155
  inode: new Inode({
11973
12156
  mode: S_IFCHR | 438,
11974
- ...init?.metadata
12157
+ ...init2?.metadata
11975
12158
  })
11976
12159
  };
11977
12160
  const path = "/" + (dev.name || driver.name) + (driver.singleton ? "" : this.devicesWithDriver(driver).length);
@@ -12224,7 +12407,7 @@ __export(exports_promises, {
12224
12407
  truncate: () => truncate,
12225
12408
  symlink: () => symlink,
12226
12409
  statfs: () => statfs,
12227
- stat: () => stat,
12410
+ stat: () => stat3,
12228
12411
  rmdir: () => rmdir,
12229
12412
  rm: () => rm,
12230
12413
  rename: () => rename3,
@@ -12755,7 +12938,7 @@ function resolve2($, path, preserveSymlinks, extra) {
12755
12938
  const target2 = resolve.call($, dirname(path), readlink.call($, path));
12756
12939
  return resolve2($, target2, preserveSymlinks, extra);
12757
12940
  } catch (e) {
12758
- setUVMessage(Object.assign(e, { syscall: "stat", path }));
12941
+ setUVMessage(Object.assign(e, { syscall: "stat", path, ...extra }));
12759
12942
  if (preserveSymlinks)
12760
12943
  throw e;
12761
12944
  }
@@ -12769,7 +12952,7 @@ function resolve2($, path, preserveSymlinks, extra) {
12769
12952
  } catch (e) {
12770
12953
  if (e.code === "ENOENT")
12771
12954
  return { ...resolved, fullPath: path };
12772
- throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath }));
12955
+ throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath, ...extra }));
12773
12956
  }
12774
12957
  if (!isSymbolicLink(stats)) {
12775
12958
  return { ...resolved, fullPath: maybePath, stats };
@@ -12956,6 +13139,28 @@ function link(target, link2) {
12956
13139
  }
12957
13140
  return fs.linkSync(resolved, dst.path);
12958
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
+ }
12959
13164
 
12960
13165
  // ../../node_modules/@zenfs/core/dist/node/dir.js
12961
13166
  init_buffer();
@@ -13162,25 +13367,11 @@ function existsSync(path) {
13162
13367
  }
13163
13368
  }
13164
13369
  function statSync(path, options) {
13165
- path = normalizePath(path);
13166
- const { fs, path: resolved } = resolve2(this, path);
13167
- let stats;
13168
- try {
13169
- stats = fs.statSync(resolved);
13170
- } catch (e) {
13171
- throw setUVMessage(Object.assign(e, { path }));
13172
- }
13173
- if (checkAccess && !hasAccess(this, stats, R_OK))
13174
- throw UV("EACCES", { syscall: "stat", path });
13370
+ const stats = stat.call(this, path, false);
13175
13371
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
13176
13372
  }
13177
13373
  function lstatSync(path, options) {
13178
- path = normalizePath(path);
13179
- const { base, dir } = parse(path);
13180
- const { fs, path: parent } = resolve2(this, dir);
13181
- const stats = wrap(fs, "statSync", path)(base ? join(parent, base) : parent);
13182
- if (checkAccess && !hasAccess(this, stats, R_OK))
13183
- throw UV("EACCES", { syscall: "lstat", path });
13374
+ const stats = stat.call(this, path, true);
13184
13375
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
13185
13376
  }
13186
13377
  function truncateSync(path, len2 = 0) {
@@ -13767,7 +13958,7 @@ async function resolve3($, path, preserveSymlinks, extra) {
13767
13958
  const stats = await resolved.fs.stat(resolved.path).catch((e) => {
13768
13959
  if (e.code == "ENOENT")
13769
13960
  return;
13770
- throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath }));
13961
+ throw setUVMessage(Object.assign(e, { syscall: "stat", path: maybePath, ...extra }));
13771
13962
  });
13772
13963
  if (!stats)
13773
13964
  return { ...resolved, fullPath: path };
@@ -13945,6 +14136,23 @@ async function link2(target, link3) {
13945
14136
  }
13946
14137
  return await fs.link(resolved, dst.path);
13947
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
+ }
13948
14156
 
13949
14157
  // ../../node_modules/@zenfs/core/dist/node/readline.js
13950
14158
  class Interface extends import__.default {
@@ -14696,23 +14904,12 @@ async function exists(path) {
14696
14904
  throw e;
14697
14905
  }
14698
14906
  }
14699
- async function stat(path, options) {
14700
- path = normalizePath(path);
14701
- const { fs, path: resolved } = await resolve3(this, path);
14702
- const $ex = { syscall: "stat", path };
14703
- const stats = await fs.stat(resolved).catch(rethrow($ex));
14704
- if (checkAccess && !hasAccess(this, stats, R_OK))
14705
- throw UV("EACCES", $ex);
14907
+ async function stat3(path, options) {
14908
+ const stats = await stat2.call(this, path, false);
14706
14909
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
14707
14910
  }
14708
14911
  async function lstat(path, options) {
14709
- path = normalizePath(path);
14710
- const $ex = { syscall: "lstat", path };
14711
- const { base, dir } = parse(path);
14712
- const { fs, path: parent } = await resolve3(this, dir);
14713
- const stats = await fs.stat(base ? join(parent, base) : parent).catch(rethrow($ex));
14714
- if (checkAccess && !hasAccess(this, stats, R_OK))
14715
- throw UV("EACCES", $ex);
14912
+ const stats = await stat2.call(this, path, true);
14716
14913
  return options?.bigint ? new BigIntStats(stats) : new Stats(stats);
14717
14914
  }
14718
14915
  async function truncate(path, len2 = 0) {
@@ -15012,7 +15209,7 @@ function watch(filename, options = {}) {
15012
15209
  async function access(path, mode = F_OK) {
15013
15210
  if (!checkAccess)
15014
15211
  return;
15015
- const stats = await stat.call(this, path);
15212
+ const stats = await stat3.call(this, path);
15016
15213
  if (!stats.hasAccess(mode, this))
15017
15214
  throw UV("EACCES", "access", path.toString());
15018
15215
  }
@@ -15133,7 +15330,7 @@ function glob(pattern2, opt) {
15133
15330
  if (typeof exclude != "function" ? exclude.some((p) => matchesGlob(p, fullPath)) : exclude(withFileTypes ? entry : fullPath))
15134
15331
  continue;
15135
15332
  const relativePath = fullPath.replace(/^\/+/g, "");
15136
- if ((await stat(fullPath)).isDirectory()) {
15333
+ if ((await stat3(fullPath)).isDirectory()) {
15137
15334
  if (hasGlobStar || patternBases.some((base) => relativePath === base || base.startsWith(relativePath + "/"))) {
15138
15335
  yield* recursiveList(fullPath);
15139
15336
  }
@@ -15196,7 +15393,7 @@ async function mountWithMkdir(path, fs) {
15196
15393
  mount(path, fs);
15197
15394
  return;
15198
15395
  }
15199
- const stats = await stat(path).catch(() => null);
15396
+ const stats = await stat3(path).catch(() => null);
15200
15397
  if (!stats) {
15201
15398
  await mkdir3(path, { recursive: true });
15202
15399
  } else if (!stats.isDirectory()) {
@@ -15237,7 +15434,7 @@ async function configure2(configuration) {
15237
15434
  if (configuration.defaultDirectories) {
15238
15435
  for (const dir of _defaultDirectories) {
15239
15436
  if (await exists(dir)) {
15240
- const stats = await stat(dir);
15437
+ const stats = await stat3(dir);
15241
15438
  if (!stats.isDirectory())
15242
15439
  exports_log.warn("Default directory exists but is not a directory: " + dir);
15243
15440
  } else
@@ -15251,8 +15448,8 @@ var journalOperations = new Set(["delete"]);
15251
15448
  var maxOpLength = Math.max(...journalOperations.values().map((op) => op.length));
15252
15449
  // ../../node_modules/utilium/dist/requests.js
15253
15450
  var resourcesCache = new Map;
15254
- async function _fetch(input, init = {}, bodyOptional = false) {
15255
- 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) => {
15256
15453
  throw { tag: "fetch", message: error2.message };
15257
15454
  });
15258
15455
  if (!response.ok)
@@ -15264,10 +15461,10 @@ async function _fetch(input, init = {}, bodyOptional = false) {
15264
15461
  });
15265
15462
  return { response, data: raw ? new Uint8Array(raw) : undefined };
15266
15463
  }
15267
- async function get(url, options, init = {}) {
15268
- const req = new Request(url, init);
15464
+ async function get2(url, options, init2 = {}) {
15465
+ const req = new Request(url, init2);
15269
15466
  if (typeof options.start != "number" || typeof options.end != "number") {
15270
- const { data } = await _fetch(url, init);
15467
+ const { data } = await _fetch(url, init2);
15271
15468
  new Resource(url, data.byteLength, options, resourcesCache).add(data, 0);
15272
15469
  return data;
15273
15470
  }
@@ -15328,14 +15525,14 @@ function getCached(url, options) {
15328
15525
  }
15329
15526
  return { data, missing: cache.missing(start, end) };
15330
15527
  }
15331
- async function set(url, data, options, init = {}) {
15528
+ async function set2(url, data, options, init2 = {}) {
15332
15529
  if (!resourcesCache.has(url)) {
15333
15530
  new Resource(url, options.size ?? data.byteLength, options, resourcesCache);
15334
15531
  }
15335
15532
  const resource = resourcesCache.get(url);
15336
15533
  const { offset = 0, method = "POST" } = options;
15337
15534
  if (!options.cacheOnly) {
15338
- const headers = new Headers(init.headers || {});
15535
+ const headers = new Headers(init2.headers || {});
15339
15536
  if (!headers.get("Content-Type")) {
15340
15537
  headers.set("Content-Type", "application/octet-stream");
15341
15538
  }
@@ -15346,7 +15543,7 @@ async function set(url, data, options, init = {}) {
15346
15543
  headers.set("Content-Range", `bytes ${start}-${end}/${total}`);
15347
15544
  }
15348
15545
  await _fetch(new Request(url, {
15349
- ...init,
15546
+ ...init2,
15350
15547
  method,
15351
15548
  headers,
15352
15549
  body: data.buffer instanceof ArrayBuffer ? data : Uint8Array.from(data)
@@ -15354,9 +15551,9 @@ async function set(url, data, options, init = {}) {
15354
15551
  }
15355
15552
  resource.add(data, offset);
15356
15553
  }
15357
- async function remove(url, options = {}, init = {}) {
15554
+ async function remove(url, options = {}, init2 = {}) {
15358
15555
  if (!options.cacheOnly)
15359
- await _fetch(new Request(url, init), { method: "DELETE" }, true);
15556
+ await _fetch(new Request(url, init2), { method: "DELETE" }, true);
15360
15557
  resourcesCache.delete(url);
15361
15558
  }
15362
15559
 
@@ -15588,7 +15785,7 @@ class FetchFS extends IndexFS {
15588
15785
  throw withErrno("ENOENT");
15589
15786
  if (end - offset == 0)
15590
15787
  return;
15591
- 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(() => {
15592
15789
  return;
15593
15790
  });
15594
15791
  if (!data)
@@ -15605,7 +15802,7 @@ class FetchFS extends IndexFS {
15605
15802
  if (!data)
15606
15803
  throw withErrno("ENODATA");
15607
15804
  if (missing.length) {
15608
- 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 }));
15609
15806
  throw withErrno("EAGAIN");
15610
15807
  }
15611
15808
  buffer2.set(data);
@@ -15615,14 +15812,14 @@ class FetchFS extends IndexFS {
15615
15812
  if (!inode)
15616
15813
  throw withErrno("ENOENT");
15617
15814
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
15618
- 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);
15619
15816
  }
15620
15817
  writeSync(path, data, offset) {
15621
15818
  const inode = this.index.get(path);
15622
15819
  if (!inode)
15623
15820
  throw withErrno("ENOENT");
15624
15821
  inode.update({ mtimeMs: Date.now(), size: Math.max(inode.size, data.byteLength + offset) });
15625
- 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));
15626
15823
  }
15627
15824
  }
15628
15825
  // ../../node_modules/@zenfs/core/dist/backends/passthrough.js
@@ -16197,7 +16394,7 @@ var { format: format2 } = new Intl.NumberFormat("en-US", {
16197
16394
  });
16198
16395
  var MetadataEntry = (() => {
16199
16396
  var _a, _b, _c, _d;
16200
- let _classDecorators = [struct.packed("MetadataEntry")];
16397
+ let _classDecorators = [struct.packed()];
16201
16398
  let _classDescriptor;
16202
16399
  let _classExtraInitializers = [];
16203
16400
  let _classThis;
@@ -16240,8 +16437,8 @@ var MetadataEntry = (() => {
16240
16437
  MetadataEntry2 = _classThis = _classDescriptor.value;
16241
16438
  if (_metadata)
16242
16439
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16243
- __runInitializers2(_classThis, _classExtraInitializers);
16244
16440
  }
16441
+ static name = "MetadataEntry";
16245
16442
  #id_accessor_storage = __runInitializers2(this, _id_initializers, undefined);
16246
16443
  get id() {
16247
16444
  return this.#id_accessor_storage;
@@ -16277,6 +16474,9 @@ var MetadataEntry = (() => {
16277
16474
  super(...arguments);
16278
16475
  __runInitializers2(this, _size_extraInitializers);
16279
16476
  }
16477
+ static {
16478
+ __runInitializers2(_classThis, _classExtraInitializers);
16479
+ }
16280
16480
  };
16281
16481
  return MetadataEntry2 = _classThis;
16282
16482
  })();
@@ -16284,7 +16484,7 @@ var entries_per_block = 255;
16284
16484
  var max_lock_attempts = 5;
16285
16485
  var MetadataBlock = (() => {
16286
16486
  var _a, _b, _c, _d;
16287
- let _classDecorators = [struct.packed("MetadataBlock")];
16487
+ let _classDecorators = [struct.packed()];
16288
16488
  let _classDescriptor;
16289
16489
  let _classExtraInitializers = [];
16290
16490
  let _classThis;
@@ -16335,7 +16535,8 @@ var MetadataBlock = (() => {
16335
16535
  if (_metadata)
16336
16536
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16337
16537
  }
16338
- static lockIndex = offsetof(MetadataBlock2, "locked") / Int32Array.BYTES_PER_ELEMENT;
16538
+ static name = "MetadataBlock";
16539
+ static lockIndex;
16339
16540
  #checksum_accessor_storage = __runInitializers2(this, _checksum_initializers, undefined);
16340
16541
  get checksum() {
16341
16542
  return this.#checksum_accessor_storage;
@@ -16433,11 +16634,12 @@ var MetadataBlock = (() => {
16433
16634
  };
16434
16635
  return MetadataBlock2 = _classThis;
16435
16636
  })();
16637
+ Object.assign(MetadataBlock, { lockIndex: offsetof(MetadataBlock, "locked") / Int32Array.BYTES_PER_ELEMENT });
16436
16638
  var sb_magic = 1651715706;
16437
16639
  var usedBytes = 2;
16438
16640
  var SuperBlock = (() => {
16439
16641
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16440
- let _classDecorators = [struct.packed("Superblock")];
16642
+ let _classDecorators = [struct.packed()];
16441
16643
  let _classDescriptor;
16442
16644
  let _classExtraInitializers = [];
16443
16645
  let _classThis;
@@ -16543,8 +16745,8 @@ var SuperBlock = (() => {
16543
16745
  SuperBlock2 = _classThis = _classDescriptor.value;
16544
16746
  if (_metadata)
16545
16747
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
16546
- __runInitializers2(_classThis, _classExtraInitializers);
16547
16748
  }
16749
+ static name = "SuperBlock";
16548
16750
  constructor(...args) {
16549
16751
  super(...args);
16550
16752
  __runInitializers2(this, __padding_extraInitializers);
@@ -16699,6 +16901,9 @@ var SuperBlock = (() => {
16699
16901
  }
16700
16902
  return true;
16701
16903
  }
16904
+ static {
16905
+ __runInitializers2(_classThis, _classExtraInitializers);
16906
+ }
16702
16907
  };
16703
16908
  return SuperBlock2 = _classThis;
16704
16909
  })();
@@ -16729,9 +16934,9 @@ function rename4(oldPath, newPath, cb = nop) {
16729
16934
  function exists2(path, cb = nop) {
16730
16935
  exists.call(this, path).then(cb).catch(() => cb(false));
16731
16936
  }
16732
- function stat2(path, options, callback = nop) {
16937
+ function stat4(path, options, callback = nop) {
16733
16938
  callback = typeof options == "function" ? options : callback;
16734
- 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);
16735
16940
  }
16736
16941
  function lstat2(path, options, callback = nop) {
16737
16942
  callback = typeof options == "function" ? options : callback;
@@ -16986,20 +17191,20 @@ init_buffer();
16986
17191
  var exports_xattr = {};
16987
17192
  __export(exports_xattr, {
16988
17193
  setSync: () => setSync,
16989
- set: () => set2,
17194
+ set: () => set3,
16990
17195
  removeSync: () => removeSync,
16991
17196
  remove: () => remove2,
16992
17197
  listSync: () => listSync,
16993
17198
  list: () => list2,
16994
17199
  getSync: () => getSync,
16995
- get: () => get2
17200
+ get: () => get3
16996
17201
  });
16997
17202
  var _allowedRestrictedNames = [];
16998
17203
  function checkName($, name, path, syscall) {
16999
17204
  if (!name.startsWith("user.") && !_allowedRestrictedNames.includes(name))
17000
17205
  throw UV("ENOTSUP", syscall, path);
17001
17206
  }
17002
- async function get2(path, name, opt = {}) {
17207
+ async function get3(path, name, opt = {}) {
17003
17208
  path = normalizePath(path);
17004
17209
  const { fs: fs2, path: resolved } = resolveMount(path, this);
17005
17210
  checkName(this, name, path, "xattr.get");
@@ -17032,7 +17237,7 @@ function getSync(path, name, opt = {}) {
17032
17237
  const buffer2 = Buffer.from(value);
17033
17238
  return opt.encoding == "buffer" || !opt.encoding ? buffer2 : buffer2.toString(opt.encoding);
17034
17239
  }
17035
- async function set2(path, name, value, opt = {}) {
17240
+ async function set3(path, name, value, opt = {}) {
17036
17241
  path = normalizePath(path);
17037
17242
  const { fs: fs2, path: resolved } = resolveMount(path, this);
17038
17243
  checkName(this, name, path, "xattr.set");
@@ -17264,7 +17469,7 @@ __export(exports_compat, {
17264
17469
  statfsSync: () => statfsSync,
17265
17470
  statfs: () => statfs2,
17266
17471
  statSync: () => statSync,
17267
- stat: () => stat2,
17472
+ stat: () => stat4,
17268
17473
  rmdirSync: () => rmdirSync,
17269
17474
  rmdir: () => rmdir2,
17270
17475
  rmSync: () => rmSync,
@@ -17429,7 +17634,7 @@ var XFlag;
17429
17634
  })(XFlag || (XFlag = {}));
17430
17635
  var fsxattr = (() => {
17431
17636
  var _a, _b, _c, _d, _e;
17432
- let _classDecorators = [struct("fsxattr")];
17637
+ let _classDecorators = [struct()];
17433
17638
  let _classDescriptor;
17434
17639
  let _classExtraInitializers = [];
17435
17640
  let _classThis;
@@ -17486,8 +17691,8 @@ var fsxattr = (() => {
17486
17691
  fsxattr2 = _classThis = _classDescriptor.value;
17487
17692
  if (_metadata)
17488
17693
  Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17489
- __runInitializers3(_classThis, _classExtraInitializers);
17490
17694
  }
17695
+ static name = "fsxattr";
17491
17696
  #xflags_accessor_storage = __runInitializers3(this, _xflags_initializers, undefined);
17492
17697
  get xflags() {
17493
17698
  return this.#xflags_accessor_storage;
@@ -17544,6 +17749,9 @@ var fsxattr = (() => {
17544
17749
  this.xflags |= XFlag[name];
17545
17750
  }
17546
17751
  }
17752
+ static {
17753
+ __runInitializers3(_classThis, _classExtraInitializers);
17754
+ }
17547
17755
  };
17548
17756
  return fsxattr2 = _classThis;
17549
17757
  })();
@@ -17690,7 +17898,7 @@ function ioctlSync(path, command, ...args) {
17690
17898
  // ../../node_modules/@zenfs/core/package.json
17691
17899
  var package_default = {
17692
17900
  name: "@zenfs/core",
17693
- version: "2.5.2",
17901
+ version: "2.5.6",
17694
17902
  description: "A filesystem, anywhere",
17695
17903
  funding: {
17696
17904
  type: "individual",
@@ -17765,9 +17973,9 @@ var package_default = {
17765
17973
  buffer: "^6.0.3",
17766
17974
  eventemitter3: "^5.0.1",
17767
17975
  kerium: "^1.3.4",
17768
- memium: "^0.3.10",
17976
+ memium: "^0.4.0",
17769
17977
  "readable-stream": "^4.5.2",
17770
- utilium: "^2.5.0"
17978
+ utilium: "^3.0.0"
17771
17979
  },
17772
17980
  devDependencies: {
17773
17981
  "@octokit/action": "^8.0.4",
@@ -17776,9 +17984,9 @@ var package_default = {
17776
17984
  globals: "^17.3.0",
17777
17985
  prettier: "^3.2.5",
17778
17986
  tsx: "^4.19.1",
17779
- typedoc: "^0.28.0",
17780
- typescript: "^5.7.2",
17781
- "typescript-eslint": "^8.16.0"
17987
+ typedoc: "^0.28.18",
17988
+ typescript: "^6.0.0",
17989
+ "typescript-eslint": "^8.58.0"
17782
17990
  }
17783
17991
  };
17784
17992