@gvnrdao/dh-mcp 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14194,6 +14194,9 @@ var require_pkg_src = __commonJS({
14194
14194
  });
14195
14195
  var index_exports = {};
14196
14196
  __export3(index_exports, {
14197
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
14198
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
14199
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
14197
14200
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
14198
14201
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
14199
14202
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -14206,6 +14209,8 @@ var require_pkg_src = __commonJS({
14206
14209
  PerformanceTracker: () => PerformanceTracker,
14207
14210
  RetryStrategy: () => RetryStrategy,
14208
14211
  analyzeError: () => analyzeError,
14212
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
14213
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
14209
14214
  calculateDelay: () => calculateDelay,
14210
14215
  cidToHex: () => cidToHex,
14211
14216
  classifyError: () => classifyError,
@@ -14452,30 +14457,30 @@ var require_pkg_src = __commonJS({
14452
14457
  }
14453
14458
  },
14454
14459
  btcTransactionSigner: {
14455
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
14460
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
14456
14461
  authorizedCidHex: cidToHex(
14457
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
14462
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
14458
14463
  ),
14459
14464
  name: "Btc Transaction Signer",
14460
14465
  description: "Production Btc Transaction Signer",
14461
14466
  version: "1.1.1",
14462
14467
  deployed: true,
14463
- deployedAt: 1786465606156,
14464
- size: 67999,
14465
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
14468
+ deployedAt: 1787923905597,
14469
+ size: 70646,
14470
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
14466
14471
  },
14467
14472
  ucdMintValidator: {
14468
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
14473
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
14469
14474
  authorizedCidHex: cidToHex(
14470
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
14475
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
14471
14476
  ),
14472
14477
  name: "Ucd Mint Validator",
14473
14478
  description: "Production Ucd Mint Validator",
14474
14479
  version: "1.2.1",
14475
14480
  deployed: true,
14476
- deployedAt: 1786465627201,
14477
- size: 82739,
14478
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
14481
+ deployedAt: 1787923919527,
14482
+ size: 86197,
14483
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
14479
14484
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14480
14485
  pkp: {
14481
14486
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -14483,17 +14488,17 @@ var require_pkg_src = __commonJS({
14483
14488
  }
14484
14489
  },
14485
14490
  processPaymentValidator: {
14486
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
14491
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
14487
14492
  authorizedCidHex: cidToHex(
14488
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
14493
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
14489
14494
  ),
14490
14495
  name: "Process Payment Validator",
14491
14496
  description: "Production Process Payment Validator",
14492
14497
  version: "1.2.1",
14493
14498
  deployed: true,
14494
- deployedAt: 1786465654796,
14495
- size: 78736,
14496
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
14499
+ deployedAt: 1787923987153,
14500
+ size: 82217,
14501
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
14497
14502
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14498
14503
  pkp: {
14499
14504
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -14501,17 +14506,17 @@ var require_pkg_src = __commonJS({
14501
14506
  }
14502
14507
  },
14503
14508
  extendPositionValidator: {
14504
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
14509
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
14505
14510
  authorizedCidHex: cidToHex(
14506
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
14511
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
14507
14512
  ),
14508
14513
  name: "Extend Position Validator",
14509
14514
  description: "Production Extend Position Validator",
14510
14515
  version: "1.2.1",
14511
14516
  deployed: true,
14512
- deployedAt: 1786465681874,
14513
- size: 76515,
14514
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
14517
+ deployedAt: 1787923999294,
14518
+ size: 79975,
14519
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
14515
14520
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14516
14521
  pkp: {
14517
14522
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -14519,17 +14524,17 @@ var require_pkg_src = __commonJS({
14519
14524
  }
14520
14525
  },
14521
14526
  btcWithdrawal: {
14522
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
14527
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
14523
14528
  authorizedCidHex: cidToHex(
14524
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
14529
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
14525
14530
  ),
14526
14531
  name: "Btc Withdrawal",
14527
14532
  description: "Production Btc Withdrawal",
14528
14533
  version: "1.2.7",
14529
14534
  deployed: true,
14530
- deployedAt: 1786446046614,
14531
- size: 97456,
14532
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
14535
+ deployedAt: 1787924017769,
14536
+ size: 100069,
14537
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
14533
14538
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14534
14539
  pkp: {
14535
14540
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -14641,30 +14646,30 @@ var require_pkg_src = __commonJS({
14641
14646
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
14642
14647
  },
14643
14648
  agentModuleExecutor: {
14644
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
14649
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
14645
14650
  authorizedCidHex: cidToHex(
14646
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
14651
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
14647
14652
  ),
14648
14653
  name: "Agent Module Executor",
14649
14654
  description: "Production Agent Module Executor",
14650
14655
  version: "1.1.1",
14651
14656
  deployed: true,
14652
- deployedAt: 1786446108348,
14653
- size: 11655,
14654
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
14657
+ deployedAt: 1787924032013,
14658
+ size: 13878,
14659
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
14655
14660
  },
14656
14661
  staleSpendRecoveryValidator: {
14657
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
14662
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
14658
14663
  authorizedCidHex: cidToHex(
14659
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
14664
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
14660
14665
  ),
14661
14666
  name: "Stale Spend Recovery Validator",
14662
14667
  description: "Production Stale Spend Recovery Validator",
14663
14668
  version: "1.1.2",
14664
14669
  deployed: true,
14665
- deployedAt: 1785173285829,
14666
- size: 37108,
14667
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
14670
+ deployedAt: 1787924048772,
14671
+ size: 41424,
14672
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
14668
14673
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
14669
14674
  pkp: {
14670
14675
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -14672,17 +14677,17 @@ var require_pkg_src = __commonJS({
14672
14677
  }
14673
14678
  },
14674
14679
  btcUtxoInvalidator: {
14675
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
14680
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
14676
14681
  authorizedCidHex: cidToHex(
14677
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
14682
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
14678
14683
  ),
14679
14684
  name: "Btc Utxo Invalidator",
14680
14685
  description: "Production Btc Utxo Invalidator",
14681
14686
  version: "1.0.0",
14682
14687
  deployed: true,
14683
- deployedAt: 1786465704240,
14684
- size: 62553,
14685
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
14688
+ deployedAt: 1787924133241,
14689
+ size: 66026,
14690
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
14686
14691
  }
14687
14692
  };
14688
14693
  function getDeploymentsForNetwork(network) {
@@ -15441,6 +15446,101 @@ ${errorReport}`);
15441
15446
  var SECONDS_PER_DAY = 86400;
15442
15447
  var DAYS_PER_MONTH = 30;
15443
15448
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
15449
+ var PINNED_CONTRACT_ADDRESSES = {
15450
+ 1: {
15451
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
15452
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
15453
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
15454
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
15455
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
15456
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
15457
+ },
15458
+ 11155111: {
15459
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
15460
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
15461
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
15462
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
15463
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
15464
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
15465
+ }
15466
+ };
15467
+ function getPinnedContractAddresses(chainId) {
15468
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
15469
+ }
15470
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
15471
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
15472
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
15473
+ MINT: "MintRequest",
15474
+ REPAY: "RepayRequest",
15475
+ RENEW: "RenewRequest",
15476
+ WITHDRAW: "WithdrawRequest"
15477
+ };
15478
+ var BORROWER_AUTHORIZATION_FIELDS = {
15479
+ MintRequest: [
15480
+ { name: "positionId", type: "bytes32" },
15481
+ { name: "mintAmount", type: "uint256" },
15482
+ { name: "quantumTimestamp", type: "uint256" }
15483
+ ],
15484
+ RepayRequest: [
15485
+ { name: "positionId", type: "bytes32" },
15486
+ { name: "paymentAmount", type: "uint256" },
15487
+ { name: "quantumTimestamp", type: "uint256" }
15488
+ ],
15489
+ RenewRequest: [
15490
+ { name: "positionId", type: "bytes32" },
15491
+ { name: "selectedTerm", type: "uint256" },
15492
+ { name: "quantumTimestamp", type: "uint256" }
15493
+ ],
15494
+ WithdrawRequest: [
15495
+ { name: "positionId", type: "bytes32" },
15496
+ { name: "totalDeduction", type: "uint256" },
15497
+ { name: "withdrawalAddress", type: "string" },
15498
+ { name: "quantumTimestamp", type: "uint256" }
15499
+ ]
15500
+ };
15501
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
15502
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
15503
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
15504
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
15505
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
15506
+ };
15507
+ function borrowerAuthorizationTypes(primaryType) {
15508
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
15509
+ if (!fields) {
15510
+ throw new Error(
15511
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
15512
+ );
15513
+ }
15514
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
15515
+ }
15516
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
15517
+ if (!Number.isInteger(chainId) || chainId <= 0) {
15518
+ throw new Error(
15519
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
15520
+ );
15521
+ }
15522
+ const pinned = getPinnedContractAddresses(chainId);
15523
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
15524
+ if (pinnedLom && verifyingContractOverride) {
15525
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
15526
+ throw new Error(
15527
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
15528
+ );
15529
+ }
15530
+ }
15531
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
15532
+ if (!verifyingContract) {
15533
+ throw new Error(
15534
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
15535
+ );
15536
+ }
15537
+ return {
15538
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
15539
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
15540
+ chainId,
15541
+ verifyingContract
15542
+ };
15543
+ }
15444
15544
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
15445
15545
  EVMChain3["SEPOLIA"] = "sepolia";
15446
15546
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -18687,22 +18787,82 @@ var require_axios = __commonJS({
18687
18787
  var hasOwnProperty2 = (({
18688
18788
  hasOwnProperty: hasOwnProperty3
18689
18789
  }) => (obj, prop) => hasOwnProperty3.call(obj, prop))(Object.prototype);
18790
+ var isUnsafeObjectKey2 = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
18791
+ var isPrototypeBoundary2 = (obj, prototype3, source) => obj === Object.prototype || !source && prototype3 === null;
18792
+ var isSafeAndFullyMutable2 = (obj) => {
18793
+ if (!Object.isExtensible(obj)) {
18794
+ return false;
18795
+ }
18796
+ const props = Object.getOwnPropertyNames(obj);
18797
+ if (Object.getOwnPropertySymbols) {
18798
+ props.push(...Object.getOwnPropertySymbols(obj));
18799
+ }
18800
+ return props.every((prop) => {
18801
+ if (isUnsafeObjectKey2(prop)) {
18802
+ return false;
18803
+ }
18804
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
18805
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
18806
+ });
18807
+ };
18690
18808
  var hasOwnInPrototypeChain2 = (thing, prop) => {
18691
18809
  let obj = thing;
18692
18810
  const seen = [];
18693
- while (obj != null && obj !== Object.prototype) {
18811
+ while (obj != null) {
18694
18812
  if (seen.indexOf(obj) !== -1) {
18695
18813
  return false;
18696
18814
  }
18697
18815
  seen.push(obj);
18816
+ const prototype3 = getPrototypeOf2(obj);
18817
+ if (isPrototypeBoundary2(obj, prototype3, obj === thing)) {
18818
+ return false;
18819
+ }
18698
18820
  if (hasOwnProperty2(obj, prop)) {
18699
18821
  return true;
18700
18822
  }
18701
- obj = getPrototypeOf2(obj);
18823
+ obj = prototype3;
18702
18824
  }
18703
18825
  return false;
18704
18826
  };
18705
18827
  var getSafeProp2 = (obj, prop) => obj != null && hasOwnInPrototypeChain2(obj, prop) ? obj[prop] : void 0;
18828
+ var toSafeFlatObject2 = (thing) => {
18829
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
18830
+ return thing;
18831
+ }
18832
+ const sourcePrototype = getPrototypeOf2(thing);
18833
+ if (sourcePrototype === null && isSafeAndFullyMutable2(thing)) {
18834
+ return thing;
18835
+ }
18836
+ const result = /* @__PURE__ */ Object.create(null);
18837
+ const merged = /* @__PURE__ */ Object.create(null);
18838
+ const seen = [];
18839
+ let current = thing;
18840
+ while (current != null) {
18841
+ if (seen.indexOf(current) !== -1) {
18842
+ break;
18843
+ }
18844
+ seen.push(current);
18845
+ const prototype3 = current === thing ? sourcePrototype : getPrototypeOf2(current);
18846
+ if (isPrototypeBoundary2(current, prototype3, current === thing)) {
18847
+ break;
18848
+ }
18849
+ const props = Object.getOwnPropertyNames(current);
18850
+ if (Object.getOwnPropertySymbols) {
18851
+ props.push(...Object.getOwnPropertySymbols(current));
18852
+ }
18853
+ for (const prop of props) {
18854
+ if (isUnsafeObjectKey2(prop)) {
18855
+ continue;
18856
+ }
18857
+ if (!hasOwnProperty2(merged, prop)) {
18858
+ result[prop] = thing[prop];
18859
+ merged[prop] = true;
18860
+ }
18861
+ }
18862
+ current = prototype3;
18863
+ }
18864
+ return result;
18865
+ };
18706
18866
  var kindOf2 = /* @__PURE__ */ ((cache) => (thing) => {
18707
18867
  const str = toString3.call(thing);
18708
18868
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -18739,9 +18899,9 @@ var require_axios = __commonJS({
18739
18899
  return false;
18740
18900
  }
18741
18901
  const prototype3 = getPrototypeOf2(val);
18742
- return (prototype3 === null || prototype3 === Object.prototype || getPrototypeOf2(prototype3) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
18743
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
18744
- // than a plain object, while ignoring keys injected onto Object.prototype.
18902
+ return (prototype3 === null || prototype3 === Object.prototype || getPrototypeOf2(prototype3) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
18903
+ // evidence the value is tagged/iterable, while ignoring members reachable
18904
+ // only through shared or terminal prototype boundaries.
18745
18905
  !hasOwnInPrototypeChain2(val, toStringTag2) && !hasOwnInPrototypeChain2(val, iterator2);
18746
18906
  };
18747
18907
  var isEmptyObject2 = (val) => {
@@ -19153,6 +19313,7 @@ var require_axios = __commonJS({
19153
19313
  // an alias to avoid ESLint no-prototype-builtins detection
19154
19314
  hasOwnInPrototypeChain: hasOwnInPrototypeChain2,
19155
19315
  getSafeProp: getSafeProp2,
19316
+ toSafeFlatObject: toSafeFlatObject2,
19156
19317
  reduceDescriptors: reduceDescriptors2,
19157
19318
  freezeMethods: freezeMethods2,
19158
19319
  toObjectSet: toObjectSet2,
@@ -19233,7 +19394,7 @@ var require_axios = __commonJS({
19233
19394
  });
19234
19395
  return byteStringHeaders;
19235
19396
  }
19236
- var $internals2 = Symbol("internals");
19397
+ var $internals$1 = Symbol("internals");
19237
19398
  function normalizeHeader2(header) {
19238
19399
  return header && String(header).trim().toLowerCase();
19239
19400
  }
@@ -19529,7 +19690,7 @@ var require_axios = __commonJS({
19529
19690
  return computed;
19530
19691
  }
19531
19692
  static accessor(header) {
19532
- const internals = this[$internals2] = this[$internals2] = {
19693
+ const internals = this[$internals$1] = this[$internals$1] = {
19533
19694
  accessors: {}
19534
19695
  };
19535
19696
  const accessors = internals.accessors;
@@ -19750,19 +19911,16 @@ var require_axios = __commonJS({
19750
19911
  throw new TypeError("target must be an object");
19751
19912
  }
19752
19913
  formData = formData || new (FormData$1 || FormData)();
19753
- options = utils$1.toFlatObject(options, {
19754
- metaTokens: true,
19755
- dots: false,
19756
- indexes: false
19757
- }, false, function defined(option, source) {
19758
- return !utils$1.isUndefined(source[option]);
19759
- });
19760
- const metaTokens = options.metaTokens;
19761
- const visitor = options.visitor || defaultVisitor;
19762
- const dots = options.dots;
19763
- const indexes = options.indexes;
19764
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
19765
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH2 : options.maxDepth;
19914
+ const option = (name, fallback) => {
19915
+ const value = utils$1.getSafeProp(options, name);
19916
+ return utils$1.isUndefined(value) ? fallback : value;
19917
+ };
19918
+ const metaTokens = option("metaTokens", true);
19919
+ const visitor = option("visitor") || defaultVisitor;
19920
+ const dots = option("dots", false);
19921
+ const indexes = option("indexes", false);
19922
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
19923
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH2);
19766
19924
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
19767
19925
  const stack = [];
19768
19926
  if (!utils$1.isFunction(visitor)) {
@@ -19921,9 +20079,47 @@ var require_axios = __commonJS({
19921
20079
  }
19922
20080
  return url3;
19923
20081
  }
20082
+ var $internals3 = Symbol("internals");
20083
+ function countHandlers2(handlers) {
20084
+ return handlers ? handlers.length : 0;
20085
+ }
20086
+ function trimHandlers2(handlers) {
20087
+ if (!handlers) {
20088
+ return;
20089
+ }
20090
+ while (handlers.length && handlers[handlers.length - 1] === null) {
20091
+ handlers.pop();
20092
+ }
20093
+ }
20094
+ function syncHandlerEntries2(manager, internals) {
20095
+ const handlers = manager.handlers;
20096
+ const length = countHandlers2(handlers);
20097
+ if (handlers !== internals.handlersRef) {
20098
+ internals.handlersRef = handlers;
20099
+ internals.handlerEntries.clear();
20100
+ } else if (length !== internals.handlersLength) {
20101
+ if (!length) {
20102
+ internals.handlerEntries.clear();
20103
+ } else {
20104
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
20105
+ if (handlers[entry.index] !== entry.handler) {
20106
+ internals.handlerEntries.delete(id);
20107
+ }
20108
+ });
20109
+ }
20110
+ }
20111
+ internals.handlersLength = length;
20112
+ }
19924
20113
  var InterceptorManager2 = class {
19925
20114
  constructor() {
19926
20115
  this.handlers = [];
20116
+ this[$internals3] = {
20117
+ handlersRef: this.handlers,
20118
+ handlersLength: this.handlers.length,
20119
+ handlerEntries: /* @__PURE__ */ new Map(),
20120
+ iterationDepth: 0,
20121
+ nextId: 0
20122
+ };
19927
20123
  }
19928
20124
  /**
19929
20125
  * Add a new interceptor to the stack
@@ -19935,13 +20131,25 @@ var require_axios = __commonJS({
19935
20131
  * @return {Number} An ID used to remove interceptor later
19936
20132
  */
19937
20133
  use(fulfilled, rejected, options) {
19938
- this.handlers.push({
20134
+ const handler = {
19939
20135
  fulfilled,
19940
20136
  rejected,
19941
20137
  synchronous: options ? options.synchronous : false,
19942
20138
  runWhen: options ? options.runWhen : null
20139
+ };
20140
+ const internals = this[$internals3];
20141
+ if (this.handlers == null) {
20142
+ this.handlers = [];
20143
+ }
20144
+ syncHandlerEntries2(this, internals);
20145
+ const id = internals.nextId++;
20146
+ this.handlers.push(handler);
20147
+ internals.handlerEntries.set(id, {
20148
+ handler,
20149
+ index: this.handlers.length - 1
19943
20150
  });
19944
- return this.handlers.length - 1;
20151
+ internals.handlersLength = this.handlers.length;
20152
+ return id;
19945
20153
  }
19946
20154
  /**
19947
20155
  * Remove an interceptor from the stack
@@ -19951,8 +20159,19 @@ var require_axios = __commonJS({
19951
20159
  * @returns {void}
19952
20160
  */
19953
20161
  eject(id) {
19954
- if (this.handlers[id]) {
19955
- this.handlers[id] = null;
20162
+ const internals = this[$internals3];
20163
+ syncHandlerEntries2(this, internals);
20164
+ const entry = internals.handlerEntries.get(id);
20165
+ if (entry) {
20166
+ internals.handlerEntries.delete(id);
20167
+ if (this.handlers[entry.index] !== entry.handler) {
20168
+ return;
20169
+ }
20170
+ this.handlers[entry.index] = null;
20171
+ if (!internals.iterationDepth) {
20172
+ trimHandlers2(this.handlers);
20173
+ internals.handlersLength = this.handlers.length;
20174
+ }
19956
20175
  }
19957
20176
  }
19958
20177
  /**
@@ -19963,6 +20182,7 @@ var require_axios = __commonJS({
19963
20182
  clear() {
19964
20183
  if (this.handlers) {
19965
20184
  this.handlers = [];
20185
+ syncHandlerEntries2(this, this[$internals3]);
19966
20186
  }
19967
20187
  }
19968
20188
  /**
@@ -19976,11 +20196,22 @@ var require_axios = __commonJS({
19976
20196
  * @returns {void}
19977
20197
  */
19978
20198
  forEach(fn) {
19979
- utils$1.forEach(this.handlers, function forEachHandler(h) {
19980
- if (h !== null) {
19981
- fn(h);
20199
+ const internals = this[$internals3];
20200
+ syncHandlerEntries2(this, internals);
20201
+ internals.iterationDepth++;
20202
+ try {
20203
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
20204
+ if (h !== null) {
20205
+ fn(h);
20206
+ }
20207
+ });
20208
+ } finally {
20209
+ if (!--internals.iterationDepth) {
20210
+ syncHandlerEntries2(this, internals);
20211
+ trimHandlers2(this.handlers);
20212
+ internals.handlersLength = countHandlers2(this.handlers);
19982
20213
  }
19983
- });
20214
+ }
19984
20215
  }
19985
20216
  };
19986
20217
  var transitionalDefaults = {
@@ -20116,6 +20347,7 @@ var require_axios = __commonJS({
20116
20347
  }
20117
20348
  return null;
20118
20349
  }
20350
+ var methodList2 = Object.freeze(["get", "delete", "head", "options", "post", "put", "patch", "purge", "link", "unlink", "query"]);
20119
20351
  var own2 = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
20120
20352
  function stringifySafely3(rawValue, parser, encoder) {
20121
20353
  if (utils$1.isString(rawValue)) {
@@ -20221,7 +20453,7 @@ var require_axios = __commonJS({
20221
20453
  }
20222
20454
  }
20223
20455
  };
20224
- utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
20456
+ utils$1.forEach(methodList2, (method) => {
20225
20457
  defaults2.headers[method] = {};
20226
20458
  });
20227
20459
  function transformData2(fns, response) {
@@ -20278,18 +20510,18 @@ var require_axios = __commonJS({
20278
20510
  }
20279
20511
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
20280
20512
  }
20281
- var malformedHttpProtocol2 = /^https?:(?!\/\/)/i;
20282
- var httpProtocolControlCharacters2 = /[\t\n\r]/g;
20283
- function stripLeadingC0ControlOrSpace2(url3) {
20284
- let i = 0;
20285
- while (i < url3.length && url3.charCodeAt(i) <= 32) {
20286
- i++;
20287
- }
20288
- return url3.slice(i);
20289
- }
20513
+ var urlParserControlCharacters2 = /[\t\n\r]/g;
20290
20514
  function normalizeURLForProtocolCheck2(url3) {
20291
- return stripLeadingC0ControlOrSpace2(url3).replace(httpProtocolControlCharacters2, "");
20515
+ if (typeof url3 !== "string") {
20516
+ return url3;
20517
+ }
20518
+ let start = 0;
20519
+ while (start < url3.length && url3.charCodeAt(start) <= 32) {
20520
+ start++;
20521
+ }
20522
+ return url3.slice(start).replace(urlParserControlCharacters2, "");
20292
20523
  }
20524
+ var malformedHttpProtocol2 = /^https?:(?!\/\/)/i;
20293
20525
  function redactFragment2(fragment) {
20294
20526
  if (!fragment) {
20295
20527
  return fragment;
@@ -20390,12 +20622,12 @@ var require_axios = __commonJS({
20390
20622
  function getEnv2(key) {
20391
20623
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
20392
20624
  }
20393
- var VERSION3 = "1.19.0";
20625
+ var VERSION3 = "1.20.0";
20394
20626
  function parseProtocol2(url3) {
20395
20627
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url3);
20396
20628
  return match && match[1] || "";
20397
20629
  }
20398
- var DATA_URL_PATTERN2 = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
20630
+ var DATA_URL_PATTERN2 = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
20399
20631
  function fromDataURI2(uri, asBlob, options) {
20400
20632
  const _Blob = options && options.Blob || platform.classes.Blob;
20401
20633
  const protocol = parseProtocol2(uri);
@@ -20672,7 +20904,7 @@ var require_axios = __commonJS({
20672
20904
  this.sessions = /* @__PURE__ */ Object.create(null);
20673
20905
  }
20674
20906
  getSession(authority, options) {
20675
- options = Object.assign({
20907
+ options = Object.assign(/* @__PURE__ */ Object.create(null), {
20676
20908
  sessionTimeout: 1e3
20677
20909
  }, options);
20678
20910
  let authoritySessions = this.sessions[authority];
@@ -20737,6 +20969,7 @@ var require_axios = __commonJS({
20737
20969
  };
20738
20970
  }
20739
20971
  session.once("close", removeSession);
20972
+ session.once("error", removeSession);
20740
20973
  let entry = [session, options];
20741
20974
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
20742
20975
  return session;
@@ -20755,6 +20988,13 @@ var require_axios = __commonJS({
20755
20988
  } : fn;
20756
20989
  };
20757
20990
  var LOOPBACK_HOSTNAMES2 = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
20991
+ var trimTrailingDots2 = (value) => {
20992
+ let end = value.length;
20993
+ while (end && value.charCodeAt(end - 1) === 46) {
20994
+ end--;
20995
+ }
20996
+ return end === value.length ? value : value.slice(0, end);
20997
+ };
20758
20998
  var isIPv4Loopback2 = (host) => {
20759
20999
  const parts = host.split(".");
20760
21000
  if (parts.length !== 4) return false;
@@ -20787,7 +21027,7 @@ var require_axios = __commonJS({
20787
21027
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
20788
21028
  h = h.slice(1, -1);
20789
21029
  }
20790
- h = h.replace(/\.+$/, "");
21030
+ h = trimTrailingDots2(h);
20791
21031
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
20792
21032
  const parts = h.split(".");
20793
21033
  if (parts.some((p) => p === "")) return host;
@@ -20899,6 +21139,40 @@ var require_axios = __commonJS({
20899
21139
  }
20900
21140
  return host;
20901
21141
  };
21142
+ var IPV4_OCTET_RE2 = /^(?:0|[1-9]\d{0,2})$/;
21143
+ var ipv4ToBytes2 = (host) => {
21144
+ const parts = host.split(".");
21145
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE2.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
21146
+ };
21147
+ var IPV6_GROUP_RE2 = /^[0-9a-f]{1,4}$/i;
21148
+ var ipv6ToBytes2 = (host) => {
21149
+ const halves = host.split("::");
21150
+ if (halves.length > 2) {
21151
+ return null;
21152
+ }
21153
+ const groups = halves[0] ? halves[0].split(":") : [];
21154
+ if (halves.length === 2) {
21155
+ const rear = halves[1] ? halves[1].split(":") : [];
21156
+ const missing = 8 - groups.length - rear.length;
21157
+ if (missing < 1) {
21158
+ return null;
21159
+ }
21160
+ groups.push(...new Array(missing).fill("0"), ...rear);
21161
+ }
21162
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE2.test(group))) {
21163
+ return null;
21164
+ }
21165
+ return groups.flatMap((group) => {
21166
+ const value = Number.parseInt(group, 16);
21167
+ return [value >> 8 & 255, value & 255];
21168
+ });
21169
+ };
21170
+ var ipToBytes2 = (host) => {
21171
+ if (typeof host !== "string" || !host) {
21172
+ return null;
21173
+ }
21174
+ return host.indexOf(":") !== -1 ? ipv6ToBytes2(host) : ipv4ToBytes2(host);
21175
+ };
20902
21176
  var normalizeNoProxyHost2 = (hostname) => {
20903
21177
  if (!hostname) {
20904
21178
  return hostname;
@@ -20906,13 +21180,99 @@ var require_axios = __commonJS({
20906
21180
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
20907
21181
  hostname = hostname.slice(1, -1);
20908
21182
  }
20909
- const trimmed = hostname.replace(/\.+$/, "");
21183
+ const trimmed = trimTrailingDots2(hostname);
20910
21184
  const ipv4 = normalizeIPAddress2(trimmed);
20911
21185
  if (ipv4 !== trimmed) {
20912
21186
  return ipv4;
20913
21187
  }
20914
21188
  return unmapIPv4MappedIPv62(trimmed);
20915
21189
  };
21190
+ var normalizeCidrBase2 = (input) => {
21191
+ let base = input;
21192
+ const startsBracket = base.charAt(0) === "[";
21193
+ const endsBracket = base.charAt(base.length - 1) === "]";
21194
+ const hasBracket = base.includes("[") || base.includes("]");
21195
+ if (startsBracket || endsBracket) {
21196
+ if (!startsBracket || !endsBracket) {
21197
+ return null;
21198
+ }
21199
+ base = base.slice(1, -1);
21200
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
21201
+ return null;
21202
+ }
21203
+ } else if (hasBracket) {
21204
+ return null;
21205
+ }
21206
+ if (!base || base.charAt(base.length - 1) === ".") {
21207
+ return null;
21208
+ }
21209
+ const wasIPv6 = base.indexOf(":") !== -1;
21210
+ if (wasIPv6) {
21211
+ try {
21212
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
21213
+ } catch (_err) {
21214
+ return null;
21215
+ }
21216
+ } else {
21217
+ base = normalizeIPAddress2(base);
21218
+ if (!ipv4ToBytes2(base)) {
21219
+ return null;
21220
+ }
21221
+ }
21222
+ return {
21223
+ normalized: unmapIPv4MappedIPv62(base),
21224
+ wasIPv6
21225
+ };
21226
+ };
21227
+ var CIDR_ENTRY_RE2 = /^(.+)\/(0|[1-9]\d{0,2})$/;
21228
+ var parseCidrEntry2 = (entry) => {
21229
+ if (entry.indexOf("/") === -1) {
21230
+ return void 0;
21231
+ }
21232
+ const match = CIDR_ENTRY_RE2.exec(entry);
21233
+ if (!match) {
21234
+ return null;
21235
+ }
21236
+ let prefix = Number(match[2]);
21237
+ const parsedBase = normalizeCidrBase2(match[1]);
21238
+ if (!parsedBase) {
21239
+ return null;
21240
+ }
21241
+ const {
21242
+ normalized,
21243
+ wasIPv6
21244
+ } = parsedBase;
21245
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
21246
+ if (prefix < 96) {
21247
+ return null;
21248
+ }
21249
+ prefix -= 96;
21250
+ }
21251
+ const bytes = ipToBytes2(normalized);
21252
+ if (!bytes || prefix > bytes.length * 8) {
21253
+ return null;
21254
+ }
21255
+ return {
21256
+ bytes,
21257
+ prefix
21258
+ };
21259
+ };
21260
+ var isInSubnet2 = (addressBytes, networkBytes, prefix) => {
21261
+ const fullBytes = prefix >> 3;
21262
+ for (let i = 0; i < fullBytes; i++) {
21263
+ if (addressBytes[i] !== networkBytes[i]) {
21264
+ return false;
21265
+ }
21266
+ }
21267
+ const remainingBits = prefix & 7;
21268
+ if (remainingBits) {
21269
+ const mask = 255 << 8 - remainingBits & 255;
21270
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
21271
+ return false;
21272
+ }
21273
+ }
21274
+ return true;
21275
+ };
20916
21276
  function shouldBypassProxy2(location) {
20917
21277
  let parsed;
20918
21278
  try {
@@ -20929,6 +21289,7 @@ var require_axios = __commonJS({
20929
21289
  }
20930
21290
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS3[parsed.protocol.split(":", 1)[0]] || 0;
20931
21291
  const hostname = normalizeNoProxyHost2(parsed.hostname.toLowerCase());
21292
+ const hostnameBytes = ipToBytes2(hostname);
20932
21293
  return noProxy.split(/[\s,]+/).some((entry) => {
20933
21294
  if (!entry) {
20934
21295
  return false;
@@ -20936,6 +21297,10 @@ var require_axios = __commonJS({
20936
21297
  if (entry === "*") {
20937
21298
  return true;
20938
21299
  }
21300
+ const cidr = parseCidrEntry2(entry);
21301
+ if (cidr !== void 0) {
21302
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet2(hostnameBytes, cidr.bytes, cidr.prefix);
21303
+ }
20939
21304
  let [entryHost, entryPort] = parseNoProxyEntry2(entry);
20940
21305
  entryHost = normalizeNoProxyHost2(entryHost);
20941
21306
  if (!entryHost) {
@@ -21016,13 +21381,14 @@ var require_axios = __commonJS({
21016
21381
  }
21017
21382
  };
21018
21383
  const flush = () => lastArgs && invoke(lastArgs);
21019
- return [throttled, flush];
21384
+ const flushWith = (...args) => invoke(args);
21385
+ return [throttled, flush, flushWith];
21020
21386
  }
21021
21387
  var progressEventReducer2 = (listener, isDownloadStream, freq = 3) => {
21022
21388
  let bytesNotified = 0;
21023
21389
  const _speedometer = speedometer2(50, 250);
21024
21390
  return throttle2((e) => {
21025
- if (!e || typeof e.loaded !== "number") {
21391
+ if (!e || !utils$1.isNumber(e.loaded)) {
21026
21392
  return;
21027
21393
  }
21028
21394
  const rawLoaded = e.loaded;
@@ -21176,6 +21542,12 @@ var require_axios = __commonJS({
21176
21542
  var isHttps2 = /https:?/;
21177
21543
  var kAxiosSocketListener2 = Symbol("axios.http.socketListener");
21178
21544
  var kAxiosCurrentReq2 = Symbol("axios.http.currentReq");
21545
+ function handleSocketError2(err) {
21546
+ const current = this[kAxiosCurrentReq2];
21547
+ if (current && !current.destroyed) {
21548
+ current.destroy(err);
21549
+ }
21550
+ }
21179
21551
  var kAxiosInstalledTunnel2 = Symbol("axios.http.installedTunnel");
21180
21552
  var tunnelingAgentCache2 = /* @__PURE__ */ new Map();
21181
21553
  var tunnelingAgentCacheUser2 = /* @__PURE__ */ new WeakMap();
@@ -21284,10 +21656,10 @@ var require_axios = __commonJS({
21284
21656
  return false;
21285
21657
  }
21286
21658
  }
21287
- function setProxy2(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
21659
+ function setProxy2(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
21288
21660
  let proxy = configProxy;
21289
21661
  const proxyEnvAgent = getProxyEnvAgent2(options, configHttpAgent, configHttpsAgent);
21290
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled2(proxyEnvAgent)) {
21662
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled2(proxyEnvAgent)) {
21291
21663
  const proxyUrl = getProxyForUrl2(location);
21292
21664
  if (proxyUrl) {
21293
21665
  if (!shouldBypassProxy2(location)) {
@@ -21378,8 +21750,9 @@ var require_axios = __commonJS({
21378
21750
  }
21379
21751
  }
21380
21752
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
21381
- setProxy2(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent);
21753
+ setProxy2(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent, allowEnvProxy);
21382
21754
  };
21755
+ return Boolean(proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled2(proxyEnvAgent));
21383
21756
  }
21384
21757
  var isHttpAdapterSupported2 = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
21385
21758
  var wrapAsync2 = (asyncExecutor) => {
@@ -21407,7 +21780,7 @@ var require_axios = __commonJS({
21407
21780
  family
21408
21781
  }) => {
21409
21782
  if (!utils$1.isString(address)) {
21410
- throw TypeError("address must be a string");
21783
+ throw new AxiosError3("address must be a string", AxiosError3.ERR_BAD_OPTION_VALUE);
21411
21784
  }
21412
21785
  return {
21413
21786
  address,
@@ -21418,6 +21791,30 @@ var require_axios = __commonJS({
21418
21791
  address,
21419
21792
  family
21420
21793
  });
21794
+ var normalizedLookupCache2 = /* @__PURE__ */ new WeakMap();
21795
+ var normalizeLookup2 = (lookup) => {
21796
+ let normalized = normalizedLookupCache2.get(lookup);
21797
+ if (normalized) {
21798
+ return normalized;
21799
+ }
21800
+ const callbackLookup = callbackify2(lookup, (value) => utils$1.isArray(value) ? value : [value]);
21801
+ normalized = (hostname, opt, cb) => {
21802
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
21803
+ if (err) {
21804
+ return cb(err);
21805
+ }
21806
+ let addresses;
21807
+ try {
21808
+ addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry2(addr)) : [buildAddressEntry2(arg0, arg1)];
21809
+ } catch (error) {
21810
+ return cb(error);
21811
+ }
21812
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
21813
+ });
21814
+ };
21815
+ normalizedLookupCache2.set(lookup, normalized);
21816
+ return normalized;
21817
+ };
21421
21818
  var http2Transport2 = {
21422
21819
  request(options, cb) {
21423
21820
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -21462,6 +21859,7 @@ var require_axios = __commonJS({
21462
21859
  let family = own3("family");
21463
21860
  let httpVersion = own3("httpVersion");
21464
21861
  if (httpVersion === void 0) httpVersion = 1;
21862
+ const rawHttpVersion = httpVersion;
21465
21863
  let http2Options = own3("http2Options");
21466
21864
  const httpAgent = own3("httpAgent");
21467
21865
  const httpsAgent = own3("httpsAgent");
@@ -21478,25 +21876,20 @@ var require_axios = __commonJS({
21478
21876
  let rejected = false;
21479
21877
  let req;
21480
21878
  let connectPhaseTimer;
21481
- httpVersion = +httpVersion;
21879
+ try {
21880
+ httpVersion = +httpVersion;
21881
+ } catch (err) {
21882
+ throw new AxiosError3("Invalid protocol version: value is not a number", AxiosError3.ERR_BAD_OPTION_VALUE, config);
21883
+ }
21482
21884
  if (Number.isNaN(httpVersion)) {
21483
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
21885
+ throw new AxiosError3(`Invalid protocol version: '${rawHttpVersion}' is not a number`, AxiosError3.ERR_BAD_OPTION_VALUE, config);
21484
21886
  }
21485
21887
  if (httpVersion !== 1 && httpVersion !== 2) {
21486
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
21888
+ throw new AxiosError3(`Unsupported protocol version '${httpVersion}'`, AxiosError3.ERR_BAD_OPTION_VALUE, config);
21487
21889
  }
21488
21890
  const isHttp2 = httpVersion === 2;
21489
21891
  if (lookup) {
21490
- const _lookup = callbackify2(lookup, (value) => utils$1.isArray(value) ? value : [value]);
21491
- lookup = (hostname, opt, cb) => {
21492
- _lookup(hostname, opt, (err, arg0, arg1) => {
21493
- if (err) {
21494
- return cb(err);
21495
- }
21496
- const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry2(addr)) : [buildAddressEntry2(arg0, arg1)];
21497
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
21498
- });
21499
- };
21892
+ lookup = normalizeLookup2(lookup);
21500
21893
  }
21501
21894
  const abortEmitter = new events.EventEmitter();
21502
21895
  function abort(reason) {
@@ -21689,6 +22082,11 @@ var require_axios = __commonJS({
21689
22082
  }));
21690
22083
  }
21691
22084
  headers.set("Accept-Encoding", utils$1.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD2 : ACCEPT_ENCODING2, false);
22085
+ if (isHttp2 && lookup) {
22086
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, {
22087
+ lookup
22088
+ });
22089
+ }
21692
22090
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
21693
22091
  path: path$1,
21694
22092
  method,
@@ -21702,9 +22100,11 @@ var require_axios = __commonJS({
21702
22100
  family,
21703
22101
  beforeRedirect: dispatchBeforeRedirect2,
21704
22102
  beforeRedirects: /* @__PURE__ */ Object.create(null),
21705
- http2Options
22103
+ http2Options,
22104
+ createConnection: void 0
21706
22105
  });
21707
22106
  !utils$1.isUndefined(lookup) && (options.lookup = lookup);
22107
+ let proxyApplied = false;
21708
22108
  if (socketPath) {
21709
22109
  if (typeof socketPath !== "string") {
21710
22110
  return reject(new AxiosError3("socketPath must be a string", AxiosError3.ERR_BAD_OPTION_VALUE, config));
@@ -21722,7 +22122,18 @@ var require_axios = __commonJS({
21722
22122
  } else {
21723
22123
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
21724
22124
  options.port = parsed.port;
21725
- setProxy2(options, configProxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path, false, httpsAgent, httpAgent);
22125
+ proxyApplied = setProxy2(
22126
+ options,
22127
+ configProxy,
22128
+ protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
22129
+ false,
22130
+ httpsAgent,
22131
+ httpAgent,
22132
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
22133
+ // cannot apply either axios-resolved or agent-local environment proxies.
22134
+ // Explicit proxy config is still processed and rejected below.
22135
+ !isHttp2
22136
+ );
21726
22137
  }
21727
22138
  let transport;
21728
22139
  let isNativeTransport = false;
@@ -21732,6 +22143,9 @@ var require_axios = __commonJS({
21732
22143
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
21733
22144
  }
21734
22145
  if (isHttp2) {
22146
+ if (proxyApplied) {
22147
+ return reject(new AxiosError3("HTTP/2 requests with a proxy are not supported", AxiosError3.ERR_NOT_SUPPORT, config));
22148
+ }
21735
22149
  transport = http2Transport2;
21736
22150
  } else {
21737
22151
  const configTransport = own3("transport");
@@ -21929,12 +22343,7 @@ var require_axios = __commonJS({
21929
22343
  socket.setKeepAlive(true, 1e3 * 60);
21930
22344
  }
21931
22345
  if (!socket[kAxiosSocketListener2]) {
21932
- socket.on("error", function handleSocketError(err) {
21933
- const current = socket[kAxiosCurrentReq2];
21934
- if (current && !current.destroyed) {
21935
- current.destroy(err);
21936
- }
21937
- });
22346
+ socket.on("error", handleSocketError2);
21938
22347
  socket[kAxiosSocketListener2] = true;
21939
22348
  }
21940
22349
  socket[kAxiosCurrentReq2] = req;
@@ -22150,7 +22559,7 @@ var require_axios = __commonJS({
22150
22559
  transformResponse: defaultToConfig2,
22151
22560
  paramsSerializer: defaultToConfig2,
22152
22561
  timeout: defaultToConfig2,
22153
- timeoutMessage: defaultToConfig2,
22562
+ timeoutErrorMessage: defaultToConfig2,
22154
22563
  withCredentials: defaultToConfig2,
22155
22564
  withXSRFToken: defaultToConfig2,
22156
22565
  adapter: defaultToConfig2,
@@ -22218,10 +22627,11 @@ var require_axios = __commonJS({
22218
22627
  }
22219
22628
  }
22220
22629
  if (utils$1.isFormData(data)) {
22630
+ const getHeaders = utils$1.getSafeProp(data, "getHeaders");
22221
22631
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
22222
22632
  headers.setContentType(void 0);
22223
- } else if (utils$1.isFunction(data.getHeaders)) {
22224
- setFormDataHeaders2(headers, data.getHeaders(), own3("formDataHeaderPolicy"));
22633
+ } else if (utils$1.isFunction(getHeaders)) {
22634
+ setFormDataHeaders2(headers, getHeaders.call(data), own3("formDataHeaderPolicy"));
22225
22635
  }
22226
22636
  }
22227
22637
  if (platform.hasStandardBrowserEnv) {
@@ -22251,7 +22661,7 @@ var require_axios = __commonJS({
22251
22661
  } = _config;
22252
22662
  let onCanceled;
22253
22663
  let uploadThrottled, downloadThrottled;
22254
- let flushUpload, flushDownload;
22664
+ let flushUpload, flushDownload, flushDownloadWithEvent;
22255
22665
  function done() {
22256
22666
  flushUpload && flushUpload();
22257
22667
  flushDownload && flushDownload();
@@ -22261,7 +22671,27 @@ var require_axios = __commonJS({
22261
22671
  let request = new XMLHttpRequest();
22262
22672
  request.open(_config.method.toUpperCase(), _config.url, true);
22263
22673
  request.timeout = _config.timeout;
22264
- function onloadend() {
22674
+ function onloadend(event) {
22675
+ if (!request) {
22676
+ return;
22677
+ }
22678
+ if (request.status === 0 && (parseProtocol2(normalizeURLForProtocolCheck2(_config.url)) || parseProtocol2(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
22679
+ reject(new AxiosError3("Request aborted", AxiosError3.ECONNABORTED, config, request));
22680
+ done();
22681
+ request = null;
22682
+ return;
22683
+ }
22684
+ try {
22685
+ if (event) {
22686
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
22687
+ } else {
22688
+ flushDownload && flushDownload();
22689
+ }
22690
+ } catch (err) {
22691
+ setTimeout(() => {
22692
+ throw err;
22693
+ });
22694
+ }
22265
22695
  if (!request) {
22266
22696
  return;
22267
22697
  }
@@ -22336,7 +22766,7 @@ var require_axios = __commonJS({
22336
22766
  request.responseType = _config.responseType;
22337
22767
  }
22338
22768
  if (onDownloadProgress) {
22339
- [downloadThrottled, flushDownload] = progressEventReducer2(onDownloadProgress, true);
22769
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer2(onDownloadProgress, true);
22340
22770
  request.addEventListener("progress", downloadThrottled);
22341
22771
  }
22342
22772
  if (onUploadProgress && request.upload) {
@@ -22498,6 +22928,17 @@ var require_axios = __commonJS({
22498
22928
  });
22499
22929
  };
22500
22930
  var DEFAULT_CHUNK_SIZE2 = 64 * 1024;
22931
+ var DEFAULT_REQUEST_OPTIONS2 = {
22932
+ cache: "default",
22933
+ redirect: "follow",
22934
+ referrer: "about:client",
22935
+ referrerPolicy: "",
22936
+ mode: "cors",
22937
+ integrity: "",
22938
+ keepalive: false,
22939
+ priority: "auto",
22940
+ window: null
22941
+ };
22501
22942
  var {
22502
22943
  isFunction: isFunction3
22503
22944
  } = utils$1;
@@ -22626,7 +23067,8 @@ var require_axios = __commonJS({
22626
23067
  withCredentials = "same-origin",
22627
23068
  fetchOptions,
22628
23069
  maxContentLength,
22629
- maxBodyLength
23070
+ maxBodyLength,
23071
+ maxRedirects
22630
23072
  } = resolveConfig2(config);
22631
23073
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
22632
23074
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -22727,17 +23169,44 @@ var require_axios = __commonJS({
22727
23169
  }
22728
23170
  }
22729
23171
  headers.set("User-Agent", "axios/" + VERSION3, false);
22730
- const resolvedOptions = {
22731
- ...fetchOptions,
23172
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
23173
+ if (safeFetchOptions) {
23174
+ delete safeFetchOptions.body;
23175
+ delete safeFetchOptions.headers;
23176
+ delete safeFetchOptions.method;
23177
+ delete safeFetchOptions.signal;
23178
+ delete safeFetchOptions.duplex;
23179
+ delete safeFetchOptions.credentials;
23180
+ }
23181
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
22732
23182
  signal: composedSignal,
22733
23183
  method: method.toUpperCase(),
22734
23184
  headers: toByteStringHeaderObject2(headers.normalize()),
22735
23185
  body: data,
22736
23186
  duplex: "half",
22737
23187
  credentials: isCredentialsSupported ? withCredentials : void 0
22738
- };
23188
+ });
23189
+ if (isRequestSupported) {
23190
+ utils$1.forEach(DEFAULT_REQUEST_OPTIONS2, (value, key) => {
23191
+ if (resolvedOptions[key] === void 0) {
23192
+ resolvedOptions[key] = value;
23193
+ }
23194
+ });
23195
+ if (resolvedOptions.signal === void 0) {
23196
+ resolvedOptions.signal = null;
23197
+ }
23198
+ if (resolvedOptions.body === void 0) {
23199
+ resolvedOptions.body = null;
23200
+ }
23201
+ }
23202
+ if (maxRedirects === 0) {
23203
+ resolvedOptions.redirect = "manual";
23204
+ if (safeFetchOptions) {
23205
+ safeFetchOptions.redirect = "manual";
23206
+ }
23207
+ }
22739
23208
  request = isRequestSupported && new Request(url3, resolvedOptions);
22740
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url3, resolvedOptions));
23209
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url3, resolvedOptions));
22741
23210
  const responseHeaders = AxiosHeaders3.from(response.headers);
22742
23211
  if (hasMaxContentLength) {
22743
23212
  const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
@@ -22929,9 +23398,10 @@ var require_axios = __commonJS({
22929
23398
  throw new CanceledError3(null, config);
22930
23399
  }
22931
23400
  }
22932
- function dispatchRequest2(config) {
23401
+ function dispatchRequest2(_config) {
23402
+ const config = utils$1.toSafeFlatObject(_config);
22933
23403
  throwIfCancellationRequested2(config);
22934
- config.headers = AxiosHeaders3.from(config.headers);
23404
+ config.headers = AxiosHeaders3.from(utils$1.getSafeProp(config, "headers"));
22935
23405
  config.data = transformData2.call(config, config.transformRequest);
22936
23406
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
22937
23407
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -23039,16 +23509,15 @@ var require_axios = __commonJS({
23039
23509
  return await this._request(configOrUrl, config);
23040
23510
  } catch (err) {
23041
23511
  if (err instanceof Error) {
23042
- let dummy = {};
23043
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
23044
- const stack = (() => {
23045
- if (!dummy.stack) {
23046
- return "";
23047
- }
23048
- const firstNewlineIndex = dummy.stack.indexOf("\n");
23049
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
23050
- })();
23051
23512
  try {
23513
+ let dummy = {};
23514
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
23515
+ const dummyStack = dummy.stack;
23516
+ let stack = "";
23517
+ if (typeof dummyStack === "string") {
23518
+ const firstNewlineIndex = dummyStack.indexOf("\n");
23519
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
23520
+ }
23052
23521
  if (!err.stack) {
23053
23522
  err.stack = stack;
23054
23523
  } else if (stack) {
@@ -23110,9 +23579,9 @@ var require_axios = __commonJS({
23110
23579
  baseUrl: validators3.spelling("baseURL"),
23111
23580
  withXsrfToken: validators3.spelling("withXSRFToken")
23112
23581
  }, true);
23113
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
23582
+ config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
23114
23583
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
23115
- headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
23584
+ headers && utils$1.forEach(methodList2.concat("common"), (method) => {
23116
23585
  delete headers[method];
23117
23586
  });
23118
23587
  config.headers = AxiosHeaders3.concat(contextHeaders, headers);
@@ -23359,14 +23828,22 @@ var require_axios = __commonJS({
23359
23828
  Gone: 410,
23360
23829
  LengthRequired: 411,
23361
23830
  PreconditionFailed: 412,
23831
+ /**
23832
+ * @deprecated Use `ContentTooLarge` instead.
23833
+ */
23362
23834
  PayloadTooLarge: 413,
23835
+ ContentTooLarge: 413,
23363
23836
  UriTooLong: 414,
23364
23837
  UnsupportedMediaType: 415,
23365
23838
  RangeNotSatisfiable: 416,
23366
23839
  ExpectationFailed: 417,
23367
23840
  ImATeapot: 418,
23368
23841
  MisdirectedRequest: 421,
23842
+ /**
23843
+ * @deprecated Use `UnprocessableContent` instead.
23844
+ */
23369
23845
  UnprocessableEntity: 422,
23846
+ UnprocessableContent: 422,
23370
23847
  Locked: 423,
23371
23848
  FailedDependency: 424,
23372
23849
  TooEarly: 425,
@@ -23395,7 +23872,9 @@ var require_axios = __commonJS({
23395
23872
  InvalidSslCertificate: 526
23396
23873
  };
23397
23874
  Object.entries(HttpStatusCode3).forEach(([key, value]) => {
23398
- HttpStatusCode3[value] = key;
23875
+ if (HttpStatusCode3[value] === void 0) {
23876
+ HttpStatusCode3[value] = key;
23877
+ }
23399
23878
  });
23400
23879
  function createInstance2(defaultConfig) {
23401
23880
  const context = new Axios3(defaultConfig);
@@ -45226,22 +45705,82 @@ var { toString } = Object.prototype;
45226
45705
  var { getPrototypeOf } = Object;
45227
45706
  var { iterator, toStringTag } = Symbol;
45228
45707
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
45708
+ var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
45709
+ var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
45710
+ var isSafeAndFullyMutable = (obj) => {
45711
+ if (!Object.isExtensible(obj)) {
45712
+ return false;
45713
+ }
45714
+ const props = Object.getOwnPropertyNames(obj);
45715
+ if (Object.getOwnPropertySymbols) {
45716
+ props.push(...Object.getOwnPropertySymbols(obj));
45717
+ }
45718
+ return props.every((prop) => {
45719
+ if (isUnsafeObjectKey(prop)) {
45720
+ return false;
45721
+ }
45722
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
45723
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
45724
+ });
45725
+ };
45229
45726
  var hasOwnInPrototypeChain = (thing, prop) => {
45230
45727
  let obj = thing;
45231
45728
  const seen = [];
45232
- while (obj != null && obj !== Object.prototype) {
45729
+ while (obj != null) {
45233
45730
  if (seen.indexOf(obj) !== -1) {
45234
45731
  return false;
45235
45732
  }
45236
45733
  seen.push(obj);
45734
+ const prototype2 = getPrototypeOf(obj);
45735
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
45736
+ return false;
45737
+ }
45237
45738
  if (hasOwnProperty(obj, prop)) {
45238
45739
  return true;
45239
45740
  }
45240
- obj = getPrototypeOf(obj);
45741
+ obj = prototype2;
45241
45742
  }
45242
45743
  return false;
45243
45744
  };
45244
45745
  var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
45746
+ var toSafeFlatObject = (thing) => {
45747
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
45748
+ return thing;
45749
+ }
45750
+ const sourcePrototype = getPrototypeOf(thing);
45751
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
45752
+ return thing;
45753
+ }
45754
+ const result = /* @__PURE__ */ Object.create(null);
45755
+ const merged = /* @__PURE__ */ Object.create(null);
45756
+ const seen = [];
45757
+ let current = thing;
45758
+ while (current != null) {
45759
+ if (seen.indexOf(current) !== -1) {
45760
+ break;
45761
+ }
45762
+ seen.push(current);
45763
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
45764
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
45765
+ break;
45766
+ }
45767
+ const props = Object.getOwnPropertyNames(current);
45768
+ if (Object.getOwnPropertySymbols) {
45769
+ props.push(...Object.getOwnPropertySymbols(current));
45770
+ }
45771
+ for (const prop of props) {
45772
+ if (isUnsafeObjectKey(prop)) {
45773
+ continue;
45774
+ }
45775
+ if (!hasOwnProperty(merged, prop)) {
45776
+ result[prop] = thing[prop];
45777
+ merged[prop] = true;
45778
+ }
45779
+ }
45780
+ current = prototype2;
45781
+ }
45782
+ return result;
45783
+ };
45245
45784
  var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
45246
45785
  const str = toString.call(thing);
45247
45786
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -45276,9 +45815,9 @@ var isPlainObject = (val) => {
45276
45815
  return false;
45277
45816
  }
45278
45817
  const prototype2 = getPrototypeOf(val);
45279
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
45280
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
45281
- // than a plain object, while ignoring keys injected onto Object.prototype.
45818
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
45819
+ // evidence the value is tagged/iterable, while ignoring members reachable
45820
+ // only through shared or terminal prototype boundaries.
45282
45821
  !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
45283
45822
  };
45284
45823
  var isEmptyObject = (val) => {
@@ -45689,6 +46228,7 @@ var utils_default = {
45689
46228
  // an alias to avoid ESLint no-prototype-builtins detection
45690
46229
  hasOwnInPrototypeChain,
45691
46230
  getSafeProp,
46231
+ toSafeFlatObject,
45692
46232
  reduceDescriptors,
45693
46233
  freezeMethods,
45694
46234
  toObjectSet,
@@ -46327,24 +46867,16 @@ function toFormData(obj, formData, options) {
46327
46867
  throw new TypeError("target must be an object");
46328
46868
  }
46329
46869
  formData = formData || new (FormData_default || FormData)();
46330
- options = utils_default.toFlatObject(
46331
- options,
46332
- {
46333
- metaTokens: true,
46334
- dots: false,
46335
- indexes: false
46336
- },
46337
- false,
46338
- function defined(option, source) {
46339
- return !utils_default.isUndefined(source[option]);
46340
- }
46341
- );
46342
- const metaTokens = options.metaTokens;
46343
- const visitor = options.visitor || defaultVisitor;
46344
- const dots = options.dots;
46345
- const indexes = options.indexes;
46346
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
46347
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
46870
+ const option = (name, fallback) => {
46871
+ const value = utils_default.getSafeProp(options, name);
46872
+ return utils_default.isUndefined(value) ? fallback : value;
46873
+ };
46874
+ const metaTokens = option("metaTokens", true);
46875
+ const visitor = option("visitor") || defaultVisitor;
46876
+ const dots = option("dots", false);
46877
+ const indexes = option("indexes", false);
46878
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
46879
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
46348
46880
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
46349
46881
  const stack = [];
46350
46882
  if (!utils_default.isFunction(visitor)) {
@@ -46368,7 +46900,10 @@ function toFormData(obj, formData, options) {
46368
46900
  if (Buffer_default && Buffer_default.isBufferAvailable()) {
46369
46901
  return Buffer_default.from(value);
46370
46902
  }
46371
- throw new AxiosError_default("Blob is not supported. Use a Buffer instead.", AxiosError_default.ERR_NOT_SUPPORT);
46903
+ throw new AxiosError_default(
46904
+ "Blob is not supported. Use a Buffer instead.",
46905
+ AxiosError_default.ERR_NOT_SUPPORT
46906
+ );
46372
46907
  }
46373
46908
  return value;
46374
46909
  }
@@ -46514,9 +47049,47 @@ function buildURL(url2, params, options) {
46514
47049
  }
46515
47050
 
46516
47051
  // node_modules/axios/lib/core/InterceptorManager.js
47052
+ var $internals2 = Symbol("internals");
47053
+ function countHandlers(handlers) {
47054
+ return handlers ? handlers.length : 0;
47055
+ }
47056
+ function trimHandlers(handlers) {
47057
+ if (!handlers) {
47058
+ return;
47059
+ }
47060
+ while (handlers.length && handlers[handlers.length - 1] === null) {
47061
+ handlers.pop();
47062
+ }
47063
+ }
47064
+ function syncHandlerEntries(manager, internals) {
47065
+ const handlers = manager.handlers;
47066
+ const length = countHandlers(handlers);
47067
+ if (handlers !== internals.handlersRef) {
47068
+ internals.handlersRef = handlers;
47069
+ internals.handlerEntries.clear();
47070
+ } else if (length !== internals.handlersLength) {
47071
+ if (!length) {
47072
+ internals.handlerEntries.clear();
47073
+ } else {
47074
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
47075
+ if (handlers[entry.index] !== entry.handler) {
47076
+ internals.handlerEntries.delete(id);
47077
+ }
47078
+ });
47079
+ }
47080
+ }
47081
+ internals.handlersLength = length;
47082
+ }
46517
47083
  var InterceptorManager = class {
46518
47084
  constructor() {
46519
47085
  this.handlers = [];
47086
+ this[$internals2] = {
47087
+ handlersRef: this.handlers,
47088
+ handlersLength: this.handlers.length,
47089
+ handlerEntries: /* @__PURE__ */ new Map(),
47090
+ iterationDepth: 0,
47091
+ nextId: 0
47092
+ };
46520
47093
  }
46521
47094
  /**
46522
47095
  * Add a new interceptor to the stack
@@ -46528,13 +47101,25 @@ var InterceptorManager = class {
46528
47101
  * @return {Number} An ID used to remove interceptor later
46529
47102
  */
46530
47103
  use(fulfilled, rejected, options) {
46531
- this.handlers.push({
47104
+ const handler = {
46532
47105
  fulfilled,
46533
47106
  rejected,
46534
47107
  synchronous: options ? options.synchronous : false,
46535
47108
  runWhen: options ? options.runWhen : null
47109
+ };
47110
+ const internals = this[$internals2];
47111
+ if (this.handlers == null) {
47112
+ this.handlers = [];
47113
+ }
47114
+ syncHandlerEntries(this, internals);
47115
+ const id = internals.nextId++;
47116
+ this.handlers.push(handler);
47117
+ internals.handlerEntries.set(id, {
47118
+ handler,
47119
+ index: this.handlers.length - 1
46536
47120
  });
46537
- return this.handlers.length - 1;
47121
+ internals.handlersLength = this.handlers.length;
47122
+ return id;
46538
47123
  }
46539
47124
  /**
46540
47125
  * Remove an interceptor from the stack
@@ -46544,8 +47129,19 @@ var InterceptorManager = class {
46544
47129
  * @returns {void}
46545
47130
  */
46546
47131
  eject(id) {
46547
- if (this.handlers[id]) {
46548
- this.handlers[id] = null;
47132
+ const internals = this[$internals2];
47133
+ syncHandlerEntries(this, internals);
47134
+ const entry = internals.handlerEntries.get(id);
47135
+ if (entry) {
47136
+ internals.handlerEntries.delete(id);
47137
+ if (this.handlers[entry.index] !== entry.handler) {
47138
+ return;
47139
+ }
47140
+ this.handlers[entry.index] = null;
47141
+ if (!internals.iterationDepth) {
47142
+ trimHandlers(this.handlers);
47143
+ internals.handlersLength = this.handlers.length;
47144
+ }
46549
47145
  }
46550
47146
  }
46551
47147
  /**
@@ -46556,6 +47152,7 @@ var InterceptorManager = class {
46556
47152
  clear() {
46557
47153
  if (this.handlers) {
46558
47154
  this.handlers = [];
47155
+ syncHandlerEntries(this, this[$internals2]);
46559
47156
  }
46560
47157
  }
46561
47158
  /**
@@ -46569,11 +47166,22 @@ var InterceptorManager = class {
46569
47166
  * @returns {void}
46570
47167
  */
46571
47168
  forEach(fn) {
46572
- utils_default.forEach(this.handlers, function forEachHandler(h) {
46573
- if (h !== null) {
46574
- fn(h);
47169
+ const internals = this[$internals2];
47170
+ syncHandlerEntries(this, internals);
47171
+ internals.iterationDepth++;
47172
+ try {
47173
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
47174
+ if (h !== null) {
47175
+ fn(h);
47176
+ }
47177
+ });
47178
+ } finally {
47179
+ if (!--internals.iterationDepth) {
47180
+ syncHandlerEntries(this, internals);
47181
+ trimHandlers(this.handlers);
47182
+ internals.handlersLength = countHandlers(this.handlers);
46575
47183
  }
46576
- });
47184
+ }
46577
47185
  }
46578
47186
  };
46579
47187
  var InterceptorManager_default = InterceptorManager;
@@ -46731,6 +47339,22 @@ function formDataToJSON(formData) {
46731
47339
  }
46732
47340
  var formDataToJSON_default = formDataToJSON;
46733
47341
 
47342
+ // node_modules/axios/lib/core/methodList.js
47343
+ var methodList = Object.freeze([
47344
+ "get",
47345
+ "delete",
47346
+ "head",
47347
+ "options",
47348
+ "post",
47349
+ "put",
47350
+ "patch",
47351
+ "purge",
47352
+ "link",
47353
+ "unlink",
47354
+ "query"
47355
+ ]);
47356
+ var methodList_default = methodList;
47357
+
46734
47358
  // node_modules/axios/lib/defaults/index.js
46735
47359
  var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
46736
47360
  function stringifySafely2(rawValue, parser, encoder) {
@@ -46843,7 +47467,7 @@ var defaults = {
46843
47467
  }
46844
47468
  }
46845
47469
  };
46846
- utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
47470
+ utils_default.forEach(methodList_default, (method) => {
46847
47471
  defaults.headers[method] = {};
46848
47472
  });
46849
47473
  var defaults_default = defaults;
@@ -46921,19 +47545,21 @@ function combineURLs(baseURL, relativeURL) {
46921
47545
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
46922
47546
  }
46923
47547
 
46924
- // node_modules/axios/lib/core/buildFullPath.js
46925
- var malformedHttpProtocol = /^https?:(?!\/\/)/i;
46926
- var httpProtocolControlCharacters = /[\t\n\r]/g;
46927
- function stripLeadingC0ControlOrSpace(url2) {
46928
- let i = 0;
46929
- while (i < url2.length && url2.charCodeAt(i) <= 32) {
46930
- i++;
46931
- }
46932
- return url2.slice(i);
46933
- }
47548
+ // node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
47549
+ var urlParserControlCharacters = /[\t\n\r]/g;
46934
47550
  function normalizeURLForProtocolCheck(url2) {
46935
- return stripLeadingC0ControlOrSpace(url2).replace(httpProtocolControlCharacters, "");
47551
+ if (typeof url2 !== "string") {
47552
+ return url2;
47553
+ }
47554
+ let start = 0;
47555
+ while (start < url2.length && url2.charCodeAt(start) <= 32) {
47556
+ start++;
47557
+ }
47558
+ return url2.slice(start).replace(urlParserControlCharacters, "");
46936
47559
  }
47560
+
47561
+ // node_modules/axios/lib/core/buildFullPath.js
47562
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
46937
47563
  function redactFragment(fragment) {
46938
47564
  if (!fragment) {
46939
47565
  return fragment;
@@ -47055,7 +47681,7 @@ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
47055
47681
  var import_zlib = __toESM(require("zlib"), 1);
47056
47682
 
47057
47683
  // node_modules/axios/lib/env/data.js
47058
- var VERSION = "1.19.0";
47684
+ var VERSION = "1.20.0";
47059
47685
 
47060
47686
  // node_modules/axios/lib/helpers/parseProtocol.js
47061
47687
  function parseProtocol(url2) {
@@ -47064,7 +47690,7 @@ function parseProtocol(url2) {
47064
47690
  }
47065
47691
 
47066
47692
  // node_modules/axios/lib/helpers/fromDataURI.js
47067
- var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
47693
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
47068
47694
  function fromDataURI(uri, asBlob, options) {
47069
47695
  const _Blob = options && options.Blob || platform_default.classes.Blob;
47070
47696
  const protocol = parseProtocol(uri);
@@ -47377,6 +48003,7 @@ var Http2Sessions = class {
47377
48003
  }
47378
48004
  getSession(authority, options) {
47379
48005
  options = Object.assign(
48006
+ /* @__PURE__ */ Object.create(null),
47380
48007
  {
47381
48008
  sessionTimeout: 1e3
47382
48009
  },
@@ -47442,6 +48069,7 @@ var Http2Sessions = class {
47442
48069
  };
47443
48070
  }
47444
48071
  session.once("close", removeSession);
48072
+ session.once("error", removeSession);
47445
48073
  let entry = [session, options];
47446
48074
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
47447
48075
  return session;
@@ -47466,6 +48094,13 @@ var callbackify_default = callbackify;
47466
48094
 
47467
48095
  // node_modules/axios/lib/helpers/shouldBypassProxy.js
47468
48096
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
48097
+ var trimTrailingDots = (value) => {
48098
+ let end = value.length;
48099
+ while (end && value.charCodeAt(end - 1) === 46) {
48100
+ end--;
48101
+ }
48102
+ return end === value.length ? value : value.slice(0, end);
48103
+ };
47469
48104
  var isIPv4Loopback = (host) => {
47470
48105
  const parts = host.split(".");
47471
48106
  if (parts.length !== 4) return false;
@@ -47498,7 +48133,7 @@ var normalizeIPAddress = (host) => {
47498
48133
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
47499
48134
  h = h.slice(1, -1);
47500
48135
  }
47501
- h = h.replace(/\.+$/, "");
48136
+ h = trimTrailingDots(h);
47502
48137
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
47503
48138
  const parts = h.split(".");
47504
48139
  if (parts.some((p) => p === "")) return host;
@@ -47610,6 +48245,40 @@ var unmapIPv4MappedIPv6 = (host) => {
47610
48245
  }
47611
48246
  return host;
47612
48247
  };
48248
+ var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
48249
+ var ipv4ToBytes = (host) => {
48250
+ const parts = host.split(".");
48251
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
48252
+ };
48253
+ var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
48254
+ var ipv6ToBytes = (host) => {
48255
+ const halves = host.split("::");
48256
+ if (halves.length > 2) {
48257
+ return null;
48258
+ }
48259
+ const groups = halves[0] ? halves[0].split(":") : [];
48260
+ if (halves.length === 2) {
48261
+ const rear = halves[1] ? halves[1].split(":") : [];
48262
+ const missing = 8 - groups.length - rear.length;
48263
+ if (missing < 1) {
48264
+ return null;
48265
+ }
48266
+ groups.push(...new Array(missing).fill("0"), ...rear);
48267
+ }
48268
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
48269
+ return null;
48270
+ }
48271
+ return groups.flatMap((group) => {
48272
+ const value = Number.parseInt(group, 16);
48273
+ return [value >> 8 & 255, value & 255];
48274
+ });
48275
+ };
48276
+ var ipToBytes = (host) => {
48277
+ if (typeof host !== "string" || !host) {
48278
+ return null;
48279
+ }
48280
+ return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
48281
+ };
47613
48282
  var normalizeNoProxyHost = (hostname) => {
47614
48283
  if (!hostname) {
47615
48284
  return hostname;
@@ -47617,13 +48286,90 @@ var normalizeNoProxyHost = (hostname) => {
47617
48286
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
47618
48287
  hostname = hostname.slice(1, -1);
47619
48288
  }
47620
- const trimmed = hostname.replace(/\.+$/, "");
48289
+ const trimmed = trimTrailingDots(hostname);
47621
48290
  const ipv4 = normalizeIPAddress(trimmed);
47622
48291
  if (ipv4 !== trimmed) {
47623
48292
  return ipv4;
47624
48293
  }
47625
48294
  return unmapIPv4MappedIPv6(trimmed);
47626
48295
  };
48296
+ var normalizeCidrBase = (input) => {
48297
+ let base = input;
48298
+ const startsBracket = base.charAt(0) === "[";
48299
+ const endsBracket = base.charAt(base.length - 1) === "]";
48300
+ const hasBracket = base.includes("[") || base.includes("]");
48301
+ if (startsBracket || endsBracket) {
48302
+ if (!startsBracket || !endsBracket) {
48303
+ return null;
48304
+ }
48305
+ base = base.slice(1, -1);
48306
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
48307
+ return null;
48308
+ }
48309
+ } else if (hasBracket) {
48310
+ return null;
48311
+ }
48312
+ if (!base || base.charAt(base.length - 1) === ".") {
48313
+ return null;
48314
+ }
48315
+ const wasIPv6 = base.indexOf(":") !== -1;
48316
+ if (wasIPv6) {
48317
+ try {
48318
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
48319
+ } catch (_err) {
48320
+ return null;
48321
+ }
48322
+ } else {
48323
+ base = normalizeIPAddress(base);
48324
+ if (!ipv4ToBytes(base)) {
48325
+ return null;
48326
+ }
48327
+ }
48328
+ return { normalized: unmapIPv4MappedIPv6(base), wasIPv6 };
48329
+ };
48330
+ var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
48331
+ var parseCidrEntry = (entry) => {
48332
+ if (entry.indexOf("/") === -1) {
48333
+ return void 0;
48334
+ }
48335
+ const match = CIDR_ENTRY_RE.exec(entry);
48336
+ if (!match) {
48337
+ return null;
48338
+ }
48339
+ let prefix = Number(match[2]);
48340
+ const parsedBase = normalizeCidrBase(match[1]);
48341
+ if (!parsedBase) {
48342
+ return null;
48343
+ }
48344
+ const { normalized, wasIPv6 } = parsedBase;
48345
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
48346
+ if (prefix < 96) {
48347
+ return null;
48348
+ }
48349
+ prefix -= 96;
48350
+ }
48351
+ const bytes = ipToBytes(normalized);
48352
+ if (!bytes || prefix > bytes.length * 8) {
48353
+ return null;
48354
+ }
48355
+ return { bytes, prefix };
48356
+ };
48357
+ var isInSubnet = (addressBytes, networkBytes, prefix) => {
48358
+ const fullBytes = prefix >> 3;
48359
+ for (let i = 0; i < fullBytes; i++) {
48360
+ if (addressBytes[i] !== networkBytes[i]) {
48361
+ return false;
48362
+ }
48363
+ }
48364
+ const remainingBits = prefix & 7;
48365
+ if (remainingBits) {
48366
+ const mask = 255 << 8 - remainingBits & 255;
48367
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
48368
+ return false;
48369
+ }
48370
+ }
48371
+ return true;
48372
+ };
47627
48373
  function shouldBypassProxy(location) {
47628
48374
  let parsed;
47629
48375
  try {
@@ -47640,6 +48386,7 @@ function shouldBypassProxy(location) {
47640
48386
  }
47641
48387
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
47642
48388
  const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
48389
+ const hostnameBytes = ipToBytes(hostname);
47643
48390
  return noProxy.split(/[\s,]+/).some((entry) => {
47644
48391
  if (!entry) {
47645
48392
  return false;
@@ -47647,6 +48394,10 @@ function shouldBypassProxy(location) {
47647
48394
  if (entry === "*") {
47648
48395
  return true;
47649
48396
  }
48397
+ const cidr = parseCidrEntry(entry);
48398
+ if (cidr !== void 0) {
48399
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
48400
+ }
47650
48401
  let [entryHost, entryPort] = parseNoProxyEntry(entry);
47651
48402
  entryHost = normalizeNoProxyHost(entryHost);
47652
48403
  if (!entryHost) {
@@ -47732,7 +48483,8 @@ function throttle(fn, freq) {
47732
48483
  }
47733
48484
  };
47734
48485
  const flush = () => lastArgs && invoke(lastArgs);
47735
- return [throttled, flush];
48486
+ const flushWith = (...args) => invoke(args);
48487
+ return [throttled, flush, flushWith];
47736
48488
  }
47737
48489
  var throttle_default = throttle;
47738
48490
 
@@ -47741,7 +48493,7 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
47741
48493
  let bytesNotified = 0;
47742
48494
  const _speedometer = speedometer_default(50, 250);
47743
48495
  return throttle_default((e) => {
47744
- if (!e || typeof e.loaded !== "number") {
48496
+ if (!e || !utils_default.isNumber(e.loaded)) {
47745
48497
  return;
47746
48498
  }
47747
48499
  const rawLoaded = e.loaded;
@@ -47902,6 +48654,12 @@ var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
47902
48654
  var isHttps = /https:?/;
47903
48655
  var kAxiosSocketListener = Symbol("axios.http.socketListener");
47904
48656
  var kAxiosCurrentReq = Symbol("axios.http.currentReq");
48657
+ function handleSocketError(err) {
48658
+ const current = this[kAxiosCurrentReq];
48659
+ if (current && !current.destroyed) {
48660
+ current.destroy(err);
48661
+ }
48662
+ }
47905
48663
  var kAxiosInstalledTunnel = Symbol("axios.http.installedTunnel");
47906
48664
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
47907
48665
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
@@ -48004,10 +48762,10 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
48004
48762
  return false;
48005
48763
  }
48006
48764
  }
48007
- function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
48765
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
48008
48766
  let proxy = configProxy;
48009
48767
  const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
48010
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
48768
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
48011
48769
  const proxyUrl = getProxyForUrl(location);
48012
48770
  if (proxyUrl) {
48013
48771
  if (!shouldBypassProxy(location)) {
@@ -48104,9 +48862,13 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
48104
48862
  redirectOptions.href,
48105
48863
  true,
48106
48864
  configHttpsAgent,
48107
- configHttpAgent
48865
+ configHttpAgent,
48866
+ allowEnvProxy
48108
48867
  );
48109
48868
  };
48869
+ return Boolean(
48870
+ proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent)
48871
+ );
48110
48872
  }
48111
48873
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
48112
48874
  var wrapAsync = (asyncExecutor) => {
@@ -48131,7 +48893,7 @@ var wrapAsync = (asyncExecutor) => {
48131
48893
  };
48132
48894
  var resolveFamily = ({ address, family }) => {
48133
48895
  if (!utils_default.isString(address)) {
48134
- throw TypeError("address must be a string");
48896
+ throw new AxiosError_default("address must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE);
48135
48897
  }
48136
48898
  return {
48137
48899
  address,
@@ -48139,6 +48901,30 @@ var resolveFamily = ({ address, family }) => {
48139
48901
  };
48140
48902
  };
48141
48903
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
48904
+ var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
48905
+ var normalizeLookup = (lookup) => {
48906
+ let normalized = normalizedLookupCache.get(lookup);
48907
+ if (normalized) {
48908
+ return normalized;
48909
+ }
48910
+ const callbackLookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48911
+ normalized = (hostname, opt, cb) => {
48912
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
48913
+ if (err) {
48914
+ return cb(err);
48915
+ }
48916
+ let addresses;
48917
+ try {
48918
+ addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48919
+ } catch (error) {
48920
+ return cb(error);
48921
+ }
48922
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48923
+ });
48924
+ };
48925
+ normalizedLookupCache.set(lookup, normalized);
48926
+ return normalized;
48927
+ };
48142
48928
  var http2Transport = {
48143
48929
  request(options, cb) {
48144
48930
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -48175,6 +48961,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48175
48961
  let family = own2("family");
48176
48962
  let httpVersion = own2("httpVersion");
48177
48963
  if (httpVersion === void 0) httpVersion = 1;
48964
+ const rawHttpVersion = httpVersion;
48178
48965
  let http2Options = own2("http2Options");
48179
48966
  const httpAgent = own2("httpAgent");
48180
48967
  const httpsAgent = own2("httpsAgent");
@@ -48191,25 +48978,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48191
48978
  let rejected = false;
48192
48979
  let req;
48193
48980
  let connectPhaseTimer;
48194
- httpVersion = +httpVersion;
48981
+ try {
48982
+ httpVersion = +httpVersion;
48983
+ } catch (err) {
48984
+ throw new AxiosError_default(
48985
+ "Invalid protocol version: value is not a number",
48986
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
48987
+ config
48988
+ );
48989
+ }
48195
48990
  if (Number.isNaN(httpVersion)) {
48196
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
48991
+ throw new AxiosError_default(
48992
+ `Invalid protocol version: '${rawHttpVersion}' is not a number`,
48993
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
48994
+ config
48995
+ );
48197
48996
  }
48198
48997
  if (httpVersion !== 1 && httpVersion !== 2) {
48199
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
48998
+ throw new AxiosError_default(
48999
+ `Unsupported protocol version '${httpVersion}'`,
49000
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
49001
+ config
49002
+ );
48200
49003
  }
48201
49004
  const isHttp2 = httpVersion === 2;
48202
49005
  if (lookup) {
48203
- const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48204
- lookup = (hostname, opt, cb) => {
48205
- _lookup(hostname, opt, (err, arg0, arg1) => {
48206
- if (err) {
48207
- return cb(err);
48208
- }
48209
- const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48210
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48211
- });
48212
- };
49006
+ lookup = normalizeLookup(lookup);
48213
49007
  }
48214
49008
  const abortEmitter = new import_events.EventEmitter();
48215
49009
  function abort(reason) {
@@ -48452,6 +49246,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48452
49246
  utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
48453
49247
  false
48454
49248
  );
49249
+ if (isHttp2 && lookup) {
49250
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, { lookup });
49251
+ }
48455
49252
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
48456
49253
  path: path5,
48457
49254
  method,
@@ -48462,9 +49259,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48462
49259
  family,
48463
49260
  beforeRedirect: dispatchBeforeRedirect,
48464
49261
  beforeRedirects: /* @__PURE__ */ Object.create(null),
48465
- http2Options
49262
+ http2Options,
49263
+ createConnection: void 0
48466
49264
  });
48467
49265
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
49266
+ let proxyApplied = false;
48468
49267
  if (socketPath) {
48469
49268
  if (typeof socketPath !== "string") {
48470
49269
  return reject(
@@ -48492,13 +49291,17 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48492
49291
  } else {
48493
49292
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
48494
49293
  options.port = parsed.port;
48495
- setProxy(
49294
+ proxyApplied = setProxy(
48496
49295
  options,
48497
49296
  configProxy,
48498
49297
  protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
48499
49298
  false,
48500
49299
  httpsAgent,
48501
- httpAgent
49300
+ httpAgent,
49301
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
49302
+ // cannot apply either axios-resolved or agent-local environment proxies.
49303
+ // Explicit proxy config is still processed and rejected below.
49304
+ !isHttp2
48502
49305
  );
48503
49306
  }
48504
49307
  let transport;
@@ -48509,6 +49312,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48509
49312
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
48510
49313
  }
48511
49314
  if (isHttp2) {
49315
+ if (proxyApplied) {
49316
+ return reject(
49317
+ new AxiosError_default(
49318
+ "HTTP/2 requests with a proxy are not supported",
49319
+ AxiosError_default.ERR_NOT_SUPPORT,
49320
+ config
49321
+ )
49322
+ );
49323
+ }
48512
49324
  transport = http2Transport;
48513
49325
  } else {
48514
49326
  const configTransport = own2("transport");
@@ -48596,7 +49408,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48596
49408
  transformStream,
48597
49409
  progressEventDecorator(
48598
49410
  responseLength,
48599
- progressEventReducer(asyncDecorator(onDownloadProgress, scheduleProgress), true, 3)
49411
+ progressEventReducer(
49412
+ asyncDecorator(onDownloadProgress, scheduleProgress),
49413
+ true,
49414
+ 3
49415
+ )
48600
49416
  )
48601
49417
  )
48602
49418
  );
@@ -48745,12 +49561,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48745
49561
  socket.setKeepAlive(true, 1e3 * 60);
48746
49562
  }
48747
49563
  if (!socket[kAxiosSocketListener]) {
48748
- socket.on("error", function handleSocketError(err) {
48749
- const current = socket[kAxiosCurrentReq];
48750
- if (current && !current.destroyed) {
48751
- current.destroy(err);
48752
- }
48753
- });
49564
+ socket.on("error", handleSocketError);
48754
49565
  socket[kAxiosSocketListener] = true;
48755
49566
  }
48756
49567
  socket[kAxiosCurrentReq] = req;
@@ -48995,7 +49806,7 @@ function mergeConfig(config1, config2) {
48995
49806
  transformResponse: defaultToConfig2,
48996
49807
  paramsSerializer: defaultToConfig2,
48997
49808
  timeout: defaultToConfig2,
48998
- timeoutMessage: defaultToConfig2,
49809
+ timeoutErrorMessage: defaultToConfig2,
48999
49810
  withCredentials: defaultToConfig2,
49000
49811
  withXSRFToken: defaultToConfig2,
49001
49812
  adapter: defaultToConfig2,
@@ -49072,10 +49883,11 @@ function resolveConfig(config) {
49072
49883
  }
49073
49884
  }
49074
49885
  if (utils_default.isFormData(data)) {
49886
+ const getHeaders = utils_default.getSafeProp(data, "getHeaders");
49075
49887
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
49076
49888
  headers.setContentType(void 0);
49077
- } else if (utils_default.isFunction(data.getHeaders)) {
49078
- setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
49889
+ } else if (utils_default.isFunction(getHeaders)) {
49890
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
49079
49891
  }
49080
49892
  }
49081
49893
  if (platform_default.hasStandardBrowserEnv) {
@@ -49104,7 +49916,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49104
49916
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
49105
49917
  let onCanceled;
49106
49918
  let uploadThrottled, downloadThrottled;
49107
- let flushUpload, flushDownload;
49919
+ let flushUpload, flushDownload, flushDownloadWithEvent;
49108
49920
  function done() {
49109
49921
  flushUpload && flushUpload();
49110
49922
  flushDownload && flushDownload();
@@ -49114,7 +49926,27 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49114
49926
  let request = new XMLHttpRequest();
49115
49927
  request.open(_config.method.toUpperCase(), _config.url, true);
49116
49928
  request.timeout = _config.timeout;
49117
- function onloadend() {
49929
+ function onloadend(event) {
49930
+ if (!request) {
49931
+ return;
49932
+ }
49933
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform_default.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
49934
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
49935
+ done();
49936
+ request = null;
49937
+ return;
49938
+ }
49939
+ try {
49940
+ if (event) {
49941
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
49942
+ } else {
49943
+ flushDownload && flushDownload();
49944
+ }
49945
+ } catch (err) {
49946
+ setTimeout(() => {
49947
+ throw err;
49948
+ });
49949
+ }
49118
49950
  if (!request) {
49119
49951
  return;
49120
49952
  }
@@ -49202,7 +50034,10 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49202
50034
  request.responseType = _config.responseType;
49203
50035
  }
49204
50036
  if (onDownloadProgress) {
49205
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
50037
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
50038
+ onDownloadProgress,
50039
+ true
50040
+ );
49206
50041
  request.addEventListener("progress", downloadThrottled);
49207
50042
  }
49208
50043
  if (onUploadProgress && request.upload) {
@@ -49372,6 +50207,17 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
49372
50207
 
49373
50208
  // node_modules/axios/lib/adapters/fetch.js
49374
50209
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
50210
+ var DEFAULT_REQUEST_OPTIONS = {
50211
+ cache: "default",
50212
+ redirect: "follow",
50213
+ referrer: "about:client",
50214
+ referrerPolicy: "",
50215
+ mode: "cors",
50216
+ integrity: "",
50217
+ keepalive: false,
50218
+ priority: "auto",
50219
+ window: null
50220
+ };
49375
50221
  var { isFunction: isFunction2 } = utils_default;
49376
50222
  var encodeUTF82 = (str) => encodeURIComponent(str).replace(
49377
50223
  /%([0-9A-F]{2})/gi,
@@ -49502,7 +50348,8 @@ var factory = (env) => {
49502
50348
  withCredentials = "same-origin",
49503
50349
  fetchOptions,
49504
50350
  maxContentLength,
49505
- maxBodyLength
50351
+ maxBodyLength,
50352
+ maxRedirects
49506
50353
  } = resolveConfig_default(config);
49507
50354
  const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
49508
50355
  const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -49632,17 +50479,44 @@ var factory = (env) => {
49632
50479
  }
49633
50480
  }
49634
50481
  headers.set("User-Agent", "axios/" + VERSION, false);
49635
- const resolvedOptions = {
49636
- ...fetchOptions,
50482
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
50483
+ if (safeFetchOptions) {
50484
+ delete safeFetchOptions.body;
50485
+ delete safeFetchOptions.headers;
50486
+ delete safeFetchOptions.method;
50487
+ delete safeFetchOptions.signal;
50488
+ delete safeFetchOptions.duplex;
50489
+ delete safeFetchOptions.credentials;
50490
+ }
50491
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
49637
50492
  signal: composedSignal,
49638
50493
  method: method.toUpperCase(),
49639
50494
  headers: toByteStringHeaderObject(headers.normalize()),
49640
50495
  body: data,
49641
50496
  duplex: "half",
49642
50497
  credentials: isCredentialsSupported ? withCredentials : void 0
49643
- };
50498
+ });
50499
+ if (isRequestSupported) {
50500
+ utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
50501
+ if (resolvedOptions[key] === void 0) {
50502
+ resolvedOptions[key] = value;
50503
+ }
50504
+ });
50505
+ if (resolvedOptions.signal === void 0) {
50506
+ resolvedOptions.signal = null;
50507
+ }
50508
+ if (resolvedOptions.body === void 0) {
50509
+ resolvedOptions.body = null;
50510
+ }
50511
+ }
50512
+ if (maxRedirects === 0) {
50513
+ resolvedOptions.redirect = "manual";
50514
+ if (safeFetchOptions) {
50515
+ safeFetchOptions.redirect = "manual";
50516
+ }
50517
+ }
49644
50518
  request = isRequestSupported && new Request(url2, resolvedOptions);
49645
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url2, resolvedOptions));
50519
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
49646
50520
  const responseHeaders = AxiosHeaders_default.from(response.headers);
49647
50521
  if (hasMaxContentLength) {
49648
50522
  const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
@@ -49861,9 +50735,10 @@ function throwIfCancellationRequested(config) {
49861
50735
  throw new CanceledError_default(null, config);
49862
50736
  }
49863
50737
  }
49864
- function dispatchRequest(config) {
50738
+ function dispatchRequest(_config) {
50739
+ const config = utils_default.toSafeFlatObject(_config);
49865
50740
  throwIfCancellationRequested(config);
49866
- config.headers = AxiosHeaders_default.from(config.headers);
50741
+ config.headers = AxiosHeaders_default.from(utils_default.getSafeProp(config, "headers"));
49867
50742
  config.data = transformData.call(config, config.transformRequest);
49868
50743
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
49869
50744
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -49993,16 +50868,15 @@ var Axios = class {
49993
50868
  return await this._request(configOrUrl, config);
49994
50869
  } catch (err) {
49995
50870
  if (err instanceof Error) {
49996
- let dummy = {};
49997
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
49998
- const stack = (() => {
49999
- if (!dummy.stack) {
50000
- return "";
50001
- }
50002
- const firstNewlineIndex = dummy.stack.indexOf("\n");
50003
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
50004
- })();
50005
50871
  try {
50872
+ let dummy = {};
50873
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
50874
+ const dummyStack = dummy.stack;
50875
+ let stack = "";
50876
+ if (typeof dummyStack === "string") {
50877
+ const firstNewlineIndex = dummyStack.indexOf("\n");
50878
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
50879
+ }
50006
50880
  if (!err.stack) {
50007
50881
  err.stack = stack;
50008
50882
  } else if (stack) {
@@ -50072,9 +50946,9 @@ var Axios = class {
50072
50946
  },
50073
50947
  true
50074
50948
  );
50075
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
50949
+ config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
50076
50950
  let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
50077
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
50951
+ headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
50078
50952
  delete headers[method];
50079
50953
  });
50080
50954
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
@@ -50337,14 +51211,22 @@ var HttpStatusCode = {
50337
51211
  Gone: 410,
50338
51212
  LengthRequired: 411,
50339
51213
  PreconditionFailed: 412,
51214
+ /**
51215
+ * @deprecated Use `ContentTooLarge` instead.
51216
+ */
50340
51217
  PayloadTooLarge: 413,
51218
+ ContentTooLarge: 413,
50341
51219
  UriTooLong: 414,
50342
51220
  UnsupportedMediaType: 415,
50343
51221
  RangeNotSatisfiable: 416,
50344
51222
  ExpectationFailed: 417,
50345
51223
  ImATeapot: 418,
50346
51224
  MisdirectedRequest: 421,
51225
+ /**
51226
+ * @deprecated Use `UnprocessableContent` instead.
51227
+ */
50347
51228
  UnprocessableEntity: 422,
51229
+ UnprocessableContent: 422,
50348
51230
  Locked: 423,
50349
51231
  FailedDependency: 424,
50350
51232
  TooEarly: 425,
@@ -50373,7 +51255,9 @@ var HttpStatusCode = {
50373
51255
  InvalidSslCertificate: 526
50374
51256
  };
50375
51257
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
50376
- HttpStatusCode[value] = key;
51258
+ if (HttpStatusCode[value] === void 0) {
51259
+ HttpStatusCode[value] = key;
51260
+ }
50377
51261
  });
50378
51262
  var HttpStatusCode_default = HttpStatusCode;
50379
51263
 
@@ -51553,6 +52437,9 @@ var require_pkg_src2 = __commonJS2({
51553
52437
  });
51554
52438
  var index_exports = {};
51555
52439
  __export22(index_exports, {
52440
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
52441
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
52442
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
51556
52443
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
51557
52444
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
51558
52445
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -51565,6 +52452,8 @@ var require_pkg_src2 = __commonJS2({
51565
52452
  PerformanceTracker: () => PerformanceTracker,
51566
52453
  RetryStrategy: () => RetryStrategy,
51567
52454
  analyzeError: () => analyzeError,
52455
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
52456
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
51568
52457
  calculateDelay: () => calculateDelay,
51569
52458
  cidToHex: () => cidToHex,
51570
52459
  classifyError: () => classifyError,
@@ -51811,30 +52700,30 @@ var require_pkg_src2 = __commonJS2({
51811
52700
  }
51812
52701
  },
51813
52702
  btcTransactionSigner: {
51814
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
52703
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
51815
52704
  authorizedCidHex: cidToHex(
51816
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
52705
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
51817
52706
  ),
51818
52707
  name: "Btc Transaction Signer",
51819
52708
  description: "Production Btc Transaction Signer",
51820
52709
  version: "1.1.1",
51821
52710
  deployed: true,
51822
- deployedAt: 1786465606156,
51823
- size: 67999,
51824
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
52711
+ deployedAt: 1787923905597,
52712
+ size: 70646,
52713
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
51825
52714
  },
51826
52715
  ucdMintValidator: {
51827
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
52716
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
51828
52717
  authorizedCidHex: cidToHex(
51829
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
52718
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
51830
52719
  ),
51831
52720
  name: "Ucd Mint Validator",
51832
52721
  description: "Production Ucd Mint Validator",
51833
52722
  version: "1.2.1",
51834
52723
  deployed: true,
51835
- deployedAt: 1786465627201,
51836
- size: 82739,
51837
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
52724
+ deployedAt: 1787923919527,
52725
+ size: 86197,
52726
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
51838
52727
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51839
52728
  pkp: {
51840
52729
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -51842,17 +52731,17 @@ var require_pkg_src2 = __commonJS2({
51842
52731
  }
51843
52732
  },
51844
52733
  processPaymentValidator: {
51845
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
52734
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
51846
52735
  authorizedCidHex: cidToHex(
51847
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
52736
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
51848
52737
  ),
51849
52738
  name: "Process Payment Validator",
51850
52739
  description: "Production Process Payment Validator",
51851
52740
  version: "1.2.1",
51852
52741
  deployed: true,
51853
- deployedAt: 1786465654796,
51854
- size: 78736,
51855
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
52742
+ deployedAt: 1787923987153,
52743
+ size: 82217,
52744
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
51856
52745
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51857
52746
  pkp: {
51858
52747
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -51860,17 +52749,17 @@ var require_pkg_src2 = __commonJS2({
51860
52749
  }
51861
52750
  },
51862
52751
  extendPositionValidator: {
51863
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
52752
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
51864
52753
  authorizedCidHex: cidToHex(
51865
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
52754
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
51866
52755
  ),
51867
52756
  name: "Extend Position Validator",
51868
52757
  description: "Production Extend Position Validator",
51869
52758
  version: "1.2.1",
51870
52759
  deployed: true,
51871
- deployedAt: 1786465681874,
51872
- size: 76515,
51873
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
52760
+ deployedAt: 1787923999294,
52761
+ size: 79975,
52762
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
51874
52763
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51875
52764
  pkp: {
51876
52765
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -51878,17 +52767,17 @@ var require_pkg_src2 = __commonJS2({
51878
52767
  }
51879
52768
  },
51880
52769
  btcWithdrawal: {
51881
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
52770
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
51882
52771
  authorizedCidHex: cidToHex(
51883
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
52772
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
51884
52773
  ),
51885
52774
  name: "Btc Withdrawal",
51886
52775
  description: "Production Btc Withdrawal",
51887
52776
  version: "1.2.7",
51888
52777
  deployed: true,
51889
- deployedAt: 1786446046614,
51890
- size: 97456,
51891
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
52778
+ deployedAt: 1787924017769,
52779
+ size: 100069,
52780
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
51892
52781
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51893
52782
  pkp: {
51894
52783
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -52000,30 +52889,30 @@ var require_pkg_src2 = __commonJS2({
52000
52889
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
52001
52890
  },
52002
52891
  agentModuleExecutor: {
52003
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
52892
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
52004
52893
  authorizedCidHex: cidToHex(
52005
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
52894
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
52006
52895
  ),
52007
52896
  name: "Agent Module Executor",
52008
52897
  description: "Production Agent Module Executor",
52009
52898
  version: "1.1.1",
52010
52899
  deployed: true,
52011
- deployedAt: 1786446108348,
52012
- size: 11655,
52013
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
52900
+ deployedAt: 1787924032013,
52901
+ size: 13878,
52902
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
52014
52903
  },
52015
52904
  staleSpendRecoveryValidator: {
52016
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
52905
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
52017
52906
  authorizedCidHex: cidToHex(
52018
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
52907
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
52019
52908
  ),
52020
52909
  name: "Stale Spend Recovery Validator",
52021
52910
  description: "Production Stale Spend Recovery Validator",
52022
52911
  version: "1.1.2",
52023
52912
  deployed: true,
52024
- deployedAt: 1785173285829,
52025
- size: 37108,
52026
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
52913
+ deployedAt: 1787924048772,
52914
+ size: 41424,
52915
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
52027
52916
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
52028
52917
  pkp: {
52029
52918
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -52031,17 +52920,17 @@ var require_pkg_src2 = __commonJS2({
52031
52920
  }
52032
52921
  },
52033
52922
  btcUtxoInvalidator: {
52034
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
52923
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
52035
52924
  authorizedCidHex: cidToHex(
52036
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
52925
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
52037
52926
  ),
52038
52927
  name: "Btc Utxo Invalidator",
52039
52928
  description: "Production Btc Utxo Invalidator",
52040
52929
  version: "1.0.0",
52041
52930
  deployed: true,
52042
- deployedAt: 1786465704240,
52043
- size: 62553,
52044
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
52931
+ deployedAt: 1787924133241,
52932
+ size: 66026,
52933
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
52045
52934
  }
52046
52935
  };
52047
52936
  function getDeploymentsForNetwork(network) {
@@ -52802,6 +53691,101 @@ ${errorReport}`);
52802
53691
  var SECONDS_PER_DAY = 86400;
52803
53692
  var DAYS_PER_MONTH = 30;
52804
53693
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
53694
+ var PINNED_CONTRACT_ADDRESSES = {
53695
+ 1: {
53696
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
53697
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
53698
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
53699
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
53700
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
53701
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
53702
+ },
53703
+ 11155111: {
53704
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
53705
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
53706
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
53707
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
53708
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
53709
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
53710
+ }
53711
+ };
53712
+ function getPinnedContractAddresses(chainId) {
53713
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
53714
+ }
53715
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
53716
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
53717
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
53718
+ MINT: "MintRequest",
53719
+ REPAY: "RepayRequest",
53720
+ RENEW: "RenewRequest",
53721
+ WITHDRAW: "WithdrawRequest"
53722
+ };
53723
+ var BORROWER_AUTHORIZATION_FIELDS = {
53724
+ MintRequest: [
53725
+ { name: "positionId", type: "bytes32" },
53726
+ { name: "mintAmount", type: "uint256" },
53727
+ { name: "quantumTimestamp", type: "uint256" }
53728
+ ],
53729
+ RepayRequest: [
53730
+ { name: "positionId", type: "bytes32" },
53731
+ { name: "paymentAmount", type: "uint256" },
53732
+ { name: "quantumTimestamp", type: "uint256" }
53733
+ ],
53734
+ RenewRequest: [
53735
+ { name: "positionId", type: "bytes32" },
53736
+ { name: "selectedTerm", type: "uint256" },
53737
+ { name: "quantumTimestamp", type: "uint256" }
53738
+ ],
53739
+ WithdrawRequest: [
53740
+ { name: "positionId", type: "bytes32" },
53741
+ { name: "totalDeduction", type: "uint256" },
53742
+ { name: "withdrawalAddress", type: "string" },
53743
+ { name: "quantumTimestamp", type: "uint256" }
53744
+ ]
53745
+ };
53746
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
53747
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
53748
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
53749
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
53750
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
53751
+ };
53752
+ function borrowerAuthorizationTypes(primaryType) {
53753
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
53754
+ if (!fields) {
53755
+ throw new Error(
53756
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
53757
+ );
53758
+ }
53759
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
53760
+ }
53761
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
53762
+ if (!Number.isInteger(chainId) || chainId <= 0) {
53763
+ throw new Error(
53764
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
53765
+ );
53766
+ }
53767
+ const pinned = getPinnedContractAddresses(chainId);
53768
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
53769
+ if (pinnedLom && verifyingContractOverride) {
53770
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
53771
+ throw new Error(
53772
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
53773
+ );
53774
+ }
53775
+ }
53776
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
53777
+ if (!verifyingContract) {
53778
+ throw new Error(
53779
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
53780
+ );
53781
+ }
53782
+ return {
53783
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
53784
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
53785
+ chainId,
53786
+ verifyingContract
53787
+ };
53788
+ }
52805
53789
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
52806
53790
  EVMChain3["SEPOLIA"] = "sepolia";
52807
53791
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -56597,6 +57581,77 @@ async function awaitSafeSubmissionWindowOnChain(signatureQuantum, chainNow, slee
56597
57581
  );
56598
57582
  return { waited: waitedSeconds > 0, waitedSeconds };
56599
57583
  }
57584
+ init_deployment_addresses();
57585
+ var BORROWER_AUTHORIZATION_712_DOMAIN_NAME = "DiamondHands.Protocol";
57586
+ var BORROWER_AUTHORIZATION_712_DOMAIN_VERSION = "1";
57587
+ var BORROWER_AUTHORIZATION_712_FIELDS = {
57588
+ MintRequest: [
57589
+ { name: "positionId", type: "bytes32" },
57590
+ { name: "mintAmount", type: "uint256" },
57591
+ { name: "quantumTimestamp", type: "uint256" }
57592
+ ],
57593
+ RepayRequest: [
57594
+ { name: "positionId", type: "bytes32" },
57595
+ { name: "paymentAmount", type: "uint256" },
57596
+ { name: "quantumTimestamp", type: "uint256" }
57597
+ ],
57598
+ RenewRequest: [
57599
+ { name: "positionId", type: "bytes32" },
57600
+ { name: "selectedTerm", type: "uint256" },
57601
+ { name: "quantumTimestamp", type: "uint256" }
57602
+ ],
57603
+ WithdrawRequest: [
57604
+ { name: "positionId", type: "bytes32" },
57605
+ { name: "totalDeduction", type: "uint256" },
57606
+ { name: "withdrawalAddress", type: "string" },
57607
+ { name: "quantumTimestamp", type: "uint256" }
57608
+ ]
57609
+ };
57610
+ function borrowerAuthorization712Types(primaryType) {
57611
+ const fields = BORROWER_AUTHORIZATION_712_FIELDS[primaryType];
57612
+ if (!fields) {
57613
+ throw new Error(
57614
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ` + Object.keys(BORROWER_AUTHORIZATION_712_FIELDS).join(", ")
57615
+ );
57616
+ }
57617
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
57618
+ }
57619
+ function buildBorrowerAuthorization712Domain(chainId) {
57620
+ if (!Number.isInteger(chainId) || chainId <= 0) {
57621
+ throw new Error(
57622
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
57623
+ );
57624
+ }
57625
+ const deployment = Object.values(ALL_DEPLOYMENTS).find(
57626
+ (d) => d.chainId === chainId
57627
+ );
57628
+ const verifyingContract = deployment?.contracts?.LoanOperationsManagerModule;
57629
+ if (!verifyingContract) {
57630
+ throw new Error(
57631
+ `No LoanOperationsManagerModule deployment known for chainId ${chainId}; refusing to build a borrower authorization domain without one`
57632
+ );
57633
+ }
57634
+ return {
57635
+ name: BORROWER_AUTHORIZATION_712_DOMAIN_NAME,
57636
+ version: BORROWER_AUTHORIZATION_712_DOMAIN_VERSION,
57637
+ chainId,
57638
+ verifyingContract
57639
+ };
57640
+ }
57641
+ async function signBorrowerAuthorization712(signer, primaryType, chainId, message) {
57642
+ const signTypedData = signer.signTypedData;
57643
+ if (typeof signTypedData !== "function") {
57644
+ throw new Error(
57645
+ `Signer has no signTypedData \u2014 cannot produce an EIP-712 ${primaryType}. Wallets without typed-data support must supply the signature via an authorizationProvider instead of a connected signer.`
57646
+ );
57647
+ }
57648
+ return signTypedData.call(
57649
+ signer,
57650
+ buildBorrowerAuthorization712Domain(chainId),
57651
+ borrowerAuthorization712Types(primaryType),
57652
+ message
57653
+ );
57654
+ }
56600
57655
  var PKP_NFT_ABI = [
56601
57656
  "function getPubkey(uint256 tokenId) external view returns (bytes memory)"
56602
57657
  ];
@@ -56609,29 +57664,11 @@ async function generateMintAuthorization(positionId, amount, chainId, signerOrPr
56609
57664
  const signer = signerOrPrecomputed;
56610
57665
  const timestamp = calculateNextQuantumTimestamp();
56611
57666
  const action = "mint-ucd";
56612
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56613
- const types = [
56614
- "bytes32",
56615
- // positionId
56616
- "uint256",
56617
- // timestamp
56618
- "uint256",
56619
- // chainId
56620
- "uint256",
56621
- // amount
56622
- "bytes32"
56623
- // actionHash
56624
- ];
56625
- const values = [
57667
+ const signature = await signBorrowerAuthorization712(signer, "MintRequest", chainId, {
56626
57668
  positionId,
56627
- timestamp,
56628
- chainId,
56629
- amount.toString(),
56630
- actionHash
56631
- ];
56632
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56633
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56634
- const signature = await signer.signMessage(messageHashBytes);
57669
+ mintAmount: amount.toString(),
57670
+ quantumTimestamp: timestamp
57671
+ });
56635
57672
  return {
56636
57673
  positionId,
56637
57674
  timestamp,
@@ -56668,44 +57705,17 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signerO
56668
57705
  throw new Error(`timestamp must be a number, got ${typeof timestamp}`);
56669
57706
  }
56670
57707
  const action = "make-payment";
56671
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56672
- if (typeof actionHash !== "string") {
56673
- throw new Error(`actionHash must be a string, got ${typeof actionHash}`);
56674
- }
56675
- const types = [
56676
- "bytes32",
56677
- // positionId
56678
- "uint256",
56679
- // timestamp
56680
- "uint256",
56681
- // chainId
56682
- "uint256",
56683
- // amount
56684
- "bytes32"
56685
- // actionHash
56686
- ];
56687
57708
  const amountStr = amount.toString();
56688
- if (typeof amountStr !== "string") {
56689
- throw new Error(
56690
- `amount.toString() must return a string, got ${typeof amountStr}`
56691
- );
56692
- }
56693
- const values = [positionId, timestamp, chainId, amountStr, actionHash];
56694
- for (let i = 0; i < values.length; i++) {
56695
- if (typeof values[i] === "object" && values[i] !== null) {
56696
- throw new Error(
56697
- `Value at index ${i} is an object: ${JSON.stringify(values[i])}`
56698
- );
56699
- }
56700
- }
56701
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56702
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56703
- const signature = await signer.signMessage(messageHashBytes);
57709
+ const signature = await signBorrowerAuthorization712(signer, "RepayRequest", chainId, {
57710
+ positionId,
57711
+ paymentAmount: amountStr,
57712
+ quantumTimestamp: timestamp
57713
+ });
56704
57714
  return {
56705
57715
  positionId,
56706
57716
  timestamp,
56707
57717
  chainId,
56708
- amount: amount.toString(),
57718
+ amount: amountStr,
56709
57719
  action,
56710
57720
  signature
56711
57721
  };
@@ -56792,32 +57802,12 @@ async function generateWithdrawAuthorization(positionId, amount, chainId, signer
56792
57802
  const signer = signerOrPrecomputed;
56793
57803
  const timestamp = calculateNextQuantumTimestamp();
56794
57804
  const action = "withdraw-btc";
56795
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56796
- const types = [
56797
- "bytes32",
56798
- // positionId
56799
- "uint256",
56800
- // timestamp
56801
- "uint256",
56802
- // chainId
56803
- "uint256",
56804
- // amount (in satoshis)
56805
- "string",
56806
- // destinationAddress (Bitcoin address)
56807
- "bytes32"
56808
- // actionHash
56809
- ];
56810
- const values = [
57805
+ const signature = await signBorrowerAuthorization712(signer, "WithdrawRequest", chainId, {
56811
57806
  positionId,
56812
- timestamp,
56813
- chainId,
56814
- amount.toString(),
56815
- destinationAddress,
56816
- actionHash
56817
- ];
56818
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56819
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56820
- const signature = await signer.signMessage(messageHashBytes);
57807
+ totalDeduction: amount.toString(),
57808
+ withdrawalAddress: destinationAddress,
57809
+ quantumTimestamp: timestamp
57810
+ });
56821
57811
  return {
56822
57812
  positionId,
56823
57813
  timestamp,
@@ -56866,29 +57856,11 @@ async function generateExtendAuthorization(positionId, newTerm, chainId, signerO
56866
57856
  const signer = signerOrPrecomputed;
56867
57857
  const timestamp = calculateNextQuantumTimestamp();
56868
57858
  const action = "extend-position";
56869
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
56870
- const types = [
56871
- "bytes32",
56872
- // positionId
56873
- "uint256",
56874
- // timestamp
56875
- "uint256",
56876
- // chainId
56877
- "uint256",
56878
- // newTerm (extension term in months)
56879
- "bytes32"
56880
- // actionHash
56881
- ];
56882
- const values = [
57859
+ const signature = await signBorrowerAuthorization712(signer, "RenewRequest", chainId, {
56883
57860
  positionId,
56884
- timestamp,
56885
- chainId,
56886
- newTerm,
56887
- actionHash
56888
- ];
56889
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
56890
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
56891
- const signature = await signer.signMessage(messageHashBytes);
57861
+ selectedTerm: newTerm,
57862
+ quantumTimestamp: timestamp
57863
+ });
56892
57864
  return {
56893
57865
  positionId,
56894
57866
  timestamp,
@@ -57123,6 +58095,7 @@ var ServerSession = class {
57123
58095
  store;
57124
58096
  onSignaturePrompt;
57125
58097
  onSignatureResolved;
58098
+ onSessionRestored;
57126
58099
  now;
57127
58100
  fetchImpl;
57128
58101
  cached = null;
@@ -57163,6 +58136,7 @@ var ServerSession = class {
57163
58136
  this.store = opts.persistSession === false ? null : opts.sessionStore ?? createDefaultSessionStore();
57164
58137
  this.onSignaturePrompt = opts.onSignaturePrompt;
57165
58138
  this.onSignatureResolved = opts.onSignatureResolved;
58139
+ this.onSessionRestored = opts.onSessionRestored;
57166
58140
  this.now = opts.now ?? (() => Math.floor(Date.now() / 1e3));
57167
58141
  this.fetchImpl = opts.fetchImpl ?? ((...a) => fetch(...a));
57168
58142
  }
@@ -57243,7 +58217,7 @@ var ServerSession = class {
57243
58217
  */
57244
58218
  async logout() {
57245
58219
  const cached = this.cached;
57246
- const token = cached && cached.expiresAt > this.now() ? cached.token : await this.getValidToken({ silent: true }).catch(() => null);
58220
+ const token = cached && cached.expiresAt > this.now() ? cached.token : await this.tryResolveSilently(this.generation, false).then((session) => session?.token ?? null).catch(() => null);
57247
58221
  await this.clearPersisted();
57248
58222
  if (!token)
57249
58223
  return;
@@ -57315,8 +58289,9 @@ var ServerSession = class {
57315
58289
  *
57316
58290
  * `gen` is the caller's clear-generation snapshot: writes to `this.cached`
57317
58291
  * and the store are skipped if a `clearPersisted()` landed meanwhile.
58292
+ * `announce` gates `onSessionRestored` for the two persisted-store outcomes.
57318
58293
  */
57319
- async tryResolveSilently(gen) {
58294
+ async tryResolveSilently(gen, announce = true) {
57320
58295
  const nowSec = this.now();
57321
58296
  if (this.cached && this.cached.expiresAt - REFRESH_LEEWAY_SECONDS > nowSec) {
57322
58297
  return this.cached;
@@ -57331,6 +58306,8 @@ var ServerSession = class {
57331
58306
  };
57332
58307
  if (gen === this.generation)
57333
58308
  this.cached = adopted;
58309
+ if (announce)
58310
+ this.onSessionRestored?.();
57334
58311
  return adopted;
57335
58312
  }
57336
58313
  try {
@@ -57339,6 +58316,8 @@ var ServerSession = class {
57339
58316
  this.persist(persisted.payload, session);
57340
58317
  this.cached = session;
57341
58318
  }
58319
+ if (announce)
58320
+ this.onSessionRestored?.();
57342
58321
  return session;
57343
58322
  } catch (error) {
57344
58323
  if (!isLoginRejection(error))
@@ -60424,6 +61403,10 @@ function normalizePkpId(pkpId) {
60424
61403
  }
60425
61404
  return pkpId;
60426
61405
  }
61406
+ function isNormalizedChipotlePkpId(pkpId) {
61407
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
61408
+ return rawId.length === 40;
61409
+ }
60427
61410
  function padPkpIdForSubgraph(pkpId) {
60428
61411
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
60429
61412
  if (raw.length === 40) {
@@ -60708,7 +61691,7 @@ var LoanQuery = class {
60708
61691
  batch.map(async (loan) => {
60709
61692
  try {
60710
61693
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
60711
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
61694
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
60712
61695
  if (isChipotlePkpId2) {
60713
61696
  if (this.config.positionManagerCoreAddress && this.config.provider) {
60714
61697
  const pmContract = new import_ethers25.Contract(
@@ -61035,6 +62018,7 @@ function createLoanQuery(config) {
61035
62018
  );
61036
62019
  }
61037
62020
  }
62021
+ var STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS = 5e3;
61038
62022
  var WithdrawalAddressModule = class {
61039
62023
  config;
61040
62024
  graphClient;
@@ -61080,13 +62064,17 @@ var WithdrawalAddressModule = class {
61080
62064
  const reg = this.getRegistry();
61081
62065
  if (!reg.success)
61082
62066
  return reg;
62067
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61083
62068
  try {
61084
- const tx2 = await reg.value.addAddress(
61085
- normalizeBitcoinAddress(btcAddress2)
61086
- );
62069
+ const tx2 = await reg.value.addAddress(normalized);
61087
62070
  return success(tx2);
61088
62071
  } catch (error) {
61089
- return this.txFailure("addAddress", error, btcAddress2);
62072
+ return this.txFailure(
62073
+ "addAddress",
62074
+ error,
62075
+ btcAddress2,
62076
+ await this.staticCallDiagnostic(reg.value, "addAddress", normalized)
62077
+ );
61090
62078
  }
61091
62079
  }
61092
62080
  /** Remove a Bitcoin address from the caller's allowlist (effective immediately). */
@@ -61094,13 +62082,17 @@ var WithdrawalAddressModule = class {
61094
62082
  const reg = this.getRegistry();
61095
62083
  if (!reg.success)
61096
62084
  return reg;
62085
+ const normalized = normalizeBitcoinAddress(btcAddress2);
61097
62086
  try {
61098
- const tx2 = await reg.value.removeAddress(
61099
- normalizeBitcoinAddress(btcAddress2)
61100
- );
62087
+ const tx2 = await reg.value.removeAddress(normalized);
61101
62088
  return success(tx2);
61102
62089
  } catch (error) {
61103
- return this.txFailure("removeAddress", error, btcAddress2);
62090
+ return this.txFailure(
62091
+ "removeAddress",
62092
+ error,
62093
+ btcAddress2,
62094
+ await this.staticCallDiagnostic(reg.value, "removeAddress", normalized)
62095
+ );
61104
62096
  }
61105
62097
  }
61106
62098
  /**
@@ -61196,16 +62188,59 @@ var WithdrawalAddressModule = class {
61196
62188
  }
61197
62189
  return success(void 0);
61198
62190
  }
61199
- txFailure(op, error, context) {
62191
+ /**
62192
+ * Ask the node for the reason a failed write did not carry.
62193
+ *
62194
+ * A failing `eth_estimateGas` frequently answers with NOTHING to decode — ethers renders that
62195
+ * as `missing revert data ... data=null, reason=null, revert=null`, which names no cause and
62196
+ * cannot distinguish "the contract rejected this" from "the RPC hiccuped". An `eth_call` of the
62197
+ * same calldata usually does carry the revert reason or custom-error selector, so this runs one
62198
+ * and folds the answer into the reported error.
62199
+ *
62200
+ * Three deliberate properties:
62201
+ *
62202
+ * 1. It runs ONLY after the write has already failed. Gating the write on a static call would
62203
+ * let a flaky endpoint — precisely the condition this exists to diagnose — block an add that
62204
+ * would otherwise have succeeded.
62205
+ * 2. It costs NO extra signature. `staticCall` is `eth_call`: a node read, never a wallet prompt.
62206
+ * 3. It can never throw. A diagnostic that escapes would replace the real cause with itself.
62207
+ * (The `try/catch` here is the authorized exception to CLAUDE.md's forbidden-patterns rule;
62208
+ * it swallows nothing — every branch returns text that is reported alongside the original.)
62209
+ *
62210
+ * A static call that SUCCEEDS is itself a finding: the contract accepts this call, so the
62211
+ * failure lay outside contract logic (RPC, gas, or nonce).
62212
+ */
62213
+ async staticCallDiagnostic(registry, op, normalizedAddress) {
62214
+ try {
62215
+ await Promise.race([
62216
+ registry[op].staticCall(normalizedAddress),
62217
+ // The failure being diagnosed is often an unresponsive endpoint, so the diagnostic must
62218
+ // not inherit that hang — the user is waiting on this error message.
62219
+ new Promise(
62220
+ (_, reject) => setTimeout(
62221
+ () => reject(new Error("static call timed out after 5s")),
62222
+ STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS
62223
+ )
62224
+ )
62225
+ ]);
62226
+ return "static call SUCCEEDED \u2014 the contract accepts this call, so the failure was not contract logic (RPC, gas, or nonce)";
62227
+ } catch (diagnostic) {
62228
+ const code = typeof diagnostic === "object" && diagnostic !== null ? diagnostic.code : void 0;
62229
+ const msg = diagnostic instanceof Error ? diagnostic.message : String(diagnostic);
62230
+ return typeof code === "string" ? `static call reverted [${code}]: ${msg}` : `static call failed: ${msg}`;
62231
+ }
62232
+ }
62233
+ txFailure(op, error, context, diagnostic) {
61200
62234
  const msg = error instanceof Error ? error.message : String(error);
62235
+ const detail = diagnostic ? `${msg} \u2014 ${diagnostic}` : msg;
61201
62236
  return failure(
61202
62237
  new SDKError({
61203
62238
  code: `SDK_WITHDRAWAL_REGISTRY_${op.toUpperCase()}_FAILED`,
61204
- message: `WithdrawalAddressRegistry.${op} failed: ${msg}`,
62239
+ message: `WithdrawalAddressRegistry.${op} failed: ${detail}`,
61205
62240
  category: "CONTRACT",
61206
62241
  severity: "MEDIUM",
61207
62242
  originalError: error instanceof Error ? error : new Error(String(error)),
61208
- context: { op, context }
62243
+ context: { op, context, diagnostic }
61209
62244
  })
61210
62245
  );
61211
62246
  }
@@ -62283,6 +63318,47 @@ function normalizePkpId2(pkpId) {
62283
63318
  }
62284
63319
  return pkpId;
62285
63320
  }
63321
+ function applyLoanEventsFilter(events, opts) {
63322
+ const { wantsEvent, fromTimestamp, toTimestamp, fromBlock, toBlock, limit } = opts;
63323
+ const inBounds = (e) => {
63324
+ const ts = e?.timestamp;
63325
+ const bn = e?.blockNumber;
63326
+ try {
63327
+ if (fromTimestamp !== void 0 && ts !== void 0 && BigInt(ts) < BigInt(fromTimestamp))
63328
+ return false;
63329
+ if (toTimestamp !== void 0 && ts !== void 0 && BigInt(ts) > BigInt(toTimestamp))
63330
+ return false;
63331
+ if (fromBlock !== void 0 && bn !== void 0 && BigInt(bn) < BigInt(fromBlock))
63332
+ return false;
63333
+ if (toBlock !== void 0 && bn !== void 0 && BigInt(bn) > BigInt(toBlock))
63334
+ return false;
63335
+ } catch {
63336
+ return true;
63337
+ }
63338
+ return true;
63339
+ };
63340
+ const narrow = (list, kind) => wantsEvent(kind) ? (list ?? []).filter(inBounds).slice(0, limit) : [];
63341
+ const single = (value, kind) => value && wantsEvent(kind) && inBounds(value) ? value : void 0;
63342
+ const filtered = {
63343
+ ...events,
63344
+ positionCreated: single(events.positionCreated, "positionCreated"),
63345
+ payments: narrow(events.payments, "payment"),
63346
+ statusUpdates: narrow(events.statusUpdates, "status"),
63347
+ liquidation: single(events.liquidation, "liquidation"),
63348
+ mints: narrow(events.mints, "mint"),
63349
+ withdrawals: narrow(events.withdrawals, "withdrawal"),
63350
+ renewals: narrow(events.renewals, "renewal"),
63351
+ operationFailures: narrow(events.operationFailures, "operationFailure"),
63352
+ mintRequests: narrow(events.mintRequests, "mintRequest"),
63353
+ burnRequests: narrow(events.burnRequests, "burnRequest"),
63354
+ collateralEvents: narrow(events.collateralEvents, "collateralEvent"),
63355
+ mintingFees: narrow(events.mintingFees, "mintingFee"),
63356
+ renewalFees: narrow(events.renewalFees, "renewalFee"),
63357
+ totalEvents: 0
63358
+ };
63359
+ filtered.totalEvents = (filtered.positionCreated ? 1 : 0) + (filtered.liquidation ? 1 : 0) + filtered.payments.length + filtered.statusUpdates.length + filtered.mints.length + filtered.withdrawals.length + filtered.renewals.length + filtered.operationFailures.length + filtered.mintRequests.length + filtered.burnRequests.length + filtered.collateralEvents.length + filtered.mintingFees.length + filtered.renewalFees.length;
63360
+ return filtered;
63361
+ }
62286
63362
  function hasLoanEventsFilter(filter2) {
62287
63363
  if (!filter2)
62288
63364
  return false;
@@ -63439,32 +64515,24 @@ var DiamondHandsGraph = class {
63439
64515
  limit = 1e3,
63440
64516
  orderDirection = "desc"
63441
64517
  } = filter2 || {};
64518
+ const wantsEvent = (kind) => !eventTypes || eventTypes.includes(kind);
64519
+ const hasBounds = fromTimestamp !== void 0 || toTimestamp !== void 0 || fromBlock !== void 0 || toBlock !== void 0;
64520
+ const pageSize = hasBounds ? THE_GRAPH_MAX_BATCH_SIZE : limit;
64521
+ const buildPositionWhereClause = () => `where: { position: "${positionId.toLowerCase()}" }`;
63442
64522
  const shouldQuery = {
63443
- positionCreated: !eventTypes || eventTypes.includes("positionCreated"),
63444
- payment: !eventTypes || eventTypes.includes("payment"),
63445
- status: !eventTypes || eventTypes.includes("status"),
63446
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
63447
- mint: !eventTypes || eventTypes.includes("mint"),
63448
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
63449
- renewal: !eventTypes || eventTypes.includes("renewal"),
63450
- operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
63451
- mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
63452
- burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
63453
- collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
63454
- mintingFee: !eventTypes || eventTypes.includes("mintingFee"),
63455
- renewalFee: !eventTypes || eventTypes.includes("renewalFee")
63456
- };
63457
- const buildPositionWhereClause = () => {
63458
- const conditions = [`position: "${positionId.toLowerCase()}"`];
63459
- if (fromTimestamp)
63460
- conditions.push(`timestamp_gte: "${fromTimestamp}"`);
63461
- if (toTimestamp)
63462
- conditions.push(`timestamp_lte: "${toTimestamp}"`);
63463
- if (fromBlock)
63464
- conditions.push(`blockNumber_gte: "${fromBlock}"`);
63465
- if (toBlock)
63466
- conditions.push(`blockNumber_lte: "${toBlock}"`);
63467
- return `where: { ${conditions.join(", ")} }`;
64523
+ positionCreated: true,
64524
+ payment: true,
64525
+ status: true,
64526
+ liquidation: true,
64527
+ mint: true,
64528
+ withdrawal: true,
64529
+ renewal: true,
64530
+ operationFailure: true,
64531
+ mintRequest: true,
64532
+ burnRequest: true,
64533
+ collateralEvent: true,
64534
+ mintingFee: true,
64535
+ renewalFee: true
63468
64536
  };
63469
64537
  const query = `
63470
64538
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -63700,11 +64768,41 @@ var DiamondHandsGraph = class {
63700
64768
  `;
63701
64769
  const variables = {
63702
64770
  positionId: positionId.toLowerCase(),
63703
- limit,
64771
+ limit: pageSize,
63704
64772
  orderDirection
63705
64773
  };
63706
64774
  const result = await this.client.execute(query, variables);
63707
- return this.assembleLoanEvents(positionId, result);
64775
+ if (hasBounds) {
64776
+ const collections = [
64777
+ ["payments", result.position?.payments],
64778
+ ["statusUpdates", result.position?.statusUpdates],
64779
+ ["withdrawals", result.position?.withdrawals],
64780
+ ["renewals", result.position?.renewals],
64781
+ ["operationFailures", result.position?.operationFailures],
64782
+ ["mintRequests", result.position?.mintRequests],
64783
+ ["burnRequests", result.position?.burnRequests],
64784
+ ["mintingFees", result.position?.mintingFees],
64785
+ ["renewalFees", result.position?.renewalFees],
64786
+ ["mints", result.ucdmintEvents],
64787
+ ["collateralEvents", result.collateralEvents]
64788
+ ];
64789
+ const saturated = collections.filter(([, list]) => (list?.length ?? 0) >= pageSize).map(([name]) => name);
64790
+ if (saturated.length > 0) {
64791
+ log.warn(
64792
+ "[DiamondHandsGraph] bounded getLoanEvents page saturated \u2014 the filtered history may be incomplete",
64793
+ { positionId, pageSize, saturated }
64794
+ );
64795
+ }
64796
+ }
64797
+ const assembled = this.assembleLoanEvents(positionId, result);
64798
+ return applyLoanEventsFilter(assembled, {
64799
+ wantsEvent,
64800
+ fromTimestamp,
64801
+ toTimestamp,
64802
+ fromBlock,
64803
+ toBlock,
64804
+ limit
64805
+ });
63708
64806
  }
63709
64807
  /**
63710
64808
  * Map one position's raw event payload into `LoanEvents`.
@@ -69507,7 +70605,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
69507
70605
  persistSession: config.sessionPersistence?.enabled,
69508
70606
  sessionStore: config.sessionPersistence?.store,
69509
70607
  onSignaturePrompt: config.onSessionSignaturePrompt,
69510
- onSignatureResolved: config.onSessionSignatureResolved
70608
+ onSignatureResolved: config.onSessionSignatureResolved,
70609
+ onSessionRestored: config.onSessionRestored
69511
70610
  });
69512
70611
  }
69513
70612
  const contractManagerResult = createContractManager({
@@ -82837,7 +83936,7 @@ mime-types/index.js:
82837
83936
  *)
82838
83937
 
82839
83938
  axios/dist/node/axios.cjs:
82840
- (*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
83939
+ (*! Axios v1.20.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
82841
83940
 
82842
83941
  safe-buffer/index.js:
82843
83942
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)