@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/boundary.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);
@@ -45024,22 +45503,82 @@ var { toString } = Object.prototype;
45024
45503
  var { getPrototypeOf } = Object;
45025
45504
  var { iterator, toStringTag } = Symbol;
45026
45505
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
45506
+ var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
45507
+ var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
45508
+ var isSafeAndFullyMutable = (obj) => {
45509
+ if (!Object.isExtensible(obj)) {
45510
+ return false;
45511
+ }
45512
+ const props = Object.getOwnPropertyNames(obj);
45513
+ if (Object.getOwnPropertySymbols) {
45514
+ props.push(...Object.getOwnPropertySymbols(obj));
45515
+ }
45516
+ return props.every((prop) => {
45517
+ if (isUnsafeObjectKey(prop)) {
45518
+ return false;
45519
+ }
45520
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
45521
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
45522
+ });
45523
+ };
45027
45524
  var hasOwnInPrototypeChain = (thing, prop) => {
45028
45525
  let obj = thing;
45029
45526
  const seen = [];
45030
- while (obj != null && obj !== Object.prototype) {
45527
+ while (obj != null) {
45031
45528
  if (seen.indexOf(obj) !== -1) {
45032
45529
  return false;
45033
45530
  }
45034
45531
  seen.push(obj);
45532
+ const prototype2 = getPrototypeOf(obj);
45533
+ if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
45534
+ return false;
45535
+ }
45035
45536
  if (hasOwnProperty(obj, prop)) {
45036
45537
  return true;
45037
45538
  }
45038
- obj = getPrototypeOf(obj);
45539
+ obj = prototype2;
45039
45540
  }
45040
45541
  return false;
45041
45542
  };
45042
45543
  var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
45544
+ var toSafeFlatObject = (thing) => {
45545
+ if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
45546
+ return thing;
45547
+ }
45548
+ const sourcePrototype = getPrototypeOf(thing);
45549
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
45550
+ return thing;
45551
+ }
45552
+ const result = /* @__PURE__ */ Object.create(null);
45553
+ const merged = /* @__PURE__ */ Object.create(null);
45554
+ const seen = [];
45555
+ let current = thing;
45556
+ while (current != null) {
45557
+ if (seen.indexOf(current) !== -1) {
45558
+ break;
45559
+ }
45560
+ seen.push(current);
45561
+ const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
45562
+ if (isPrototypeBoundary(current, prototype2, current === thing)) {
45563
+ break;
45564
+ }
45565
+ const props = Object.getOwnPropertyNames(current);
45566
+ if (Object.getOwnPropertySymbols) {
45567
+ props.push(...Object.getOwnPropertySymbols(current));
45568
+ }
45569
+ for (const prop of props) {
45570
+ if (isUnsafeObjectKey(prop)) {
45571
+ continue;
45572
+ }
45573
+ if (!hasOwnProperty(merged, prop)) {
45574
+ result[prop] = thing[prop];
45575
+ merged[prop] = true;
45576
+ }
45577
+ }
45578
+ current = prototype2;
45579
+ }
45580
+ return result;
45581
+ };
45043
45582
  var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
45044
45583
  const str = toString.call(thing);
45045
45584
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -45074,9 +45613,9 @@ var isPlainObject = (val) => {
45074
45613
  return false;
45075
45614
  }
45076
45615
  const prototype2 = getPrototypeOf(val);
45077
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
45078
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
45079
- // than a plain object, while ignoring keys injected onto Object.prototype.
45616
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
45617
+ // evidence the value is tagged/iterable, while ignoring members reachable
45618
+ // only through shared or terminal prototype boundaries.
45080
45619
  !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
45081
45620
  };
45082
45621
  var isEmptyObject = (val) => {
@@ -45487,6 +46026,7 @@ var utils_default = {
45487
46026
  // an alias to avoid ESLint no-prototype-builtins detection
45488
46027
  hasOwnInPrototypeChain,
45489
46028
  getSafeProp,
46029
+ toSafeFlatObject,
45490
46030
  reduceDescriptors,
45491
46031
  freezeMethods,
45492
46032
  toObjectSet,
@@ -46125,24 +46665,16 @@ function toFormData(obj, formData, options) {
46125
46665
  throw new TypeError("target must be an object");
46126
46666
  }
46127
46667
  formData = formData || new (FormData_default || FormData)();
46128
- options = utils_default.toFlatObject(
46129
- options,
46130
- {
46131
- metaTokens: true,
46132
- dots: false,
46133
- indexes: false
46134
- },
46135
- false,
46136
- function defined(option, source) {
46137
- return !utils_default.isUndefined(source[option]);
46138
- }
46139
- );
46140
- const metaTokens = options.metaTokens;
46141
- const visitor = options.visitor || defaultVisitor;
46142
- const dots = options.dots;
46143
- const indexes = options.indexes;
46144
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
46145
- const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
46668
+ const option = (name, fallback) => {
46669
+ const value = utils_default.getSafeProp(options, name);
46670
+ return utils_default.isUndefined(value) ? fallback : value;
46671
+ };
46672
+ const metaTokens = option("metaTokens", true);
46673
+ const visitor = option("visitor") || defaultVisitor;
46674
+ const dots = option("dots", false);
46675
+ const indexes = option("indexes", false);
46676
+ const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
46677
+ const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
46146
46678
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
46147
46679
  const stack = [];
46148
46680
  if (!utils_default.isFunction(visitor)) {
@@ -46166,7 +46698,10 @@ function toFormData(obj, formData, options) {
46166
46698
  if (Buffer_default && Buffer_default.isBufferAvailable()) {
46167
46699
  return Buffer_default.from(value);
46168
46700
  }
46169
- throw new AxiosError_default("Blob is not supported. Use a Buffer instead.", AxiosError_default.ERR_NOT_SUPPORT);
46701
+ throw new AxiosError_default(
46702
+ "Blob is not supported. Use a Buffer instead.",
46703
+ AxiosError_default.ERR_NOT_SUPPORT
46704
+ );
46170
46705
  }
46171
46706
  return value;
46172
46707
  }
@@ -46312,9 +46847,47 @@ function buildURL(url2, params, options) {
46312
46847
  }
46313
46848
 
46314
46849
  // node_modules/axios/lib/core/InterceptorManager.js
46850
+ var $internals2 = Symbol("internals");
46851
+ function countHandlers(handlers) {
46852
+ return handlers ? handlers.length : 0;
46853
+ }
46854
+ function trimHandlers(handlers) {
46855
+ if (!handlers) {
46856
+ return;
46857
+ }
46858
+ while (handlers.length && handlers[handlers.length - 1] === null) {
46859
+ handlers.pop();
46860
+ }
46861
+ }
46862
+ function syncHandlerEntries(manager, internals) {
46863
+ const handlers = manager.handlers;
46864
+ const length = countHandlers(handlers);
46865
+ if (handlers !== internals.handlersRef) {
46866
+ internals.handlersRef = handlers;
46867
+ internals.handlerEntries.clear();
46868
+ } else if (length !== internals.handlersLength) {
46869
+ if (!length) {
46870
+ internals.handlerEntries.clear();
46871
+ } else {
46872
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
46873
+ if (handlers[entry.index] !== entry.handler) {
46874
+ internals.handlerEntries.delete(id);
46875
+ }
46876
+ });
46877
+ }
46878
+ }
46879
+ internals.handlersLength = length;
46880
+ }
46315
46881
  var InterceptorManager = class {
46316
46882
  constructor() {
46317
46883
  this.handlers = [];
46884
+ this[$internals2] = {
46885
+ handlersRef: this.handlers,
46886
+ handlersLength: this.handlers.length,
46887
+ handlerEntries: /* @__PURE__ */ new Map(),
46888
+ iterationDepth: 0,
46889
+ nextId: 0
46890
+ };
46318
46891
  }
46319
46892
  /**
46320
46893
  * Add a new interceptor to the stack
@@ -46326,13 +46899,25 @@ var InterceptorManager = class {
46326
46899
  * @return {Number} An ID used to remove interceptor later
46327
46900
  */
46328
46901
  use(fulfilled, rejected, options) {
46329
- this.handlers.push({
46902
+ const handler = {
46330
46903
  fulfilled,
46331
46904
  rejected,
46332
46905
  synchronous: options ? options.synchronous : false,
46333
46906
  runWhen: options ? options.runWhen : null
46907
+ };
46908
+ const internals = this[$internals2];
46909
+ if (this.handlers == null) {
46910
+ this.handlers = [];
46911
+ }
46912
+ syncHandlerEntries(this, internals);
46913
+ const id = internals.nextId++;
46914
+ this.handlers.push(handler);
46915
+ internals.handlerEntries.set(id, {
46916
+ handler,
46917
+ index: this.handlers.length - 1
46334
46918
  });
46335
- return this.handlers.length - 1;
46919
+ internals.handlersLength = this.handlers.length;
46920
+ return id;
46336
46921
  }
46337
46922
  /**
46338
46923
  * Remove an interceptor from the stack
@@ -46342,8 +46927,19 @@ var InterceptorManager = class {
46342
46927
  * @returns {void}
46343
46928
  */
46344
46929
  eject(id) {
46345
- if (this.handlers[id]) {
46346
- this.handlers[id] = null;
46930
+ const internals = this[$internals2];
46931
+ syncHandlerEntries(this, internals);
46932
+ const entry = internals.handlerEntries.get(id);
46933
+ if (entry) {
46934
+ internals.handlerEntries.delete(id);
46935
+ if (this.handlers[entry.index] !== entry.handler) {
46936
+ return;
46937
+ }
46938
+ this.handlers[entry.index] = null;
46939
+ if (!internals.iterationDepth) {
46940
+ trimHandlers(this.handlers);
46941
+ internals.handlersLength = this.handlers.length;
46942
+ }
46347
46943
  }
46348
46944
  }
46349
46945
  /**
@@ -46354,6 +46950,7 @@ var InterceptorManager = class {
46354
46950
  clear() {
46355
46951
  if (this.handlers) {
46356
46952
  this.handlers = [];
46953
+ syncHandlerEntries(this, this[$internals2]);
46357
46954
  }
46358
46955
  }
46359
46956
  /**
@@ -46367,11 +46964,22 @@ var InterceptorManager = class {
46367
46964
  * @returns {void}
46368
46965
  */
46369
46966
  forEach(fn) {
46370
- utils_default.forEach(this.handlers, function forEachHandler(h) {
46371
- if (h !== null) {
46372
- fn(h);
46967
+ const internals = this[$internals2];
46968
+ syncHandlerEntries(this, internals);
46969
+ internals.iterationDepth++;
46970
+ try {
46971
+ utils_default.forEach(this.handlers, function forEachHandler(h) {
46972
+ if (h !== null) {
46973
+ fn(h);
46974
+ }
46975
+ });
46976
+ } finally {
46977
+ if (!--internals.iterationDepth) {
46978
+ syncHandlerEntries(this, internals);
46979
+ trimHandlers(this.handlers);
46980
+ internals.handlersLength = countHandlers(this.handlers);
46373
46981
  }
46374
- });
46982
+ }
46375
46983
  }
46376
46984
  };
46377
46985
  var InterceptorManager_default = InterceptorManager;
@@ -46529,6 +47137,22 @@ function formDataToJSON(formData) {
46529
47137
  }
46530
47138
  var formDataToJSON_default = formDataToJSON;
46531
47139
 
47140
+ // node_modules/axios/lib/core/methodList.js
47141
+ var methodList = Object.freeze([
47142
+ "get",
47143
+ "delete",
47144
+ "head",
47145
+ "options",
47146
+ "post",
47147
+ "put",
47148
+ "patch",
47149
+ "purge",
47150
+ "link",
47151
+ "unlink",
47152
+ "query"
47153
+ ]);
47154
+ var methodList_default = methodList;
47155
+
46532
47156
  // node_modules/axios/lib/defaults/index.js
46533
47157
  var own = (obj, key) => obj != null && utils_default.hasOwnProp(obj, key) ? obj[key] : void 0;
46534
47158
  function stringifySafely2(rawValue, parser, encoder) {
@@ -46641,7 +47265,7 @@ var defaults = {
46641
47265
  }
46642
47266
  }
46643
47267
  };
46644
- utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query"], (method) => {
47268
+ utils_default.forEach(methodList_default, (method) => {
46645
47269
  defaults.headers[method] = {};
46646
47270
  });
46647
47271
  var defaults_default = defaults;
@@ -46719,19 +47343,21 @@ function combineURLs(baseURL, relativeURL) {
46719
47343
  return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
46720
47344
  }
46721
47345
 
46722
- // node_modules/axios/lib/core/buildFullPath.js
46723
- var malformedHttpProtocol = /^https?:(?!\/\/)/i;
46724
- var httpProtocolControlCharacters = /[\t\n\r]/g;
46725
- function stripLeadingC0ControlOrSpace(url2) {
46726
- let i = 0;
46727
- while (i < url2.length && url2.charCodeAt(i) <= 32) {
46728
- i++;
46729
- }
46730
- return url2.slice(i);
46731
- }
47346
+ // node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js
47347
+ var urlParserControlCharacters = /[\t\n\r]/g;
46732
47348
  function normalizeURLForProtocolCheck(url2) {
46733
- return stripLeadingC0ControlOrSpace(url2).replace(httpProtocolControlCharacters, "");
47349
+ if (typeof url2 !== "string") {
47350
+ return url2;
47351
+ }
47352
+ let start = 0;
47353
+ while (start < url2.length && url2.charCodeAt(start) <= 32) {
47354
+ start++;
47355
+ }
47356
+ return url2.slice(start).replace(urlParserControlCharacters, "");
46734
47357
  }
47358
+
47359
+ // node_modules/axios/lib/core/buildFullPath.js
47360
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
46735
47361
  function redactFragment(fragment) {
46736
47362
  if (!fragment) {
46737
47363
  return fragment;
@@ -46853,7 +47479,7 @@ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
46853
47479
  var import_zlib = __toESM(require("zlib"), 1);
46854
47480
 
46855
47481
  // node_modules/axios/lib/env/data.js
46856
- var VERSION = "1.19.0";
47482
+ var VERSION = "1.20.0";
46857
47483
 
46858
47484
  // node_modules/axios/lib/helpers/parseProtocol.js
46859
47485
  function parseProtocol(url2) {
@@ -46862,7 +47488,7 @@ function parseProtocol(url2) {
46862
47488
  }
46863
47489
 
46864
47490
  // node_modules/axios/lib/helpers/fromDataURI.js
46865
- var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
47491
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
46866
47492
  function fromDataURI(uri, asBlob, options) {
46867
47493
  const _Blob = options && options.Blob || platform_default.classes.Blob;
46868
47494
  const protocol = parseProtocol(uri);
@@ -47175,6 +47801,7 @@ var Http2Sessions = class {
47175
47801
  }
47176
47802
  getSession(authority, options) {
47177
47803
  options = Object.assign(
47804
+ /* @__PURE__ */ Object.create(null),
47178
47805
  {
47179
47806
  sessionTimeout: 1e3
47180
47807
  },
@@ -47240,6 +47867,7 @@ var Http2Sessions = class {
47240
47867
  };
47241
47868
  }
47242
47869
  session.once("close", removeSession);
47870
+ session.once("error", removeSession);
47243
47871
  let entry = [session, options];
47244
47872
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
47245
47873
  return session;
@@ -47264,6 +47892,13 @@ var callbackify_default = callbackify;
47264
47892
 
47265
47893
  // node_modules/axios/lib/helpers/shouldBypassProxy.js
47266
47894
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
47895
+ var trimTrailingDots = (value) => {
47896
+ let end = value.length;
47897
+ while (end && value.charCodeAt(end - 1) === 46) {
47898
+ end--;
47899
+ }
47900
+ return end === value.length ? value : value.slice(0, end);
47901
+ };
47267
47902
  var isIPv4Loopback = (host) => {
47268
47903
  const parts = host.split(".");
47269
47904
  if (parts.length !== 4) return false;
@@ -47296,7 +47931,7 @@ var normalizeIPAddress = (host) => {
47296
47931
  if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
47297
47932
  h = h.slice(1, -1);
47298
47933
  }
47299
- h = h.replace(/\.+$/, "");
47934
+ h = trimTrailingDots(h);
47300
47935
  if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
47301
47936
  const parts = h.split(".");
47302
47937
  if (parts.some((p) => p === "")) return host;
@@ -47408,6 +48043,40 @@ var unmapIPv4MappedIPv6 = (host) => {
47408
48043
  }
47409
48044
  return host;
47410
48045
  };
48046
+ var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
48047
+ var ipv4ToBytes = (host) => {
48048
+ const parts = host.split(".");
48049
+ return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
48050
+ };
48051
+ var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
48052
+ var ipv6ToBytes = (host) => {
48053
+ const halves = host.split("::");
48054
+ if (halves.length > 2) {
48055
+ return null;
48056
+ }
48057
+ const groups = halves[0] ? halves[0].split(":") : [];
48058
+ if (halves.length === 2) {
48059
+ const rear = halves[1] ? halves[1].split(":") : [];
48060
+ const missing = 8 - groups.length - rear.length;
48061
+ if (missing < 1) {
48062
+ return null;
48063
+ }
48064
+ groups.push(...new Array(missing).fill("0"), ...rear);
48065
+ }
48066
+ if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
48067
+ return null;
48068
+ }
48069
+ return groups.flatMap((group) => {
48070
+ const value = Number.parseInt(group, 16);
48071
+ return [value >> 8 & 255, value & 255];
48072
+ });
48073
+ };
48074
+ var ipToBytes = (host) => {
48075
+ if (typeof host !== "string" || !host) {
48076
+ return null;
48077
+ }
48078
+ return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
48079
+ };
47411
48080
  var normalizeNoProxyHost = (hostname) => {
47412
48081
  if (!hostname) {
47413
48082
  return hostname;
@@ -47415,13 +48084,90 @@ var normalizeNoProxyHost = (hostname) => {
47415
48084
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
47416
48085
  hostname = hostname.slice(1, -1);
47417
48086
  }
47418
- const trimmed = hostname.replace(/\.+$/, "");
48087
+ const trimmed = trimTrailingDots(hostname);
47419
48088
  const ipv4 = normalizeIPAddress(trimmed);
47420
48089
  if (ipv4 !== trimmed) {
47421
48090
  return ipv4;
47422
48091
  }
47423
48092
  return unmapIPv4MappedIPv6(trimmed);
47424
48093
  };
48094
+ var normalizeCidrBase = (input) => {
48095
+ let base = input;
48096
+ const startsBracket = base.charAt(0) === "[";
48097
+ const endsBracket = base.charAt(base.length - 1) === "]";
48098
+ const hasBracket = base.includes("[") || base.includes("]");
48099
+ if (startsBracket || endsBracket) {
48100
+ if (!startsBracket || !endsBracket) {
48101
+ return null;
48102
+ }
48103
+ base = base.slice(1, -1);
48104
+ if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
48105
+ return null;
48106
+ }
48107
+ } else if (hasBracket) {
48108
+ return null;
48109
+ }
48110
+ if (!base || base.charAt(base.length - 1) === ".") {
48111
+ return null;
48112
+ }
48113
+ const wasIPv6 = base.indexOf(":") !== -1;
48114
+ if (wasIPv6) {
48115
+ try {
48116
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
48117
+ } catch (_err) {
48118
+ return null;
48119
+ }
48120
+ } else {
48121
+ base = normalizeIPAddress(base);
48122
+ if (!ipv4ToBytes(base)) {
48123
+ return null;
48124
+ }
48125
+ }
48126
+ return { normalized: unmapIPv4MappedIPv6(base), wasIPv6 };
48127
+ };
48128
+ var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
48129
+ var parseCidrEntry = (entry) => {
48130
+ if (entry.indexOf("/") === -1) {
48131
+ return void 0;
48132
+ }
48133
+ const match = CIDR_ENTRY_RE.exec(entry);
48134
+ if (!match) {
48135
+ return null;
48136
+ }
48137
+ let prefix = Number(match[2]);
48138
+ const parsedBase = normalizeCidrBase(match[1]);
48139
+ if (!parsedBase) {
48140
+ return null;
48141
+ }
48142
+ const { normalized, wasIPv6 } = parsedBase;
48143
+ if (wasIPv6 && normalized.indexOf(":") === -1) {
48144
+ if (prefix < 96) {
48145
+ return null;
48146
+ }
48147
+ prefix -= 96;
48148
+ }
48149
+ const bytes = ipToBytes(normalized);
48150
+ if (!bytes || prefix > bytes.length * 8) {
48151
+ return null;
48152
+ }
48153
+ return { bytes, prefix };
48154
+ };
48155
+ var isInSubnet = (addressBytes, networkBytes, prefix) => {
48156
+ const fullBytes = prefix >> 3;
48157
+ for (let i = 0; i < fullBytes; i++) {
48158
+ if (addressBytes[i] !== networkBytes[i]) {
48159
+ return false;
48160
+ }
48161
+ }
48162
+ const remainingBits = prefix & 7;
48163
+ if (remainingBits) {
48164
+ const mask = 255 << 8 - remainingBits & 255;
48165
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
48166
+ return false;
48167
+ }
48168
+ }
48169
+ return true;
48170
+ };
47425
48171
  function shouldBypassProxy(location) {
47426
48172
  let parsed;
47427
48173
  try {
@@ -47438,6 +48184,7 @@ function shouldBypassProxy(location) {
47438
48184
  }
47439
48185
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS2[parsed.protocol.split(":", 1)[0]] || 0;
47440
48186
  const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
48187
+ const hostnameBytes = ipToBytes(hostname);
47441
48188
  return noProxy.split(/[\s,]+/).some((entry) => {
47442
48189
  if (!entry) {
47443
48190
  return false;
@@ -47445,6 +48192,10 @@ function shouldBypassProxy(location) {
47445
48192
  if (entry === "*") {
47446
48193
  return true;
47447
48194
  }
48195
+ const cidr = parseCidrEntry(entry);
48196
+ if (cidr !== void 0) {
48197
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
48198
+ }
47448
48199
  let [entryHost, entryPort] = parseNoProxyEntry(entry);
47449
48200
  entryHost = normalizeNoProxyHost(entryHost);
47450
48201
  if (!entryHost) {
@@ -47530,7 +48281,8 @@ function throttle(fn, freq) {
47530
48281
  }
47531
48282
  };
47532
48283
  const flush = () => lastArgs && invoke(lastArgs);
47533
- return [throttled, flush];
48284
+ const flushWith = (...args) => invoke(args);
48285
+ return [throttled, flush, flushWith];
47534
48286
  }
47535
48287
  var throttle_default = throttle;
47536
48288
 
@@ -47539,7 +48291,7 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
47539
48291
  let bytesNotified = 0;
47540
48292
  const _speedometer = speedometer_default(50, 250);
47541
48293
  return throttle_default((e) => {
47542
- if (!e || typeof e.loaded !== "number") {
48294
+ if (!e || !utils_default.isNumber(e.loaded)) {
47543
48295
  return;
47544
48296
  }
47545
48297
  const rawLoaded = e.loaded;
@@ -47700,6 +48452,12 @@ var { http: httpFollow, https: httpsFollow } = import_follow_redirects.default;
47700
48452
  var isHttps = /https:?/;
47701
48453
  var kAxiosSocketListener = Symbol("axios.http.socketListener");
47702
48454
  var kAxiosCurrentReq = Symbol("axios.http.currentReq");
48455
+ function handleSocketError(err) {
48456
+ const current = this[kAxiosCurrentReq];
48457
+ if (current && !current.destroyed) {
48458
+ current.destroy(err);
48459
+ }
48460
+ }
47703
48461
  var kAxiosInstalledTunnel = Symbol("axios.http.installedTunnel");
47704
48462
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
47705
48463
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
@@ -47802,10 +48560,10 @@ function isSameOriginRedirect(redirectOptions, requestDetails) {
47802
48560
  return false;
47803
48561
  }
47804
48562
  }
47805
- function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
48563
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
47806
48564
  let proxy = configProxy;
47807
48565
  const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
47808
- if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
48566
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
47809
48567
  const proxyUrl = getProxyForUrl(location);
47810
48568
  if (proxyUrl) {
47811
48569
  if (!shouldBypassProxy(location)) {
@@ -47902,9 +48660,13 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
47902
48660
  redirectOptions.href,
47903
48661
  true,
47904
48662
  configHttpsAgent,
47905
- configHttpAgent
48663
+ configHttpAgent,
48664
+ allowEnvProxy
47906
48665
  );
47907
48666
  };
48667
+ return Boolean(
48668
+ proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent)
48669
+ );
47908
48670
  }
47909
48671
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
47910
48672
  var wrapAsync = (asyncExecutor) => {
@@ -47929,7 +48691,7 @@ var wrapAsync = (asyncExecutor) => {
47929
48691
  };
47930
48692
  var resolveFamily = ({ address, family }) => {
47931
48693
  if (!utils_default.isString(address)) {
47932
- throw TypeError("address must be a string");
48694
+ throw new AxiosError_default("address must be a string", AxiosError_default.ERR_BAD_OPTION_VALUE);
47933
48695
  }
47934
48696
  return {
47935
48697
  address,
@@ -47937,6 +48699,30 @@ var resolveFamily = ({ address, family }) => {
47937
48699
  };
47938
48700
  };
47939
48701
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
48702
+ var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
48703
+ var normalizeLookup = (lookup) => {
48704
+ let normalized = normalizedLookupCache.get(lookup);
48705
+ if (normalized) {
48706
+ return normalized;
48707
+ }
48708
+ const callbackLookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48709
+ normalized = (hostname, opt, cb) => {
48710
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
48711
+ if (err) {
48712
+ return cb(err);
48713
+ }
48714
+ let addresses;
48715
+ try {
48716
+ addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48717
+ } catch (error) {
48718
+ return cb(error);
48719
+ }
48720
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48721
+ });
48722
+ };
48723
+ normalizedLookupCache.set(lookup, normalized);
48724
+ return normalized;
48725
+ };
47940
48726
  var http2Transport = {
47941
48727
  request(options, cb) {
47942
48728
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
@@ -47973,6 +48759,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
47973
48759
  let family = own2("family");
47974
48760
  let httpVersion = own2("httpVersion");
47975
48761
  if (httpVersion === void 0) httpVersion = 1;
48762
+ const rawHttpVersion = httpVersion;
47976
48763
  let http2Options = own2("http2Options");
47977
48764
  const httpAgent = own2("httpAgent");
47978
48765
  const httpsAgent = own2("httpsAgent");
@@ -47989,25 +48776,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
47989
48776
  let rejected = false;
47990
48777
  let req;
47991
48778
  let connectPhaseTimer;
47992
- httpVersion = +httpVersion;
48779
+ try {
48780
+ httpVersion = +httpVersion;
48781
+ } catch (err) {
48782
+ throw new AxiosError_default(
48783
+ "Invalid protocol version: value is not a number",
48784
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
48785
+ config
48786
+ );
48787
+ }
47993
48788
  if (Number.isNaN(httpVersion)) {
47994
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
48789
+ throw new AxiosError_default(
48790
+ `Invalid protocol version: '${rawHttpVersion}' is not a number`,
48791
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
48792
+ config
48793
+ );
47995
48794
  }
47996
48795
  if (httpVersion !== 1 && httpVersion !== 2) {
47997
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
48796
+ throw new AxiosError_default(
48797
+ `Unsupported protocol version '${httpVersion}'`,
48798
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
48799
+ config
48800
+ );
47998
48801
  }
47999
48802
  const isHttp2 = httpVersion === 2;
48000
48803
  if (lookup) {
48001
- const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
48002
- lookup = (hostname, opt, cb) => {
48003
- _lookup(hostname, opt, (err, arg0, arg1) => {
48004
- if (err) {
48005
- return cb(err);
48006
- }
48007
- const addresses = utils_default.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
48008
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
48009
- });
48010
- };
48804
+ lookup = normalizeLookup(lookup);
48011
48805
  }
48012
48806
  const abortEmitter = new import_events.EventEmitter();
48013
48807
  function abort(reason) {
@@ -48250,6 +49044,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48250
49044
  utils_default.hasOwnProp(transitional2, "advertiseZstdAcceptEncoding") && transitional2.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING,
48251
49045
  false
48252
49046
  );
49047
+ if (isHttp2 && lookup) {
49048
+ http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, { lookup });
49049
+ }
48253
49050
  const options = Object.assign(/* @__PURE__ */ Object.create(null), {
48254
49051
  path: path5,
48255
49052
  method,
@@ -48260,9 +49057,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48260
49057
  family,
48261
49058
  beforeRedirect: dispatchBeforeRedirect,
48262
49059
  beforeRedirects: /* @__PURE__ */ Object.create(null),
48263
- http2Options
49060
+ http2Options,
49061
+ createConnection: void 0
48264
49062
  });
48265
49063
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
49064
+ let proxyApplied = false;
48266
49065
  if (socketPath) {
48267
49066
  if (typeof socketPath !== "string") {
48268
49067
  return reject(
@@ -48290,13 +49089,17 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48290
49089
  } else {
48291
49090
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
48292
49091
  options.port = parsed.port;
48293
- setProxy(
49092
+ proxyApplied = setProxy(
48294
49093
  options,
48295
49094
  configProxy,
48296
49095
  protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
48297
49096
  false,
48298
49097
  httpsAgent,
48299
- httpAgent
49098
+ httpAgent,
49099
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
49100
+ // cannot apply either axios-resolved or agent-local environment proxies.
49101
+ // Explicit proxy config is still processed and rejected below.
49102
+ !isHttp2
48300
49103
  );
48301
49104
  }
48302
49105
  let transport;
@@ -48307,6 +49110,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48307
49110
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
48308
49111
  }
48309
49112
  if (isHttp2) {
49113
+ if (proxyApplied) {
49114
+ return reject(
49115
+ new AxiosError_default(
49116
+ "HTTP/2 requests with a proxy are not supported",
49117
+ AxiosError_default.ERR_NOT_SUPPORT,
49118
+ config
49119
+ )
49120
+ );
49121
+ }
48310
49122
  transport = http2Transport;
48311
49123
  } else {
48312
49124
  const configTransport = own2("transport");
@@ -48394,7 +49206,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48394
49206
  transformStream,
48395
49207
  progressEventDecorator(
48396
49208
  responseLength,
48397
- progressEventReducer(asyncDecorator(onDownloadProgress, scheduleProgress), true, 3)
49209
+ progressEventReducer(
49210
+ asyncDecorator(onDownloadProgress, scheduleProgress),
49211
+ true,
49212
+ 3
49213
+ )
48398
49214
  )
48399
49215
  )
48400
49216
  );
@@ -48543,12 +49359,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
48543
49359
  socket.setKeepAlive(true, 1e3 * 60);
48544
49360
  }
48545
49361
  if (!socket[kAxiosSocketListener]) {
48546
- socket.on("error", function handleSocketError(err) {
48547
- const current = socket[kAxiosCurrentReq];
48548
- if (current && !current.destroyed) {
48549
- current.destroy(err);
48550
- }
48551
- });
49362
+ socket.on("error", handleSocketError);
48552
49363
  socket[kAxiosSocketListener] = true;
48553
49364
  }
48554
49365
  socket[kAxiosCurrentReq] = req;
@@ -48793,7 +49604,7 @@ function mergeConfig(config1, config2) {
48793
49604
  transformResponse: defaultToConfig2,
48794
49605
  paramsSerializer: defaultToConfig2,
48795
49606
  timeout: defaultToConfig2,
48796
- timeoutMessage: defaultToConfig2,
49607
+ timeoutErrorMessage: defaultToConfig2,
48797
49608
  withCredentials: defaultToConfig2,
48798
49609
  withXSRFToken: defaultToConfig2,
48799
49610
  adapter: defaultToConfig2,
@@ -48870,10 +49681,11 @@ function resolveConfig(config) {
48870
49681
  }
48871
49682
  }
48872
49683
  if (utils_default.isFormData(data)) {
49684
+ const getHeaders = utils_default.getSafeProp(data, "getHeaders");
48873
49685
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) {
48874
49686
  headers.setContentType(void 0);
48875
- } else if (utils_default.isFunction(data.getHeaders)) {
48876
- setFormDataHeaders(headers, data.getHeaders(), own2("formDataHeaderPolicy"));
49687
+ } else if (utils_default.isFunction(getHeaders)) {
49688
+ setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
48877
49689
  }
48878
49690
  }
48879
49691
  if (platform_default.hasStandardBrowserEnv) {
@@ -48902,7 +49714,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
48902
49714
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
48903
49715
  let onCanceled;
48904
49716
  let uploadThrottled, downloadThrottled;
48905
- let flushUpload, flushDownload;
49717
+ let flushUpload, flushDownload, flushDownloadWithEvent;
48906
49718
  function done() {
48907
49719
  flushUpload && flushUpload();
48908
49720
  flushDownload && flushDownload();
@@ -48912,7 +49724,27 @@ var xhr_default = isXHRAdapterSupported && function(config) {
48912
49724
  let request = new XMLHttpRequest();
48913
49725
  request.open(_config.method.toUpperCase(), _config.url, true);
48914
49726
  request.timeout = _config.timeout;
48915
- function onloadend() {
49727
+ function onloadend(event) {
49728
+ if (!request) {
49729
+ return;
49730
+ }
49731
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform_default.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
49732
+ reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
49733
+ done();
49734
+ request = null;
49735
+ return;
49736
+ }
49737
+ try {
49738
+ if (event) {
49739
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
49740
+ } else {
49741
+ flushDownload && flushDownload();
49742
+ }
49743
+ } catch (err) {
49744
+ setTimeout(() => {
49745
+ throw err;
49746
+ });
49747
+ }
48916
49748
  if (!request) {
48917
49749
  return;
48918
49750
  }
@@ -49000,7 +49832,10 @@ var xhr_default = isXHRAdapterSupported && function(config) {
49000
49832
  request.responseType = _config.responseType;
49001
49833
  }
49002
49834
  if (onDownloadProgress) {
49003
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
49835
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
49836
+ onDownloadProgress,
49837
+ true
49838
+ );
49004
49839
  request.addEventListener("progress", downloadThrottled);
49005
49840
  }
49006
49841
  if (onUploadProgress && request.upload) {
@@ -49170,6 +50005,17 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
49170
50005
 
49171
50006
  // node_modules/axios/lib/adapters/fetch.js
49172
50007
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
50008
+ var DEFAULT_REQUEST_OPTIONS = {
50009
+ cache: "default",
50010
+ redirect: "follow",
50011
+ referrer: "about:client",
50012
+ referrerPolicy: "",
50013
+ mode: "cors",
50014
+ integrity: "",
50015
+ keepalive: false,
50016
+ priority: "auto",
50017
+ window: null
50018
+ };
49173
50019
  var { isFunction: isFunction2 } = utils_default;
49174
50020
  var encodeUTF82 = (str) => encodeURIComponent(str).replace(
49175
50021
  /%([0-9A-F]{2})/gi,
@@ -49300,7 +50146,8 @@ var factory = (env) => {
49300
50146
  withCredentials = "same-origin",
49301
50147
  fetchOptions,
49302
50148
  maxContentLength,
49303
- maxBodyLength
50149
+ maxBodyLength,
50150
+ maxRedirects
49304
50151
  } = resolveConfig_default(config);
49305
50152
  const hasMaxContentLength = utils_default.isNumber(maxContentLength) && maxContentLength > -1;
49306
50153
  const hasMaxBodyLength = utils_default.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -49430,17 +50277,44 @@ var factory = (env) => {
49430
50277
  }
49431
50278
  }
49432
50279
  headers.set("User-Agent", "axios/" + VERSION, false);
49433
- const resolvedOptions = {
49434
- ...fetchOptions,
50280
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
50281
+ if (safeFetchOptions) {
50282
+ delete safeFetchOptions.body;
50283
+ delete safeFetchOptions.headers;
50284
+ delete safeFetchOptions.method;
50285
+ delete safeFetchOptions.signal;
50286
+ delete safeFetchOptions.duplex;
50287
+ delete safeFetchOptions.credentials;
50288
+ }
50289
+ const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
49435
50290
  signal: composedSignal,
49436
50291
  method: method.toUpperCase(),
49437
50292
  headers: toByteStringHeaderObject(headers.normalize()),
49438
50293
  body: data,
49439
50294
  duplex: "half",
49440
50295
  credentials: isCredentialsSupported ? withCredentials : void 0
49441
- };
50296
+ });
50297
+ if (isRequestSupported) {
50298
+ utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
50299
+ if (resolvedOptions[key] === void 0) {
50300
+ resolvedOptions[key] = value;
50301
+ }
50302
+ });
50303
+ if (resolvedOptions.signal === void 0) {
50304
+ resolvedOptions.signal = null;
50305
+ }
50306
+ if (resolvedOptions.body === void 0) {
50307
+ resolvedOptions.body = null;
50308
+ }
50309
+ }
50310
+ if (maxRedirects === 0) {
50311
+ resolvedOptions.redirect = "manual";
50312
+ if (safeFetchOptions) {
50313
+ safeFetchOptions.redirect = "manual";
50314
+ }
50315
+ }
49442
50316
  request = isRequestSupported && new Request(url2, resolvedOptions);
49443
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url2, resolvedOptions));
50317
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
49444
50318
  const responseHeaders = AxiosHeaders_default.from(response.headers);
49445
50319
  if (hasMaxContentLength) {
49446
50320
  const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
@@ -49659,9 +50533,10 @@ function throwIfCancellationRequested(config) {
49659
50533
  throw new CanceledError_default(null, config);
49660
50534
  }
49661
50535
  }
49662
- function dispatchRequest(config) {
50536
+ function dispatchRequest(_config) {
50537
+ const config = utils_default.toSafeFlatObject(_config);
49663
50538
  throwIfCancellationRequested(config);
49664
- config.headers = AxiosHeaders_default.from(config.headers);
50539
+ config.headers = AxiosHeaders_default.from(utils_default.getSafeProp(config, "headers"));
49665
50540
  config.data = transformData.call(config, config.transformRequest);
49666
50541
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
49667
50542
  config.headers.setContentType("application/x-www-form-urlencoded", false);
@@ -49791,16 +50666,15 @@ var Axios = class {
49791
50666
  return await this._request(configOrUrl, config);
49792
50667
  } catch (err) {
49793
50668
  if (err instanceof Error) {
49794
- let dummy = {};
49795
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
49796
- const stack = (() => {
49797
- if (!dummy.stack) {
49798
- return "";
49799
- }
49800
- const firstNewlineIndex = dummy.stack.indexOf("\n");
49801
- return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
49802
- })();
49803
50669
  try {
50670
+ let dummy = {};
50671
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
50672
+ const dummyStack = dummy.stack;
50673
+ let stack = "";
50674
+ if (typeof dummyStack === "string") {
50675
+ const firstNewlineIndex = dummyStack.indexOf("\n");
50676
+ stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
50677
+ }
49804
50678
  if (!err.stack) {
49805
50679
  err.stack = stack;
49806
50680
  } else if (stack) {
@@ -49870,9 +50744,9 @@ var Axios = class {
49870
50744
  },
49871
50745
  true
49872
50746
  );
49873
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
50747
+ config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
49874
50748
  let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
49875
- headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "query", "common"], (method) => {
50749
+ headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
49876
50750
  delete headers[method];
49877
50751
  });
49878
50752
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
@@ -50135,14 +51009,22 @@ var HttpStatusCode = {
50135
51009
  Gone: 410,
50136
51010
  LengthRequired: 411,
50137
51011
  PreconditionFailed: 412,
51012
+ /**
51013
+ * @deprecated Use `ContentTooLarge` instead.
51014
+ */
50138
51015
  PayloadTooLarge: 413,
51016
+ ContentTooLarge: 413,
50139
51017
  UriTooLong: 414,
50140
51018
  UnsupportedMediaType: 415,
50141
51019
  RangeNotSatisfiable: 416,
50142
51020
  ExpectationFailed: 417,
50143
51021
  ImATeapot: 418,
50144
51022
  MisdirectedRequest: 421,
51023
+ /**
51024
+ * @deprecated Use `UnprocessableContent` instead.
51025
+ */
50145
51026
  UnprocessableEntity: 422,
51027
+ UnprocessableContent: 422,
50146
51028
  Locked: 423,
50147
51029
  FailedDependency: 424,
50148
51030
  TooEarly: 425,
@@ -50171,7 +51053,9 @@ var HttpStatusCode = {
50171
51053
  InvalidSslCertificate: 526
50172
51054
  };
50173
51055
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
50174
- HttpStatusCode[value] = key;
51056
+ if (HttpStatusCode[value] === void 0) {
51057
+ HttpStatusCode[value] = key;
51058
+ }
50175
51059
  });
50176
51060
  var HttpStatusCode_default = HttpStatusCode;
50177
51061
 
@@ -51351,6 +52235,9 @@ var require_pkg_src2 = __commonJS2({
51351
52235
  });
51352
52236
  var index_exports = {};
51353
52237
  __export22(index_exports, {
52238
+ BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
52239
+ BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
52240
+ BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
51354
52241
  CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
51355
52242
  DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
51356
52243
  DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
@@ -51363,6 +52250,8 @@ var require_pkg_src2 = __commonJS2({
51363
52250
  PerformanceTracker: () => PerformanceTracker,
51364
52251
  RetryStrategy: () => RetryStrategy,
51365
52252
  analyzeError: () => analyzeError,
52253
+ borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
52254
+ buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
51366
52255
  calculateDelay: () => calculateDelay,
51367
52256
  cidToHex: () => cidToHex,
51368
52257
  classifyError: () => classifyError,
@@ -51609,30 +52498,30 @@ var require_pkg_src2 = __commonJS2({
51609
52498
  }
51610
52499
  },
51611
52500
  btcTransactionSigner: {
51612
- cid: "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp",
52501
+ cid: "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf",
51613
52502
  authorizedCidHex: cidToHex(
51614
- "QmakWzTce8NH1Jkgv1xwg83Bg9WmF2UG1Mq76pDYDSwwUp"
52503
+ "QmVi1BYdxvCX3QUhXwPtP6FjWMzqSPtXzrS54YsXjTgjYf"
51615
52504
  ),
51616
52505
  name: "Btc Transaction Signer",
51617
52506
  description: "Production Btc Transaction Signer",
51618
52507
  version: "1.1.1",
51619
52508
  deployed: true,
51620
- deployedAt: 1786465606156,
51621
- size: 67999,
51622
- hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
52509
+ deployedAt: 1787923905597,
52510
+ size: 70646,
52511
+ hash: "37c3bb72a660c8275d92e1b73f9482742d86b64789480b9246304c0ca1bab47a"
51623
52512
  },
51624
52513
  ucdMintValidator: {
51625
- cid: "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx",
52514
+ cid: "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc",
51626
52515
  authorizedCidHex: cidToHex(
51627
- "Qmd8jgKRceLvf5aoTtwdXG2JqMoBK5cRJwrvEtQkgvbFbx"
52516
+ "QmUWR5fLiyimLT9TPXpYx3HgwNwkvR6MxjZ7hdeYCFodbc"
51628
52517
  ),
51629
52518
  name: "Ucd Mint Validator",
51630
52519
  description: "Production Ucd Mint Validator",
51631
52520
  version: "1.2.1",
51632
52521
  deployed: true,
51633
- deployedAt: 1786465627201,
51634
- size: 82739,
51635
- hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
52522
+ deployedAt: 1787923919527,
52523
+ size: 86197,
52524
+ hash: "c2d80939746cc37f65ef2f63c6a3215b929214a63f10c78144e1f5c98320dabf",
51636
52525
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51637
52526
  pkp: {
51638
52527
  publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
@@ -51640,17 +52529,17 @@ var require_pkg_src2 = __commonJS2({
51640
52529
  }
51641
52530
  },
51642
52531
  processPaymentValidator: {
51643
- cid: "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z",
52532
+ cid: "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF",
51644
52533
  authorizedCidHex: cidToHex(
51645
- "QmNXVdysXDhCaQ1uNE2Vgjbuzy6yUEnnVgHzmDfNKXMU6z"
52534
+ "QmXmXuMRAjMLdgKGyTf9KQdGwYrDp8DxkiF44TvSXDf7wF"
51646
52535
  ),
51647
52536
  name: "Process Payment Validator",
51648
52537
  description: "Production Process Payment Validator",
51649
52538
  version: "1.2.1",
51650
52539
  deployed: true,
51651
- deployedAt: 1786465654796,
51652
- size: 78736,
51653
- hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
52540
+ deployedAt: 1787923987153,
52541
+ size: 82217,
52542
+ hash: "13defa19614215ab3b1fe88955d69e530d13a09475396af932fe0e213637da2f",
51654
52543
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51655
52544
  pkp: {
51656
52545
  publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
@@ -51658,17 +52547,17 @@ var require_pkg_src2 = __commonJS2({
51658
52547
  }
51659
52548
  },
51660
52549
  extendPositionValidator: {
51661
- cid: "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav",
52550
+ cid: "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m",
51662
52551
  authorizedCidHex: cidToHex(
51663
- "QmYwBsyrhGfHWyRKx549G4tKHxsBLAuRUHcecigeUCkFav"
52552
+ "QmU8h99EEVEsQkxroXiYqLsKZw9gNjE6N5CcTpE9aUc12m"
51664
52553
  ),
51665
52554
  name: "Extend Position Validator",
51666
52555
  description: "Production Extend Position Validator",
51667
52556
  version: "1.2.1",
51668
52557
  deployed: true,
51669
- deployedAt: 1786465681874,
51670
- size: 76515,
51671
- hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
52558
+ deployedAt: 1787923999294,
52559
+ size: 79975,
52560
+ hash: "31c1aaf883ef22f37681ddb0a4a949be5c05304b6aef178989475a2da935ef9a",
51672
52561
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51673
52562
  pkp: {
51674
52563
  publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
@@ -51676,17 +52565,17 @@ var require_pkg_src2 = __commonJS2({
51676
52565
  }
51677
52566
  },
51678
52567
  btcWithdrawal: {
51679
- cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
52568
+ cid: "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY",
51680
52569
  authorizedCidHex: cidToHex(
51681
- "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
52570
+ "QmZQWET9pzrVD4gwQuSzYZmqa24JrUNtnnGFDd513sxMCY"
51682
52571
  ),
51683
52572
  name: "Btc Withdrawal",
51684
52573
  description: "Production Btc Withdrawal",
51685
52574
  version: "1.2.7",
51686
52575
  deployed: true,
51687
- deployedAt: 1786446046614,
51688
- size: 97456,
51689
- hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
52576
+ deployedAt: 1787924017769,
52577
+ size: 100069,
52578
+ hash: "4f8e27414e4da235e63d6ae1325c63f3d2fb956464515a21aa007a99935f0f13",
51690
52579
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51691
52580
  pkp: {
51692
52581
  publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
@@ -51798,30 +52687,30 @@ var require_pkg_src2 = __commonJS2({
51798
52687
  hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
51799
52688
  },
51800
52689
  agentModuleExecutor: {
51801
- cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
52690
+ cid: "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf",
51802
52691
  authorizedCidHex: cidToHex(
51803
- "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
52692
+ "QmcD65vuremot5fsHVgp9JBAmei6gAaEtm5mdtLP7Yt9Kf"
51804
52693
  ),
51805
52694
  name: "Agent Module Executor",
51806
52695
  description: "Production Agent Module Executor",
51807
52696
  version: "1.1.1",
51808
52697
  deployed: true,
51809
- deployedAt: 1786446108348,
51810
- size: 11655,
51811
- hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
52698
+ deployedAt: 1787924032013,
52699
+ size: 13878,
52700
+ hash: "a7f0204700912e26e5a354bee13a1242a2baa218643b3bb22d28481f67f9baf4"
51812
52701
  },
51813
52702
  staleSpendRecoveryValidator: {
51814
- cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
52703
+ cid: "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8",
51815
52704
  authorizedCidHex: cidToHex(
51816
- "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
52705
+ "QmNuwo4PT4AikAmhMdZgPWCb2mJDwWa9TnUqrqvofjbrT8"
51817
52706
  ),
51818
52707
  name: "Stale Spend Recovery Validator",
51819
52708
  description: "Production Stale Spend Recovery Validator",
51820
52709
  version: "1.1.2",
51821
52710
  deployed: true,
51822
- deployedAt: 1785173285829,
51823
- size: 37108,
51824
- hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
52711
+ deployedAt: 1787924048772,
52712
+ size: 41424,
52713
+ hash: "3c5f028d2bef4344768462993616d45e30d9d44ef126e04d6eb579821d57d99c",
51825
52714
  validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
51826
52715
  pkp: {
51827
52716
  publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
@@ -51829,17 +52718,17 @@ var require_pkg_src2 = __commonJS2({
51829
52718
  }
51830
52719
  },
51831
52720
  btcUtxoInvalidator: {
51832
- cid: "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m",
52721
+ cid: "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf",
51833
52722
  authorizedCidHex: cidToHex(
51834
- "Qmf4Ze8yhnQhHbnX5RPgJrC7Jw1aA3gbpfpd52kFg7fd1m"
52723
+ "QmaNGeWut7EiGwW4zUc2sFSt7RY5NWFgxYboyG333TwrJf"
51835
52724
  ),
51836
52725
  name: "Btc Utxo Invalidator",
51837
52726
  description: "Production Btc Utxo Invalidator",
51838
52727
  version: "1.0.0",
51839
52728
  deployed: true,
51840
- deployedAt: 1786465704240,
51841
- size: 62553,
51842
- hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
52729
+ deployedAt: 1787924133241,
52730
+ size: 66026,
52731
+ hash: "603bc50920d7f1dee77086f2c518d9e2922ab3858a419d3fbea8221ea3a6d9e9"
51843
52732
  }
51844
52733
  };
51845
52734
  function getDeploymentsForNetwork(network) {
@@ -52600,6 +53489,101 @@ ${errorReport}`);
52600
53489
  var SECONDS_PER_DAY = 86400;
52601
53490
  var DAYS_PER_MONTH = 30;
52602
53491
  var LIT_ACTION_ETH_RPC_TIMEOUT_MS = 8e3;
53492
+ var PINNED_CONTRACT_ADDRESSES = {
53493
+ 1: {
53494
+ PositionManager: "0x12A1836e56139ccaD8722B89519d84233efc224B",
53495
+ LoanOperationsManagerModule: "0x2561974A40F1AEed1251d0A090A83cF8536FB9E9",
53496
+ BTCSpendAuthorizer: "0xfBbF108486fa07F1B06a811C5b66ed68DD9c508a",
53497
+ BitcoinProviderRegistry: "0x4ab3Fb96e02893Ed6FAa61bad1918390c8DbbFFC",
53498
+ LITActionValidator: "0xD2c5d59c2CC5c409AC65ce0A817236aeC6869512",
53499
+ PositionDelegateRegistry: "0xf0aa2678aD4F60f49e8F7725089B5E86B7F8FE4C"
53500
+ },
53501
+ 11155111: {
53502
+ PositionManager: "0x68e0507D982AEBF1D1C1Af8FBbd842327e2deeFF",
53503
+ LoanOperationsManagerModule: "0x3e05e760a87715207b7F4e8fD35EF7559BcA72C0",
53504
+ BTCSpendAuthorizer: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
53505
+ BitcoinProviderRegistry: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
53506
+ LITActionValidator: "0x54eECd7C90F8A8fac27749Ba30BbE8AFBAccc856",
53507
+ PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9"
53508
+ }
53509
+ };
53510
+ function getPinnedContractAddresses(chainId) {
53511
+ return PINNED_CONTRACT_ADDRESSES[chainId] ?? null;
53512
+ }
53513
+ var PROTOCOL_EIP712_DOMAIN_NAME = "DiamondHands.Protocol";
53514
+ var PROTOCOL_EIP712_DOMAIN_VERSION = "1";
53515
+ var BORROWER_AUTHORIZATION_PRIMARY_TYPES = {
53516
+ MINT: "MintRequest",
53517
+ REPAY: "RepayRequest",
53518
+ RENEW: "RenewRequest",
53519
+ WITHDRAW: "WithdrawRequest"
53520
+ };
53521
+ var BORROWER_AUTHORIZATION_FIELDS = {
53522
+ MintRequest: [
53523
+ { name: "positionId", type: "bytes32" },
53524
+ { name: "mintAmount", type: "uint256" },
53525
+ { name: "quantumTimestamp", type: "uint256" }
53526
+ ],
53527
+ RepayRequest: [
53528
+ { name: "positionId", type: "bytes32" },
53529
+ { name: "paymentAmount", type: "uint256" },
53530
+ { name: "quantumTimestamp", type: "uint256" }
53531
+ ],
53532
+ RenewRequest: [
53533
+ { name: "positionId", type: "bytes32" },
53534
+ { name: "selectedTerm", type: "uint256" },
53535
+ { name: "quantumTimestamp", type: "uint256" }
53536
+ ],
53537
+ WithdrawRequest: [
53538
+ { name: "positionId", type: "bytes32" },
53539
+ { name: "totalDeduction", type: "uint256" },
53540
+ { name: "withdrawalAddress", type: "string" },
53541
+ { name: "quantumTimestamp", type: "uint256" }
53542
+ ]
53543
+ };
53544
+ var BORROWER_AUTHORIZATION_ENCODE_TYPES = {
53545
+ MintRequest: "MintRequest(bytes32 positionId,uint256 mintAmount,uint256 quantumTimestamp)",
53546
+ RepayRequest: "RepayRequest(bytes32 positionId,uint256 paymentAmount,uint256 quantumTimestamp)",
53547
+ RenewRequest: "RenewRequest(bytes32 positionId,uint256 selectedTerm,uint256 quantumTimestamp)",
53548
+ WithdrawRequest: "WithdrawRequest(bytes32 positionId,uint256 totalDeduction,string withdrawalAddress,uint256 quantumTimestamp)"
53549
+ };
53550
+ function borrowerAuthorizationTypes(primaryType) {
53551
+ const fields = BORROWER_AUTHORIZATION_FIELDS[primaryType];
53552
+ if (!fields) {
53553
+ throw new Error(
53554
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ${Object.keys(BORROWER_AUTHORIZATION_FIELDS).join(", ")}`
53555
+ );
53556
+ }
53557
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
53558
+ }
53559
+ function buildBorrowerAuthorizationDomain(chainId, verifyingContractOverride) {
53560
+ if (!Number.isInteger(chainId) || chainId <= 0) {
53561
+ throw new Error(
53562
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
53563
+ );
53564
+ }
53565
+ const pinned = getPinnedContractAddresses(chainId);
53566
+ const pinnedLom = pinned?.LoanOperationsManagerModule;
53567
+ if (pinnedLom && verifyingContractOverride) {
53568
+ if (pinnedLom.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
53569
+ throw new Error(
53570
+ `Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedLom}`
53571
+ );
53572
+ }
53573
+ }
53574
+ const verifyingContract = pinnedLom ?? verifyingContractOverride;
53575
+ if (!verifyingContract) {
53576
+ throw new Error(
53577
+ `No pinned LoanOperationsManagerModule for chainId ${chainId} and no verifyingContract supplied; refusing to build a borrower authorization domain without one`
53578
+ );
53579
+ }
53580
+ return {
53581
+ name: PROTOCOL_EIP712_DOMAIN_NAME,
53582
+ version: PROTOCOL_EIP712_DOMAIN_VERSION,
53583
+ chainId,
53584
+ verifyingContract
53585
+ };
53586
+ }
52603
53587
  var EVMChain = /* @__PURE__ */ ((EVMChain3) => {
52604
53588
  EVMChain3["SEPOLIA"] = "sepolia";
52605
53589
  EVMChain3["ETHEREUM"] = "ethereum";
@@ -56395,6 +57379,77 @@ async function awaitSafeSubmissionWindowOnChain(signatureQuantum, chainNow, slee
56395
57379
  );
56396
57380
  return { waited: waitedSeconds > 0, waitedSeconds };
56397
57381
  }
57382
+ init_deployment_addresses();
57383
+ var BORROWER_AUTHORIZATION_712_DOMAIN_NAME = "DiamondHands.Protocol";
57384
+ var BORROWER_AUTHORIZATION_712_DOMAIN_VERSION = "1";
57385
+ var BORROWER_AUTHORIZATION_712_FIELDS = {
57386
+ MintRequest: [
57387
+ { name: "positionId", type: "bytes32" },
57388
+ { name: "mintAmount", type: "uint256" },
57389
+ { name: "quantumTimestamp", type: "uint256" }
57390
+ ],
57391
+ RepayRequest: [
57392
+ { name: "positionId", type: "bytes32" },
57393
+ { name: "paymentAmount", type: "uint256" },
57394
+ { name: "quantumTimestamp", type: "uint256" }
57395
+ ],
57396
+ RenewRequest: [
57397
+ { name: "positionId", type: "bytes32" },
57398
+ { name: "selectedTerm", type: "uint256" },
57399
+ { name: "quantumTimestamp", type: "uint256" }
57400
+ ],
57401
+ WithdrawRequest: [
57402
+ { name: "positionId", type: "bytes32" },
57403
+ { name: "totalDeduction", type: "uint256" },
57404
+ { name: "withdrawalAddress", type: "string" },
57405
+ { name: "quantumTimestamp", type: "uint256" }
57406
+ ]
57407
+ };
57408
+ function borrowerAuthorization712Types(primaryType) {
57409
+ const fields = BORROWER_AUTHORIZATION_712_FIELDS[primaryType];
57410
+ if (!fields) {
57411
+ throw new Error(
57412
+ `Unknown borrower authorization primary type "${primaryType}"; expected one of ` + Object.keys(BORROWER_AUTHORIZATION_712_FIELDS).join(", ")
57413
+ );
57414
+ }
57415
+ return { [primaryType]: fields.map((field) => ({ ...field })) };
57416
+ }
57417
+ function buildBorrowerAuthorization712Domain(chainId) {
57418
+ if (!Number.isInteger(chainId) || chainId <= 0) {
57419
+ throw new Error(
57420
+ `Borrower authorization domain requires a positive integer chainId, got ${String(chainId)}`
57421
+ );
57422
+ }
57423
+ const deployment = Object.values(ALL_DEPLOYMENTS).find(
57424
+ (d) => d.chainId === chainId
57425
+ );
57426
+ const verifyingContract = deployment?.contracts?.LoanOperationsManagerModule;
57427
+ if (!verifyingContract) {
57428
+ throw new Error(
57429
+ `No LoanOperationsManagerModule deployment known for chainId ${chainId}; refusing to build a borrower authorization domain without one`
57430
+ );
57431
+ }
57432
+ return {
57433
+ name: BORROWER_AUTHORIZATION_712_DOMAIN_NAME,
57434
+ version: BORROWER_AUTHORIZATION_712_DOMAIN_VERSION,
57435
+ chainId,
57436
+ verifyingContract
57437
+ };
57438
+ }
57439
+ async function signBorrowerAuthorization712(signer, primaryType, chainId, message) {
57440
+ const signTypedData = signer.signTypedData;
57441
+ if (typeof signTypedData !== "function") {
57442
+ throw new Error(
57443
+ `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.`
57444
+ );
57445
+ }
57446
+ return signTypedData.call(
57447
+ signer,
57448
+ buildBorrowerAuthorization712Domain(chainId),
57449
+ borrowerAuthorization712Types(primaryType),
57450
+ message
57451
+ );
57452
+ }
56398
57453
  var PKP_NFT_ABI = [
56399
57454
  "function getPubkey(uint256 tokenId) external view returns (bytes memory)"
56400
57455
  ];
@@ -56407,29 +57462,11 @@ async function generateMintAuthorization(positionId, amount, chainId, signerOrPr
56407
57462
  const signer = signerOrPrecomputed;
56408
57463
  const timestamp = calculateNextQuantumTimestamp();
56409
57464
  const action = "mint-ucd";
56410
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56411
- const types = [
56412
- "bytes32",
56413
- // positionId
56414
- "uint256",
56415
- // timestamp
56416
- "uint256",
56417
- // chainId
56418
- "uint256",
56419
- // amount
56420
- "bytes32"
56421
- // actionHash
56422
- ];
56423
- const values = [
57465
+ const signature = await signBorrowerAuthorization712(signer, "MintRequest", chainId, {
56424
57466
  positionId,
56425
- timestamp,
56426
- chainId,
56427
- amount.toString(),
56428
- actionHash
56429
- ];
56430
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56431
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56432
- const signature = await signer.signMessage(messageHashBytes);
57467
+ mintAmount: amount.toString(),
57468
+ quantumTimestamp: timestamp
57469
+ });
56433
57470
  return {
56434
57471
  positionId,
56435
57472
  timestamp,
@@ -56466,44 +57503,17 @@ async function generatePaymentAuthorization(positionId, amount, chainId, signerO
56466
57503
  throw new Error(`timestamp must be a number, got ${typeof timestamp}`);
56467
57504
  }
56468
57505
  const action = "make-payment";
56469
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56470
- if (typeof actionHash !== "string") {
56471
- throw new Error(`actionHash must be a string, got ${typeof actionHash}`);
56472
- }
56473
- const types = [
56474
- "bytes32",
56475
- // positionId
56476
- "uint256",
56477
- // timestamp
56478
- "uint256",
56479
- // chainId
56480
- "uint256",
56481
- // amount
56482
- "bytes32"
56483
- // actionHash
56484
- ];
56485
57506
  const amountStr = amount.toString();
56486
- if (typeof amountStr !== "string") {
56487
- throw new Error(
56488
- `amount.toString() must return a string, got ${typeof amountStr}`
56489
- );
56490
- }
56491
- const values = [positionId, timestamp, chainId, amountStr, actionHash];
56492
- for (let i = 0; i < values.length; i++) {
56493
- if (typeof values[i] === "object" && values[i] !== null) {
56494
- throw new Error(
56495
- `Value at index ${i} is an object: ${JSON.stringify(values[i])}`
56496
- );
56497
- }
56498
- }
56499
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56500
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56501
- const signature = await signer.signMessage(messageHashBytes);
57507
+ const signature = await signBorrowerAuthorization712(signer, "RepayRequest", chainId, {
57508
+ positionId,
57509
+ paymentAmount: amountStr,
57510
+ quantumTimestamp: timestamp
57511
+ });
56502
57512
  return {
56503
57513
  positionId,
56504
57514
  timestamp,
56505
57515
  chainId,
56506
- amount: amount.toString(),
57516
+ amount: amountStr,
56507
57517
  action,
56508
57518
  signature
56509
57519
  };
@@ -56590,32 +57600,12 @@ async function generateWithdrawAuthorization(positionId, amount, chainId, signer
56590
57600
  const signer = signerOrPrecomputed;
56591
57601
  const timestamp = calculateNextQuantumTimestamp();
56592
57602
  const action = "withdraw-btc";
56593
- const actionHash = (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(action));
56594
- const types = [
56595
- "bytes32",
56596
- // positionId
56597
- "uint256",
56598
- // timestamp
56599
- "uint256",
56600
- // chainId
56601
- "uint256",
56602
- // amount (in satoshis)
56603
- "string",
56604
- // destinationAddress (Bitcoin address)
56605
- "bytes32"
56606
- // actionHash
56607
- ];
56608
- const values = [
57603
+ const signature = await signBorrowerAuthorization712(signer, "WithdrawRequest", chainId, {
56609
57604
  positionId,
56610
- timestamp,
56611
- chainId,
56612
- amount.toString(),
56613
- destinationAddress,
56614
- actionHash
56615
- ];
56616
- const messageHash = (0, import_ethers15.solidityPackedKeccak256)(types, values);
56617
- const messageHashBytes = (0, import_ethers15.getBytes)(messageHash);
56618
- const signature = await signer.signMessage(messageHashBytes);
57605
+ totalDeduction: amount.toString(),
57606
+ withdrawalAddress: destinationAddress,
57607
+ quantumTimestamp: timestamp
57608
+ });
56619
57609
  return {
56620
57610
  positionId,
56621
57611
  timestamp,
@@ -56664,29 +57654,11 @@ async function generateExtendAuthorization(positionId, newTerm, chainId, signerO
56664
57654
  const signer = signerOrPrecomputed;
56665
57655
  const timestamp = calculateNextQuantumTimestamp();
56666
57656
  const action = "extend-position";
56667
- const actionHash = (0, import_ethers16.keccak256)((0, import_ethers16.toUtf8Bytes)(action));
56668
- const types = [
56669
- "bytes32",
56670
- // positionId
56671
- "uint256",
56672
- // timestamp
56673
- "uint256",
56674
- // chainId
56675
- "uint256",
56676
- // newTerm (extension term in months)
56677
- "bytes32"
56678
- // actionHash
56679
- ];
56680
- const values = [
57657
+ const signature = await signBorrowerAuthorization712(signer, "RenewRequest", chainId, {
56681
57658
  positionId,
56682
- timestamp,
56683
- chainId,
56684
- newTerm,
56685
- actionHash
56686
- ];
56687
- const messageHash = (0, import_ethers16.solidityPackedKeccak256)(types, values);
56688
- const messageHashBytes = (0, import_ethers16.getBytes)(messageHash);
56689
- const signature = await signer.signMessage(messageHashBytes);
57659
+ selectedTerm: newTerm,
57660
+ quantumTimestamp: timestamp
57661
+ });
56690
57662
  return {
56691
57663
  positionId,
56692
57664
  timestamp,
@@ -56921,6 +57893,7 @@ var ServerSession = class {
56921
57893
  store;
56922
57894
  onSignaturePrompt;
56923
57895
  onSignatureResolved;
57896
+ onSessionRestored;
56924
57897
  now;
56925
57898
  fetchImpl;
56926
57899
  cached = null;
@@ -56961,6 +57934,7 @@ var ServerSession = class {
56961
57934
  this.store = opts.persistSession === false ? null : opts.sessionStore ?? createDefaultSessionStore();
56962
57935
  this.onSignaturePrompt = opts.onSignaturePrompt;
56963
57936
  this.onSignatureResolved = opts.onSignatureResolved;
57937
+ this.onSessionRestored = opts.onSessionRestored;
56964
57938
  this.now = opts.now ?? (() => Math.floor(Date.now() / 1e3));
56965
57939
  this.fetchImpl = opts.fetchImpl ?? ((...a) => fetch(...a));
56966
57940
  }
@@ -57041,7 +58015,7 @@ var ServerSession = class {
57041
58015
  */
57042
58016
  async logout() {
57043
58017
  const cached = this.cached;
57044
- const token = cached && cached.expiresAt > this.now() ? cached.token : await this.getValidToken({ silent: true }).catch(() => null);
58018
+ const token = cached && cached.expiresAt > this.now() ? cached.token : await this.tryResolveSilently(this.generation, false).then((session) => session?.token ?? null).catch(() => null);
57045
58019
  await this.clearPersisted();
57046
58020
  if (!token)
57047
58021
  return;
@@ -57113,8 +58087,9 @@ var ServerSession = class {
57113
58087
  *
57114
58088
  * `gen` is the caller's clear-generation snapshot: writes to `this.cached`
57115
58089
  * and the store are skipped if a `clearPersisted()` landed meanwhile.
58090
+ * `announce` gates `onSessionRestored` for the two persisted-store outcomes.
57116
58091
  */
57117
- async tryResolveSilently(gen) {
58092
+ async tryResolveSilently(gen, announce = true) {
57118
58093
  const nowSec = this.now();
57119
58094
  if (this.cached && this.cached.expiresAt - REFRESH_LEEWAY_SECONDS > nowSec) {
57120
58095
  return this.cached;
@@ -57129,6 +58104,8 @@ var ServerSession = class {
57129
58104
  };
57130
58105
  if (gen === this.generation)
57131
58106
  this.cached = adopted;
58107
+ if (announce)
58108
+ this.onSessionRestored?.();
57132
58109
  return adopted;
57133
58110
  }
57134
58111
  try {
@@ -57137,6 +58114,8 @@ var ServerSession = class {
57137
58114
  this.persist(persisted.payload, session);
57138
58115
  this.cached = session;
57139
58116
  }
58117
+ if (announce)
58118
+ this.onSessionRestored?.();
57140
58119
  return session;
57141
58120
  } catch (error) {
57142
58121
  if (!isLoginRejection(error))
@@ -60222,6 +61201,10 @@ function normalizePkpId(pkpId) {
60222
61201
  }
60223
61202
  return pkpId;
60224
61203
  }
61204
+ function isNormalizedChipotlePkpId(pkpId) {
61205
+ const rawId = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
61206
+ return rawId.length === 40;
61207
+ }
60225
61208
  function padPkpIdForSubgraph(pkpId) {
60226
61209
  const raw = pkpId.startsWith("0x") ? pkpId.slice(2) : pkpId;
60227
61210
  if (raw.length === 40) {
@@ -60506,7 +61489,7 @@ var LoanQuery = class {
60506
61489
  batch.map(async (loan) => {
60507
61490
  try {
60508
61491
  const rawId = loan.pkpId?.startsWith("0x") ? loan.pkpId.slice(2) : loan.pkpId;
60509
- const isChipotlePkpId2 = typeof rawId === "string" && rawId.length === 40 && !rawId.toLowerCase().startsWith("04");
61492
+ const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
60510
61493
  if (isChipotlePkpId2) {
60511
61494
  if (this.config.positionManagerCoreAddress && this.config.provider) {
60512
61495
  const pmContract = new import_ethers25.Contract(
@@ -60833,6 +61816,7 @@ function createLoanQuery(config) {
60833
61816
  );
60834
61817
  }
60835
61818
  }
61819
+ var STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS = 5e3;
60836
61820
  var WithdrawalAddressModule = class {
60837
61821
  config;
60838
61822
  graphClient;
@@ -60878,13 +61862,17 @@ var WithdrawalAddressModule = class {
60878
61862
  const reg = this.getRegistry();
60879
61863
  if (!reg.success)
60880
61864
  return reg;
61865
+ const normalized = normalizeBitcoinAddress(btcAddress2);
60881
61866
  try {
60882
- const tx2 = await reg.value.addAddress(
60883
- normalizeBitcoinAddress(btcAddress2)
60884
- );
61867
+ const tx2 = await reg.value.addAddress(normalized);
60885
61868
  return success(tx2);
60886
61869
  } catch (error) {
60887
- return this.txFailure("addAddress", error, btcAddress2);
61870
+ return this.txFailure(
61871
+ "addAddress",
61872
+ error,
61873
+ btcAddress2,
61874
+ await this.staticCallDiagnostic(reg.value, "addAddress", normalized)
61875
+ );
60888
61876
  }
60889
61877
  }
60890
61878
  /** Remove a Bitcoin address from the caller's allowlist (effective immediately). */
@@ -60892,13 +61880,17 @@ var WithdrawalAddressModule = class {
60892
61880
  const reg = this.getRegistry();
60893
61881
  if (!reg.success)
60894
61882
  return reg;
61883
+ const normalized = normalizeBitcoinAddress(btcAddress2);
60895
61884
  try {
60896
- const tx2 = await reg.value.removeAddress(
60897
- normalizeBitcoinAddress(btcAddress2)
60898
- );
61885
+ const tx2 = await reg.value.removeAddress(normalized);
60899
61886
  return success(tx2);
60900
61887
  } catch (error) {
60901
- return this.txFailure("removeAddress", error, btcAddress2);
61888
+ return this.txFailure(
61889
+ "removeAddress",
61890
+ error,
61891
+ btcAddress2,
61892
+ await this.staticCallDiagnostic(reg.value, "removeAddress", normalized)
61893
+ );
60902
61894
  }
60903
61895
  }
60904
61896
  /**
@@ -60994,16 +61986,59 @@ var WithdrawalAddressModule = class {
60994
61986
  }
60995
61987
  return success(void 0);
60996
61988
  }
60997
- txFailure(op, error, context) {
61989
+ /**
61990
+ * Ask the node for the reason a failed write did not carry.
61991
+ *
61992
+ * A failing `eth_estimateGas` frequently answers with NOTHING to decode — ethers renders that
61993
+ * as `missing revert data ... data=null, reason=null, revert=null`, which names no cause and
61994
+ * cannot distinguish "the contract rejected this" from "the RPC hiccuped". An `eth_call` of the
61995
+ * same calldata usually does carry the revert reason or custom-error selector, so this runs one
61996
+ * and folds the answer into the reported error.
61997
+ *
61998
+ * Three deliberate properties:
61999
+ *
62000
+ * 1. It runs ONLY after the write has already failed. Gating the write on a static call would
62001
+ * let a flaky endpoint — precisely the condition this exists to diagnose — block an add that
62002
+ * would otherwise have succeeded.
62003
+ * 2. It costs NO extra signature. `staticCall` is `eth_call`: a node read, never a wallet prompt.
62004
+ * 3. It can never throw. A diagnostic that escapes would replace the real cause with itself.
62005
+ * (The `try/catch` here is the authorized exception to CLAUDE.md's forbidden-patterns rule;
62006
+ * it swallows nothing — every branch returns text that is reported alongside the original.)
62007
+ *
62008
+ * A static call that SUCCEEDS is itself a finding: the contract accepts this call, so the
62009
+ * failure lay outside contract logic (RPC, gas, or nonce).
62010
+ */
62011
+ async staticCallDiagnostic(registry, op, normalizedAddress) {
62012
+ try {
62013
+ await Promise.race([
62014
+ registry[op].staticCall(normalizedAddress),
62015
+ // The failure being diagnosed is often an unresponsive endpoint, so the diagnostic must
62016
+ // not inherit that hang — the user is waiting on this error message.
62017
+ new Promise(
62018
+ (_, reject) => setTimeout(
62019
+ () => reject(new Error("static call timed out after 5s")),
62020
+ STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS
62021
+ )
62022
+ )
62023
+ ]);
62024
+ return "static call SUCCEEDED \u2014 the contract accepts this call, so the failure was not contract logic (RPC, gas, or nonce)";
62025
+ } catch (diagnostic) {
62026
+ const code = typeof diagnostic === "object" && diagnostic !== null ? diagnostic.code : void 0;
62027
+ const msg = diagnostic instanceof Error ? diagnostic.message : String(diagnostic);
62028
+ return typeof code === "string" ? `static call reverted [${code}]: ${msg}` : `static call failed: ${msg}`;
62029
+ }
62030
+ }
62031
+ txFailure(op, error, context, diagnostic) {
60998
62032
  const msg = error instanceof Error ? error.message : String(error);
62033
+ const detail = diagnostic ? `${msg} \u2014 ${diagnostic}` : msg;
60999
62034
  return failure(
61000
62035
  new SDKError({
61001
62036
  code: `SDK_WITHDRAWAL_REGISTRY_${op.toUpperCase()}_FAILED`,
61002
- message: `WithdrawalAddressRegistry.${op} failed: ${msg}`,
62037
+ message: `WithdrawalAddressRegistry.${op} failed: ${detail}`,
61003
62038
  category: "CONTRACT",
61004
62039
  severity: "MEDIUM",
61005
62040
  originalError: error instanceof Error ? error : new Error(String(error)),
61006
- context: { op, context }
62041
+ context: { op, context, diagnostic }
61007
62042
  })
61008
62043
  );
61009
62044
  }
@@ -62081,6 +63116,47 @@ function normalizePkpId2(pkpId) {
62081
63116
  }
62082
63117
  return pkpId;
62083
63118
  }
63119
+ function applyLoanEventsFilter(events, opts) {
63120
+ const { wantsEvent, fromTimestamp, toTimestamp, fromBlock, toBlock, limit } = opts;
63121
+ const inBounds = (e) => {
63122
+ const ts = e?.timestamp;
63123
+ const bn = e?.blockNumber;
63124
+ try {
63125
+ if (fromTimestamp !== void 0 && ts !== void 0 && BigInt(ts) < BigInt(fromTimestamp))
63126
+ return false;
63127
+ if (toTimestamp !== void 0 && ts !== void 0 && BigInt(ts) > BigInt(toTimestamp))
63128
+ return false;
63129
+ if (fromBlock !== void 0 && bn !== void 0 && BigInt(bn) < BigInt(fromBlock))
63130
+ return false;
63131
+ if (toBlock !== void 0 && bn !== void 0 && BigInt(bn) > BigInt(toBlock))
63132
+ return false;
63133
+ } catch {
63134
+ return true;
63135
+ }
63136
+ return true;
63137
+ };
63138
+ const narrow = (list, kind) => wantsEvent(kind) ? (list ?? []).filter(inBounds).slice(0, limit) : [];
63139
+ const single = (value, kind) => value && wantsEvent(kind) && inBounds(value) ? value : void 0;
63140
+ const filtered = {
63141
+ ...events,
63142
+ positionCreated: single(events.positionCreated, "positionCreated"),
63143
+ payments: narrow(events.payments, "payment"),
63144
+ statusUpdates: narrow(events.statusUpdates, "status"),
63145
+ liquidation: single(events.liquidation, "liquidation"),
63146
+ mints: narrow(events.mints, "mint"),
63147
+ withdrawals: narrow(events.withdrawals, "withdrawal"),
63148
+ renewals: narrow(events.renewals, "renewal"),
63149
+ operationFailures: narrow(events.operationFailures, "operationFailure"),
63150
+ mintRequests: narrow(events.mintRequests, "mintRequest"),
63151
+ burnRequests: narrow(events.burnRequests, "burnRequest"),
63152
+ collateralEvents: narrow(events.collateralEvents, "collateralEvent"),
63153
+ mintingFees: narrow(events.mintingFees, "mintingFee"),
63154
+ renewalFees: narrow(events.renewalFees, "renewalFee"),
63155
+ totalEvents: 0
63156
+ };
63157
+ 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;
63158
+ return filtered;
63159
+ }
62084
63160
  function hasLoanEventsFilter(filter2) {
62085
63161
  if (!filter2)
62086
63162
  return false;
@@ -63237,32 +64313,24 @@ var DiamondHandsGraph = class {
63237
64313
  limit = 1e3,
63238
64314
  orderDirection = "desc"
63239
64315
  } = filter2 || {};
64316
+ const wantsEvent = (kind) => !eventTypes || eventTypes.includes(kind);
64317
+ const hasBounds = fromTimestamp !== void 0 || toTimestamp !== void 0 || fromBlock !== void 0 || toBlock !== void 0;
64318
+ const pageSize = hasBounds ? THE_GRAPH_MAX_BATCH_SIZE : limit;
64319
+ const buildPositionWhereClause = () => `where: { position: "${positionId.toLowerCase()}" }`;
63240
64320
  const shouldQuery = {
63241
- positionCreated: !eventTypes || eventTypes.includes("positionCreated"),
63242
- payment: !eventTypes || eventTypes.includes("payment"),
63243
- status: !eventTypes || eventTypes.includes("status"),
63244
- liquidation: !eventTypes || eventTypes.includes("liquidation"),
63245
- mint: !eventTypes || eventTypes.includes("mint"),
63246
- withdrawal: !eventTypes || eventTypes.includes("withdrawal"),
63247
- renewal: !eventTypes || eventTypes.includes("renewal"),
63248
- operationFailure: !eventTypes || eventTypes.includes("operationFailure"),
63249
- mintRequest: !eventTypes || eventTypes.includes("mintRequest"),
63250
- burnRequest: !eventTypes || eventTypes.includes("burnRequest"),
63251
- collateralEvent: !eventTypes || eventTypes.includes("collateralEvent"),
63252
- mintingFee: !eventTypes || eventTypes.includes("mintingFee"),
63253
- renewalFee: !eventTypes || eventTypes.includes("renewalFee")
63254
- };
63255
- const buildPositionWhereClause = () => {
63256
- const conditions = [`position: "${positionId.toLowerCase()}"`];
63257
- if (fromTimestamp)
63258
- conditions.push(`timestamp_gte: "${fromTimestamp}"`);
63259
- if (toTimestamp)
63260
- conditions.push(`timestamp_lte: "${toTimestamp}"`);
63261
- if (fromBlock)
63262
- conditions.push(`blockNumber_gte: "${fromBlock}"`);
63263
- if (toBlock)
63264
- conditions.push(`blockNumber_lte: "${toBlock}"`);
63265
- return `where: { ${conditions.join(", ")} }`;
64321
+ positionCreated: true,
64322
+ payment: true,
64323
+ status: true,
64324
+ liquidation: true,
64325
+ mint: true,
64326
+ withdrawal: true,
64327
+ renewal: true,
64328
+ operationFailure: true,
64329
+ mintRequest: true,
64330
+ burnRequest: true,
64331
+ collateralEvent: true,
64332
+ mintingFee: true,
64333
+ renewalFee: true
63266
64334
  };
63267
64335
  const query = `
63268
64336
  query GetLoanEvents($positionId: Bytes!, $limit: Int!, $orderDirection: OrderDirection!) {
@@ -63498,11 +64566,41 @@ var DiamondHandsGraph = class {
63498
64566
  `;
63499
64567
  const variables = {
63500
64568
  positionId: positionId.toLowerCase(),
63501
- limit,
64569
+ limit: pageSize,
63502
64570
  orderDirection
63503
64571
  };
63504
64572
  const result = await this.client.execute(query, variables);
63505
- return this.assembleLoanEvents(positionId, result);
64573
+ if (hasBounds) {
64574
+ const collections = [
64575
+ ["payments", result.position?.payments],
64576
+ ["statusUpdates", result.position?.statusUpdates],
64577
+ ["withdrawals", result.position?.withdrawals],
64578
+ ["renewals", result.position?.renewals],
64579
+ ["operationFailures", result.position?.operationFailures],
64580
+ ["mintRequests", result.position?.mintRequests],
64581
+ ["burnRequests", result.position?.burnRequests],
64582
+ ["mintingFees", result.position?.mintingFees],
64583
+ ["renewalFees", result.position?.renewalFees],
64584
+ ["mints", result.ucdmintEvents],
64585
+ ["collateralEvents", result.collateralEvents]
64586
+ ];
64587
+ const saturated = collections.filter(([, list]) => (list?.length ?? 0) >= pageSize).map(([name]) => name);
64588
+ if (saturated.length > 0) {
64589
+ log.warn(
64590
+ "[DiamondHandsGraph] bounded getLoanEvents page saturated \u2014 the filtered history may be incomplete",
64591
+ { positionId, pageSize, saturated }
64592
+ );
64593
+ }
64594
+ }
64595
+ const assembled = this.assembleLoanEvents(positionId, result);
64596
+ return applyLoanEventsFilter(assembled, {
64597
+ wantsEvent,
64598
+ fromTimestamp,
64599
+ toTimestamp,
64600
+ fromBlock,
64601
+ toBlock,
64602
+ limit
64603
+ });
63506
64604
  }
63507
64605
  /**
63508
64606
  * Map one position's raw event payload into `LoanEvents`.
@@ -69305,7 +70403,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
69305
70403
  persistSession: config.sessionPersistence?.enabled,
69306
70404
  sessionStore: config.sessionPersistence?.store,
69307
70405
  onSignaturePrompt: config.onSessionSignaturePrompt,
69308
- onSignatureResolved: config.onSessionSignatureResolved
70406
+ onSignatureResolved: config.onSessionSignatureResolved,
70407
+ onSessionRestored: config.onSessionRestored
69309
70408
  });
69310
70409
  }
69311
70410
  const contractManagerResult = createContractManager({
@@ -80740,7 +81839,7 @@ mime-types/index.js:
80740
81839
  *)
80741
81840
 
80742
81841
  axios/dist/node/axios.cjs:
80743
- (*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
81842
+ (*! Axios v1.20.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
80744
81843
 
80745
81844
  safe-buffer/index.js:
80746
81845
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)