@settlemint/sdk-cli 2.2.2 → 2.2.3-main0f4b90ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -837,7 +837,7 @@ var require_dist2 = __commonJS((exports) => {
837
837
  // ../../node_modules/@dotenvx/dotenvx/package.json
838
838
  var require_package = __commonJS((exports, module) => {
839
839
  module.exports = {
840
- version: "1.41.0",
840
+ version: "1.43.0",
841
841
  name: "@dotenvx/dotenvx",
842
842
  description: "a better dotenv–from the creator of `dotenv`",
843
843
  author: "@motdotla",
@@ -990,14 +990,11 @@ var require_logger = __commonJS((exports, module) => {
990
990
  var { getColor, bold: bold2 } = require_colors();
991
991
  var levels = {
992
992
  error: 0,
993
- errorv: 0,
994
- errornocolor: 0,
995
993
  warn: 1,
996
994
  success: 2,
997
995
  successv: 2,
998
996
  info: 2,
999
997
  help: 2,
1000
- blank: 2,
1001
998
  verbose: 4,
1002
999
  debug: 5,
1003
1000
  silly: 6
@@ -1010,7 +1007,11 @@ var require_logger = __commonJS((exports, module) => {
1010
1007
  var verbose = getColor("plum");
1011
1008
  var debug = getColor("plum");
1012
1009
  var currentLevel = levels.info;
1013
- function log(level, message) {
1010
+ function stderr(level, message) {
1011
+ const formattedMessage = formatMessage(level, message);
1012
+ console.error(formattedMessage);
1013
+ }
1014
+ function stdout(level, message) {
1014
1015
  if (levels[level] === undefined) {
1015
1016
  throw new Error(`MISSING_LOG_LEVEL: '${level}'. implement in logger.`);
1016
1017
  }
@@ -1024,10 +1025,6 @@ var require_logger = __commonJS((exports, module) => {
1024
1025
  switch (level.toLowerCase()) {
1025
1026
  case "error":
1026
1027
  return error(formattedMessage);
1027
- case "errorv":
1028
- return error(`[dotenvx@${packageJson.version}] ${formattedMessage}`);
1029
- case "errornocolor":
1030
- return formattedMessage;
1031
1028
  case "warn":
1032
1029
  return warn(formattedMessage);
1033
1030
  case "success":
@@ -1042,23 +1039,18 @@ var require_logger = __commonJS((exports, module) => {
1042
1039
  return verbose(formattedMessage);
1043
1040
  case "debug":
1044
1041
  return debug(formattedMessage);
1045
- case "blank":
1046
- return formattedMessage;
1047
1042
  }
1048
1043
  }
1049
1044
  var logger = {
1050
1045
  level: "info",
1051
- error: (msg) => log("error", msg),
1052
- errorv: (msg) => log("errorv", msg),
1053
- errornocolor: (msg) => log("errornocolor", msg),
1054
- warn: (msg) => log("warn", msg),
1055
- success: (msg) => log("success", msg),
1056
- successv: (msg) => log("successv", msg),
1057
- info: (msg) => log("info", msg),
1058
- help: (msg) => log("help", msg),
1059
- verbose: (msg) => log("verbose", msg),
1060
- debug: (msg) => log("debug", msg),
1061
- blank: (msg) => log("blank", msg),
1046
+ error: (msg) => stderr("error", msg),
1047
+ warn: (msg) => stdout("warn", msg),
1048
+ success: (msg) => stdout("success", msg),
1049
+ successv: (msg) => stdout("successv", msg),
1050
+ info: (msg) => stdout("info", msg),
1051
+ help: (msg) => stdout("help", msg),
1052
+ verbose: (msg) => stdout("verbose", msg),
1053
+ debug: (msg) => stdout("debug", msg),
1062
1054
  setLevel: (level) => {
1063
1055
  if (levels[level] !== undefined) {
1064
1056
  currentLevel = levels[level];
@@ -4166,54 +4158,21 @@ var require_webcrypto = __commonJS((exports) => {
4166
4158
  exports.gcm = /* @__PURE__ */ (() => generate(mode.GCM))();
4167
4159
  });
4168
4160
 
4169
- // ../../node_modules/eciesjs/node_modules/@noble/hashes/cryptoNode.js
4170
- var require_cryptoNode2 = __commonJS((exports) => {
4161
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/_assert.js
4162
+ var require__assert = __commonJS((exports) => {
4171
4163
  Object.defineProperty(exports, "__esModule", { value: true });
4172
- exports.crypto = undefined;
4173
- var nc = __require("node:crypto");
4174
- exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && ("randomBytes" in nc) ? nc : undefined;
4175
- });
4176
-
4177
- // ../../node_modules/eciesjs/node_modules/@noble/hashes/utils.js
4178
- var require_utils4 = __commonJS((exports) => {
4179
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4180
- Object.defineProperty(exports, "__esModule", { value: true });
4181
- exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = undefined;
4182
- exports.isBytes = isBytes;
4183
4164
  exports.anumber = anumber;
4184
4165
  exports.abytes = abytes;
4185
4166
  exports.ahash = ahash;
4186
4167
  exports.aexists = aexists;
4187
4168
  exports.aoutput = aoutput;
4188
- exports.u8 = u8;
4189
- exports.u32 = u32;
4190
- exports.clean = clean;
4191
- exports.createView = createView;
4192
- exports.rotr = rotr;
4193
- exports.rotl = rotl;
4194
- exports.byteSwap = byteSwap;
4195
- exports.byteSwap32 = byteSwap32;
4196
- exports.bytesToHex = bytesToHex;
4197
- exports.hexToBytes = hexToBytes;
4198
- exports.asyncLoop = asyncLoop;
4199
- exports.utf8ToBytes = utf8ToBytes;
4200
- exports.bytesToUtf8 = bytesToUtf8;
4201
- exports.toBytes = toBytes;
4202
- exports.kdfInputToBytes = kdfInputToBytes;
4203
- exports.concatBytes = concatBytes;
4204
- exports.checkOpts = checkOpts;
4205
- exports.createHasher = createHasher;
4206
- exports.createOptHasher = createOptHasher;
4207
- exports.createXOFer = createXOFer;
4208
- exports.randomBytes = randomBytes;
4209
- var crypto_1 = require_cryptoNode2();
4210
- function isBytes(a) {
4211
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4212
- }
4213
4169
  function anumber(n) {
4214
4170
  if (!Number.isSafeInteger(n) || n < 0)
4215
4171
  throw new Error("positive integer expected, got " + n);
4216
4172
  }
4173
+ function isBytes(a) {
4174
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4175
+ }
4217
4176
  function abytes(b, ...lengths) {
4218
4177
  if (!isBytes(b))
4219
4178
  throw new Error("Uint8Array expected");
@@ -4222,7 +4181,7 @@ var require_utils4 = __commonJS((exports) => {
4222
4181
  }
4223
4182
  function ahash(h) {
4224
4183
  if (typeof h !== "function" || typeof h.create !== "function")
4225
- throw new Error("Hash should be wrapped by utils.createHasher");
4184
+ throw new Error("Hash should be wrapped by utils.wrapConstructor");
4226
4185
  anumber(h.outputLen);
4227
4186
  anumber(h.blockLen);
4228
4187
  }
@@ -4239,17 +4198,51 @@ var require_utils4 = __commonJS((exports) => {
4239
4198
  throw new Error("digestInto() expects output buffer of length at least " + min);
4240
4199
  }
4241
4200
  }
4201
+ });
4202
+
4203
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/cryptoNode.js
4204
+ var require_cryptoNode2 = __commonJS((exports) => {
4205
+ Object.defineProperty(exports, "__esModule", { value: true });
4206
+ exports.crypto = undefined;
4207
+ var nc = __require("node:crypto");
4208
+ exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && ("randomBytes" in nc) ? nc : undefined;
4209
+ });
4210
+
4211
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/utils.js
4212
+ var require_utils4 = __commonJS((exports) => {
4213
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4214
+ Object.defineProperty(exports, "__esModule", { value: true });
4215
+ exports.Hash = exports.nextTick = exports.byteSwapIfBE = exports.isLE = undefined;
4216
+ exports.isBytes = isBytes;
4217
+ exports.u8 = u8;
4218
+ exports.u32 = u32;
4219
+ exports.createView = createView;
4220
+ exports.rotr = rotr;
4221
+ exports.rotl = rotl;
4222
+ exports.byteSwap = byteSwap;
4223
+ exports.byteSwap32 = byteSwap32;
4224
+ exports.bytesToHex = bytesToHex;
4225
+ exports.hexToBytes = hexToBytes;
4226
+ exports.asyncLoop = asyncLoop;
4227
+ exports.utf8ToBytes = utf8ToBytes;
4228
+ exports.toBytes = toBytes;
4229
+ exports.concatBytes = concatBytes;
4230
+ exports.checkOpts = checkOpts;
4231
+ exports.wrapConstructor = wrapConstructor;
4232
+ exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
4233
+ exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
4234
+ exports.randomBytes = randomBytes;
4235
+ var crypto_1 = require_cryptoNode2();
4236
+ var _assert_ts_1 = require__assert();
4237
+ function isBytes(a) {
4238
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4239
+ }
4242
4240
  function u8(arr) {
4243
4241
  return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
4244
4242
  }
4245
4243
  function u32(arr) {
4246
4244
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
4247
4245
  }
4248
- function clean(...arrays) {
4249
- for (let i = 0;i < arrays.length; i++) {
4250
- arrays[i].fill(0);
4251
- }
4252
- }
4253
4246
  function createView(arr) {
4254
4247
  return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
4255
4248
  }
@@ -4263,19 +4256,16 @@ var require_utils4 = __commonJS((exports) => {
4263
4256
  function byteSwap(word) {
4264
4257
  return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
4265
4258
  }
4266
- exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap(n);
4267
- exports.byteSwapIfBE = exports.swap8IfBE;
4259
+ exports.byteSwapIfBE = exports.isLE ? (n) => n : (n) => byteSwap(n);
4268
4260
  function byteSwap32(arr) {
4269
4261
  for (let i = 0;i < arr.length; i++) {
4270
4262
  arr[i] = byteSwap(arr[i]);
4271
4263
  }
4272
- return arr;
4273
4264
  }
4274
- exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap32;
4275
- var hasHexBuiltin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function")();
4265
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
4276
4266
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
4277
4267
  function bytesToHex(bytes) {
4278
- abytes(bytes);
4268
+ (0, _assert_ts_1.abytes)(bytes);
4279
4269
  if (hasHexBuiltin)
4280
4270
  return bytes.toHex();
4281
4271
  let hex = "";
@@ -4330,29 +4320,20 @@ var require_utils4 = __commonJS((exports) => {
4330
4320
  }
4331
4321
  function utf8ToBytes(str) {
4332
4322
  if (typeof str !== "string")
4333
- throw new Error("string expected");
4323
+ throw new Error("utf8ToBytes expected string, got " + typeof str);
4334
4324
  return new Uint8Array(new TextEncoder().encode(str));
4335
4325
  }
4336
- function bytesToUtf8(bytes) {
4337
- return new TextDecoder().decode(bytes);
4338
- }
4339
4326
  function toBytes(data) {
4340
4327
  if (typeof data === "string")
4341
4328
  data = utf8ToBytes(data);
4342
- abytes(data);
4343
- return data;
4344
- }
4345
- function kdfInputToBytes(data) {
4346
- if (typeof data === "string")
4347
- data = utf8ToBytes(data);
4348
- abytes(data);
4329
+ (0, _assert_ts_1.abytes)(data);
4349
4330
  return data;
4350
4331
  }
4351
4332
  function concatBytes(...arrays) {
4352
4333
  let sum = 0;
4353
4334
  for (let i = 0;i < arrays.length; i++) {
4354
4335
  const a = arrays[i];
4355
- abytes(a);
4336
+ (0, _assert_ts_1.abytes)(a);
4356
4337
  sum += a.length;
4357
4338
  }
4358
4339
  const res = new Uint8Array(sum);
@@ -4363,17 +4344,20 @@ var require_utils4 = __commonJS((exports) => {
4363
4344
  }
4364
4345
  return res;
4365
4346
  }
4347
+
4348
+ class Hash {
4349
+ clone() {
4350
+ return this._cloneInto();
4351
+ }
4352
+ }
4353
+ exports.Hash = Hash;
4366
4354
  function checkOpts(defaults, opts) {
4367
4355
  if (opts !== undefined && {}.toString.call(opts) !== "[object Object]")
4368
- throw new Error("options should be object or undefined");
4356
+ throw new Error("Options should be object or undefined");
4369
4357
  const merged = Object.assign(defaults, opts);
4370
4358
  return merged;
4371
4359
  }
4372
-
4373
- class Hash {
4374
- }
4375
- exports.Hash = Hash;
4376
- function createHasher(hashCons) {
4360
+ function wrapConstructor(hashCons) {
4377
4361
  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
4378
4362
  const tmp = hashCons();
4379
4363
  hashC.outputLen = tmp.outputLen;
@@ -4381,7 +4365,7 @@ var require_utils4 = __commonJS((exports) => {
4381
4365
  hashC.create = () => hashCons();
4382
4366
  return hashC;
4383
4367
  }
4384
- function createOptHasher(hashCons) {
4368
+ function wrapConstructorWithOpts(hashCons) {
4385
4369
  const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
4386
4370
  const tmp = hashCons({});
4387
4371
  hashC.outputLen = tmp.outputLen;
@@ -4389,7 +4373,7 @@ var require_utils4 = __commonJS((exports) => {
4389
4373
  hashC.create = (opts) => hashCons(opts);
4390
4374
  return hashC;
4391
4375
  }
4392
- function createXOFer(hashCons) {
4376
+ function wrapXOFConstructorWithOpts(hashCons) {
4393
4377
  const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
4394
4378
  const tmp = hashCons({});
4395
4379
  hashC.outputLen = tmp.outputLen;
@@ -4397,9 +4381,6 @@ var require_utils4 = __commonJS((exports) => {
4397
4381
  hashC.create = (opts) => hashCons(opts);
4398
4382
  return hashC;
4399
4383
  }
4400
- exports.wrapConstructor = createHasher;
4401
- exports.wrapConstructorWithOpts = createOptHasher;
4402
- exports.wrapXOFConstructorWithOpts = createXOFer;
4403
4384
  function randomBytes(bytesLength = 32) {
4404
4385
  if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
4405
4386
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
@@ -4414,10 +4395,11 @@ var require_utils4 = __commonJS((exports) => {
4414
4395
  // ../../node_modules/eciesjs/node_modules/@noble/hashes/_md.js
4415
4396
  var require__md = __commonJS((exports) => {
4416
4397
  Object.defineProperty(exports, "__esModule", { value: true });
4417
- exports.SHA512_IV = exports.SHA384_IV = exports.SHA224_IV = exports.SHA256_IV = exports.HashMD = undefined;
4398
+ exports.HashMD = undefined;
4418
4399
  exports.setBigUint64 = setBigUint64;
4419
4400
  exports.Chi = Chi;
4420
4401
  exports.Maj = Maj;
4402
+ var _assert_ts_1 = require__assert();
4421
4403
  var utils_ts_1 = require_utils4();
4422
4404
  function setBigUint64(view, byteOffset, value, isLE) {
4423
4405
  if (typeof view.setBigUint64 === "function")
@@ -4453,10 +4435,9 @@ var require__md = __commonJS((exports) => {
4453
4435
  this.view = (0, utils_ts_1.createView)(this.buffer);
4454
4436
  }
4455
4437
  update(data) {
4456
- (0, utils_ts_1.aexists)(this);
4457
- data = (0, utils_ts_1.toBytes)(data);
4458
- (0, utils_ts_1.abytes)(data);
4438
+ (0, _assert_ts_1.aexists)(this);
4459
4439
  const { view, buffer, blockLen } = this;
4440
+ data = (0, utils_ts_1.toBytes)(data);
4460
4441
  const len = data.length;
4461
4442
  for (let pos = 0;pos < len; ) {
4462
4443
  const take = Math.min(blockLen - this.pos, len - pos);
@@ -4479,13 +4460,13 @@ var require__md = __commonJS((exports) => {
4479
4460
  return this;
4480
4461
  }
4481
4462
  digestInto(out) {
4482
- (0, utils_ts_1.aexists)(this);
4483
- (0, utils_ts_1.aoutput)(out, this);
4463
+ (0, _assert_ts_1.aexists)(this);
4464
+ (0, _assert_ts_1.aoutput)(out, this);
4484
4465
  this.finished = true;
4485
4466
  const { buffer, view, blockLen, isLE } = this;
4486
4467
  let { pos } = this;
4487
4468
  buffer[pos++] = 128;
4488
- (0, utils_ts_1.clean)(this.buffer.subarray(pos));
4469
+ this.buffer.subarray(pos).fill(0);
4489
4470
  if (this.padOffset > blockLen - pos) {
4490
4471
  this.process(view, 0);
4491
4472
  pos = 0;
@@ -4516,84 +4497,197 @@ var require__md = __commonJS((exports) => {
4516
4497
  to || (to = new this.constructor);
4517
4498
  to.set(...this.get());
4518
4499
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
4519
- to.destroyed = destroyed;
4520
- to.finished = finished;
4521
4500
  to.length = length;
4522
4501
  to.pos = pos;
4502
+ to.finished = finished;
4503
+ to.destroyed = destroyed;
4523
4504
  if (length % blockLen)
4524
4505
  to.buffer.set(buffer);
4525
4506
  return to;
4526
4507
  }
4527
- clone() {
4528
- return this._cloneInto();
4529
- }
4530
4508
  }
4531
4509
  exports.HashMD = HashMD;
4532
- exports.SHA256_IV = Uint32Array.from([
4533
- 1779033703,
4534
- 3144134277,
4535
- 1013904242,
4536
- 2773480762,
4537
- 1359893119,
4538
- 2600822924,
4539
- 528734635,
4540
- 1541459225
4541
- ]);
4542
- exports.SHA224_IV = Uint32Array.from([
4543
- 3238371032,
4544
- 914150663,
4545
- 812702999,
4546
- 4144912697,
4547
- 4290775857,
4548
- 1750603025,
4549
- 1694076839,
4550
- 3204075428
4551
- ]);
4552
- exports.SHA384_IV = Uint32Array.from([
4553
- 3418070365,
4554
- 3238371032,
4555
- 1654270250,
4556
- 914150663,
4557
- 2438529370,
4558
- 812702999,
4559
- 355462360,
4560
- 4144912697,
4561
- 1731405415,
4562
- 4290775857,
4563
- 2394180231,
4564
- 1750603025,
4565
- 3675008525,
4566
- 1694076839,
4567
- 1203062813,
4568
- 3204075428
4510
+ });
4511
+
4512
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/sha256.js
4513
+ var require_sha256 = __commonJS((exports) => {
4514
+ Object.defineProperty(exports, "__esModule", { value: true });
4515
+ exports.sha224 = exports.sha256 = exports.SHA256 = undefined;
4516
+ var _md_ts_1 = require__md();
4517
+ var utils_ts_1 = require_utils4();
4518
+ var SHA256_K = /* @__PURE__ */ new Uint32Array([
4519
+ 1116352408,
4520
+ 1899447441,
4521
+ 3049323471,
4522
+ 3921009573,
4523
+ 961987163,
4524
+ 1508970993,
4525
+ 2453635748,
4526
+ 2870763221,
4527
+ 3624381080,
4528
+ 310598401,
4529
+ 607225278,
4530
+ 1426881987,
4531
+ 1925078388,
4532
+ 2162078206,
4533
+ 2614888103,
4534
+ 3248222580,
4535
+ 3835390401,
4536
+ 4022224774,
4537
+ 264347078,
4538
+ 604807628,
4539
+ 770255983,
4540
+ 1249150122,
4541
+ 1555081692,
4542
+ 1996064986,
4543
+ 2554220882,
4544
+ 2821834349,
4545
+ 2952996808,
4546
+ 3210313671,
4547
+ 3336571891,
4548
+ 3584528711,
4549
+ 113926993,
4550
+ 338241895,
4551
+ 666307205,
4552
+ 773529912,
4553
+ 1294757372,
4554
+ 1396182291,
4555
+ 1695183700,
4556
+ 1986661051,
4557
+ 2177026350,
4558
+ 2456956037,
4559
+ 2730485921,
4560
+ 2820302411,
4561
+ 3259730800,
4562
+ 3345764771,
4563
+ 3516065817,
4564
+ 3600352804,
4565
+ 4094571909,
4566
+ 275423344,
4567
+ 430227734,
4568
+ 506948616,
4569
+ 659060556,
4570
+ 883997877,
4571
+ 958139571,
4572
+ 1322822218,
4573
+ 1537002063,
4574
+ 1747873779,
4575
+ 1955562222,
4576
+ 2024104815,
4577
+ 2227730452,
4578
+ 2361852424,
4579
+ 2428436474,
4580
+ 2756734187,
4581
+ 3204031479,
4582
+ 3329325298
4569
4583
  ]);
4570
- exports.SHA512_IV = Uint32Array.from([
4584
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
4571
4585
  1779033703,
4572
- 4089235720,
4573
4586
  3144134277,
4574
- 2227873595,
4575
4587
  1013904242,
4576
- 4271175723,
4577
4588
  2773480762,
4578
- 1595750129,
4579
4589
  1359893119,
4580
- 2917565137,
4581
4590
  2600822924,
4582
- 725511199,
4583
4591
  528734635,
4584
- 4215389547,
4585
- 1541459225,
4586
- 327033209
4592
+ 1541459225
4587
4593
  ]);
4594
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
4595
+
4596
+ class SHA256 extends _md_ts_1.HashMD {
4597
+ constructor(outputLen = 32) {
4598
+ super(64, outputLen, 8, false);
4599
+ this.A = SHA256_IV[0] | 0;
4600
+ this.B = SHA256_IV[1] | 0;
4601
+ this.C = SHA256_IV[2] | 0;
4602
+ this.D = SHA256_IV[3] | 0;
4603
+ this.E = SHA256_IV[4] | 0;
4604
+ this.F = SHA256_IV[5] | 0;
4605
+ this.G = SHA256_IV[6] | 0;
4606
+ this.H = SHA256_IV[7] | 0;
4607
+ }
4608
+ get() {
4609
+ const { A, B, C, D, E, F, G, H } = this;
4610
+ return [A, B, C, D, E, F, G, H];
4611
+ }
4612
+ set(A, B, C, D, E, F, G, H) {
4613
+ this.A = A | 0;
4614
+ this.B = B | 0;
4615
+ this.C = C | 0;
4616
+ this.D = D | 0;
4617
+ this.E = E | 0;
4618
+ this.F = F | 0;
4619
+ this.G = G | 0;
4620
+ this.H = H | 0;
4621
+ }
4622
+ process(view, offset) {
4623
+ for (let i = 0;i < 16; i++, offset += 4)
4624
+ SHA256_W[i] = view.getUint32(offset, false);
4625
+ for (let i = 16;i < 64; i++) {
4626
+ const W15 = SHA256_W[i - 15];
4627
+ const W2 = SHA256_W[i - 2];
4628
+ const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ W15 >>> 3;
4629
+ const s1 = (0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ W2 >>> 10;
4630
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
4631
+ }
4632
+ let { A, B, C, D, E, F, G, H } = this;
4633
+ for (let i = 0;i < 64; i++) {
4634
+ const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
4635
+ const T1 = H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
4636
+ const sigma0 = (0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22);
4637
+ const T2 = sigma0 + (0, _md_ts_1.Maj)(A, B, C) | 0;
4638
+ H = G;
4639
+ G = F;
4640
+ F = E;
4641
+ E = D + T1 | 0;
4642
+ D = C;
4643
+ C = B;
4644
+ B = A;
4645
+ A = T1 + T2 | 0;
4646
+ }
4647
+ A = A + this.A | 0;
4648
+ B = B + this.B | 0;
4649
+ C = C + this.C | 0;
4650
+ D = D + this.D | 0;
4651
+ E = E + this.E | 0;
4652
+ F = F + this.F | 0;
4653
+ G = G + this.G | 0;
4654
+ H = H + this.H | 0;
4655
+ this.set(A, B, C, D, E, F, G, H);
4656
+ }
4657
+ roundClean() {
4658
+ SHA256_W.fill(0);
4659
+ }
4660
+ destroy() {
4661
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
4662
+ this.buffer.fill(0);
4663
+ }
4664
+ }
4665
+ exports.SHA256 = SHA256;
4666
+
4667
+ class SHA224 extends SHA256 {
4668
+ constructor() {
4669
+ super(28);
4670
+ this.A = 3238371032 | 0;
4671
+ this.B = 914150663 | 0;
4672
+ this.C = 812702999 | 0;
4673
+ this.D = 4144912697 | 0;
4674
+ this.E = 4290775857 | 0;
4675
+ this.F = 1750603025 | 0;
4676
+ this.G = 1694076839 | 0;
4677
+ this.H = 3204075428 | 0;
4678
+ }
4679
+ }
4680
+ exports.sha256 = (0, utils_ts_1.wrapConstructor)(() => new SHA256);
4681
+ exports.sha224 = (0, utils_ts_1.wrapConstructor)(() => new SHA224);
4588
4682
  });
4589
4683
 
4590
4684
  // ../../node_modules/eciesjs/node_modules/@noble/hashes/_u64.js
4591
4685
  var require__u64 = __commonJS((exports) => {
4592
4686
  Object.defineProperty(exports, "__esModule", { value: true });
4593
- exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = undefined;
4594
- exports.add = add;
4687
+ exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = undefined;
4595
4688
  exports.fromBig = fromBig;
4596
4689
  exports.split = split;
4690
+ exports.add = add;
4597
4691
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
4598
4692
  var _32n = /* @__PURE__ */ BigInt(32);
4599
4693
  function fromBig(n, le = false) {
@@ -4602,10 +4696,9 @@ var require__u64 = __commonJS((exports) => {
4602
4696
  return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
4603
4697
  }
4604
4698
  function split(lst, le = false) {
4605
- const len = lst.length;
4606
- let Ah = new Uint32Array(len);
4607
- let Al = new Uint32Array(len);
4608
- for (let i = 0;i < len; i++) {
4699
+ let Ah = new Uint32Array(lst.length);
4700
+ let Al = new Uint32Array(lst.length);
4701
+ for (let i = 0;i < lst.length; i++) {
4609
4702
  const { h, l } = fromBig(lst[i], le);
4610
4703
  [Ah[i], Al[i]] = [h, l];
4611
4704
  }
@@ -4680,167 +4773,14 @@ var require__u64 = __commonJS((exports) => {
4680
4773
  exports.default = u64;
4681
4774
  });
4682
4775
 
4683
- // ../../node_modules/eciesjs/node_modules/@noble/hashes/sha2.js
4684
- var require_sha2 = __commonJS((exports) => {
4776
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/sha512.js
4777
+ var require_sha512 = __commonJS((exports) => {
4685
4778
  Object.defineProperty(exports, "__esModule", { value: true });
4686
- exports.sha512_224 = exports.sha512_256 = exports.sha384 = exports.sha512 = exports.sha224 = exports.sha256 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA384 = exports.SHA512 = exports.SHA224 = exports.SHA256 = undefined;
4779
+ exports.sha384 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.SHA384 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA512 = undefined;
4687
4780
  var _md_ts_1 = require__md();
4688
- var u64 = require__u64();
4781
+ var _u64_ts_1 = require__u64();
4689
4782
  var utils_ts_1 = require_utils4();
4690
- var SHA256_K = /* @__PURE__ */ Uint32Array.from([
4691
- 1116352408,
4692
- 1899447441,
4693
- 3049323471,
4694
- 3921009573,
4695
- 961987163,
4696
- 1508970993,
4697
- 2453635748,
4698
- 2870763221,
4699
- 3624381080,
4700
- 310598401,
4701
- 607225278,
4702
- 1426881987,
4703
- 1925078388,
4704
- 2162078206,
4705
- 2614888103,
4706
- 3248222580,
4707
- 3835390401,
4708
- 4022224774,
4709
- 264347078,
4710
- 604807628,
4711
- 770255983,
4712
- 1249150122,
4713
- 1555081692,
4714
- 1996064986,
4715
- 2554220882,
4716
- 2821834349,
4717
- 2952996808,
4718
- 3210313671,
4719
- 3336571891,
4720
- 3584528711,
4721
- 113926993,
4722
- 338241895,
4723
- 666307205,
4724
- 773529912,
4725
- 1294757372,
4726
- 1396182291,
4727
- 1695183700,
4728
- 1986661051,
4729
- 2177026350,
4730
- 2456956037,
4731
- 2730485921,
4732
- 2820302411,
4733
- 3259730800,
4734
- 3345764771,
4735
- 3516065817,
4736
- 3600352804,
4737
- 4094571909,
4738
- 275423344,
4739
- 430227734,
4740
- 506948616,
4741
- 659060556,
4742
- 883997877,
4743
- 958139571,
4744
- 1322822218,
4745
- 1537002063,
4746
- 1747873779,
4747
- 1955562222,
4748
- 2024104815,
4749
- 2227730452,
4750
- 2361852424,
4751
- 2428436474,
4752
- 2756734187,
4753
- 3204031479,
4754
- 3329325298
4755
- ]);
4756
- var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
4757
-
4758
- class SHA256 extends _md_ts_1.HashMD {
4759
- constructor(outputLen = 32) {
4760
- super(64, outputLen, 8, false);
4761
- this.A = _md_ts_1.SHA256_IV[0] | 0;
4762
- this.B = _md_ts_1.SHA256_IV[1] | 0;
4763
- this.C = _md_ts_1.SHA256_IV[2] | 0;
4764
- this.D = _md_ts_1.SHA256_IV[3] | 0;
4765
- this.E = _md_ts_1.SHA256_IV[4] | 0;
4766
- this.F = _md_ts_1.SHA256_IV[5] | 0;
4767
- this.G = _md_ts_1.SHA256_IV[6] | 0;
4768
- this.H = _md_ts_1.SHA256_IV[7] | 0;
4769
- }
4770
- get() {
4771
- const { A, B, C, D, E, F, G, H } = this;
4772
- return [A, B, C, D, E, F, G, H];
4773
- }
4774
- set(A, B, C, D, E, F, G, H) {
4775
- this.A = A | 0;
4776
- this.B = B | 0;
4777
- this.C = C | 0;
4778
- this.D = D | 0;
4779
- this.E = E | 0;
4780
- this.F = F | 0;
4781
- this.G = G | 0;
4782
- this.H = H | 0;
4783
- }
4784
- process(view, offset) {
4785
- for (let i = 0;i < 16; i++, offset += 4)
4786
- SHA256_W[i] = view.getUint32(offset, false);
4787
- for (let i = 16;i < 64; i++) {
4788
- const W15 = SHA256_W[i - 15];
4789
- const W2 = SHA256_W[i - 2];
4790
- const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ W15 >>> 3;
4791
- const s1 = (0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ W2 >>> 10;
4792
- SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
4793
- }
4794
- let { A, B, C, D, E, F, G, H } = this;
4795
- for (let i = 0;i < 64; i++) {
4796
- const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
4797
- const T1 = H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
4798
- const sigma0 = (0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22);
4799
- const T2 = sigma0 + (0, _md_ts_1.Maj)(A, B, C) | 0;
4800
- H = G;
4801
- G = F;
4802
- F = E;
4803
- E = D + T1 | 0;
4804
- D = C;
4805
- C = B;
4806
- B = A;
4807
- A = T1 + T2 | 0;
4808
- }
4809
- A = A + this.A | 0;
4810
- B = B + this.B | 0;
4811
- C = C + this.C | 0;
4812
- D = D + this.D | 0;
4813
- E = E + this.E | 0;
4814
- F = F + this.F | 0;
4815
- G = G + this.G | 0;
4816
- H = H + this.H | 0;
4817
- this.set(A, B, C, D, E, F, G, H);
4818
- }
4819
- roundClean() {
4820
- (0, utils_ts_1.clean)(SHA256_W);
4821
- }
4822
- destroy() {
4823
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
4824
- (0, utils_ts_1.clean)(this.buffer);
4825
- }
4826
- }
4827
- exports.SHA256 = SHA256;
4828
-
4829
- class SHA224 extends SHA256 {
4830
- constructor() {
4831
- super(28);
4832
- this.A = _md_ts_1.SHA224_IV[0] | 0;
4833
- this.B = _md_ts_1.SHA224_IV[1] | 0;
4834
- this.C = _md_ts_1.SHA224_IV[2] | 0;
4835
- this.D = _md_ts_1.SHA224_IV[3] | 0;
4836
- this.E = _md_ts_1.SHA224_IV[4] | 0;
4837
- this.F = _md_ts_1.SHA224_IV[5] | 0;
4838
- this.G = _md_ts_1.SHA224_IV[6] | 0;
4839
- this.H = _md_ts_1.SHA224_IV[7] | 0;
4840
- }
4841
- }
4842
- exports.SHA224 = SHA224;
4843
- var K512 = /* @__PURE__ */ (() => u64.split([
4783
+ var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => _u64_ts_1.default.split([
4844
4784
  "0x428a2f98d728ae22",
4845
4785
  "0x7137449123ef65cd",
4846
4786
  "0xb5c0fbcfec4d3b2f",
@@ -4922,30 +4862,28 @@ var require_sha2 = __commonJS((exports) => {
4922
4862
  "0x5fcb6fab3ad6faec",
4923
4863
  "0x6c44198c4a475817"
4924
4864
  ].map((n) => BigInt(n))))();
4925
- var SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
4926
- var SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
4927
4865
  var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
4928
4866
  var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
4929
4867
 
4930
4868
  class SHA512 extends _md_ts_1.HashMD {
4931
4869
  constructor(outputLen = 64) {
4932
4870
  super(128, outputLen, 16, false);
4933
- this.Ah = _md_ts_1.SHA512_IV[0] | 0;
4934
- this.Al = _md_ts_1.SHA512_IV[1] | 0;
4935
- this.Bh = _md_ts_1.SHA512_IV[2] | 0;
4936
- this.Bl = _md_ts_1.SHA512_IV[3] | 0;
4937
- this.Ch = _md_ts_1.SHA512_IV[4] | 0;
4938
- this.Cl = _md_ts_1.SHA512_IV[5] | 0;
4939
- this.Dh = _md_ts_1.SHA512_IV[6] | 0;
4940
- this.Dl = _md_ts_1.SHA512_IV[7] | 0;
4941
- this.Eh = _md_ts_1.SHA512_IV[8] | 0;
4942
- this.El = _md_ts_1.SHA512_IV[9] | 0;
4943
- this.Fh = _md_ts_1.SHA512_IV[10] | 0;
4944
- this.Fl = _md_ts_1.SHA512_IV[11] | 0;
4945
- this.Gh = _md_ts_1.SHA512_IV[12] | 0;
4946
- this.Gl = _md_ts_1.SHA512_IV[13] | 0;
4947
- this.Hh = _md_ts_1.SHA512_IV[14] | 0;
4948
- this.Hl = _md_ts_1.SHA512_IV[15] | 0;
4871
+ this.Ah = 1779033703 | 0;
4872
+ this.Al = 4089235720 | 0;
4873
+ this.Bh = 3144134277 | 0;
4874
+ this.Bl = 2227873595 | 0;
4875
+ this.Ch = 1013904242 | 0;
4876
+ this.Cl = 4271175723 | 0;
4877
+ this.Dh = 2773480762 | 0;
4878
+ this.Dl = 1595750129 | 0;
4879
+ this.Eh = 1359893119 | 0;
4880
+ this.El = 2917565137 | 0;
4881
+ this.Fh = 2600822924 | 0;
4882
+ this.Fl = 725511199 | 0;
4883
+ this.Gh = 528734635 | 0;
4884
+ this.Gl = 4215389547 | 0;
4885
+ this.Hh = 1541459225 | 0;
4886
+ this.Hl = 327033209 | 0;
4949
4887
  }
4950
4888
  get() {
4951
4889
  const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
@@ -4977,28 +4915,28 @@ var require_sha2 = __commonJS((exports) => {
4977
4915
  for (let i = 16;i < 80; i++) {
4978
4916
  const W15h = SHA512_W_H[i - 15] | 0;
4979
4917
  const W15l = SHA512_W_L[i - 15] | 0;
4980
- const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
4981
- const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
4918
+ const s0h = _u64_ts_1.default.rotrSH(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSH(W15h, W15l, 8) ^ _u64_ts_1.default.shrSH(W15h, W15l, 7);
4919
+ const s0l = _u64_ts_1.default.rotrSL(W15h, W15l, 1) ^ _u64_ts_1.default.rotrSL(W15h, W15l, 8) ^ _u64_ts_1.default.shrSL(W15h, W15l, 7);
4982
4920
  const W2h = SHA512_W_H[i - 2] | 0;
4983
4921
  const W2l = SHA512_W_L[i - 2] | 0;
4984
- const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
4985
- const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
4986
- const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
4987
- const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
4922
+ const s1h = _u64_ts_1.default.rotrSH(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBH(W2h, W2l, 61) ^ _u64_ts_1.default.shrSH(W2h, W2l, 6);
4923
+ const s1l = _u64_ts_1.default.rotrSL(W2h, W2l, 19) ^ _u64_ts_1.default.rotrBL(W2h, W2l, 61) ^ _u64_ts_1.default.shrSL(W2h, W2l, 6);
4924
+ const SUMl = _u64_ts_1.default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
4925
+ const SUMh = _u64_ts_1.default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
4988
4926
  SHA512_W_H[i] = SUMh | 0;
4989
4927
  SHA512_W_L[i] = SUMl | 0;
4990
4928
  }
4991
4929
  let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
4992
4930
  for (let i = 0;i < 80; i++) {
4993
- const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
4994
- const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
4931
+ const sigma1h = _u64_ts_1.default.rotrSH(Eh, El, 14) ^ _u64_ts_1.default.rotrSH(Eh, El, 18) ^ _u64_ts_1.default.rotrBH(Eh, El, 41);
4932
+ const sigma1l = _u64_ts_1.default.rotrSL(Eh, El, 14) ^ _u64_ts_1.default.rotrSL(Eh, El, 18) ^ _u64_ts_1.default.rotrBL(Eh, El, 41);
4995
4933
  const CHIh = Eh & Fh ^ ~Eh & Gh;
4996
4934
  const CHIl = El & Fl ^ ~El & Gl;
4997
- const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
4998
- const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
4935
+ const T1ll = _u64_ts_1.default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
4936
+ const T1h = _u64_ts_1.default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
4999
4937
  const T1l = T1ll | 0;
5000
- const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
5001
- const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
4938
+ const sigma0h = _u64_ts_1.default.rotrSH(Ah, Al, 28) ^ _u64_ts_1.default.rotrBH(Ah, Al, 34) ^ _u64_ts_1.default.rotrBH(Ah, Al, 39);
4939
+ const sigma0l = _u64_ts_1.default.rotrSL(Ah, Al, 28) ^ _u64_ts_1.default.rotrBL(Ah, Al, 34) ^ _u64_ts_1.default.rotrBL(Ah, Al, 39);
5002
4940
  const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
5003
4941
  const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
5004
4942
  Hh = Gh | 0;
@@ -5007,115 +4945,57 @@ var require_sha2 = __commonJS((exports) => {
5007
4945
  Gl = Fl | 0;
5008
4946
  Fh = Eh | 0;
5009
4947
  Fl = El | 0;
5010
- ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
4948
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
5011
4949
  Dh = Ch | 0;
5012
4950
  Dl = Cl | 0;
5013
4951
  Ch = Bh | 0;
5014
4952
  Cl = Bl | 0;
5015
4953
  Bh = Ah | 0;
5016
4954
  Bl = Al | 0;
5017
- const All = u64.add3L(T1l, sigma0l, MAJl);
5018
- Ah = u64.add3H(All, T1h, sigma0h, MAJh);
4955
+ const All = _u64_ts_1.default.add3L(T1l, sigma0l, MAJl);
4956
+ Ah = _u64_ts_1.default.add3H(All, T1h, sigma0h, MAJh);
5019
4957
  Al = All | 0;
5020
4958
  }
5021
- ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
5022
- ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
5023
- ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
5024
- ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
5025
- ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
5026
- ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
5027
- ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
5028
- ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
4959
+ ({ h: Ah, l: Al } = _u64_ts_1.default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
4960
+ ({ h: Bh, l: Bl } = _u64_ts_1.default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
4961
+ ({ h: Ch, l: Cl } = _u64_ts_1.default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
4962
+ ({ h: Dh, l: Dl } = _u64_ts_1.default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
4963
+ ({ h: Eh, l: El } = _u64_ts_1.default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
4964
+ ({ h: Fh, l: Fl } = _u64_ts_1.default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
4965
+ ({ h: Gh, l: Gl } = _u64_ts_1.default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
4966
+ ({ h: Hh, l: Hl } = _u64_ts_1.default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
5029
4967
  this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
5030
4968
  }
5031
4969
  roundClean() {
5032
- (0, utils_ts_1.clean)(SHA512_W_H, SHA512_W_L);
4970
+ SHA512_W_H.fill(0);
4971
+ SHA512_W_L.fill(0);
5033
4972
  }
5034
4973
  destroy() {
5035
- (0, utils_ts_1.clean)(this.buffer);
4974
+ this.buffer.fill(0);
5036
4975
  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
5037
4976
  }
5038
4977
  }
5039
4978
  exports.SHA512 = SHA512;
5040
4979
 
5041
- class SHA384 extends SHA512 {
5042
- constructor() {
5043
- super(48);
5044
- this.Ah = _md_ts_1.SHA384_IV[0] | 0;
5045
- this.Al = _md_ts_1.SHA384_IV[1] | 0;
5046
- this.Bh = _md_ts_1.SHA384_IV[2] | 0;
5047
- this.Bl = _md_ts_1.SHA384_IV[3] | 0;
5048
- this.Ch = _md_ts_1.SHA384_IV[4] | 0;
5049
- this.Cl = _md_ts_1.SHA384_IV[5] | 0;
5050
- this.Dh = _md_ts_1.SHA384_IV[6] | 0;
5051
- this.Dl = _md_ts_1.SHA384_IV[7] | 0;
5052
- this.Eh = _md_ts_1.SHA384_IV[8] | 0;
5053
- this.El = _md_ts_1.SHA384_IV[9] | 0;
5054
- this.Fh = _md_ts_1.SHA384_IV[10] | 0;
5055
- this.Fl = _md_ts_1.SHA384_IV[11] | 0;
5056
- this.Gh = _md_ts_1.SHA384_IV[12] | 0;
5057
- this.Gl = _md_ts_1.SHA384_IV[13] | 0;
5058
- this.Hh = _md_ts_1.SHA384_IV[14] | 0;
5059
- this.Hl = _md_ts_1.SHA384_IV[15] | 0;
5060
- }
5061
- }
5062
- exports.SHA384 = SHA384;
5063
- var T224_IV = /* @__PURE__ */ Uint32Array.from([
5064
- 2352822216,
5065
- 424955298,
5066
- 1944164710,
5067
- 2312950998,
5068
- 502970286,
5069
- 855612546,
5070
- 1738396948,
5071
- 1479516111,
5072
- 258812777,
5073
- 2077511080,
5074
- 2011393907,
5075
- 79989058,
5076
- 1067287976,
5077
- 1780299464,
5078
- 286451373,
5079
- 2446758561
5080
- ]);
5081
- var T256_IV = /* @__PURE__ */ Uint32Array.from([
5082
- 573645204,
5083
- 4230739756,
5084
- 2673172387,
5085
- 3360449730,
5086
- 596883563,
5087
- 1867755857,
5088
- 2520282905,
5089
- 1497426621,
5090
- 2519219938,
5091
- 2827943907,
5092
- 3193839141,
5093
- 1401305490,
5094
- 721525244,
5095
- 746961066,
5096
- 246885852,
5097
- 2177182882
5098
- ]);
5099
-
5100
4980
  class SHA512_224 extends SHA512 {
5101
4981
  constructor() {
5102
4982
  super(28);
5103
- this.Ah = T224_IV[0] | 0;
5104
- this.Al = T224_IV[1] | 0;
5105
- this.Bh = T224_IV[2] | 0;
5106
- this.Bl = T224_IV[3] | 0;
5107
- this.Ch = T224_IV[4] | 0;
5108
- this.Cl = T224_IV[5] | 0;
5109
- this.Dh = T224_IV[6] | 0;
5110
- this.Dl = T224_IV[7] | 0;
5111
- this.Eh = T224_IV[8] | 0;
5112
- this.El = T224_IV[9] | 0;
5113
- this.Fh = T224_IV[10] | 0;
5114
- this.Fl = T224_IV[11] | 0;
5115
- this.Gh = T224_IV[12] | 0;
5116
- this.Gl = T224_IV[13] | 0;
5117
- this.Hh = T224_IV[14] | 0;
5118
- this.Hl = T224_IV[15] | 0;
4983
+ this.Ah = 2352822216 | 0;
4984
+ this.Al = 424955298 | 0;
4985
+ this.Bh = 1944164710 | 0;
4986
+ this.Bl = 2312950998 | 0;
4987
+ this.Ch = 502970286 | 0;
4988
+ this.Cl = 855612546 | 0;
4989
+ this.Dh = 1738396948 | 0;
4990
+ this.Dl = 1479516111 | 0;
4991
+ this.Eh = 258812777 | 0;
4992
+ this.El = 2077511080 | 0;
4993
+ this.Fh = 2011393907 | 0;
4994
+ this.Fl = 79989058 | 0;
4995
+ this.Gh = 1067287976 | 0;
4996
+ this.Gl = 1780299464 | 0;
4997
+ this.Hh = 286451373 | 0;
4998
+ this.Hl = 2446758561 | 0;
5119
4999
  }
5120
5000
  }
5121
5001
  exports.SHA512_224 = SHA512_224;
@@ -5123,31 +5003,78 @@ var require_sha2 = __commonJS((exports) => {
5123
5003
  class SHA512_256 extends SHA512 {
5124
5004
  constructor() {
5125
5005
  super(32);
5126
- this.Ah = T256_IV[0] | 0;
5127
- this.Al = T256_IV[1] | 0;
5128
- this.Bh = T256_IV[2] | 0;
5129
- this.Bl = T256_IV[3] | 0;
5130
- this.Ch = T256_IV[4] | 0;
5131
- this.Cl = T256_IV[5] | 0;
5132
- this.Dh = T256_IV[6] | 0;
5133
- this.Dl = T256_IV[7] | 0;
5134
- this.Eh = T256_IV[8] | 0;
5135
- this.El = T256_IV[9] | 0;
5136
- this.Fh = T256_IV[10] | 0;
5137
- this.Fl = T256_IV[11] | 0;
5138
- this.Gh = T256_IV[12] | 0;
5139
- this.Gl = T256_IV[13] | 0;
5140
- this.Hh = T256_IV[14] | 0;
5141
- this.Hl = T256_IV[15] | 0;
5006
+ this.Ah = 573645204 | 0;
5007
+ this.Al = 4230739756 | 0;
5008
+ this.Bh = 2673172387 | 0;
5009
+ this.Bl = 3360449730 | 0;
5010
+ this.Ch = 596883563 | 0;
5011
+ this.Cl = 1867755857 | 0;
5012
+ this.Dh = 2520282905 | 0;
5013
+ this.Dl = 1497426621 | 0;
5014
+ this.Eh = 2519219938 | 0;
5015
+ this.El = 2827943907 | 0;
5016
+ this.Fh = 3193839141 | 0;
5017
+ this.Fl = 1401305490 | 0;
5018
+ this.Gh = 721525244 | 0;
5019
+ this.Gl = 746961066 | 0;
5020
+ this.Hh = 246885852 | 0;
5021
+ this.Hl = 2177182882 | 0;
5142
5022
  }
5143
5023
  }
5144
5024
  exports.SHA512_256 = SHA512_256;
5145
- exports.sha256 = (0, utils_ts_1.createHasher)(() => new SHA256);
5146
- exports.sha224 = (0, utils_ts_1.createHasher)(() => new SHA224);
5147
- exports.sha512 = (0, utils_ts_1.createHasher)(() => new SHA512);
5148
- exports.sha384 = (0, utils_ts_1.createHasher)(() => new SHA384);
5149
- exports.sha512_256 = (0, utils_ts_1.createHasher)(() => new SHA512_256);
5150
- exports.sha512_224 = (0, utils_ts_1.createHasher)(() => new SHA512_224);
5025
+
5026
+ class SHA384 extends SHA512 {
5027
+ constructor() {
5028
+ super(48);
5029
+ this.Ah = 3418070365 | 0;
5030
+ this.Al = 3238371032 | 0;
5031
+ this.Bh = 1654270250 | 0;
5032
+ this.Bl = 914150663 | 0;
5033
+ this.Ch = 2438529370 | 0;
5034
+ this.Cl = 812702999 | 0;
5035
+ this.Dh = 355462360 | 0;
5036
+ this.Dl = 4144912697 | 0;
5037
+ this.Eh = 1731405415 | 0;
5038
+ this.El = 4290775857 | 0;
5039
+ this.Fh = 2394180231 | 0;
5040
+ this.Fl = 1750603025 | 0;
5041
+ this.Gh = 3675008525 | 0;
5042
+ this.Gl = 1694076839 | 0;
5043
+ this.Hh = 1203062813 | 0;
5044
+ this.Hl = 3204075428 | 0;
5045
+ }
5046
+ }
5047
+ exports.SHA384 = SHA384;
5048
+ exports.sha512 = (0, utils_ts_1.wrapConstructor)(() => new SHA512);
5049
+ exports.sha512_224 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_224);
5050
+ exports.sha512_256 = (0, utils_ts_1.wrapConstructor)(() => new SHA512_256);
5051
+ exports.sha384 = (0, utils_ts_1.wrapConstructor)(() => new SHA384);
5052
+ });
5053
+
5054
+ // ../../node_modules/eciesjs/node_modules/@noble/hashes/sha2.js
5055
+ var require_sha2 = __commonJS((exports) => {
5056
+ Object.defineProperty(exports, "__esModule", { value: true });
5057
+ exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.sha384 = exports.sha256 = exports.sha224 = undefined;
5058
+ var sha256_ts_1 = require_sha256();
5059
+ Object.defineProperty(exports, "sha224", { enumerable: true, get: function() {
5060
+ return sha256_ts_1.sha224;
5061
+ } });
5062
+ Object.defineProperty(exports, "sha256", { enumerable: true, get: function() {
5063
+ return sha256_ts_1.sha256;
5064
+ } });
5065
+ var sha512_ts_1 = require_sha512();
5066
+ Object.defineProperty(exports, "sha384", { enumerable: true, get: function() {
5067
+ return sha512_ts_1.sha384;
5068
+ } });
5069
+ Object.defineProperty(exports, "sha512", { enumerable: true, get: function() {
5070
+ return sha512_ts_1.sha512;
5071
+ } });
5072
+ Object.defineProperty(exports, "sha512_224", { enumerable: true, get: function() {
5073
+ return sha512_ts_1.sha512_224;
5074
+ } });
5075
+ Object.defineProperty(exports, "sha512_256", { enumerable: true, get: function() {
5076
+ return sha512_ts_1.sha512_256;
5077
+ } });
5151
5078
  });
5152
5079
 
5153
5080
  // ../../node_modules/eciesjs/node_modules/@noble/curves/abstract/utils.js
@@ -5449,7 +5376,6 @@ var require_modular = __commonJS((exports) => {
5449
5376
  exports.getMinHashLength = getMinHashLength;
5450
5377
  exports.mapHashToField = mapHashToField;
5451
5378
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5452
- var utils_1 = require_utils4();
5453
5379
  var utils_ts_1 = require_utils5();
5454
5380
  var _0n = BigInt(0);
5455
5381
  var _1n = BigInt(1);
@@ -5509,17 +5435,13 @@ var require_modular = __commonJS((exports) => {
5509
5435
  return mod(x, modulo);
5510
5436
  }
5511
5437
  function tonelliShanks(P) {
5512
- let Q = P - _1n;
5513
- let S = 0;
5514
- while (Q % _2n === _0n) {
5515
- Q /= _2n;
5516
- S++;
5517
- }
5518
- let Z = _2n;
5519
- const _Fp = Field(P);
5520
- while (Z < P && FpIsSquare(_Fp, Z)) {
5521
- if (Z++ > 1000)
5522
- throw new Error("Cannot find square root: probably non-prime P");
5438
+ const legendreC = (P - _1n) / _2n;
5439
+ let Q, S, Z;
5440
+ for (Q = P - _1n, S = 0;Q % _2n === _0n; Q /= _2n, S++)
5441
+ ;
5442
+ for (Z = _2n;Z < P && pow(Z, legendreC, P) !== P - _1n; Z++) {
5443
+ if (Z > 1000)
5444
+ throw new Error("Cannot find square root: likely non-prime P");
5523
5445
  }
5524
5446
  if (S === 1) {
5525
5447
  const p1div4 = (P + _1n) / _4n;
@@ -5532,7 +5454,7 @@ var require_modular = __commonJS((exports) => {
5532
5454
  }
5533
5455
  const Q1div2 = (Q + _1n) / _2n;
5534
5456
  return function tonelliSlow(Fp, n) {
5535
- if (!FpIsSquare(Fp, n))
5457
+ if (Fp.pow(n, legendreC) === Fp.neg(Fp.ONE))
5536
5458
  throw new Error("Cannot find square root");
5537
5459
  let r = S;
5538
5460
  let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q);
@@ -5558,8 +5480,8 @@ var require_modular = __commonJS((exports) => {
5558
5480
  }
5559
5481
  function FpSqrt(P) {
5560
5482
  if (P % _4n === _3n) {
5483
+ const p1div4 = (P + _1n) / _4n;
5561
5484
  return function sqrt3mod4(Fp, n) {
5562
- const p1div4 = (P + _1n) / _4n;
5563
5485
  const root = Fp.pow(n, p1div4);
5564
5486
  if (!Fp.eql(Fp.sqr(root), n))
5565
5487
  throw new Error("Cannot find square root");
@@ -5567,9 +5489,9 @@ var require_modular = __commonJS((exports) => {
5567
5489
  };
5568
5490
  }
5569
5491
  if (P % _8n === _5n) {
5492
+ const c1 = (P - _5n) / _8n;
5570
5493
  return function sqrt5mod8(Fp, n) {
5571
5494
  const n2 = Fp.mul(n, _2n);
5572
- const c1 = (P - _5n) / _8n;
5573
5495
  const v = Fp.pow(n2, c1);
5574
5496
  const nv = Fp.mul(n, v);
5575
5497
  const i = Fp.mul(Fp.mul(nv, _2n), v);
@@ -5616,60 +5538,55 @@ var require_modular = __commonJS((exports) => {
5616
5538
  }, initial);
5617
5539
  return (0, utils_ts_1.validateObject)(field, opts);
5618
5540
  }
5619
- function FpPow(Fp, num, power) {
5541
+ function FpPow(f, num, power) {
5620
5542
  if (power < _0n)
5621
5543
  throw new Error("invalid exponent, negatives unsupported");
5622
5544
  if (power === _0n)
5623
- return Fp.ONE;
5545
+ return f.ONE;
5624
5546
  if (power === _1n)
5625
5547
  return num;
5626
- let p = Fp.ONE;
5548
+ let p = f.ONE;
5627
5549
  let d = num;
5628
5550
  while (power > _0n) {
5629
5551
  if (power & _1n)
5630
- p = Fp.mul(p, d);
5631
- d = Fp.sqr(d);
5552
+ p = f.mul(p, d);
5553
+ d = f.sqr(d);
5632
5554
  power >>= _1n;
5633
5555
  }
5634
5556
  return p;
5635
5557
  }
5636
- function FpInvertBatch(Fp, nums, passZero = false) {
5637
- const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined);
5638
- const multipliedAcc = nums.reduce((acc, num, i) => {
5639
- if (Fp.is0(num))
5558
+ function FpInvertBatch(f, nums) {
5559
+ const tmp = new Array(nums.length);
5560
+ const lastMultiplied = nums.reduce((acc, num, i) => {
5561
+ if (f.is0(num))
5640
5562
  return acc;
5641
- inverted[i] = acc;
5642
- return Fp.mul(acc, num);
5643
- }, Fp.ONE);
5644
- const invertedAcc = Fp.inv(multipliedAcc);
5563
+ tmp[i] = acc;
5564
+ return f.mul(acc, num);
5565
+ }, f.ONE);
5566
+ const inverted = f.inv(lastMultiplied);
5645
5567
  nums.reduceRight((acc, num, i) => {
5646
- if (Fp.is0(num))
5568
+ if (f.is0(num))
5647
5569
  return acc;
5648
- inverted[i] = Fp.mul(acc, inverted[i]);
5649
- return Fp.mul(acc, num);
5650
- }, invertedAcc);
5651
- return inverted;
5652
- }
5653
- function FpDiv(Fp, lhs, rhs) {
5654
- return Fp.mul(lhs, typeof rhs === "bigint" ? invert(rhs, Fp.ORDER) : Fp.inv(rhs));
5655
- }
5656
- function FpLegendre(Fp, n) {
5657
- const legc = (Fp.ORDER - _1n) / _2n;
5658
- const powered = Fp.pow(n, legc);
5659
- const yes = Fp.eql(powered, Fp.ONE);
5660
- const zero = Fp.eql(powered, Fp.ZERO);
5661
- const no = Fp.eql(powered, Fp.neg(Fp.ONE));
5662
- if (!yes && !zero && !no)
5663
- throw new Error("Cannot find square root: probably non-prime P");
5664
- return yes ? 1 : zero ? 0 : -1;
5665
- }
5666
- function FpIsSquare(Fp, n) {
5667
- const l = FpLegendre(Fp, n);
5668
- return l === 0 || l === 1;
5570
+ tmp[i] = f.mul(acc, tmp[i]);
5571
+ return f.mul(acc, num);
5572
+ }, inverted);
5573
+ return tmp;
5574
+ }
5575
+ function FpDiv(f, lhs, rhs) {
5576
+ return f.mul(lhs, typeof rhs === "bigint" ? invert(rhs, f.ORDER) : f.inv(rhs));
5577
+ }
5578
+ function FpLegendre(order) {
5579
+ const legendreConst = (order - _1n) / _2n;
5580
+ return (f, x) => f.pow(x, legendreConst);
5581
+ }
5582
+ function FpIsSquare(f) {
5583
+ const legendre = FpLegendre(f.ORDER);
5584
+ return (x) => {
5585
+ const p = legendre(f, x);
5586
+ return f.eql(p, f.ZERO) || f.eql(p, f.ONE);
5587
+ };
5669
5588
  }
5670
5589
  function nLength(n, nBitLength) {
5671
- if (nBitLength !== undefined)
5672
- (0, utils_1.anumber)(nBitLength);
5673
5590
  const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;
5674
5591
  const nByteLength = Math.ceil(_nBitLength / 8);
5675
5592
  return { nBitLength: _nBitLength, nByteLength };
@@ -5715,14 +5632,14 @@ var require_modular = __commonJS((exports) => {
5715
5632
  sqrtP = FpSqrt(ORDER);
5716
5633
  return sqrtP(f, n);
5717
5634
  }),
5635
+ invertBatch: (lst) => FpInvertBatch(f, lst),
5636
+ cmov: (a, b, c) => c ? b : a,
5718
5637
  toBytes: (num) => isLE ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
5719
5638
  fromBytes: (bytes) => {
5720
5639
  if (bytes.length !== BYTES)
5721
5640
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
5722
5641
  return isLE ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
5723
- },
5724
- invertBatch: (lst) => FpInvertBatch(f, lst),
5725
- cmov: (a, b, c) => c ? b : a
5642
+ }
5726
5643
  });
5727
5644
  return Object.freeze(f);
5728
5645
  }
@@ -6128,7 +6045,7 @@ var require_edwards = __commonJS((exports) => {
6128
6045
  return new Point(x, y, _1n, modP(x * y));
6129
6046
  }
6130
6047
  static normalizeZ(points) {
6131
- const toInv = (0, modular_ts_1.FpInvertBatch)(Fp, points.map((p) => p.ez));
6048
+ const toInv = Fp.invertBatch(points.map((p) => p.ez));
6132
6049
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
6133
6050
  }
6134
6051
  static msm(points, scalars) {
@@ -6296,7 +6213,7 @@ var require_edwards = __commonJS((exports) => {
6296
6213
  function getPublicKey(privKey) {
6297
6214
  return getExtendedPublicKey(privKey).pointBytes;
6298
6215
  }
6299
- function hashDomainToScalar(context = Uint8Array.of(), ...msgs) {
6216
+ function hashDomainToScalar(context = new Uint8Array, ...msgs) {
6300
6217
  const msg = (0, utils_ts_1.concatBytes)(...msgs);
6301
6218
  return modN_LE(cHash(domain(msg, (0, utils_ts_1.ensureBytes)("context", context), !!prehash)));
6302
6219
  }
@@ -6467,47 +6384,43 @@ var require_hash_to_curve = __commonJS((exports) => {
6467
6384
  return u;
6468
6385
  }
6469
6386
  function isogenyMap(field, map) {
6470
- const coeff = map.map((i) => Array.from(i).reverse());
6387
+ const COEFF = map.map((i) => Array.from(i).reverse());
6471
6388
  return (x, y) => {
6472
- const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));
6473
- const [xd_inv, yd_inv] = (0, modular_ts_1.FpInvertBatch)(field, [xd, yd], true);
6474
- x = field.mul(xn, xd_inv);
6475
- y = field.mul(y, field.mul(yn, yd_inv));
6389
+ const [xNum, xDen, yNum, yDen] = COEFF.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));
6390
+ if (field.is0(xDen) || field.is0(yDen))
6391
+ throw new Error("bad point: ZERO");
6392
+ x = field.div(xNum, xDen);
6393
+ y = field.mul(y, field.div(yNum, yDen));
6476
6394
  return { x, y };
6477
6395
  };
6478
6396
  }
6479
- function createHasher(Point, mapToCurve, defaults) {
6397
+ function createHasher(Point, mapToCurve, def) {
6480
6398
  if (typeof mapToCurve !== "function")
6481
6399
  throw new Error("mapToCurve() must be defined");
6482
- function map(num) {
6483
- return Point.fromAffine(mapToCurve(num));
6484
- }
6485
- function clear(initial) {
6486
- const P = initial.clearCofactor();
6487
- if (P.equals(Point.ZERO))
6488
- return Point.ZERO;
6489
- P.assertValidity();
6490
- return P;
6491
- }
6492
6400
  return {
6493
- defaults,
6494
6401
  hashToCurve(msg, options) {
6495
- const u = hash_to_field(msg, 2, { ...defaults, DST: defaults.DST, ...options });
6496
- const u0 = map(u[0]);
6497
- const u1 = map(u[1]);
6498
- return clear(u0.add(u1));
6402
+ const u = hash_to_field(msg, 2, { ...def, DST: def.DST, ...options });
6403
+ const u0 = Point.fromAffine(mapToCurve(u[0]));
6404
+ const u1 = Point.fromAffine(mapToCurve(u[1]));
6405
+ const P = u0.add(u1).clearCofactor();
6406
+ P.assertValidity();
6407
+ return P;
6499
6408
  },
6500
6409
  encodeToCurve(msg, options) {
6501
- const u = hash_to_field(msg, 1, { ...defaults, DST: defaults.encodeDST, ...options });
6502
- return clear(map(u[0]));
6410
+ const u = hash_to_field(msg, 1, { ...def, DST: def.encodeDST, ...options });
6411
+ const P = Point.fromAffine(mapToCurve(u[0])).clearCofactor();
6412
+ P.assertValidity();
6413
+ return P;
6503
6414
  },
6504
6415
  mapToCurve(scalars) {
6505
6416
  if (!Array.isArray(scalars))
6506
- throw new Error("expected array of bigints");
6417
+ throw new Error("mapToCurve: expected array of bigints");
6507
6418
  for (const i of scalars)
6508
6419
  if (typeof i !== "bigint")
6509
- throw new Error("expected array of bigints");
6510
- return clear(map(scalars));
6420
+ throw new Error("mapToCurve: expected array of bigints");
6421
+ const P = Point.fromAffine(mapToCurve(scalars)).clearCofactor();
6422
+ P.assertValidity();
6423
+ return P;
6511
6424
  }
6512
6425
  };
6513
6426
  }
@@ -6538,13 +6451,12 @@ var require_montgomery = __commonJS((exports) => {
6538
6451
  function montgomery(curveDef) {
6539
6452
  const CURVE = validateOpts(curveDef);
6540
6453
  const { P } = CURVE;
6541
- const Fp = (0, modular_ts_1.Field)(P);
6542
6454
  const modP = (n) => (0, modular_ts_1.mod)(n, P);
6543
6455
  const montgomeryBits = CURVE.montgomeryBits;
6544
6456
  const montgomeryBytes = Math.ceil(montgomeryBits / 8);
6545
6457
  const fieldLen = CURVE.nByteLength;
6546
6458
  const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes);
6547
- const powPminus2 = CURVE.powPminus2 || ((x) => Fp.pow(x, P - BigInt(2)));
6459
+ const powPminus2 = CURVE.powPminus2 || ((x) => (0, modular_ts_1.pow)(x, P - BigInt(2), P));
6548
6460
  function cswap(swap, x_2, x_3) {
6549
6461
  const dummy = modP(swap * (x_2 - x_3));
6550
6462
  x_2 = modP(x_2 - dummy);
@@ -6642,7 +6554,7 @@ var require_montgomery = __commonJS((exports) => {
6642
6554
  // ../../node_modules/eciesjs/node_modules/@noble/curves/ed25519.js
6643
6555
  var require_ed25519 = __commonJS((exports) => {
6644
6556
  Object.defineProperty(exports, "__esModule", { value: true });
6645
- exports.hash_to_ristretto255 = exports.hashToRistretto255 = exports.RistrettoPoint = exports.encodeToCurve = exports.hashToCurve = exports.ed25519_hasher = exports.edwardsToMontgomery = exports.x25519 = exports.ed25519ph = exports.ed25519ctx = exports.ed25519 = exports.ED25519_TORSION_SUBGROUP = undefined;
6557
+ exports.hash_to_ristretto255 = exports.hashToRistretto255 = exports.RistrettoPoint = exports.encodeToCurve = exports.hashToCurve = exports.edwardsToMontgomery = exports.x25519 = exports.ed25519ph = exports.ed25519ctx = exports.ed25519 = exports.ED25519_TORSION_SUBGROUP = undefined;
6646
6558
  exports.edwardsToMontgomeryPub = edwardsToMontgomeryPub;
6647
6559
  exports.edwardsToMontgomeryPriv = edwardsToMontgomeryPriv;
6648
6560
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -6827,10 +6739,10 @@ var require_ed25519 = __commonJS((exports) => {
6827
6739
  xd = Fp.cmov(xd, Fp.ONE, e);
6828
6740
  yn = Fp.cmov(yn, Fp.ONE, e);
6829
6741
  yd = Fp.cmov(yd, Fp.ONE, e);
6830
- const [xd_inv, yd_inv] = (0, modular_ts_1.FpInvertBatch)(Fp, [xd, yd], true);
6831
- return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) };
6742
+ const inv = Fp.invertBatch([xd, yd]);
6743
+ return { x: Fp.mul(xn, inv[0]), y: Fp.mul(yn, inv[1]) };
6832
6744
  }
6833
- exports.ed25519_hasher = (() => (0, hash_to_curve_ts_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6745
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.ed25519.ExtendedPoint, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {
6834
6746
  DST: "edwards25519_XMD:SHA-512_ELL2_RO_",
6835
6747
  encodeDST: "edwards25519_XMD:SHA-512_ELL2_NU_",
6836
6748
  p: Fp.ORDER,
@@ -6839,8 +6751,8 @@ var require_ed25519 = __commonJS((exports) => {
6839
6751
  expand: "xmd",
6840
6752
  hash: sha2_1.sha512
6841
6753
  }))();
6842
- exports.hashToCurve = (() => exports.ed25519_hasher.hashToCurve)();
6843
- exports.encodeToCurve = (() => exports.ed25519_hasher.encodeToCurve)();
6754
+ exports.hashToCurve = (() => htf.hashToCurve)();
6755
+ exports.encodeToCurve = (() => htf.encodeToCurve)();
6844
6756
  function aristp(other) {
6845
6757
  if (!(other instanceof RistPoint))
6846
6758
  throw new Error("RistrettoPoint expected");
@@ -7010,6 +6922,7 @@ var require_ed25519 = __commonJS((exports) => {
7010
6922
  var require_hmac = __commonJS((exports) => {
7011
6923
  Object.defineProperty(exports, "__esModule", { value: true });
7012
6924
  exports.hmac = exports.HMAC = undefined;
6925
+ var _assert_ts_1 = require__assert();
7013
6926
  var utils_ts_1 = require_utils4();
7014
6927
 
7015
6928
  class HMAC extends utils_ts_1.Hash {
@@ -7017,7 +6930,7 @@ var require_hmac = __commonJS((exports) => {
7017
6930
  super();
7018
6931
  this.finished = false;
7019
6932
  this.destroyed = false;
7020
- (0, utils_ts_1.ahash)(hash);
6933
+ (0, _assert_ts_1.ahash)(hash);
7021
6934
  const key = (0, utils_ts_1.toBytes)(_key);
7022
6935
  this.iHash = hash.create();
7023
6936
  if (typeof this.iHash.update !== "function")
@@ -7034,16 +6947,16 @@ var require_hmac = __commonJS((exports) => {
7034
6947
  for (let i = 0;i < pad.length; i++)
7035
6948
  pad[i] ^= 54 ^ 92;
7036
6949
  this.oHash.update(pad);
7037
- (0, utils_ts_1.clean)(pad);
6950
+ pad.fill(0);
7038
6951
  }
7039
6952
  update(buf) {
7040
- (0, utils_ts_1.aexists)(this);
6953
+ (0, _assert_ts_1.aexists)(this);
7041
6954
  this.iHash.update(buf);
7042
6955
  return this;
7043
6956
  }
7044
6957
  digestInto(out) {
7045
- (0, utils_ts_1.aexists)(this);
7046
- (0, utils_ts_1.abytes)(out, this.outputLen);
6958
+ (0, _assert_ts_1.aexists)(this);
6959
+ (0, _assert_ts_1.abytes)(out, this.outputLen);
7047
6960
  this.finished = true;
7048
6961
  this.iHash.digestInto(out);
7049
6962
  this.oHash.update(out);
@@ -7067,9 +6980,6 @@ var require_hmac = __commonJS((exports) => {
7067
6980
  to.iHash = iHash._cloneInto(to.iHash);
7068
6981
  return to;
7069
6982
  }
7070
- clone() {
7071
- return this._cloneInto();
7072
- }
7073
6983
  destroy() {
7074
6984
  this.destroyed = true;
7075
6985
  this.oHash.destroy();
@@ -7317,7 +7227,7 @@ var require_weierstrass = __commonJS((exports) => {
7317
7227
  constructor(px, py, pz) {
7318
7228
  if (px == null || !Fp.isValid(px))
7319
7229
  throw new Error("x required");
7320
- if (py == null || !Fp.isValid(py) || Fp.is0(py))
7230
+ if (py == null || !Fp.isValid(py))
7321
7231
  throw new Error("y required");
7322
7232
  if (pz == null || !Fp.isValid(pz))
7323
7233
  throw new Error("z required");
@@ -7344,7 +7254,7 @@ var require_weierstrass = __commonJS((exports) => {
7344
7254
  return this.toAffine().y;
7345
7255
  }
7346
7256
  static normalizeZ(points) {
7347
- const toInv = (0, modular_ts_1.FpInvertBatch)(Fp, points.map((p) => p.pz));
7257
+ const toInv = Fp.invertBatch(points.map((p) => p.pz));
7348
7258
  return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
7349
7259
  }
7350
7260
  static fromHex(hex) {
@@ -7705,7 +7615,7 @@ var require_weierstrass = __commonJS((exports) => {
7705
7615
  return (0, utils_ts_1.hexToBytes)(this.toDERHex());
7706
7616
  }
7707
7617
  toDERHex() {
7708
- return exports.DER.hexFromSig(this);
7618
+ return exports.DER.hexFromSig({ r: this.r, s: this.s });
7709
7619
  }
7710
7620
  toCompactRawBytes() {
7711
7621
  return (0, utils_ts_1.hexToBytes)(this.toCompactHex());
@@ -7980,8 +7890,7 @@ var require_weierstrass = __commonJS((exports) => {
7980
7890
  y = Fp.cmov(y, value, isValid2);
7981
7891
  const e1 = Fp.isOdd(u) === Fp.isOdd(y);
7982
7892
  y = Fp.cmov(Fp.neg(y), y, e1);
7983
- const tv4_inv = (0, modular_ts_1.FpInvertBatch)(Fp, [tv4], true)[0];
7984
- x = Fp.mul(x, tv4_inv);
7893
+ x = Fp.div(x, tv4);
7985
7894
  return { x, y };
7986
7895
  };
7987
7896
  }
@@ -8012,7 +7921,7 @@ var require__shortw_utils = __commonJS((exports) => {
8012
7921
  // ../../node_modules/eciesjs/node_modules/@noble/curves/secp256k1.js
8013
7922
  var require_secp256k1 = __commonJS((exports) => {
8014
7923
  Object.defineProperty(exports, "__esModule", { value: true });
8015
- exports.encodeToCurve = exports.hashToCurve = exports.secp256k1_hasher = exports.schnorr = exports.secp256k1 = undefined;
7924
+ exports.encodeToCurve = exports.hashToCurve = exports.schnorr = exports.secp256k1 = undefined;
8016
7925
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
8017
7926
  var sha2_1 = require_sha2();
8018
7927
  var utils_1 = require_utils4();
@@ -8208,7 +8117,7 @@ var require_secp256k1 = __commonJS((exports) => {
8208
8117
  B: BigInt("1771"),
8209
8118
  Z: Fpk1.create(BigInt("-11"))
8210
8119
  }))();
8211
- exports.secp256k1_hasher = (() => (0, hash_to_curve_ts_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8120
+ var htf = /* @__PURE__ */ (() => (0, hash_to_curve_ts_1.createHasher)(exports.secp256k1.ProjectivePoint, (scalars) => {
8212
8121
  const { x, y } = mapSWU(Fpk1.create(scalars[0]));
8213
8122
  return isoMap(x, y);
8214
8123
  }, {
@@ -8220,8 +8129,8 @@ var require_secp256k1 = __commonJS((exports) => {
8220
8129
  expand: "xmd",
8221
8130
  hash: sha2_1.sha256
8222
8131
  }))();
8223
- exports.hashToCurve = (() => exports.secp256k1_hasher.hashToCurve)();
8224
- exports.encodeToCurve = (() => exports.secp256k1_hasher.encodeToCurve)();
8132
+ exports.hashToCurve = (() => htf.hashToCurve)();
8133
+ exports.encodeToCurve = (() => htf.encodeToCurve)();
8225
8134
  });
8226
8135
 
8227
8136
  // ../../node_modules/eciesjs/dist/utils/hex.js
@@ -8341,55 +8250,45 @@ var require_hkdf = __commonJS((exports) => {
8341
8250
  exports.hkdf = undefined;
8342
8251
  exports.extract = extract;
8343
8252
  exports.expand = expand;
8253
+ var _assert_ts_1 = require__assert();
8344
8254
  var hmac_ts_1 = require_hmac();
8345
8255
  var utils_ts_1 = require_utils4();
8346
8256
  function extract(hash, ikm, salt) {
8347
- (0, utils_ts_1.ahash)(hash);
8257
+ (0, _assert_ts_1.ahash)(hash);
8348
8258
  if (salt === undefined)
8349
8259
  salt = new Uint8Array(hash.outputLen);
8350
8260
  return (0, hmac_ts_1.hmac)(hash, (0, utils_ts_1.toBytes)(salt), (0, utils_ts_1.toBytes)(ikm));
8351
8261
  }
8352
- var HKDF_COUNTER = /* @__PURE__ */ Uint8Array.from([0]);
8353
- var EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
8262
+ var HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]);
8263
+ var EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array;
8354
8264
  function expand(hash, prk, info, length = 32) {
8355
- (0, utils_ts_1.ahash)(hash);
8356
- (0, utils_ts_1.anumber)(length);
8357
- const olen = hash.outputLen;
8358
- if (length > 255 * olen)
8265
+ (0, _assert_ts_1.ahash)(hash);
8266
+ (0, _assert_ts_1.anumber)(length);
8267
+ if (length > 255 * hash.outputLen)
8359
8268
  throw new Error("Length should be <= 255*HashLen");
8360
- const blocks = Math.ceil(length / olen);
8269
+ const blocks = Math.ceil(length / hash.outputLen);
8361
8270
  if (info === undefined)
8362
8271
  info = EMPTY_BUFFER;
8363
- const okm = new Uint8Array(blocks * olen);
8272
+ const okm = new Uint8Array(blocks * hash.outputLen);
8364
8273
  const HMAC = hmac_ts_1.hmac.create(hash, prk);
8365
8274
  const HMACTmp = HMAC._cloneInto();
8366
8275
  const T = new Uint8Array(HMAC.outputLen);
8367
8276
  for (let counter = 0;counter < blocks; counter++) {
8368
8277
  HKDF_COUNTER[0] = counter + 1;
8369
8278
  HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T).update(info).update(HKDF_COUNTER).digestInto(T);
8370
- okm.set(T, olen * counter);
8279
+ okm.set(T, hash.outputLen * counter);
8371
8280
  HMAC._cloneInto(HMACTmp);
8372
8281
  }
8373
8282
  HMAC.destroy();
8374
8283
  HMACTmp.destroy();
8375
- (0, utils_ts_1.clean)(T, HKDF_COUNTER);
8284
+ T.fill(0);
8285
+ HKDF_COUNTER.fill(0);
8376
8286
  return okm.slice(0, length);
8377
8287
  }
8378
8288
  var hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);
8379
8289
  exports.hkdf = hkdf;
8380
8290
  });
8381
8291
 
8382
- // ../../node_modules/eciesjs/node_modules/@noble/hashes/sha256.js
8383
- var require_sha256 = __commonJS((exports) => {
8384
- Object.defineProperty(exports, "__esModule", { value: true });
8385
- exports.sha224 = exports.SHA224 = exports.sha256 = exports.SHA256 = undefined;
8386
- var sha2_ts_1 = require_sha2();
8387
- exports.SHA256 = sha2_ts_1.SHA256;
8388
- exports.sha256 = sha2_ts_1.sha256;
8389
- exports.SHA224 = sha2_ts_1.SHA224;
8390
- exports.sha224 = sha2_ts_1.sha224;
8391
- });
8392
-
8393
8292
  // ../../node_modules/eciesjs/dist/utils/hash.js
8394
8293
  var require_hash = __commonJS((exports) => {
8395
8294
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -10696,15 +10595,15 @@ var require_main2 = __commonJS((exports, module) => {
10696
10595
  lastError = error;
10697
10596
  if (error.code === "MISSING_ENV_FILE") {
10698
10597
  if (!options.convention) {
10699
- console.error(error.message);
10598
+ logger.error(error.message);
10700
10599
  if (error.help) {
10701
- console.error(error.help);
10600
+ logger.error(error.help);
10702
10601
  }
10703
10602
  }
10704
10603
  } else {
10705
- console.error(error.message);
10604
+ logger.error(error.message);
10706
10605
  if (error.help) {
10707
- console.error(error.help);
10606
+ logger.error(error.help);
10708
10607
  }
10709
10608
  }
10710
10609
  }
@@ -10749,9 +10648,9 @@ var require_main2 = __commonJS((exports, module) => {
10749
10648
  const overload = options.overload || options.override;
10750
10649
  const { parsed, errors } = new Parse(src, privateKey, processEnv, overload).run();
10751
10650
  for (const error of errors) {
10752
- console.error(error.message);
10651
+ logger.error(error.message);
10753
10652
  if (error.help) {
10754
- console.error(error.help);
10653
+ logger.error(error.help);
10755
10654
  }
10756
10655
  }
10757
10656
  return parsed;
@@ -10822,9 +10721,9 @@ var require_main2 = __commonJS((exports, module) => {
10822
10721
  }
10823
10722
  if (options.strict)
10824
10723
  throw error;
10825
- console.error(error.message);
10724
+ logger.error(error.message);
10826
10725
  if (error.help) {
10827
- console.error(error.help);
10726
+ logger.error(error.help);
10828
10727
  }
10829
10728
  }
10830
10729
  if (key) {
@@ -29869,7 +29768,7 @@ var require_lib3 = __commonJS((exports, module) => {
29869
29768
  };
29870
29769
  });
29871
29770
 
29872
- // ../../node_modules/lru-cache/dist/commonjs/index.js
29771
+ // ../../node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/index.js
29873
29772
  var require_commonjs = __commonJS((exports) => {
29874
29773
  Object.defineProperty(exports, "__esModule", { value: true });
29875
29774
  exports.LRUCache = undefined;
@@ -32724,8 +32623,1123 @@ globstar while`, file, fr, pattern, pr, swallowee);
32724
32623
  exports.minimatch.unescape = unescape_js_1.unescape;
32725
32624
  });
32726
32625
 
32727
- // ../../node_modules/minipass/dist/commonjs/index.js
32626
+ // ../../node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js
32728
32627
  var require_commonjs3 = __commonJS((exports) => {
32628
+ Object.defineProperty(exports, "__esModule", { value: true });
32629
+ exports.LRUCache = undefined;
32630
+ var perf2 = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
32631
+ var warned2 = new Set;
32632
+ var PROCESS2 = typeof process === "object" && !!process ? process : {};
32633
+ var emitWarning2 = (msg, type2, code, fn) => {
32634
+ typeof PROCESS2.emitWarning === "function" ? PROCESS2.emitWarning(msg, type2, code, fn) : console.error(`[${code}] ${type2}: ${msg}`);
32635
+ };
32636
+ var AC2 = globalThis.AbortController;
32637
+ var AS2 = globalThis.AbortSignal;
32638
+ if (typeof AC2 === "undefined") {
32639
+ AS2 = class AbortSignal2 {
32640
+ onabort;
32641
+ _onabort = [];
32642
+ reason;
32643
+ aborted = false;
32644
+ addEventListener(_, fn) {
32645
+ this._onabort.push(fn);
32646
+ }
32647
+ };
32648
+ AC2 = class AbortController2 {
32649
+ constructor() {
32650
+ warnACPolyfill();
32651
+ }
32652
+ signal = new AS2;
32653
+ abort(reason) {
32654
+ if (this.signal.aborted)
32655
+ return;
32656
+ this.signal.reason = reason;
32657
+ this.signal.aborted = true;
32658
+ for (const fn of this.signal._onabort) {
32659
+ fn(reason);
32660
+ }
32661
+ this.signal.onabort?.(reason);
32662
+ }
32663
+ };
32664
+ let printACPolyfillWarning = PROCESS2.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
32665
+ const warnACPolyfill = () => {
32666
+ if (!printACPolyfillWarning)
32667
+ return;
32668
+ printACPolyfillWarning = false;
32669
+ emitWarning2("AbortController is not defined. If using lru-cache in " + "node 14, load an AbortController polyfill from the " + "`node-abort-controller` package. A minimal polyfill is " + "provided for use by LRUCache.fetch(), but it should not be " + "relied upon in other contexts (eg, passing it to other APIs that " + "use AbortController/AbortSignal might have undesirable effects). " + "You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
32670
+ };
32671
+ }
32672
+ var shouldWarn2 = (code) => !warned2.has(code);
32673
+ var TYPE2 = Symbol("type");
32674
+ var isPosInt2 = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
32675
+ var getUintArray2 = (max) => !isPosInt2(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray2 : null;
32676
+
32677
+ class ZeroArray2 extends Array {
32678
+ constructor(size) {
32679
+ super(size);
32680
+ this.fill(0);
32681
+ }
32682
+ }
32683
+
32684
+ class Stack2 {
32685
+ heap;
32686
+ length;
32687
+ static #constructing = false;
32688
+ static create(max) {
32689
+ const HeapCls = getUintArray2(max);
32690
+ if (!HeapCls)
32691
+ return [];
32692
+ Stack2.#constructing = true;
32693
+ const s = new Stack2(max, HeapCls);
32694
+ Stack2.#constructing = false;
32695
+ return s;
32696
+ }
32697
+ constructor(max, HeapCls) {
32698
+ if (!Stack2.#constructing) {
32699
+ throw new TypeError("instantiate Stack using Stack.create(n)");
32700
+ }
32701
+ this.heap = new HeapCls(max);
32702
+ this.length = 0;
32703
+ }
32704
+ push(n2) {
32705
+ this.heap[this.length++] = n2;
32706
+ }
32707
+ pop() {
32708
+ return this.heap[--this.length];
32709
+ }
32710
+ }
32711
+
32712
+ class LRUCache2 {
32713
+ #max;
32714
+ #maxSize;
32715
+ #dispose;
32716
+ #disposeAfter;
32717
+ #fetchMethod;
32718
+ #memoMethod;
32719
+ ttl;
32720
+ ttlResolution;
32721
+ ttlAutopurge;
32722
+ updateAgeOnGet;
32723
+ updateAgeOnHas;
32724
+ allowStale;
32725
+ noDisposeOnSet;
32726
+ noUpdateTTL;
32727
+ maxEntrySize;
32728
+ sizeCalculation;
32729
+ noDeleteOnFetchRejection;
32730
+ noDeleteOnStaleGet;
32731
+ allowStaleOnFetchAbort;
32732
+ allowStaleOnFetchRejection;
32733
+ ignoreFetchAbort;
32734
+ #size;
32735
+ #calculatedSize;
32736
+ #keyMap;
32737
+ #keyList;
32738
+ #valList;
32739
+ #next;
32740
+ #prev;
32741
+ #head;
32742
+ #tail;
32743
+ #free;
32744
+ #disposed;
32745
+ #sizes;
32746
+ #starts;
32747
+ #ttls;
32748
+ #hasDispose;
32749
+ #hasFetchMethod;
32750
+ #hasDisposeAfter;
32751
+ static unsafeExposeInternals(c) {
32752
+ return {
32753
+ starts: c.#starts,
32754
+ ttls: c.#ttls,
32755
+ sizes: c.#sizes,
32756
+ keyMap: c.#keyMap,
32757
+ keyList: c.#keyList,
32758
+ valList: c.#valList,
32759
+ next: c.#next,
32760
+ prev: c.#prev,
32761
+ get head() {
32762
+ return c.#head;
32763
+ },
32764
+ get tail() {
32765
+ return c.#tail;
32766
+ },
32767
+ free: c.#free,
32768
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
32769
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
32770
+ moveToTail: (index) => c.#moveToTail(index),
32771
+ indexes: (options) => c.#indexes(options),
32772
+ rindexes: (options) => c.#rindexes(options),
32773
+ isStale: (index) => c.#isStale(index)
32774
+ };
32775
+ }
32776
+ get max() {
32777
+ return this.#max;
32778
+ }
32779
+ get maxSize() {
32780
+ return this.#maxSize;
32781
+ }
32782
+ get calculatedSize() {
32783
+ return this.#calculatedSize;
32784
+ }
32785
+ get size() {
32786
+ return this.#size;
32787
+ }
32788
+ get fetchMethod() {
32789
+ return this.#fetchMethod;
32790
+ }
32791
+ get memoMethod() {
32792
+ return this.#memoMethod;
32793
+ }
32794
+ get dispose() {
32795
+ return this.#dispose;
32796
+ }
32797
+ get disposeAfter() {
32798
+ return this.#disposeAfter;
32799
+ }
32800
+ constructor(options) {
32801
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
32802
+ if (max !== 0 && !isPosInt2(max)) {
32803
+ throw new TypeError("max option must be a nonnegative integer");
32804
+ }
32805
+ const UintArray = max ? getUintArray2(max) : Array;
32806
+ if (!UintArray) {
32807
+ throw new Error("invalid max value: " + max);
32808
+ }
32809
+ this.#max = max;
32810
+ this.#maxSize = maxSize;
32811
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
32812
+ this.sizeCalculation = sizeCalculation;
32813
+ if (this.sizeCalculation) {
32814
+ if (!this.#maxSize && !this.maxEntrySize) {
32815
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
32816
+ }
32817
+ if (typeof this.sizeCalculation !== "function") {
32818
+ throw new TypeError("sizeCalculation set to non-function");
32819
+ }
32820
+ }
32821
+ if (memoMethod !== undefined && typeof memoMethod !== "function") {
32822
+ throw new TypeError("memoMethod must be a function if defined");
32823
+ }
32824
+ this.#memoMethod = memoMethod;
32825
+ if (fetchMethod !== undefined && typeof fetchMethod !== "function") {
32826
+ throw new TypeError("fetchMethod must be a function if specified");
32827
+ }
32828
+ this.#fetchMethod = fetchMethod;
32829
+ this.#hasFetchMethod = !!fetchMethod;
32830
+ this.#keyMap = new Map;
32831
+ this.#keyList = new Array(max).fill(undefined);
32832
+ this.#valList = new Array(max).fill(undefined);
32833
+ this.#next = new UintArray(max);
32834
+ this.#prev = new UintArray(max);
32835
+ this.#head = 0;
32836
+ this.#tail = 0;
32837
+ this.#free = Stack2.create(max);
32838
+ this.#size = 0;
32839
+ this.#calculatedSize = 0;
32840
+ if (typeof dispose === "function") {
32841
+ this.#dispose = dispose;
32842
+ }
32843
+ if (typeof disposeAfter === "function") {
32844
+ this.#disposeAfter = disposeAfter;
32845
+ this.#disposed = [];
32846
+ } else {
32847
+ this.#disposeAfter = undefined;
32848
+ this.#disposed = undefined;
32849
+ }
32850
+ this.#hasDispose = !!this.#dispose;
32851
+ this.#hasDisposeAfter = !!this.#disposeAfter;
32852
+ this.noDisposeOnSet = !!noDisposeOnSet;
32853
+ this.noUpdateTTL = !!noUpdateTTL;
32854
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
32855
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
32856
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
32857
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
32858
+ if (this.maxEntrySize !== 0) {
32859
+ if (this.#maxSize !== 0) {
32860
+ if (!isPosInt2(this.#maxSize)) {
32861
+ throw new TypeError("maxSize must be a positive integer if specified");
32862
+ }
32863
+ }
32864
+ if (!isPosInt2(this.maxEntrySize)) {
32865
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
32866
+ }
32867
+ this.#initializeSizeTracking();
32868
+ }
32869
+ this.allowStale = !!allowStale;
32870
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
32871
+ this.updateAgeOnGet = !!updateAgeOnGet;
32872
+ this.updateAgeOnHas = !!updateAgeOnHas;
32873
+ this.ttlResolution = isPosInt2(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
32874
+ this.ttlAutopurge = !!ttlAutopurge;
32875
+ this.ttl = ttl || 0;
32876
+ if (this.ttl) {
32877
+ if (!isPosInt2(this.ttl)) {
32878
+ throw new TypeError("ttl must be a positive integer if specified");
32879
+ }
32880
+ this.#initializeTTLTracking();
32881
+ }
32882
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
32883
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
32884
+ }
32885
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
32886
+ const code = "LRU_CACHE_UNBOUNDED";
32887
+ if (shouldWarn2(code)) {
32888
+ warned2.add(code);
32889
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
32890
+ emitWarning2(msg, "UnboundedCacheWarning", code, LRUCache2);
32891
+ }
32892
+ }
32893
+ }
32894
+ getRemainingTTL(key2) {
32895
+ return this.#keyMap.has(key2) ? Infinity : 0;
32896
+ }
32897
+ #initializeTTLTracking() {
32898
+ const ttls = new ZeroArray2(this.#max);
32899
+ const starts = new ZeroArray2(this.#max);
32900
+ this.#ttls = ttls;
32901
+ this.#starts = starts;
32902
+ this.#setItemTTL = (index, ttl, start = perf2.now()) => {
32903
+ starts[index] = ttl !== 0 ? start : 0;
32904
+ ttls[index] = ttl;
32905
+ if (ttl !== 0 && this.ttlAutopurge) {
32906
+ const t3 = setTimeout(() => {
32907
+ if (this.#isStale(index)) {
32908
+ this.#delete(this.#keyList[index], "expire");
32909
+ }
32910
+ }, ttl + 1);
32911
+ if (t3.unref) {
32912
+ t3.unref();
32913
+ }
32914
+ }
32915
+ };
32916
+ this.#updateItemAge = (index) => {
32917
+ starts[index] = ttls[index] !== 0 ? perf2.now() : 0;
32918
+ };
32919
+ this.#statusTTL = (status, index) => {
32920
+ if (ttls[index]) {
32921
+ const ttl = ttls[index];
32922
+ const start = starts[index];
32923
+ if (!ttl || !start)
32924
+ return;
32925
+ status.ttl = ttl;
32926
+ status.start = start;
32927
+ status.now = cachedNow || getNow();
32928
+ const age = status.now - start;
32929
+ status.remainingTTL = ttl - age;
32930
+ }
32931
+ };
32932
+ let cachedNow = 0;
32933
+ const getNow = () => {
32934
+ const n2 = perf2.now();
32935
+ if (this.ttlResolution > 0) {
32936
+ cachedNow = n2;
32937
+ const t3 = setTimeout(() => cachedNow = 0, this.ttlResolution);
32938
+ if (t3.unref) {
32939
+ t3.unref();
32940
+ }
32941
+ }
32942
+ return n2;
32943
+ };
32944
+ this.getRemainingTTL = (key2) => {
32945
+ const index = this.#keyMap.get(key2);
32946
+ if (index === undefined) {
32947
+ return 0;
32948
+ }
32949
+ const ttl = ttls[index];
32950
+ const start = starts[index];
32951
+ if (!ttl || !start) {
32952
+ return Infinity;
32953
+ }
32954
+ const age = (cachedNow || getNow()) - start;
32955
+ return ttl - age;
32956
+ };
32957
+ this.#isStale = (index) => {
32958
+ const s = starts[index];
32959
+ const t3 = ttls[index];
32960
+ return !!t3 && !!s && (cachedNow || getNow()) - s > t3;
32961
+ };
32962
+ }
32963
+ #updateItemAge = () => {};
32964
+ #statusTTL = () => {};
32965
+ #setItemTTL = () => {};
32966
+ #isStale = () => false;
32967
+ #initializeSizeTracking() {
32968
+ const sizes = new ZeroArray2(this.#max);
32969
+ this.#calculatedSize = 0;
32970
+ this.#sizes = sizes;
32971
+ this.#removeItemSize = (index) => {
32972
+ this.#calculatedSize -= sizes[index];
32973
+ sizes[index] = 0;
32974
+ };
32975
+ this.#requireSize = (k, v, size, sizeCalculation) => {
32976
+ if (this.#isBackgroundFetch(v)) {
32977
+ return 0;
32978
+ }
32979
+ if (!isPosInt2(size)) {
32980
+ if (sizeCalculation) {
32981
+ if (typeof sizeCalculation !== "function") {
32982
+ throw new TypeError("sizeCalculation must be a function");
32983
+ }
32984
+ size = sizeCalculation(v, k);
32985
+ if (!isPosInt2(size)) {
32986
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
32987
+ }
32988
+ } else {
32989
+ throw new TypeError("invalid size value (must be positive integer). " + "When maxSize or maxEntrySize is used, sizeCalculation " + "or size must be set.");
32990
+ }
32991
+ }
32992
+ return size;
32993
+ };
32994
+ this.#addItemSize = (index, size, status) => {
32995
+ sizes[index] = size;
32996
+ if (this.#maxSize) {
32997
+ const maxSize = this.#maxSize - sizes[index];
32998
+ while (this.#calculatedSize > maxSize) {
32999
+ this.#evict(true);
33000
+ }
33001
+ }
33002
+ this.#calculatedSize += sizes[index];
33003
+ if (status) {
33004
+ status.entrySize = size;
33005
+ status.totalCalculatedSize = this.#calculatedSize;
33006
+ }
33007
+ };
33008
+ }
33009
+ #removeItemSize = (_i) => {};
33010
+ #addItemSize = (_i, _s, _st) => {};
33011
+ #requireSize = (_k, _v, size, sizeCalculation) => {
33012
+ if (size || sizeCalculation) {
33013
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
33014
+ }
33015
+ return 0;
33016
+ };
33017
+ *#indexes({ allowStale = this.allowStale } = {}) {
33018
+ if (this.#size) {
33019
+ for (let i2 = this.#tail;; ) {
33020
+ if (!this.#isValidIndex(i2)) {
33021
+ break;
33022
+ }
33023
+ if (allowStale || !this.#isStale(i2)) {
33024
+ yield i2;
33025
+ }
33026
+ if (i2 === this.#head) {
33027
+ break;
33028
+ } else {
33029
+ i2 = this.#prev[i2];
33030
+ }
33031
+ }
33032
+ }
33033
+ }
33034
+ *#rindexes({ allowStale = this.allowStale } = {}) {
33035
+ if (this.#size) {
33036
+ for (let i2 = this.#head;; ) {
33037
+ if (!this.#isValidIndex(i2)) {
33038
+ break;
33039
+ }
33040
+ if (allowStale || !this.#isStale(i2)) {
33041
+ yield i2;
33042
+ }
33043
+ if (i2 === this.#tail) {
33044
+ break;
33045
+ } else {
33046
+ i2 = this.#next[i2];
33047
+ }
33048
+ }
33049
+ }
33050
+ }
33051
+ #isValidIndex(index) {
33052
+ return index !== undefined && this.#keyMap.get(this.#keyList[index]) === index;
33053
+ }
33054
+ *entries() {
33055
+ for (const i2 of this.#indexes()) {
33056
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33057
+ yield [this.#keyList[i2], this.#valList[i2]];
33058
+ }
33059
+ }
33060
+ }
33061
+ *rentries() {
33062
+ for (const i2 of this.#rindexes()) {
33063
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33064
+ yield [this.#keyList[i2], this.#valList[i2]];
33065
+ }
33066
+ }
33067
+ }
33068
+ *keys() {
33069
+ for (const i2 of this.#indexes()) {
33070
+ const k = this.#keyList[i2];
33071
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33072
+ yield k;
33073
+ }
33074
+ }
33075
+ }
33076
+ *rkeys() {
33077
+ for (const i2 of this.#rindexes()) {
33078
+ const k = this.#keyList[i2];
33079
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33080
+ yield k;
33081
+ }
33082
+ }
33083
+ }
33084
+ *values() {
33085
+ for (const i2 of this.#indexes()) {
33086
+ const v = this.#valList[i2];
33087
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33088
+ yield this.#valList[i2];
33089
+ }
33090
+ }
33091
+ }
33092
+ *rvalues() {
33093
+ for (const i2 of this.#rindexes()) {
33094
+ const v = this.#valList[i2];
33095
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
33096
+ yield this.#valList[i2];
33097
+ }
33098
+ }
33099
+ }
33100
+ [Symbol.iterator]() {
33101
+ return this.entries();
33102
+ }
33103
+ [Symbol.toStringTag] = "LRUCache";
33104
+ find(fn, getOptions = {}) {
33105
+ for (const i2 of this.#indexes()) {
33106
+ const v = this.#valList[i2];
33107
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33108
+ if (value2 === undefined)
33109
+ continue;
33110
+ if (fn(value2, this.#keyList[i2], this)) {
33111
+ return this.get(this.#keyList[i2], getOptions);
33112
+ }
33113
+ }
33114
+ }
33115
+ forEach(fn, thisp = this) {
33116
+ for (const i2 of this.#indexes()) {
33117
+ const v = this.#valList[i2];
33118
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33119
+ if (value2 === undefined)
33120
+ continue;
33121
+ fn.call(thisp, value2, this.#keyList[i2], this);
33122
+ }
33123
+ }
33124
+ rforEach(fn, thisp = this) {
33125
+ for (const i2 of this.#rindexes()) {
33126
+ const v = this.#valList[i2];
33127
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33128
+ if (value2 === undefined)
33129
+ continue;
33130
+ fn.call(thisp, value2, this.#keyList[i2], this);
33131
+ }
33132
+ }
33133
+ purgeStale() {
33134
+ let deleted = false;
33135
+ for (const i2 of this.#rindexes({ allowStale: true })) {
33136
+ if (this.#isStale(i2)) {
33137
+ this.#delete(this.#keyList[i2], "expire");
33138
+ deleted = true;
33139
+ }
33140
+ }
33141
+ return deleted;
33142
+ }
33143
+ info(key2) {
33144
+ const i2 = this.#keyMap.get(key2);
33145
+ if (i2 === undefined)
33146
+ return;
33147
+ const v = this.#valList[i2];
33148
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33149
+ if (value2 === undefined)
33150
+ return;
33151
+ const entry = { value: value2 };
33152
+ if (this.#ttls && this.#starts) {
33153
+ const ttl = this.#ttls[i2];
33154
+ const start = this.#starts[i2];
33155
+ if (ttl && start) {
33156
+ const remain = ttl - (perf2.now() - start);
33157
+ entry.ttl = remain;
33158
+ entry.start = Date.now();
33159
+ }
33160
+ }
33161
+ if (this.#sizes) {
33162
+ entry.size = this.#sizes[i2];
33163
+ }
33164
+ return entry;
33165
+ }
33166
+ dump() {
33167
+ const arr = [];
33168
+ for (const i2 of this.#indexes({ allowStale: true })) {
33169
+ const key2 = this.#keyList[i2];
33170
+ const v = this.#valList[i2];
33171
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33172
+ if (value2 === undefined || key2 === undefined)
33173
+ continue;
33174
+ const entry = { value: value2 };
33175
+ if (this.#ttls && this.#starts) {
33176
+ entry.ttl = this.#ttls[i2];
33177
+ const age = perf2.now() - this.#starts[i2];
33178
+ entry.start = Math.floor(Date.now() - age);
33179
+ }
33180
+ if (this.#sizes) {
33181
+ entry.size = this.#sizes[i2];
33182
+ }
33183
+ arr.unshift([key2, entry]);
33184
+ }
33185
+ return arr;
33186
+ }
33187
+ load(arr) {
33188
+ this.clear();
33189
+ for (const [key2, entry] of arr) {
33190
+ if (entry.start) {
33191
+ const age = Date.now() - entry.start;
33192
+ entry.start = perf2.now() - age;
33193
+ }
33194
+ this.set(key2, entry.value, entry);
33195
+ }
33196
+ }
33197
+ set(k, v, setOptions = {}) {
33198
+ if (v === undefined) {
33199
+ this.delete(k);
33200
+ return this;
33201
+ }
33202
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
33203
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
33204
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
33205
+ if (this.maxEntrySize && size > this.maxEntrySize) {
33206
+ if (status) {
33207
+ status.set = "miss";
33208
+ status.maxEntrySizeExceeded = true;
33209
+ }
33210
+ this.#delete(k, "set");
33211
+ return this;
33212
+ }
33213
+ let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
33214
+ if (index === undefined) {
33215
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
33216
+ this.#keyList[index] = k;
33217
+ this.#valList[index] = v;
33218
+ this.#keyMap.set(k, index);
33219
+ this.#next[this.#tail] = index;
33220
+ this.#prev[index] = this.#tail;
33221
+ this.#tail = index;
33222
+ this.#size++;
33223
+ this.#addItemSize(index, size, status);
33224
+ if (status)
33225
+ status.set = "add";
33226
+ noUpdateTTL = false;
33227
+ } else {
33228
+ this.#moveToTail(index);
33229
+ const oldVal = this.#valList[index];
33230
+ if (v !== oldVal) {
33231
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
33232
+ oldVal.__abortController.abort(new Error("replaced"));
33233
+ const { __staleWhileFetching: s } = oldVal;
33234
+ if (s !== undefined && !noDisposeOnSet) {
33235
+ if (this.#hasDispose) {
33236
+ this.#dispose?.(s, k, "set");
33237
+ }
33238
+ if (this.#hasDisposeAfter) {
33239
+ this.#disposed?.push([s, k, "set"]);
33240
+ }
33241
+ }
33242
+ } else if (!noDisposeOnSet) {
33243
+ if (this.#hasDispose) {
33244
+ this.#dispose?.(oldVal, k, "set");
33245
+ }
33246
+ if (this.#hasDisposeAfter) {
33247
+ this.#disposed?.push([oldVal, k, "set"]);
33248
+ }
33249
+ }
33250
+ this.#removeItemSize(index);
33251
+ this.#addItemSize(index, size, status);
33252
+ this.#valList[index] = v;
33253
+ if (status) {
33254
+ status.set = "replace";
33255
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
33256
+ if (oldValue !== undefined)
33257
+ status.oldValue = oldValue;
33258
+ }
33259
+ } else if (status) {
33260
+ status.set = "update";
33261
+ }
33262
+ }
33263
+ if (ttl !== 0 && !this.#ttls) {
33264
+ this.#initializeTTLTracking();
33265
+ }
33266
+ if (this.#ttls) {
33267
+ if (!noUpdateTTL) {
33268
+ this.#setItemTTL(index, ttl, start);
33269
+ }
33270
+ if (status)
33271
+ this.#statusTTL(status, index);
33272
+ }
33273
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
33274
+ const dt2 = this.#disposed;
33275
+ let task;
33276
+ while (task = dt2?.shift()) {
33277
+ this.#disposeAfter?.(...task);
33278
+ }
33279
+ }
33280
+ return this;
33281
+ }
33282
+ pop() {
33283
+ try {
33284
+ while (this.#size) {
33285
+ const val = this.#valList[this.#head];
33286
+ this.#evict(true);
33287
+ if (this.#isBackgroundFetch(val)) {
33288
+ if (val.__staleWhileFetching) {
33289
+ return val.__staleWhileFetching;
33290
+ }
33291
+ } else if (val !== undefined) {
33292
+ return val;
33293
+ }
33294
+ }
33295
+ } finally {
33296
+ if (this.#hasDisposeAfter && this.#disposed) {
33297
+ const dt2 = this.#disposed;
33298
+ let task;
33299
+ while (task = dt2?.shift()) {
33300
+ this.#disposeAfter?.(...task);
33301
+ }
33302
+ }
33303
+ }
33304
+ }
33305
+ #evict(free) {
33306
+ const head = this.#head;
33307
+ const k = this.#keyList[head];
33308
+ const v = this.#valList[head];
33309
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
33310
+ v.__abortController.abort(new Error("evicted"));
33311
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
33312
+ if (this.#hasDispose) {
33313
+ this.#dispose?.(v, k, "evict");
33314
+ }
33315
+ if (this.#hasDisposeAfter) {
33316
+ this.#disposed?.push([v, k, "evict"]);
33317
+ }
33318
+ }
33319
+ this.#removeItemSize(head);
33320
+ if (free) {
33321
+ this.#keyList[head] = undefined;
33322
+ this.#valList[head] = undefined;
33323
+ this.#free.push(head);
33324
+ }
33325
+ if (this.#size === 1) {
33326
+ this.#head = this.#tail = 0;
33327
+ this.#free.length = 0;
33328
+ } else {
33329
+ this.#head = this.#next[head];
33330
+ }
33331
+ this.#keyMap.delete(k);
33332
+ this.#size--;
33333
+ return head;
33334
+ }
33335
+ has(k, hasOptions = {}) {
33336
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
33337
+ const index = this.#keyMap.get(k);
33338
+ if (index !== undefined) {
33339
+ const v = this.#valList[index];
33340
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
33341
+ return false;
33342
+ }
33343
+ if (!this.#isStale(index)) {
33344
+ if (updateAgeOnHas) {
33345
+ this.#updateItemAge(index);
33346
+ }
33347
+ if (status) {
33348
+ status.has = "hit";
33349
+ this.#statusTTL(status, index);
33350
+ }
33351
+ return true;
33352
+ } else if (status) {
33353
+ status.has = "stale";
33354
+ this.#statusTTL(status, index);
33355
+ }
33356
+ } else if (status) {
33357
+ status.has = "miss";
33358
+ }
33359
+ return false;
33360
+ }
33361
+ peek(k, peekOptions = {}) {
33362
+ const { allowStale = this.allowStale } = peekOptions;
33363
+ const index = this.#keyMap.get(k);
33364
+ if (index === undefined || !allowStale && this.#isStale(index)) {
33365
+ return;
33366
+ }
33367
+ const v = this.#valList[index];
33368
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
33369
+ }
33370
+ #backgroundFetch(k, index, options, context) {
33371
+ const v = index === undefined ? undefined : this.#valList[index];
33372
+ if (this.#isBackgroundFetch(v)) {
33373
+ return v;
33374
+ }
33375
+ const ac = new AC2;
33376
+ const { signal } = options;
33377
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
33378
+ signal: ac.signal
33379
+ });
33380
+ const fetchOpts = {
33381
+ signal: ac.signal,
33382
+ options,
33383
+ context
33384
+ };
33385
+ const cb = (v2, updateCache = false) => {
33386
+ const { aborted } = ac.signal;
33387
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== undefined;
33388
+ if (options.status) {
33389
+ if (aborted && !updateCache) {
33390
+ options.status.fetchAborted = true;
33391
+ options.status.fetchError = ac.signal.reason;
33392
+ if (ignoreAbort)
33393
+ options.status.fetchAbortIgnored = true;
33394
+ } else {
33395
+ options.status.fetchResolved = true;
33396
+ }
33397
+ }
33398
+ if (aborted && !ignoreAbort && !updateCache) {
33399
+ return fetchFail(ac.signal.reason);
33400
+ }
33401
+ const bf2 = p;
33402
+ if (this.#valList[index] === p) {
33403
+ if (v2 === undefined) {
33404
+ if (bf2.__staleWhileFetching) {
33405
+ this.#valList[index] = bf2.__staleWhileFetching;
33406
+ } else {
33407
+ this.#delete(k, "fetch");
33408
+ }
33409
+ } else {
33410
+ if (options.status)
33411
+ options.status.fetchUpdated = true;
33412
+ this.set(k, v2, fetchOpts.options);
33413
+ }
33414
+ }
33415
+ return v2;
33416
+ };
33417
+ const eb = (er) => {
33418
+ if (options.status) {
33419
+ options.status.fetchRejected = true;
33420
+ options.status.fetchError = er;
33421
+ }
33422
+ return fetchFail(er);
33423
+ };
33424
+ const fetchFail = (er) => {
33425
+ const { aborted } = ac.signal;
33426
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
33427
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
33428
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
33429
+ const bf2 = p;
33430
+ if (this.#valList[index] === p) {
33431
+ const del = !noDelete || bf2.__staleWhileFetching === undefined;
33432
+ if (del) {
33433
+ this.#delete(k, "fetch");
33434
+ } else if (!allowStaleAborted) {
33435
+ this.#valList[index] = bf2.__staleWhileFetching;
33436
+ }
33437
+ }
33438
+ if (allowStale) {
33439
+ if (options.status && bf2.__staleWhileFetching !== undefined) {
33440
+ options.status.returnedStale = true;
33441
+ }
33442
+ return bf2.__staleWhileFetching;
33443
+ } else if (bf2.__returned === bf2) {
33444
+ throw er;
33445
+ }
33446
+ };
33447
+ const pcall = (res, rej) => {
33448
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
33449
+ if (fmp && fmp instanceof Promise) {
33450
+ fmp.then((v2) => res(v2 === undefined ? undefined : v2), rej);
33451
+ }
33452
+ ac.signal.addEventListener("abort", () => {
33453
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
33454
+ res(undefined);
33455
+ if (options.allowStaleOnFetchAbort) {
33456
+ res = (v2) => cb(v2, true);
33457
+ }
33458
+ }
33459
+ });
33460
+ };
33461
+ if (options.status)
33462
+ options.status.fetchDispatched = true;
33463
+ const p = new Promise(pcall).then(cb, eb);
33464
+ const bf = Object.assign(p, {
33465
+ __abortController: ac,
33466
+ __staleWhileFetching: v,
33467
+ __returned: undefined
33468
+ });
33469
+ if (index === undefined) {
33470
+ this.set(k, bf, { ...fetchOpts.options, status: undefined });
33471
+ index = this.#keyMap.get(k);
33472
+ } else {
33473
+ this.#valList[index] = bf;
33474
+ }
33475
+ return bf;
33476
+ }
33477
+ #isBackgroundFetch(p) {
33478
+ if (!this.#hasFetchMethod)
33479
+ return false;
33480
+ const b = p;
33481
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC2;
33482
+ }
33483
+ async fetch(k, fetchOptions = {}) {
33484
+ const {
33485
+ allowStale = this.allowStale,
33486
+ updateAgeOnGet = this.updateAgeOnGet,
33487
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
33488
+ ttl = this.ttl,
33489
+ noDisposeOnSet = this.noDisposeOnSet,
33490
+ size = 0,
33491
+ sizeCalculation = this.sizeCalculation,
33492
+ noUpdateTTL = this.noUpdateTTL,
33493
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
33494
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
33495
+ ignoreFetchAbort = this.ignoreFetchAbort,
33496
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
33497
+ context,
33498
+ forceRefresh = false,
33499
+ status,
33500
+ signal
33501
+ } = fetchOptions;
33502
+ if (!this.#hasFetchMethod) {
33503
+ if (status)
33504
+ status.fetch = "get";
33505
+ return this.get(k, {
33506
+ allowStale,
33507
+ updateAgeOnGet,
33508
+ noDeleteOnStaleGet,
33509
+ status
33510
+ });
33511
+ }
33512
+ const options = {
33513
+ allowStale,
33514
+ updateAgeOnGet,
33515
+ noDeleteOnStaleGet,
33516
+ ttl,
33517
+ noDisposeOnSet,
33518
+ size,
33519
+ sizeCalculation,
33520
+ noUpdateTTL,
33521
+ noDeleteOnFetchRejection,
33522
+ allowStaleOnFetchRejection,
33523
+ allowStaleOnFetchAbort,
33524
+ ignoreFetchAbort,
33525
+ status,
33526
+ signal
33527
+ };
33528
+ let index = this.#keyMap.get(k);
33529
+ if (index === undefined) {
33530
+ if (status)
33531
+ status.fetch = "miss";
33532
+ const p = this.#backgroundFetch(k, index, options, context);
33533
+ return p.__returned = p;
33534
+ } else {
33535
+ const v = this.#valList[index];
33536
+ if (this.#isBackgroundFetch(v)) {
33537
+ const stale = allowStale && v.__staleWhileFetching !== undefined;
33538
+ if (status) {
33539
+ status.fetch = "inflight";
33540
+ if (stale)
33541
+ status.returnedStale = true;
33542
+ }
33543
+ return stale ? v.__staleWhileFetching : v.__returned = v;
33544
+ }
33545
+ const isStale = this.#isStale(index);
33546
+ if (!forceRefresh && !isStale) {
33547
+ if (status)
33548
+ status.fetch = "hit";
33549
+ this.#moveToTail(index);
33550
+ if (updateAgeOnGet) {
33551
+ this.#updateItemAge(index);
33552
+ }
33553
+ if (status)
33554
+ this.#statusTTL(status, index);
33555
+ return v;
33556
+ }
33557
+ const p = this.#backgroundFetch(k, index, options, context);
33558
+ const hasStale = p.__staleWhileFetching !== undefined;
33559
+ const staleVal = hasStale && allowStale;
33560
+ if (status) {
33561
+ status.fetch = isStale ? "stale" : "refresh";
33562
+ if (staleVal && isStale)
33563
+ status.returnedStale = true;
33564
+ }
33565
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
33566
+ }
33567
+ }
33568
+ async forceFetch(k, fetchOptions = {}) {
33569
+ const v = await this.fetch(k, fetchOptions);
33570
+ if (v === undefined)
33571
+ throw new Error("fetch() returned undefined");
33572
+ return v;
33573
+ }
33574
+ memo(k, memoOptions = {}) {
33575
+ const memoMethod = this.#memoMethod;
33576
+ if (!memoMethod) {
33577
+ throw new Error("no memoMethod provided to constructor");
33578
+ }
33579
+ const { context, forceRefresh, ...options } = memoOptions;
33580
+ const v = this.get(k, options);
33581
+ if (!forceRefresh && v !== undefined)
33582
+ return v;
33583
+ const vv = memoMethod(k, v, {
33584
+ options,
33585
+ context
33586
+ });
33587
+ this.set(k, vv, options);
33588
+ return vv;
33589
+ }
33590
+ get(k, getOptions = {}) {
33591
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
33592
+ const index = this.#keyMap.get(k);
33593
+ if (index !== undefined) {
33594
+ const value2 = this.#valList[index];
33595
+ const fetching = this.#isBackgroundFetch(value2);
33596
+ if (status)
33597
+ this.#statusTTL(status, index);
33598
+ if (this.#isStale(index)) {
33599
+ if (status)
33600
+ status.get = "stale";
33601
+ if (!fetching) {
33602
+ if (!noDeleteOnStaleGet) {
33603
+ this.#delete(k, "expire");
33604
+ }
33605
+ if (status && allowStale)
33606
+ status.returnedStale = true;
33607
+ return allowStale ? value2 : undefined;
33608
+ } else {
33609
+ if (status && allowStale && value2.__staleWhileFetching !== undefined) {
33610
+ status.returnedStale = true;
33611
+ }
33612
+ return allowStale ? value2.__staleWhileFetching : undefined;
33613
+ }
33614
+ } else {
33615
+ if (status)
33616
+ status.get = "hit";
33617
+ if (fetching) {
33618
+ return value2.__staleWhileFetching;
33619
+ }
33620
+ this.#moveToTail(index);
33621
+ if (updateAgeOnGet) {
33622
+ this.#updateItemAge(index);
33623
+ }
33624
+ return value2;
33625
+ }
33626
+ } else if (status) {
33627
+ status.get = "miss";
33628
+ }
33629
+ }
33630
+ #connect(p, n2) {
33631
+ this.#prev[n2] = p;
33632
+ this.#next[p] = n2;
33633
+ }
33634
+ #moveToTail(index) {
33635
+ if (index !== this.#tail) {
33636
+ if (index === this.#head) {
33637
+ this.#head = this.#next[index];
33638
+ } else {
33639
+ this.#connect(this.#prev[index], this.#next[index]);
33640
+ }
33641
+ this.#connect(this.#tail, index);
33642
+ this.#tail = index;
33643
+ }
33644
+ }
33645
+ delete(k) {
33646
+ return this.#delete(k, "delete");
33647
+ }
33648
+ #delete(k, reason) {
33649
+ let deleted = false;
33650
+ if (this.#size !== 0) {
33651
+ const index = this.#keyMap.get(k);
33652
+ if (index !== undefined) {
33653
+ deleted = true;
33654
+ if (this.#size === 1) {
33655
+ this.#clear(reason);
33656
+ } else {
33657
+ this.#removeItemSize(index);
33658
+ const v = this.#valList[index];
33659
+ if (this.#isBackgroundFetch(v)) {
33660
+ v.__abortController.abort(new Error("deleted"));
33661
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
33662
+ if (this.#hasDispose) {
33663
+ this.#dispose?.(v, k, reason);
33664
+ }
33665
+ if (this.#hasDisposeAfter) {
33666
+ this.#disposed?.push([v, k, reason]);
33667
+ }
33668
+ }
33669
+ this.#keyMap.delete(k);
33670
+ this.#keyList[index] = undefined;
33671
+ this.#valList[index] = undefined;
33672
+ if (index === this.#tail) {
33673
+ this.#tail = this.#prev[index];
33674
+ } else if (index === this.#head) {
33675
+ this.#head = this.#next[index];
33676
+ } else {
33677
+ const pi = this.#prev[index];
33678
+ this.#next[pi] = this.#next[index];
33679
+ const ni = this.#next[index];
33680
+ this.#prev[ni] = this.#prev[index];
33681
+ }
33682
+ this.#size--;
33683
+ this.#free.push(index);
33684
+ }
33685
+ }
33686
+ }
33687
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
33688
+ const dt2 = this.#disposed;
33689
+ let task;
33690
+ while (task = dt2?.shift()) {
33691
+ this.#disposeAfter?.(...task);
33692
+ }
33693
+ }
33694
+ return deleted;
33695
+ }
33696
+ clear() {
33697
+ return this.#clear("delete");
33698
+ }
33699
+ #clear(reason) {
33700
+ for (const index of this.#rindexes({ allowStale: true })) {
33701
+ const v = this.#valList[index];
33702
+ if (this.#isBackgroundFetch(v)) {
33703
+ v.__abortController.abort(new Error("deleted"));
33704
+ } else {
33705
+ const k = this.#keyList[index];
33706
+ if (this.#hasDispose) {
33707
+ this.#dispose?.(v, k, reason);
33708
+ }
33709
+ if (this.#hasDisposeAfter) {
33710
+ this.#disposed?.push([v, k, reason]);
33711
+ }
33712
+ }
33713
+ }
33714
+ this.#keyMap.clear();
33715
+ this.#valList.fill(undefined);
33716
+ this.#keyList.fill(undefined);
33717
+ if (this.#ttls && this.#starts) {
33718
+ this.#ttls.fill(0);
33719
+ this.#starts.fill(0);
33720
+ }
33721
+ if (this.#sizes) {
33722
+ this.#sizes.fill(0);
33723
+ }
33724
+ this.#head = 0;
33725
+ this.#tail = 0;
33726
+ this.#free.length = 0;
33727
+ this.#calculatedSize = 0;
33728
+ this.#size = 0;
33729
+ if (this.#hasDisposeAfter && this.#disposed) {
33730
+ const dt2 = this.#disposed;
33731
+ let task;
33732
+ while (task = dt2?.shift()) {
33733
+ this.#disposeAfter?.(...task);
33734
+ }
33735
+ }
33736
+ }
33737
+ }
33738
+ exports.LRUCache = LRUCache2;
33739
+ });
33740
+
33741
+ // ../../node_modules/minipass/dist/commonjs/index.js
33742
+ var require_commonjs4 = __commonJS((exports) => {
32729
33743
  var __importDefault = exports && exports.__importDefault || function(mod) {
32730
33744
  return mod && mod.__esModule ? mod : { default: mod };
32731
33745
  };
@@ -33397,7 +34411,7 @@ var require_commonjs3 = __commonJS((exports) => {
33397
34411
  });
33398
34412
 
33399
34413
  // ../../node_modules/path-scurry/dist/commonjs/index.js
33400
- var require_commonjs4 = __commonJS((exports) => {
34414
+ var require_commonjs5 = __commonJS((exports) => {
33401
34415
  var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m, k, k2) {
33402
34416
  if (k2 === undefined)
33403
34417
  k2 = k;
@@ -33432,14 +34446,14 @@ var require_commonjs4 = __commonJS((exports) => {
33432
34446
  };
33433
34447
  Object.defineProperty(exports, "__esModule", { value: true });
33434
34448
  exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = undefined;
33435
- var lru_cache_1 = require_commonjs();
34449
+ var lru_cache_1 = require_commonjs3();
33436
34450
  var node_path_1 = __require("node:path");
33437
34451
  var node_url_1 = __require("node:url");
33438
34452
  var fs_1 = __require("fs");
33439
34453
  var actualFS2 = __importStar(__require("node:fs"));
33440
34454
  var realpathSync2 = fs_1.realpathSync.native;
33441
34455
  var promises_1 = __require("node:fs/promises");
33442
- var minipass_1 = require_commonjs3();
34456
+ var minipass_1 = require_commonjs4();
33443
34457
  var defaultFS2 = {
33444
34458
  lstatSync: fs_1.lstatSync,
33445
34459
  readdir: fs_1.readdir,
@@ -35197,7 +36211,7 @@ var require_processor = __commonJS((exports) => {
35197
36211
  var require_walker2 = __commonJS((exports) => {
35198
36212
  Object.defineProperty(exports, "__esModule", { value: true });
35199
36213
  exports.GlobStream = exports.GlobWalker = exports.GlobUtil = undefined;
35200
- var minipass_1 = require_commonjs3();
36214
+ var minipass_1 = require_commonjs4();
35201
36215
  var ignore_js_1 = require_ignore2();
35202
36216
  var processor_js_1 = require_processor();
35203
36217
  var makeIgnore2 = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore;
@@ -35536,7 +36550,7 @@ var require_glob = __commonJS((exports) => {
35536
36550
  exports.Glob = undefined;
35537
36551
  var minimatch_1 = require_commonjs2();
35538
36552
  var node_url_1 = __require("node:url");
35539
- var path_scurry_1 = require_commonjs4();
36553
+ var path_scurry_1 = require_commonjs5();
35540
36554
  var pattern_js_1 = require_pattern();
35541
36555
  var walker_js_1 = require_walker2();
35542
36556
  var defaultPlatform4 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
@@ -35733,7 +36747,7 @@ var require_has_magic = __commonJS((exports) => {
35733
36747
  });
35734
36748
 
35735
36749
  // ../../node_modules/glob/dist/commonjs/index.js
35736
- var require_commonjs5 = __commonJS((exports) => {
36750
+ var require_commonjs6 = __commonJS((exports) => {
35737
36751
  Object.defineProperty(exports, "__esModule", { value: true });
35738
36752
  exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = undefined;
35739
36753
  exports.globStreamSync = globStreamSync2;
@@ -36565,380 +37579,1495 @@ var require_errors2 = __commonJS((exports, module) => {
36565
37579
  shouldRetry() {
36566
37580
  return false;
36567
37581
  }
36568
- }
36569
-
36570
- class GitConnectionError extends GitError {
36571
- constructor() {
36572
- super("A git connection error occurred");
37582
+ }
37583
+
37584
+ class GitConnectionError extends GitError {
37585
+ constructor() {
37586
+ super("A git connection error occurred");
37587
+ }
37588
+ shouldRetry(number) {
37589
+ return number < maxRetry;
37590
+ }
37591
+ }
37592
+
37593
+ class GitPathspecError extends GitError {
37594
+ constructor() {
37595
+ super("The git reference could not be found");
37596
+ }
37597
+ }
37598
+
37599
+ class GitUnknownError extends GitError {
37600
+ constructor() {
37601
+ super("An unknown git error occurred");
37602
+ }
37603
+ }
37604
+ module.exports = {
37605
+ GitConnectionError,
37606
+ GitPathspecError,
37607
+ GitUnknownError
37608
+ };
37609
+ });
37610
+
37611
+ // ../../node_modules/@npmcli/git/lib/make-error.js
37612
+ var require_make_error = __commonJS((exports, module) => {
37613
+ var {
37614
+ GitConnectionError,
37615
+ GitPathspecError,
37616
+ GitUnknownError
37617
+ } = require_errors2();
37618
+ var connectionErrorRe = new RegExp([
37619
+ "remote error: Internal Server Error",
37620
+ "The remote end hung up unexpectedly",
37621
+ "Connection timed out",
37622
+ "Operation timed out",
37623
+ "Failed to connect to .* Timed out",
37624
+ "Connection reset by peer",
37625
+ "SSL_ERROR_SYSCALL",
37626
+ "The requested URL returned error: 503"
37627
+ ].join("|"));
37628
+ var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
37629
+ function makeError(er) {
37630
+ const message = er.stderr;
37631
+ let gitEr;
37632
+ if (connectionErrorRe.test(message)) {
37633
+ gitEr = new GitConnectionError(message);
37634
+ } else if (missingPathspecRe.test(message)) {
37635
+ gitEr = new GitPathspecError(message);
37636
+ } else {
37637
+ gitEr = new GitUnknownError(message);
37638
+ }
37639
+ return Object.assign(gitEr, er);
37640
+ }
37641
+ module.exports = makeError;
37642
+ });
37643
+
37644
+ // ../../node_modules/ini/lib/ini.js
37645
+ var require_ini = __commonJS((exports, module) => {
37646
+ var { hasOwnProperty } = Object.prototype;
37647
+ var encode = (obj, opt = {}) => {
37648
+ if (typeof opt === "string") {
37649
+ opt = { section: opt };
37650
+ }
37651
+ opt.align = opt.align === true;
37652
+ opt.newline = opt.newline === true;
37653
+ opt.sort = opt.sort === true;
37654
+ opt.whitespace = opt.whitespace === true || opt.align === true;
37655
+ opt.platform = opt.platform || typeof process !== "undefined" && process.platform;
37656
+ opt.bracketedArray = opt.bracketedArray !== false;
37657
+ const eol = opt.platform === "win32" ? `\r
37658
+ ` : `
37659
+ `;
37660
+ const separator = opt.whitespace ? " = " : "=";
37661
+ const children = [];
37662
+ const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj);
37663
+ let padToChars = 0;
37664
+ if (opt.align) {
37665
+ padToChars = safe(keys.filter((k) => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== "object").map((k) => Array.isArray(obj[k]) ? `${k}[]` : k).concat([""]).reduce((a3, b) => safe(a3).length >= safe(b).length ? a3 : b)).length;
37666
+ }
37667
+ let out = "";
37668
+ const arraySuffix = opt.bracketedArray ? "[]" : "";
37669
+ for (const k of keys) {
37670
+ const val = obj[k];
37671
+ if (val && Array.isArray(val)) {
37672
+ for (const item of val) {
37673
+ out += safe(`${k}${arraySuffix}`).padEnd(padToChars, " ") + separator + safe(item) + eol;
37674
+ }
37675
+ } else if (val && typeof val === "object") {
37676
+ children.push(k);
37677
+ } else {
37678
+ out += safe(k).padEnd(padToChars, " ") + separator + safe(val) + eol;
37679
+ }
37680
+ }
37681
+ if (opt.section && out.length) {
37682
+ out = "[" + safe(opt.section) + "]" + (opt.newline ? eol + eol : eol) + out;
37683
+ }
37684
+ for (const k of children) {
37685
+ const nk = splitSections(k, ".").join("\\.");
37686
+ const section = (opt.section ? opt.section + "." : "") + nk;
37687
+ const child = encode(obj[k], {
37688
+ ...opt,
37689
+ section
37690
+ });
37691
+ if (out.length && child.length) {
37692
+ out += eol;
37693
+ }
37694
+ out += child;
37695
+ }
37696
+ return out;
37697
+ };
37698
+ function splitSections(str, separator) {
37699
+ var lastMatchIndex = 0;
37700
+ var lastSeparatorIndex = 0;
37701
+ var nextIndex = 0;
37702
+ var sections = [];
37703
+ do {
37704
+ nextIndex = str.indexOf(separator, lastMatchIndex);
37705
+ if (nextIndex !== -1) {
37706
+ lastMatchIndex = nextIndex + separator.length;
37707
+ if (nextIndex > 0 && str[nextIndex - 1] === "\\") {
37708
+ continue;
37709
+ }
37710
+ sections.push(str.slice(lastSeparatorIndex, nextIndex));
37711
+ lastSeparatorIndex = nextIndex + separator.length;
37712
+ }
37713
+ } while (nextIndex !== -1);
37714
+ sections.push(str.slice(lastSeparatorIndex));
37715
+ return sections;
37716
+ }
37717
+ var decode = (str, opt = {}) => {
37718
+ opt.bracketedArray = opt.bracketedArray !== false;
37719
+ const out = Object.create(null);
37720
+ let p = out;
37721
+ let section = null;
37722
+ const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i;
37723
+ const lines2 = str.split(/[\r\n]+/g);
37724
+ const duplicates = {};
37725
+ for (const line of lines2) {
37726
+ if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
37727
+ continue;
37728
+ }
37729
+ const match2 = line.match(re);
37730
+ if (!match2) {
37731
+ continue;
37732
+ }
37733
+ if (match2[1] !== undefined) {
37734
+ section = unsafe(match2[1]);
37735
+ if (section === "__proto__") {
37736
+ p = Object.create(null);
37737
+ continue;
37738
+ }
37739
+ p = out[section] = out[section] || Object.create(null);
37740
+ continue;
37741
+ }
37742
+ const keyRaw = unsafe(match2[2]);
37743
+ let isArray;
37744
+ if (opt.bracketedArray) {
37745
+ isArray = keyRaw.length > 2 && keyRaw.slice(-2) === "[]";
37746
+ } else {
37747
+ duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1;
37748
+ isArray = duplicates[keyRaw] > 1;
37749
+ }
37750
+ const key2 = isArray && keyRaw.endsWith("[]") ? keyRaw.slice(0, -2) : keyRaw;
37751
+ if (key2 === "__proto__") {
37752
+ continue;
37753
+ }
37754
+ const valueRaw = match2[3] ? unsafe(match2[4]) : true;
37755
+ const value2 = valueRaw === "true" || valueRaw === "false" || valueRaw === "null" ? JSON.parse(valueRaw) : valueRaw;
37756
+ if (isArray) {
37757
+ if (!hasOwnProperty.call(p, key2)) {
37758
+ p[key2] = [];
37759
+ } else if (!Array.isArray(p[key2])) {
37760
+ p[key2] = [p[key2]];
37761
+ }
37762
+ }
37763
+ if (Array.isArray(p[key2])) {
37764
+ p[key2].push(value2);
37765
+ } else {
37766
+ p[key2] = value2;
37767
+ }
37768
+ }
37769
+ const remove = [];
37770
+ for (const k of Object.keys(out)) {
37771
+ if (!hasOwnProperty.call(out, k) || typeof out[k] !== "object" || Array.isArray(out[k])) {
37772
+ continue;
37773
+ }
37774
+ const parts = splitSections(k, ".");
37775
+ p = out;
37776
+ const l2 = parts.pop();
37777
+ const nl = l2.replace(/\\\./g, ".");
37778
+ for (const part of parts) {
37779
+ if (part === "__proto__") {
37780
+ continue;
37781
+ }
37782
+ if (!hasOwnProperty.call(p, part) || typeof p[part] !== "object") {
37783
+ p[part] = Object.create(null);
37784
+ }
37785
+ p = p[part];
37786
+ }
37787
+ if (p === out && nl === l2) {
37788
+ continue;
37789
+ }
37790
+ p[nl] = out[k];
37791
+ remove.push(k);
37792
+ }
37793
+ for (const del of remove) {
37794
+ delete out[del];
37795
+ }
37796
+ return out;
37797
+ };
37798
+ var isQuoted = (val) => {
37799
+ return val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'");
37800
+ };
37801
+ var safe = (val) => {
37802
+ if (typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim()) {
37803
+ return JSON.stringify(val);
37804
+ }
37805
+ return val.split(";").join("\\;").split("#").join("\\#");
37806
+ };
37807
+ var unsafe = (val) => {
37808
+ val = (val || "").trim();
37809
+ if (isQuoted(val)) {
37810
+ if (val.charAt(0) === "'") {
37811
+ val = val.slice(1, -1);
37812
+ }
37813
+ try {
37814
+ val = JSON.parse(val);
37815
+ } catch {}
37816
+ } else {
37817
+ let esc = false;
37818
+ let unesc = "";
37819
+ for (let i2 = 0, l2 = val.length;i2 < l2; i2++) {
37820
+ const c = val.charAt(i2);
37821
+ if (esc) {
37822
+ if ("\\;#".indexOf(c) !== -1) {
37823
+ unesc += c;
37824
+ } else {
37825
+ unesc += "\\" + c;
37826
+ }
37827
+ esc = false;
37828
+ } else if (";#".indexOf(c) !== -1) {
37829
+ break;
37830
+ } else if (c === "\\") {
37831
+ esc = true;
37832
+ } else {
37833
+ unesc += c;
37834
+ }
37835
+ }
37836
+ if (esc) {
37837
+ unesc += "\\";
37838
+ }
37839
+ return unesc.trim();
37840
+ }
37841
+ return val;
37842
+ };
37843
+ module.exports = {
37844
+ parse: decode,
37845
+ decode,
37846
+ stringify: encode,
37847
+ encode,
37848
+ safe,
37849
+ unsafe
37850
+ };
37851
+ });
37852
+
37853
+ // ../../node_modules/@npmcli/git/lib/opts.js
37854
+ var require_opts = __commonJS((exports, module) => {
37855
+ var fs4 = __require("node:fs");
37856
+ var os = __require("node:os");
37857
+ var path6 = __require("node:path");
37858
+ var ini = require_ini();
37859
+ var gitConfigPath = path6.join(os.homedir(), ".gitconfig");
37860
+ var cachedConfig = null;
37861
+ var loadGitConfig = () => {
37862
+ if (cachedConfig === null) {
37863
+ try {
37864
+ cachedConfig = {};
37865
+ if (fs4.existsSync(gitConfigPath)) {
37866
+ const configContent = fs4.readFileSync(gitConfigPath, "utf-8");
37867
+ cachedConfig = ini.parse(configContent);
37868
+ }
37869
+ } catch (error2) {
37870
+ cachedConfig = {};
37871
+ }
37872
+ }
37873
+ return cachedConfig;
37874
+ };
37875
+ var checkGitConfigs = () => {
37876
+ const config3 = loadGitConfig();
37877
+ return {
37878
+ sshCommandSetInConfig: config3?.core?.sshCommand !== undefined,
37879
+ askPassSetInConfig: config3?.core?.askpass !== undefined
37880
+ };
37881
+ };
37882
+ var sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined;
37883
+ var askPassSetInEnv = process.env.GIT_ASKPASS !== undefined;
37884
+ var { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs();
37885
+ var finalGitEnv = {
37886
+ ...askPassSetInEnv || askPassSetInConfig ? {} : {
37887
+ GIT_ASKPASS: "echo"
37888
+ },
37889
+ ...sshCommandSetInEnv || sshCommandSetInConfig ? {} : {
37890
+ GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
37891
+ }
37892
+ };
37893
+ module.exports = (opts = {}) => ({
37894
+ stdioString: true,
37895
+ ...opts,
37896
+ shell: false,
37897
+ env: opts.env || { ...finalGitEnv, ...process.env }
37898
+ });
37899
+ module.exports.loadGitConfig = loadGitConfig;
37900
+ });
37901
+
37902
+ // ../../node_modules/@npmcli/git/lib/which.js
37903
+ var require_which = __commonJS((exports, module) => {
37904
+ var which = require_lib5();
37905
+ var gitPath;
37906
+ try {
37907
+ gitPath = which.sync("git");
37908
+ } catch {}
37909
+ module.exports = (opts = {}) => {
37910
+ if (opts.git) {
37911
+ return opts.git;
37912
+ }
37913
+ if (!gitPath || opts.git === false) {
37914
+ return Object.assign(new Error("No git binary found in $PATH"), { code: "ENOGIT" });
37915
+ }
37916
+ return gitPath;
37917
+ };
37918
+ });
37919
+
37920
+ // ../../node_modules/@npmcli/git/lib/spawn.js
37921
+ var require_spawn = __commonJS((exports, module) => {
37922
+ var spawn2 = require_lib6();
37923
+ var promiseRetry = require_promise_retry();
37924
+ var { log } = require_lib3();
37925
+ var makeError = require_make_error();
37926
+ var makeOpts = require_opts();
37927
+ module.exports = (gitArgs, opts = {}) => {
37928
+ const whichGit = require_which();
37929
+ const gitPath = whichGit(opts);
37930
+ if (gitPath instanceof Error) {
37931
+ return Promise.reject(gitPath);
37932
+ }
37933
+ const args = opts.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
37934
+ let retryOpts = opts.retry;
37935
+ if (retryOpts === null || retryOpts === undefined) {
37936
+ retryOpts = {
37937
+ retries: opts.fetchRetries || 2,
37938
+ factor: opts.fetchRetryFactor || 10,
37939
+ maxTimeout: opts.fetchRetryMaxtimeout || 60000,
37940
+ minTimeout: opts.fetchRetryMintimeout || 1000
37941
+ };
37942
+ }
37943
+ return promiseRetry((retryFn, number) => {
37944
+ if (number !== 1) {
37945
+ log.silly("git", `Retrying git command: ${args.join(" ")} attempt # ${number}`);
37946
+ }
37947
+ return spawn2(gitPath, args, makeOpts(opts)).catch((er) => {
37948
+ const gitError = makeError(er);
37949
+ if (!gitError.shouldRetry(number)) {
37950
+ throw gitError;
37951
+ }
37952
+ retryFn(gitError);
37953
+ });
37954
+ }, retryOpts);
37955
+ };
37956
+ });
37957
+
37958
+ // ../../node_modules/@npmcli/git/node_modules/lru-cache/dist/commonjs/index.js
37959
+ var require_commonjs7 = __commonJS((exports) => {
37960
+ Object.defineProperty(exports, "__esModule", { value: true });
37961
+ exports.LRUCache = undefined;
37962
+ var perf2 = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
37963
+ var warned2 = new Set;
37964
+ var PROCESS2 = typeof process === "object" && !!process ? process : {};
37965
+ var emitWarning2 = (msg, type2, code, fn) => {
37966
+ typeof PROCESS2.emitWarning === "function" ? PROCESS2.emitWarning(msg, type2, code, fn) : console.error(`[${code}] ${type2}: ${msg}`);
37967
+ };
37968
+ var AC2 = globalThis.AbortController;
37969
+ var AS2 = globalThis.AbortSignal;
37970
+ if (typeof AC2 === "undefined") {
37971
+ AS2 = class AbortSignal2 {
37972
+ onabort;
37973
+ _onabort = [];
37974
+ reason;
37975
+ aborted = false;
37976
+ addEventListener(_, fn) {
37977
+ this._onabort.push(fn);
37978
+ }
37979
+ };
37980
+ AC2 = class AbortController2 {
37981
+ constructor() {
37982
+ warnACPolyfill();
37983
+ }
37984
+ signal = new AS2;
37985
+ abort(reason) {
37986
+ if (this.signal.aborted)
37987
+ return;
37988
+ this.signal.reason = reason;
37989
+ this.signal.aborted = true;
37990
+ for (const fn of this.signal._onabort) {
37991
+ fn(reason);
37992
+ }
37993
+ this.signal.onabort?.(reason);
37994
+ }
37995
+ };
37996
+ let printACPolyfillWarning = PROCESS2.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
37997
+ const warnACPolyfill = () => {
37998
+ if (!printACPolyfillWarning)
37999
+ return;
38000
+ printACPolyfillWarning = false;
38001
+ emitWarning2("AbortController is not defined. If using lru-cache in " + "node 14, load an AbortController polyfill from the " + "`node-abort-controller` package. A minimal polyfill is " + "provided for use by LRUCache.fetch(), but it should not be " + "relied upon in other contexts (eg, passing it to other APIs that " + "use AbortController/AbortSignal might have undesirable effects). " + "You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
38002
+ };
38003
+ }
38004
+ var shouldWarn2 = (code) => !warned2.has(code);
38005
+ var TYPE2 = Symbol("type");
38006
+ var isPosInt2 = (n2) => n2 && n2 === Math.floor(n2) && n2 > 0 && isFinite(n2);
38007
+ var getUintArray2 = (max) => !isPosInt2(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray2 : null;
38008
+
38009
+ class ZeroArray2 extends Array {
38010
+ constructor(size) {
38011
+ super(size);
38012
+ this.fill(0);
38013
+ }
38014
+ }
38015
+
38016
+ class Stack2 {
38017
+ heap;
38018
+ length;
38019
+ static #constructing = false;
38020
+ static create(max) {
38021
+ const HeapCls = getUintArray2(max);
38022
+ if (!HeapCls)
38023
+ return [];
38024
+ Stack2.#constructing = true;
38025
+ const s = new Stack2(max, HeapCls);
38026
+ Stack2.#constructing = false;
38027
+ return s;
38028
+ }
38029
+ constructor(max, HeapCls) {
38030
+ if (!Stack2.#constructing) {
38031
+ throw new TypeError("instantiate Stack using Stack.create(n)");
38032
+ }
38033
+ this.heap = new HeapCls(max);
38034
+ this.length = 0;
38035
+ }
38036
+ push(n2) {
38037
+ this.heap[this.length++] = n2;
38038
+ }
38039
+ pop() {
38040
+ return this.heap[--this.length];
38041
+ }
38042
+ }
38043
+
38044
+ class LRUCache2 {
38045
+ #max;
38046
+ #maxSize;
38047
+ #dispose;
38048
+ #disposeAfter;
38049
+ #fetchMethod;
38050
+ #memoMethod;
38051
+ ttl;
38052
+ ttlResolution;
38053
+ ttlAutopurge;
38054
+ updateAgeOnGet;
38055
+ updateAgeOnHas;
38056
+ allowStale;
38057
+ noDisposeOnSet;
38058
+ noUpdateTTL;
38059
+ maxEntrySize;
38060
+ sizeCalculation;
38061
+ noDeleteOnFetchRejection;
38062
+ noDeleteOnStaleGet;
38063
+ allowStaleOnFetchAbort;
38064
+ allowStaleOnFetchRejection;
38065
+ ignoreFetchAbort;
38066
+ #size;
38067
+ #calculatedSize;
38068
+ #keyMap;
38069
+ #keyList;
38070
+ #valList;
38071
+ #next;
38072
+ #prev;
38073
+ #head;
38074
+ #tail;
38075
+ #free;
38076
+ #disposed;
38077
+ #sizes;
38078
+ #starts;
38079
+ #ttls;
38080
+ #hasDispose;
38081
+ #hasFetchMethod;
38082
+ #hasDisposeAfter;
38083
+ static unsafeExposeInternals(c) {
38084
+ return {
38085
+ starts: c.#starts,
38086
+ ttls: c.#ttls,
38087
+ sizes: c.#sizes,
38088
+ keyMap: c.#keyMap,
38089
+ keyList: c.#keyList,
38090
+ valList: c.#valList,
38091
+ next: c.#next,
38092
+ prev: c.#prev,
38093
+ get head() {
38094
+ return c.#head;
38095
+ },
38096
+ get tail() {
38097
+ return c.#tail;
38098
+ },
38099
+ free: c.#free,
38100
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
38101
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
38102
+ moveToTail: (index) => c.#moveToTail(index),
38103
+ indexes: (options) => c.#indexes(options),
38104
+ rindexes: (options) => c.#rindexes(options),
38105
+ isStale: (index) => c.#isStale(index)
38106
+ };
38107
+ }
38108
+ get max() {
38109
+ return this.#max;
38110
+ }
38111
+ get maxSize() {
38112
+ return this.#maxSize;
38113
+ }
38114
+ get calculatedSize() {
38115
+ return this.#calculatedSize;
38116
+ }
38117
+ get size() {
38118
+ return this.#size;
38119
+ }
38120
+ get fetchMethod() {
38121
+ return this.#fetchMethod;
38122
+ }
38123
+ get memoMethod() {
38124
+ return this.#memoMethod;
38125
+ }
38126
+ get dispose() {
38127
+ return this.#dispose;
38128
+ }
38129
+ get disposeAfter() {
38130
+ return this.#disposeAfter;
38131
+ }
38132
+ constructor(options) {
38133
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
38134
+ if (max !== 0 && !isPosInt2(max)) {
38135
+ throw new TypeError("max option must be a nonnegative integer");
38136
+ }
38137
+ const UintArray = max ? getUintArray2(max) : Array;
38138
+ if (!UintArray) {
38139
+ throw new Error("invalid max value: " + max);
38140
+ }
38141
+ this.#max = max;
38142
+ this.#maxSize = maxSize;
38143
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
38144
+ this.sizeCalculation = sizeCalculation;
38145
+ if (this.sizeCalculation) {
38146
+ if (!this.#maxSize && !this.maxEntrySize) {
38147
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
38148
+ }
38149
+ if (typeof this.sizeCalculation !== "function") {
38150
+ throw new TypeError("sizeCalculation set to non-function");
38151
+ }
38152
+ }
38153
+ if (memoMethod !== undefined && typeof memoMethod !== "function") {
38154
+ throw new TypeError("memoMethod must be a function if defined");
38155
+ }
38156
+ this.#memoMethod = memoMethod;
38157
+ if (fetchMethod !== undefined && typeof fetchMethod !== "function") {
38158
+ throw new TypeError("fetchMethod must be a function if specified");
38159
+ }
38160
+ this.#fetchMethod = fetchMethod;
38161
+ this.#hasFetchMethod = !!fetchMethod;
38162
+ this.#keyMap = new Map;
38163
+ this.#keyList = new Array(max).fill(undefined);
38164
+ this.#valList = new Array(max).fill(undefined);
38165
+ this.#next = new UintArray(max);
38166
+ this.#prev = new UintArray(max);
38167
+ this.#head = 0;
38168
+ this.#tail = 0;
38169
+ this.#free = Stack2.create(max);
38170
+ this.#size = 0;
38171
+ this.#calculatedSize = 0;
38172
+ if (typeof dispose === "function") {
38173
+ this.#dispose = dispose;
38174
+ }
38175
+ if (typeof disposeAfter === "function") {
38176
+ this.#disposeAfter = disposeAfter;
38177
+ this.#disposed = [];
38178
+ } else {
38179
+ this.#disposeAfter = undefined;
38180
+ this.#disposed = undefined;
38181
+ }
38182
+ this.#hasDispose = !!this.#dispose;
38183
+ this.#hasDisposeAfter = !!this.#disposeAfter;
38184
+ this.noDisposeOnSet = !!noDisposeOnSet;
38185
+ this.noUpdateTTL = !!noUpdateTTL;
38186
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
38187
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
38188
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
38189
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
38190
+ if (this.maxEntrySize !== 0) {
38191
+ if (this.#maxSize !== 0) {
38192
+ if (!isPosInt2(this.#maxSize)) {
38193
+ throw new TypeError("maxSize must be a positive integer if specified");
38194
+ }
38195
+ }
38196
+ if (!isPosInt2(this.maxEntrySize)) {
38197
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
38198
+ }
38199
+ this.#initializeSizeTracking();
38200
+ }
38201
+ this.allowStale = !!allowStale;
38202
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
38203
+ this.updateAgeOnGet = !!updateAgeOnGet;
38204
+ this.updateAgeOnHas = !!updateAgeOnHas;
38205
+ this.ttlResolution = isPosInt2(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
38206
+ this.ttlAutopurge = !!ttlAutopurge;
38207
+ this.ttl = ttl || 0;
38208
+ if (this.ttl) {
38209
+ if (!isPosInt2(this.ttl)) {
38210
+ throw new TypeError("ttl must be a positive integer if specified");
38211
+ }
38212
+ this.#initializeTTLTracking();
38213
+ }
38214
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
38215
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
38216
+ }
38217
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
38218
+ const code = "LRU_CACHE_UNBOUNDED";
38219
+ if (shouldWarn2(code)) {
38220
+ warned2.add(code);
38221
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
38222
+ emitWarning2(msg, "UnboundedCacheWarning", code, LRUCache2);
38223
+ }
38224
+ }
38225
+ }
38226
+ getRemainingTTL(key2) {
38227
+ return this.#keyMap.has(key2) ? Infinity : 0;
38228
+ }
38229
+ #initializeTTLTracking() {
38230
+ const ttls = new ZeroArray2(this.#max);
38231
+ const starts = new ZeroArray2(this.#max);
38232
+ this.#ttls = ttls;
38233
+ this.#starts = starts;
38234
+ this.#setItemTTL = (index, ttl, start = perf2.now()) => {
38235
+ starts[index] = ttl !== 0 ? start : 0;
38236
+ ttls[index] = ttl;
38237
+ if (ttl !== 0 && this.ttlAutopurge) {
38238
+ const t3 = setTimeout(() => {
38239
+ if (this.#isStale(index)) {
38240
+ this.#delete(this.#keyList[index], "expire");
38241
+ }
38242
+ }, ttl + 1);
38243
+ if (t3.unref) {
38244
+ t3.unref();
38245
+ }
38246
+ }
38247
+ };
38248
+ this.#updateItemAge = (index) => {
38249
+ starts[index] = ttls[index] !== 0 ? perf2.now() : 0;
38250
+ };
38251
+ this.#statusTTL = (status, index) => {
38252
+ if (ttls[index]) {
38253
+ const ttl = ttls[index];
38254
+ const start = starts[index];
38255
+ if (!ttl || !start)
38256
+ return;
38257
+ status.ttl = ttl;
38258
+ status.start = start;
38259
+ status.now = cachedNow || getNow();
38260
+ const age = status.now - start;
38261
+ status.remainingTTL = ttl - age;
38262
+ }
38263
+ };
38264
+ let cachedNow = 0;
38265
+ const getNow = () => {
38266
+ const n2 = perf2.now();
38267
+ if (this.ttlResolution > 0) {
38268
+ cachedNow = n2;
38269
+ const t3 = setTimeout(() => cachedNow = 0, this.ttlResolution);
38270
+ if (t3.unref) {
38271
+ t3.unref();
38272
+ }
38273
+ }
38274
+ return n2;
38275
+ };
38276
+ this.getRemainingTTL = (key2) => {
38277
+ const index = this.#keyMap.get(key2);
38278
+ if (index === undefined) {
38279
+ return 0;
38280
+ }
38281
+ const ttl = ttls[index];
38282
+ const start = starts[index];
38283
+ if (!ttl || !start) {
38284
+ return Infinity;
38285
+ }
38286
+ const age = (cachedNow || getNow()) - start;
38287
+ return ttl - age;
38288
+ };
38289
+ this.#isStale = (index) => {
38290
+ const s = starts[index];
38291
+ const t3 = ttls[index];
38292
+ return !!t3 && !!s && (cachedNow || getNow()) - s > t3;
38293
+ };
38294
+ }
38295
+ #updateItemAge = () => {};
38296
+ #statusTTL = () => {};
38297
+ #setItemTTL = () => {};
38298
+ #isStale = () => false;
38299
+ #initializeSizeTracking() {
38300
+ const sizes = new ZeroArray2(this.#max);
38301
+ this.#calculatedSize = 0;
38302
+ this.#sizes = sizes;
38303
+ this.#removeItemSize = (index) => {
38304
+ this.#calculatedSize -= sizes[index];
38305
+ sizes[index] = 0;
38306
+ };
38307
+ this.#requireSize = (k, v, size, sizeCalculation) => {
38308
+ if (this.#isBackgroundFetch(v)) {
38309
+ return 0;
38310
+ }
38311
+ if (!isPosInt2(size)) {
38312
+ if (sizeCalculation) {
38313
+ if (typeof sizeCalculation !== "function") {
38314
+ throw new TypeError("sizeCalculation must be a function");
38315
+ }
38316
+ size = sizeCalculation(v, k);
38317
+ if (!isPosInt2(size)) {
38318
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
38319
+ }
38320
+ } else {
38321
+ throw new TypeError("invalid size value (must be positive integer). " + "When maxSize or maxEntrySize is used, sizeCalculation " + "or size must be set.");
38322
+ }
38323
+ }
38324
+ return size;
38325
+ };
38326
+ this.#addItemSize = (index, size, status) => {
38327
+ sizes[index] = size;
38328
+ if (this.#maxSize) {
38329
+ const maxSize = this.#maxSize - sizes[index];
38330
+ while (this.#calculatedSize > maxSize) {
38331
+ this.#evict(true);
38332
+ }
38333
+ }
38334
+ this.#calculatedSize += sizes[index];
38335
+ if (status) {
38336
+ status.entrySize = size;
38337
+ status.totalCalculatedSize = this.#calculatedSize;
38338
+ }
38339
+ };
38340
+ }
38341
+ #removeItemSize = (_i) => {};
38342
+ #addItemSize = (_i, _s, _st) => {};
38343
+ #requireSize = (_k, _v, size, sizeCalculation) => {
38344
+ if (size || sizeCalculation) {
38345
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
38346
+ }
38347
+ return 0;
38348
+ };
38349
+ *#indexes({ allowStale = this.allowStale } = {}) {
38350
+ if (this.#size) {
38351
+ for (let i2 = this.#tail;; ) {
38352
+ if (!this.#isValidIndex(i2)) {
38353
+ break;
38354
+ }
38355
+ if (allowStale || !this.#isStale(i2)) {
38356
+ yield i2;
38357
+ }
38358
+ if (i2 === this.#head) {
38359
+ break;
38360
+ } else {
38361
+ i2 = this.#prev[i2];
38362
+ }
38363
+ }
38364
+ }
38365
+ }
38366
+ *#rindexes({ allowStale = this.allowStale } = {}) {
38367
+ if (this.#size) {
38368
+ for (let i2 = this.#head;; ) {
38369
+ if (!this.#isValidIndex(i2)) {
38370
+ break;
38371
+ }
38372
+ if (allowStale || !this.#isStale(i2)) {
38373
+ yield i2;
38374
+ }
38375
+ if (i2 === this.#tail) {
38376
+ break;
38377
+ } else {
38378
+ i2 = this.#next[i2];
38379
+ }
38380
+ }
38381
+ }
36573
38382
  }
36574
- shouldRetry(number) {
36575
- return number < maxRetry;
38383
+ #isValidIndex(index) {
38384
+ return index !== undefined && this.#keyMap.get(this.#keyList[index]) === index;
36576
38385
  }
36577
- }
36578
-
36579
- class GitPathspecError extends GitError {
36580
- constructor() {
36581
- super("The git reference could not be found");
38386
+ *entries() {
38387
+ for (const i2 of this.#indexes()) {
38388
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38389
+ yield [this.#keyList[i2], this.#valList[i2]];
38390
+ }
38391
+ }
36582
38392
  }
36583
- }
36584
-
36585
- class GitUnknownError extends GitError {
36586
- constructor() {
36587
- super("An unknown git error occurred");
38393
+ *rentries() {
38394
+ for (const i2 of this.#rindexes()) {
38395
+ if (this.#valList[i2] !== undefined && this.#keyList[i2] !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38396
+ yield [this.#keyList[i2], this.#valList[i2]];
38397
+ }
38398
+ }
36588
38399
  }
36589
- }
36590
- module.exports = {
36591
- GitConnectionError,
36592
- GitPathspecError,
36593
- GitUnknownError
36594
- };
36595
- });
36596
-
36597
- // ../../node_modules/@npmcli/git/lib/make-error.js
36598
- var require_make_error = __commonJS((exports, module) => {
36599
- var {
36600
- GitConnectionError,
36601
- GitPathspecError,
36602
- GitUnknownError
36603
- } = require_errors2();
36604
- var connectionErrorRe = new RegExp([
36605
- "remote error: Internal Server Error",
36606
- "The remote end hung up unexpectedly",
36607
- "Connection timed out",
36608
- "Operation timed out",
36609
- "Failed to connect to .* Timed out",
36610
- "Connection reset by peer",
36611
- "SSL_ERROR_SYSCALL",
36612
- "The requested URL returned error: 503"
36613
- ].join("|"));
36614
- var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
36615
- function makeError(er) {
36616
- const message = er.stderr;
36617
- let gitEr;
36618
- if (connectionErrorRe.test(message)) {
36619
- gitEr = new GitConnectionError(message);
36620
- } else if (missingPathspecRe.test(message)) {
36621
- gitEr = new GitPathspecError(message);
36622
- } else {
36623
- gitEr = new GitUnknownError(message);
38400
+ *keys() {
38401
+ for (const i2 of this.#indexes()) {
38402
+ const k = this.#keyList[i2];
38403
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38404
+ yield k;
38405
+ }
38406
+ }
36624
38407
  }
36625
- return Object.assign(gitEr, er);
36626
- }
36627
- module.exports = makeError;
36628
- });
36629
-
36630
- // ../../node_modules/ini/lib/ini.js
36631
- var require_ini = __commonJS((exports, module) => {
36632
- var { hasOwnProperty } = Object.prototype;
36633
- var encode = (obj, opt = {}) => {
36634
- if (typeof opt === "string") {
36635
- opt = { section: opt };
38408
+ *rkeys() {
38409
+ for (const i2 of this.#rindexes()) {
38410
+ const k = this.#keyList[i2];
38411
+ if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38412
+ yield k;
38413
+ }
38414
+ }
36636
38415
  }
36637
- opt.align = opt.align === true;
36638
- opt.newline = opt.newline === true;
36639
- opt.sort = opt.sort === true;
36640
- opt.whitespace = opt.whitespace === true || opt.align === true;
36641
- opt.platform = opt.platform || typeof process !== "undefined" && process.platform;
36642
- opt.bracketedArray = opt.bracketedArray !== false;
36643
- const eol = opt.platform === "win32" ? `\r
36644
- ` : `
36645
- `;
36646
- const separator = opt.whitespace ? " = " : "=";
36647
- const children = [];
36648
- const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj);
36649
- let padToChars = 0;
36650
- if (opt.align) {
36651
- padToChars = safe(keys.filter((k) => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== "object").map((k) => Array.isArray(obj[k]) ? `${k}[]` : k).concat([""]).reduce((a3, b) => safe(a3).length >= safe(b).length ? a3 : b)).length;
38416
+ *values() {
38417
+ for (const i2 of this.#indexes()) {
38418
+ const v = this.#valList[i2];
38419
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38420
+ yield this.#valList[i2];
38421
+ }
38422
+ }
36652
38423
  }
36653
- let out = "";
36654
- const arraySuffix = opt.bracketedArray ? "[]" : "";
36655
- for (const k of keys) {
36656
- const val = obj[k];
36657
- if (val && Array.isArray(val)) {
36658
- for (const item of val) {
36659
- out += safe(`${k}${arraySuffix}`).padEnd(padToChars, " ") + separator + safe(item) + eol;
38424
+ *rvalues() {
38425
+ for (const i2 of this.#rindexes()) {
38426
+ const v = this.#valList[i2];
38427
+ if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i2])) {
38428
+ yield this.#valList[i2];
36660
38429
  }
36661
- } else if (val && typeof val === "object") {
36662
- children.push(k);
36663
- } else {
36664
- out += safe(k).padEnd(padToChars, " ") + separator + safe(val) + eol;
36665
38430
  }
36666
38431
  }
36667
- if (opt.section && out.length) {
36668
- out = "[" + safe(opt.section) + "]" + (opt.newline ? eol + eol : eol) + out;
38432
+ [Symbol.iterator]() {
38433
+ return this.entries();
36669
38434
  }
36670
- for (const k of children) {
36671
- const nk = splitSections(k, ".").join("\\.");
36672
- const section = (opt.section ? opt.section + "." : "") + nk;
36673
- const child = encode(obj[k], {
36674
- ...opt,
36675
- section
36676
- });
36677
- if (out.length && child.length) {
36678
- out += eol;
38435
+ [Symbol.toStringTag] = "LRUCache";
38436
+ find(fn, getOptions = {}) {
38437
+ for (const i2 of this.#indexes()) {
38438
+ const v = this.#valList[i2];
38439
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38440
+ if (value2 === undefined)
38441
+ continue;
38442
+ if (fn(value2, this.#keyList[i2], this)) {
38443
+ return this.get(this.#keyList[i2], getOptions);
38444
+ }
36679
38445
  }
36680
- out += child;
36681
38446
  }
36682
- return out;
36683
- };
36684
- function splitSections(str, separator) {
36685
- var lastMatchIndex = 0;
36686
- var lastSeparatorIndex = 0;
36687
- var nextIndex = 0;
36688
- var sections = [];
36689
- do {
36690
- nextIndex = str.indexOf(separator, lastMatchIndex);
36691
- if (nextIndex !== -1) {
36692
- lastMatchIndex = nextIndex + separator.length;
36693
- if (nextIndex > 0 && str[nextIndex - 1] === "\\") {
38447
+ forEach(fn, thisp = this) {
38448
+ for (const i2 of this.#indexes()) {
38449
+ const v = this.#valList[i2];
38450
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38451
+ if (value2 === undefined)
38452
+ continue;
38453
+ fn.call(thisp, value2, this.#keyList[i2], this);
38454
+ }
38455
+ }
38456
+ rforEach(fn, thisp = this) {
38457
+ for (const i2 of this.#rindexes()) {
38458
+ const v = this.#valList[i2];
38459
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38460
+ if (value2 === undefined)
36694
38461
  continue;
38462
+ fn.call(thisp, value2, this.#keyList[i2], this);
38463
+ }
38464
+ }
38465
+ purgeStale() {
38466
+ let deleted = false;
38467
+ for (const i2 of this.#rindexes({ allowStale: true })) {
38468
+ if (this.#isStale(i2)) {
38469
+ this.#delete(this.#keyList[i2], "expire");
38470
+ deleted = true;
36695
38471
  }
36696
- sections.push(str.slice(lastSeparatorIndex, nextIndex));
36697
- lastSeparatorIndex = nextIndex + separator.length;
36698
38472
  }
36699
- } while (nextIndex !== -1);
36700
- sections.push(str.slice(lastSeparatorIndex));
36701
- return sections;
36702
- }
36703
- var decode = (str, opt = {}) => {
36704
- opt.bracketedArray = opt.bracketedArray !== false;
36705
- const out = Object.create(null);
36706
- let p = out;
36707
- let section = null;
36708
- const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i;
36709
- const lines2 = str.split(/[\r\n]+/g);
36710
- const duplicates = {};
36711
- for (const line of lines2) {
36712
- if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) {
36713
- continue;
38473
+ return deleted;
38474
+ }
38475
+ info(key2) {
38476
+ const i2 = this.#keyMap.get(key2);
38477
+ if (i2 === undefined)
38478
+ return;
38479
+ const v = this.#valList[i2];
38480
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38481
+ if (value2 === undefined)
38482
+ return;
38483
+ const entry = { value: value2 };
38484
+ if (this.#ttls && this.#starts) {
38485
+ const ttl = this.#ttls[i2];
38486
+ const start = this.#starts[i2];
38487
+ if (ttl && start) {
38488
+ const remain = ttl - (perf2.now() - start);
38489
+ entry.ttl = remain;
38490
+ entry.start = Date.now();
38491
+ }
36714
38492
  }
36715
- const match2 = line.match(re);
36716
- if (!match2) {
36717
- continue;
38493
+ if (this.#sizes) {
38494
+ entry.size = this.#sizes[i2];
36718
38495
  }
36719
- if (match2[1] !== undefined) {
36720
- section = unsafe(match2[1]);
36721
- if (section === "__proto__") {
36722
- p = Object.create(null);
38496
+ return entry;
38497
+ }
38498
+ dump() {
38499
+ const arr = [];
38500
+ for (const i2 of this.#indexes({ allowStale: true })) {
38501
+ const key2 = this.#keyList[i2];
38502
+ const v = this.#valList[i2];
38503
+ const value2 = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
38504
+ if (value2 === undefined || key2 === undefined)
36723
38505
  continue;
38506
+ const entry = { value: value2 };
38507
+ if (this.#ttls && this.#starts) {
38508
+ entry.ttl = this.#ttls[i2];
38509
+ const age = perf2.now() - this.#starts[i2];
38510
+ entry.start = Math.floor(Date.now() - age);
36724
38511
  }
36725
- p = out[section] = out[section] || Object.create(null);
36726
- continue;
38512
+ if (this.#sizes) {
38513
+ entry.size = this.#sizes[i2];
38514
+ }
38515
+ arr.unshift([key2, entry]);
36727
38516
  }
36728
- const keyRaw = unsafe(match2[2]);
36729
- let isArray;
36730
- if (opt.bracketedArray) {
36731
- isArray = keyRaw.length > 2 && keyRaw.slice(-2) === "[]";
36732
- } else {
36733
- duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1;
36734
- isArray = duplicates[keyRaw] > 1;
38517
+ return arr;
38518
+ }
38519
+ load(arr) {
38520
+ this.clear();
38521
+ for (const [key2, entry] of arr) {
38522
+ if (entry.start) {
38523
+ const age = Date.now() - entry.start;
38524
+ entry.start = perf2.now() - age;
38525
+ }
38526
+ this.set(key2, entry.value, entry);
36735
38527
  }
36736
- const key2 = isArray && keyRaw.endsWith("[]") ? keyRaw.slice(0, -2) : keyRaw;
36737
- if (key2 === "__proto__") {
36738
- continue;
38528
+ }
38529
+ set(k, v, setOptions = {}) {
38530
+ if (v === undefined) {
38531
+ this.delete(k);
38532
+ return this;
36739
38533
  }
36740
- const valueRaw = match2[3] ? unsafe(match2[4]) : true;
36741
- const value2 = valueRaw === "true" || valueRaw === "false" || valueRaw === "null" ? JSON.parse(valueRaw) : valueRaw;
36742
- if (isArray) {
36743
- if (!hasOwnProperty.call(p, key2)) {
36744
- p[key2] = [];
36745
- } else if (!Array.isArray(p[key2])) {
36746
- p[key2] = [p[key2]];
38534
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
38535
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
38536
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
38537
+ if (this.maxEntrySize && size > this.maxEntrySize) {
38538
+ if (status) {
38539
+ status.set = "miss";
38540
+ status.maxEntrySizeExceeded = true;
36747
38541
  }
38542
+ this.#delete(k, "set");
38543
+ return this;
36748
38544
  }
36749
- if (Array.isArray(p[key2])) {
36750
- p[key2].push(value2);
38545
+ let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
38546
+ if (index === undefined) {
38547
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
38548
+ this.#keyList[index] = k;
38549
+ this.#valList[index] = v;
38550
+ this.#keyMap.set(k, index);
38551
+ this.#next[this.#tail] = index;
38552
+ this.#prev[index] = this.#tail;
38553
+ this.#tail = index;
38554
+ this.#size++;
38555
+ this.#addItemSize(index, size, status);
38556
+ if (status)
38557
+ status.set = "add";
38558
+ noUpdateTTL = false;
36751
38559
  } else {
36752
- p[key2] = value2;
38560
+ this.#moveToTail(index);
38561
+ const oldVal = this.#valList[index];
38562
+ if (v !== oldVal) {
38563
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
38564
+ oldVal.__abortController.abort(new Error("replaced"));
38565
+ const { __staleWhileFetching: s } = oldVal;
38566
+ if (s !== undefined && !noDisposeOnSet) {
38567
+ if (this.#hasDispose) {
38568
+ this.#dispose?.(s, k, "set");
38569
+ }
38570
+ if (this.#hasDisposeAfter) {
38571
+ this.#disposed?.push([s, k, "set"]);
38572
+ }
38573
+ }
38574
+ } else if (!noDisposeOnSet) {
38575
+ if (this.#hasDispose) {
38576
+ this.#dispose?.(oldVal, k, "set");
38577
+ }
38578
+ if (this.#hasDisposeAfter) {
38579
+ this.#disposed?.push([oldVal, k, "set"]);
38580
+ }
38581
+ }
38582
+ this.#removeItemSize(index);
38583
+ this.#addItemSize(index, size, status);
38584
+ this.#valList[index] = v;
38585
+ if (status) {
38586
+ status.set = "replace";
38587
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
38588
+ if (oldValue !== undefined)
38589
+ status.oldValue = oldValue;
38590
+ }
38591
+ } else if (status) {
38592
+ status.set = "update";
38593
+ }
38594
+ }
38595
+ if (ttl !== 0 && !this.#ttls) {
38596
+ this.#initializeTTLTracking();
38597
+ }
38598
+ if (this.#ttls) {
38599
+ if (!noUpdateTTL) {
38600
+ this.#setItemTTL(index, ttl, start);
38601
+ }
38602
+ if (status)
38603
+ this.#statusTTL(status, index);
38604
+ }
38605
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
38606
+ const dt2 = this.#disposed;
38607
+ let task;
38608
+ while (task = dt2?.shift()) {
38609
+ this.#disposeAfter?.(...task);
38610
+ }
36753
38611
  }
38612
+ return this;
36754
38613
  }
36755
- const remove = [];
36756
- for (const k of Object.keys(out)) {
36757
- if (!hasOwnProperty.call(out, k) || typeof out[k] !== "object" || Array.isArray(out[k])) {
36758
- continue;
38614
+ pop() {
38615
+ try {
38616
+ while (this.#size) {
38617
+ const val = this.#valList[this.#head];
38618
+ this.#evict(true);
38619
+ if (this.#isBackgroundFetch(val)) {
38620
+ if (val.__staleWhileFetching) {
38621
+ return val.__staleWhileFetching;
38622
+ }
38623
+ } else if (val !== undefined) {
38624
+ return val;
38625
+ }
38626
+ }
38627
+ } finally {
38628
+ if (this.#hasDisposeAfter && this.#disposed) {
38629
+ const dt2 = this.#disposed;
38630
+ let task;
38631
+ while (task = dt2?.shift()) {
38632
+ this.#disposeAfter?.(...task);
38633
+ }
38634
+ }
36759
38635
  }
36760
- const parts = splitSections(k, ".");
36761
- p = out;
36762
- const l2 = parts.pop();
36763
- const nl = l2.replace(/\\\./g, ".");
36764
- for (const part of parts) {
36765
- if (part === "__proto__") {
36766
- continue;
38636
+ }
38637
+ #evict(free) {
38638
+ const head = this.#head;
38639
+ const k = this.#keyList[head];
38640
+ const v = this.#valList[head];
38641
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
38642
+ v.__abortController.abort(new Error("evicted"));
38643
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
38644
+ if (this.#hasDispose) {
38645
+ this.#dispose?.(v, k, "evict");
36767
38646
  }
36768
- if (!hasOwnProperty.call(p, part) || typeof p[part] !== "object") {
36769
- p[part] = Object.create(null);
38647
+ if (this.#hasDisposeAfter) {
38648
+ this.#disposed?.push([v, k, "evict"]);
36770
38649
  }
36771
- p = p[part];
36772
38650
  }
36773
- if (p === out && nl === l2) {
36774
- continue;
38651
+ this.#removeItemSize(head);
38652
+ if (free) {
38653
+ this.#keyList[head] = undefined;
38654
+ this.#valList[head] = undefined;
38655
+ this.#free.push(head);
36775
38656
  }
36776
- p[nl] = out[k];
36777
- remove.push(k);
38657
+ if (this.#size === 1) {
38658
+ this.#head = this.#tail = 0;
38659
+ this.#free.length = 0;
38660
+ } else {
38661
+ this.#head = this.#next[head];
38662
+ }
38663
+ this.#keyMap.delete(k);
38664
+ this.#size--;
38665
+ return head;
36778
38666
  }
36779
- for (const del of remove) {
36780
- delete out[del];
38667
+ has(k, hasOptions = {}) {
38668
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
38669
+ const index = this.#keyMap.get(k);
38670
+ if (index !== undefined) {
38671
+ const v = this.#valList[index];
38672
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
38673
+ return false;
38674
+ }
38675
+ if (!this.#isStale(index)) {
38676
+ if (updateAgeOnHas) {
38677
+ this.#updateItemAge(index);
38678
+ }
38679
+ if (status) {
38680
+ status.has = "hit";
38681
+ this.#statusTTL(status, index);
38682
+ }
38683
+ return true;
38684
+ } else if (status) {
38685
+ status.has = "stale";
38686
+ this.#statusTTL(status, index);
38687
+ }
38688
+ } else if (status) {
38689
+ status.has = "miss";
38690
+ }
38691
+ return false;
36781
38692
  }
36782
- return out;
36783
- };
36784
- var isQuoted = (val) => {
36785
- return val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'");
36786
- };
36787
- var safe = (val) => {
36788
- if (typeof val !== "string" || val.match(/[=\r\n]/) || val.match(/^\[/) || val.length > 1 && isQuoted(val) || val !== val.trim()) {
36789
- return JSON.stringify(val);
38693
+ peek(k, peekOptions = {}) {
38694
+ const { allowStale = this.allowStale } = peekOptions;
38695
+ const index = this.#keyMap.get(k);
38696
+ if (index === undefined || !allowStale && this.#isStale(index)) {
38697
+ return;
38698
+ }
38699
+ const v = this.#valList[index];
38700
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
36790
38701
  }
36791
- return val.split(";").join("\\;").split("#").join("\\#");
36792
- };
36793
- var unsafe = (val) => {
36794
- val = (val || "").trim();
36795
- if (isQuoted(val)) {
36796
- if (val.charAt(0) === "'") {
36797
- val = val.slice(1, -1);
38702
+ #backgroundFetch(k, index, options, context) {
38703
+ const v = index === undefined ? undefined : this.#valList[index];
38704
+ if (this.#isBackgroundFetch(v)) {
38705
+ return v;
36798
38706
  }
36799
- try {
36800
- val = JSON.parse(val);
36801
- } catch {}
36802
- } else {
36803
- let esc = false;
36804
- let unesc = "";
36805
- for (let i2 = 0, l2 = val.length;i2 < l2; i2++) {
36806
- const c = val.charAt(i2);
36807
- if (esc) {
36808
- if ("\\;#".indexOf(c) !== -1) {
36809
- unesc += c;
38707
+ const ac = new AC2;
38708
+ const { signal } = options;
38709
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
38710
+ signal: ac.signal
38711
+ });
38712
+ const fetchOpts = {
38713
+ signal: ac.signal,
38714
+ options,
38715
+ context
38716
+ };
38717
+ const cb = (v2, updateCache = false) => {
38718
+ const { aborted } = ac.signal;
38719
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== undefined;
38720
+ if (options.status) {
38721
+ if (aborted && !updateCache) {
38722
+ options.status.fetchAborted = true;
38723
+ options.status.fetchError = ac.signal.reason;
38724
+ if (ignoreAbort)
38725
+ options.status.fetchAbortIgnored = true;
36810
38726
  } else {
36811
- unesc += "\\" + c;
38727
+ options.status.fetchResolved = true;
36812
38728
  }
36813
- esc = false;
36814
- } else if (";#".indexOf(c) !== -1) {
36815
- break;
36816
- } else if (c === "\\") {
36817
- esc = true;
36818
- } else {
36819
- unesc += c;
36820
38729
  }
38730
+ if (aborted && !ignoreAbort && !updateCache) {
38731
+ return fetchFail(ac.signal.reason);
38732
+ }
38733
+ const bf2 = p;
38734
+ if (this.#valList[index] === p) {
38735
+ if (v2 === undefined) {
38736
+ if (bf2.__staleWhileFetching) {
38737
+ this.#valList[index] = bf2.__staleWhileFetching;
38738
+ } else {
38739
+ this.#delete(k, "fetch");
38740
+ }
38741
+ } else {
38742
+ if (options.status)
38743
+ options.status.fetchUpdated = true;
38744
+ this.set(k, v2, fetchOpts.options);
38745
+ }
38746
+ }
38747
+ return v2;
38748
+ };
38749
+ const eb = (er) => {
38750
+ if (options.status) {
38751
+ options.status.fetchRejected = true;
38752
+ options.status.fetchError = er;
38753
+ }
38754
+ return fetchFail(er);
38755
+ };
38756
+ const fetchFail = (er) => {
38757
+ const { aborted } = ac.signal;
38758
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
38759
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
38760
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
38761
+ const bf2 = p;
38762
+ if (this.#valList[index] === p) {
38763
+ const del = !noDelete || bf2.__staleWhileFetching === undefined;
38764
+ if (del) {
38765
+ this.#delete(k, "fetch");
38766
+ } else if (!allowStaleAborted) {
38767
+ this.#valList[index] = bf2.__staleWhileFetching;
38768
+ }
38769
+ }
38770
+ if (allowStale) {
38771
+ if (options.status && bf2.__staleWhileFetching !== undefined) {
38772
+ options.status.returnedStale = true;
38773
+ }
38774
+ return bf2.__staleWhileFetching;
38775
+ } else if (bf2.__returned === bf2) {
38776
+ throw er;
38777
+ }
38778
+ };
38779
+ const pcall = (res, rej) => {
38780
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
38781
+ if (fmp && fmp instanceof Promise) {
38782
+ fmp.then((v2) => res(v2 === undefined ? undefined : v2), rej);
38783
+ }
38784
+ ac.signal.addEventListener("abort", () => {
38785
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
38786
+ res(undefined);
38787
+ if (options.allowStaleOnFetchAbort) {
38788
+ res = (v2) => cb(v2, true);
38789
+ }
38790
+ }
38791
+ });
38792
+ };
38793
+ if (options.status)
38794
+ options.status.fetchDispatched = true;
38795
+ const p = new Promise(pcall).then(cb, eb);
38796
+ const bf = Object.assign(p, {
38797
+ __abortController: ac,
38798
+ __staleWhileFetching: v,
38799
+ __returned: undefined
38800
+ });
38801
+ if (index === undefined) {
38802
+ this.set(k, bf, { ...fetchOpts.options, status: undefined });
38803
+ index = this.#keyMap.get(k);
38804
+ } else {
38805
+ this.#valList[index] = bf;
36821
38806
  }
36822
- if (esc) {
36823
- unesc += "\\";
38807
+ return bf;
38808
+ }
38809
+ #isBackgroundFetch(p) {
38810
+ if (!this.#hasFetchMethod)
38811
+ return false;
38812
+ const b = p;
38813
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC2;
38814
+ }
38815
+ async fetch(k, fetchOptions = {}) {
38816
+ const {
38817
+ allowStale = this.allowStale,
38818
+ updateAgeOnGet = this.updateAgeOnGet,
38819
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
38820
+ ttl = this.ttl,
38821
+ noDisposeOnSet = this.noDisposeOnSet,
38822
+ size = 0,
38823
+ sizeCalculation = this.sizeCalculation,
38824
+ noUpdateTTL = this.noUpdateTTL,
38825
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
38826
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
38827
+ ignoreFetchAbort = this.ignoreFetchAbort,
38828
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
38829
+ context,
38830
+ forceRefresh = false,
38831
+ status,
38832
+ signal
38833
+ } = fetchOptions;
38834
+ if (!this.#hasFetchMethod) {
38835
+ if (status)
38836
+ status.fetch = "get";
38837
+ return this.get(k, {
38838
+ allowStale,
38839
+ updateAgeOnGet,
38840
+ noDeleteOnStaleGet,
38841
+ status
38842
+ });
38843
+ }
38844
+ const options = {
38845
+ allowStale,
38846
+ updateAgeOnGet,
38847
+ noDeleteOnStaleGet,
38848
+ ttl,
38849
+ noDisposeOnSet,
38850
+ size,
38851
+ sizeCalculation,
38852
+ noUpdateTTL,
38853
+ noDeleteOnFetchRejection,
38854
+ allowStaleOnFetchRejection,
38855
+ allowStaleOnFetchAbort,
38856
+ ignoreFetchAbort,
38857
+ status,
38858
+ signal
38859
+ };
38860
+ let index = this.#keyMap.get(k);
38861
+ if (index === undefined) {
38862
+ if (status)
38863
+ status.fetch = "miss";
38864
+ const p = this.#backgroundFetch(k, index, options, context);
38865
+ return p.__returned = p;
38866
+ } else {
38867
+ const v = this.#valList[index];
38868
+ if (this.#isBackgroundFetch(v)) {
38869
+ const stale = allowStale && v.__staleWhileFetching !== undefined;
38870
+ if (status) {
38871
+ status.fetch = "inflight";
38872
+ if (stale)
38873
+ status.returnedStale = true;
38874
+ }
38875
+ return stale ? v.__staleWhileFetching : v.__returned = v;
38876
+ }
38877
+ const isStale = this.#isStale(index);
38878
+ if (!forceRefresh && !isStale) {
38879
+ if (status)
38880
+ status.fetch = "hit";
38881
+ this.#moveToTail(index);
38882
+ if (updateAgeOnGet) {
38883
+ this.#updateItemAge(index);
38884
+ }
38885
+ if (status)
38886
+ this.#statusTTL(status, index);
38887
+ return v;
38888
+ }
38889
+ const p = this.#backgroundFetch(k, index, options, context);
38890
+ const hasStale = p.__staleWhileFetching !== undefined;
38891
+ const staleVal = hasStale && allowStale;
38892
+ if (status) {
38893
+ status.fetch = isStale ? "stale" : "refresh";
38894
+ if (staleVal && isStale)
38895
+ status.returnedStale = true;
38896
+ }
38897
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
36824
38898
  }
36825
- return unesc.trim();
36826
38899
  }
36827
- return val;
36828
- };
36829
- module.exports = {
36830
- parse: decode,
36831
- decode,
36832
- stringify: encode,
36833
- encode,
36834
- safe,
36835
- unsafe
36836
- };
36837
- });
36838
-
36839
- // ../../node_modules/@npmcli/git/lib/opts.js
36840
- var require_opts = __commonJS((exports, module) => {
36841
- var fs4 = __require("node:fs");
36842
- var os = __require("node:os");
36843
- var path6 = __require("node:path");
36844
- var ini = require_ini();
36845
- var gitConfigPath = path6.join(os.homedir(), ".gitconfig");
36846
- var cachedConfig = null;
36847
- var loadGitConfig = () => {
36848
- if (cachedConfig === null) {
36849
- try {
36850
- cachedConfig = {};
36851
- if (fs4.existsSync(gitConfigPath)) {
36852
- const configContent = fs4.readFileSync(gitConfigPath, "utf-8");
36853
- cachedConfig = ini.parse(configContent);
38900
+ async forceFetch(k, fetchOptions = {}) {
38901
+ const v = await this.fetch(k, fetchOptions);
38902
+ if (v === undefined)
38903
+ throw new Error("fetch() returned undefined");
38904
+ return v;
38905
+ }
38906
+ memo(k, memoOptions = {}) {
38907
+ const memoMethod = this.#memoMethod;
38908
+ if (!memoMethod) {
38909
+ throw new Error("no memoMethod provided to constructor");
38910
+ }
38911
+ const { context, forceRefresh, ...options } = memoOptions;
38912
+ const v = this.get(k, options);
38913
+ if (!forceRefresh && v !== undefined)
38914
+ return v;
38915
+ const vv = memoMethod(k, v, {
38916
+ options,
38917
+ context
38918
+ });
38919
+ this.set(k, vv, options);
38920
+ return vv;
38921
+ }
38922
+ get(k, getOptions = {}) {
38923
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
38924
+ const index = this.#keyMap.get(k);
38925
+ if (index !== undefined) {
38926
+ const value2 = this.#valList[index];
38927
+ const fetching = this.#isBackgroundFetch(value2);
38928
+ if (status)
38929
+ this.#statusTTL(status, index);
38930
+ if (this.#isStale(index)) {
38931
+ if (status)
38932
+ status.get = "stale";
38933
+ if (!fetching) {
38934
+ if (!noDeleteOnStaleGet) {
38935
+ this.#delete(k, "expire");
38936
+ }
38937
+ if (status && allowStale)
38938
+ status.returnedStale = true;
38939
+ return allowStale ? value2 : undefined;
38940
+ } else {
38941
+ if (status && allowStale && value2.__staleWhileFetching !== undefined) {
38942
+ status.returnedStale = true;
38943
+ }
38944
+ return allowStale ? value2.__staleWhileFetching : undefined;
38945
+ }
38946
+ } else {
38947
+ if (status)
38948
+ status.get = "hit";
38949
+ if (fetching) {
38950
+ return value2.__staleWhileFetching;
38951
+ }
38952
+ this.#moveToTail(index);
38953
+ if (updateAgeOnGet) {
38954
+ this.#updateItemAge(index);
38955
+ }
38956
+ return value2;
36854
38957
  }
36855
- } catch (error2) {
36856
- cachedConfig = {};
38958
+ } else if (status) {
38959
+ status.get = "miss";
36857
38960
  }
36858
38961
  }
36859
- return cachedConfig;
36860
- };
36861
- var checkGitConfigs = () => {
36862
- const config3 = loadGitConfig();
36863
- return {
36864
- sshCommandSetInConfig: config3?.core?.sshCommand !== undefined,
36865
- askPassSetInConfig: config3?.core?.askpass !== undefined
36866
- };
36867
- };
36868
- var sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined;
36869
- var askPassSetInEnv = process.env.GIT_ASKPASS !== undefined;
36870
- var { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs();
36871
- var finalGitEnv = {
36872
- ...askPassSetInEnv || askPassSetInConfig ? {} : {
36873
- GIT_ASKPASS: "echo"
36874
- },
36875
- ...sshCommandSetInEnv || sshCommandSetInConfig ? {} : {
36876
- GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
38962
+ #connect(p, n2) {
38963
+ this.#prev[n2] = p;
38964
+ this.#next[p] = n2;
36877
38965
  }
36878
- };
36879
- module.exports = (opts = {}) => ({
36880
- stdioString: true,
36881
- ...opts,
36882
- shell: false,
36883
- env: opts.env || { ...finalGitEnv, ...process.env }
36884
- });
36885
- module.exports.loadGitConfig = loadGitConfig;
36886
- });
36887
-
36888
- // ../../node_modules/@npmcli/git/lib/which.js
36889
- var require_which = __commonJS((exports, module) => {
36890
- var which = require_lib5();
36891
- var gitPath;
36892
- try {
36893
- gitPath = which.sync("git");
36894
- } catch {}
36895
- module.exports = (opts = {}) => {
36896
- if (opts.git) {
36897
- return opts.git;
38966
+ #moveToTail(index) {
38967
+ if (index !== this.#tail) {
38968
+ if (index === this.#head) {
38969
+ this.#head = this.#next[index];
38970
+ } else {
38971
+ this.#connect(this.#prev[index], this.#next[index]);
38972
+ }
38973
+ this.#connect(this.#tail, index);
38974
+ this.#tail = index;
38975
+ }
36898
38976
  }
36899
- if (!gitPath || opts.git === false) {
36900
- return Object.assign(new Error("No git binary found in $PATH"), { code: "ENOGIT" });
38977
+ delete(k) {
38978
+ return this.#delete(k, "delete");
36901
38979
  }
36902
- return gitPath;
36903
- };
36904
- });
36905
-
36906
- // ../../node_modules/@npmcli/git/lib/spawn.js
36907
- var require_spawn = __commonJS((exports, module) => {
36908
- var spawn2 = require_lib6();
36909
- var promiseRetry = require_promise_retry();
36910
- var { log } = require_lib3();
36911
- var makeError = require_make_error();
36912
- var makeOpts = require_opts();
36913
- module.exports = (gitArgs, opts = {}) => {
36914
- const whichGit = require_which();
36915
- const gitPath = whichGit(opts);
36916
- if (gitPath instanceof Error) {
36917
- return Promise.reject(gitPath);
38980
+ #delete(k, reason) {
38981
+ let deleted = false;
38982
+ if (this.#size !== 0) {
38983
+ const index = this.#keyMap.get(k);
38984
+ if (index !== undefined) {
38985
+ deleted = true;
38986
+ if (this.#size === 1) {
38987
+ this.#clear(reason);
38988
+ } else {
38989
+ this.#removeItemSize(index);
38990
+ const v = this.#valList[index];
38991
+ if (this.#isBackgroundFetch(v)) {
38992
+ v.__abortController.abort(new Error("deleted"));
38993
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
38994
+ if (this.#hasDispose) {
38995
+ this.#dispose?.(v, k, reason);
38996
+ }
38997
+ if (this.#hasDisposeAfter) {
38998
+ this.#disposed?.push([v, k, reason]);
38999
+ }
39000
+ }
39001
+ this.#keyMap.delete(k);
39002
+ this.#keyList[index] = undefined;
39003
+ this.#valList[index] = undefined;
39004
+ if (index === this.#tail) {
39005
+ this.#tail = this.#prev[index];
39006
+ } else if (index === this.#head) {
39007
+ this.#head = this.#next[index];
39008
+ } else {
39009
+ const pi = this.#prev[index];
39010
+ this.#next[pi] = this.#next[index];
39011
+ const ni = this.#next[index];
39012
+ this.#prev[ni] = this.#prev[index];
39013
+ }
39014
+ this.#size--;
39015
+ this.#free.push(index);
39016
+ }
39017
+ }
39018
+ }
39019
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
39020
+ const dt2 = this.#disposed;
39021
+ let task;
39022
+ while (task = dt2?.shift()) {
39023
+ this.#disposeAfter?.(...task);
39024
+ }
39025
+ }
39026
+ return deleted;
36918
39027
  }
36919
- const args = opts.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
36920
- let retryOpts = opts.retry;
36921
- if (retryOpts === null || retryOpts === undefined) {
36922
- retryOpts = {
36923
- retries: opts.fetchRetries || 2,
36924
- factor: opts.fetchRetryFactor || 10,
36925
- maxTimeout: opts.fetchRetryMaxtimeout || 60000,
36926
- minTimeout: opts.fetchRetryMintimeout || 1000
36927
- };
39028
+ clear() {
39029
+ return this.#clear("delete");
36928
39030
  }
36929
- return promiseRetry((retryFn, number) => {
36930
- if (number !== 1) {
36931
- log.silly("git", `Retrying git command: ${args.join(" ")} attempt # ${number}`);
39031
+ #clear(reason) {
39032
+ for (const index of this.#rindexes({ allowStale: true })) {
39033
+ const v = this.#valList[index];
39034
+ if (this.#isBackgroundFetch(v)) {
39035
+ v.__abortController.abort(new Error("deleted"));
39036
+ } else {
39037
+ const k = this.#keyList[index];
39038
+ if (this.#hasDispose) {
39039
+ this.#dispose?.(v, k, reason);
39040
+ }
39041
+ if (this.#hasDisposeAfter) {
39042
+ this.#disposed?.push([v, k, reason]);
39043
+ }
39044
+ }
36932
39045
  }
36933
- return spawn2(gitPath, args, makeOpts(opts)).catch((er) => {
36934
- const gitError = makeError(er);
36935
- if (!gitError.shouldRetry(number)) {
36936
- throw gitError;
39046
+ this.#keyMap.clear();
39047
+ this.#valList.fill(undefined);
39048
+ this.#keyList.fill(undefined);
39049
+ if (this.#ttls && this.#starts) {
39050
+ this.#ttls.fill(0);
39051
+ this.#starts.fill(0);
39052
+ }
39053
+ if (this.#sizes) {
39054
+ this.#sizes.fill(0);
39055
+ }
39056
+ this.#head = 0;
39057
+ this.#tail = 0;
39058
+ this.#free.length = 0;
39059
+ this.#calculatedSize = 0;
39060
+ this.#size = 0;
39061
+ if (this.#hasDisposeAfter && this.#disposed) {
39062
+ const dt2 = this.#disposed;
39063
+ let task;
39064
+ while (task = dt2?.shift()) {
39065
+ this.#disposeAfter?.(...task);
36937
39066
  }
36938
- retryFn(gitError);
36939
- });
36940
- }, retryOpts);
36941
- };
39067
+ }
39068
+ }
39069
+ }
39070
+ exports.LRUCache = LRUCache2;
36942
39071
  });
36943
39072
 
36944
39073
  // ../../node_modules/semver/functions/inc.js
@@ -38367,7 +40496,7 @@ var require_lines_to_revs = __commonJS((exports, module) => {
38367
40496
  // ../../node_modules/@npmcli/git/lib/revs.js
38368
40497
  var require_revs = __commonJS((exports, module) => {
38369
40498
  var spawn2 = require_spawn();
38370
- var { LRUCache: LRUCache2 } = require_commonjs();
40499
+ var { LRUCache: LRUCache2 } = require_commonjs7();
38371
40500
  var linesToRevs = require_lines_to_revs();
38372
40501
  var revsCache = new LRUCache2({
38373
40502
  max: 100,
@@ -41108,7 +43237,7 @@ var require_normalize = __commonJS((exports, module) => {
41108
43237
  var _glob;
41109
43238
  function lazyLoadGlob() {
41110
43239
  if (!_glob) {
41111
- _glob = require_commonjs5().glob;
43240
+ _glob = require_commonjs6().glob;
41112
43241
  }
41113
43242
  return _glob;
41114
43243
  }
@@ -236269,13 +238398,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
236269
238398
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
236270
238399
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
236271
238400
  function timeRegexSource(args) {
236272
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
238401
+ let secondsRegexSource = `[0-5]\\d`;
236273
238402
  if (args.precision) {
236274
- regex = `${regex}\\.\\d{${args.precision}}`;
238403
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
236275
238404
  } else if (args.precision == null) {
236276
- regex = `${regex}(\\.\\d+)?`;
238405
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
236277
238406
  }
236278
- return regex;
238407
+ const secondsQuantifier = args.precision ? "+" : "?";
238408
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
236279
238409
  }
236280
238410
  function timeRegex(args) {
236281
238411
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -240887,7 +243017,7 @@ minimatch.unescape = unescape2;
240887
243017
  // ../../node_modules/glob/dist/esm/glob.js
240888
243018
  import { fileURLToPath as fileURLToPath4 } from "node:url";
240889
243019
 
240890
- // ../../node_modules/lru-cache/dist/esm/index.js
243020
+ // ../../node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js
240891
243021
  var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
240892
243022
  var warned = new Set;
240893
243023
  var PROCESS = typeof process === "object" && !!process ? process : {};
@@ -245445,7 +247575,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245445
247575
  var package_default = {
245446
247576
  name: "@settlemint/sdk-cli",
245447
247577
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245448
- version: "2.2.2",
247578
+ version: "2.2.3-main0f4b90ca",
245449
247579
  type: "module",
245450
247580
  private: false,
245451
247581
  license: "FSL-1.1-MIT",
@@ -245490,13 +247620,13 @@ var package_default = {
245490
247620
  devDependencies: {
245491
247621
  "@commander-js/extra-typings": "11.1.0",
245492
247622
  commander: "11.1.0",
245493
- "@inquirer/confirm": "5.1.9",
245494
- "@inquirer/input": "4.1.9",
245495
- "@inquirer/password": "4.0.12",
245496
- "@inquirer/select": "4.2.0",
245497
- "@settlemint/sdk-js": "2.2.2",
245498
- "@settlemint/sdk-utils": "2.2.2",
245499
- "@types/node": "22.15.3",
247623
+ "@inquirer/confirm": "5.1.10",
247624
+ "@inquirer/input": "4.1.10",
247625
+ "@inquirer/password": "4.0.13",
247626
+ "@inquirer/select": "4.2.1",
247627
+ "@settlemint/sdk-js": "2.2.3-main0f4b90ca",
247628
+ "@settlemint/sdk-utils": "2.2.3-main0f4b90ca",
247629
+ "@types/node": "22.15.17",
245500
247630
  "@types/semver": "7.7.0",
245501
247631
  "@types/which": "3.0.4",
245502
247632
  "get-tsconfig": "4.10.0",
@@ -245509,7 +247639,7 @@ var package_default = {
245509
247639
  yoctocolors: "2.1.1"
245510
247640
  },
245511
247641
  peerDependencies: {
245512
- hardhat: "2.23.0"
247642
+ hardhat: "2.24.0"
245513
247643
  },
245514
247644
  peerDependenciesMeta: {
245515
247645
  hardhat: {
@@ -246597,6 +248727,9 @@ function createPrompt(view) {
246597
248727
  cleanups.add(onExit((code, signal2) => {
246598
248728
  reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
246599
248729
  }));
248730
+ const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
248731
+ rl.on("SIGINT", sigint);
248732
+ cleanups.add(() => rl.removeListener("SIGINT", sigint));
246600
248733
  const checkCursorPos = () => screen.checkCursorPos();
246601
248734
  rl.input.on("keypress", checkCursorPos);
246602
248735
  cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
@@ -249274,7 +251407,18 @@ async function parsePackageJson(filepath, onUnknown) {
249274
251407
  return !filepath || !pathExists2(filepath, "file") ? null : await handlePackageManager(filepath, onUnknown);
249275
251408
  }
249276
251409
  async function detect(options = {}) {
249277
- const { cwd, strategies = ["lockfile", "packageManager-field", "devEngines-field"], onUnknown } = options;
251410
+ const {
251411
+ cwd,
251412
+ strategies = ["lockfile", "packageManager-field", "devEngines-field"],
251413
+ onUnknown
251414
+ } = options;
251415
+ let stopDir;
251416
+ if (typeof options.stopDir === "string") {
251417
+ const resolved = path4.resolve(options.stopDir);
251418
+ stopDir = (dir) => dir === resolved;
251419
+ } else {
251420
+ stopDir = options.stopDir;
251421
+ }
249278
251422
  for (const directory of lookup(cwd)) {
249279
251423
  for (const strategy of strategies) {
249280
251424
  switch (strategy) {
@@ -249311,6 +251455,8 @@ async function detect(options = {}) {
249311
251455
  }
249312
251456
  }
249313
251457
  }
251458
+ if (stopDir?.(directory))
251459
+ break;
249314
251460
  }
249315
251461
  return null;
249316
251462
  }
@@ -250455,6 +252601,17 @@ function missingApplication() {
250455
252601
  return cancel2("No application configured, please run `settlemint connect` to connect to your application");
250456
252602
  }
250457
252603
 
252604
+ // src/utils/instance-url-utils.ts
252605
+ function sanitizeInstanceUrl(url) {
252606
+ const instanceUrl = new URL(url);
252607
+ return instanceUrl.origin;
252608
+ }
252609
+ function sanitizeAndValidateInstanceUrl(url) {
252610
+ const sanitizedUrl = sanitizeInstanceUrl(url);
252611
+ validate2(UrlSchema2, sanitizedUrl);
252612
+ return sanitizedUrl;
252613
+ }
252614
+
250458
252615
  // src/utils/get-app-or-personal-token.ts
250459
252616
  var getApplicationOrPersonalAccessToken = async ({
250460
252617
  env: env2,
@@ -250462,7 +252619,8 @@ var getApplicationOrPersonalAccessToken = async ({
250462
252619
  prefer
250463
252620
  }) => {
250464
252621
  const applicationAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
250465
- const personalAccessToken = (await getInstanceCredentials(instance))?.personalAccessToken;
252622
+ const instanceUrl = sanitizeInstanceUrl(instance);
252623
+ const personalAccessToken = (await getInstanceCredentials(instanceUrl))?.personalAccessToken;
250466
252624
  const preferredToken = prefer === "application" ? applicationAccessToken : personalAccessToken;
250467
252625
  const fallbackToken = prefer === "application" ? personalAccessToken : applicationAccessToken;
250468
252626
  const allowFallback = prefer === "application";
@@ -252979,17 +255137,6 @@ async function theGraphPrompt({
252979
255137
  });
252980
255138
  }
252981
255139
 
252982
- // src/utils/instance-url-utils.ts
252983
- function sanitizeInstanceUrl(url) {
252984
- const instanceUrl = new URL(url);
252985
- return instanceUrl.origin;
252986
- }
252987
- function sanitizeAndValidateInstanceUrl(url) {
252988
- const sanitizedUrl = sanitizeInstanceUrl(url);
252989
- validate2(UrlSchema2, sanitizedUrl);
252990
- return sanitizedUrl;
252991
- }
252992
-
252993
255140
  // src/prompts/instance.prompt.ts
252994
255141
  async function instancePrompt(env2, accept, freeTextInput = false, isCi = is_in_ci_default) {
252995
255142
  const knownInstances = await getInstances();
@@ -253497,8 +255644,8 @@ function connectCommand() {
253497
255644
  SETTLEMINT_HASURA: hasura?.uniqueName,
253498
255645
  ...getHasuraEndpoints(hasura),
253499
255646
  SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
253500
- SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: defaultSubgraph,
253501
255647
  ...graphEndpoints,
255648
+ SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: defaultSubgraph,
253502
255649
  SETTLEMINT_PORTAL: portal?.uniqueName,
253503
255650
  ...getPortalEndpoints(portal),
253504
255651
  SETTLEMINT_HD_PRIVATE_KEY: hdPrivateKey?.uniqueName,
@@ -260299,9 +262446,6 @@ function hardhatTestCommand() {
260299
262446
  });
260300
262447
  }
260301
262448
 
260302
- // src/commands/smart-contract-set/subgraph/build.ts
260303
- import { dirname as dirname10 } from "node:path";
260304
-
260305
262449
  // src/utils/subgraph/setup.ts
260306
262450
  import { rm as rm4 } from "node:fs/promises";
260307
262451
  var import_semver = __toESM(require_semver2(), 1);
@@ -260465,15 +262609,13 @@ function subgraphBuildCommand() {
260465
262609
  });
260466
262610
  const { command, args } = await getPackageManagerExecutable();
260467
262611
  const subgraphYamlFile = await getSubgraphYamlFile();
260468
- const cwd2 = dirname10(subgraphYamlFile);
260469
- await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile], { cwd: cwd2 });
260470
- await executeCommand(command, [...args, "graph", "build", subgraphYamlFile], { cwd: cwd2 });
262612
+ await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile]);
262613
+ await executeCommand(command, [...args, "graph", "build", subgraphYamlFile]);
260471
262614
  outro("Subgraph built successfully");
260472
262615
  });
260473
262616
  }
260474
262617
 
260475
262618
  // src/commands/smart-contract-set/subgraph/codegen.ts
260476
- import { dirname as dirname11 } from "node:path";
260477
262619
  function subgraphCodegenCommand() {
260478
262620
  return new Command("codegen").description("Codegen the subgraph types").usage(createExamples([
260479
262621
  {
@@ -260488,15 +262630,12 @@ function subgraphCodegenCommand() {
260488
262630
  });
260489
262631
  const { command, args } = await getPackageManagerExecutable();
260490
262632
  const subgraphYamlFile = await getSubgraphYamlFile();
260491
- await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile], {
260492
- cwd: dirname11(subgraphYamlFile)
260493
- });
262633
+ await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile]);
260494
262634
  outro("Subgraph types generated successfully");
260495
262635
  });
260496
262636
  }
260497
262637
 
260498
262638
  // src/commands/smart-contract-set/subgraph/deploy.ts
260499
- import { dirname as dirname12 } from "node:path";
260500
262639
  function subgraphDeployCommand() {
260501
262640
  return new Command("deploy").description("Deploy the subgraph").usage(createExamples([
260502
262641
  {
@@ -260532,9 +262671,7 @@ function subgraphDeployCommand() {
260532
262671
  const subgraphYamlFile = await getSubgraphYamlFile();
260533
262672
  await updateSpecVersion(theGraphMiddleware.specVersion);
260534
262673
  const { command, args } = await getPackageManagerExecutable();
260535
- await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile], {
260536
- cwd: dirname12(subgraphYamlFile)
260537
- });
262674
+ await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile]);
260538
262675
  const generated = await isGenerated();
260539
262676
  if (generated) {
260540
262677
  const currentConfig = await getSubgraphConfig();
@@ -260598,7 +262735,7 @@ async function updateSpecVersion(specVersion) {
260598
262735
  }
260599
262736
 
260600
262737
  // src/commands/smart-contract-set/subgraph/remove.ts
260601
- import { dirname as dirname13 } from "node:path";
262738
+ import { dirname as dirname10 } from "node:path";
260602
262739
  function subgraphRemoveCommand() {
260603
262740
  return new Command("remove").description("Remove a subgraph").usage(createExamples([
260604
262741
  {
@@ -260633,7 +262770,7 @@ function subgraphRemoveCommand() {
260633
262770
  serviceNotRunningError("graph middleware", theGraphMiddleware.status);
260634
262771
  }
260635
262772
  const subgraphYamlFile = await getSubgraphYamlFile();
260636
- const cwd2 = dirname13(subgraphYamlFile);
262773
+ const cwd2 = dirname10(subgraphYamlFile);
260637
262774
  const { command, args } = await getPackageManagerExecutable();
260638
262775
  const middlewareAdminUrl = new URL(`/${encodeURIComponent(accessToken)}/admin`, theGraphMiddleware.serviceUrl).toString();
260639
262776
  await executeCommand(command, [...args, "graph", "remove", "--node", middlewareAdminUrl, graphName]);
@@ -260806,4 +262943,4 @@ async function sdkCliCommand(argv = process.argv) {
260806
262943
  // src/cli.ts
260807
262944
  sdkCliCommand();
260808
262945
 
260809
- //# debugId=C18154BFBD09A46D64756E2164756E21
262946
+ //# debugId=7DD3A870094E980F64756E2164756E21