@dcl/governance-site 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/assets/{ConstantsUtil-689989f0.js → ConstantsUtil-c3a75781.js} +1 -1
  2. package/assets/{ExchangeController-88f78111.js → ExchangeController-de6066de.js} +1 -1
  3. package/assets/{HelpersUtil-40f31189.js → HelpersUtil-47bce835.js} +1 -1
  4. package/assets/{NetworkUtil-2fb81493.js → NetworkUtil-cfdab321.js} +1 -1
  5. package/assets/{ReownAuthentication-e5d1d4cc.js → ReownAuthentication-c1098727.js} +1 -1
  6. package/assets/{SwapController-f47e6f17.js → SwapController-6f3f28da.js} +1 -1
  7. package/assets/{UserAvatar-0c19fd64.js → UserAvatar-4217a7be.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-33e9645e.js → W3MFrameProviderSingleton-316899f0.js} +2 -2
  9. package/assets/{basic-509eb412.js → basic-d9c0f288.js} +1 -1
  10. package/assets/{biconomy-6fa3eb98.js → biconomy-bc04f7cc.js} +1 -1
  11. package/assets/{ccip-040f274b.js → ccip-d88eddf3.js} +1 -1
  12. package/assets/{ccip-6d1e4a15.js → ccip-e509a2bd.js} +1 -1
  13. package/assets/{chains-bae55e5f.js → chains-12910e1f.js} +1 -1
  14. package/assets/{common-f2e88a7e.js → common-583dfda9.js} +1 -1
  15. package/assets/{compat-b432550d.js → compat-000e5801.js} +1 -1
  16. package/assets/{controller-83cf739b.js → controller-5a843a75.js} +1 -1
  17. package/assets/{core-71a03396.js → core-1a166f08.js} +3 -3
  18. package/assets/{custom-7ae31f11.js → custom-3c5e7814.js} +1 -1
  19. package/assets/{data-capture-f1f485c2.js → data-capture-a27f6e5c.js} +1 -1
  20. package/assets/decimals-50f9fee1.js +1 -0
  21. package/assets/{decimals-9d5fec14.js → decimals-bddbc743.js} +1 -1
  22. package/assets/{email-be31d86e.js → email-0c5024d9.js} +1 -1
  23. package/assets/{embedded-wallet-41341ab4.js → embedded-wallet-d5992bd8.js} +1 -1
  24. package/assets/{engine-8d2b111b.js → engine-9b39863f.js} +1 -1
  25. package/assets/{estimate-l1-fee-8acb8860.js → estimate-l1-fee-69110584.js} +1 -1
  26. package/assets/eth_estimateGas-945ce595.js +1 -0
  27. package/assets/{eth_getStorageAt-2d8a4700.js → eth_getStorageAt-125a2bc1.js} +1 -1
  28. package/assets/{eth_getTransactionCount-273004ec.js → eth_getTransactionCount-6240f912.js} +1 -1
  29. package/assets/{ethereum-667be7dc.js → ethereum-0d579241.js} +1 -1
  30. package/assets/{execute-6c88dd5f.js → execute-264a98ed.js} +1 -1
  31. package/assets/{extractIPFS-640303a3.js → extractIPFS-d48a2b7b.js} +1 -1
  32. package/assets/features-7c8dc530.js +1 -0
  33. package/assets/{fetchTokenMetadata-1e138f21.js → fetchTokenMetadata-f32fb87e.js} +1 -1
  34. package/assets/{fortmatic-d34f42c3.js → fortmatic-5f1bb82e.js} +1 -1
  35. package/assets/{get-bytecode-8cb4e224.js → get-bytecode-7a8c6215.js} +1 -1
  36. package/assets/{get-ecosystem-wallet-info-ec712acc.js → get-ecosystem-wallet-info-0a9d1fa7.js} +1 -1
  37. package/assets/{getBalance-0308f38f.js → getBalance-e2e6d859.js} +1 -1
  38. package/assets/{getInstalledModules-17fa1a09.js → getInstalledModules-4e23fa8a.js} +1 -1
  39. package/assets/{getNFT-06eb1406.js → getNFT-5486b2f7.js} +1 -1
  40. package/assets/{getNFT-30795fe1.js → getNFT-74f5ae81.js} +1 -1
  41. package/assets/{hashBytecode-a29db705.js → hashBytecode-7a0e56f5.js} +1 -1
  42. package/assets/{hashTypedData-23a00dc9.js → hashTypedData-03b693eb.js} +1 -1
  43. package/assets/{hashTypedData-ba8e399b.js → hashTypedData-cc1589a7.js} +1 -1
  44. package/assets/{in-app-9acc158b.js → in-app-1d212717.js} +1 -1
  45. package/assets/{in-app-wallet-calls-48ca2694.js → in-app-wallet-calls-7fdb5823.js} +1 -1
  46. package/assets/{index-89cbc69d.js → index-06d7a58c.js} +1 -1
  47. package/assets/{index-355751ab.js → index-10c73e9d.js} +245 -245
  48. package/assets/{index-9ecf773e.js → index-19891b89.js} +1 -1
  49. package/assets/{index-2ebd7a81.js → index-206ffe7d.js} +1 -1
  50. package/assets/{index-f4401a12.js → index-20b33848.js} +1 -1
  51. package/assets/{index-6e64d31e.js → index-23dd6251.js} +2 -2
  52. package/assets/{index-2124b7cd.js → index-2cab452e.js} +1 -1
  53. package/assets/{index-9c2f8893.js → index-2f82abe0.js} +1 -1
  54. package/assets/{index-a5c29e80.js → index-30a8f53e.js} +1 -1
  55. package/assets/{index-4bc8eee8.js → index-31022e63.js} +1 -1
  56. package/assets/{index-a5876580.js → index-32a45902.js} +1 -1
  57. package/assets/{index-b7605561.js → index-3b678484.js} +1 -1
  58. package/assets/{index-3cdab001.js → index-3bc5c9df.js} +1 -1
  59. package/assets/{index-d7ed4af8.js → index-3d19d06c.js} +1 -1
  60. package/assets/{index-1368749b.js → index-401eba13.js} +1 -1
  61. package/assets/{index-f4841b7d.js → index-5071722a.js} +1 -1
  62. package/assets/{index-e7f3149f.css → index-59db4a58.css} +4 -4
  63. package/assets/{index-e6ba4bbe.js → index-5d7b6c51.js} +1 -1
  64. package/assets/{index-78689969.js → index-5ece9033.js} +1 -1
  65. package/assets/{index-33bd3c33.js → index-610c7efb.js} +1 -1
  66. package/assets/{index-a91bb597.js → index-69a0492a.js} +1 -1
  67. package/assets/{index-76dbec48.js → index-6d8da0b7.js} +1 -1
  68. package/assets/{index-863b5c53.js → index-6ec6d7c7.js} +1 -1
  69. package/assets/{index-ec8cf158.js → index-780a2232.js} +1 -1
  70. package/assets/{index-b40ed19e.js → index-7ad05b06.js} +1 -1
  71. package/assets/{index-e332724b.js → index-7f01a27a.js} +1 -1
  72. package/assets/{index-69ac8519.js → index-877ffe4a.js} +1 -1
  73. package/assets/{index-e6d2ed90.js → index-8aeaab91.js} +1 -1
  74. package/assets/{index-66d53073.js → index-8cbb4ff7.js} +2 -2
  75. package/assets/{index-e2d1a06e.js → index-8d81098b.js} +1 -1
  76. package/assets/{index-3ad96675.js → index-8fa35f13.js} +1 -1
  77. package/assets/{index-5f847edd.js → index-93724bad.js} +2 -2
  78. package/assets/index-9bee2cc7.js +77 -0
  79. package/assets/{index-2e071cd2.js → index-9d37fa54.js} +1 -1
  80. package/assets/{index-57dbcd5d.js → index-a151f6d7.js} +1 -1
  81. package/assets/{index-54323fc3.js → index-a22875e4.js} +2 -2
  82. package/assets/{index-d7bf28d3.js → index-a69ba1cc.js} +1 -1
  83. package/assets/{index-6c8c5091.js → index-a6a44c61.js} +1 -1
  84. package/assets/{index-b41b719c.js → index-aae2726c.js} +1 -1
  85. package/assets/{index-8bdd54b7.js → index-ad63abcf.js} +1 -1
  86. package/assets/{index-375e28ad.js → index-b3691f6b.js} +1 -1
  87. package/assets/{index-276c1c99.js → index-b3889ac8.js} +1 -1
  88. package/assets/{index-2537319c.js → index-bb13bbcd.js} +1 -1
  89. package/assets/{index-05f3c18a.js → index-bcedc0e6.js} +1 -1
  90. package/assets/{index-9e3730d4.js → index-c49dee70.js} +1 -1
  91. package/assets/{index-c7839713.js → index-cafc0996.js} +1 -1
  92. package/assets/{index-1c9749d2.js → index-d22cfc35.js} +1 -1
  93. package/assets/{index-9c119afb.js → index-d2f37bee.js} +1 -1
  94. package/assets/{index-ffdeacb2.js → index-d44b19e2.js} +1 -1
  95. package/assets/{index-8b5a06dd.js → index-d77a63d3.js} +1 -1
  96. package/assets/{index-ab687c6f.js → index-e332040b.js} +1 -1
  97. package/assets/{index-5b4e7208.js → index-e583ff4e.js} +1 -1
  98. package/assets/{index-5947dd15.js → index-e9ab8876.js} +1 -1
  99. package/assets/{index-3c50ab3b.js → index-f49c89c1.js} +1 -1
  100. package/assets/{index-3d2bada3.js → index-fe892b11.js} +1 -1
  101. package/assets/{index.es-2aacf970.js → index.es-0f7943d8.js} +1 -1
  102. package/assets/{index.es-ce0aa5fd.js → index.es-30a0ec70.js} +3 -3
  103. package/assets/{index.es-ac60fff2.js → index.es-4520fb10.js} +1 -1
  104. package/assets/{index.web-1837e57d.js → index.web-e2526e19.js} +1 -1
  105. package/assets/{localBatchGatewayRequest-b2e2be89.js → localBatchGatewayRequest-ff5d42f6.js} +1 -1
  106. package/assets/{native-8dd45a06.js → native-3e8a86bb.js} +1 -1
  107. package/assets/{networks-2b49f856.js → networks-fc1b1902.js} +1 -1
  108. package/assets/{onramp-7ba26b97.js → onramp-cf41485f.js} +1 -1
  109. package/assets/{openzeppelin-56d83a0f.js → openzeppelin-e72c7daa.js} +1 -1
  110. package/assets/{ownerOf-558180d2.js → ownerOf-c09a8f45.js} +1 -1
  111. package/assets/parseNft-147a451f.js +1 -0
  112. package/assets/{parseSignature-16c7c561.js → parseSignature-6b0b4698.js} +2 -2
  113. package/assets/{parseSignature-7a759338.js → parseSignature-b975d9a6.js} +1 -1
  114. package/assets/{passkeys-fd92f407.js → passkeys-bb25d43e.js} +1 -1
  115. package/assets/{pay-with-exchange-542b5282.js → pay-with-exchange-cd96ece6.js} +1 -1
  116. package/assets/{prepare-contract-call-ac31a985.js → prepare-contract-call-4be4cc68.js} +1 -1
  117. package/assets/{qr-overlay-548b2074.js → qr-overlay-fd67e1ca.js} +1 -1
  118. package/assets/{receive-9119a0fc.js → receive-9ddd4e2d.js} +1 -1
  119. package/assets/{redirect-state-202ec690.js → redirect-state-301cb22c.js} +1 -1
  120. package/assets/{resolveImplementation-ffd32467.js → resolveImplementation-6b55308f.js} +1 -1
  121. package/assets/{rpc-4fa5fbde.js → rpc-83ca4b71.js} +1 -1
  122. package/assets/{secp256k1-61174a68.js → secp256k1-44255658.js} +1 -1
  123. package/assets/{secp256k1-587b447b.js → secp256k1-4ab38443.js} +1 -1
  124. package/assets/{secp256k1-2e39eaab.js → secp256k1-ac683ebc.js} +1 -1
  125. package/assets/{send-5e9549ca.js → send-7e34f1e6.js} +1 -1
  126. package/assets/{send-batch-transaction-16b5b747.js → send-batch-transaction-429c82ee.js} +1 -1
  127. package/assets/{send-eip712-transaction-67b51817.js → send-eip712-transaction-20a9b9ed.js} +1 -1
  128. package/assets/send-gasless-transaction-0435da18.js +1 -0
  129. package/assets/{send-transaction-5984dc09.js → send-transaction-c3053b90.js} +1 -1
  130. package/assets/{session-proposal-548687be.js → session-proposal-d1473b74.js} +1 -1
  131. package/assets/{session-request-543a34de.js → session-request-f0a8f695.js} +1 -1
  132. package/assets/{sha256-865a5e2e.js → sha256-937f482f.js} +1 -1
  133. package/assets/{signing-67cb53a5.js → signing-6d6682ec.js} +2 -2
  134. package/assets/{socials-1c5f45aa.js → socials-d1713bee.js} +1 -1
  135. package/assets/{swaps-a0b58cae.js → swaps-8bad12fe.js} +1 -1
  136. package/assets/{thirdweb-d54893e0.js → thirdweb-73096eef.js} +2 -2
  137. package/assets/{to-serializable-transaction-2ea802ff.js → to-serializable-transaction-9e540f8c.js} +2 -2
  138. package/assets/{totalSupply-f714505e.js → totalSupply-7e83596b.js} +1 -1
  139. package/assets/{transaction-e500e7c4.js → transaction-ea614a5a.js} +1 -1
  140. package/assets/{transactionReceipt-c6fe2381.js → transactionReceipt-1e425ab1.js} +1 -1
  141. package/assets/{transactions-9a79e8f9.js → transactions-a47e2cb5.js} +1 -1
  142. package/assets/{tslib.es6-b444c8f1.js → tslib.es6-24024d67.js} +1 -1
  143. package/assets/{utils-74c631d9.js → utils-dddc86ba.js} +1 -1
  144. package/assets/{verifyHash-34edded7.js → verifyHash-b21b75c2.js} +1 -1
  145. package/assets/{w3m-modal-0795c078.js → w3m-modal-e914d462.js} +1 -1
  146. package/assets/{w3m-modal-906aa735.js → w3m-modal-ff2f112d.js} +1 -1
  147. package/assets/{wait-for-tx-receipt-dbf6b521.js → wait-for-tx-receipt-50389b4e.js} +1 -1
  148. package/assets/{wallets-331c410d.js → wallets-4e23dd0f.js} +4 -4
  149. package/assets/{web-connector-3a1204fd.js → web-connector-351693f5.js} +2 -2
  150. package/assets/{writeContract-f6b81199.js → writeContract-03e44e49.js} +2 -2
  151. package/assets/{zora-sepolia-eaf59a0b.js → zora-sepolia-72e60034.js} +1 -1
  152. package/assets/{zoraTestnet-55836178.js → zoraTestnet-1485f0af.js} +1 -1
  153. package/index.html +4 -4
  154. package/package.json +3 -3
  155. package/assets/decimals-37678a25.js +0 -1
  156. package/assets/eth_estimateGas-79dc1763.js +0 -1
  157. package/assets/features-0025dc16.js +0 -1
  158. package/assets/index-7ee82e4f.js +0 -77
  159. package/assets/parseNft-93d99682.js +0 -1
  160. package/assets/send-gasless-transaction-8bdf3649.js +0 -1
@@ -0,0 +1,77 @@
1
+ var vw=Object.defineProperty;var bw=(e,t,r)=>t in e?vw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var cr=(e,t,r)=>(bw(e,typeof t!="symbol"?t+"":t,r),r),kh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var be=(e,t,r)=>(kh(e,t,"read from private field"),r?r.call(e):t.get(e)),Ot=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Pt=(e,t,r,n)=>(kh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Hl=(e,t,r,n)=>({set _(s){Pt(e,t,s,r)},get _(){return be(e,t,n)}}),gt=(e,t,r)=>(kh(e,t,"access private method"),r);import{M as _w,O as ww,P as Ew,Q as o4,R as Aw,S as Sw,T as Pw,U as Tw,V as Iw,W as Cw,X as Rw,Z as kw,Y as Ny,$ as sl,a0 as zf,a1 as ra,a2 as c4,a3 as Hp,a4 as u4,a5 as Z2,a6 as jt,a7 as xn,a8 as al,a9 as Lr,aa as _l,ab as Ds,ac as wl,ad as Dy,ae as xy,af as Ga,ag as l4,ah as d4,ai as ms,aj as f4,ak as Gp,al as za,am as h4,an as p4,ao as y4,ap as Mw,aq as Ow,ar as Nw,as as Dw,at as xw,au as g4,av as m4,aw as Kd,ax as Uw,ay as Bw,az as Lw,aA as Kw,aB as jw,aC as qw,aD as $w,aE as Vw,aF as Fw,aG as Hw,aH as Gw,aI as zw,aJ as Ww,aK as Yw,aL as Jw,aM as Zw,aN as Xw,aO as Qw,aP as eE,aQ as tE,aR as rE,aS as nE,aT as iE,aU as sE,aV as aE,aW as oE,aX as cE,aY as uE,aZ as lE,a_ as dE,a$ as fE,b0 as hE,b1 as pE,b2 as yE,b3 as gE,b4 as mE,b5 as vE,b6 as bE,b7 as _E,b8 as wE,b9 as EE,ba as AE,bb as SE,bc as PE,bd as TE,be as IE,bf as CE,bg as RE,bh as kE,bi as ME,bj as OE,bk as NE,bl as DE,bm as xE,bn as UE,bo as BE,bp as LE,bq as KE,br as jE,bs as qE,bt as $E,bu as VE,bv as FE,bw as HE,bx as GE,by as zE,bz as WE,bA as YE,bB as JE,bC as ZE,bD as XE,bE as QE,bF as v4,bG as b4,bH as _4,bI as w4,bJ as E4,bK as A4,bL as S4,bM as P4,bN as T4,bO as I4,f as El,B as at,b as Cr,bP as Uy,bQ as C4,bR as zp,i as It,K as nf,e as R4,c as eA,q as tA,w as rA,v as Wa,bS as nA,g as iA}from"./index-10c73e9d.js";import{d as Ke,e as k4,r as sA,a as aA,c as Un,b as oA}from"./tslib.es6-24024d67.js";import{c as cA}from"./index-d77a63d3.js";import{_ as uA}from"./index-206ffe7d.js";import{c as qr}from"./index-d22cfc35.js";import{r as lA,i as dA}from"./index-2f82abe0.js";import{s as fA,w as hA}from"./index-e583ff4e.js";function pA(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(n,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const yA=Object.freeze(Object.defineProperty({__proto__:null,decode:_w,encode:ww},Symbol.toStringTag,{value:"Module"})),gA="Ξ",M4=Object.freeze(Object.defineProperty({__proto__:null,AddressZero:Ew,EtherSymbol:gA,HashZero:o4,MaxInt256:Aw,MaxUint256:Sw,MinInt256:Pw,NegativeOne:Tw,One:Iw,Two:Cw,WeiPerEther:Rw,Zero:kw},Symbol.toStringTag,{value:"Module"}));function mA(e){const t=Ny(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return sl(zf([t,o4]).slice(0,32))}function vA(e){const t=ra(e);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;t[r-1]===0;)r--;return c4(t.slice(0,r))}function bA(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function By(e,t){t||(t=function(s){return[parseInt(s,16)]});let r=0,n={};return e.split(",").forEach(s=>{let i=s.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])}),n}function O4(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let s=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:s,h:t}})}function Ly(e,t){let r=0;for(let n=0;n<t.length;n++){let s=t[n];if(r+=s.l,e>=r&&e<=r+s.h&&(e-r)%(s.d||1)===0){if(s.e&&s.e.indexOf(e-r)!==-1)continue;return s}}return null}const _A=O4("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),wA="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),EA=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],AA=By("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),SA=By("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),PA=By("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",bA),TA=O4("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function IA(e){return e.reduce((t,r)=>(r.forEach(n=>{t.push(n)}),t),[])}function CA(e){return!!Ly(e,_A)}function RA(e){let t=Ly(e,EA);if(t)return[e+t.s];let r=AA[e];if(r)return r;let n=SA[e];if(n)return[e+n[0]];let s=PA[e];return s||null}function kA(e){return!!Ly(e,TA)}function MA(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=Hp(e);t=IA(t.map(n=>{if(wA.indexOf(n)>=0)return[];if(n>=65024&&n<=65039)return[];let s=RA(n);return s||[n]})),t=Hp(Z2(t),u4.NFKC),t.forEach(n=>{if(kA(n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(n=>{if(CA(n))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=Z2(t);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}let Hu=null;try{if(Hu=WebSocket,Hu==null)throw new Error("inject please")}catch{const t=new jt(xn);Hu=function(){t.throwError("WebSockets not supported in this environment",jt.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Mh=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const Gl=new jt(xn);let OA=1;class Wf extends al{constructor(t,r){r==="any"&&Gl.throwError("WebSocketProvider does not support 'any' network yet",jt.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof t=="string"?super(t,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof t=="string"?Lr(this,"_websocket",new Hu(this.connection.url)):Lr(this,"_websocket",t),Lr(this,"_requests",{}),Lr(this,"_subs",{}),Lr(this,"_subIds",{}),Lr(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(s=>{this.websocket.send(this._requests[s].payload)})},this.websocket.onmessage=s=>{const i=s.data,o=JSON.parse(i);if(o.id!=null){const a=String(o.id),f=this._requests[a];if(delete this._requests[a],o.result!==void 0)f.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(f.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Lr(c,"code",o.error.code||null),Lr(c,"response",i)):c=new Error("unknown error"),f.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(f.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){Gl.throwError("cannot reset events block on WebSocketProvider",jt.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){Gl.throwError("cannot set polling interval on WebSocketProvider",jt.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Mh(this,void 0,void 0,function*(){return null})}set polling(t){t&&Gl.throwError("cannot set polling on WebSocketProvider",jt.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,r){const n=OA++;return new Promise((s,i)=>{function o(f,c){return f?i(f):s(c)}const a=JSON.stringify({method:t,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(n)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,r,n){return Mh(this,void 0,void 0,function*(){let s=this._subIds[t];s==null&&(s=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[t]=s);const i=yield s;this._subs[i]={tag:t,processFunc:n}})}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=_l.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(t.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const s=n.hash;this.getTransactionReceipt(s).then(i=>{i&&this.emit(s,i)})};r(t),this._subscribe("tx",["newHeads"],n=>{this._events.filter(s=>s.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t);break}}_stopEvent(t){let r=t.tag;if(t.type==="tx"){if(this._events.filter(s=>s.type==="tx").length)return;r="tx"}else if(this.listenerCount(t.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(s=>{this._subs[s]&&(delete this._subs[s],this.send("eth_unsubscribe",[s]))}))}destroy(){return Mh(this,void 0,void 0,function*(){this.websocket.readyState===Hu.CONNECTING&&(yield new Promise(t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}})),this.websocket.close(1e3)})}}const X2=new jt(xn),jd="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class N4 extends Wf{constructor(t,r){const n=new Ky(t,r),s=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(s,n.network),Lr(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===jd}}class Ky extends Ds{static getWebSocketProvider(t,r){return new N4(t,r)}static getApiKey(t){return t==null?jd:(t&&typeof t!="string"&&X2.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"sepolia":n="eth-sepolia.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"arbitrum-sepolia":n="arb-sepolia.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;case"optimism-sepolia":n="opt-sepolia.g.alchemy.com/v2/";break;default:X2.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(s,i)=>(r===jd&&wl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===jd}}const NA=new jt(xn),zl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function DA(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"sepolia":return"rpc.ankr.com/eth_sepolia/";case"matic":return"rpc.ankr.com/polygon/";case"maticmum":return"rpc.ankr.com/polygon_mumbai/";case"optimism":return"rpc.ankr.com/optimism/";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet/";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return NA.throwArgumentError("unsupported network","name",e)}class D4 extends Ds{isCommunityResource(){return this.apiKey===zl}static getApiKey(t){return t??zl}static getUrl(t,r){r==null&&(r=zl);const n={allowGzip:!0,url:"https://"+DA(t.name)+r,throttleCallback:(s,i)=>(r.apiKey===zl&&wl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var xA=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const Q2=new jt(xn);class x4 extends Ds{static getApiKey(t){return t!=null&&Q2.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Q2.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return xA(this,void 0,void 0,function*(){return t==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,t,r)})}}var Wl=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const bs=new jt(xn);function eg(e){const t={};for(let r in e){if(e[r]==null)continue;let n=e[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=l4(sl(n)):r==="accessList"?n="["+d4(n).map(s=>`{address:"${s.address}",storageKeys:["${s.storageKeys.join('","')}"]}`).join(",")+"]":n=sl(n),t[r]=n)}return t}function UA(e){if(e.status==0&&(e.message==="No records found"||e.message==="No transactions found"))return e.result;if(e.status!=1||typeof e.message!="string"||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function tg(e){if(e&&e.status==0&&e.message=="NOTOK"&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if(e.jsonrpc!="2.0"){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function rg(e){if(e==="pending")throw new Error("pending not supported");return e==="latest"?e:parseInt(e.substring(2),16)}function Oh(e,t,r){if(e==="call"&&t.code===jt.errors.SERVER_ERROR){const s=t.error;if(s&&(s.message.match(/reverted/i)||s.message.match(/VM execution error/i))){let i=s.data;if(i&&(i="0x"+i.replace(/^.*0x/i,"")),ms(i))return i;bs.throwError("missing revert data in call exception",jt.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===jt.errors.SERVER_ERROR&&(t.error&&typeof t.error.message=="string"?n=t.error.message:typeof t.body=="string"?n=t.body:typeof t.responseText=="string"&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&bs.throwError("insufficient funds for intrinsic transaction cost",jt.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&bs.throwError("nonce has already been used",jt.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&bs.throwError("replacement fee too low",jt.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&bs.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",jt.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class U4 extends Dy{constructor(t,r){super(t),Lr(this,"baseUrl",this.getBaseUrl()),Lr(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return bs.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,r){const n=Object.keys(r).reduce((i,o)=>{const a=r[o];return a!=null&&(i+=`&${o}=${a}`),i},""),s=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${n}${s}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}fetch(t,r,n){return Wl(this,void 0,void 0,function*(){const s=n?this.getPostUrl():this.getUrl(t,r),i=n?this.getPostData(t,r):null,o=t==="proxy"?tg:UA;this.emit("debug",{action:"request",request:s,provider:this});const a={url:s,throttleSlotInterval:1e3,throttleCallback:(l,u)=>(this.isCommunityResource()&&wl(),Promise.resolve(!0))};let f=null;i&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},f=Object.keys(i).map(l=>`${l}=${i[l]}`).join("&"));const c=yield xy(a,f,o||tg);return this.emit("debug",{action:"response",request:s,response:Ga(c),provider:this}),c})}detectNetwork(){return Wl(this,void 0,void 0,function*(){return this.network})}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Wl(this,void 0,void 0,function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(s=>Oh("sendTransaction",s,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const s=eg(r.transaction);s.module="proxy",s.action="eth_call";try{return yield this.fetch("proxy",s,!0)}catch(i){return Oh("call",i,r.transaction)}}case"estimateGas":{const s=eg(r.transaction);s.module="proxy",s.action="eth_estimateGas";try{return yield this.fetch("proxy",s,!0)}catch(i){return Oh("estimateGas",i,r.transaction)}}case"getLogs":{const s={action:"getLogs"};if(r.filter.fromBlock&&(s.fromBlock=rg(r.filter.fromBlock)),r.filter.toBlock&&(s.toBlock=rg(r.filter.toBlock)),r.filter.address&&(s.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&bs.throwError("unsupported topic count",jt.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&bs.throwError("unsupported topic format",jt.errors.UNSUPPORTED_OPERATION,{topic0:a}),s.topic0=a}const i=yield this.fetch("logs",s);let o={};for(let a=0;a<i.length;a++){const f=i[a];if(f.blockHash==null){if(o[f.blockNumber]==null){const c=yield this.getBlock(f.blockNumber);c&&(o[f.blockNumber]=c.hash)}f.blockHash=o[f.blockNumber]}}return i}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return n.perform.call(this,t,r)})}getHistory(t,r,n){return Wl(this,void 0,void 0,function*(){const s={action:"txlist",address:yield this.resolveName(t),startblock:r??0,endblock:n??99999999,sort:"asc"};return(yield this.fetch("account",s)).map(o=>{["contractAddress","to"].forEach(function(f){o[f]==""&&delete o[f]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function B4(e){e=e.slice();for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var sf=globalThis&&globalThis.__awaiter||function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(l){try{c(n.next(l))}catch(u){o(u)}}function f(l){try{c(n.throw(l))}catch(u){o(u)}}function c(l){l.done?i(l.value):s(l.value).then(a,f)}c((n=n.apply(e,t||[])).next())})};const na=new jt(xn);function Yl(){return new Date().getTime()}function ng(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(n==null)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||t.ensAddress==null&&n.ensAddress==null)||na.throwArgumentError("provider mismatch","networks",e):t=n}return t}function ig(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],s=e[r];return t!=null&&Math.abs(n-s)>t?null:(n+s)/2}function Ka(e){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="string")return e;if(_l.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map(t=>Ka(t)));if(typeof e=="object"){const t=Object.keys(e);return t.sort(),"{"+t.map(r=>{let n=e[r];return typeof n=="function"?n="[function]":n=Ka(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let BA=1;function sg(e){let t=null,r=null,n=new Promise(o=>{t=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(t,e)});const s=o=>(n=n.then(o),n);function i(){return n}return{cancel:t,getPromise:i,wait:s}}const LA=[jt.errors.CALL_EXCEPTION,jt.errors.INSUFFICIENT_FUNDS,jt.errors.NONCE_EXPIRED,jt.errors.REPLACEMENT_UNDERPRICED,jt.errors.UNPREDICTABLE_GAS_LIMIT],KA=["address","args","errorArgs","errorSignature","method","transaction"];function Jl(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function jA(e,t){return function(r){const n={};r.forEach(i=>{const o=e(i.result);n[o]||(n[o]={count:0,result:i.result}),n[o].count++});const s=Object.keys(n);for(let i=0;i<s.length;i++){const o=n[s[i]];if(o.count>=t)return o.result}}}function qA(e,t,r){let n=Ka;switch(t){case"getBlockNumber":return function(s){const i=s.map(a=>a.result);let o=ig(s.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),i.indexOf(o+1)>=0&&o++,o>=e._highestBlockNumber&&(e._highestBlockNumber=o),e._highestBlockNumber};case"getGasPrice":return function(s){const i=s.map(o=>o.result);return i.sort(),i[Math.floor(i.length/2)]};case"getEtherPrice":return function(s){return ig(s.map(i=>i.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(s){return s==null?null:(s=za(s),s.confirmations=-1,Ka(s))};break;case"getBlock":r.includeTransactions?n=function(s){return s==null?null:(s=za(s),s.transactions=s.transactions.map(i=>(i=za(i),i.confirmations=-1,i)),Ka(s))}:n=function(s){return s==null?null:Ka(s)};break;default:throw new Error("unknown method: "+t)}return jA(n,e.quorum)}function wo(e,t){return sf(this,void 0,void 0,function*(){const r=e.provider;return r.blockNumber!=null&&r.blockNumber>=t||t===-1?r:h4(()=>new Promise((n,s)=>{setTimeout(function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function $A(e,t,r,n){return sf(this,void 0,void 0,function*(){let s=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return s[r]();case"getEtherPrice":if(s.getEtherPrice)return s.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&ms(n.blockTag)&&(s=yield wo(e,t)),s[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&ms(n.blockTag)&&(s=yield wo(e,t)),s.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&ms(n.blockTag)&&(s=yield wo(e,t)),s[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&ms(n.blockTag)&&(s=yield wo(e,t)),r==="call"&&n.blockTag?s[r](n.transaction,n.blockTag):s[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return s[r](n.transactionHash);case"getLogs":{let i=n.filter;return(i.fromBlock&&ms(i.fromBlock)||i.toBlock&&ms(i.toBlock))&&(s=yield wo(e,t)),s.getLogs(i)}}return na.throwError("unknown method error",jt.errors.UNKNOWN_ERROR,{method:r,params:n})})}class L4 extends Dy{constructor(t,r){t.length===0&&na.throwArgumentError("missing providers","providers",t);const n=t.map((o,a)=>{if(f4.isProvider(o)){const l=Gp(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:l,priority:1})}const f=za(o);f.priority==null&&(f.priority=1),f.stallTimeout==null&&(f.stallTimeout=Gp(o)?2e3:750),f.weight==null&&(f.weight=1);const c=f.weight;return(c%1||c>512||c<1)&&na.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(f)}),s=n.reduce((o,a)=>o+a.weight,0);r==null?r=s/2:r>s&&na.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let i=ng(n.map(o=>o.provider.network));i==null&&(i=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(i),Lr(this,"providerConfigs",Object.freeze(n)),Lr(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return sf(this,void 0,void 0,function*(){const t=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return ng(t)})}perform(t,r){return sf(this,void 0,void 0,function*(){if(t==="sendTransaction"){const f=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(r.signedTransaction).then(l=>l.hash,l=>l)));for(let c=0;c<f.length;c++){const l=f[c];if(typeof l=="string")return l}throw f[0]}this._highestBlockNumber===-1&&t!=="getBlockNumber"&&(yield this.getBlockNumber());const n=qA(this,t,r),s=B4(this.providerConfigs.map(za));s.sort((f,c)=>f.priority-c.priority);const i=this._highestBlockNumber;let o=0,a=!0;for(;;){const f=Yl();let c=s.filter(d=>d.runner&&f-d.start<d.stallTimeout).reduce((d,h)=>d+h.weight,0);for(;c<this.quorum&&o<s.length;){const d=s[o++],h=BA++;d.start=Yl(),d.staller=sg(d.stallTimeout),d.staller.wait(()=>{d.staller=null}),d.runner=$A(d,i,t,r).then(y=>{d.done=!0,d.result=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:Jl(d,Yl()),request:{method:t,params:Ga(r)},provider:this})},y=>{d.done=!0,d.error=y,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:Jl(d,Yl()),request:{method:t,params:Ga(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:h,backend:Jl(d,null),request:{method:t,params:Ga(r)},provider:this}),c+=d.weight}const l=[];s.forEach(d=>{d.done||!d.runner||(l.push(d.runner),d.staller&&l.push(d.staller.getPromise()))}),l.length&&(yield Promise.race(l));const u=s.filter(d=>d.done&&d.error==null);if(u.length>=this.quorum){const d=n(u);if(d!==void 0)return s.forEach(h=>{h.staller&&h.staller.cancel(),h.cancelled=!0}),d;a||(yield sg(100).getPromise()),a=!1}const p=s.reduce((d,h)=>{if(!h.done||h.error==null)return d;const y=h.error.code;return LA.indexOf(y)>=0&&(d[y]||(d[y]={error:h.error,weight:0}),d[y].weight+=h.weight),d},{});if(Object.keys(p).forEach(d=>{const h=p[d];if(h.weight<this.quorum)return;s.forEach(m=>{m.staller&&m.staller.cancel(),m.cancelled=!0});const y=h.error,g={};KA.forEach(m=>{y[m]!=null&&(g[m]=y[m])}),na.throwError(y.reason||y.message,d,g)}),s.filter(d=>!d.done).length===0)break}return s.forEach(f=>{f.staller&&f.staller.cancel(),f.cancelled=!0}),na.throwError("failed to meet quorum",jt.errors.SERVER_ERROR,{method:t,params:r,results:s.map(f=>Jl(f)),provider:this})})}}const K4=null,qd=new jt(xn),Cu="84842078b09946638c03157f83405213";class j4 extends Wf{constructor(t,r){const n=new jy(t,r),s=n.connection;s.password&&qd.throwError("INFURA WebSocket project secrets unsupported",jt.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const i=s.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(i,t),Lr(this,"apiKey",n.projectId),Lr(this,"projectId",n.projectId),Lr(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===Cu}}class jy extends Ds{static getWebSocketProvider(t,r){return new j4(t,r)}static getApiKey(t){const r={apiKey:Cu,projectId:Cu,projectSecret:null};return t==null||(typeof t=="string"?r.projectId=t:t.projectSecret!=null?(qd.assertArgument(typeof t.projectId=="string","projectSecret requires a projectId","projectId",t.projectId),qd.assertArgument(typeof t.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=t.projectId,r.projectSecret=t.projectSecret):t.projectId&&(r.projectId=t.projectId),r.apiKey=r.projectId),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"optimism-sepolia":n="optimism-sepolia.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;case"arbitrum-sepolia":n="arbitrum-sepolia.infura.io";break;default:qd.throwError("unsupported network",jt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(i,o)=>(r.projectId===Cu&&wl(),Promise.resolve(!0))};return r.projectSecret!=null&&(s.user="",s.password=r.projectSecret),s}isCommunityResource(){return this.projectId===Cu}}class VA extends al{send(t,r){const n={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const s={request:n,resolve:null,reject:null},i=new Promise((o,a)=>{s.resolve=o,s.reject=a});return this._pendingBatch.push(s),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const a=o.map(f=>f.request);return this.emit("debug",{action:"requestBatch",request:Ga(a),provider:this}),xy(this.connection,JSON.stringify(a)).then(f=>{this.emit("debug",{action:"response",request:a,response:f,provider:this}),o.forEach((c,l)=>{const u=f[l];if(u.error){const p=new Error(u.error.message);p.code=u.error.code,p.data=u.error.data,c.reject(p)}else c.resolve(u.result)})},f=>{this.emit("debug",{action:"response",error:f,request:a,provider:this}),o.forEach(c=>{c.reject(f)})})},10)),i}}const Nh=new jt(xn),FA="ETHERS_JS_SHARED";class q4 extends Ds{static getApiKey(t){return t&&typeof t!="string"&&Nh.throwArgumentError("invalid apiKey","apiKey",t),t||FA}static getUrl(t,r){Nh.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(t.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Nh.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const ag=new jt(xn),og="62e1ad51b37b8e00394bda3b";class $4 extends Ds{static getApiKey(t){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return t==null?r.applicationId=og:typeof t=="string"?r.applicationId=t:t.applicationSecretKey!=null?(r.applicationId=t.applicationId,r.applicationSecretKey=t.applicationSecretKey):t.applicationId?r.applicationId=t.applicationId:ag.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:ag.throwError("unsupported network",jt.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const s=`https://${n}/v1/lb/${r.applicationId}`,i={headers:{},url:s};return r.applicationSecretKey!=null&&(i.user="",i.password=r.applicationSecretKey),i}isCommunityResource(){return this.applicationId===og}}const cg=new jt(xn),HA="919b412a057b5e9c9b6dce193c5a60242d6efadb";class V4 extends Ds{static getApiKey(t){return t&&typeof t!="string"&&cg.throwArgumentError("invalid apiKey","apiKey",t),t||HA}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="ethers.quiknode.pro";break;case"goerli":n="ethers.ethereum-goerli.quiknode.pro";break;case"sepolia":n="ethers.ethereum-sepolia.quiknode.pro";break;case"holesky":n="ethers.ethereum-holesky.quiknode.pro";break;case"arbitrum":n="ethers.arbitrum-mainnet.quiknode.pro";break;case"arbitrum-goerli":n="ethers.arbitrum-goerli.quiknode.pro";break;case"arbitrum-sepolia":n="ethers.arbitrum-sepolia.quiknode.pro";break;case"base":n="ethers.base-mainnet.quiknode.pro";break;case"base-goerli":n="ethers.base-goerli.quiknode.pro";break;case"base-spolia":n="ethers.base-sepolia.quiknode.pro";break;case"bnb":n="ethers.bsc.quiknode.pro";break;case"bnbt":n="ethers.bsc-testnet.quiknode.pro";break;case"matic":n="ethers.matic.quiknode.pro";break;case"maticmum":n="ethers.matic-testnet.quiknode.pro";break;case"optimism":n="ethers.optimism.quiknode.pro";break;case"optimism-goerli":n="ethers.optimism-goerli.quiknode.pro";break;case"optimism-sepolia":n="ethers.optimism-sepolia.quiknode.pro";break;case"xdai":n="ethers.xdai.quiknode.pro";break;default:cg.throwArgumentError("unsupported network","network",arguments[0])}return"https://"+n+"/"+r}}const ug=new jt(xn);function qy(e,t){if(e==null&&(e="homestead"),typeof e=="string"){const n=e.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new al(e);case"ws":case"wss":return new Wf(e);default:ug.throwArgumentError("unsupported URL scheme","network",e)}}const r=p4(e);return(!r||!r._defaultProvider)&&ug.throwError("unsupported getDefaultProvider network",jt.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:L4,AlchemyProvider:Ky,AnkrProvider:D4,CloudflareProvider:x4,EtherscanProvider:U4,InfuraProvider:jy,JsonRpcProvider:al,NodesmithProvider:q4,PocketProvider:$4,QuickNodeProvider:V4,Web3Provider:y4,IpcProvider:K4},t)}const F4=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Ky,AlchemyWebSocketProvider:N4,AnkrProvider:D4,BaseProvider:Dy,CloudflareProvider:x4,EtherscanProvider:U4,FallbackProvider:L4,Formatter:Mw,InfuraProvider:jy,InfuraWebSocketProvider:j4,IpcProvider:K4,JsonRpcBatchProvider:VA,JsonRpcProvider:al,JsonRpcSigner:Ow,NodesmithProvider:q4,PocketProvider:$4,Provider:f4,QuickNodeProvider:V4,Resolver:Nw,StaticJsonRpcProvider:Dw,UrlJsonRpcProvider:Ds,Web3Provider:y4,WebSocketProvider:Wf,getDefaultProvider:qy,getNetwork:p4,isCommunityResourcable:xw,isCommunityResource:Gp,showThrottleMessage:wl},Symbol.toStringTag,{value:"Module"})),GA="solidity/5.8.0",zA=new RegExp("^bytes([0-9]+)$"),WA=new RegExp("^(u?int)([0-9]*)$"),YA=new RegExp("^(.*)\\[([0-9]*)\\]$"),JA="0000000000000000000000000000000000000000000000000000000000000000",xa=new jt(GA);function H4(e,t,r){switch(e){case"address":return r?Kd(t,32):ra(t);case"string":return Ny(t);case"bytes":return ra(t);case"bool":return t=t?"0x01":"0x00",r?Kd(t,32):ra(t)}let n=e.match(WA);if(n){let s=parseInt(n[2]||"256");return(n[2]&&String(s)!==n[2]||s%8!==0||s===0||s>256)&&xa.throwArgumentError("invalid number type","type",e),r&&(s=256),t=_l.from(t).toTwos(s),Kd(t,s/8)}if(n=e.match(zA),n){const s=parseInt(n[1]);return(String(s)!==n[1]||s===0||s>32)&&xa.throwArgumentError("invalid bytes type","type",e),ra(t).byteLength!==s&&xa.throwArgumentError(`invalid value for ${e}`,"value",t),r?ra((t+JA).substring(0,66)):t}if(n=e.match(YA),n&&Array.isArray(t)){const s=n[1];parseInt(n[2]||String(t.length))!=t.length&&xa.throwArgumentError(`invalid array length for ${e}`,"value",t);const o=[];return t.forEach(function(a){o.push(H4(s,a,!0))}),zf(o)}return xa.throwArgumentError("invalid type","type",e)}function $y(e,t){e.length!=t.length&&xa.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach(function(n,s){r.push(H4(n,t[s]))}),sl(zf(r))}function ZA(e,t){return g4($y(e,t))}function XA(e,t){return m4($y(e,t))}const G4=Object.freeze(Object.defineProperty({__proto__:null,AbiCoder:Uw,ConstructorFragment:Bw,ErrorFragment:Lw,EventFragment:Kw,FormatTypes:jw,Fragment:qw,FunctionFragment:$w,HDNode:Vw,Indexed:Fw,Interface:Hw,LogDescription:Gw,Logger:jt,ParamType:zw,RLP:Ww,SigningKey:Yw,get SupportedAlgorithm(){return Jw},TransactionDescription:Zw,get TransactionTypes(){return Xw},get UnicodeNormalizationForm(){return u4},Utf8ErrorFuncs:Qw,get Utf8ErrorReason(){return eE},_TypedDataEncoder:tE,_fetchData:rE,_toEscapedUtf8String:nE,accessListify:d4,arrayify:ra,base58:iE,base64:yA,checkProperties:sE,checkResultErrors:aE,commify:oE,computeAddress:cE,computeHmac:uE,computePublicKey:lE,concat:zf,deepCopy:Ga,defaultAbiCoder:dE,defaultPath:fE,defineReadOnly:Lr,dnsEncode:hE,entropyToMnemonic:pE,fetchJson:xy,formatBytes32String:mA,formatEther:yE,formatUnits:gE,getAccountPath:mE,getAddress:vE,getContractAddress:bE,getCreate2Address:_E,getIcapAddress:wE,getJsonWalletAddress:EE,getStatic:AE,hashMessage:SE,hexConcat:PE,hexDataLength:TE,hexDataSlice:IE,hexStripZeros:CE,hexValue:l4,hexZeroPad:RE,hexlify:sl,id:kE,isAddress:ME,isBytes:OE,isBytesLike:NE,isHexString:ms,isValidMnemonic:DE,isValidName:xE,joinSignature:UE,keccak256:g4,mnemonicToEntropy:BE,mnemonicToSeed:LE,namehash:KE,nameprep:MA,parseBytes32String:vA,parseEther:jE,parseTransaction:qE,parseUnits:$E,poll:h4,randomBytes:VE,recoverAddress:FE,recoverPublicKey:HE,resolveProperties:GE,ripemd160:zE,serializeTransaction:WE,sha256:m4,sha512:YE,shallowCopy:za,shuffled:B4,solidityKeccak256:ZA,solidityPack:$y,soliditySha256:XA,splitSignature:JE,stripZeros:ZE,toUtf8Bytes:Ny,toUtf8CodePoints:Hp,toUtf8String:c4,verifyMessage:XE,verifyTypedData:QE,zeroPad:Kd},Symbol.toStringTag,{value:"Module"})),Vy="ethers/5.8.0",z4=new jt(Vy),W4=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:v4,BigNumber:_l,Contract:b4,ContractFactory:_4,FixedNumber:w4,Signer:E4,VoidSigner:A4,Wallet:S4,Wordlist:P4,constants:M4,get errors(){return T4},getDefaultProvider:qy,logger:z4,providers:F4,utils:G4,version:Vy,wordlists:I4},Symbol.toStringTag,{value:"Module"}));try{const e=window;e._ethers==null&&(e._ethers=W4)}catch{}const QA=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:v4,BigNumber:_l,Contract:b4,ContractFactory:_4,FixedNumber:w4,Signer:E4,VoidSigner:A4,Wallet:S4,Wordlist:P4,constants:M4,get errors(){return T4},ethers:W4,getDefaultProvider:qy,logger:z4,providers:F4,utils:G4,version:Vy,wordlists:I4},Symbol.toStringTag,{value:"Module"}));var Fy={},Dh={},xh={},Eo={},Uh={},Ls={},Bh={},Lh={};const eS="@pushprotocol/restapi",tS="1.7.32",rS="commonjs",nS={registry:"https://registry.npmjs.org/"},iS={ethers:"^5.0.0 || ^6.0.0"},sS={ethers:{optional:!0}},aS={"@metamask/eth-sig-util":"^5.0.2",buffer:"^6.0.3","crypto-js":"^4.1.1",immer:"^10.0.2",joi:"^17.9.2",livepeer:"^2.5.8","lru-cache":"^10.1.0",openpgp:"^5.5.0","simple-peer":"^9.11.1","socket.io-client":"^4.7.2","video-stream-merger":"^4.0.1",viem:"^2.28.0",axios:"^0.27.2",uuid:"^9.0.0","unique-names-generator":"^4.7.1",tslib:"^2.3.0"},oS={test:"TS_NODE_PROJECT='./tsconfig.mocha.json' NODE_OPTIONS='--loader ts-node/esm' DOTENV_CONFIG_PATH='./tests/.env' mocha -r ts-node/register -r dotenv/config 'tests/**/*.test.ts' --timeout 1200000 --require tests/root.ts --serial"},cS={"@types/chai":"^4.3.4","@types/chai-as-promised":"^7.1.5","@types/crypto-js":"^4.1.1","@types/mocha":"^10.0.1",chai:"^4.3.7","chai-as-promised":"^7.1.1",envfile:"^7.1.0",mocha:"^10.2.0","mocha-typescript":"^1.1.17","ts-node":"^10.9.1",typescript:"^5.0.2",undici:"^6.21.2","web-streams-polyfill":"^4.1.0","@ethersproject/providers":"^5.7.2","@lit-protocol/auth-browser":"^7.0.5","@lit-protocol/auth-helpers":"^7.0.5","@lit-protocol/constants":"^7.0.5","@lit-protocol/contracts-sdk":"^7.0.5","@lit-protocol/lit-auth-client":"^7.0.5","@lit-protocol/lit-node-client":"^7.0.5","@lit-protocol/pkp-ethers":"^7.0.5","@lit-protocol/types":"^7.0.5","@lit-protocol/wrapped-keys":"^7.0.3","@pushprotocol/restapi":"^1.7.32-exp.1","@zerodev/hooks":"^5.3.0","@zerodev/intent":"^0.0.7","@zerodev/multi-chain-ecdsa-validator":"^5.4.2","@zerodev/permissions":"^5.5.0","@zerodev/remote-signer":"^5.3.0","@zerodev/session-key":"^5.5.0","@zerodev/weighted-ecdsa-validator":"^5.4.0",dotenv:"^16.3.1",ethers:"^5.7.2","isomorphic-fetch":"^3.0.0","@zerodev/ecdsa-validator":"^5.4.7","@zerodev/sdk":"^5.4.29"},uS="./src/index.js",lS="./src/index.d.ts",Y4={name:eS,version:tS,type:rS,publishConfig:nS,peerDependencies:iS,peerDependenciesMeta:sS,dependencies:aS,scripts:oS,devDependencies:cS,main:uS,typings:lS};var lg;function Je(){return lg||(lg=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PACKAGE_BUILD=e.ALPHA_FEATURES=e.MessageType=e.ENCRYPTION_TYPE=e.ENV=void 0;const t=Y4;var r;(function(i){i.PROD="prod",i.STAGING="staging",i.DEV="dev",i.LOCAL="local"})(r=e.ENV||(e.ENV={}));var n;(function(i){i.PGP_V1="x25519-xsalsa20-poly1305",i.PGP_V2="aes256GcmHkdfSha256",i.PGP_V3="eip191-aes256-gcm-hkdf-sha256",i.NFTPGP_V1="pgpv1:nft",i.SCWPGP_V1="pgpv1:scw"})(n=e.ENCRYPTION_TYPE||(e.ENCRYPTION_TYPE={})),function(i){i.TEXT="Text",i.IMAGE="Image",i.VIDEO="Video",i.AUDIO="Audio",i.FILE="File",i.GIF="GIF",i.MEDIA_EMBED="MediaEmbed",i.META="Meta",i.REACTION="Reaction",i.RECEIPT="Receipt",i.USER_ACTIVITY="UserActivity",i.INTENT="Intent",i.REPLY="Reply",i.COMPOSITE="Composite",i.PAYMENT="Payment"}(e.MessageType||(e.MessageType={})),e.ALPHA_FEATURES={SCALABILITY_V2:"SCALABILITY_V2"},e.PACKAGE_BUILD=t.version.includes("alpha")?"ALPHA":"STABLE";const s={ENV:r,ENCRYPTION_TYPE:n,PAGINATION:{INITIAL_PAGE:1,LIMIT:10,LIMIT_MIN:1,LIMIT_MAX:50},DEFAULT_CHAIN_ID:11155111,DEV_CHAIN_ID:99999,NON_ETH_CHAINS:[137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,59141,59144,111557560,7560,84532,8453],ETH_CHAINS:[1,11155111],ENC_TYPE_V1:"x25519-xsalsa20-poly1305",ENC_TYPE_V2:"aes256GcmHkdfSha256",ENC_TYPE_V3:"eip191-aes256-gcm-hkdf-sha256",ENC_TYPE_V4:"pgpv1:nft",ENC_TYPE_V5:"pgpv1:scw",ALPHA_FEATURES:e.ALPHA_FEATURES};e.default=s}(Lh)),Lh}var Ao={},dg;function dS(){return dg||(dg=1,Object.defineProperty(Ao,"__esModule",{value:!0}),Ao.coreABI=void 0,Ao.coreABI=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"AddChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"AddSubGraph",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"}],name:"ChannelBlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"uint256",name:"totalNotifOptions",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"},{indexed:!1,internalType:"string",name:"_notifDescription",type:"string"}],name:"ChannelNotifcationSettingsAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"ChannelOwnershipTransfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"revoker",type:"address"}],name:"ChannelVerificationRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"verifier",type:"address"}],name:"ChannelVerified",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountClaimed",type:"uint256"}],name:"ChatIncentiveClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"DeactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"requestSender",type:"address"},{indexed:!1,internalType:"address",name:"requestReceiver",type:"address"},{indexed:!1,internalType:"uint256",name:"amountForReqReceiver",type:"uint256"},{indexed:!1,internalType:"uint256",name:"feePoolAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"timestamp",type:"uint256"}],name:"IncentivizeChatReqReceived",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"ReactivateChannel",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"rewardAmount",type:"uint256"}],name:"RewardsClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"rewardAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fromEpoch",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tillEpoch",type:"uint256"}],name:"RewardsHarvested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountStaked",type:"uint256"}],name:"Staked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"uint256",name:"amountRefunded",type:"uint256"}],name:"TimeBoundChannelDestroyed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"uint256",name:"amountUnstaked",type:"uint256"}],name:"Unstaked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"},{indexed:!0,internalType:"uint256",name:"amountDeposited",type:"uint256"}],name:"UpdateChannel",type:"event"},{inputs:[],name:"ADD_CHANNEL_MIN_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CHANNEL_POOL_FUNDS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"CREATE_CHANNEL_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FEE_AMOUNT",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"MIN_POOL_CONTRIBUTION",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PROTOCOL_POOL_FEES",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"PUSH_TOKEN_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"REFERRAL_CODE",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNISWAP_V2_ROUTER",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH_ADDRESS",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"aDaiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_rewardAmount",type:"uint256"}],name:"addPoolFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_subGraphData",type:"bytes"}],name:"addSubGraph",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchVerification",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"blockChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_user",type:"address"},{internalType:"uint256",name:"_epochId",type:"uint256"}],name:"calculateEpochRewards",outputs:[{internalType:"uint256",name:"rewards",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"celebUserFunds",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"channelById",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelNotifSettings",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channelUpdateCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"channels",outputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"channelType",type:"uint8"},{internalType:"uint8",name:"channelState",type:"uint8"},{internalType:"address",name:"verifiedBy",type:"address"},{internalType:"uint256",name:"poolContribution",type:"uint256"},{internalType:"uint256",name:"channelHistoricalZ",type:"uint256"},{internalType:"uint256",name:"channelFairShareCount",type:"uint256"},{internalType:"uint256",name:"channelLastUpdate",type:"uint256"},{internalType:"uint256",name:"channelStartBlock",type:"uint256"},{internalType:"uint256",name:"channelUpdateBlock",type:"uint256"},{internalType:"uint256",name:"channelWeight",type:"uint256"},{internalType:"uint256",name:"expiryTime",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"channelsCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"claimChatIncentives",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_notifOptions",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"},{internalType:"string",name:"_notifDescription",type:"string"},{internalType:"uint256",name:"_amountDeposited",type:"uint256"}],name:"createChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum EPNSCoreStorageV1_5.ChannelType",name:"_channelType",type:"uint8"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"uint256",name:"_channelExpiryTime",type:"uint256"}],name:"createChannelWithPUSH",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"daiAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"daoHarvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channelAddress",type:"address"}],name:"destroyTimeBoundChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"epnsCommunicator",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epochDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"epochToTotalStakedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"genesisEpoch",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"getChannelVerfication",outputs:[{internalType:"uint8",name:"verificationStatus",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupFairShareCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupHistoricalZ",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupLastUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"groupNormalizedWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"requestSender",type:"address"},{internalType:"address",name:"requestReceiver",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"handleChatRequestData",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"harvestAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_tillEpoch",type:"uint256"}],name:"harvestPaginated",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"address",name:"_pushTokenAddress",type:"address"},{internalType:"address",name:"_wethAddress",type:"address"},{internalType:"address",name:"_uniswapRouterAddress",type:"address"},{internalType:"address",name:"_lendingPoolProviderAddress",type:"address"},{internalType:"address",name:"_daiAddress",type:"address"},{internalType:"address",name:"_aDaiAddress",type:"address"},{internalType:"uint256",name:"_referralCode",type:"uint256"}],name:"initialize",outputs:[{internalType:"bool",name:"success",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"initializeStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_from",type:"uint256"},{internalType:"uint256",name:"_to",type:"uint256"}],name:"lastEpochRelative",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"lendingPoolProviderAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"previouslySetEpochRewards",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"reactivateChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_commAddress",type:"address"}],name:"setEpnsCommunicatorAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setFeeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newFees",type:"uint256"}],name:"setMinChannelCreationFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_newAmount",type:"uint256"}],name:"setMinPoolContribution",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_amount",type:"uint256"}],name:"stake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalStakedAmount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unPauseContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unstake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unverifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"bytes",name:"_newIdentity",type:"bytes"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"updateChannelMeta",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"userFeesInfo",outputs:[{internalType:"uint256",name:"stakedAmount",type:"uint256"},{internalType:"uint256",name:"stakedWeight",type:"uint256"},{internalType:"uint256",name:"lastStakedBlock",type:"uint256"},{internalType:"uint256",name:"lastClaimedBlock",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"usersRewardsClaimed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"verifyChannel",outputs:[],stateMutability:"nonpayable",type:"function"}]),Ao}var So={},fg;function fS(){return fg||(fg=1,Object.defineProperty(So,"__esModule",{value:!0}),So.commABI=void 0,So.commABI=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"AddDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"_chainName",type:"string"},{indexed:!0,internalType:"uint256",name:"_chainID",type:"uint256"},{indexed:!0,internalType:"address",name:"_channelOwnerAddress",type:"address"},{indexed:!1,internalType:"string",name:"_ethereumChannelAddress",type:"string"}],name:"ChannelAlias",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"bytes",name:"publickey",type:"bytes"}],name:"PublicKeyRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"channel",type:"address"},{indexed:!1,internalType:"address",name:"delegate",type:"address"}],name:"RemoveDelegate",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"bytes",name:"identity",type:"bytes"}],name:"SendNotification",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Subscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"channel",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"}],name:"Unsubscribe",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_channel",type:"address"},{indexed:!1,internalType:"address",name:"_user",type:"address"},{indexed:!1,internalType:"uint256",name:"_notifID",type:"uint256"},{indexed:!1,internalType:"string",name:"_notifSettings",type:"string"}],name:"UserNotifcationSettingsAdded",type:"event"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"EPNSCoreAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"NAME_HASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SEND_NOTIFICATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UNSUBSCRIBE_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"addDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchSubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address[]",name:"_channelList",type:"address[]"}],name:"batchUnsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"broadcastUserPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"chainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"chainName",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"uint256",name:"_notifID",type:"uint256"},{internalType:"string",name:"_notifSettings",type:"string"}],name:"changeUserChannelSettings",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"completeMigration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"delegatedNotificationSenders",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_publicKey",type:"bytes"}],name:"getWalletFromPublicKey",outputs:[{internalType:"address",name:"wallet",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[],name:"governance",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_pushChannelAdmin",type:"address"},{internalType:"string",name:"_chainName",type:"string"}],name:"initialize",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isMigrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"isUserSubscribed",outputs:[{internalType:"bool",name:"isSubscriber",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"mapAddressUsers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_startIndex",type:"uint256"},{internalType:"uint256",name:"_endIndex",type:"uint256"},{internalType:"address[]",name:"_channelList",type:"address[]"},{internalType:"address[]",name:"_usersList",type:"address[]"}],name:"migrateSubscribeData",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pushChannelAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_delegate",type:"address"}],name:"removeDelegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"sendNotifBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_recipient",type:"address"},{internalType:"bytes",name:"_identity",type:"bytes"}],name:"sendNotification",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_coreAddress",type:"address"}],name:"setEPNSCoreAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_governanceAddress",type:"address"}],name:"setGovernanceAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"subscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"subscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"},{internalType:"address",name:"_user",type:"address"}],name:"subscribeViaCore",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_newAdmin",type:"address"}],name:"transferPushChannelAdminControl",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_channel",type:"address"}],name:"unsubscribe",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"channel",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"unsubscribeBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"userToChannelNotifs",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"users",outputs:[{internalType:"bool",name:"userActivated",type:"bool"},{internalType:"bool",name:"publicKeyRegistered",type:"bool"},{internalType:"uint256",name:"userStartBlock",type:"uint256"},{internalType:"uint256",name:"subscribedCount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"usersCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"_channelAddress",type:"string"}],name:"verifyChannelAlias",outputs:[],stateMutability:"nonpayable",type:"function"}]),So}var Po={},hg;function hS(){return hg||(hg=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.tokenABI=void 0,Po.tokenABI=[{inputs:[{internalType:"address",name:"account",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegator",type:"address"},{indexed:!0,internalType:"address",name:"fromDelegate",type:"address"},{indexed:!0,internalType:"address",name:"toDelegate",type:"address"}],name:"DelegateChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!1,internalType:"uint256",name:"previousBalance",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newBalance",type:"uint256"}],name:"DelegateVotesChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"holder",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"HolderWeightChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DELEGATION_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"born",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint32",name:"",type:"uint32"}],name:"checkpoints",outputs:[{internalType:"uint32",name:"fromBlock",type:"uint32"},{internalType:"uint96",name:"votes",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"}],name:"delegate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"delegatee",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"delegateBySig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"delegates",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getCurrentVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getPriorVotes",outputs:[{internalType:"uint96",name:"",type:"uint96"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"holderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"holderWeight",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"numCheckpoints",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"holder",type:"address"}],name:"resetHolderWeight",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"delegate",type:"address"}],name:"returnHolderDelegation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"returnHolderRatio",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"value",type:"bool"}],name:"setHolderDelegation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"src",type:"address"},{internalType:"address",name:"dst",type:"address"},{internalType:"uint256",name:"rawAmount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}]),Po}const J4=El(cA);var tn={};const ya=El(uA);var pg;function pS(){if(pg)return tn;pg=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.lineaSepoliaTestnet=tn.cyberConnectMainnet=tn.cyberConnectTestnet=tn.berachainTestnet=tn.polygonAmoy=tn.polygonZkEvmCordona=void 0;const e=ya;return tn.polygonZkEvmCordona=(0,e.defineChain)({id:2442,name:"Polygon zkEVM Cardona Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com/"]},public:{http:["https://rpc.cardona.zkevm-rpc.com/"]}},blockExplorers:{default:{name:"Polygon zkEVM Cardona",url:" https://cardona-zkevm.polygonscan.com/"}},testnet:!0}),tn.polygonAmoy=(0,e.defineChain)({id:80002,name:"Polygon Amoy Testnet",network:"polygon-amoy",nativeCurrency:{decimals:18,name:"MATIC",symbol:"MATIC"},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology/"]},public:{http:["https://rpc-amoy.polygon.technology/"]}},blockExplorers:{default:{name:"Polygon Amoy",url:"https://www.oklink.com/amoy"}},testnet:!0}),tn.berachainTestnet=(0,e.defineChain)({id:80085,name:"Berachain Artio",network:"berachain-testnet",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]},public:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),tn.cyberConnectTestnet=(0,e.defineChain)({id:111557560,name:"Cyber Testnet",network:"cyberconnect-testent",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]},public:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),tn.cyberConnectMainnet=(0,e.defineChain)({id:7560,name:"Cyber",network:"cyberconnect-mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]},public:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),tn.lineaSepoliaTestnet=(0,e.defineChain)({id:59141,name:"Linea Sepolia Testnet",network:"linea-sepolia-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]},public:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),tn}var yg;function en(){return yg||(yg=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ALPHA_FEATURE_CONFIG=e.VIEM_CONFIG=e.CHANNEL_TYPE=e.ABIS=e.MIN_TOKEN_BALANCE=e.TOKEN_VIEM_NETWORK_MAP=e.TOKEN=e.CORE_CONFIG=e.VIEM_CORE_CONFIG=e.CHAIN_NAME=e.CHAIN_ID=e.ALIAS_CHAIN_ID=e.ETH_CHAIN_ID=e.API_BASE_URL=void 0;const t=Je(),r=dS(),n=fS(),s=hS(),i=J4,o=pS();e.API_BASE_URL={[t.ENV.PROD]:"https://backend.epns.io/apis",[t.ENV.STAGING]:"https://backend-staging.epns.io/apis",[t.ENV.DEV]:"https://backend-dev.epns.io/apis",[t.ENV.LOCAL]:"http://localhost:4000/apis"};const a={ETH_MAINNET:"eip155:1",ETH_SEPOLIA:"eip155:11155111",POLYGON_MAINNET:"eip155:137",POLYGON_AMOY:"eip155:80002",BSC_MAINNET:"eip155:56",BSC_TESTNET:"eip155:97",OPTIMISM_TESTNET:"eip155:11155420",OPTIMISM_MAINNET:"eip155:10",POLYGON_ZK_EVM_TESTNET:"eip155:2442",POLYGON_ZK_EVM_MAINNET:"eip155:1101",ARBITRUM_TESTNET:"eip155:421614",ARBITRUMONE_MAINNET:"eip155:42161",FUSE_TESTNET:"eip155:123",FUSE_MAINNET:"eip155:122",BERACHAIN_TESTNET:"eip155:80085",LINEA_MAINNET:"eip155:59144",LINEA_TESTNET:"eip155:59141",CYBER_CONNECT_TESTNET:"eip155:111557560",CYBER_CONNECT_MAINNET:"eip155:7560",BASE_TESTNET:"eip155:84532",BASE_MAINNET:"eip155:8453"};e.ETH_CHAIN_ID={[t.ENV.PROD]:1,[t.ENV.STAGING]:11155111,[t.ENV.DEV]:11155111,[t.ENV.LOCAL]:11155111},e.ALIAS_CHAIN_ID={POLYGON:{[t.ENV.PROD]:137,[t.ENV.STAGING]:80002,[t.ENV.DEV]:80002,[t.ENV.LOCAL]:80002},BSC:{[t.ENV.PROD]:56,[t.ENV.STAGING]:97,[t.ENV.DEV]:97,[t.ENV.LOCAL]:97},OPTIMISM:{[t.ENV.PROD]:10,[t.ENV.STAGING]:11155420,[t.ENV.DEV]:11155420,[t.ENV.LOCAL]:11155420},POLYGONZKEVM:{[t.ENV.PROD]:1101,[t.ENV.STAGING]:2442,[t.ENV.DEV]:2442,[t.ENV.LOCAL]:2442},ARBITRUMONE:{[t.ENV.PROD]:42161,[t.ENV.STAGING]:421614,[t.ENV.DEV]:421614,[t.ENV.LOCAL]:421614},FUSE:{[t.ENV.PROD]:122,[t.ENV.STAGING]:123,[t.ENV.DEV]:123,[t.ENV.LOCAL]:123},BERACHAIN:{[t.ENV.PROD]:0,[t.ENV.STAGING]:80085,[t.ENV.DEV]:80085,[t.ENV.LOCAL]:80085},LINEA:{[t.ENV.PROD]:59144,[t.ENV.STAGING]:59141,[t.ENV.DEV]:59141,[t.ENV.LOCAL]:59141},CYBERCONNECT:{[t.ENV.PROD]:7560,[t.ENV.STAGING]:111557560,[t.ENV.DEV]:111557560,[t.ENV.LOCAL]:111557560},BASE:{[t.ENV.PROD]:8453,[t.ENV.STAGING]:84532,[t.ENV.DEV]:84532,[t.ENV.LOCAL]:84532}},e.CHAIN_ID=Object.assign({ETHEREUM:e.ETH_CHAIN_ID},e.ALIAS_CHAIN_ID),e.CHAIN_NAME={1:"ETHEREUM",11155111:"ETHEREUM",137:"POLYGON",80002:"POLYGON",56:"BSC",97:"BSC",10:"OPTIMISM",11155420:"OPTIMISM",1101:"POLYGONZKEVM",2442:"POLYGONZKEVM",421614:"ARBITRUN",42161:"ARBITRUM",122:"FUSE",123:"FUSE",80085:"BERACHAIN",59144:"LINEA",59141:"LINEA",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",8453:"BASE_MAINNET",84532:"BASE_TESTNET"},e.VIEM_CORE_CONFIG={[t.ENV.PROD]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}},e.CORE_CONFIG={[t.ENV.PROD]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_CORE_CONTRACT:"0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE"},[t.ENV.STAGING]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_CORE_CONTRACT:"0x9d65129223451fbd58fc299c635cd919baf2564c"},[t.ENV.DEV]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"},[t.ENV.LOCAL]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_CORE_CONTRACT:"0x5ab1520e2bd519bdab2e1347eee81c00a77f4946"}};const f={[t.ENV.PROD]:{[a.ETH_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.CYBER_CONNECT_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.BASE_MAINNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}};e.default=f,e.TOKEN={[t.ENV.PROD]:"0xf418588522d5dd018b425E472991E52EBBeEEEEE",[t.ENV.STAGING]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.DEV]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804",[t.ENV.LOCAL]:"0x37c779a1564DCc0e3914aB130e0e787d93e21804"},e.TOKEN_VIEM_NETWORK_MAP={[t.ENV.PROD]:i.mainnet,[t.ENV.STAGING]:i.sepolia,[t.ENV.DEV]:i.sepolia,[t.ENV.LOCAL]:i.sepolia},e.MIN_TOKEN_BALANCE={[t.ENV.PROD]:50,[t.ENV.STAGING]:50,[t.ENV.DEV]:50,[t.ENV.LOCAL]:50},e.ABIS={CORE:r.coreABI,COMM:n.commABI,TOKEN:s.tokenABI},e.CHANNEL_TYPE={TIMEBOUND:4,GENERAL:2},e.VIEM_CONFIG={[t.ENV.PROD]:{[a.ETH_MAINNET]:{NETWORK:i.mainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_MAINNET]:{NETWORK:i.polygon,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_MAINNET]:{NETWORK:i.bsc,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_MAINNET]:{NETWORK:i.optimism,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.POLYGON_ZK_EVM_MAINNET]:{NETWORK:i.polygonZkEvm,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.ARBITRUMONE_MAINNET]:{NETWORK:i.arbitrum,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.FUSE_MAINNET]:{NETWORK:i.fuse,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.LINEA_MAINNET]:{NETWORK:i.linea,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0x0d8e75CB5d8873c43c5d9Add71Fd71a09F7Ef890"},[a.CYBER_CONNECT_MAINNET]:{NETWORK:o.cyberConnectMainnet,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BASE_MAINNET]:{NETWORK:i.base,API_BASE_URL:e.API_BASE_URL[t.ENV.PROD],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"}},[t.ENV.STAGING]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x0c34d54a09cfe75bccd878a469206ae77e0fe6e7"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489b7af21ceb969f49a90e481274966ce9d74d"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9Dc25996ba72A2FD7E64e7a674232a683f406F1A"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x7b9C405e261ba671f008c20D0321f62d08C140EC"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.STAGING],EPNS_COMMUNICATOR_CONTRACT:"0x6e489B7af21cEb969f49A90E481274966ce9D74d"}},[t.ENV.DEV]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.DEV],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}},[t.ENV.LOCAL]:{[a.ETH_SEPOLIA]:{NETWORK:i.sepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9dDCD7ed7151afab43044E4D694FA064742C428c"},[a.POLYGON_AMOY]:{NETWORK:o.polygonAmoy,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.BSC_TESTNET]:{NETWORK:i.bscTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8"},[a.OPTIMISM_TESTNET]:{NETWORK:i.optimismSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.POLYGON_ZK_EVM_TESTNET]:{NETWORK:o.polygonZkEvmCordona,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550b5c92baa056fc0f08132f49508145f"},[a.ARBITRUM_TESTNET]:{NETWORK:i.arbitrumSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x754787358fac861ef904c92d54f7adb659779317"},[a.FUSE_TESTNET]:{NETWORK:i.fuseSparknet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x7eBb54D86CF928115965DB596a3E600404dD8039"},[a.BERACHAIN_TESTNET]:{NETWORK:o.berachainTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB"},[a.LINEA_TESTNET]:{NETWORK:o.lineaSepoliaTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.CYBER_CONNECT_TESTNET]:{NETWORK:o.cyberConnectTestnet,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"},[a.BASE_TESTNET]:{NETWORK:i.baseSepolia,API_BASE_URL:e.API_BASE_URL[t.ENV.LOCAL],EPNS_COMMUNICATOR_CONTRACT:"0x9cb3bd7550B5c92baA056Fc0F08132f49508145F"}}},e.ALPHA_FEATURE_CONFIG={STABLE:{feature:[]},ALPHA:{feature:[t.default.ALPHA_FEATURES.SCALABILITY_V2]}}}(Bh)),Bh}var gg;function yS(){if(gg)return Ls;gg=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.getAPIBaseUrls=Ls.getConfig=void 0;const e=en(),t=(n,{blockchain:s,networkId:i})=>{const o=`${s}:${i}`,a=e.default[n][o];if(!a)throw Error(`
2
+ [Push SDK] - cannot determine config for
3
+ env: ${n},
4
+ blockchain: ${s},
5
+ networkId: ${i}
6
+ `);return a};Ls.getConfig=t;function r(n){if(!n)throw Error("ENV not provided!");return e.API_BASE_URL[n]}return Ls.getAPIBaseUrls=r,Ls}var Kh={},jh={},qh={},$h={},Ri={},mg;function ga(){if(mg)return Ri;mg=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.generateRandomSecret=Ri.aesDecrypt=Ri.aesEncrypt=void 0;const e=qr,t=({plainText:s,secretKey:i})=>e.AES.encrypt(s,i).toString();Ri.aesEncrypt=t;const r=({cipherText:s,secretKey:i})=>e.AES.decrypt(s,i).toString(e.enc.Utf8);Ri.aesDecrypt=r;const n=s=>{let i="";const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",a=o.length;for(let f=0;f<s;f++)i+=o.charAt(Math.floor(Math.random()*a));return i};return Ri.generateRandomSecret=n,Ri}var rn={};/*! OpenPGP.js v5.11.3 - 2025-05-19 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */const Sn=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ja=Symbol("doneWritingPromise"),Z4=Symbol("doneWritingResolve"),X4=Symbol("doneWritingReject"),To=Symbol("readingIndex");class pi extends Array{constructor(){super(),this[ja]=new Promise((t,r)=>{this[Z4]=t,this[X4]=r}),this[ja].catch(()=>{})}}function vr(e){return e&&e.getReader&&Array.isArray(e)}function Ru(e){if(!vr(e)){const t=e.getWriter(),r=t.releaseLock;return t.releaseLock=()=>{t.closed.catch(function(){}),r.call(t)},t}this.stream=e}pi.prototype.getReader=function(){return this[To]===void 0&&(this[To]=0),{read:async()=>(await this[ja],this[To]===this.length?{value:void 0,done:!0}:{value:this[this[To]++],done:!1})}},pi.prototype.readToEnd=async function(e){await this[ja];const t=e(this.slice(this[To]));return this.length=0,t},pi.prototype.clone=function(){const e=new pi;return e[ja]=this[ja].then(()=>{e.push(...this)}),e},Ru.prototype.write=async function(e){this.stream.push(e)},Ru.prototype.close=async function(){this.stream[Z4]()},Ru.prototype.abort=async function(e){return this.stream[X4](e),e},Ru.prototype.releaseLock=function(){};const Yf=typeof Sn.process=="object"&&typeof Sn.process.versions=="object",vg=Yf&&void 0;function yn(e){return vr(e)?"array":Sn.ReadableStream&&Sn.ReadableStream.prototype.isPrototypeOf(e)?"web":Wi&&Wi.prototype.isPrototypeOf(e)?"ponyfill":vg&&vg.prototype.isPrototypeOf(e)?"node":!(!e||!e.getReader)&&"web-like"}function Jf(e){return Uint8Array.prototype.isPrototypeOf(e)}function Q4(e){if(e.length===1)return e[0];let t=0;for(let s=0;s<e.length;s++){if(!Jf(e[s]))throw Error("concatUint8Array: Data must be in the form of a Uint8Array");t+=e[s].length}const r=new Uint8Array(t);let n=0;return e.forEach(function(s){r.set(s,n),n+=s.length}),r}const gS=Yf&&void 0,bg=Yf&&void 0;let Zf,Hy;if(bg){Zf=function(t){let r=!1;return new Wi({start(n){t.pause(),t.on("data",s=>{r||(gS.isBuffer(s)&&(s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),n.enqueue(s),t.pause())}),t.on("end",()=>{r||n.close()}),t.on("error",s=>n.error(s))},pull(){t.resume()},cancel(n){r=!0,t.destroy(n)}})};class e extends bg{constructor(r,n){super(n),this._reader=Ti(r)}async _read(r){try{for(;;){const{done:n,value:s}=await this._reader.read();if(n){this.push(null);break}if(!this.push(s))break}}catch(n){this.destroy(n)}}async _destroy(r,n){this._reader.cancel(r).then(n,n)}}Hy=function(t,r){return new e(t,r)}}const _g=new WeakSet,ir=Symbol("externalBuffer");function si(e){if(this.stream=e,e[ir]&&(this[ir]=e[ir].slice()),vr(e)){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{},void(this._cancel=async()=>{})}let t=yn(e);if(t==="node"&&(e=Zf(e)),t){const n=e.getReader();return this._read=n.read.bind(n),this._releaseLock=()=>{n.closed.catch(function(){}),n.releaseLock()},void(this._cancel=n.cancel.bind(n))}let r=!1;this._read=async()=>r||_g.has(e)?{value:void 0,done:!0}:(r=!0,{value:e,done:!1}),this._releaseLock=()=>{if(r)try{_g.add(e)}catch{}}}si.prototype.read=async function(){return this[ir]&&this[ir].length?{done:!1,value:this[ir].shift()}:this._read()},si.prototype.releaseLock=function(){this[ir]&&(this.stream[ir]=this[ir]),this._releaseLock()},si.prototype.cancel=function(e){return this._cancel(e)},si.prototype.readLine=async function(){let e,t=[];for(;!e;){let{done:r,value:n}=await this.read();if(n+="",r)return t.length?on(t):void 0;const s=n.indexOf(`
7
+ `)+1;s&&(e=on(t.concat(n.substr(0,s))),t=[]),s!==n.length&&t.push(n.substr(s))}return this.unshift(...t),e},si.prototype.readByte=async function(){const{done:e,value:t}=await this.read();if(e)return;const r=t[0];return this.unshift(jr(t,1)),r},si.prototype.readBytes=async function(e){const t=[];let r=0;for(;;){const{done:n,value:s}=await this.read();if(n)return t.length?on(t):void 0;if(t.push(s),r+=s.length,r>=e){const i=on(t);return this.unshift(jr(i,e)),jr(i,0,e)}}},si.prototype.peekBytes=async function(e){const t=await this.readBytes(e);return this.unshift(t),t},si.prototype.unshift=function(...e){this[ir]||(this[ir]=[]),e.length===1&&Jf(e[0])&&this[ir].length&&e[0].length&&this[ir][0].byteOffset>=e[0].length?this[ir][0]=new Uint8Array(this[ir][0].buffer,this[ir][0].byteOffset-e[0].length,this[ir][0].byteLength+e[0].length):this[ir].unshift(...e.filter(t=>t&&t.length))},si.prototype.readToEnd=async function(e=on){const t=[];for(;;){const{done:r,value:n}=await this.read();if(r)break;t.push(n)}return e(t)};let Wp,e8,{ReadableStream:Wi,WritableStream:t8,TransformStream:to}=Sn;async function r8(){if(to)return;const[e,t]=await Promise.all([Promise.resolve().then(function(){return qI}),Promise.resolve().then(function(){return GI})]);({ReadableStream:Wi,WritableStream:t8,TransformStream:to}=e);const{createReadableStreamWrapper:r}=t;Sn.ReadableStream&&Wi!==Sn.ReadableStream&&(Wp=r(Wi),e8=r(Sn.ReadableStream))}const Gu=Yf&&void 0;function Al(e){let t=yn(e);return t==="node"?Zf(e):t==="web"&&Wp?Wp(e):t?e:new Wi({start(r){r.enqueue(e),r.close()}})}function n8(e){if(yn(e))return e;const t=new pi;return(async()=>{const r=gn(t);await r.write(e),await r.close()})(),t}function on(e){return e.some(t=>yn(t)&&!vr(t))?function(t){t=t.map(Al);const r=s8(async function(i){await Promise.all(s.map(o=>Yp(o,i)))});let n=Promise.resolve();const s=t.map((i,o)=>Ai(i,(a,f)=>(n=n.then(()=>Yi(a,r.writable,{preventClose:o!==t.length-1})),n)));return r.readable}(e):e.some(t=>vr(t))?function(t){const r=new pi;let n=Promise.resolve();return t.forEach((s,i)=>(n=n.then(()=>Yi(s,r,{preventClose:i!==t.length-1})),n)),r}(e):typeof e[0]=="string"?e.join(""):Gu&&Gu.isBuffer(e[0])?Gu.concat(e):Q4(e)}function Ti(e){return new si(e)}function gn(e){return new Ru(e)}async function Yi(e,t,{preventClose:r=!1,preventAbort:n=!1,preventCancel:s=!1}={}){if(yn(e)&&!vr(e)){e=Al(e);try{if(e[ir]){const a=gn(t);for(let f=0;f<e[ir].length;f++)await a.ready,await a.write(e[ir][f]);a.releaseLock()}await e.pipeTo(t,{preventClose:r,preventAbort:n,preventCancel:s})}catch{}return}const i=Ti(e=n8(e)),o=gn(t);try{for(;;){await o.ready;const{done:a,value:f}=await i.read();if(a){r||await o.close();break}await o.write(f)}}catch(a){n||await o.abort(a)}finally{i.releaseLock(),o.releaseLock()}}function i8(e,t){const r=new to(t);return Yi(e,r.writable),r.readable}function s8(e){let t,r,n,s=!1,i=!1;return{readable:new Wi({start(o){n=o},pull(){t?t():s=!0},async cancel(o){i=!0,e&&await e(o),r&&r(o)}},{highWaterMark:0}),writable:new t8({write:async function(o){if(i)throw Error("Stream is cancelled");n.enqueue(o),s?s=!1:(await new Promise((a,f)=>{t=a,r=f}),t=null,r=null)},close:n.close.bind(n),abort:n.error.bind(n)})}}function hr(e,t=()=>{},r=()=>{}){if(vr(e)){const i=new pi;return(async()=>{const o=gn(i);try{const a=await mr(e),f=t(a),c=r();let l;l=f!==void 0&&c!==void 0?on([f,c]):f!==void 0?f:c,await o.write(l),await o.close()}catch(a){await o.abort(a)}})(),i}if(yn(e))return i8(e,{async transform(i,o){try{const a=await t(i);a!==void 0&&o.enqueue(a)}catch(a){o.error(a)}},async flush(i){try{const o=await r();o!==void 0&&i.enqueue(o)}catch(o){i.error(o)}}});const n=t(e),s=r();return n!==void 0&&s!==void 0?on([n,s]):n!==void 0?n:s}function Ai(e,t){if(yn(e)&&!vr(e)){let n;const s=new to({start(a){n=a}}),i=Yi(e,s.writable),o=s8(async function(a){n.error(a),await i,await new Promise(setTimeout)});return t(s.readable,o.writable),o.readable}e=n8(e);const r=new pi;return t(e,r),r}function Xf(e,t){let r;const n=Ai(e,(s,i)=>{const o=Ti(s);o.remainder=()=>(o.releaseLock(),Yi(s,i),n),r=t(o)});return r}function ma(e){if(vr(e))return e.clone();if(yn(e)){const t=function(r){if(vr(r))throw Error("ArrayStream cannot be tee()d, use clone() instead");if(yn(r)){const n=Al(r).tee();return n[0][ir]=n[1][ir]=r[ir],n}return[jr(r),jr(r)]}(e);return a8(e,t[0]),t[1]}return jr(e)}function Ya(e){return vr(e)?ma(e):yn(e)?new Wi({start(t){const r=Ai(e,async(n,s)=>{const i=Ti(n),o=gn(s);try{for(;;){await o.ready;const{done:a,value:f}=await i.read();if(a){try{t.close()}catch{}return void await o.close()}try{t.enqueue(f)}catch{}await o.write(f)}}catch(a){t.error(a),await o.abort(a)}});a8(e,r)}}):jr(e)}function a8(e,t){Object.entries(Object.getOwnPropertyDescriptors(e.constructor.prototype)).forEach(([r,n])=>{r!=="constructor"&&(n.value?n.value=n.value.bind(t):n.get=n.get.bind(t),Object.defineProperty(e,r,n))})}function jr(e,t=0,r=1/0){if(vr(e))throw Error("Not implemented");if(yn(e)){if(t>=0&&r>=0){let n=0;return i8(e,{transform(s,i){n<r?(n+s.length>=t&&i.enqueue(jr(s,Math.max(t-n,0),r-n)),n+=s.length):i.terminate()}})}if(t<0&&(r<0||r===1/0)){let n=[];return hr(e,s=>{s.length>=-t?n=[s]:n.push(s)},()=>jr(on(n),t,r))}if(t===0&&r<0){let n;return hr(e,s=>{const i=n?on([n,s]):s;if(i.length>=-r)return n=jr(i,r),jr(i,t,r);n=i})}return console.warn(`stream.slice(input, ${t}, ${r}) not implemented efficiently.`),rs(async()=>jr(await mr(e),t,r))}return e[ir]&&(e=on(e[ir].concat([e]))),!Jf(e)||Gu&&Gu.isBuffer(e)?e.slice(t,r):(r===1/0&&(r=e.length),e.subarray(t,r))}async function mr(e,t=on){return vr(e)?e.readToEnd(t):yn(e)?Ti(e).readToEnd(t):e}async function Yp(e,t){if(yn(e)){if(e.cancel)return e.cancel(t);if(e.destroy)return e.destroy(t),await new Promise(setTimeout),t}}function rs(e){const t=new pi;return(async()=>{const r=gn(t);try{await r.write(await e()),await r.close()}catch(n){await r.abort(n)}})(),t}class sn{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");if(t instanceof Uint8Array){const r=t,n=Array(r.length);for(let s=0;s<r.length;s++){const i=r[s].toString(16);n[s]=r[s]<=15?"0"+i:i}this.value=BigInt("0x0"+n.join(""))}else this.value=BigInt(t)}clone(){return new sn(this.value)}iinc(){return this.value++,this}inc(){return this.clone().iinc()}idec(){return this.value--,this}dec(){return this.clone().idec()}iadd(t){return this.value+=t.value,this}add(t){return this.clone().iadd(t)}isub(t){return this.value-=t.value,this}sub(t){return this.clone().isub(t)}imul(t){return this.value*=t.value,this}mul(t){return this.clone().imul(t)}imod(t){return this.value%=t.value,this.isNegative()&&this.iadd(t),this}mod(t){return this.clone().imod(t)}modExp(t,r){if(r.isZero())throw Error("Modulo cannot be zero");if(r.isOne())return new sn(0);if(t.isNegative())throw Error("Unsopported negative exponent");let n=t.value,s=this.value;s%=r.value;let i=BigInt(1);for(;n>BigInt(0);){const o=n&BigInt(1);n>>=BigInt(1);const a=i*s%r.value;i=o?a:i,s=s*s%r.value}return new sn(i)}modInv(t){const{gcd:r,x:n}=this._egcd(t);if(!r.isOne())throw Error("Inverse does not exist");return n.add(t).mod(t)}_egcd(t){let r=BigInt(0),n=BigInt(1),s=BigInt(1),i=BigInt(0),o=this.value;for(t=t.value;t!==BigInt(0);){const a=o/t;let f=r;r=s-a*r,s=f,f=n,n=i-a*n,i=f,f=t,t=o%t,o=f}return{x:new sn(s),y:new sn(i),gcd:new sn(o)}}gcd(t){let r=this.value;for(t=t.value;t!==BigInt(0);){const n=t;t=r%t,r=n}return new sn(r)}ileftShift(t){return this.value<<=t.value,this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value>>=t.value,this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value===t.value}lt(t){return this.value<t.value}lte(t){return this.value<=t.value}gt(t){return this.value>t.value}gte(t){return this.value>=t.value}isZero(){return this.value===BigInt(0)}isOne(){return this.value===BigInt(1)}isNegative(){return this.value<BigInt(0)}isEven(){return!(this.value&BigInt(1))}abs(){const t=this.clone();return this.isNegative()&&(t.value=-t.value),t}toString(){return this.value.toString()}toNumber(){const t=Number(this.value);if(t>Number.MAX_SAFE_INTEGER)throw Error("Number can only safely store up to 53 bits");return t}getBit(t){return(this.value>>BigInt(t)&BigInt(1))===BigInt(0)?0:1}bitLength(){const t=new sn(0),r=new sn(1),n=new sn(-1),s=this.isNegative()?n:t;let i=1;const o=this.clone();for(;!o.irightShift(r).equal(s);)i++;return i}byteLength(){const t=new sn(0),r=new sn(-1),n=this.isNegative()?r:t,s=new sn(8);let i=1;const o=this.clone();for(;!o.irightShift(s).equal(n);)i++;return i}toUint8Array(t="be",r){let n=this.value.toString(16);n.length%2==1&&(n="0"+n);const s=n.length/2,i=new Uint8Array(r||s),o=r?r-s:0;let a=0;for(;a<s;)i[a+o]=parseInt(n.slice(2*a,2*a+2),16),a++;return t!=="be"&&i.reverse(),i}}const mS=()=>typeof BigInt<"u",Io=Symbol("byValue");var j={curve:{p256:"p256","P-256":"p256",secp256r1:"p256",prime256v1:"p256","1.2.840.10045.3.1.7":"p256","2a8648ce3d030107":"p256","2A8648CE3D030107":"p256",p384:"p384","P-384":"p384",secp384r1:"p384","1.3.132.0.34":"p384","2b81040022":"p384","2B81040022":"p384",p521:"p521","P-521":"p521",secp521r1:"p521","1.3.132.0.35":"p521","2b81040023":"p521","2B81040023":"p521",secp256k1:"secp256k1","1.3.132.0.10":"secp256k1","2b8104000a":"secp256k1","2B8104000A":"secp256k1",ed25519Legacy:"ed25519",ED25519:"ed25519",ed25519:"ed25519",Ed25519:"ed25519","1.3.6.1.4.1.11591.15.1":"ed25519","2b06010401da470f01":"ed25519","2B06010401DA470F01":"ed25519",curve25519Legacy:"curve25519",X25519:"curve25519",cv25519:"curve25519",curve25519:"curve25519",Curve25519:"curve25519","1.3.6.1.4.1.3029.1.5.1":"curve25519","2b060104019755010501":"curve25519","2B060104019755010501":"curve25519",brainpoolP256r1:"brainpoolP256r1","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1","2b2403030208010107":"brainpoolP256r1","2B2403030208010107":"brainpoolP256r1",brainpoolP384r1:"brainpoolP384r1","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1","2b240303020801010b":"brainpoolP384r1","2B240303020801010B":"brainpoolP384r1",brainpoolP512r1:"brainpoolP512r1","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1","2b240303020801010d":"brainpoolP512r1","2B240303020801010D":"brainpoolP512r1"},s2k:{simple:0,salted:1,iterated:3,gnu:101},publicKey:{rsaEncryptSign:1,rsaEncrypt:2,rsaSign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsaLegacy:22,ed25519Legacy:22,eddsa:22,aedh:23,aedsa:24,x25519:25,x448:26,ed25519:27,ed448:28},symmetric:{plaintext:0,idea:1,tripledes:2,cast5:3,blowfish:4,aes128:7,aes192:8,aes256:9,twofish:10},compression:{uncompressed:0,zip:1,zlib:2,bzip2:3},hash:{md5:1,sha1:2,ripemd:3,sha256:8,sha384:9,sha512:10,sha224:11},webHash:{"SHA-1":2,"SHA-256":8,"SHA-384":9,"SHA-512":10},aead:{eax:1,ocb:2,experimentalGCM:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressedData:8,symmetricallyEncryptedData:9,marker:10,literalData:11,trust:12,userID:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtectedData:18,modificationDetectionCode:19,aeadEncryptedData:20},literal:{binary:98,text:116,utf8:117,mime:109},signature:{binary:0,text:1,standalone:2,certGeneric:16,certPersona:17,certCasual:18,certPositive:19,certRevocation:48,subkeyBinding:24,keyBinding:25,key:31,keyRevocation:32,subkeyRevocation:40,timestamp:64,thirdParty:80},signatureSubpacket:{signatureCreationTime:2,signatureExpirationTime:3,exportableCertification:4,trustSignature:5,regularExpression:6,revocable:7,keyExpirationTime:9,placeholderBackwardsCompatibility:10,preferredSymmetricAlgorithms:11,revocationKey:12,issuer:16,notationData:20,preferredHashAlgorithms:21,preferredCompressionAlgorithms:22,keyServerPreferences:23,preferredKeyServer:24,primaryUserID:25,policyURI:26,keyFlags:27,signersUserID:28,reasonForRevocation:29,features:30,signatureTarget:31,embeddedSignature:32,issuerFingerprint:33,preferredAEADAlgorithms:34},keyFlags:{certifyKeys:1,signData:2,encryptCommunication:4,encryptStorage:8,splitPrivateKey:16,authentication:32,sharedPrivateKey:128},armor:{multipartSection:0,multipartLast:1,signed:2,message:3,publicKey:4,privateKey:5,signature:6},reasonForRevocation:{noReason:0,keySuperseded:1,keyCompromised:2,keyRetired:3,userIDInvalid:32},features:{modificationDetection:1,aead:2,v5Keys:4},write:function(e,t){if(typeof t=="number"&&(t=this.read(e,t)),e[t]!==void 0)return e[t];throw Error("Invalid enum value.")},read:function(e,t){if(e[Io]||(e[Io]=[],Object.entries(e).forEach(([r,n])=>{e[Io][n]=r})),e[Io][t]!==void 0)return e[Io][t];throw Error("Invalid enum value.")}};const wg=(()=>{try{return!1}catch{}return!1})(),X={isString:function(e){return typeof e=="string"||e instanceof String},isArray:function(e){return e instanceof Array},isUint8Array:Jf,isStream:yn,readNumber:function(e){let t=0;for(let r=0;r<e.length;r++)t+=256**r*e[e.length-1-r];return t},writeNumber:function(e,t){const r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e>>8*(t-n-1)&255;return r},readDate:function(e){const t=X.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return X.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return e===null||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},readMPI:function(e){const t=(e[0]<<8|e[1])+7>>>3;return e.subarray(2,2+t)},leftPad(e,t){const r=new Uint8Array(t),n=t-e.length;return r.set(e,n),r},uint8ArrayToMPI:function(e){const t=X.uint8ArrayBitLength(e);if(t===0)throw Error("Zero MPI");const r=e.subarray(e.length-Math.ceil(t/8)),n=new Uint8Array([(65280&t)>>8,255&t]);return X.concatUint8Array([n,r])},uint8ArrayBitLength:function(e){let t;for(t=0;t<e.length&&e[t]===0;t++);if(t===e.length)return 0;const r=e.subarray(t);return 8*(r.length-1)+X.nbits(r[0])},hexToUint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r<e.length>>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},uint8ArrayToHex:function(e){const t=[],r=e.length;let n,s=0;for(;s<r;){for(n=e[s++].toString(16);n.length<2;)n="0"+n;t.push(""+n)}return t.join("")},stringToUint8Array:function(e){return hr(e,t=>{if(!X.isString(t))throw Error("stringToUint8Array: Data must be in the form of a string");const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r})},uint8ArrayToString:function(e){const t=[],n=(e=new Uint8Array(e)).length;for(let s=0;s<n;s+=16384)t.push(String.fromCharCode.apply(String,e.subarray(s,s+16384<n?s+16384:n)));return t.join("")},encodeUTF8:function(e){const t=new TextEncoder("utf-8");function r(n,s=!1){return t.encode(n,{stream:!s})}return hr(e,r,()=>r("",!0))},decodeUTF8:function(e){const t=new TextDecoder("utf-8");function r(n,s=!1){return t.decode(n,{stream:!s})}return hr(e,r,()=>r(new Uint8Array,!0))},concat:on,concatUint8Array:Q4,equalsUint8Array:function(e,t){if(!X.isUint8Array(e)||!X.isUint8Array(t))throw Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},writeChecksum:function(e){let t=0;for(let r=0;r<e.length;r++)t=t+e[r]&65535;return X.writeNumber(t,2)},printDebug:function(e){wg&&console.log("[OpenPGP.js debug]",e)},printDebugError:function(e){wg&&console.error("[OpenPGP.js debug]",e)},nbits:function(e){let t=1,r=e>>>16;return r!==0&&(e=r,t+=16),r=e>>8,r!==0&&(e=r,t+=8),r=e>>4,r!==0&&(e=r,t+=4),r=e>>2,r!==0&&(e=r,t+=2),r=e>>1,r!==0&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n<r;n++)t[n]=e[n]<<1^e[n+1]>>7;return t[r]=e[r]<<1^135*(e[0]>>7),t},shiftRight:function(e,t){if(t)for(let r=e.length-1;r>=0;r--)e[r]>>=t,r>0&&(e[r]|=e[r-1]<<8-t);return e},getWebCrypto:function(){return Sn!==void 0&&Sn.crypto&&Sn.crypto.subtle},getBigInteger:async function(){if(mS())return sn;{const{default:e}=await Promise.resolve().then(function(){return zI});return e}},getNodeCrypto:function(){},getNodeZlib:function(){},getNodeBuffer:function(){return{}.Buffer},getHardwareConcurrency:function(){return typeof navigator<"u"?navigator.hardwareConcurrency||1:(void 0).cpus().length},isEmailAddress:function(e){return X.isString(e)?/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/.test(e):!1},canonicalizeEOL:function(e){let t=!1;return hr(e,r=>{let n;t&&(r=X.concatUint8Array([new Uint8Array([13]),r])),r[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;const s=[];for(let a=0;n=r.indexOf(10,a)+1,n;a=n)r[n-2]!==13&&s.push(n);if(!s.length)return r;const i=new Uint8Array(r.length+s.length);let o=0;for(let a=0;a<s.length;a++){const f=r.subarray(s[a-1]||0,s[a]);i.set(f,o),o+=f.length,i[o-1]=13,i[o]=10,o++}return i.set(r.subarray(s[s.length-1]||0),o),i},()=>t?new Uint8Array([13]):void 0)},nativeEOL:function(e){let t=!1;return hr(e,r=>{let n;(r=t&&r[0]!==10?X.concatUint8Array([new Uint8Array([13]),r]):new Uint8Array(r))[r.length-1]===13?(t=!0,r=r.subarray(0,-1)):t=!1;let s=0;for(let i=0;i!==r.length;i=n){n=r.indexOf(13,i)+1,n||(n=r.length);const o=n-(r[n]===10?1:0);i&&r.copyWithin(s,i,o),s+=o-i}return r.subarray(0,s)},()=>t?new Uint8Array([13]):void 0)},removeTrailingSpaces:function(e){return e.split(`
8
+ `).map(t=>{let r=t.length-1;for(;r>=0&&(t[r]===" "||t[r]===" "||t[r]==="\r");r--);return t.substr(0,r+1)}).join(`
9
+ `)},wrapError:function(e,t){if(!t)return Error(e);try{t.message=e+": "+t.message}catch{}return t},constructAllowedPackets:function(e){const t={};return e.forEach(r=>{if(!r.tag)throw Error("Invalid input: expected a packet class");t[r.tag]=r}),t},anyPromise:function(e){return new Promise(async(t,r)=>{let n;await Promise.all(e.map(async s=>{try{t(await s)}catch(i){n=i}})),r(n)})},selectUint8Array:function(e,t,r){const n=Math.max(t.length,r.length),s=new Uint8Array(n);let i=0;for(let o=0;o<s.length;o++)s[o]=t[o]&256-e|r[o]&255+e,i+=e&o<t.length|1-e&o<r.length;return s.subarray(0,i)},selectUint8:function(e,t,r){return t&256-e|r&255+e},isAES:function(e){return e===j.symmetric.aes128||e===j.symmetric.aes192||e===j.symmetric.aes256}},Vh=X.getNodeBuffer();let af,of;function Li(e){let t=new Uint8Array;return hr(e,r=>{t=X.concatUint8Array([t,r]);const n=[],s=Math.floor(t.length/45),i=45*s,o=af(t.subarray(0,i));for(let a=0;a<s;a++)n.push(o.substr(60*a,60)),n.push(`
10
+ `);return t=t.subarray(i),n.join("")},()=>t.length?af(t)+`
11
+ `:"")}function o8(e){let t="";return hr(e,r=>{t+=r;let n=0;const s=[" "," ","\r",`
12
+ `];for(let a=0;a<s.length;a++){const f=s[a];for(let c=t.indexOf(f);c!==-1;c=t.indexOf(f,c+1))n++}let i=t.length;for(;i>0&&(i-n)%4!=0;i--)s.includes(t[i])&&n--;const o=of(t.substr(0,i));return t=t.substr(i),o},()=>of(t))}function qi(e){return o8(e.replace(/-/g,"+").replace(/_/g,"/"))}function An(e,t){let r=Li(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r}Vh?(af=e=>Vh.from(e).toString("base64"),of=e=>{const t=Vh.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}):(af=e=>btoa(X.uint8ArrayToString(e)),of=e=>X.stringToUint8Array(atob(e)));var Xe={preferredHashAlgorithm:j.hash.sha256,preferredSymmetricAlgorithm:j.symmetric.aes256,preferredCompressionAlgorithm:j.compression.uncompressed,deflateLevel:6,aeadProtect:!1,preferredAEADAlgorithm:j.aead.eax,aeadChunkSizeByte:12,v5Keys:!1,s2kIterationCountByte:224,allowUnauthenticatedMessages:!1,allowUnauthenticatedStream:!1,checksumRequired:!1,minRSABits:2047,passwordCollisionCheck:!1,revocationsExpire:!1,allowInsecureDecryptionWithSigningKeys:!1,allowInsecureVerificationWithReformattedKeys:!1,constantTimePKCS1Decryption:!1,constantTimePKCS1DecryptionSupportedSymmetricAlgorithms:new Set([j.symmetric.aes128,j.symmetric.aes192,j.symmetric.aes256]),minBytesForWebCrypto:1e3,ignoreUnsupportedPackets:!0,ignoreMalformedPackets:!1,additionalAllowedPackets:[],showVersion:!1,showComment:!1,versionString:"OpenPGP.js 5.11.3",commentString:"https://openpgpjs.org",maxUserIDLength:5120,knownNotations:[],useIndutnyElliptic:!0,rejectHashAlgorithms:new Set([j.hash.md5,j.hash.ripemd]),rejectMessageHashAlgorithms:new Set([j.hash.md5,j.hash.ripemd,j.hash.sha1]),rejectPublicKeyAlgorithms:new Set([j.publicKey.elgamal,j.publicKey.dsa]),rejectCurves:new Set([j.curve.secp256k1])};function vS(e){const t=e.match(/^-----BEGIN PGP (MESSAGE, PART \d+\/\d+|MESSAGE, PART \d+|SIGNED MESSAGE|MESSAGE|PUBLIC KEY BLOCK|PRIVATE KEY BLOCK|SIGNATURE)-----$/m);if(!t)throw Error("Unknown ASCII armor type");return/MESSAGE, PART \d+\/\d+/.test(t[1])?j.armor.multipartSection:/MESSAGE, PART \d+/.test(t[1])?j.armor.multipartLast:/SIGNED MESSAGE/.test(t[1])?j.armor.signed:/MESSAGE/.test(t[1])?j.armor.message:/PUBLIC KEY BLOCK/.test(t[1])?j.armor.publicKey:/PRIVATE KEY BLOCK/.test(t[1])?j.armor.privateKey:/SIGNATURE/.test(t[1])?j.armor.signature:void 0}function Ks(e,t){let r="";return t.showVersion&&(r+="Version: "+t.versionString+`
13
+ `),t.showComment&&(r+="Comment: "+t.commentString+`
14
+ `),e&&(r+="Comment: "+e+`
15
+ `),r+=`
16
+ `,r}function os(e){return Li(function(t){let r=13501623;return hr(t,n=>{const s=bS?Math.floor(n.length/4):0,i=new Uint32Array(n.buffer,n.byteOffset,s);for(let o=0;o<s;o++)r^=i[o],r=kr[0][r>>24&255]^kr[1][r>>16&255]^kr[2][r>>8&255]^kr[3][r>>0&255];for(let o=4*s;o<n.length;o++)r=r>>8^kr[0][255&r^n[o]]},()=>new Uint8Array([r,r>>8,r>>16]))}(e))}const kr=[Array(255),Array(255),Array(255),Array(255)];for(let e=0;e<=255;e++){let t=e<<16;for(let r=0;r<8;r++)t=t<<1^(8388608&t?8801531:0);kr[0][e]=(16711680&t)>>16|65280&t|(255&t)<<16}for(let e=0;e<=255;e++)kr[1][e]=kr[0][e]>>8^kr[0][255&kr[0][e]];for(let e=0;e<=255;e++)kr[2][e]=kr[1][e]>>8^kr[0][255&kr[1][e]];for(let e=0;e<=255;e++)kr[3][e]=kr[2][e]>>8^kr[0][255&kr[2][e]];const bS=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),new Int16Array(e)[0]===255}();function Eg(e){for(let t=0;t<e.length;t++)/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(e[t])||X.printDebugError(Error("Improperly formatted armor header: "+e[t])),/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(e[t])||X.printDebugError(Error("Unknown header: "+e[t]))}function _S(e){let t=e,r="";const n=e.lastIndexOf("=");return n>=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}function Ii(e,t=Xe){return new Promise(async(r,n)=>{try{const s=/^-----[^-]+-----$/m,i=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let o;const a=[];let f,c,l,u=a,p=[],d=o8(Ai(e,async(h,y)=>{const g=Ti(h);try{for(;;){let b=await g.readLine();if(b===void 0)throw Error("Misformed armored text");if(b=X.removeTrailingSpaces(b.replace(/[\r\n]/g,"")),o)if(f)c||o!==2||(s.test(b)?(p=p.join(`\r
17
+ `),c=!0,Eg(u),u=[],f=!1):p.push(b.replace(/^- /,"")));else if(s.test(b)&&n(Error("Mandatory blank line missing between armor headers and armor data")),i.test(b)){if(Eg(u),f=!0,c||o!==2){r({text:p,data:d,headers:a,type:o});break}}else u.push(b);else s.test(b)&&(o=vS(b))}}catch(b){return void n(b)}const m=gn(y);try{for(;;){await m.ready;const{done:b,value:w}=await g.read();if(b)throw Error("Misformed armored text");const E=w+"";if(E.indexOf("=")!==-1||E.indexOf("-")!==-1){let C=await g.readToEnd();C.length||(C=""),C=E+C,C=X.removeTrailingSpaces(C.replace(/\r/g,""));const R=C.split(s);if(R.length===1)throw Error("Misformed armored text");const M=_S(R[0].slice(0,-1));l=M.checksum,await m.write(M.body);break}await m.write(E)}await m.ready,await m.close()}catch(b){await m.abort(b)}}));d=Ai(d,async(h,y)=>{const g=mr(os(Ya(h)));g.catch(()=>{}),await Yi(h,y,{preventClose:!0});const m=gn(y);try{const b=(await g).replace(`
18
+ `,"");if(l!==b&&(l||t.checksumRequired))throw Error("Ascii armor integrity check failed");await m.ready,await m.close()}catch(b){await m.abort(b)}})}catch(s){n(s)}}).then(async r=>(vr(r.data)&&(r.data=await mr(r.data)),r))}function Ea(e,t,r,n,s,i=Xe){let o,a;e===j.armor.signed&&(o=t.text,a=t.hash,t=t.data);const f=Ya(t),c=[];switch(e){case j.armor.multipartSection:c.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+n+`-----
19
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push("-----END PGP MESSAGE, PART "+r+"/"+n+`-----
20
+ `);break;case j.armor.multipartLast:c.push("-----BEGIN PGP MESSAGE, PART "+r+`-----
21
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push("-----END PGP MESSAGE, PART "+r+`-----
22
+ `);break;case j.armor.signed:c.push(`-----BEGIN PGP SIGNED MESSAGE-----
23
+ `),c.push("Hash: "+a+`
24
+
25
+ `),c.push(o.replace(/^-/gm,"- -")),c.push(`
26
+ -----BEGIN PGP SIGNATURE-----
27
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push(`-----END PGP SIGNATURE-----
28
+ `);break;case j.armor.message:c.push(`-----BEGIN PGP MESSAGE-----
29
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push(`-----END PGP MESSAGE-----
30
+ `);break;case j.armor.publicKey:c.push(`-----BEGIN PGP PUBLIC KEY BLOCK-----
31
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push(`-----END PGP PUBLIC KEY BLOCK-----
32
+ `);break;case j.armor.privateKey:c.push(`-----BEGIN PGP PRIVATE KEY BLOCK-----
33
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push(`-----END PGP PRIVATE KEY BLOCK-----
34
+ `);break;case j.armor.signature:c.push(`-----BEGIN PGP SIGNATURE-----
35
+ `),c.push(Ks(s,i)),c.push(Li(t)),c.push("=",os(f)),c.push(`-----END PGP SIGNATURE-----
36
+ `)}return X.concat(c)}class Ms{constructor(){this.bytes=""}read(t){return this.bytes=X.uint8ArrayToString(t.subarray(0,8)),this.bytes.length}write(){return X.stringToUint8Array(this.bytes)}toHex(){return X.uint8ArrayToHex(X.stringToUint8Array(this.bytes))}equals(t,r=!1){return r&&(t.isWildcard()||this.isWildcard())||this.bytes===t.bytes}isNull(){return this.bytes===""}isWildcard(){return/^0+$/.test(this.toHex())}static mapToHex(t){return t.toHex()}static fromID(t){const r=new Ms;return r.read(X.hexToUint8Array(t)),r}static wildcard(){const t=new Ms;return t.read(new Uint8Array(8)),t}}var Lt=function(){var e,t,r=!1;function n(u,p){var d=e[(t[u]+t[p])%255];return u!==0&&p!==0||(d=0),d}var s,i,o,a,f=!1;function c(){function u(y){var g,m,b;for(m=b=function(w){var E=e[255-t[w]];return w===0&&(E=0),E}(y),g=0;g<4;g++)b^=m=255&(m<<1|m>>>7);return b^=99}r||function(){e=[],t=[];var y,g,m=1;for(y=0;y<255;y++)e[y]=m,g=128&m,m<<=1,m&=255,g===128&&(m^=27),m^=e[y],t[e[y]]=y;e[255]=e[0],t[0]=0,r=!0}(),s=[],i=[],o=[[],[],[],[]],a=[[],[],[],[]];for(var p=0;p<256;p++){var d=u(p);s[p]=d,i[d]=p,o[0][p]=n(2,d)<<24|d<<16|d<<8|n(3,d),a[0][d]=n(14,p)<<24|n(9,p)<<16|n(13,p)<<8|n(11,p);for(var h=1;h<4;h++)o[h][p]=o[h-1][p]>>>8|o[h-1][p]<<24,a[h][d]=a[h-1][d]>>>8|a[h-1][d]<<24}f=!0}var l=function(u,p){f||c();var d=new Uint32Array(p);d.set(s,512),d.set(i,768);for(var h=0;h<4;h++)d.set(o[h],4096+1024*h>>2),d.set(a[h],8192+1024*h>>2);var y=function(g,m,b){var w=0,E=0,C=0,R=0,M=0,_=0,A=0,I=0,P=0,v=0,S=0,T=0,N=0,D=0,O=0,L=0,B=0,k=0,q=0,W=0,re=0,ue=new g.Uint32Array(b),H=new g.Uint8Array(b);function ae(ee,Z,$e,Ve,Qe,dt,rt,ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,Qe=Qe|0,dt=dt|0,rt=rt|0,ve=ve|0;var G=0,se=0,me=0,Se=0,Ae=0,ke=0,Ne=0,xe=0;for(G=$e|1024,se=$e|2048,me=$e|3072,Qe=Qe^ue[(ee|0)>>2],dt=dt^ue[(ee|4)>>2],rt=rt^ue[(ee|8)>>2],ve=ve^ue[(ee|12)>>2],xe=16;(xe|0)<=Ve<<4;xe=xe+16|0)Se=ue[($e|Qe>>22&1020)>>2]^ue[(G|dt>>14&1020)>>2]^ue[(se|rt>>6&1020)>>2]^ue[(me|ve<<2&1020)>>2]^ue[(ee|xe|0)>>2],Ae=ue[($e|dt>>22&1020)>>2]^ue[(G|rt>>14&1020)>>2]^ue[(se|ve>>6&1020)>>2]^ue[(me|Qe<<2&1020)>>2]^ue[(ee|xe|4)>>2],ke=ue[($e|rt>>22&1020)>>2]^ue[(G|ve>>14&1020)>>2]^ue[(se|Qe>>6&1020)>>2]^ue[(me|dt<<2&1020)>>2]^ue[(ee|xe|8)>>2],Ne=ue[($e|ve>>22&1020)>>2]^ue[(G|Qe>>14&1020)>>2]^ue[(se|dt>>6&1020)>>2]^ue[(me|rt<<2&1020)>>2]^ue[(ee|xe|12)>>2],Qe=Se,dt=Ae,rt=ke,ve=Ne;w=ue[(Z|Qe>>22&1020)>>2]<<24^ue[(Z|dt>>14&1020)>>2]<<16^ue[(Z|rt>>6&1020)>>2]<<8^ue[(Z|ve<<2&1020)>>2]^ue[(ee|xe|0)>>2],E=ue[(Z|dt>>22&1020)>>2]<<24^ue[(Z|rt>>14&1020)>>2]<<16^ue[(Z|ve>>6&1020)>>2]<<8^ue[(Z|Qe<<2&1020)>>2]^ue[(ee|xe|4)>>2],C=ue[(Z|rt>>22&1020)>>2]<<24^ue[(Z|ve>>14&1020)>>2]<<16^ue[(Z|Qe>>6&1020)>>2]<<8^ue[(Z|dt<<2&1020)>>2]^ue[(ee|xe|8)>>2],R=ue[(Z|ve>>22&1020)>>2]<<24^ue[(Z|Qe>>14&1020)>>2]<<16^ue[(Z|dt>>6&1020)>>2]<<8^ue[(Z|rt<<2&1020)>>2]^ue[(ee|xe|12)>>2]}function V(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,ee,Z,$e,Ve)}function U(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0;var Qe=0;ae(1024,3072,8192,re,ee,Ve,$e,Z),Qe=E,E=R,R=Qe}function te(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,M^ee,_^Z,A^$e,I^Ve),M=w,_=E,A=C,I=R}function ge(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0;var Qe=0;ae(1024,3072,8192,re,ee,Ve,$e,Z),Qe=E,E=R,R=Qe,w=w^M,E=E^_,C=C^A,R=R^I,M=ee,_=Z,A=$e,I=Ve}function Pe(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,M,_,A,I),M=w=w^ee,_=E=E^Z,A=C=C^$e,I=R=R^Ve}function Te(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,M,_,A,I),w=w^ee,E=E^Z,C=C^$e,R=R^Ve,M=ee,_=Z,A=$e,I=Ve}function z(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,M,_,A,I),M=w,_=E,A=C,I=R,w=w^ee,E=E^Z,C=C^$e,R=R^Ve}function $(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,ae(0,2048,4096,re,P,v,S,T),T=~L&T|L&T+1,S=~O&S|O&S+((T|0)==0),v=~D&v|D&v+((S|0)==0),P=~N&P|N&P+((v|0)==0),w=w^ee,E=E^Z,C=C^$e,R=R^Ve}function F(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0;var Qe=0,dt=0,rt=0,ve=0,G=0,se=0,me=0,Se=0,Ae=0,ke=0;for(ee=ee^M,Z=Z^_,$e=$e^A,Ve=Ve^I,Qe=B|0,dt=k|0,rt=q|0,ve=W|0;(Ae|0)<128;Ae=Ae+1|0)Qe>>>31&&(G=G^ee,se=se^Z,me=me^$e,Se=Se^Ve),Qe=Qe<<1|dt>>>31,dt=dt<<1|rt>>>31,rt=rt<<1|ve>>>31,ve=ve<<1,ke=Ve&1,Ve=Ve>>>1|$e<<31,$e=$e>>>1|Z<<31,Z=Z>>>1|ee<<31,ee=ee>>>1,ke&&(ee=ee^3774873600);M=G,_=se,A=me,I=Se}function Q(ee){ee=ee|0,re=ee}function de(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,w=ee,E=Z,C=$e,R=Ve}function oe(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,M=ee,_=Z,A=$e,I=Ve}function ne(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,P=ee,v=Z,S=$e,T=Ve}function Fe(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,N=ee,D=Z,O=$e,L=Ve}function je(ee,Z,$e,Ve){ee=ee|0,Z=Z|0,$e=$e|0,Ve=Ve|0,T=~L&T|L&Ve,S=~O&S|O&$e,v=~D&v|D&Z,P=~N&P|N&ee}function He(ee){return ee=ee|0,ee&15?-1:(H[ee|0]=w>>>24,H[ee|1]=w>>>16&255,H[ee|2]=w>>>8&255,H[ee|3]=w&255,H[ee|4]=E>>>24,H[ee|5]=E>>>16&255,H[ee|6]=E>>>8&255,H[ee|7]=E&255,H[ee|8]=C>>>24,H[ee|9]=C>>>16&255,H[ee|10]=C>>>8&255,H[ee|11]=C&255,H[ee|12]=R>>>24,H[ee|13]=R>>>16&255,H[ee|14]=R>>>8&255,H[ee|15]=R&255,16)}function he(ee){return ee=ee|0,ee&15?-1:(H[ee|0]=M>>>24,H[ee|1]=M>>>16&255,H[ee|2]=M>>>8&255,H[ee|3]=M&255,H[ee|4]=_>>>24,H[ee|5]=_>>>16&255,H[ee|6]=_>>>8&255,H[ee|7]=_&255,H[ee|8]=A>>>24,H[ee|9]=A>>>16&255,H[ee|10]=A>>>8&255,H[ee|11]=A&255,H[ee|12]=I>>>24,H[ee|13]=I>>>16&255,H[ee|14]=I>>>8&255,H[ee|15]=I&255,16)}function ce(){V(0,0,0,0),B=w,k=E,q=C,W=R}function pe(ee,Z,$e){ee=ee|0,Z=Z|0,$e=$e|0;var Ve=0;if(Z&15)return-1;for(;($e|0)>=16;)fe[ee&7](H[Z|0]<<24|H[Z|1]<<16|H[Z|2]<<8|H[Z|3],H[Z|4]<<24|H[Z|5]<<16|H[Z|6]<<8|H[Z|7],H[Z|8]<<24|H[Z|9]<<16|H[Z|10]<<8|H[Z|11],H[Z|12]<<24|H[Z|13]<<16|H[Z|14]<<8|H[Z|15]),H[Z|0]=w>>>24,H[Z|1]=w>>>16&255,H[Z|2]=w>>>8&255,H[Z|3]=w&255,H[Z|4]=E>>>24,H[Z|5]=E>>>16&255,H[Z|6]=E>>>8&255,H[Z|7]=E&255,H[Z|8]=C>>>24,H[Z|9]=C>>>16&255,H[Z|10]=C>>>8&255,H[Z|11]=C&255,H[Z|12]=R>>>24,H[Z|13]=R>>>16&255,H[Z|14]=R>>>8&255,H[Z|15]=R&255,Ve=Ve+16|0,Z=Z+16|0,$e=$e-16|0;return Ve|0}function le(ee,Z,$e){ee=ee|0,Z=Z|0,$e=$e|0;var Ve=0;if(Z&15)return-1;for(;($e|0)>=16;)ye[ee&1](H[Z|0]<<24|H[Z|1]<<16|H[Z|2]<<8|H[Z|3],H[Z|4]<<24|H[Z|5]<<16|H[Z|6]<<8|H[Z|7],H[Z|8]<<24|H[Z|9]<<16|H[Z|10]<<8|H[Z|11],H[Z|12]<<24|H[Z|13]<<16|H[Z|14]<<8|H[Z|15]),Ve=Ve+16|0,Z=Z+16|0,$e=$e-16|0;return Ve|0}var fe=[V,U,te,ge,Pe,Te,z,$],ye=[te,F];return{set_rounds:Q,set_state:de,set_iv:oe,set_nonce:ne,set_mask:Fe,set_counter:je,get_state:He,get_iv:he,gcm_init:ce,cipher:pe,mac:le}}({Uint8Array,Uint32Array},u,p);return y.set_key=function(g,m,b,w,E,C,R,M,_){var A=d.subarray(0,60),I=d.subarray(256,316);A.set([m,b,w,E,C,R,M,_]);for(var P=g,v=1;P<4*g+28;P++){var S=A[P-1];(P%g==0||g===8&&P%g==4)&&(S=s[S>>>24]<<24^s[S>>>16&255]<<16^s[S>>>8&255]<<8^s[255&S]),P%g==0&&(S=S<<8^S>>>24^v<<24,v=v<<1^(128&v?27:0)),A[P]=A[P-g]^S}for(var T=0;T<P;T+=4)for(var N=0;N<4;N++)S=A[P-(4+T)+(4-N)%4],I[T+N]=T<4||T>=P-4?S:a[0][s[S>>>24]]^a[1][s[S>>>16&255]]^a[2][s[S>>>8&255]]^a[3][s[255&S]];y.set_rounds(g+5)},y};return l.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},l.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},l.MAC={CBC:0,GCM:1},l.HEAP_DATA=16384,l}();function Ag(e){return e instanceof Uint8Array}function Gy(e,t){const r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw Error("heap size must be a positive integer and a multiple of 4096");return e=e||new Uint8Array(new ArrayBuffer(r))}function ia(e,t,r,n,s){const i=e.length-t,o=i<s?i:s;return e.set(r.subarray(n,n+o),t),o}function Os(...e){const t=e.reduce((s,i)=>s+i.length,0),r=new Uint8Array(t);let n=0;for(let s=0;s<e.length;s++)r.set(e[s],n),n+=e[s].length;return r}class Jp extends Error{constructor(...t){super(...t)}}class Fi extends Error{constructor(...t){super(...t)}}class Zp extends Error{constructor(...t){super(...t)}}const Sg=[],Pg=[];class Sl{constructor(t,r,n=!0,s,i,o){this.pos=0,this.len=0,this.mode=s,this.pos=0,this.len=0,this.key=t,this.iv=r,this.padding=n,this.acquire_asm(i,o)}acquire_asm(t,r){return this.heap!==void 0&&this.asm!==void 0||(this.heap=t||Sg.pop()||Gy().subarray(Lt.HEAP_DATA),this.asm=r||Pg.pop()||new Lt(null,this.heap.buffer),this.reset(this.key,this.iv)),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(Sg.push(this.heap),Pg.push(this.asm)),this.heap=void 0,this.asm=void 0}reset(t,r){const{asm:n}=this.acquire_asm(),s=t.length;if(s!==16&&s!==24&&s!==32)throw new Fi("illegal key size");const i=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.set_key(s>>2,i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12),s>16?i.getUint32(16):0,s>16?i.getUint32(20):0,s>24?i.getUint32(24):0,s>24?i.getUint32(28):0),r!==void 0){if(r.length!==16)throw new Fi("illegal iv size");let o=new DataView(r.buffer,r.byteOffset,r.byteLength);n.set_iv(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}else n.set_iv(0,0,0,0)}AES_Encrypt_process(t){if(!Ag(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Lt.ENC[this.mode],i=Lt.HEAP_DATA,o=this.pos,a=this.len,f=0,c=t.length||0,l=0,u=0,p=new Uint8Array(a+c&-16);for(;c>0;)u=ia(r,o+a,t,f,c),a+=u,f+=u,c-=u,u=n.cipher(s,i+o,a),u&&p.set(r.subarray(o,o+u),l),l+=u,u<a?(o+=u,a-=u):(o=0,a=0);return this.pos=o,this.len=a,p}AES_Encrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Lt.ENC[this.mode],s=Lt.HEAP_DATA,i=this.pos,o=this.len,a=16-o%16,f=o;if(this.hasOwnProperty("padding")){if(this.padding){for(let l=0;l<a;++l)t[i+o+l]=a;o+=a,f=o}else if(o%16)throw new Fi("data length must be a multiple of the block size")}else o+=a;const c=new Uint8Array(f);return o&&r.cipher(n,s+i,o),f&&c.set(t.subarray(i,i+f)),this.pos=0,this.len=0,this.release_asm(),c}AES_Decrypt_process(t){if(!Ag(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:n}=this.acquire_asm(),s=Lt.DEC[this.mode],i=Lt.HEAP_DATA,o=this.pos,a=this.len,f=0,c=t.length||0,l=0,u=a+c&-16,p=0,d=0;this.padding&&(p=a+c-u||16,u-=p);const h=new Uint8Array(u);for(;c>0;)d=ia(r,o+a,t,f,c),a+=d,f+=d,c-=d,d=n.cipher(s,i+o,a-(c?0:p)),d&&h.set(r.subarray(o,o+d),l),l+=d,d<a?(o+=d,a-=d):(o=0,a=0);return this.pos=o,this.len=a,h}AES_Decrypt_finish(){let{heap:t,asm:r}=this.acquire_asm(),n=Lt.DEC[this.mode],s=Lt.HEAP_DATA,i=this.pos,o=this.len,a=o;if(o>0){if(o%16){if(this.hasOwnProperty("padding"))throw new Fi("data length must be a multiple of the block size");o+=16-o%16}if(r.cipher(n,s+i,o),this.hasOwnProperty("padding")&&this.padding){let c=t[i+a-1];if(c<1||c>16||c>a)throw new Zp("bad padding");let l=0;for(let u=c;u>1;u--)l|=c^t[i+a-u];if(l)throw new Zp("bad padding");a-=c}}const f=new Uint8Array(a);return a>0&&f.set(t.subarray(i,i+a)),this.pos=0,this.len=0,this.release_asm(),f}}class cf{static encrypt(t,r,n=!1){return new cf(r,n).encrypt(t)}static decrypt(t,r,n=!1){return new cf(r,n).decrypt(t)}constructor(t,r=!1,n){this.aes=n||new Sl(t,void 0,r,"ECB")}encrypt(t){return Os(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Os(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function zy(e){const t=function(r){const n=new cf(r);this.encrypt=function(s){return n.encrypt(s)},this.decrypt=function(s){return n.decrypt(s)}};return t.blockSize=t.prototype.blockSize=16,t.keySize=t.prototype.keySize=e/8,t}function zu(e,t,r,n,s,i){const o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],f=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let h,y,g,m,b,w,E,C,R,M,_,A,I,P,v=0,S=t.length;const T=e.length===32?3:9;C=T===3?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(t=function(O,L){const B=8-O.length%8;let k;if(L===2&&B<8)k=32;else if(L===1)k=B;else{if(L||!(B<8)){if(B===8)return O;throw Error("des: invalid padding")}k=0}const q=new Uint8Array(O.length+B);for(let W=0;W<O.length;W++)q[W]=O[W];for(let W=0;W<B;W++)q[O.length+W]=k;return q}(t,i),S=t.length);let N=new Uint8Array(S),D=0;for(n===1&&(R=s[v++]<<24|s[v++]<<16|s[v++]<<8|s[v++],_=s[v++]<<24|s[v++]<<16|s[v++]<<8|s[v++],v=0);v<S;){for(w=t[v++]<<24|t[v++]<<16|t[v++]<<8|t[v++],E=t[v++]<<24|t[v++]<<16|t[v++]<<8|t[v++],n===1&&(r?(w^=R,E^=_):(M=R,A=_,R=w,_=E)),g=252645135&(w>>>4^E),E^=g,w^=g<<4,g=65535&(w>>>16^E),E^=g,w^=g<<16,g=858993459&(E>>>2^w),w^=g,E^=g<<2,g=16711935&(E>>>8^w),w^=g,E^=g<<8,g=1431655765&(w>>>1^E),E^=g,w^=g<<1,w=w<<1|w>>>31,E=E<<1|E>>>31,y=0;y<T;y+=3){for(I=C[y+1],P=C[y+2],h=C[y];h!==I;h+=P)m=E^e[h],b=(E>>>4|E<<28)^e[h+1],g=w,w=E,E=g^(a[m>>>24&63]|c[m>>>16&63]|u[m>>>8&63]|d[63&m]|o[b>>>24&63]|f[b>>>16&63]|l[b>>>8&63]|p[63&b]);g=w,w=E,E=g}w=w>>>1|w<<31,E=E>>>1|E<<31,g=1431655765&(w>>>1^E),E^=g,w^=g<<1,g=16711935&(E>>>8^w),w^=g,E^=g<<8,g=858993459&(E>>>2^w),w^=g,E^=g<<2,g=65535&(w>>>16^E),E^=g,w^=g<<16,g=252645135&(w>>>4^E),E^=g,w^=g<<4,n===1&&(r?(R=w,_=E):(w^=M,E^=A)),N[D++]=w>>>24,N[D++]=w>>>16&255,N[D++]=w>>>8&255,N[D++]=255&w,N[D++]=E>>>24,N[D++]=E>>>16&255,N[D++]=E>>>8&255,N[D++]=255&E}return r||(N=function(O,L){let B,k=null;if(L===2)B=32;else if(L===1)k=O[O.length-1];else{if(L)throw Error("des: invalid padding");B=0}if(!k){for(k=1;O[O.length-k]===B;)k++;k--}return O.subarray(0,O.length-k)}(N,i)),N}function Wu(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],u=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,g=Array(32*y),m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let b,w,E,C=0,R=0;for(let M=0;M<y;M++){let _=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++],A=e[C++]<<24|e[C++]<<16|e[C++]<<8|e[C++];E=252645135&(_>>>4^A),A^=E,_^=E<<4,E=65535&(A>>>-16^_),_^=E,A^=E<<-16,E=858993459&(_>>>2^A),A^=E,_^=E<<2,E=65535&(A>>>-16^_),_^=E,A^=E<<-16,E=1431655765&(_>>>1^A),A^=E,_^=E<<1,E=16711935&(A>>>8^_),_^=E,A^=E<<8,E=1431655765&(_>>>1^A),A^=E,_^=E<<1,E=_<<8|A>>>20&240,_=A<<24|A<<8&16711680|A>>>8&65280|A>>>24&240,A=E;for(let I=0;I<16;I++)m[I]?(_=_<<2|_>>>26,A=A<<2|A>>>26):(_=_<<1|_>>>27,A=A<<1|A>>>27),_&=-15,A&=-15,b=t[_>>>28]|r[_>>>24&15]|n[_>>>20&15]|s[_>>>16&15]|i[_>>>12&15]|o[_>>>8&15]|a[_>>>4&15],w=f[A>>>28]|c[A>>>24&15]|l[A>>>20&15]|u[A>>>16&15]|p[A>>>12&15]|d[A>>>8&15]|h[A>>>4&15],E=65535&(w>>>16^b),g[R++]=b^E,g[R++]=w^E<<16}return g}function ku(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(t){return zu(Wu(this.key[2]),zu(Wu(this.key[1]),zu(Wu(this.key[0]),t,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}function wS(){this.BlockSize=8,this.KeySize=16,this.setKey=function(o){if(this.masking=Array(16),this.rotate=Array(16),this.reset(),o.length!==this.KeySize)throw Error("CAST-128: keys must be 16 bytes");return this.keySchedule(o),!0},this.reset=function(){for(let o=0;o<16;o++)this.masking[o]=0,this.rotate[o]=0},this.getBlockSize=function(){return this.BlockSize},this.encrypt=function(o){const a=Array(o.length);for(let f=0;f<o.length;f+=8){let c,l=o[f]<<24|o[f+1]<<16|o[f+2]<<8|o[f+3],u=o[f+4]<<24|o[f+5]<<16|o[f+6]<<8|o[f+7];c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,a[f]=u>>>24&255,a[f+1]=u>>>16&255,a[f+2]=u>>>8&255,a[f+3]=255&u,a[f+4]=l>>>24&255,a[f+5]=l>>>16&255,a[f+6]=l>>>8&255,a[f+7]=255&l}return a},this.decrypt=function(o){const a=Array(o.length);for(let f=0;f<o.length;f+=8){let c,l=o[f]<<24|o[f+1]<<16|o[f+2]<<8|o[f+3],u=o[f+4]<<24|o[f+5]<<16|o[f+6]<<8|o[f+7];c=u,u=l^r(u,this.masking[15],this.rotate[15]),l=c,c=u,u=l^s(u,this.masking[14],this.rotate[14]),l=c,c=u,u=l^n(u,this.masking[13],this.rotate[13]),l=c,c=u,u=l^r(u,this.masking[12],this.rotate[12]),l=c,c=u,u=l^s(u,this.masking[11],this.rotate[11]),l=c,c=u,u=l^n(u,this.masking[10],this.rotate[10]),l=c,c=u,u=l^r(u,this.masking[9],this.rotate[9]),l=c,c=u,u=l^s(u,this.masking[8],this.rotate[8]),l=c,c=u,u=l^n(u,this.masking[7],this.rotate[7]),l=c,c=u,u=l^r(u,this.masking[6],this.rotate[6]),l=c,c=u,u=l^s(u,this.masking[5],this.rotate[5]),l=c,c=u,u=l^n(u,this.masking[4],this.rotate[4]),l=c,c=u,u=l^r(u,this.masking[3],this.rotate[3]),l=c,c=u,u=l^s(u,this.masking[2],this.rotate[2]),l=c,c=u,u=l^n(u,this.masking[1],this.rotate[1]),l=c,c=u,u=l^r(u,this.masking[0],this.rotate[0]),l=c,a[f]=u>>>24&255,a[f+1]=u>>>16&255,a[f+2]=u>>>8&255,a[f+3]=255&u,a[f+4]=l>>>24&255,a[f+5]=l>>16&255,a[f+6]=l>>8&255,a[f+7]=255&l}return a};const e=[,,,,];e[0]=[,,,,],e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=[,,,,],e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=[,,,,],e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=[,,,,],e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=[,,,,];function r(o,a,f){const c=a+o,l=c<<f|c>>>32-f;return(i[0][l>>>24]^i[1][l>>>16&255])-i[2][l>>>8&255]+i[3][255&l]}function n(o,a,f){const c=a^o,l=c<<f|c>>>32-f;return i[0][l>>>24]-i[1][l>>>16&255]+i[2][l>>>8&255]^i[3][255&l]}function s(o,a,f){const c=a-o,l=c<<f|c>>>32-f;return(i[0][l>>>24]+i[1][l>>>16&255]^i[2][l>>>8&255])-i[3][255&l]}t[0]=[,,,,],t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=[,,,,],t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=[,,,,],t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=[,,,,],t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(o){const a=[,,,,,,,,],f=Array(32);let c;for(let d=0;d<4;d++)c=4*d,a[d]=o[c]<<24|o[c+1]<<16|o[c+2]<<8|o[c+3];const l=[6,7,4,5];let u,p=0;for(let d=0;d<2;d++)for(let h=0;h<4;h++){for(c=0;c<4;c++){const y=e[h][c];u=a[y[1]],u^=i[4][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[5][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[6][a[y[4]>>>2]>>>24-8*(3&y[4])&255],u^=i[7][a[y[5]>>>2]>>>24-8*(3&y[5])&255],u^=i[l[c]][a[y[6]>>>2]>>>24-8*(3&y[6])&255],a[y[0]]=u}for(c=0;c<4;c++){const y=t[h][c];u=i[4][a[y[0]>>>2]>>>24-8*(3&y[0])&255],u^=i[5][a[y[1]>>>2]>>>24-8*(3&y[1])&255],u^=i[6][a[y[2]>>>2]>>>24-8*(3&y[2])&255],u^=i[7][a[y[3]>>>2]>>>24-8*(3&y[3])&255],u^=i[4+c][a[y[4]>>>2]>>>24-8*(3&y[4])&255],f[p]=u,p++}}for(let d=0;d<16;d++)this.masking[d]=f[d],this.rotate[d]=31&f[16+d]};const i=[,,,,,,,,];i[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],i[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],i[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],i[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],i[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],i[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],i[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],i[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function Mu(e){this.cast5=new wS,this.cast5.setKey(e),this.encrypt=function(t){return this.cast5.encrypt(t)}}ku.keySize=ku.prototype.keySize=24,ku.blockSize=ku.prototype.blockSize=8,Mu.blockSize=Mu.prototype.blockSize=8,Mu.keySize=Mu.prototype.keySize=16;const kn=4294967295;function ti(e,t){return(e<<t|e>>>32-t)&kn}function ki(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function ns(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function Nt(e,t){return e>>>8*t&255}function Ou(e){this.tf=function(){let t=null,r=null,n=-1,s=[],i=[[],[],[],[]];function o(l){return i[0][Nt(l,0)]^i[1][Nt(l,1)]^i[2][Nt(l,2)]^i[3][Nt(l,3)]}function a(l){return i[0][Nt(l,3)]^i[1][Nt(l,0)]^i[2][Nt(l,1)]^i[3][Nt(l,2)]}function f(l,u){let p=o(u[0]),d=a(u[1]);u[2]=ti(u[2]^p+d+s[4*l+8]&kn,31),u[3]=ti(u[3],1)^p+2*d+s[4*l+9]&kn,p=o(u[2]),d=a(u[3]),u[0]=ti(u[0]^p+d+s[4*l+10]&kn,31),u[1]=ti(u[1],1)^p+2*d+s[4*l+11]&kn}function c(l,u){let p=o(u[0]),d=a(u[1]);u[2]=ti(u[2],1)^p+d+s[4*l+10]&kn,u[3]=ti(u[3]^p+2*d+s[4*l+11]&kn,31),p=o(u[2]),d=a(u[3]),u[0]=ti(u[0],1)^p+d+s[4*l+8]&kn,u[1]=ti(u[1]^p+2*d+s[4*l+9]&kn,31)}return{name:"twofish",blocksize:16,open:function(l){let u,p,d,h,y;t=l;const g=[],m=[],b=[];let w;const E=[];let C,R,M;const _=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],A=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],I=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],P=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],v=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],S=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],T=[[],[]],N=[[],[],[],[]];function D(q){return q^q>>2^[0,90,180,238][3&q]}function O(q){return q^q>>1^q>>2^[0,238,180,90][3&q]}function L(q,W){let re,ue,H;for(re=0;re<8;re++)ue=W>>>24,W=W<<8&kn|q>>>24,q=q<<8&kn,H=ue<<1,128&ue&&(H^=333),W^=ue^H<<16,H^=ue>>>1,1&ue&&(H^=166),W^=H<<24|H<<8;return W}function B(q,W){const re=W>>4,ue=15&W,H=_[q][re^ue],ae=A[q][v[ue]^S[re]];return P[q][v[ae]^S[H]]<<4|I[q][H^ae]}function k(q,W){let re=Nt(q,0),ue=Nt(q,1),H=Nt(q,2),ae=Nt(q,3);switch(w){case 4:re=T[1][re]^Nt(W[3],0),ue=T[0][ue]^Nt(W[3],1),H=T[0][H]^Nt(W[3],2),ae=T[1][ae]^Nt(W[3],3);case 3:re=T[1][re]^Nt(W[2],0),ue=T[1][ue]^Nt(W[2],1),H=T[0][H]^Nt(W[2],2),ae=T[0][ae]^Nt(W[2],3);case 2:re=T[0][T[0][re]^Nt(W[1],0)]^Nt(W[0],0),ue=T[0][T[1][ue]^Nt(W[1],1)]^Nt(W[0],1),H=T[1][T[0][H]^Nt(W[1],2)]^Nt(W[0],2),ae=T[1][T[1][ae]^Nt(W[1],3)]^Nt(W[0],3)}return N[0][re]^N[1][ue]^N[2][H]^N[3][ae]}for(t=t.slice(0,32),u=t.length;u!==16&&u!==24&&u!==32;)t[u++]=0;for(u=0;u<t.length;u+=4)b[u>>2]=ki(t,u);for(u=0;u<256;u++)T[0][u]=B(0,u),T[1][u]=B(1,u);for(u=0;u<256;u++)C=T[1][u],R=D(C),M=O(C),N[0][u]=C+(R<<8)+(M<<16)+(M<<24),N[2][u]=R+(M<<8)+(C<<16)+(M<<24),C=T[0][u],R=D(C),M=O(C),N[1][u]=M+(M<<8)+(R<<16)+(C<<24),N[3][u]=R+(C<<8)+(M<<16)+(R<<24);for(w=b.length/2,u=0;u<w;u++)p=b[u+u],g[u]=p,d=b[u+u+1],m[u]=d,E[w-u-1]=L(p,d);for(u=0;u<40;u+=2)p=16843009*u,d=p+16843009,p=k(p,g),d=ti(k(d,m),8),s[u]=p+d&kn,s[u+1]=ti(p+2*d,9);for(u=0;u<256;u++)switch(p=d=h=y=u,w){case 4:p=T[1][p]^Nt(E[3],0),d=T[0][d]^Nt(E[3],1),h=T[0][h]^Nt(E[3],2),y=T[1][y]^Nt(E[3],3);case 3:p=T[1][p]^Nt(E[2],0),d=T[1][d]^Nt(E[2],1),h=T[0][h]^Nt(E[2],2),y=T[0][y]^Nt(E[2],3);case 2:i[0][u]=N[0][T[0][T[0][p]^Nt(E[1],0)]^Nt(E[0],0)],i[1][u]=N[1][T[0][T[1][d]^Nt(E[1],1)]^Nt(E[0],1)],i[2][u]=N[2][T[1][T[0][h]^Nt(E[1],2)]^Nt(E[0],2)],i[3][u]=N[3][T[1][T[1][y]^Nt(E[1],3)]^Nt(E[0],3)]}},close:function(){s=[],i=[[],[],[],[]]},encrypt:function(l,u){r=l,n=u;const p=[ki(r,n)^s[0],ki(r,n+4)^s[1],ki(r,n+8)^s[2],ki(r,n+12)^s[3]];for(let d=0;d<8;d++)f(d,p);return ns(r,n,p[2]^s[4]),ns(r,n+4,p[3]^s[5]),ns(r,n+8,p[0]^s[6]),ns(r,n+12,p[1]^s[7]),n+=16,r},decrypt:function(l,u){r=l,n=u;const p=[ki(r,n)^s[4],ki(r,n+4)^s[5],ki(r,n+8)^s[6],ki(r,n+12)^s[7]];for(let d=7;d>=0;d--)c(d,p);ns(r,n,p[2]^s[0]),ns(r,n+4,p[3]^s[1]),ns(r,n+8,p[0]^s[2]),ns(r,n+12,p[1]^s[3]),n+=16},finalize:function(){return r}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(t){return this.tf.encrypt(Array.from(t),0)}}function Hn(){}function Nu(e){this.bf=new Hn,this.bf.init(e),this.encrypt=function(t){return this.bf.encryptBlock(t)}}Ou.keySize=Ou.prototype.keySize=32,Ou.blockSize=Ou.prototype.blockSize=16,Hn.prototype.BLOCKSIZE=8,Hn.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]],Hn.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],Hn.prototype.NN=16,Hn.prototype._clean=function(e){return e<0&&(e=(2147483647&e)+2147483648),e},Hn.prototype._F=function(e){let t;const r=255&e,n=255&(e>>>=8),s=255&(e>>>=8),i=255&(e>>>=8);return t=this.sboxes[0][i]+this.sboxes[1][s],t^=this.sboxes[2][n],t+=this.sboxes[3][r],t},Hn.prototype._encryptBlock=function(e){let t,r=e[0],n=e[1];for(t=0;t<this.NN;++t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[this.NN+0],n^=this.parray[this.NN+1],e[0]=this._clean(n),e[1]=this._clean(r)},Hn.prototype.encryptBlock=function(e){let t;const r=[0,0],n=this.BLOCKSIZE/2;for(t=0;t<this.BLOCKSIZE/2;++t)r[0]=r[0]<<8|255&e[t+0],r[1]=r[1]<<8|255&e[t+n];this._encryptBlock(r);const s=[];for(t=0;t<this.BLOCKSIZE/2;++t)s[t+0]=r[0]>>>24-8*t&255,s[t+n]=r[1]>>>24-8*t&255;return s},Hn.prototype._decryptBlock=function(e){let t,r=e[0],n=e[1];for(t=this.NN+1;t>1;--t){r^=this.parray[t],n=this._F(r)^n;const s=r;r=n,n=s}r^=this.parray[1],n^=this.parray[0],e[0]=this._clean(n),e[1]=this._clean(r)},Hn.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t<this.NN+2;++t){let s=0;for(let i=0;i<4;++i)s=s<<8|255&e[r],++r>=e.length&&(r=0);this.parray[t]=this.PARRAY[t]^s}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const n=[0,0];for(t=0;t<this.NN+2;t+=2)this._encryptBlock(n),this.parray[t+0]=n[0],this.parray[t+1]=n[1];for(t=0;t<4;++t)for(r=0;r<256;r+=2)this._encryptBlock(n),this.sboxes[t][r+0]=n[0],this.sboxes[t][r+1]=n[1]},Nu.keySize=Nu.prototype.keySize=16,Nu.blockSize=Nu.prototype.blockSize=8;const ES=zy(128),AS=zy(192),SS=zy(256),PS=function(e){this.key=e,this.encrypt=function(t,r){return zu(Wu(this.key),t,!0,0,null,r)},this.decrypt=function(t,r){return zu(Wu(this.key),t,!1,0,null,r)}};var Pl=Object.freeze({__proto__:null,aes128:ES,aes192:AS,aes256:SS,des:PS,tripledes:ku,cast5:Mu,twofish:Ou,blowfish:Nu,idea:function(){throw Error("IDEA symmetric-key algorithm not implemented")}}),c8=function(e,t,r){var n=0,s=0,i=0,o=0,a=0,f=0,c=0,l=0,u=0,p=0,d=0,h=0,y=0,g=0,m=0,b=0,w=0,E=new e.Uint8Array(r);function C(O,L,B,k,q,W,re,ue,H,ae,V,U,te,ge,Pe,Te){O=O|0,L=L|0,B=B|0,k=k|0,q=q|0,W=W|0,re=re|0,ue=ue|0,H=H|0,ae=ae|0,V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0,Te=Te|0;var z=0,$=0,F=0,Q=0,de=0,oe=0,ne=0,Fe=0,je=0,He=0,he=0,ce=0,pe=0,le=0,fe=0,ye=0,ee=0,Z=0,$e=0,Ve=0,Qe=0,dt=0,rt=0,ve=0,G=0,se=0,me=0,Se=0,Ae=0,ke=0,Ne=0,xe=0,Re=0,Me=0,et=0,we=0,Ce=0,Oe=0,Ue=0,qe=0,K=0,Y=0,J=0,x=0,ie=0,Ee=0,Ie=0,De=0,Ge=0,ut=0,nt=0,Ct=0,st=0,mt=0,vt=0,At=0,Et=0,bt=0,wt=0,_t=0,ct=0,ft=0,it=0,lt=0,ht=0,ot=0,Be=0,Le=0,Ye=0,ze=0,We=0;z=n,$=s,F=i,Q=o,de=a,ne=O+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=L+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=B+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=k+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=q+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=W+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=re+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=ue+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=H+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=ae+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=V+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=U+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=te+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=ge+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=Pe+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,ne=Te+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ge^H^B^O,Fe=oe<<1|oe>>>31,ne=Fe+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Pe^ae^k^L,je=oe<<1|oe>>>31,ne=je+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Te^V^q^B,He=oe<<1|oe>>>31,ne=He+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Fe^U^W^k,he=oe<<1|oe>>>31,ne=he+(z<<5|z>>>27)+de+($&F|~$&Q)+1518500249|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=je^te^re^q,ce=oe<<1|oe>>>31,ne=ce+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=He^ge^ue^W,pe=oe<<1|oe>>>31,ne=pe+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=he^Pe^H^re,le=oe<<1|oe>>>31,ne=le+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ce^Te^ae^ue,fe=oe<<1|oe>>>31,ne=fe+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=pe^Fe^V^H,ye=oe<<1|oe>>>31,ne=ye+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=le^je^U^ae,ee=oe<<1|oe>>>31,ne=ee+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=fe^He^te^V,Z=oe<<1|oe>>>31,ne=Z+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ye^he^ge^U,$e=oe<<1|oe>>>31,ne=$e+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ee^ce^Pe^te,Ve=oe<<1|oe>>>31,ne=Ve+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Z^pe^Te^ge,Qe=oe<<1|oe>>>31,ne=Qe+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=$e^le^Fe^Pe,dt=oe<<1|oe>>>31,ne=dt+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ve^fe^je^Te,rt=oe<<1|oe>>>31,ne=rt+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Qe^ye^He^Fe,ve=oe<<1|oe>>>31,ne=ve+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=dt^ee^he^je,G=oe<<1|oe>>>31,ne=G+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=rt^Z^ce^He,se=oe<<1|oe>>>31,ne=se+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ve^$e^pe^he,me=oe<<1|oe>>>31,ne=me+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=G^Ve^le^ce,Se=oe<<1|oe>>>31,ne=Se+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=se^Qe^fe^pe,Ae=oe<<1|oe>>>31,ne=Ae+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=me^dt^ye^le,ke=oe<<1|oe>>>31,ne=ke+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Se^rt^ee^fe,Ne=oe<<1|oe>>>31,ne=Ne+(z<<5|z>>>27)+de+($^F^Q)+1859775393|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ae^ve^Z^ye,xe=oe<<1|oe>>>31,ne=xe+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ke^G^$e^ee,Re=oe<<1|oe>>>31,ne=Re+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ne^se^Ve^Z,Me=oe<<1|oe>>>31,ne=Me+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=xe^me^Qe^$e,et=oe<<1|oe>>>31,ne=et+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Re^Se^dt^Ve,we=oe<<1|oe>>>31,ne=we+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Me^Ae^rt^Qe,Ce=oe<<1|oe>>>31,ne=Ce+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=et^ke^ve^dt,Oe=oe<<1|oe>>>31,ne=Oe+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=we^Ne^G^rt,Ue=oe<<1|oe>>>31,ne=Ue+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ce^xe^se^ve,qe=oe<<1|oe>>>31,ne=qe+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Oe^Re^me^G,K=oe<<1|oe>>>31,ne=K+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ue^Me^Se^se,Y=oe<<1|oe>>>31,ne=Y+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=qe^et^Ae^me,J=oe<<1|oe>>>31,ne=J+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=K^we^ke^Se,x=oe<<1|oe>>>31,ne=x+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Y^Ce^Ne^Ae,ie=oe<<1|oe>>>31,ne=ie+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=J^Oe^xe^ke,Ee=oe<<1|oe>>>31,ne=Ee+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=x^Ue^Re^Ne,Ie=oe<<1|oe>>>31,ne=Ie+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ie^qe^Me^xe,De=oe<<1|oe>>>31,ne=De+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ee^K^et^Re,Ge=oe<<1|oe>>>31,ne=Ge+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ie^Y^we^Me,ut=oe<<1|oe>>>31,ne=ut+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=De^J^Ce^et,nt=oe<<1|oe>>>31,ne=nt+(z<<5|z>>>27)+de+($&F|$&Q|F&Q)-1894007588|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ge^x^Oe^we,Ct=oe<<1|oe>>>31,ne=Ct+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ut^ie^Ue^Ce,st=oe<<1|oe>>>31,ne=st+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=nt^Ee^qe^Oe,mt=oe<<1|oe>>>31,ne=mt+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Ct^Ie^K^Ue,vt=oe<<1|oe>>>31,ne=vt+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=st^De^Y^qe,At=oe<<1|oe>>>31,ne=At+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=mt^Ge^J^K,Et=oe<<1|oe>>>31,ne=Et+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=vt^ut^x^Y,bt=oe<<1|oe>>>31,ne=bt+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=At^nt^ie^J,wt=oe<<1|oe>>>31,ne=wt+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Et^Ct^Ee^x,_t=oe<<1|oe>>>31,ne=_t+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=bt^st^Ie^ie,ct=oe<<1|oe>>>31,ne=ct+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=wt^mt^De^Ee,ft=oe<<1|oe>>>31,ne=ft+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=_t^vt^Ge^Ie,it=oe<<1|oe>>>31,ne=it+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ct^At^ut^De,lt=oe<<1|oe>>>31,ne=lt+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ft^Et^nt^Ge,ht=oe<<1|oe>>>31,ne=ht+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=it^bt^Ct^ut,ot=oe<<1|oe>>>31,ne=ot+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=lt^wt^st^nt,Be=oe<<1|oe>>>31,ne=Be+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ht^_t^mt^Ct,Le=oe<<1|oe>>>31,ne=Le+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=ot^ct^vt^st,Ye=oe<<1|oe>>>31,ne=Ye+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Be^ft^At^mt,ze=oe<<1|oe>>>31,ne=ze+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,oe=Le^it^Et^vt,We=oe<<1|oe>>>31,ne=We+(z<<5|z>>>27)+de+($^F^Q)-899497514|0,de=Q,Q=F,F=$<<30|$>>>2,$=z,z=ne,n=n+z|0,s=s+$|0,i=i+F|0,o=o+Q|0,a=a+de|0}function R(O){O=O|0,C(E[O|0]<<24|E[O|1]<<16|E[O|2]<<8|E[O|3],E[O|4]<<24|E[O|5]<<16|E[O|6]<<8|E[O|7],E[O|8]<<24|E[O|9]<<16|E[O|10]<<8|E[O|11],E[O|12]<<24|E[O|13]<<16|E[O|14]<<8|E[O|15],E[O|16]<<24|E[O|17]<<16|E[O|18]<<8|E[O|19],E[O|20]<<24|E[O|21]<<16|E[O|22]<<8|E[O|23],E[O|24]<<24|E[O|25]<<16|E[O|26]<<8|E[O|27],E[O|28]<<24|E[O|29]<<16|E[O|30]<<8|E[O|31],E[O|32]<<24|E[O|33]<<16|E[O|34]<<8|E[O|35],E[O|36]<<24|E[O|37]<<16|E[O|38]<<8|E[O|39],E[O|40]<<24|E[O|41]<<16|E[O|42]<<8|E[O|43],E[O|44]<<24|E[O|45]<<16|E[O|46]<<8|E[O|47],E[O|48]<<24|E[O|49]<<16|E[O|50]<<8|E[O|51],E[O|52]<<24|E[O|53]<<16|E[O|54]<<8|E[O|55],E[O|56]<<24|E[O|57]<<16|E[O|58]<<8|E[O|59],E[O|60]<<24|E[O|61]<<16|E[O|62]<<8|E[O|63])}function M(O){O=O|0,E[O|0]=n>>>24,E[O|1]=n>>>16&255,E[O|2]=n>>>8&255,E[O|3]=n&255,E[O|4]=s>>>24,E[O|5]=s>>>16&255,E[O|6]=s>>>8&255,E[O|7]=s&255,E[O|8]=i>>>24,E[O|9]=i>>>16&255,E[O|10]=i>>>8&255,E[O|11]=i&255,E[O|12]=o>>>24,E[O|13]=o>>>16&255,E[O|14]=o>>>8&255,E[O|15]=o&255,E[O|16]=a>>>24,E[O|17]=a>>>16&255,E[O|18]=a>>>8&255,E[O|19]=a&255}function _(){n=1732584193,s=4023233417,i=2562383102,o=271733878,a=3285377520,f=c=0}function A(O,L,B,k,q,W,re){O=O|0,L=L|0,B=B|0,k=k|0,q=q|0,W=W|0,re=re|0,n=O,s=L,i=B,o=k,a=q,f=W,c=re}function I(O,L){O=O|0,L=L|0;var B=0;if(O&63)return-1;for(;(L|0)>=64;)R(O),O=O+64|0,L=L-64|0,B=B+64|0;return f=f+B|0,f>>>0<B>>>0&&(c=c+1|0),B|0}function P(O,L,B){O=O|0,L=L|0,B=B|0;var k=0,q=0;if(O&63||~B&&B&31)return-1;if((L|0)>=64){if(k=I(O,L)|0,(k|0)==-1)return-1;O=O+k|0,L=L-k|0}if(k=k+L|0,f=f+L|0,f>>>0<L>>>0&&(c=c+1|0),E[O|L]=128,(L|0)>=56){for(q=L+1|0;(q|0)<64;q=q+1|0)E[O|q]=0;R(O),L=0,E[O|0]=0}for(q=L+1|0;(q|0)<59;q=q+1|0)E[O|q]=0;return E[O|56]=c>>>21&255,E[O|57]=c>>>13&255,E[O|58]=c>>>5&255,E[O|59]=c<<3&255|f>>>29,E[O|60]=f>>>21&255,E[O|61]=f>>>13&255,E[O|62]=f>>>5&255,E[O|63]=f<<3&255,R(O),~B&&M(B),k|0}function v(){n=l,s=u,i=p,o=d,a=h,f=64,c=0}function S(){n=y,s=g,i=m,o=b,a=w,f=64,c=0}function T(O,L,B,k,q,W,re,ue,H,ae,V,U,te,ge,Pe,Te){O=O|0,L=L|0,B=B|0,k=k|0,q=q|0,W=W|0,re=re|0,ue=ue|0,H=H|0,ae=ae|0,V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0,Te=Te|0,_(),C(O^1549556828,L^1549556828,B^1549556828,k^1549556828,q^1549556828,W^1549556828,re^1549556828,ue^1549556828,H^1549556828,ae^1549556828,V^1549556828,U^1549556828,te^1549556828,ge^1549556828,Pe^1549556828,Te^1549556828),y=n,g=s,m=i,b=o,w=a,_(),C(O^909522486,L^909522486,B^909522486,k^909522486,q^909522486,W^909522486,re^909522486,ue^909522486,H^909522486,ae^909522486,V^909522486,U^909522486,te^909522486,ge^909522486,Pe^909522486,Te^909522486),l=n,u=s,p=i,d=o,h=a,f=64,c=0}function N(O,L,B){O=O|0,L=L|0,B=B|0;var k=0,q=0,W=0,re=0,ue=0,H=0;return O&63||~B&&B&31?-1:(H=P(O,L,-1)|0,k=n,q=s,W=i,re=o,ue=a,S(),C(k,q,W,re,ue,2147483648,0,0,0,0,0,0,0,0,0,672),~B&&M(B),H|0)}function D(O,L,B,k,q){O=O|0,L=L|0,B=B|0,k=k|0,q=q|0;var W=0,re=0,ue=0,H=0,ae=0,V=0,U=0,te=0,ge=0,Pe=0;if(O&63||~q&&q&31)return-1;for(E[O+L|0]=B>>>24,E[O+L+1|0]=B>>>16&255,E[O+L+2|0]=B>>>8&255,E[O+L+3|0]=B&255,N(O,L+4|0,-1)|0,W=V=n,re=U=s,ue=te=i,H=ge=o,ae=Pe=a,k=k-1|0;(k|0)>0;)v(),C(V,U,te,ge,Pe,2147483648,0,0,0,0,0,0,0,0,0,672),V=n,U=s,te=i,ge=o,Pe=a,S(),C(V,U,te,ge,Pe,2147483648,0,0,0,0,0,0,0,0,0,672),V=n,U=s,te=i,ge=o,Pe=a,W=W^n,re=re^s,ue=ue^i,H=H^o,ae=ae^a,k=k-1|0;return n=W,s=re,i=ue,o=H,a=ae,~q&&M(q),0}return{reset:_,init:A,process:I,finish:P,hmac_reset:v,hmac_init:T,hmac_finish:N,pbkdf2_generate_block:D}};class u8{constructor(){this.pos=0,this.len=0}reset(){const{asm:t}=this.acquire_asm();return this.result=null,this.pos=0,this.len=0,t.reset(),this}process(t){if(this.result!==null)throw new Jp("state must be reset before processing new data");const{asm:r,heap:n}=this.acquire_asm();let s=this.pos,i=this.len,o=0,a=t.length,f=0;for(;a>0;)f=ia(n,s+i,t,o,a),i+=f,o+=f,a-=f,f=r.process(s,i),s+=f,i-=f,i||(s=0);return this.pos=s,this.len=i,this}finish(){if(this.result!==null)throw new Jp("state must be reset before processing new data");const{asm:t,heap:r}=this.acquire_asm();return t.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(r.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this.release_asm(),this}}const Tg=[],Ig=[];class sa extends u8{constructor(){super(),this.NAME="sha1",this.BLOCK_SIZE=64,this.HASH_SIZE=20,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=Tg.pop()||Gy(),this.asm=Ig.pop()||c8({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(Tg.push(this.heap),Ig.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new sa().process(t).finish().result}}sa.NAME="sha1",sa.heap_pool=[],sa.asm_pool=[],sa.asm_function=c8;const Cg=[],Rg=[];class Qf extends u8{constructor(){super(),this.NAME="sha256",this.BLOCK_SIZE=64,this.HASH_SIZE=32,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=Cg.pop()||Gy(),this.asm=Rg.pop()||function(t,r,n){var s=0,i=0,o=0,a=0,f=0,c=0,l=0,u=0,p=0,d=0,h=0,y=0,g=0,m=0,b=0,w=0,E=0,C=0,R=0,M=0,_=0,A=0,I=0,P=0,v=0,S=0,T=new t.Uint8Array(n);function N(V,U,te,ge,Pe,Te,z,$,F,Q,de,oe,ne,Fe,je,He){V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0,Te=Te|0,z=z|0,$=$|0,F=F|0,Q=Q|0,de=de|0,oe=oe|0,ne=ne|0,Fe=Fe|0,je=je|0,He=He|0;var he=0,ce=0,pe=0,le=0,fe=0,ye=0,ee=0,Z=0;he=s,ce=i,pe=o,le=a,fe=f,ye=c,ee=l,Z=u,Z=V+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+1116352408|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=U+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+1899447441|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,ye=te+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+3049323471|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,fe=ge+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+3921009573|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,le=Pe+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+961987163|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=Te+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+1508970993|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,ce=z+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+2453635748|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=$+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+2870763221|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,Z=F+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+3624381080|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,ee=Q+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+310598401|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,ye=de+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+607225278|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,fe=oe+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+1426881987|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,le=ne+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+1925078388|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,pe=Fe+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+2162078206|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,ce=je+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+2614888103|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,he=He+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+3248222580|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+V+Q|0,Z=V+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+3835390401|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(te>>>7^te>>>18^te>>>3^te<<25^te<<14)+(He>>>17^He>>>19^He>>>10^He<<15^He<<13)+U+de|0,ee=U+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+4022224774|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,te=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+te+oe|0,ye=te+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+264347078|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,ge=(Pe>>>7^Pe>>>18^Pe>>>3^Pe<<25^Pe<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ge+ne|0,fe=ge+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+604807628|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,Pe=(Te>>>7^Te>>>18^Te>>>3^Te<<25^Te<<14)+(te>>>17^te>>>19^te>>>10^te<<15^te<<13)+Pe+Fe|0,le=Pe+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+770255983|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Te=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Te+je|0,pe=Te+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+1249150122|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,z=($>>>7^$>>>18^$>>>3^$<<25^$<<14)+(Pe>>>17^Pe>>>19^Pe>>>10^Pe<<15^Pe<<13)+z+He|0,ce=z+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+1555081692|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,$=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(Te>>>17^Te>>>19^Te>>>10^Te<<15^Te<<13)+$+V|0,he=$+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+1996064986|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,F=(Q>>>7^Q>>>18^Q>>>3^Q<<25^Q<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+F+U|0,Z=F+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+2554220882|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,Q=(de>>>7^de>>>18^de>>>3^de<<25^de<<14)+($>>>17^$>>>19^$>>>10^$<<15^$<<13)+Q+te|0,ee=Q+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+2821834349|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,de=(oe>>>7^oe>>>18^oe>>>3^oe<<25^oe<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+de+ge|0,ye=de+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+2952996808|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,oe=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(Q>>>17^Q>>>19^Q>>>10^Q<<15^Q<<13)+oe+Pe|0,fe=oe+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+3210313671|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(de>>>17^de>>>19^de>>>10^de<<15^de<<13)+ne+Te|0,le=ne+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+3336571891|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(oe>>>17^oe>>>19^oe>>>10^oe<<15^oe<<13)+Fe+z|0,pe=Fe+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+3584528711|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,je=(He>>>7^He>>>18^He>>>3^He<<25^He<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+je+$|0,ce=je+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+113926993|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,He=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+He+F|0,he=He+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+338241895|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+V+Q|0,Z=V+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+666307205|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(te>>>7^te>>>18^te>>>3^te<<25^te<<14)+(He>>>17^He>>>19^He>>>10^He<<15^He<<13)+U+de|0,ee=U+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+773529912|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,te=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+te+oe|0,ye=te+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+1294757372|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,ge=(Pe>>>7^Pe>>>18^Pe>>>3^Pe<<25^Pe<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ge+ne|0,fe=ge+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+1396182291|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,Pe=(Te>>>7^Te>>>18^Te>>>3^Te<<25^Te<<14)+(te>>>17^te>>>19^te>>>10^te<<15^te<<13)+Pe+Fe|0,le=Pe+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+1695183700|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Te=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Te+je|0,pe=Te+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+1986661051|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,z=($>>>7^$>>>18^$>>>3^$<<25^$<<14)+(Pe>>>17^Pe>>>19^Pe>>>10^Pe<<15^Pe<<13)+z+He|0,ce=z+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+2177026350|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,$=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(Te>>>17^Te>>>19^Te>>>10^Te<<15^Te<<13)+$+V|0,he=$+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+2456956037|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,F=(Q>>>7^Q>>>18^Q>>>3^Q<<25^Q<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+F+U|0,Z=F+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+2730485921|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,Q=(de>>>7^de>>>18^de>>>3^de<<25^de<<14)+($>>>17^$>>>19^$>>>10^$<<15^$<<13)+Q+te|0,ee=Q+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+2820302411|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,de=(oe>>>7^oe>>>18^oe>>>3^oe<<25^oe<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+de+ge|0,ye=de+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+3259730800|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,oe=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(Q>>>17^Q>>>19^Q>>>10^Q<<15^Q<<13)+oe+Pe|0,fe=oe+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+3345764771|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(de>>>17^de>>>19^de>>>10^de<<15^de<<13)+ne+Te|0,le=ne+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+3516065817|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(oe>>>17^oe>>>19^oe>>>10^oe<<15^oe<<13)+Fe+z|0,pe=Fe+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+3600352804|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,je=(He>>>7^He>>>18^He>>>3^He<<25^He<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+je+$|0,ce=je+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+4094571909|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,He=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+He+F|0,he=He+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+275423344|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,V=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(je>>>17^je>>>19^je>>>10^je<<15^je<<13)+V+Q|0,Z=V+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+430227734|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,U=(te>>>7^te>>>18^te>>>3^te<<25^te<<14)+(He>>>17^He>>>19^He>>>10^He<<15^He<<13)+U+de|0,ee=U+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+506948616|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,te=(ge>>>7^ge>>>18^ge>>>3^ge<<25^ge<<14)+(V>>>17^V>>>19^V>>>10^V<<15^V<<13)+te+oe|0,ye=te+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+659060556|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,ge=(Pe>>>7^Pe>>>18^Pe>>>3^Pe<<25^Pe<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+ge+ne|0,fe=ge+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+883997877|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,Pe=(Te>>>7^Te>>>18^Te>>>3^Te<<25^Te<<14)+(te>>>17^te>>>19^te>>>10^te<<15^te<<13)+Pe+Fe|0,le=Pe+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+958139571|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Te=(z>>>7^z>>>18^z>>>3^z<<25^z<<14)+(ge>>>17^ge>>>19^ge>>>10^ge<<15^ge<<13)+Te+je|0,pe=Te+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+1322822218|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,z=($>>>7^$>>>18^$>>>3^$<<25^$<<14)+(Pe>>>17^Pe>>>19^Pe>>>10^Pe<<15^Pe<<13)+z+He|0,ce=z+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+1537002063|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,$=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(Te>>>17^Te>>>19^Te>>>10^Te<<15^Te<<13)+$+V|0,he=$+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+1747873779|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,F=(Q>>>7^Q>>>18^Q>>>3^Q<<25^Q<<14)+(z>>>17^z>>>19^z>>>10^z<<15^z<<13)+F+U|0,Z=F+Z+(fe>>>6^fe>>>11^fe>>>25^fe<<26^fe<<21^fe<<7)+(ee^fe&(ye^ee))+1955562222|0,le=le+Z|0,Z=Z+(he&ce^pe&(he^ce))+(he>>>2^he>>>13^he>>>22^he<<30^he<<19^he<<10)|0,Q=(de>>>7^de>>>18^de>>>3^de<<25^de<<14)+($>>>17^$>>>19^$>>>10^$<<15^$<<13)+Q+te|0,ee=Q+ee+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(ye^le&(fe^ye))+2024104815|0,pe=pe+ee|0,ee=ee+(Z&he^ce&(Z^he))+(Z>>>2^Z>>>13^Z>>>22^Z<<30^Z<<19^Z<<10)|0,de=(oe>>>7^oe>>>18^oe>>>3^oe<<25^oe<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+de+ge|0,ye=de+ye+(pe>>>6^pe>>>11^pe>>>25^pe<<26^pe<<21^pe<<7)+(fe^pe&(le^fe))+2227730452|0,ce=ce+ye|0,ye=ye+(ee&Z^he&(ee^Z))+(ee>>>2^ee>>>13^ee>>>22^ee<<30^ee<<19^ee<<10)|0,oe=(ne>>>7^ne>>>18^ne>>>3^ne<<25^ne<<14)+(Q>>>17^Q>>>19^Q>>>10^Q<<15^Q<<13)+oe+Pe|0,fe=oe+fe+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(le^ce&(pe^le))+2361852424|0,he=he+fe|0,fe=fe+(ye&ee^Z&(ye^ee))+(ye>>>2^ye>>>13^ye>>>22^ye<<30^ye<<19^ye<<10)|0,ne=(Fe>>>7^Fe>>>18^Fe>>>3^Fe<<25^Fe<<14)+(de>>>17^de>>>19^de>>>10^de<<15^de<<13)+ne+Te|0,le=ne+le+(he>>>6^he>>>11^he>>>25^he<<26^he<<21^he<<7)+(pe^he&(ce^pe))+2428436474|0,Z=Z+le|0,le=le+(fe&ye^ee&(fe^ye))+(fe>>>2^fe>>>13^fe>>>22^fe<<30^fe<<19^fe<<10)|0,Fe=(je>>>7^je>>>18^je>>>3^je<<25^je<<14)+(oe>>>17^oe>>>19^oe>>>10^oe<<15^oe<<13)+Fe+z|0,pe=Fe+pe+(Z>>>6^Z>>>11^Z>>>25^Z<<26^Z<<21^Z<<7)+(ce^Z&(he^ce))+2756734187|0,ee=ee+pe|0,pe=pe+(le&fe^ye&(le^fe))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,je=(He>>>7^He>>>18^He>>>3^He<<25^He<<14)+(ne>>>17^ne>>>19^ne>>>10^ne<<15^ne<<13)+je+$|0,ce=je+ce+(ee>>>6^ee>>>11^ee>>>25^ee<<26^ee<<21^ee<<7)+(he^ee&(Z^he))+3204031479|0,ye=ye+ce|0,ce=ce+(pe&le^fe&(pe^le))+(pe>>>2^pe>>>13^pe>>>22^pe<<30^pe<<19^pe<<10)|0,He=(V>>>7^V>>>18^V>>>3^V<<25^V<<14)+(Fe>>>17^Fe>>>19^Fe>>>10^Fe<<15^Fe<<13)+He+F|0,he=He+he+(ye>>>6^ye>>>11^ye>>>25^ye<<26^ye<<21^ye<<7)+(Z^ye&(ee^Z))+3329325298|0,fe=fe+he|0,he=he+(ce&pe^le&(ce^pe))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,s=s+he|0,i=i+ce|0,o=o+pe|0,a=a+le|0,f=f+fe|0,c=c+ye|0,l=l+ee|0,u=u+Z|0}function D(V){V=V|0,N(T[V|0]<<24|T[V|1]<<16|T[V|2]<<8|T[V|3],T[V|4]<<24|T[V|5]<<16|T[V|6]<<8|T[V|7],T[V|8]<<24|T[V|9]<<16|T[V|10]<<8|T[V|11],T[V|12]<<24|T[V|13]<<16|T[V|14]<<8|T[V|15],T[V|16]<<24|T[V|17]<<16|T[V|18]<<8|T[V|19],T[V|20]<<24|T[V|21]<<16|T[V|22]<<8|T[V|23],T[V|24]<<24|T[V|25]<<16|T[V|26]<<8|T[V|27],T[V|28]<<24|T[V|29]<<16|T[V|30]<<8|T[V|31],T[V|32]<<24|T[V|33]<<16|T[V|34]<<8|T[V|35],T[V|36]<<24|T[V|37]<<16|T[V|38]<<8|T[V|39],T[V|40]<<24|T[V|41]<<16|T[V|42]<<8|T[V|43],T[V|44]<<24|T[V|45]<<16|T[V|46]<<8|T[V|47],T[V|48]<<24|T[V|49]<<16|T[V|50]<<8|T[V|51],T[V|52]<<24|T[V|53]<<16|T[V|54]<<8|T[V|55],T[V|56]<<24|T[V|57]<<16|T[V|58]<<8|T[V|59],T[V|60]<<24|T[V|61]<<16|T[V|62]<<8|T[V|63])}function O(V){V=V|0,T[V|0]=s>>>24,T[V|1]=s>>>16&255,T[V|2]=s>>>8&255,T[V|3]=s&255,T[V|4]=i>>>24,T[V|5]=i>>>16&255,T[V|6]=i>>>8&255,T[V|7]=i&255,T[V|8]=o>>>24,T[V|9]=o>>>16&255,T[V|10]=o>>>8&255,T[V|11]=o&255,T[V|12]=a>>>24,T[V|13]=a>>>16&255,T[V|14]=a>>>8&255,T[V|15]=a&255,T[V|16]=f>>>24,T[V|17]=f>>>16&255,T[V|18]=f>>>8&255,T[V|19]=f&255,T[V|20]=c>>>24,T[V|21]=c>>>16&255,T[V|22]=c>>>8&255,T[V|23]=c&255,T[V|24]=l>>>24,T[V|25]=l>>>16&255,T[V|26]=l>>>8&255,T[V|27]=l&255,T[V|28]=u>>>24,T[V|29]=u>>>16&255,T[V|30]=u>>>8&255,T[V|31]=u&255}function L(){s=1779033703,i=3144134277,o=1013904242,a=2773480762,f=1359893119,c=2600822924,l=528734635,u=1541459225,p=d=0}function B(V,U,te,ge,Pe,Te,z,$,F,Q){V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0,Te=Te|0,z=z|0,$=$|0,F=F|0,Q=Q|0,s=V,i=U,o=te,a=ge,f=Pe,c=Te,l=z,u=$,p=F,d=Q}function k(V,U){V=V|0,U=U|0;var te=0;if(V&63)return-1;for(;(U|0)>=64;)D(V),V=V+64|0,U=U-64|0,te=te+64|0;return p=p+te|0,p>>>0<te>>>0&&(d=d+1|0),te|0}function q(V,U,te){V=V|0,U=U|0,te=te|0;var ge=0,Pe=0;if(V&63||~te&&te&31)return-1;if((U|0)>=64){if(ge=k(V,U)|0,(ge|0)==-1)return-1;V=V+ge|0,U=U-ge|0}if(ge=ge+U|0,p=p+U|0,p>>>0<U>>>0&&(d=d+1|0),T[V|U]=128,(U|0)>=56){for(Pe=U+1|0;(Pe|0)<64;Pe=Pe+1|0)T[V|Pe]=0;D(V),U=0,T[V|0]=0}for(Pe=U+1|0;(Pe|0)<59;Pe=Pe+1|0)T[V|Pe]=0;return T[V|56]=d>>>21&255,T[V|57]=d>>>13&255,T[V|58]=d>>>5&255,T[V|59]=d<<3&255|p>>>29,T[V|60]=p>>>21&255,T[V|61]=p>>>13&255,T[V|62]=p>>>5&255,T[V|63]=p<<3&255,D(V),~te&&O(te),ge|0}function W(){s=h,i=y,o=g,a=m,f=b,c=w,l=E,u=C,p=64,d=0}function re(){s=R,i=M,o=_,a=A,f=I,c=P,l=v,u=S,p=64,d=0}function ue(V,U,te,ge,Pe,Te,z,$,F,Q,de,oe,ne,Fe,je,He){V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0,Te=Te|0,z=z|0,$=$|0,F=F|0,Q=Q|0,de=de|0,oe=oe|0,ne=ne|0,Fe=Fe|0,je=je|0,He=He|0,L(),N(V^1549556828,U^1549556828,te^1549556828,ge^1549556828,Pe^1549556828,Te^1549556828,z^1549556828,$^1549556828,F^1549556828,Q^1549556828,de^1549556828,oe^1549556828,ne^1549556828,Fe^1549556828,je^1549556828,He^1549556828),R=s,M=i,_=o,A=a,I=f,P=c,v=l,S=u,L(),N(V^909522486,U^909522486,te^909522486,ge^909522486,Pe^909522486,Te^909522486,z^909522486,$^909522486,F^909522486,Q^909522486,de^909522486,oe^909522486,ne^909522486,Fe^909522486,je^909522486,He^909522486),h=s,y=i,g=o,m=a,b=f,w=c,E=l,C=u,p=64,d=0}function H(V,U,te){V=V|0,U=U|0,te=te|0;var ge=0,Pe=0,Te=0,z=0,$=0,F=0,Q=0,de=0,oe=0;return V&63||~te&&te&31?-1:(oe=q(V,U,-1)|0,ge=s,Pe=i,Te=o,z=a,$=f,F=c,Q=l,de=u,re(),N(ge,Pe,Te,z,$,F,Q,de,2147483648,0,0,0,0,0,0,768),~te&&O(te),oe|0)}function ae(V,U,te,ge,Pe){V=V|0,U=U|0,te=te|0,ge=ge|0,Pe=Pe|0;var Te=0,z=0,$=0,F=0,Q=0,de=0,oe=0,ne=0,Fe=0,je=0,He=0,he=0,ce=0,pe=0,le=0,fe=0;if(V&63||~Pe&&Pe&31)return-1;for(T[V+U|0]=te>>>24,T[V+U+1|0]=te>>>16&255,T[V+U+2|0]=te>>>8&255,T[V+U+3|0]=te&255,H(V,U+4|0,-1)|0,Te=Fe=s,z=je=i,$=He=o,F=he=a,Q=ce=f,de=pe=c,oe=le=l,ne=fe=u,ge=ge-1|0;(ge|0)>0;)W(),N(Fe,je,He,he,ce,pe,le,fe,2147483648,0,0,0,0,0,0,768),Fe=s,je=i,He=o,he=a,ce=f,pe=c,le=l,fe=u,re(),N(Fe,je,He,he,ce,pe,le,fe,2147483648,0,0,0,0,0,0,768),Fe=s,je=i,He=o,he=a,ce=f,pe=c,le=l,fe=u,Te=Te^s,z=z^i,$=$^o,F=F^a,Q=Q^f,de=de^c,oe=oe^l,ne=ne^u,ge=ge-1|0;return s=Te,i=z,o=$,a=F,f=Q,c=de,l=oe,u=ne,~Pe&&O(Pe),0}return{reset:L,init:B,process:k,finish:q,hmac_reset:W,hmac_init:ue,hmac_finish:H,pbkdf2_generate_block:ae}}({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(Cg.push(this.heap),Rg.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new Qf().process(t).finish().result}}Qf.NAME="sha256";var xs=l8;function l8(e,t){if(!e)throw Error(t||"Assertion failed")}l8.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)};var TS=Sn!==void 0?Sn:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ci(e,t){return e(t={exports:{}},t.exports),t.exports}function IS(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Is=Ci(function(e){e.exports=typeof Object.create=="function"?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}),CS=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var s=e.charCodeAt(n),i=s>>8,o=255&s;i?r.push(i,o):r.push(o)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},RS=function(e){for(var t="",r=0;r<e.length;r++)t+=f8(e[r].toString(16));return t};function d8(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}var kS=function(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];t==="little"&&(s=d8(s)),r+=h8(s.toString(16))}return r};function f8(e){return e.length===1?"0"+e:e}function h8(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}var MS=function(e,t,r,n){var s=r-t;xs(s%4==0);for(var i=Array(s/4),o=0,a=t;o<i.length;o++,a+=4){var f;f=n==="big"?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],i[o]=f>>>0}return i},OS=function(e,t){for(var r=Array(4*e.length),n=0,s=0;n<e.length;n++,s+=4){var i=e[n];t==="big"?(r[s]=i>>>24,r[s+1]=i>>>16&255,r[s+2]=i>>>8&255,r[s+3]=255&i):(r[s+3]=i>>>24,r[s+2]=i>>>16&255,r[s+1]=i>>>8&255,r[s]=255&i)}return r},Dt={inherits:Is,toArray:CS,toHex:RS,htonl:d8,toHex32:kS,zero2:f8,zero8:h8,join32:MS,split32:OS,rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e<<t|e>>>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,r){return e+t+r>>>0},sum32_4:function(e,t,r,n){return e+t+r+n>>>0},sum32_5:function(e,t,r,n,s){return e+t+r+n+s>>>0},sum64:function(e,t,r,n){var s=e[t],i=n+e[t+1]>>>0,o=(i<n?1:0)+r+s;e[t]=o>>>0,e[t+1]=i},sum64_hi:function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},sum64_lo:function(e,t,r,n){return t+n>>>0},sum64_4_hi:function(e,t,r,n,s,i,o,a){var f=0,c=t;return f+=(c=c+n>>>0)<t?1:0,f+=(c=c+i>>>0)<i?1:0,e+r+s+o+(f+=(c=c+a>>>0)<a?1:0)>>>0},sum64_4_lo:function(e,t,r,n,s,i,o,a){return t+n+i+a>>>0},sum64_5_hi:function(e,t,r,n,s,i,o,a,f,c){var l=0,u=t;return l+=(u=u+n>>>0)<t?1:0,l+=(u=u+i>>>0)<i?1:0,l+=(u=u+a>>>0)<a?1:0,e+r+s+o+f+(l+=(u=u+c>>>0)<c?1:0)>>>0},sum64_5_lo:function(e,t,r,n,s,i,o,a,f,c){return t+n+i+a+c>>>0},rotr64_hi:function(e,t,r){return(t<<32-r|e>>>r)>>>0},rotr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0},shr64_hi:function(e,t,r){return e>>>r},shr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0}};function $d(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var NS=$d;$d.prototype.update=function(e,t){if(e=Dt.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Dt.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},$d.prototype.digest=function(e){return this.update(this._pad()),xs(this.pending===null),this._digest(e)},$d.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=Array(r+this.padLength);n[0]=128;for(var s=1;s<r;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var i=8;i<this.padLength;i++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=255&e}else for(n[s++]=255&e,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i<this.padLength;i++)n[s++]=0;return n};var Tl={BlockHash:NS},ri=Dt.rotr32,DS=function(e,t,r,n){return e===0?p8(t,r,n):e===1||e===3?g8(t,r,n):e===2?y8(t,r,n):void 0};function p8(e,t,r){return e&t^~e&r}function y8(e,t,r){return e&t^e&r^t&r}function g8(e,t,r){return e^t^r}var Aa={ft_1:DS,ch32:p8,maj32:y8,p32:g8,s0_256:function(e){return ri(e,2)^ri(e,13)^ri(e,22)},s1_256:function(e){return ri(e,6)^ri(e,11)^ri(e,25)},g0_256:function(e){return ri(e,7)^ri(e,18)^e>>>3},g1_256:function(e){return ri(e,17)^ri(e,19)^e>>>10}},Ln=Dt.sum32,xS=Dt.sum32_4,US=Dt.sum32_5,BS=Aa.ch32,LS=Aa.maj32,KS=Aa.s0_256,jS=Aa.s1_256,qS=Aa.g0_256,$S=Aa.g1_256,m8=Tl.BlockHash,VS=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function ci(){if(!(this instanceof ci))return new ci;m8.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=VS,this.W=Array(64)}Dt.inherits(ci,m8);var Wy=ci;function $i(){if(!(this instanceof $i))return new $i;Wy.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}ci.blockSize=512,ci.outSize=256,ci.hmacStrength=192,ci.padLength=64,ci.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=xS($S(r[n-2]),r[n-7],qS(r[n-15]),r[n-16]);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],f=this.h[4],c=this.h[5],l=this.h[6],u=this.h[7];for(xs(this.k.length===r.length),n=0;n<r.length;n++){var p=US(u,jS(f),BS(f,c,l),this.k[n],r[n]),d=Ln(KS(s),LS(s,i,o));u=l,l=c,c=f,f=Ln(a,p),a=o,o=i,i=s,s=Ln(p,d)}this.h[0]=Ln(this.h[0],s),this.h[1]=Ln(this.h[1],i),this.h[2]=Ln(this.h[2],o),this.h[3]=Ln(this.h[3],a),this.h[4]=Ln(this.h[4],f),this.h[5]=Ln(this.h[5],c),this.h[6]=Ln(this.h[6],l),this.h[7]=Ln(this.h[7],u)},ci.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")},Dt.inherits($i,Wy);var v8=$i;$i.blockSize=512,$i.outSize=224,$i.hmacStrength=192,$i.padLength=64,$i.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h.slice(0,7),"big"):Dt.split32(this.h.slice(0,7),"big")};var mi=Dt.rotr64_hi,vi=Dt.rotr64_lo,b8=Dt.shr64_hi,_8=Dt.shr64_lo,is=Dt.sum64,Fh=Dt.sum64_hi,Hh=Dt.sum64_lo,FS=Dt.sum64_4_hi,HS=Dt.sum64_4_lo,GS=Dt.sum64_5_hi,zS=Dt.sum64_5_lo,w8=Tl.BlockHash,WS=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Gn(){if(!(this instanceof Gn))return new Gn;w8.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=WS,this.W=Array(160)}Dt.inherits(Gn,w8);var ao=Gn;function YS(e,t,r,n,s){var i=e&r^~e&s;return i<0&&(i+=4294967296),i}function JS(e,t,r,n,s,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function ZS(e,t,r,n,s){var i=e&r^e&s^r&s;return i<0&&(i+=4294967296),i}function XS(e,t,r,n,s,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function QS(e,t){var r=mi(e,t,28)^mi(t,e,2)^mi(t,e,7);return r<0&&(r+=4294967296),r}function eP(e,t){var r=vi(e,t,28)^vi(t,e,2)^vi(t,e,7);return r<0&&(r+=4294967296),r}function tP(e,t){var r=mi(e,t,14)^mi(e,t,18)^mi(t,e,9);return r<0&&(r+=4294967296),r}function rP(e,t){var r=vi(e,t,14)^vi(e,t,18)^vi(t,e,9);return r<0&&(r+=4294967296),r}function nP(e,t){var r=mi(e,t,1)^mi(e,t,8)^b8(e,t,7);return r<0&&(r+=4294967296),r}function iP(e,t){var r=vi(e,t,1)^vi(e,t,8)^_8(e,t,7);return r<0&&(r+=4294967296),r}function sP(e,t){var r=mi(e,t,19)^mi(t,e,29)^b8(e,t,6);return r<0&&(r+=4294967296),r}function aP(e,t){var r=vi(e,t,19)^vi(t,e,29)^_8(e,t,6);return r<0&&(r+=4294967296),r}function Vi(){if(!(this instanceof Vi))return new Vi;ao.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Gn.blockSize=1024,Gn.outSize=512,Gn.hmacStrength=192,Gn.padLength=128,Gn.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var s=sP(r[n-4],r[n-3]),i=aP(r[n-4],r[n-3]),o=r[n-14],a=r[n-13],f=nP(r[n-30],r[n-29]),c=iP(r[n-30],r[n-29]),l=r[n-32],u=r[n-31];r[n]=FS(s,i,o,a,f,c,l,u),r[n+1]=HS(s,i,o,a,f,c,l,u)}},Gn.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],s=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],f=this.h[5],c=this.h[6],l=this.h[7],u=this.h[8],p=this.h[9],d=this.h[10],h=this.h[11],y=this.h[12],g=this.h[13],m=this.h[14],b=this.h[15];xs(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var E=m,C=b,R=tP(u,p),M=rP(u,p),_=YS(u,p,d,h,y),A=JS(u,p,d,h,y,g),I=this.k[w],P=this.k[w+1],v=r[w],S=r[w+1],T=GS(E,C,R,M,_,A,I,P,v,S),N=zS(E,C,R,M,_,A,I,P,v,S);E=QS(n,s),C=eP(n,s),R=ZS(n,s,i,o,a),M=XS(n,s,i,o,a,f);var D=Fh(E,C,R,M),O=Hh(E,C,R,M);m=y,b=g,y=d,g=h,d=u,h=p,u=Fh(c,l,T,N),p=Hh(l,l,T,N),c=a,l=f,a=i,f=o,i=n,o=s,n=Fh(T,N,D,O),s=Hh(T,N,D,O)}is(this.h,0,n,s),is(this.h,2,i,o),is(this.h,4,a,f),is(this.h,6,c,l),is(this.h,8,u,p),is(this.h,10,d,h),is(this.h,12,y,g),is(this.h,14,m,b)},Gn.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")},Dt.inherits(Vi,ao);var E8=Vi;Vi.blockSize=1024,Vi.outSize=384,Vi.hmacStrength=192,Vi.padLength=128,Vi.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h.slice(0,12),"big"):Dt.split32(this.h.slice(0,12),"big")};var Zl=Dt.rotl32,kg=Dt.sum32,Co=Dt.sum32_3,Mg=Dt.sum32_4,A8=Tl.BlockHash;function ui(){if(!(this instanceof ui))return new ui;A8.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Dt.inherits(ui,A8);var S8=ui;function Og(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function oP(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function cP(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}ui.blockSize=512,ui.outSize=160,ui.hmacStrength=192,ui.padLength=64,ui.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],s=this.h[2],i=this.h[3],o=this.h[4],a=r,f=n,c=s,l=i,u=o,p=0;p<80;p++){var d=kg(Zl(Mg(r,Og(p,n,s,i),e[uP[p]+t],oP(p)),dP[p]),o);r=o,o=i,i=Zl(s,10),s=n,n=d,d=kg(Zl(Mg(a,Og(79-p,f,c,l),e[lP[p]+t],cP(p)),fP[p]),u),a=u,u=l,l=Zl(c,10),c=f,f=d}d=Co(this.h[1],s,l),this.h[1]=Co(this.h[2],i,u),this.h[2]=Co(this.h[3],o,a),this.h[3]=Co(this.h[4],r,f),this.h[4]=Co(this.h[0],n,c),this.h[0]=d},ui.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"little"):Dt.split32(this.h,"little")};var uP=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],lP=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],dP=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],fP=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],hP={ripemd160:S8};function Gh(e,t){let r=e[0],n=e[1],s=e[2],i=e[3];r=Gr(r,n,s,i,t[0],7,-680876936),i=Gr(i,r,n,s,t[1],12,-389564586),s=Gr(s,i,r,n,t[2],17,606105819),n=Gr(n,s,i,r,t[3],22,-1044525330),r=Gr(r,n,s,i,t[4],7,-176418897),i=Gr(i,r,n,s,t[5],12,1200080426),s=Gr(s,i,r,n,t[6],17,-1473231341),n=Gr(n,s,i,r,t[7],22,-45705983),r=Gr(r,n,s,i,t[8],7,1770035416),i=Gr(i,r,n,s,t[9],12,-1958414417),s=Gr(s,i,r,n,t[10],17,-42063),n=Gr(n,s,i,r,t[11],22,-1990404162),r=Gr(r,n,s,i,t[12],7,1804603682),i=Gr(i,r,n,s,t[13],12,-40341101),s=Gr(s,i,r,n,t[14],17,-1502002290),n=Gr(n,s,i,r,t[15],22,1236535329),r=zr(r,n,s,i,t[1],5,-165796510),i=zr(i,r,n,s,t[6],9,-1069501632),s=zr(s,i,r,n,t[11],14,643717713),n=zr(n,s,i,r,t[0],20,-373897302),r=zr(r,n,s,i,t[5],5,-701558691),i=zr(i,r,n,s,t[10],9,38016083),s=zr(s,i,r,n,t[15],14,-660478335),n=zr(n,s,i,r,t[4],20,-405537848),r=zr(r,n,s,i,t[9],5,568446438),i=zr(i,r,n,s,t[14],9,-1019803690),s=zr(s,i,r,n,t[3],14,-187363961),n=zr(n,s,i,r,t[8],20,1163531501),r=zr(r,n,s,i,t[13],5,-1444681467),i=zr(i,r,n,s,t[2],9,-51403784),s=zr(s,i,r,n,t[7],14,1735328473),n=zr(n,s,i,r,t[12],20,-1926607734),r=Wr(r,n,s,i,t[5],4,-378558),i=Wr(i,r,n,s,t[8],11,-2022574463),s=Wr(s,i,r,n,t[11],16,1839030562),n=Wr(n,s,i,r,t[14],23,-35309556),r=Wr(r,n,s,i,t[1],4,-1530992060),i=Wr(i,r,n,s,t[4],11,1272893353),s=Wr(s,i,r,n,t[7],16,-155497632),n=Wr(n,s,i,r,t[10],23,-1094730640),r=Wr(r,n,s,i,t[13],4,681279174),i=Wr(i,r,n,s,t[0],11,-358537222),s=Wr(s,i,r,n,t[3],16,-722521979),n=Wr(n,s,i,r,t[6],23,76029189),r=Wr(r,n,s,i,t[9],4,-640364487),i=Wr(i,r,n,s,t[12],11,-421815835),s=Wr(s,i,r,n,t[15],16,530742520),n=Wr(n,s,i,r,t[2],23,-995338651),r=Yr(r,n,s,i,t[0],6,-198630844),i=Yr(i,r,n,s,t[7],10,1126891415),s=Yr(s,i,r,n,t[14],15,-1416354905),n=Yr(n,s,i,r,t[5],21,-57434055),r=Yr(r,n,s,i,t[12],6,1700485571),i=Yr(i,r,n,s,t[3],10,-1894986606),s=Yr(s,i,r,n,t[10],15,-1051523),n=Yr(n,s,i,r,t[1],21,-2054922799),r=Yr(r,n,s,i,t[8],6,1873313359),i=Yr(i,r,n,s,t[15],10,-30611744),s=Yr(s,i,r,n,t[6],15,-1560198380),n=Yr(n,s,i,r,t[13],21,1309151649),r=Yr(r,n,s,i,t[4],6,-145523070),i=Yr(i,r,n,s,t[11],10,-1120210379),s=Yr(s,i,r,n,t[2],15,718787259),n=Yr(n,s,i,r,t[9],21,-343485551),e[0]=Es(r,e[0]),e[1]=Es(n,e[1]),e[2]=Es(s,e[2]),e[3]=Es(i,e[3])}function eh(e,t,r,n,s,i){return t=Es(Es(t,e),Es(n,i)),Es(t<<s|t>>>32-s,r)}function Gr(e,t,r,n,s,i,o){return eh(t&r|~t&n,e,t,s,i,o)}function zr(e,t,r,n,s,i,o){return eh(t&n|r&~n,e,t,s,i,o)}function Wr(e,t,r,n,s,i,o){return eh(t^r^n,e,t,s,i,o)}function Yr(e,t,r,n,s,i,o){return eh(r^(t|~n),e,t,s,i,o)}function pP(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const Ng="0123456789abcdef".split("");function yP(e){let t="",r=0;for(;r<4;r++)t+=Ng[e>>8*r+4&15]+Ng[e>>8*r&15];return t}function Es(e,t){return e+t&4294967295}const uf=X.getWebCrypto(),lf=X.getNodeCrypto(),gP=lf&&lf.getHashes();function js(e){if(lf&&gP.includes(e))return async function(t){const r=lf.createHash(e);return hr(t,n=>{r.update(n)},()=>new Uint8Array(r.digest()))}}function Xl(e,t){return async function(r,n=Xe){if(vr(r)&&(r=await mr(r)),!X.isStream(r)&&uf&&t&&r.length>=n.minBytesForWebCrypto)return new Uint8Array(await uf.digest(t,r));const s=e();return hr(r,i=>{s.update(i)},()=>new Uint8Array(s.digest()))}}function Dg(e,t){return async function(r,n=Xe){if(vr(r)&&(r=await mr(r)),X.isStream(r)){const s=new e;return hr(r,i=>{s.process(i)},()=>s.finish().result)}return uf&&t&&r.length>=n.minBytesForWebCrypto?new Uint8Array(await uf.digest(t,r)):e.bytes(r)}}const qs={md5:js("md5")||async function(e){const t=function(r){const n=r.length,s=[1732584193,-271733879,-1732584194,271733878];let i;for(i=64;i<=r.length;i+=64)Gh(s,pP(r.substring(i-64,i)));r=r.substring(i-64);const o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<r.length;i++)o[i>>2]|=r.charCodeAt(i)<<(i%4<<3);if(o[i>>2]|=128<<(i%4<<3),i>55)for(Gh(s,o),i=0;i<16;i++)o[i]=0;return o[14]=8*n,Gh(s,o),s}(X.uint8ArrayToString(e));return X.hexToUint8Array(function(r){for(let n=0;n<r.length;n++)r[n]=yP(r[n]);return r.join("")}(t))},sha1:js("sha1")||Dg(sa,"SHA-1"),sha224:js("sha224")||Xl(v8),sha256:js("sha256")||Dg(Qf,"SHA-256"),sha384:js("sha384")||Xl(E8,"SHA-384"),sha512:js("sha512")||Xl(ao,"SHA-512"),ripemd:js("ripemd160")||Xl(S8)};var Nn={md5:qs.md5,sha1:qs.sha1,sha224:qs.sha224,sha256:qs.sha256,sha384:qs.sha384,sha512:qs.sha512,ripemd:qs.ripemd,digest:function(e,t){switch(e){case j.hash.md5:return this.md5(t);case j.hash.sha1:return this.sha1(t);case j.hash.ripemd:return this.ripemd(t);case j.hash.sha256:return this.sha256(t);case j.hash.sha384:return this.sha384(t);case j.hash.sha512:return this.sha512(t);case j.hash.sha224:return this.sha224(t);default:throw Error("Invalid hash function.")}},getHashByteLength:function(e){switch(e){case j.hash.md5:return 16;case j.hash.sha1:case j.hash.ripemd:return 20;case j.hash.sha256:return 32;case j.hash.sha384:return 48;case j.hash.sha512:return 64;case j.hash.sha224:return 28;default:throw Error("Invalid hash algorithm.")}}};class Ja{static encrypt(t,r,n){return new Ja(r,n).encrypt(t)}static decrypt(t,r,n){return new Ja(r,n).decrypt(t)}constructor(t,r,n){this.aes=n||new Sl(t,r,!0,"CFB"),delete this.aes.padding}encrypt(t){return Os(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Os(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function bi(e){const t=j.read(j.symmetric,e);return Pl[t]}const xg=X.getWebCrypto(),df=X.getNodeCrypto(),$s=df?df.getCiphers():[],Ql={idea:$s.includes("idea-cfb")?"idea-cfb":void 0,tripledes:$s.includes("des-ede3-cfb")?"des-ede3-cfb":void 0,cast5:$s.includes("cast5-cfb")?"cast5-cfb":void 0,blowfish:$s.includes("bf-cfb")?"bf-cfb":void 0,aes128:$s.includes("aes-128-cfb")?"aes-128-cfb":void 0,aes192:$s.includes("aes-192-cfb")?"aes-192-cfb":void 0,aes256:$s.includes("aes-256-cfb")?"aes-256-cfb":void 0};var mP=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n,s){const i=j.read(j.symmetric,e);if(X.getNodeCrypto()&&Ql[i])return function(u,p,d,h){const y=j.read(j.symmetric,u),g=new df.createCipheriv(Ql[y],p,h);return hr(d,m=>new Uint8Array(g.update(m)))}(e,t,r,n);if(X.isAES(e))return function(u,p,d,h,y){if(X.getWebCrypto()&&p.length!==24&&!X.isStream(d)&&d.length>=3e3*y.minBytesForWebCrypto)return async function(m,b,w,E){const C="AES-CBC",R=await xg.importKey("raw",b,{name:C},!1,["encrypt"]),{blockSize:M}=bi(m),_=X.concatUint8Array([new Uint8Array(M),w]),A=new Uint8Array(await xg.encrypt({name:C,iv:E},R,_)).subarray(0,w.length);return function(I,P){for(let v=0;v<I.length;v++)I[v]=I[v]^P[v]}(A,w),A}(u,p,d,h);const g=new Ja(p,h);return hr(d,m=>g.aes.AES_Encrypt_process(m),()=>g.aes.AES_Encrypt_finish())}(e,t,r,n,s);const o=new(bi(e))(t),a=o.blockSize,f=n.slice();let c=new Uint8Array;const l=u=>{u&&(c=X.concatUint8Array([c,u]));const p=new Uint8Array(c.length);let d,h=0;for(;u?c.length>=a:c.length;){const y=o.encrypt(f);for(d=0;d<a;d++)f[d]=c[d]^y[d],p[h++]=f[d];c=c.subarray(a)}return p.subarray(0,h)};return hr(r,l,l)},decrypt:async function(e,t,r,n){const s=j.read(j.symmetric,e);if(X.getNodeCrypto()&&Ql[s])return function(l,u,p,d){const h=j.read(j.symmetric,l),y=new df.createDecipheriv(Ql[h],u,d);return hr(p,g=>new Uint8Array(y.update(g)))}(e,t,r,n);if(X.isAES(e))return function(l,u,p,d){if(X.isStream(p)){const h=new Ja(u,d);return hr(p,y=>h.aes.AES_Decrypt_process(y),()=>h.aes.AES_Decrypt_finish())}return Ja.decrypt(p,u,d)}(0,t,r,n);const i=new(bi(e))(t),o=i.blockSize;let a=n,f=new Uint8Array;const c=l=>{l&&(f=X.concatUint8Array([f,l]));const u=new Uint8Array(f.length);let p,d=0;for(;l?f.length>=o:f.length;){const h=i.encrypt(a);for(a=f.subarray(0,o),p=0;p<o;p++)u[d++]=a[p]^h[p];f=f.subarray(o)}return u.subarray(0,d)};return hr(r,c,c)}});class ff{static encrypt(t,r,n){return new ff(r,n).encrypt(t)}static decrypt(t,r,n){return new ff(r,n).encrypt(t)}constructor(t,r,n){this.aes=n||new Sl(t,void 0,!1,"CTR"),delete this.aes.padding,this.AES_CTR_set_options(r)}encrypt(t){return Os(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Os(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}AES_CTR_set_options(t,r,n){let{asm:s}=this.aes.acquire_asm();if(n!==void 0){if(n<8||n>48)throw new Fi("illegal counter size");let i=Math.pow(2,n)-1;s.set_mask(0,0,i/4294967296|0,0|i)}else n=48,s.set_mask(0,0,65535,4294967295);if(t===void 0)throw Error("nonce is required");{let i=t.length;if(!i||i>16)throw new Fi("illegal nonce size");let o=new DataView(new ArrayBuffer(16));new Uint8Array(o.buffer).set(t),s.set_nonce(o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12))}if(r!==void 0){if(r<0||r>=Math.pow(2,n))throw new Fi("illegal counter value");s.set_counter(0,0,r/4294967296|0,0|r)}}}class hf{static encrypt(t,r,n=!0,s){return new hf(r,s,n).encrypt(t)}static decrypt(t,r,n=!0,s){return new hf(r,s,n).decrypt(t)}constructor(t,r,n=!0,s){this.aes=s||new Sl(t,r,n,"CBC")}encrypt(t){return Os(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return Os(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}const Ug=X.getWebCrypto(),vP=X.getNodeCrypto(),Ki=16;function Bg(e,t){const r=e.length-Ki;for(let n=0;n<Ki;n++)e[n+r]^=t[n];return e}const ed=new Uint8Array(Ki);async function bP(e){const t=await async function(s){return X.getWebCrypto()&&s.length!==24?(s=await Ug.importKey("raw",s,{name:"AES-CBC",length:8*s.length},!1,["encrypt"]),async function(i){const o=await Ug.encrypt({name:"AES-CBC",iv:ed,length:8*Ki},s,i);return new Uint8Array(o).subarray(0,o.byteLength-Ki)}):X.getNodeCrypto()?async function(i){const o=new vP.createCipheriv("aes-"+8*s.length+"-cbc",s,ed).update(i);return new Uint8Array(o)}:async function(i){return hf.encrypt(i,s,!1,ed)}}(e),r=X.double(await t(ed)),n=X.double(r);return async function(s){return(await t(function(i,o,a){if(i.length&&i.length%Ki==0)return Bg(i,o);const f=new Uint8Array(i.length+(Ki-i.length%Ki));return f.set(i),f[i.length]=128,Bg(f,a)}(s,r,n))).subarray(-Ki)}}const Lg=X.getWebCrypto(),_P=X.getNodeCrypto(),wP=X.getNodeBuffer(),Ji=16,EP=Ji,Ua=Ji,Kg=new Uint8Array(Ji),Xp=new Uint8Array(Ji);Xp[Ji-1]=1;const Qp=new Uint8Array(Ji);async function AP(e){const t=await bP(e);return function(r,n){return t(X.concatUint8Array([r,n]))}}async function SP(e){return X.getWebCrypto()&&e.length!==24?(e=await Lg.importKey("raw",e,{name:"AES-CTR",length:8*e.length},!1,["encrypt"]),async function(t,r){const n=await Lg.encrypt({name:"AES-CTR",counter:r,length:8*Ji},e,t);return new Uint8Array(n)}):X.getNodeCrypto()?async function(t,r){const n=new _P.createCipheriv("aes-"+8*e.length+"-ctr",e,r),s=wP.concat([n.update(t),n.final()]);return new Uint8Array(s)}:async function(t,r){return ff.encrypt(t,e,r)}}async function Du(e,t){if(e!==j.symmetric.aes128&&e!==j.symmetric.aes192&&e!==j.symmetric.aes256)throw Error("EAX mode supports only AES cipher");const[r,n]=await Promise.all([AP(t),SP(t)]);return{encrypt:async function(s,i,o){const[a,f]=await Promise.all([r(Kg,i),r(Xp,o)]),c=await n(s,a),l=await r(Qp,c);for(let u=0;u<Ua;u++)l[u]^=f[u]^a[u];return X.concatUint8Array([c,l])},decrypt:async function(s,i,o){if(s.length<Ua)throw Error("Invalid EAX ciphertext");const a=s.subarray(0,-Ua),f=s.subarray(-Ua),[c,l,u]=await Promise.all([r(Kg,i),r(Xp,o),r(Qp,a)]),p=u;for(let d=0;d<Ua;d++)p[d]^=l[d]^c[d];if(!X.equalsUint8Array(f,p))throw Error("Authentication tag mismatch");return await n(a,c)}}}Qp[Ji-1]=2,Du.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[8+n]^=t[n];return r},Du.blockLength=Ji,Du.ivLength=EP,Du.tagLength=Ua;const an=16,P8=15,cs=16;function jg(e){let t=0;for(let r=1;!(e&r);r<<=1)t++;return t}function fn(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r];return e}function td(e,t){return fn(e.slice(),t)}const zh=new Uint8Array(an),PP=new Uint8Array([1]);async function xu(e,t){let r,n,s,i=0;function o(a,f,c,l){const u=f.length/an|0;(function(R,M){const _=X.nbits(Math.max(R.length,M.length)/an|0)-1;for(let A=i+1;A<=_;A++)s[A]=X.double(s[A-1]);i=_})(f,l);const p=X.concatUint8Array([zh.subarray(0,P8-c.length),PP,c]),d=63&p[an-1];p[an-1]&=192;const h=r(p),y=X.concatUint8Array([h,td(h.subarray(0,8),h.subarray(1,9))]),g=X.shiftRight(y.subarray(0+(d>>3),17+(d>>3)),8-(7&d)).subarray(1),m=new Uint8Array(an),b=new Uint8Array(f.length+cs);let w,E=0;for(w=0;w<u;w++)fn(g,s[jg(w+1)]),b.set(fn(a(td(g,f)),g),E),fn(m,a===r?f:b.subarray(E)),f=f.subarray(an),E+=an;if(f.length){fn(g,s.x);const R=r(g);b.set(td(f,R),E);const M=new Uint8Array(an);M.set(a===r?f:b.subarray(E,-cs),0),M[f.length]=128,fn(m,M),E+=f.length}const C=fn(r(fn(fn(m,g),s.$)),function(R){if(!R.length)return zh;const M=R.length/an|0,_=new Uint8Array(an),A=new Uint8Array(an);for(let I=0;I<M;I++)fn(_,s[jg(I+1)]),fn(A,r(td(_,R))),R=R.subarray(an);if(R.length){fn(_,s.x);const I=new Uint8Array(an);I.set(R,0),I[R.length]=128,fn(I,_),fn(A,r(I))}return A}(l));return b.set(C,E),b}return function(a,f){const c=j.read(j.symmetric,a),l=new Pl[c](f);r=l.encrypt.bind(l),n=l.decrypt.bind(l);const u=r(zh),p=X.double(u);s=[],s[0]=X.double(p),s.x=u,s.$=p}(e,t),{encrypt:async function(a,f,c){return o(r,a,f,c)},decrypt:async function(a,f,c){if(a.length<cs)throw Error("Invalid OCB ciphertext");const l=a.subarray(-cs);a=a.subarray(0,-cs);const u=o(n,a,f,c);if(X.equalsUint8Array(l,u.subarray(-cs)))return u.subarray(0,-cs);throw Error("Authentication tag mismatch")}}}xu.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[7+n]^=t[n];return r},xu.blockLength=an,xu.ivLength=P8,xu.tagLength=cs;const Wh=68719476704;class aa{constructor(t,r,n,s=16,i){this.tagSize=s,this.gamma0=0,this.counter=1,this.aes=i||new Sl(t,void 0,!1,"CTR");let{asm:o,heap:a}=this.aes.acquire_asm();if(o.gcm_init(),this.tagSize<4||this.tagSize>16)throw new Fi("illegal tagSize value");const f=r.length||0,c=new Uint8Array(16);f!==12?(this._gcm_mac_process(r),a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=0,a[11]=f>>>29,a[12]=f>>>21&255,a[13]=f>>>13&255,a[14]=f>>>5&255,a[15]=f<<3&255,o.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),o.get_iv(Lt.HEAP_DATA),o.set_iv(0,0,0,0),c.set(a.subarray(0,16))):(c.set(r),c[15]=1);const l=new DataView(c.buffer);if(this.gamma0=l.getUint32(12),o.set_nonce(l.getUint32(0),l.getUint32(4),l.getUint32(8),0),o.set_mask(0,0,0,4294967295),n!==void 0){if(n.length>Wh)throw new Fi("illegal adata length");n.length?(this.adata=n,this._gcm_mac_process(n)):this.adata=void 0}else this.adata=void 0;if(this.counter<1||this.counter>4294967295)throw new RangeError("counter must be a positive 32-bit integer");o.set_counter(0,0,0,this.gamma0+this.counter|0)}static encrypt(t,r,n,s,i){return new aa(r,n,s,i).encrypt(t)}static decrypt(t,r,n,s,i){return new aa(r,n,s,i).decrypt(t)}encrypt(t){return this.AES_GCM_encrypt(t)}decrypt(t){return this.AES_GCM_decrypt(t)}AES_GCM_Encrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.aes.pos,f=this.aes.len,c=0,l=f+n&-16,u=0;if((o-1<<4)+f+n>Wh)throw new RangeError("counter overflow");const p=new Uint8Array(l);for(;n>0;)u=ia(i,a+f,t,r,n),f+=u,r+=u,n-=u,u=s.cipher(Lt.ENC.CTR,Lt.HEAP_DATA+a,f),u=s.mac(Lt.MAC.GCM,Lt.HEAP_DATA+a,u),u&&p.set(i.subarray(a,a+u),c),o+=u>>>4,c+=u,u<f?(a+=u,f-=u):(a=0,f=0);return this.counter=o,this.aes.pos=a,this.aes.len=f,p}AES_GCM_Encrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.counter,s=this.tagSize,i=this.adata,o=this.aes.pos,a=this.aes.len;const f=new Uint8Array(a+s);t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA+o,a+15&-16),a&&f.set(r.subarray(o,o+a));let c=a;for(;15&c;c++)r[o+c]=0;t.mac(Lt.MAC.GCM,Lt.HEAP_DATA+o,c);const l=i!==void 0?i.length:0,u=(n-1<<4)+a;return r[0]=0,r[1]=0,r[2]=0,r[3]=l>>>29,r[4]=l>>>21,r[5]=l>>>13&255,r[6]=l>>>5&255,r[7]=l<<3&255,r[8]=r[9]=r[10]=0,r[11]=u>>>29,r[12]=u>>>21&255,r[13]=u>>>13&255,r[14]=u>>>5&255,r[15]=u<<3&255,t.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),t.get_iv(Lt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA,16),f.set(r.subarray(0,s),a),this.counter=1,this.aes.pos=0,this.aes.len=0,f}AES_GCM_Decrypt_process(t){let r=0,n=t.length||0,{asm:s,heap:i}=this.aes.acquire_asm(),o=this.counter,a=this.tagSize,f=this.aes.pos,c=this.aes.len,l=0,u=c+n>a?c+n-a&-16:0,p=c+n-u,d=0;if((o-1<<4)+c+n>Wh)throw new RangeError("counter overflow");const h=new Uint8Array(u);for(;n>p;)d=ia(i,f+c,t,r,n-p),c+=d,r+=d,n-=d,d=s.mac(Lt.MAC.GCM,Lt.HEAP_DATA+f,d),d=s.cipher(Lt.DEC.CTR,Lt.HEAP_DATA+f,d),d&&h.set(i.subarray(f,f+d),l),o+=d>>>4,l+=d,f=0,c=0;return n>0&&(c+=ia(i,0,t,r,n)),this.counter=o,this.aes.pos=f,this.aes.len=c,h}AES_GCM_Decrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),n=this.tagSize,s=this.adata,i=this.counter,o=this.aes.pos,a=this.aes.len,f=a-n;if(a<n)throw new Jp("authentication tag not found");const c=new Uint8Array(f),l=new Uint8Array(r.subarray(o+f,o+a));let u=f;for(;15&u;u++)r[o+u]=0;t.mac(Lt.MAC.GCM,Lt.HEAP_DATA+o,u),t.cipher(Lt.DEC.CTR,Lt.HEAP_DATA+o,u),f&&c.set(r.subarray(o,o+f));const p=s!==void 0?s.length:0,d=(i-1<<4)+a-n;r[0]=0,r[1]=0,r[2]=0,r[3]=p>>>29,r[4]=p>>>21,r[5]=p>>>13&255,r[6]=p>>>5&255,r[7]=p<<3&255,r[8]=r[9]=r[10]=0,r[11]=d>>>29,r[12]=d>>>21&255,r[13]=d>>>13&255,r[14]=d>>>5&255,r[15]=d<<3&255,t.mac(Lt.MAC.GCM,Lt.HEAP_DATA,16),t.get_iv(Lt.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(Lt.ENC.CTR,Lt.HEAP_DATA,16);let h=0;for(let y=0;y<n;++y)h|=l[y]^r[y];if(h)throw new Zp("data integrity check failed");return this.counter=1,this.aes.pos=0,this.aes.len=0,c}AES_GCM_decrypt(t){const r=this.AES_GCM_Decrypt_process(t),n=this.AES_GCM_Decrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}AES_GCM_encrypt(t){const r=this.AES_GCM_Encrypt_process(t),n=this.AES_GCM_Encrypt_finish(),s=new Uint8Array(r.length+n.length);return r.length&&s.set(r),n.length&&s.set(n,r.length),s}_gcm_mac_process(t){let{asm:r,heap:n}=this.aes.acquire_asm(),s=0,i=t.length||0,o=0;for(;i>0;){for(o=ia(n,0,t,s,i),s+=o,i-=o;15&o;)n[o++]=0;r.mac(Lt.MAC.GCM,Lt.HEAP_DATA,o)}}}const Yh=X.getWebCrypto(),qg=X.getNodeCrypto(),$g=X.getNodeBuffer(),Ba=16,Jh="AES-GCM";async function qa(e,t){if(e!==j.symmetric.aes128&&e!==j.symmetric.aes192&&e!==j.symmetric.aes256)throw Error("GCM mode supports only AES cipher");if(X.getNodeCrypto())return{encrypt:async function(r,n,s=new Uint8Array){const i=new qg.createCipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s);const o=$g.concat([i.update(r),i.final(),i.getAuthTag()]);return new Uint8Array(o)},decrypt:async function(r,n,s=new Uint8Array){const i=new qg.createDecipheriv("aes-"+8*t.length+"-gcm",t,n);i.setAAD(s),i.setAuthTag(r.slice(r.length-Ba,r.length));const o=$g.concat([i.update(r.slice(0,r.length-Ba)),i.final()]);return new Uint8Array(o)}};if(X.getWebCrypto()&&t.length!==24){const r=await Yh.importKey("raw",t,{name:Jh},!1,["encrypt","decrypt"]);return{encrypt:async function(n,s,i=new Uint8Array){if(!n.length)return aa.encrypt(n,t,s,i);const o=await Yh.encrypt({name:Jh,iv:s,additionalData:i,tagLength:8*Ba},r,n);return new Uint8Array(o)},decrypt:async function(n,s,i=new Uint8Array){if(n.length===Ba)return aa.decrypt(n,t,s,i);const o=await Yh.decrypt({name:Jh,iv:s,additionalData:i,tagLength:8*Ba},r,n);return new Uint8Array(o)}}}return{encrypt:async function(r,n,s){return aa.encrypt(r,t,n,s)},decrypt:async function(r,n,s){return aa.decrypt(r,t,n,s)}}}qa.getNonce=function(e,t){const r=e.slice();for(let n=0;n<t.length;n++)r[4+n]^=t[n];return r},qa.blockLength=16,qa.ivLength=12,qa.tagLength=Ba;var T8={cfb:mP,gcm:qa,experimentalGCM:qa,eax:Du,ocb:xu},wr=Ci(function(e){(function(t){var r=function(H){var ae,V=new Float64Array(16);if(H)for(ae=0;ae<H.length;ae++)V[ae]=H[ae];return V},n=function(){throw Error("no PRNG")},s=new Uint8Array(32);s[0]=9;var i=r(),o=r([1]),a=r([56129,1]),f=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),c=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),u=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function d(H,ae,V,U){return function(te,ge,Pe,Te,z){var $,F=0;for($=0;$<z;$++)F|=te[ge+$]^Pe[Te+$];return(1&F-1>>>8)-1}(H,ae,V,U,32)}function h(H,ae){var V;for(V=0;V<16;V++)H[V]=0|ae[V]}function y(H){var ae,V,U=1;for(ae=0;ae<16;ae++)V=H[ae]+U+65535,U=Math.floor(V/65536),H[ae]=V-65536*U;H[0]+=U-1+37*(U-1)}function g(H,ae,V){for(var U,te=~(V-1),ge=0;ge<16;ge++)U=te&(H[ge]^ae[ge]),H[ge]^=U,ae[ge]^=U}function m(H,ae){var V,U,te,ge=r(),Pe=r();for(V=0;V<16;V++)Pe[V]=ae[V];for(y(Pe),y(Pe),y(Pe),U=0;U<2;U++){for(ge[0]=Pe[0]-65517,V=1;V<15;V++)ge[V]=Pe[V]-65535-(ge[V-1]>>16&1),ge[V-1]&=65535;ge[15]=Pe[15]-32767-(ge[14]>>16&1),te=ge[15]>>16&1,ge[14]&=65535,g(Pe,ge,1-te)}for(V=0;V<16;V++)H[2*V]=255&Pe[V],H[2*V+1]=Pe[V]>>8}function b(H,ae){var V=new Uint8Array(32),U=new Uint8Array(32);return m(V,H),m(U,ae),d(V,0,U,0)}function w(H){var ae=new Uint8Array(32);return m(ae,H),1&ae[0]}function E(H,ae){var V;for(V=0;V<16;V++)H[V]=ae[2*V]+(ae[2*V+1]<<8);H[15]&=32767}function C(H,ae,V){for(var U=0;U<16;U++)H[U]=ae[U]+V[U]}function R(H,ae,V){for(var U=0;U<16;U++)H[U]=ae[U]-V[U]}function M(H,ae,V){var U,te,ge=0,Pe=0,Te=0,z=0,$=0,F=0,Q=0,de=0,oe=0,ne=0,Fe=0,je=0,He=0,he=0,ce=0,pe=0,le=0,fe=0,ye=0,ee=0,Z=0,$e=0,Ve=0,Qe=0,dt=0,rt=0,ve=0,G=0,se=0,me=0,Se=0,Ae=V[0],ke=V[1],Ne=V[2],xe=V[3],Re=V[4],Me=V[5],et=V[6],we=V[7],Ce=V[8],Oe=V[9],Ue=V[10],qe=V[11],K=V[12],Y=V[13],J=V[14],x=V[15];ge+=(U=ae[0])*Ae,Pe+=U*ke,Te+=U*Ne,z+=U*xe,$+=U*Re,F+=U*Me,Q+=U*et,de+=U*we,oe+=U*Ce,ne+=U*Oe,Fe+=U*Ue,je+=U*qe,He+=U*K,he+=U*Y,ce+=U*J,pe+=U*x,Pe+=(U=ae[1])*Ae,Te+=U*ke,z+=U*Ne,$+=U*xe,F+=U*Re,Q+=U*Me,de+=U*et,oe+=U*we,ne+=U*Ce,Fe+=U*Oe,je+=U*Ue,He+=U*qe,he+=U*K,ce+=U*Y,pe+=U*J,le+=U*x,Te+=(U=ae[2])*Ae,z+=U*ke,$+=U*Ne,F+=U*xe,Q+=U*Re,de+=U*Me,oe+=U*et,ne+=U*we,Fe+=U*Ce,je+=U*Oe,He+=U*Ue,he+=U*qe,ce+=U*K,pe+=U*Y,le+=U*J,fe+=U*x,z+=(U=ae[3])*Ae,$+=U*ke,F+=U*Ne,Q+=U*xe,de+=U*Re,oe+=U*Me,ne+=U*et,Fe+=U*we,je+=U*Ce,He+=U*Oe,he+=U*Ue,ce+=U*qe,pe+=U*K,le+=U*Y,fe+=U*J,ye+=U*x,$+=(U=ae[4])*Ae,F+=U*ke,Q+=U*Ne,de+=U*xe,oe+=U*Re,ne+=U*Me,Fe+=U*et,je+=U*we,He+=U*Ce,he+=U*Oe,ce+=U*Ue,pe+=U*qe,le+=U*K,fe+=U*Y,ye+=U*J,ee+=U*x,F+=(U=ae[5])*Ae,Q+=U*ke,de+=U*Ne,oe+=U*xe,ne+=U*Re,Fe+=U*Me,je+=U*et,He+=U*we,he+=U*Ce,ce+=U*Oe,pe+=U*Ue,le+=U*qe,fe+=U*K,ye+=U*Y,ee+=U*J,Z+=U*x,Q+=(U=ae[6])*Ae,de+=U*ke,oe+=U*Ne,ne+=U*xe,Fe+=U*Re,je+=U*Me,He+=U*et,he+=U*we,ce+=U*Ce,pe+=U*Oe,le+=U*Ue,fe+=U*qe,ye+=U*K,ee+=U*Y,Z+=U*J,$e+=U*x,de+=(U=ae[7])*Ae,oe+=U*ke,ne+=U*Ne,Fe+=U*xe,je+=U*Re,He+=U*Me,he+=U*et,ce+=U*we,pe+=U*Ce,le+=U*Oe,fe+=U*Ue,ye+=U*qe,ee+=U*K,Z+=U*Y,$e+=U*J,Ve+=U*x,oe+=(U=ae[8])*Ae,ne+=U*ke,Fe+=U*Ne,je+=U*xe,He+=U*Re,he+=U*Me,ce+=U*et,pe+=U*we,le+=U*Ce,fe+=U*Oe,ye+=U*Ue,ee+=U*qe,Z+=U*K,$e+=U*Y,Ve+=U*J,Qe+=U*x,ne+=(U=ae[9])*Ae,Fe+=U*ke,je+=U*Ne,He+=U*xe,he+=U*Re,ce+=U*Me,pe+=U*et,le+=U*we,fe+=U*Ce,ye+=U*Oe,ee+=U*Ue,Z+=U*qe,$e+=U*K,Ve+=U*Y,Qe+=U*J,dt+=U*x,Fe+=(U=ae[10])*Ae,je+=U*ke,He+=U*Ne,he+=U*xe,ce+=U*Re,pe+=U*Me,le+=U*et,fe+=U*we,ye+=U*Ce,ee+=U*Oe,Z+=U*Ue,$e+=U*qe,Ve+=U*K,Qe+=U*Y,dt+=U*J,rt+=U*x,je+=(U=ae[11])*Ae,He+=U*ke,he+=U*Ne,ce+=U*xe,pe+=U*Re,le+=U*Me,fe+=U*et,ye+=U*we,ee+=U*Ce,Z+=U*Oe,$e+=U*Ue,Ve+=U*qe,Qe+=U*K,dt+=U*Y,rt+=U*J,ve+=U*x,He+=(U=ae[12])*Ae,he+=U*ke,ce+=U*Ne,pe+=U*xe,le+=U*Re,fe+=U*Me,ye+=U*et,ee+=U*we,Z+=U*Ce,$e+=U*Oe,Ve+=U*Ue,Qe+=U*qe,dt+=U*K,rt+=U*Y,ve+=U*J,G+=U*x,he+=(U=ae[13])*Ae,ce+=U*ke,pe+=U*Ne,le+=U*xe,fe+=U*Re,ye+=U*Me,ee+=U*et,Z+=U*we,$e+=U*Ce,Ve+=U*Oe,Qe+=U*Ue,dt+=U*qe,rt+=U*K,ve+=U*Y,G+=U*J,se+=U*x,ce+=(U=ae[14])*Ae,pe+=U*ke,le+=U*Ne,fe+=U*xe,ye+=U*Re,ee+=U*Me,Z+=U*et,$e+=U*we,Ve+=U*Ce,Qe+=U*Oe,dt+=U*Ue,rt+=U*qe,ve+=U*K,G+=U*Y,se+=U*J,me+=U*x,pe+=(U=ae[15])*Ae,Pe+=38*(fe+=U*Ne),Te+=38*(ye+=U*xe),z+=38*(ee+=U*Re),$+=38*(Z+=U*Me),F+=38*($e+=U*et),Q+=38*(Ve+=U*we),de+=38*(Qe+=U*Ce),oe+=38*(dt+=U*Oe),ne+=38*(rt+=U*Ue),Fe+=38*(ve+=U*qe),je+=38*(G+=U*K),He+=38*(se+=U*Y),he+=38*(me+=U*J),ce+=38*(Se+=U*x),ge=(U=(ge+=38*(le+=U*ke))+(te=1)+65535)-65536*(te=Math.floor(U/65536)),Pe=(U=Pe+te+65535)-65536*(te=Math.floor(U/65536)),Te=(U=Te+te+65535)-65536*(te=Math.floor(U/65536)),z=(U=z+te+65535)-65536*(te=Math.floor(U/65536)),$=(U=$+te+65535)-65536*(te=Math.floor(U/65536)),F=(U=F+te+65535)-65536*(te=Math.floor(U/65536)),Q=(U=Q+te+65535)-65536*(te=Math.floor(U/65536)),de=(U=de+te+65535)-65536*(te=Math.floor(U/65536)),oe=(U=oe+te+65535)-65536*(te=Math.floor(U/65536)),ne=(U=ne+te+65535)-65536*(te=Math.floor(U/65536)),Fe=(U=Fe+te+65535)-65536*(te=Math.floor(U/65536)),je=(U=je+te+65535)-65536*(te=Math.floor(U/65536)),He=(U=He+te+65535)-65536*(te=Math.floor(U/65536)),he=(U=he+te+65535)-65536*(te=Math.floor(U/65536)),ce=(U=ce+te+65535)-65536*(te=Math.floor(U/65536)),pe=(U=pe+te+65535)-65536*(te=Math.floor(U/65536)),ge=(U=(ge+=te-1+37*(te-1))+(te=1)+65535)-65536*(te=Math.floor(U/65536)),Pe=(U=Pe+te+65535)-65536*(te=Math.floor(U/65536)),Te=(U=Te+te+65535)-65536*(te=Math.floor(U/65536)),z=(U=z+te+65535)-65536*(te=Math.floor(U/65536)),$=(U=$+te+65535)-65536*(te=Math.floor(U/65536)),F=(U=F+te+65535)-65536*(te=Math.floor(U/65536)),Q=(U=Q+te+65535)-65536*(te=Math.floor(U/65536)),de=(U=de+te+65535)-65536*(te=Math.floor(U/65536)),oe=(U=oe+te+65535)-65536*(te=Math.floor(U/65536)),ne=(U=ne+te+65535)-65536*(te=Math.floor(U/65536)),Fe=(U=Fe+te+65535)-65536*(te=Math.floor(U/65536)),je=(U=je+te+65535)-65536*(te=Math.floor(U/65536)),He=(U=He+te+65535)-65536*(te=Math.floor(U/65536)),he=(U=he+te+65535)-65536*(te=Math.floor(U/65536)),ce=(U=ce+te+65535)-65536*(te=Math.floor(U/65536)),pe=(U=pe+te+65535)-65536*(te=Math.floor(U/65536)),ge+=te-1+37*(te-1),H[0]=ge,H[1]=Pe,H[2]=Te,H[3]=z,H[4]=$,H[5]=F,H[6]=Q,H[7]=de,H[8]=oe,H[9]=ne,H[10]=Fe,H[11]=je,H[12]=He,H[13]=he,H[14]=ce,H[15]=pe}function _(H,ae){M(H,ae,ae)}function A(H,ae){var V,U=r();for(V=0;V<16;V++)U[V]=ae[V];for(V=253;V>=0;V--)_(U,U),V!==2&&V!==4&&M(U,U,ae);for(V=0;V<16;V++)H[V]=U[V]}function I(H,ae,V){var U,te,ge=new Uint8Array(32),Pe=new Float64Array(80),Te=r(),z=r(),$=r(),F=r(),Q=r(),de=r();for(te=0;te<31;te++)ge[te]=ae[te];for(ge[31]=127&ae[31]|64,ge[0]&=248,E(Pe,V),te=0;te<16;te++)z[te]=Pe[te],F[te]=Te[te]=$[te]=0;for(Te[0]=F[0]=1,te=254;te>=0;--te)g(Te,z,U=ge[te>>>3]>>>(7&te)&1),g($,F,U),C(Q,Te,$),R(Te,Te,$),C($,z,F),R(z,z,F),_(F,Q),_(de,Te),M(Te,$,Te),M($,z,Q),C(Q,Te,$),R(Te,Te,$),_(z,Te),R($,F,de),M(Te,$,a),C(Te,Te,F),M($,$,Te),M(Te,F,de),M(F,z,Pe),_(z,Q),g(Te,z,U),g($,F,U);for(te=0;te<16;te++)Pe[te+16]=Te[te],Pe[te+32]=$[te],Pe[te+48]=z[te],Pe[te+64]=F[te];var oe=Pe.subarray(32),ne=Pe.subarray(16);return A(oe,oe),M(ne,ne,oe),m(H,ne),0}function P(H,ae){return I(H,ae,s)}function v(H,ae){var V=r(),U=r(),te=r(),ge=r(),Pe=r(),Te=r(),z=r(),$=r(),F=r();R(V,H[1],H[0]),R(F,ae[1],ae[0]),M(V,V,F),C(U,H[0],H[1]),C(F,ae[0],ae[1]),M(U,U,F),M(te,H[3],ae[3]),M(te,te,c),M(ge,H[2],ae[2]),C(ge,ge,ge),R(Pe,U,V),R(Te,ge,te),C(z,ge,te),C($,U,V),M(H[0],Pe,Te),M(H[1],$,z),M(H[2],z,Te),M(H[3],Pe,$)}function S(H,ae,V){var U;for(U=0;U<4;U++)g(H[U],ae[U],V)}function T(H,ae){var V=r(),U=r(),te=r();A(te,ae[2]),M(V,ae[0],te),M(U,ae[1],te),m(H,U),H[31]^=w(V)<<7}function N(H,ae,V){var U,te;for(h(H[0],i),h(H[1],o),h(H[2],o),h(H[3],i),te=255;te>=0;--te)S(H,ae,U=V[te/8|0]>>(7&te)&1),v(ae,H),v(H,H),S(H,ae,U)}function D(H,ae){var V=[r(),r(),r(),r()];h(V[0],l),h(V[1],u),h(V[2],o),M(V[3],l,u),N(H,V,ae)}function O(H,ae,V){var U,te,ge=[r(),r(),r(),r()];for(V||n(ae,32),(U=t.hash(ae.subarray(0,32)))[0]&=248,U[31]&=127,U[31]|=64,D(ge,U),T(H,ge),te=0;te<32;te++)ae[te+32]=H[te];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function B(H,ae){var V,U,te,ge;for(U=63;U>=32;--U){for(V=0,te=U-32,ge=U-12;te<ge;++te)ae[te]+=V-16*ae[U]*L[te-(U-32)],V=Math.floor((ae[te]+128)/256),ae[te]-=256*V;ae[te]+=V,ae[U]=0}for(V=0,te=0;te<32;te++)ae[te]+=V-(ae[31]>>4)*L[te],V=ae[te]>>8,ae[te]&=255;for(te=0;te<32;te++)ae[te]-=V*L[te];for(U=0;U<32;U++)ae[U+1]+=ae[U]>>8,H[U]=255&ae[U]}function k(H){var ae,V=new Float64Array(64);for(ae=0;ae<64;ae++)V[ae]=H[ae];for(ae=0;ae<64;ae++)H[ae]=0;B(H,V)}function q(H,ae){var V=r(),U=r(),te=r(),ge=r(),Pe=r(),Te=r(),z=r();return h(H[2],o),E(H[1],ae),_(te,H[1]),M(ge,te,f),R(te,te,H[2]),C(ge,H[2],ge),_(Pe,ge),_(Te,Pe),M(z,Te,Pe),M(V,z,te),M(V,V,ge),function($,F){var Q,de=r();for(Q=0;Q<16;Q++)de[Q]=F[Q];for(Q=250;Q>=0;Q--)_(de,de),Q!==1&&M(de,de,F);for(Q=0;Q<16;Q++)$[Q]=de[Q]}(V,V),M(V,V,te),M(V,V,ge),M(V,V,ge),M(H[0],V,ge),_(U,H[0]),M(U,U,ge),b(U,te)&&M(H[0],H[0],p),_(U,H[0]),M(U,U,ge),b(U,te)?-1:(w(H[0])===ae[31]>>7&&R(H[0],i,H[0]),M(H[3],H[0],H[1]),0)}var W=64;function re(){for(var H=0;H<arguments.length;H++)if(!(arguments[H]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ue(H){for(var ae=0;ae<H.length;ae++)H[ae]=0}t.scalarMult=function(H,ae){if(re(H,ae),H.length!==32)throw Error("bad n size");if(ae.length!==32)throw Error("bad p size");var V=new Uint8Array(32);return I(V,H,ae),V},t.box={},t.box.keyPair=function(){var H,ae,V=new Uint8Array(32),U=new Uint8Array(32);return H=V,n(ae=U,32),P(H,ae),{publicKey:V,secretKey:U}},t.box.keyPair.fromSecretKey=function(H){if(re(H),H.length!==32)throw Error("bad secret key size");var ae=new Uint8Array(32);return P(ae,H),{publicKey:ae,secretKey:new Uint8Array(H)}},t.sign=function(H,ae){if(re(H,ae),ae.length!==64)throw Error("bad secret key size");var V=new Uint8Array(W+H.length);return function(U,te,ge,Pe){var Te,z,$,F,Q,de=new Float64Array(64),oe=[r(),r(),r(),r()];(Te=t.hash(Pe.subarray(0,32)))[0]&=248,Te[31]&=127,Te[31]|=64;var ne=ge+64;for(F=0;F<ge;F++)U[64+F]=te[F];for(F=0;F<32;F++)U[32+F]=Te[32+F];for(k($=t.hash(U.subarray(32,ne))),D(oe,$),T(U,oe),F=32;F<64;F++)U[F]=Pe[F];for(k(z=t.hash(U.subarray(0,ne))),F=0;F<64;F++)de[F]=0;for(F=0;F<32;F++)de[F]=$[F];for(F=0;F<32;F++)for(Q=0;Q<32;Q++)de[F+Q]+=z[F]*Te[Q];B(U.subarray(32),de)}(V,H,H.length,ae),V},t.sign.detached=function(H,ae){for(var V=t.sign(H,ae),U=new Uint8Array(W),te=0;te<U.length;te++)U[te]=V[te];return U},t.sign.detached.verify=function(H,ae,V){if(re(H,ae,V),ae.length!==W)throw Error("bad signature size");if(V.length!==32)throw Error("bad public key size");var U,te=new Uint8Array(W+H.length),ge=new Uint8Array(W+H.length);for(U=0;U<W;U++)te[U]=ae[U];for(U=0;U<H.length;U++)te[U+W]=H[U];return function(Pe,Te,z,$){var F,Q,de=new Uint8Array(32),oe=[r(),r(),r(),r()],ne=[r(),r(),r(),r()];if(z<64||q(ne,$))return-1;for(F=0;F<z;F++)Pe[F]=Te[F];for(F=0;F<32;F++)Pe[F+32]=$[F];if(k(Q=t.hash(Pe.subarray(0,z))),N(oe,ne,Q),D(ne,Te.subarray(32)),v(oe,ne),T(de,oe),z-=64,d(Te,0,de,0)){for(F=0;F<z;F++)Pe[F]=0;return-1}for(F=0;F<z;F++)Pe[F]=Te[F+64];return z}(ge,te,te.length,V)>=0},t.sign.keyPair=function(){var H=new Uint8Array(32),ae=new Uint8Array(64);return O(H,ae),{publicKey:H,secretKey:ae}},t.sign.keyPair.fromSecretKey=function(H){if(re(H),H.length!==64)throw Error("bad secret key size");for(var ae=new Uint8Array(32),V=0;V<ae.length;V++)ae[V]=H[32+V];return{publicKey:ae,secretKey:new Uint8Array(H)}},t.sign.keyPair.fromSeed=function(H){if(re(H),H.length!==32)throw Error("bad seed size");for(var ae=new Uint8Array(32),V=new Uint8Array(64),U=0;U<32;U++)V[U]=H[U];return O(ae,V,!0),{publicKey:ae,secretKey:V}},t.setPRNG=function(H){n=H},function(){var H=typeof self<"u"?self.crypto||self.msCrypto:null;H&&H.getRandomValues?t.setPRNG(function(ae,V){var U,te=new Uint8Array(V);for(U=0;U<V;U+=65536)H.getRandomValues(te.subarray(U,U+Math.min(V-U,65536)));for(U=0;U<V;U++)ae[U]=te[U];ue(te)}):IS!==void 0&&(H=void 0)&&H.randomBytes&&t.setPRNG(function(ae,V){var U,te=H.randomBytes(V);for(U=0;U<V;U++)ae[U]=te[U];ue(te)})}()})(e.exports?e.exports:self.nacl=self.nacl||{})});const Vg=X.getNodeCrypto();function Pn(e){const t=new Uint8Array(e);if(Vg){const r=Vg.randomBytes(t.length);t.set(r)}else{if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("No secure random number generator available.");crypto.getRandomValues(t)}return t}async function Zi(e,t){const r=await X.getBigInteger();if(t.lt(e))throw Error("Illegal parameter value: max <= min");const n=t.sub(e),s=n.byteLength();return new r(await Pn(s+8)).mod(n).add(e)}var TP=Object.freeze({__proto__:null,getRandomBytes:Pn,getRandomBigInteger:Zi});async function Fg(e,t,r){const n=await X.getBigInteger(),s=new n(1),i=s.leftShift(new n(e-1)),o=new n(30),a=[1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2],f=await Zi(i,i.leftShift(s));let c=f.mod(o).toNumber();do f.iadd(new n(a[c])),c=(c+a[c])%a.length,f.bitLength()>e&&(f.imod(i.leftShift(s)).iadd(i),c=f.mod(o).toNumber());while(!await I8(f,t,r));return f}async function I8(e,t,r){return!(t&&!e.dec().gcd(t).isOne())&&!!await async function(n){const s=await X.getBigInteger();return IP.every(i=>n.mod(new s(i))!==0)}(e)&&!!await async function(n,s){const i=await X.getBigInteger();return s=s||new i(2),s.modExp(n.dec(),n).isOne()}(e)&&!!await async function(n,s,i){const o=await X.getBigInteger(),a=n.bitLength();s||(s=Math.max(1,a/48|0));const f=n.dec();let c=0;for(;!f.getBit(c);)c++;const l=n.rightShift(new o(c));for(;s>0;s--){let u,p=(i?i():await Zi(new o(2),f)).modExp(l,n);if(!p.isOne()&&!p.equal(f)){for(u=1;u<c;u++){if(p=p.mul(p).mod(n),p.isOne())return!1;if(p.equal(f))break}if(u===c)return!1}}return!0}(e,r)}const IP=[7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999],oi=[];function Yy(e,t){const r=e.length;if(r>t-11)throw Error("Message too long");const n=function(i){const o=new Uint8Array(i);let a=0;for(;a<i;){const f=Pn(i-a);for(let c=0;c<f.length;c++)f[c]!==0&&(o[a++]=f[c])}return o}(t-r-3),s=new Uint8Array(t);return s[1]=2,s.set(n,2),s.set(e,t-r),s}function Jy(e,t){let r=2,n=1;for(let a=r;a<e.length;a++)n&=e[a]!==0,r+=n;const s=r-2,i=e.subarray(r+1),o=e[0]===0&e[1]===2&s>=8&!n;if(t)return X.selectUint8Array(o,i,t);if(o)return i;throw Error("Decryption error")}async function ey(e,t,r){let n;if(t.length!==Nn.getHashByteLength(e))throw Error("Invalid hash length");const s=new Uint8Array(oi[e].length);for(n=0;n<oi[e].length;n++)s[n]=oi[e][n];const i=s.length+t.length;if(r<i+11)throw Error("Intended encoded message length too short");const o=new Uint8Array(r-i-3).fill(255),a=new Uint8Array(r);return a[1]=1,a.set(o,2),a.set(s,r-i),a.set(t,r-t.length),a}oi[1]=[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],oi[2]=[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],oi[3]=[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20],oi[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32],oi[9]=[48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48],oi[10]=[48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64],oi[11]=[48,45,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28];var CP=Object.freeze({__proto__:null,emeEncode:Yy,emeDecode:Jy,emsaEncode:ey});const Ca=X.getWebCrypto(),Zr=X.getNodeCrypto(),C8=void 0,Ra=Zr?C8.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}):void 0,rd=Zr?C8.define("RSAPubliceKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}):void 0;var RP=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i,o,a,f){if(t&&!X.isStream(t)){if(X.getWebCrypto())try{return await async function(c,l,u,p,d,h,y,g){const m=await async function(E,C,R,M,_,A){const I=await X.getBigInteger(),P=new I(M),v=new I(_),S=new I(R);let T=S.mod(v.dec()),N=S.mod(P.dec());return N=N.toUint8Array(),T=T.toUint8Array(),{kty:"RSA",n:An(E,!0),e:An(C,!0),d:An(R,!0),p:An(_,!0),q:An(M,!0),dp:An(T,!0),dq:An(N,!0),qi:An(A,!0),ext:!0}}(u,p,d,h,y,g),b={name:"RSASSA-PKCS1-v1_5",hash:{name:c}},w=await Ca.importKey("jwk",m,b,!1,["sign"]);return new Uint8Array(await Ca.sign("RSASSA-PKCS1-v1_5",w,l))}(j.read(j.webHash,e),t,r,n,s,i,o,a)}catch(c){X.printDebugError(c)}else if(X.getNodeCrypto())return async function(c,l,u,p,d,h,y,g){const{default:m}=await Promise.resolve().then(function(){return $u}),b=new m(h),w=new m(y),E=new m(d),C=E.mod(w.subn(1)),R=E.mod(b.subn(1)),M=Zr.createSign(j.read(j.hash,c));M.write(l),M.end();const _={version:0,modulus:new m(u),publicExponent:new m(p),privateExponent:new m(d),prime1:new m(y),prime2:new m(h),exponent1:C,exponent2:R,coefficient:new m(g)};if(Zr.createPrivateKey!==void 0){const I=Ra.encode(_,"der");return new Uint8Array(M.sign({key:I,format:"der",type:"pkcs1"}))}const A=Ra.encode(_,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(M.sign(A))}(e,t,r,n,s,i,o,a)}return async function(c,l,u,p){const d=await X.getBigInteger();l=new d(l);const h=new d(await ey(c,p,l.byteLength()));if(u=new d(u),h.gte(l))throw Error("Message size cannot exceed modulus size");return h.modExp(u,l).toUint8Array("be",l.byteLength())}(e,r,s,f)},verify:async function(e,t,r,n,s,i){if(t&&!X.isStream(t)){if(X.getWebCrypto())try{return await async function(o,a,f,c,l){const u=function(d,h){return{kty:"RSA",n:An(d,!0),e:An(h,!0),ext:!0}}(c,l),p=await Ca.importKey("jwk",u,{name:"RSASSA-PKCS1-v1_5",hash:{name:o}},!1,["verify"]);return Ca.verify("RSASSA-PKCS1-v1_5",p,f,a)}(j.read(j.webHash,e),t,r,n,s)}catch(o){X.printDebugError(o)}else if(X.getNodeCrypto())return async function(o,a,f,c,l){const{default:u}=await Promise.resolve().then(function(){return $u}),p=Zr.createVerify(j.read(j.hash,o));p.write(a),p.end();const d={modulus:new u(c),publicExponent:new u(l)};let h;Zr.createPrivateKey!==void 0?h={key:rd.encode(d,"der"),format:"der",type:"pkcs1"}:h=rd.encode(d,"pem",{label:"RSA PUBLIC KEY"});try{return await p.verify(h,f)}catch{return!1}}(e,t,r,n,s)}return async function(o,a,f,c,l){const u=await X.getBigInteger();if(f=new u(f),a=new u(a),c=new u(c),a.gte(f))throw Error("Signature size cannot exceed modulus size");const p=a.modExp(c,f).toUint8Array("be",f.byteLength()),d=await ey(o,l,f.byteLength());return X.equalsUint8Array(p,d)}(e,r,n,s,i)},encrypt:async function(e,t,r){return X.getNodeCrypto()?async function(n,s,i){const{default:o}=await Promise.resolve().then(function(){return $u}),a={modulus:new o(s),publicExponent:new o(i)};let f;return Zr.createPrivateKey!==void 0?f={key:rd.encode(a,"der"),format:"der",type:"pkcs1",padding:Zr.constants.RSA_PKCS1_PADDING}:f={key:rd.encode(a,"pem",{label:"RSA PUBLIC KEY"}),padding:Zr.constants.RSA_PKCS1_PADDING},new Uint8Array(Zr.publicEncrypt(f,n))}(e,t,r):async function(n,s,i){const o=await X.getBigInteger();if(s=new o(s),n=new o(Yy(n,s.byteLength())),i=new o(i),n.gte(s))throw Error("Message size cannot exceed modulus size");return n.modExp(i,s).toUint8Array("be",s.byteLength())}(e,t,r)},decrypt:async function(e,t,r,n,s,i,o,a){if(X.getNodeCrypto()&&!a)try{return await async function(f,c,l,u,p,d,h){const{default:y}=await Promise.resolve().then(function(){return $u}),g=new y(p),m=new y(d),b=new y(u),w=b.mod(m.subn(1)),E=b.mod(g.subn(1)),C={version:0,modulus:new y(c),publicExponent:new y(l),privateExponent:new y(u),prime1:new y(d),prime2:new y(p),exponent1:w,exponent2:E,coefficient:new y(h)};let R;Zr.createPrivateKey!==void 0?R={key:Ra.encode(C,"der"),format:"der",type:"pkcs1",padding:Zr.constants.RSA_PKCS1_PADDING}:R={key:Ra.encode(C,"pem",{label:"RSA PRIVATE KEY"}),padding:Zr.constants.RSA_PKCS1_PADDING};try{return new Uint8Array(Zr.privateDecrypt(R,f))}catch{throw Error("Decryption error")}}(e,t,r,n,s,i,o)}catch(f){X.printDebugError(f)}return async function(f,c,l,u,p,d,h,y){const g=await X.getBigInteger();if(f=new g(f),c=new g(c),l=new g(l),u=new g(u),p=new g(p),d=new g(d),h=new g(h),f.gte(c))throw Error("Data too large.");const m=u.mod(d.dec()),b=u.mod(p.dec()),w=(await Zi(new g(2),c)).mod(c),E=w.modInv(c).modExp(l,c);f=f.mul(E).mod(c);const C=f.modExp(b,p),R=f.modExp(m,d);let _=h.mul(R.sub(C)).mod(d).mul(p).add(C);return _=_.mul(w).mod(c),Jy(_.toUint8Array("be",c.byteLength()),y)}(e,t,r,n,s,i,o,a)},generate:async function(e,t){if(t=new(await X.getBigInteger())(t),X.getWebCrypto()){const o={name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:t.toUint8Array(),hash:{name:"SHA-1"}},a=await Ca.generateKey(o,!0,["sign","verify"]),f=await Ca.exportKey("jwk",a.privateKey);return{n:qi(f.n),e:t.toUint8Array(),d:qi(f.d),p:qi(f.q),q:qi(f.p),u:qi(f.qi)}}if(X.getNodeCrypto()&&Zr.generateKeyPair&&Ra){const o={modulusLength:e,publicExponent:t.toNumber(),publicKeyEncoding:{type:"pkcs1",format:"der"},privateKeyEncoding:{type:"pkcs1",format:"der"}},a=await new Promise((f,c)=>{Zr.generateKeyPair("rsa",o,(l,u,p)=>{l?c(l):f(Ra.decode(p,"der"))})});return{n:a.modulus.toArrayLike(Uint8Array),e:a.publicExponent.toArrayLike(Uint8Array),d:a.privateExponent.toArrayLike(Uint8Array),p:a.prime2.toArrayLike(Uint8Array),q:a.prime1.toArrayLike(Uint8Array),u:a.coefficient.toArrayLike(Uint8Array)}}let r,n,s;do n=await Fg(e-(e>>1),t,40),r=await Fg(e>>1,t,40),s=r.mul(n);while(s.bitLength()!==e);const i=r.dec().imul(n.dec());return n.lt(r)&&([r,n]=[n,r]),{n:s.toUint8Array(),e:t.toUint8Array(),d:t.modInv(i).toUint8Array(),p:r.toUint8Array(),q:n.toUint8Array(),u:r.modInv(n).toUint8Array()}},validateParams:async function(e,t,r,n,s,i){const o=await X.getBigInteger();if(e=new o(e),n=new o(n),s=new o(s),!n.mul(s).equal(e))return!1;const a=new o(2);if(i=new o(i),!n.mul(i).mod(s).isOne())return!1;t=new o(t),r=new o(r);const f=new o(Math.floor(e.bitLength()/3)),c=await Zi(a,a.leftShift(f)),l=c.mul(r).mul(t);return!(!l.mod(n.dec()).equal(c)||!l.mod(s.dec()).equal(c))}}),kP=Object.freeze({__proto__:null,encrypt:async function(e,t,r,n){const s=await X.getBigInteger();t=new s(t),r=new s(r),n=new s(n);const i=new s(Yy(e,t.byteLength())),o=await Zi(new s(1),t.dec());return{c1:r.modExp(o,t).toUint8Array(),c2:n.modExp(o,t).imul(i).imod(t).toUint8Array()}},decrypt:async function(e,t,r,n,s){const i=await X.getBigInteger();return e=new i(e),t=new i(t),r=new i(r),n=new i(n),Jy(e.modExp(n,r).modInv(r).imul(t).imod(r).toUint8Array("be",r.byteLength()),s)},validateParams:async function(e,t,r,n){const s=await X.getBigInteger();e=new s(e),t=new s(t),r=new s(r);const i=new s(1);if(t.lte(i)||t.gte(e))return!1;const o=new s(e.bitLength()),a=new s(1023);if(o.lt(a)||!t.modExp(e.dec(),e).isOne())return!1;let f=t;const c=new s(1),l=new s(2).leftShift(new s(17));for(;c.lt(l);){if(f=f.mul(t).imod(e),f.isOne())return!1;c.iinc()}n=new s(n);const u=new s(2),p=await Zi(u.leftShift(o.dec()),u.leftShift(o)),d=e.dec().imul(p).iadd(n);return!!r.equal(t.modExp(d,e))}});class li{constructor(t){if(t instanceof li)this.oid=t.oid;else if(X.isArray(t)||X.isUint8Array(t)){if((t=new Uint8Array(t))[0]===6){if(t[1]!==t.length-2)throw Error("Length mismatch in DER encoded oid");t=t.subarray(2)}this.oid=t}else this.oid=""}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.oid=t.subarray(1,1+r),1+this.oid.length}throw Error("Invalid oid")}write(){return X.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])}toHex(){return X.uint8ArrayToHex(this.oid)}getName(){const t=this.toHex();if(j.curve[t])return j.write(j.curve,t);throw Error("Unknown curve object identifier.")}}function th(e,t){return e.keyPair({priv:t})}function rh(e,t){const r=e.keyPair({pub:t});if(r.validate().result!==!0)throw Error("Invalid elliptic public key");return r}async function oo(e){if(!Xe.useIndutnyElliptic)throw Error("This curve is only supported in the full build of OpenPGP.js");const{default:t}=await Promise.resolve().then(function(){return yC});return new t.ec(e)}function R8(e){let t,r=0;const n=e[0];return n<192?([r]=e,t=1):n<255?(r=(e[0]-192<<8)+e[1]+192,t=2):n===255&&(r=X.readNumber(e.subarray(1,5)),t=5),{len:r,offset:t}}function Il(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):X.concatUint8Array([new Uint8Array([255]),X.writeNumber(e,4)])}function MP(e){if(e<0||e>30)throw Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])}function k8(e){return new Uint8Array([192|e])}function Hg(e,t){return X.concatUint8Array([k8(e),Il(t)])}function Vd(e){return[j.packet.literalData,j.packet.compressedData,j.packet.symmetricallyEncryptedData,j.packet.symEncryptedIntegrityProtectedData,j.packet.aeadEncryptedData].includes(e)}async function OP(e,t){const r=Ti(e);let n,s;try{const i=await r.peekBytes(2);if(!i||i.length<2||!(128&i[0]))throw Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const o=await r.readByte();let a,f,c=-1,l=-1;l=0,64&o&&(l=1),l?c=63&o:(c=(63&o)>>2,f=3&o);const u=Vd(c);let p,d=null;if(u){if(X.isStream(e)==="array"){const y=new pi;n=gn(y),d=y}else{const y=new to;n=gn(y.writable),d=y.readable}s=t({tag:c,packet:d})}else d=[];do{if(l){const y=await r.readByte();if(p=!1,y<192)a=y;else if(y>=192&&y<224)a=(y-192<<8)+await r.readByte()+192;else if(y>223&&y<255){if(a=1<<(31&y),p=!0,!u)throw new TypeError("This packet type does not support partial lengths.")}else a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte()}else switch(f){case 0:a=await r.readByte();break;case 1:a=await r.readByte()<<8|await r.readByte();break;case 2:a=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte();break;default:a=1/0}if(a>0){let y=0;for(;;){n&&await n.ready;const{done:g,value:m}=await r.read();if(g){if(a===1/0)break;throw Error("Unexpected end of packet")}const b=a===1/0?m:m.subarray(0,a-y);if(n?await n.write(b):d.push(b),y+=m.length,y>=a){r.unshift(m.subarray(a-y+m.length));break}}}}while(p);const h=await r.peekBytes(u?1/0:2);return n?(await n.ready,await n.close()):(d=X.concatUint8Array(d),await t({tag:c,packet:d})),!h||!h.length}catch(i){if(n)return await n.abort(i),!0;throw i}finally{n&&await s,r.releaseLock()}}let dr=class M8 extends Error{constructor(...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,M8),this.name="UnsupportedError"}};class pf{constructor(t,r){this.tag=t,this.rawContent=r}write(){return this.rawContent}}const Zh=X.getWebCrypto(),yf=X.getNodeCrypto(),_i={p256:"P-256",p384:"P-384",p521:"P-521"},Mi=yf?yf.getCurves():[],us=yf?{secp256k1:Mi.includes("secp256k1")?"secp256k1":void 0,p256:Mi.includes("prime256v1")?"prime256v1":void 0,p384:Mi.includes("secp384r1")?"secp384r1":void 0,p521:Mi.includes("secp521r1")?"secp521r1":void 0,ed25519:Mi.includes("ED25519")?"ED25519":void 0,curve25519:Mi.includes("X25519")?"X25519":void 0,brainpoolP256r1:Mi.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:Mi.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:Mi.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},Fd={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:j.publicKey.ecdsa,hash:j.hash.sha256,cipher:j.symmetric.aes128,node:us.p256,web:_i.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:j.publicKey.ecdsa,hash:j.hash.sha384,cipher:j.symmetric.aes192,node:us.p384,web:_i.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:j.publicKey.ecdsa,hash:j.hash.sha512,cipher:j.symmetric.aes256,node:us.p521,web:_i.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:j.publicKey.ecdsa,hash:j.hash.sha256,cipher:j.symmetric.aes128,node:us.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:j.publicKey.eddsaLegacy,hash:j.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:j.publicKey.ecdh,hash:j.hash.sha256,cipher:j.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:j.publicKey.ecdsa,hash:j.hash.sha256,cipher:j.symmetric.aes128,node:us.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:j.publicKey.ecdsa,hash:j.hash.sha384,cipher:j.symmetric.aes192,node:us.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:j.publicKey.ecdsa,hash:j.hash.sha512,cipher:j.symmetric.aes256,node:us.brainpoolP512r1,payloadSize:64}};class Xi{constructor(t,r){try{(X.isArray(t)||X.isUint8Array(t))&&(t=new li(t)),t instanceof li&&(t=t.getName()),this.name=j.write(j.curve,t)}catch{throw new dr("Unknown curve")}r=r||Fd[this.name],this.keyType=r.keyType,this.oid=r.oid,this.hash=r.hash,this.cipher=r.cipher,this.node=r.node&&Fd[this.name],this.web=r.web&&Fd[this.name],this.payloadSize=r.payloadSize,this.web&&X.getWebCrypto()?this.type="web":this.node&&X.getNodeCrypto()?this.type="node":this.name==="curve25519"?this.type="curve25519":this.name==="ed25519"&&(this.type="ed25519")}async genKeyPair(){let t;switch(this.type){case"web":try{return await async function(n){const s=await Zh.generateKey({name:"ECDSA",namedCurve:_i[n]},!0,["sign","verify"]),i=await Zh.exportKey("jwk",s.privateKey),o=await Zh.exportKey("jwk",s.publicKey);return{publicKey:N8(o),privateKey:qi(i.d)}}(this.name)}catch(n){X.printDebugError("Browser did not support generating ec key "+n.message);break}case"node":return async function(n){const s=yf.createECDH(us[n]);return await s.generateKeys(),{publicKey:new Uint8Array(s.getPublicKey()),privateKey:new Uint8Array(s.getPrivateKey())}}(this.name);case"curve25519":{const n=Pn(32);n[0]=127&n[0]|64,n[31]&=248;const s=n.slice().reverse();return t=wr.box.keyPair.fromSecretKey(s),{publicKey:X.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:n}}case"ed25519":{const n=Pn(32),s=wr.sign.keyPair.fromSeed(n);return{publicKey:X.concatUint8Array([new Uint8Array([64]),s.publicKey]),privateKey:n}}}return t=await(await oo(this.name)).genKeyPair({entropy:X.uint8ArrayToString(Pn(32))}),{publicKey:new Uint8Array(t.getPublic("array",!1)),privateKey:t.getPrivate().toArrayLike(Uint8Array)}}}async function O8(e,t,r,n){const s={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===j.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},i=t.getName();if(!s[i])return!1;if(i==="curve25519"){n=n.slice().reverse();const{publicKey:a}=wr.box.keyPair.fromSecretKey(n);r=new Uint8Array(r);const f=new Uint8Array([64,...a]);return!!X.equalsUint8Array(f,r)}const o=await oo(i);try{r=rh(o,r).getPublic()}catch{return!1}return!!th(o,n).getPublic().eq(r)}function N8(e){const t=qi(e.x),r=qi(e.y),n=new Uint8Array(t.length+r.length+1);return n[0]=4,n.set(t,1),n.set(r,t.length+1),n}function nh(e,t,r){const n=e,s=r.slice(1,n+1),i=r.slice(n+1,2*n+1);return{kty:"EC",crv:t,x:An(s,!0),y:An(i,!0),ext:!0}}function D8(e,t,r,n){const s=nh(e,t,r);return s.d=An(n,!0),s}const gf=X.getWebCrypto(),co=X.getNodeCrypto();async function Gg(e,t,r,n,s,i){const o=new Xi(e);if(r&&!X.isStream(r)){const a={publicKey:n,privateKey:s};switch(o.type){case"web":try{return await async function(f,c,l,u){const p=f.payloadSize,d=D8(f.payloadSize,_i[f.name],u.publicKey,u.privateKey),h=await gf.importKey("jwk",d,{name:"ECDSA",namedCurve:_i[f.name],hash:{name:j.read(j.webHash,f.hash)}},!1,["sign"]),y=new Uint8Array(await gf.sign({name:"ECDSA",namedCurve:_i[f.name],hash:{name:j.read(j.webHash,c)}},h,l));return{r:y.slice(0,p),s:y.slice(p,p<<1)}}(o,t,r,a)}catch(f){if(o.name!=="p521"&&(f.name==="DataError"||f.name==="OperationError"))throw f;X.printDebugError("Browser did not support signing: "+f.message)}break;case"node":{const f=await async function(c,l,u,p){const d=co.createSign(j.read(j.hash,l));d.write(u),d.end();const h=NP.encode({version:1,parameters:c.oid,privateKey:Array.from(p.privateKey),publicKey:{unused:0,data:Array.from(p.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return x8.decode(d.sign(h),"der")}(o,t,r,a);return{r:f.r.toArrayLike(Uint8Array),s:f.s.toArrayLike(Uint8Array)}}}}return async function(a,f,c){const l=await oo(a.name),u=th(l,c),p=u.sign(f);return{r:p.r.toArrayLike(Uint8Array),s:p.s.toArrayLike(Uint8Array)}}(o,i,s)}async function zg(e,t,r,n,s,i){const o=new Xi(e);if(n&&!X.isStream(n))switch(o.type){case"web":try{return await async function(a,f,{r:c,s:l},u,p){const d=nh(a.payloadSize,_i[a.name],p),h=await gf.importKey("jwk",d,{name:"ECDSA",namedCurve:_i[a.name],hash:{name:j.read(j.webHash,a.hash)}},!1,["verify"]),y=X.concatUint8Array([c,l]).buffer;return gf.verify({name:"ECDSA",namedCurve:_i[a.name],hash:{name:j.read(j.webHash,f)}},h,y,u)}(o,t,r,n,s)}catch(a){if(o.name!=="p521"&&(a.name==="DataError"||a.name==="OperationError"))throw a;X.printDebugError("Browser did not support verifying: "+a.message)}break;case"node":return async function(a,f,{r:c,s:l},u,p){const{default:d}=await Promise.resolve().then(function(){return $u}),h=co.createVerify(j.read(j.hash,f));h.write(u),h.end();const y=xP.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:a.oid},subjectPublicKey:{unused:0,data:Array.from(p)}},"pem",{label:"PUBLIC KEY"}),g=x8.encode({r:new d(c),s:new d(l)},"der");try{return h.verify(y,g)}catch{return!1}}(o,t,r,n,s)}return async function(a,f,c,l){const u=await oo(a.name);return rh(u,l).verify(c,f)}(o,r,t===void 0?n:i,s)}const ih=void 0,x8=co?ih.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,NP=co?ih.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,DP=co?ih.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,xP=co?ih.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(DP),this.key("subjectPublicKey").bitstr())}):void 0;var UP=Object.freeze({__proto__:null,sign:Gg,verify:zg,validateParams:async function(e,t,r){const n=new Xi(e);if(n.keyType!==j.publicKey.ecdsa)return!1;switch(n.type){case"web":case"node":{const s=Pn(8),i=j.hash.sha256,o=await Nn.digest(i,s);try{const a=await Gg(e,i,s,t,r,o);return await zg(e,i,a,s,t,o)}catch{return!1}}default:return O8(j.publicKey.ecdsa,e,t,r)}}});wr.hash=e=>new Uint8Array(ao().update(e).digest());var BP=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){if(Nn.getHashByteLength(t)<Nn.getHashByteLength(j.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const o=X.concatUint8Array([s,n.subarray(1)]),a=wr.sign.detached(i,o);return{r:a.subarray(0,32),s:a.subarray(32)}},verify:async function(e,t,{r,s:n},s,i,o){if(Nn.getHashByteLength(t)<Nn.getHashByteLength(j.hash.sha256))throw Error("Hash algorithm too weak for EdDSA.");const a=X.concatUint8Array([r,n]);return wr.sign.detached.verify(o,a,i.subarray(1))},validateParams:async function(e,t,r){if(e.getName()!=="ed25519")return!1;const{publicKey:n}=wr.sign.keyPair.fromSeed(r),s=new Uint8Array([64,...n]);return X.equalsUint8Array(t,s)}});function Xh(e){if(e===j.publicKey.ed25519)return j.hash.sha256;throw Error("Unknown EdDSA algo")}wr.hash=e=>new Uint8Array(ao().update(e).digest());var LP=Object.freeze({__proto__:null,generate:async function(e){if(e===j.publicKey.ed25519){const t=Pn(32),{publicKey:r}=wr.sign.keyPair.fromSeed(t);return{A:r,seed:t}}throw Error("Unsupported EdDSA algorithm")},sign:async function(e,t,r,n,s,i){if(Nn.getHashByteLength(t)<Nn.getHashByteLength(Xh(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case j.publicKey.ed25519:{const o=X.concatUint8Array([s,n]);return{RS:wr.sign.detached(i,o)}}case j.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},verify:async function(e,t,{RS:r},n,s,i){if(Nn.getHashByteLength(t)<Nn.getHashByteLength(Xh(e)))throw Error("Hash algorithm too weak for EdDSA.");switch(e){case j.publicKey.ed25519:return wr.sign.detached.verify(i,r,s);case j.publicKey.ed448:default:throw Error("Unsupported EdDSA algorithm")}},validateParams:async function(e,t,r){switch(e){case j.publicKey.ed25519:{const{publicKey:n}=wr.sign.keyPair.fromSeed(r);return X.equalsUint8Array(t,n)}case j.publicKey.ed448:default:return!1}},getPreferredHashAlgo:Xh});function Zy(e,t){const r=new Pl["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=mf(t);let i=n;const o=s,a=s.length/2,f=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=0;l<=5;++l)for(let u=0;u<a;++u)f[1]=a*l+(1+u),c[0]=i[0],c[1]=i[1],c[2]=o[2*u],c[3]=o[2*u+1],c=mf(r.encrypt(vf(c))),i=c.subarray(0,2),i[0]^=f[0],i[1]^=f[1],o[2*u]=c[2],o[2*u+1]=c[3];return vf(i,o)}function Xy(e,t){const r=new Pl["aes"+8*e.length](e),n=new Uint32Array([2795939494,2795939494]),s=mf(t);let i=s.subarray(0,2);const o=s.subarray(2),a=s.length/2-1,f=new Uint32Array([0,0]);let c=new Uint32Array(4);for(let l=5;l>=0;--l)for(let u=a-1;u>=0;--u)f[1]=a*l+(u+1),c[0]=i[0]^f[0],c[1]=i[1]^f[1],c[2]=o[2*u],c[3]=o[2*u+1],c=mf(r.decrypt(vf(c))),i=c.subarray(0,2),o[2*u]=c[2],o[2*u+1]=c[3];if(i[0]===n[0]&&i[1]===n[1])return vf(o);throw Error("Key Data Integrity failed")}function mf(e){const{length:t}=e,r=function(i){if(X.isString(i)){const{length:o}=i,a=new ArrayBuffer(o),f=new Uint8Array(a);for(let c=0;c<o;++c)f[c]=i.charCodeAt(c);return a}return new Uint8Array(i).buffer}(e),n=new DataView(r),s=new Uint32Array(t/4);for(let i=0;i<t/4;++i)s[i]=n.getUint32(4*i);return s}function vf(){let e=0;for(let s=0;s<arguments.length;++s)e+=4*arguments[s].length;const t=new ArrayBuffer(e),r=new DataView(t);let n=0;for(let s=0;s<arguments.length;++s){for(let i=0;i<arguments[s].length;++i)r.setUint32(n+4*i,arguments[s][i]);n+=4*arguments[s].length}return new Uint8Array(t)}var KP=Object.freeze({__proto__:null,wrap:Zy,unwrap:Xy});function U8(e){const t=8-e.length%8,r=new Uint8Array(e.length+t).fill(t);return r.set(e),r}function B8(e){const t=e.length;if(t>0){const r=e[t-1];if(r>=1){const n=e.subarray(t-r),s=new Uint8Array(r).fill(r);if(X.equalsUint8Array(n,s))return e.subarray(0,t-r)}}throw Error("Invalid padding")}var jP=Object.freeze({__proto__:null,encode:U8,decode:B8});const As=X.getWebCrypto(),L8=X.getNodeCrypto();function Wg(e,t,r,n){return X.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),X.stringToUint8Array("Anonymous Sender "),n.subarray(0,20)])}async function Yg(e,t,r,n,s=!1,i=!1){let o;if(s){for(o=0;o<t.length&&t[o]===0;o++);t=t.subarray(o)}if(i){for(o=t.length-1;o>=0&&t[o]===0;o--);t=t.subarray(0,o+1)}return(await Nn.digest(e,X.concatUint8Array([new Uint8Array([0,0,0,1]),t,n]))).subarray(0,r)}async function qP(e,t){switch(e.type){case"curve25519":{const r=Pn(32),{secretKey:n,sharedKey:s}=await K8(e,t,null,r);let{publicKey:i}=wr.box.keyPair.fromSecretKey(n);return i=X.concatUint8Array([new Uint8Array([64]),i]),{publicKey:i,sharedKey:s}}case"web":if(e.web&&X.getWebCrypto())try{return await async function(r,n){const s=nh(r.payloadSize,r.web.web,n);let i=As.generateKey({name:"ECDH",namedCurve:r.web.web},!0,["deriveKey","deriveBits"]),o=As.importKey("jwk",s,{name:"ECDH",namedCurve:r.web.web},!1,[]);[i,o]=await Promise.all([i,o]);let a=As.deriveBits({name:"ECDH",namedCurve:r.web.web,public:o},i.privateKey,r.web.sharedSize),f=As.exportKey("jwk",i.publicKey);[a,f]=await Promise.all([a,f]);const c=new Uint8Array(a);return{publicKey:new Uint8Array(N8(f)),sharedKey:c}}(e,t)}catch(r){X.printDebugError(r)}break;case"node":return async function(r,n){const s=L8.createECDH(r.node.node);s.generateKeys();const i=new Uint8Array(s.computeSecret(n));return{publicKey:new Uint8Array(s.getPublicKey()),sharedKey:i}}(e,t)}return async function(r,n){const s=await oo(r.name),i=await r.genKeyPair();n=rh(s,n);const o=th(s,i.privateKey),a=i.publicKey,f=o.derive(n.getPublic()),c=s.curve.p.byteLength(),l=f.toArrayLike(Uint8Array,"be",c);return{publicKey:a,sharedKey:l}}(e,t)}async function K8(e,t,r,n){if(n.length!==e.payloadSize){const s=new Uint8Array(e.payloadSize);s.set(n,e.payloadSize-n.length),n=s}switch(e.type){case"curve25519":{const s=n.slice().reverse();return{secretKey:s,sharedKey:wr.scalarMult(s,t.subarray(1))}}case"web":if(e.web&&X.getWebCrypto())try{return await async function(s,i,o,a){const f=D8(s.payloadSize,s.web.web,o,a);let c=As.importKey("jwk",f,{name:"ECDH",namedCurve:s.web.web},!0,["deriveKey","deriveBits"]);const l=nh(s.payloadSize,s.web.web,i);let u=As.importKey("jwk",l,{name:"ECDH",namedCurve:s.web.web},!0,[]);[c,u]=await Promise.all([c,u]);let p=As.deriveBits({name:"ECDH",namedCurve:s.web.web,public:u},c,s.web.sharedSize),d=As.exportKey("jwk",c);[p,d]=await Promise.all([p,d]);const h=new Uint8Array(p);return{secretKey:qi(d.d),sharedKey:h}}(e,t,r,n)}catch(s){X.printDebugError(s)}break;case"node":return async function(s,i,o){const a=L8.createECDH(s.node.node);a.setPrivateKey(o);const f=new Uint8Array(a.computeSecret(i));return{secretKey:new Uint8Array(a.getPrivateKey()),sharedKey:f}}(e,t,n)}return async function(s,i,o){const a=await oo(s.name);i=rh(a,i),o=th(a,o);const f=new Uint8Array(o.getPrivate()),c=o.derive(i.getPublic()),l=a.curve.p.byteLength(),u=c.toArrayLike(Uint8Array,"be",l);return{secretKey:f,sharedKey:u}}(e,t,n)}var $P=Object.freeze({__proto__:null,validateParams:async function(e,t,r){return O8(j.publicKey.ecdh,e,t,r)},encrypt:async function(e,t,r,n,s){const i=U8(r),o=new Xi(e),{publicKey:a,sharedKey:f}=await qP(o,n),c=Wg(j.publicKey.ecdh,e,t,s),{keySize:l}=bi(t.cipher);return{publicKey:a,wrappedKey:Zy(await Yg(t.hash,f,l,c),i)}},decrypt:async function(e,t,r,n,s,i,o){const a=new Xi(e),{sharedKey:f}=await K8(a,r,s,i),c=Wg(j.publicKey.ecdh,e,t,o),{keySize:l}=bi(t.cipher);let u;for(let p=0;p<3;p++)try{return B8(Xy(await Yg(t.hash,f,l,c,p===1,p===2),n))}catch(d){u=d}throw u}});const Jg=X.getWebCrypto(),Yu=X.getNodeCrypto(),Zg=Yu&&Yu.webcrypto&&Yu.webcrypto.subtle;async function Xg(e,t,r,n,s){const i=j.read(j.webHash,e);if(!i)throw Error("Hash algo not supported with HKDF");if(Jg||Zg){const o=Jg||Zg,a=await o.importKey("raw",t,"HKDF",!1,["deriveBits"]),f=await o.deriveBits({name:"HKDF",hash:i,salt:r,info:n},a,8*s);return new Uint8Array(f)}if(Yu){const o=j.read(j.hash,e),a=(d,h)=>Yu.createHmac(o,d).update(h).digest(),f=a(r,t),c=f.length,l=Math.ceil(s/c),u=new Uint8Array(l*c),p=new Uint8Array(c+n.length+1);p.set(n,c);for(let d=0;d<l;d++){p[p.length-1]=d+1;const h=a(f,d>0?p:p.subarray(c));p.set(h,0),u.set(h,d*c)}return u.subarray(0,s)}throw Error("No HKDF implementation available")}const Qg={x25519:X.encodeUTF8("OpenPGP X25519")};var VP=Object.freeze({__proto__:null,generate:async function(e){if(e===j.publicKey.x25519){const t=Pn(32),{publicKey:r}=wr.box.keyPair.fromSecretKey(t);return{A:r,k:t}}throw Error("Unsupported ECDH algorithm")},validateParams:async function(e,t,r){if(e===j.publicKey.x25519){const{publicKey:n}=wr.box.keyPair.fromSecretKey(r);return X.equalsUint8Array(t,n)}return!1},encrypt:async function(e,t,r){if(e===j.publicKey.x25519){const n=Pn(32),s=wr.scalarMult(n,r),{publicKey:i}=wr.box.keyPair.fromSecretKey(n),o=X.concatUint8Array([i,r,s]),{keySize:a}=bi(j.symmetric.aes128);return{ephemeralPublicKey:i,wrappedKey:Zy(await Xg(j.hash.sha256,o,new Uint8Array,Qg.x25519,a),t)}}throw Error("Unsupported ECDH algorithm")},decrypt:async function(e,t,r,n,s){if(e===j.publicKey.x25519){const i=wr.scalarMult(s,t),o=X.concatUint8Array([t,n,i]),{keySize:a}=bi(j.symmetric.aes128);return Xy(await Xg(j.hash.sha256,o,new Uint8Array,Qg.x25519,a),r)}throw Error("Unsupported ECDH algorithm")}}),FP=Object.freeze({__proto__:null,CurveWithOID:Xi,ecdh:$P,ecdhX:VP,ecdsa:UP,eddsaLegacy:BP,eddsa:LP,generate:async function(e){const t=await X.getBigInteger();e=new Xi(e);const r=await e.genKeyPair(),n=new t(r.publicKey).toUint8Array(),s=new t(r.privateKey).toUint8Array("be",e.payloadSize);return{oid:e.oid,Q:n,secret:s,hash:e.hash,cipher:e.cipher}},getPreferredHashAlgo:function(e){return Fd[j.write(j.curve,e.toHex())].hash}}),HP=Object.freeze({__proto__:null,sign:async function(e,t,r,n,s,i){const o=await X.getBigInteger(),a=new o(1);let f,c,l,u;n=new o(n),s=new o(s),r=new o(r),i=new o(i),r=r.mod(n),i=i.mod(s);const p=new o(t.subarray(0,s.byteLength())).mod(s);for(;;){if(f=await Zi(a,s),c=r.modExp(f,n).imod(s),c.isZero())continue;const d=i.mul(c).imod(s);if(u=p.add(d).imod(s),l=f.modInv(s).imul(u).imod(s),!l.isZero())break}return{r:c.toUint8Array("be",s.byteLength()),s:l.toUint8Array("be",s.byteLength())}},verify:async function(e,t,r,n,s,i,o,a){const f=await X.getBigInteger(),c=new f(0);if(t=new f(t),r=new f(r),i=new f(i),o=new f(o),s=new f(s),a=new f(a),t.lte(c)||t.gte(o)||r.lte(c)||r.gte(o))return X.printDebug("invalid DSA Signature"),!1;const l=new f(n.subarray(0,o.byteLength())).imod(o),u=r.modInv(o);if(u.isZero())return X.printDebug("invalid DSA Signature"),!1;s=s.mod(i),a=a.mod(i);const p=l.mul(u).imod(o),d=t.mul(u).imod(o),h=s.modExp(p,i),y=a.modExp(d,i);return h.mul(y).imod(i).imod(o).equal(t)},validateParams:async function(e,t,r,n,s){const i=await X.getBigInteger();e=new i(e),t=new i(t),r=new i(r),n=new i(n);const o=new i(1);if(r.lte(o)||r.gte(e)||!e.dec().mod(t).isZero()||!r.modExp(t,e).isOne())return!1;const a=new i(t.bitLength()),f=new i(150);if(a.lt(f)||!await I8(t,null,32))return!1;s=new i(s);const c=new i(2),l=await Zi(c.leftShift(a.dec()),c.leftShift(a)),u=t.mul(l).add(s);return!!n.equal(r.modExp(u,e))}}),$t={rsa:RP,elgamal:kP,elliptic:FP,dsa:HP,nacl:wr},GP=Object.freeze({__proto__:null,parseSignatureParams:function(e,t){let r=0;switch(e){case j.publicKey.rsaEncryptSign:case j.publicKey.rsaEncrypt:case j.publicKey.rsaSign:return{s:X.readMPI(t.subarray(r))};case j.publicKey.dsa:case j.publicKey.ecdsa:{const n=X.readMPI(t.subarray(r));return r+=n.length+2,{r:n,s:X.readMPI(t.subarray(r))}}case j.publicKey.eddsaLegacy:{let n=X.readMPI(t.subarray(r));r+=n.length+2,n=X.leftPad(n,32);let s=X.readMPI(t.subarray(r));return s=X.leftPad(s,32),{r:n,s}}case j.publicKey.ed25519:{const n=t.subarray(r,r+64);return r+=n.length,{RS:n}}default:throw new dr("Unknown signature algorithm.")}},verify:async function(e,t,r,n,s,i){switch(e){case j.publicKey.rsaEncryptSign:case j.publicKey.rsaEncrypt:case j.publicKey.rsaSign:{const{n:o,e:a}=n,f=X.leftPad(r.s,o.length);return $t.rsa.verify(t,s,f,o,a,i)}case j.publicKey.dsa:{const{g:o,p:a,q:f,y:c}=n,{r:l,s:u}=r;return $t.dsa.verify(t,l,u,i,o,a,f,c)}case j.publicKey.ecdsa:{const{oid:o,Q:a}=n,f=new $t.elliptic.CurveWithOID(o).payloadSize,c=X.leftPad(r.r,f),l=X.leftPad(r.s,f);return $t.elliptic.ecdsa.verify(o,t,{r:c,s:l},s,a,i)}case j.publicKey.eddsaLegacy:{const{oid:o,Q:a}=n;return $t.elliptic.eddsaLegacy.verify(o,t,r,s,a,i)}case j.publicKey.ed25519:{const{A:o}=n;return $t.elliptic.eddsa.verify(e,t,r,s,o,i)}default:throw Error("Unknown signature algorithm.")}},sign:async function(e,t,r,n,s,i){if(!r||!n)throw Error("Missing key parameters");switch(e){case j.publicKey.rsaEncryptSign:case j.publicKey.rsaEncrypt:case j.publicKey.rsaSign:{const{n:o,e:a}=r,{d:f,p:c,q:l,u}=n;return{s:await $t.rsa.sign(t,s,o,a,f,c,l,u,i)}}case j.publicKey.dsa:{const{g:o,p:a,q:f}=r,{x:c}=n;return $t.dsa.sign(t,i,o,a,f,c)}case j.publicKey.elgamal:throw Error("Signing with Elgamal is not defined in the OpenPGP standard.");case j.publicKey.ecdsa:{const{oid:o,Q:a}=r,{d:f}=n;return $t.elliptic.ecdsa.sign(o,t,s,a,f,i)}case j.publicKey.eddsaLegacy:{const{oid:o,Q:a}=r,{seed:f}=n;return $t.elliptic.eddsaLegacy.sign(o,t,s,a,f,i)}case j.publicKey.ed25519:{const{A:o}=r,{seed:a}=n;return $t.elliptic.eddsa.sign(e,t,s,o,a,i)}default:throw Error("Unknown signature algorithm.")}}});class em{constructor(t){t&&(this.data=t)}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.data=t.subarray(1,1+r),1+this.data.length}throw Error("Invalid symmetric key")}write(){return X.concatUint8Array([new Uint8Array([this.data.length]),this.data])}}class tm{constructor(t){if(t){const{hash:r,cipher:n}=t;this.hash=r,this.cipher=n}else this.hash=null,this.cipher=null}read(t){if(t.length<4||t[0]!==3||t[1]!==1)throw new dr("Cannot read KDFParams");return this.hash=t[2],this.cipher=t[3],4}write(){return new Uint8Array([3,1,this.hash,this.cipher])}}class bf{static fromObject({wrappedKey:t,algorithm:r}){const n=new bf;return n.wrappedKey=t,n.algorithm=r,n}read(t){let r=0,n=t[r++];this.algorithm=n%2?t[r++]:null,n-=n%2,this.wrappedKey=t.subarray(r,r+n),r+=n}write(){return X.concatUint8Array([this.algorithm?new Uint8Array([this.wrappedKey.length+1,this.algorithm]):new Uint8Array([this.wrappedKey.length]),this.wrappedKey])}}function Qh(e){try{e.getName()}catch{throw new dr("Unknown curve OID")}}var zP=Object.freeze({__proto__:null,publicKeyEncrypt:async function(e,t,r,n,s){switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:{const{n:i,e:o}=r;return{c:await $t.rsa.encrypt(n,i,o)}}case j.publicKey.elgamal:{const{p:i,g:o,y:a}=r;return $t.elgamal.encrypt(n,i,o,a)}case j.publicKey.ecdh:{const{oid:i,Q:o,kdfParams:a}=r,{publicKey:f,wrappedKey:c}=await $t.elliptic.ecdh.encrypt(i,a,n,o,s);return{V:f,C:new em(c)}}case j.publicKey.x25519:{if(!X.isAES(t))throw Error("X25519 keys can only encrypt AES session keys");const{A:i}=r,{ephemeralPublicKey:o,wrappedKey:a}=await $t.elliptic.ecdhX.encrypt(e,n,i);return{ephemeralPublicKey:o,C:bf.fromObject({algorithm:t,wrappedKey:a})}}default:return[]}},publicKeyDecrypt:async function(e,t,r,n,s,i){switch(e){case j.publicKey.rsaEncryptSign:case j.publicKey.rsaEncrypt:{const{c:o}=n,{n:a,e:f}=t,{d:c,p:l,q:u,u:p}=r;return $t.rsa.decrypt(o,a,f,c,l,u,p,i)}case j.publicKey.elgamal:{const{c1:o,c2:a}=n,f=t.p,c=r.x;return $t.elgamal.decrypt(o,a,f,c,i)}case j.publicKey.ecdh:{const{oid:o,Q:a,kdfParams:f}=t,{d:c}=r,{V:l,C:u}=n;return $t.elliptic.ecdh.decrypt(o,f,l,u.data,a,c,s)}case j.publicKey.x25519:{const{A:o}=t,{k:a}=r,{ephemeralPublicKey:f,C:c}=n;if(!X.isAES(c.algorithm))throw Error("AES session key expected");return $t.elliptic.ecdhX.decrypt(e,f,c.wrappedKey,o,a)}default:throw Error("Unknown public key encryption algorithm.")}},parsePublicKeyParams:function(e,t){let r=0;switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.rsaSign:{const n=X.readMPI(t.subarray(r));r+=n.length+2;const s=X.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{n,e:s}}}case j.publicKey.dsa:{const n=X.readMPI(t.subarray(r));r+=n.length+2;const s=X.readMPI(t.subarray(r));r+=s.length+2;const i=X.readMPI(t.subarray(r));r+=i.length+2;const o=X.readMPI(t.subarray(r));return r+=o.length+2,{read:r,publicParams:{p:n,q:s,g:i,y:o}}}case j.publicKey.elgamal:{const n=X.readMPI(t.subarray(r));r+=n.length+2;const s=X.readMPI(t.subarray(r));r+=s.length+2;const i=X.readMPI(t.subarray(r));return r+=i.length+2,{read:r,publicParams:{p:n,g:s,y:i}}}case j.publicKey.ecdsa:{const n=new li;r+=n.read(t),Qh(n);const s=X.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{oid:n,Q:s}}}case j.publicKey.eddsaLegacy:{const n=new li;r+=n.read(t),Qh(n);let s=X.readMPI(t.subarray(r));return r+=s.length+2,s=X.leftPad(s,33),{read:r,publicParams:{oid:n,Q:s}}}case j.publicKey.ecdh:{const n=new li;r+=n.read(t),Qh(n);const s=X.readMPI(t.subarray(r));r+=s.length+2;const i=new tm;return r+=i.read(t.subarray(r)),{read:r,publicParams:{oid:n,Q:s,kdfParams:i}}}case j.publicKey.ed25519:case j.publicKey.x25519:{const n=t.subarray(r,r+32);return r+=n.length,{read:r,publicParams:{A:n}}}default:throw new dr("Unknown public key encryption algorithm.")}},parsePrivateKeyParams:function(e,t,r){let n=0;switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.rsaSign:{const s=X.readMPI(t.subarray(n));n+=s.length+2;const i=X.readMPI(t.subarray(n));n+=i.length+2;const o=X.readMPI(t.subarray(n));n+=o.length+2;const a=X.readMPI(t.subarray(n));return n+=a.length+2,{read:n,privateParams:{d:s,p:i,q:o,u:a}}}case j.publicKey.dsa:case j.publicKey.elgamal:{const s=X.readMPI(t.subarray(n));return n+=s.length+2,{read:n,privateParams:{x:s}}}case j.publicKey.ecdsa:case j.publicKey.ecdh:{const s=new Xi(r.oid);let i=X.readMPI(t.subarray(n));return n+=i.length+2,i=X.leftPad(i,s.payloadSize),{read:n,privateParams:{d:i}}}case j.publicKey.eddsaLegacy:{const s=new Xi(r.oid);let i=X.readMPI(t.subarray(n));return n+=i.length+2,i=X.leftPad(i,s.payloadSize),{read:n,privateParams:{seed:i}}}case j.publicKey.ed25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{seed:s}}}case j.publicKey.x25519:{const s=t.subarray(n,n+32);return n+=s.length,{read:n,privateParams:{k:s}}}default:throw new dr("Unknown public key encryption algorithm.")}},parseEncSessionKeyParams:function(e,t){let r=0;switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:return{c:X.readMPI(t.subarray(r))};case j.publicKey.elgamal:{const n=X.readMPI(t.subarray(r));return r+=n.length+2,{c1:n,c2:X.readMPI(t.subarray(r))}}case j.publicKey.ecdh:{const n=X.readMPI(t.subarray(r));r+=n.length+2;const s=new em;return s.read(t.subarray(r)),{V:n,C:s}}case j.publicKey.x25519:{const n=t.subarray(r,r+32);r+=n.length;const s=new bf;return s.read(t.subarray(r)),{ephemeralPublicKey:n,C:s}}default:throw new dr("Unknown public key encryption algorithm.")}},serializeParams:function(e,t){const r=new Set([j.publicKey.ed25519,j.publicKey.x25519]),n=Object.keys(t).map(s=>{const i=t[s];return X.isUint8Array(i)?r.has(e)?i:X.uint8ArrayToMPI(i):i.write()});return X.concatUint8Array(n)},generateParams:function(e,t,r){switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.rsaSign:return $t.rsa.generate(t,65537).then(({n,e:s,d:i,p:o,q:a,u:f})=>({privateParams:{d:i,p:o,q:a,u:f},publicParams:{n,e:s}}));case j.publicKey.ecdsa:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{d:i},publicParams:{oid:new li(n),Q:s}}));case j.publicKey.eddsaLegacy:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i})=>({privateParams:{seed:i},publicParams:{oid:new li(n),Q:s}}));case j.publicKey.ecdh:return $t.elliptic.generate(r).then(({oid:n,Q:s,secret:i,hash:o,cipher:a})=>({privateParams:{d:i},publicParams:{oid:new li(n),Q:s,kdfParams:new tm({hash:o,cipher:a})}}));case j.publicKey.ed25519:return $t.elliptic.eddsa.generate(e).then(({A:n,seed:s})=>({privateParams:{seed:s},publicParams:{A:n}}));case j.publicKey.x25519:return $t.elliptic.ecdhX.generate(e).then(({A:n,k:s})=>({privateParams:{k:s},publicParams:{A:n}}));case j.publicKey.dsa:case j.publicKey.elgamal:throw Error("Unsupported algorithm for key generation.");default:throw Error("Unknown public key algorithm.")}},validateParams:async function(e,t,r){if(!t||!r)throw Error("Missing key parameters");switch(e){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.rsaSign:{const{n,e:s}=t,{d:i,p:o,q:a,u:f}=r;return $t.rsa.validateParams(n,s,i,o,a,f)}case j.publicKey.dsa:{const{p:n,q:s,g:i,y:o}=t,{x:a}=r;return $t.dsa.validateParams(n,s,i,o,a)}case j.publicKey.elgamal:{const{p:n,g:s,y:i}=t,{x:o}=r;return $t.elgamal.validateParams(n,s,i,o)}case j.publicKey.ecdsa:case j.publicKey.ecdh:{const n=$t.elliptic[j.read(j.publicKey,e)],{oid:s,Q:i}=t,{d:o}=r;return n.validateParams(s,i,o)}case j.publicKey.eddsaLegacy:{const{Q:n,oid:s}=t,{seed:i}=r;return $t.elliptic.eddsaLegacy.validateParams(s,n,i)}case j.publicKey.ed25519:{const{A:n}=t,{seed:s}=r;return $t.elliptic.eddsa.validateParams(e,n,s)}case j.publicKey.x25519:{const{A:n}=t,{k:s}=r;return $t.elliptic.ecdhX.validateParams(e,n,s)}default:throw Error("Unknown public key algorithm.")}},getPrefixRandom:async function(e){const{blockSize:t}=bi(e),r=await Pn(t),n=new Uint8Array([r[r.length-2],r[r.length-1]]);return X.concat([r,n])},generateSessionKey:function(e){const{keySize:t}=bi(e);return Pn(t)},getAEADMode:function(e){const t=j.read(j.aead,e);return T8[t]},getCipher:bi,getPreferredCurveHashAlgo:function(e,t){switch(e){case j.publicKey.ecdsa:case j.publicKey.eddsaLegacy:return $t.elliptic.getPreferredHashAlgo(t);case j.publicKey.ed25519:return $t.elliptic.eddsa.getPreferredHashAlgo(e);default:throw Error("Unknown elliptic signing algo")}}});const yt={cipher:Pl,hash:Nn,mode:T8,publicKey:$t,signature:GP,random:TP,pkcs1:CP,pkcs5:jP,aesKW:KP};Object.assign(yt,zP);var Cl=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function j8(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)}const q8={arraySet:function(e,t,r,n,s){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),s);else for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){let t,r,n,s,i;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;const o=new Uint8Array(n);for(s=0,t=0,r=e.length;t<r;t++)i=e[t],o.set(i,s),s+=i.length;return o}},$8={arraySet:function(e,t,r,n,s){for(let i=0;i<n;i++)e[s+i]=t[r+i]},flattenChunks:function(e){return[].concat.apply([],e)}};let yi=Cl?Uint8Array:Array,On=Cl?Uint16Array:Array,_f=Cl?Int32Array:Array,V8=Cl?q8.flattenChunks:$8.flattenChunks,wi=Cl?q8.arraySet:$8.arraySet;const Ei=0,WP=1,ol=2,YP=3,Mr=4,ty=5,nd=6,er=0,Hi=1,F8=2,_r=-2,Qy=-3,Ju=-5,rm=-1,JP=1,id=2,ZP=3,H8=4,nm=0,im=1,G8=2,ro=8;function uo(e){let t=e.length;for(;--t>=0;)e[t]=0}const XP=0,z8=1,QP=2,e2=29,Rl=256,cl=Rl+1+e2,Za=30,t2=19,sm=2*cl+1,oa=15,e0=16,eT=7,r2=256,W8=16,Y8=17,J8=18,ry=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Hd=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],tT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],am=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ji=Array(2*(cl+2));uo(ji);const Zu=Array(2*Za);uo(Zu);const ul=Array(512);uo(ul);const ll=Array(256);uo(ll);const n2=Array(e2);uo(n2);const wf=Array(Za);function t0(e,t,r,n,s){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=s,this.has_stree=e&&e.length}let om,cm,um;function r0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Z8(e){return e<256?ul[e]:ul[256+(e>>>7)]}function dl(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function pn(e,t,r){e.bi_valid>e0-r?(e.bi_buf|=t<<e.bi_valid&65535,dl(e,e.bi_buf),e.bi_buf=t>>e0-e.bi_valid,e.bi_valid+=r-e0):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function fi(e,t,r){pn(e,r[2*t],r[2*t+1])}function X8(e,t){let r=0;do r|=1&e,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Q8(e,t,r){const n=Array(oa+1);let s,i,o=0;for(s=1;s<=oa;s++)n[s]=o=o+r[s-1]<<1;for(i=0;i<=t;i++){const a=e[2*i+1];a!==0&&(e[2*i]=X8(n[a]++,a))}}function e7(e){let t;for(t=0;t<cl;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Za;t++)e.dyn_dtree[2*t]=0;for(t=0;t<t2;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*r2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function t7(e){e.bi_valid>8?dl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function lm(e,t,r,n){const s=2*t,i=2*r;return e[s]<e[i]||e[s]===e[i]&&n[t]<=n[r]}function n0(e,t,r){const n=e.heap[r];let s=r<<1;for(;s<=e.heap_len&&(s<e.heap_len&&lm(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!lm(t,n,e.heap[s],e.depth));)e.heap[r]=e.heap[s],r=s,s<<=1;e.heap[r]=n}function dm(e,t,r){let n,s,i,o,a=0;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],s=e.pending_buf[e.l_buf+a],a++,n===0?fi(e,s,t):(i=ll[s],fi(e,i+Rl+1,t),o=ry[i],o!==0&&(s-=n2[i],pn(e,s,o)),n--,i=Z8(n),fi(e,i,r),o=Hd[i],o!==0&&(n-=wf[i],pn(e,n,o)));while(a<e.last_lit);fi(e,r2,t)}function i0(e,t){const r=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let o,a,f,c=-1;for(e.heap_len=0,e.heap_max=sm,o=0;o<i;o++)r[2*o]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):r[2*o+1]=0;for(;e.heap_len<2;)f=e.heap[++e.heap_len]=c<2?++c:0,r[2*f]=1,e.depth[f]=0,e.opt_len--,s&&(e.static_len-=n[2*f+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)n0(e,r,o);f=i;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],n0(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,r[2*f]=r[2*o]+r[2*a],e.depth[f]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,r[2*o+1]=r[2*a+1]=f,e.heap[1]=f++,n0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(l,u){const p=u.dyn_tree,d=u.max_code,h=u.stat_desc.static_tree,y=u.stat_desc.has_stree,g=u.stat_desc.extra_bits,m=u.stat_desc.extra_base,b=u.stat_desc.max_length;let w,E,C,R,M,_,A=0;for(R=0;R<=oa;R++)l.bl_count[R]=0;for(p[2*l.heap[l.heap_max]+1]=0,w=l.heap_max+1;w<sm;w++)E=l.heap[w],R=p[2*p[2*E+1]+1]+1,R>b&&(R=b,A++),p[2*E+1]=R,E>d||(l.bl_count[R]++,M=0,E>=m&&(M=g[E-m]),_=p[2*E],l.opt_len+=_*(R+M),y&&(l.static_len+=_*(h[2*E+1]+M)));if(A!==0){do{for(R=b-1;l.bl_count[R]===0;)R--;l.bl_count[R]--,l.bl_count[R+1]+=2,l.bl_count[b]--,A-=2}while(A>0);for(R=b;R!==0;R--)for(E=l.bl_count[R];E!==0;)C=l.heap[--w],C>d||(p[2*C+1]!==R&&(l.opt_len+=(R-p[2*C+1])*p[2*C],p[2*C+1]=R),E--)}}(e,t),Q8(r,c,e.bl_count)}function fm(e,t,r){let n,s,i=-1,o=t[1],a=0,f=7,c=4;for(o===0&&(f=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)s=o,o=t[2*(n+1)+1],++a<f&&s===o||(a<c?e.bl_tree[2*s]+=a:s!==0?(s!==i&&e.bl_tree[2*s]++,e.bl_tree[2*W8]++):a<=10?e.bl_tree[2*Y8]++:e.bl_tree[2*J8]++,a=0,i=s,o===0?(f=138,c=3):s===o?(f=6,c=3):(f=7,c=4))}function hm(e,t,r){let n,s,i=-1,o=t[1],a=0,f=7,c=4;for(o===0&&(f=138,c=3),n=0;n<=r;n++)if(s=o,o=t[2*(n+1)+1],!(++a<f&&s===o)){if(a<c)do fi(e,s,e.bl_tree);while(--a!=0);else s!==0?(s!==i&&(fi(e,s,e.bl_tree),a--),fi(e,W8,e.bl_tree),pn(e,a-3,2)):a<=10?(fi(e,Y8,e.bl_tree),pn(e,a-3,3)):(fi(e,J8,e.bl_tree),pn(e,a-11,7));a=0,i=s,o===0?(f=138,c=3):s===o?(f=6,c=3):(f=7,c=4)}}uo(wf);let pm=!1;function rT(e){pm||(function(){let t,r,n,s,i;const o=Array(oa+1);for(n=0,s=0;s<e2-1;s++)for(n2[s]=n,t=0;t<1<<ry[s];t++)ll[n++]=s;for(ll[n-1]=s,i=0,s=0;s<16;s++)for(wf[s]=i,t=0;t<1<<Hd[s];t++)ul[i++]=s;for(i>>=7;s<Za;s++)for(wf[s]=i<<7,t=0;t<1<<Hd[s]-7;t++)ul[256+i++]=s;for(r=0;r<=oa;r++)o[r]=0;for(t=0;t<=143;)ji[2*t+1]=8,t++,o[8]++;for(;t<=255;)ji[2*t+1]=9,t++,o[9]++;for(;t<=279;)ji[2*t+1]=7,t++,o[7]++;for(;t<=287;)ji[2*t+1]=8,t++,o[8]++;for(Q8(ji,cl+1,o),t=0;t<Za;t++)Zu[2*t+1]=5,Zu[2*t]=X8(t,5);om=new t0(ji,ry,Rl+1,cl,oa),cm=new t0(Zu,Hd,0,Za,oa),um=new t0([],tT,0,t2,eT)}(),pm=!0),e.l_desc=new r0(e.dyn_ltree,om),e.d_desc=new r0(e.dyn_dtree,cm),e.bl_desc=new r0(e.bl_tree,um),e.bi_buf=0,e.bi_valid=0,e7(e)}function r7(e,t,r,n){pn(e,(XP<<1)+(n?1:0),3),function(s,i,o,a){t7(s),a&&(dl(s,o),dl(s,~o)),wi(s.pending_buf,s.window,i,o,s.pending),s.pending+=o}(e,t,r,!0)}function nT(e){pn(e,z8<<1,3),fi(e,r2,ji),function(t){t.bi_valid===16?(dl(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(e)}function iT(e,t,r,n){let s,i,o=0;e.level>0?(e.strm.data_type===G8&&(e.strm.data_type=function(a){let f,c=4093624447;for(f=0;f<=31;f++,c>>>=1)if(1&c&&a.dyn_ltree[2*f]!==0)return nm;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return im;for(f=32;f<Rl;f++)if(a.dyn_ltree[2*f]!==0)return im;return nm}(e)),i0(e,e.l_desc),i0(e,e.d_desc),o=function(a){let f;for(fm(a,a.dyn_ltree,a.l_desc.max_code),fm(a,a.dyn_dtree,a.d_desc.max_code),i0(a,a.bl_desc),f=t2-1;f>=3&&a.bl_tree[2*am[f]+1]===0;f--);return a.opt_len+=3*(f+1)+5+5+4,f}(e),s=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=s&&(s=i)):s=i=r+5,r+4<=s&&t!==-1?r7(e,t,r,n):e.strategy===H8||i===s?(pn(e,(z8<<1)+(n?1:0),3),dm(e,ji,Zu)):(pn(e,(QP<<1)+(n?1:0),3),function(a,f,c,l){let u;for(pn(a,f-257,5),pn(a,c-1,5),pn(a,l-4,4),u=0;u<l;u++)pn(a,a.bl_tree[2*am[u]+1],3);hm(a,a.dyn_ltree,f-1),hm(a,a.dyn_dtree,c-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),dm(e,e.dyn_ltree,e.dyn_dtree)),e7(e),n&&t7(e)}function Cs(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,t===0?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(ll[r]+Rl+1)]++,e.dyn_dtree[2*Z8(t)]++),e.last_lit===e.lit_bufsize-1}function fl(e,t,r,n){let s=65535&e|0,i=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do s=s+t[n++]|0,i=i+s|0;while(--o);s%=65521,i%=65521}return s|i<<16|0}const sT=function(){let e;const t=[];for(let r=0;r<256;r++){e=r;for(let n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function Ir(e,t,r,n){const s=sT,i=n+r;e^=-1;for(let o=n;o<i;o++)e=e>>>8^s[255&(e^t[o])];return-1^e}var hl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};const aT=9,Vt=3,Ss=258,Jn=Ss+Vt+1,oT=32,Ef=42,ny=69,Gd=73,zd=91,Wd=103,ca=113,Uu=666,Rr=1,Xu=2,ua=3,Xa=4,cT=3;function Ps(e,t){return e.msg=hl[t],t}function ym(e){return(e<<1)-(e>4?9:0)}function _s(e){let t=e.length;for(;--t>=0;)e[t]=0}function ls(e){const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(wi(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Kr(e,t){iT(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ls(e.strm)}function Jt(e,t){e.pending_buf[e.pending++]=t}function Ro(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function uT(e,t,r,n){let s=e.avail_in;return s>n&&(s=n),s===0?0:(e.avail_in-=s,wi(t,e.input,e.next_in,s,r),e.state.wrap===1?e.adler=fl(e.adler,t,s,r):e.state.wrap===2&&(e.adler=Ir(e.adler,t,s,r)),e.next_in+=s,e.total_in+=s,s)}function n7(e,t){let r,n,s=e.max_chain_length,i=e.strstart,o=e.prev_length,a=e.nice_match;const f=e.strstart>e.w_size-Jn?e.strstart-(e.w_size-Jn):0,c=e.window,l=e.w_mask,u=e.prev,p=e.strstart+Ss;let d=c[i+o-1],h=c[i+o];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do if(r=t,c[r+o]===h&&c[r+o-1]===d&&c[r]===c[i]&&c[++r]===c[i+1]){i+=2,r++;do;while(c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&c[++i]===c[++r]&&i<p);if(n=Ss-(p-i),i=p-Ss,n>o){if(e.match_start=t,o=n,n>=a)break;d=c[i+o-1],h=c[i+o]}}while((t=u[t&l])>f&&--s!=0);return o<=e.lookahead?o:e.lookahead}function va(e){const t=e.w_size;let r,n,s,i,o;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Jn)){wi(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do s=e.head[--r],e.head[r]=s>=t?s-t:0;while(--n);n=t,r=n;do s=e.prev[--r],e.prev[r]=s>=t?s-t:0;while(--n);i+=t}if(e.strm.avail_in===0)break;if(n=uT(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=Vt)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+Vt-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<Vt)););}while(e.lookahead<Jn&&e.strm.avail_in!==0)}function s0(e,t){let r,n;for(;;){if(e.lookahead<Jn){if(va(e),e.lookahead<Jn&&t===Ei)return Rr;if(e.lookahead===0)break}if(r=0,e.lookahead>=Vt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-Jn&&(e.match_length=n7(e,r)),e.match_length>=Vt)if(n=Cs(e,e.strstart-e.match_start,e.match_length-Vt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Vt){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=Cs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Kr(e,!1),e.strm.avail_out===0))return Rr}return e.insert=e.strstart<Vt-1?e.strstart:Vt-1,t===Mr?(Kr(e,!0),e.strm.avail_out===0?ua:Xa):e.last_lit&&(Kr(e,!1),e.strm.avail_out===0)?Rr:Xu}function ka(e,t){let r,n,s;for(;;){if(e.lookahead<Jn){if(va(e),e.lookahead<Jn&&t===Ei)return Rr;if(e.lookahead===0)break}if(r=0,e.lookahead>=Vt&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Vt-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-Jn&&(e.match_length=n7(e,r),e.match_length<=5&&(e.strategy===JP||e.match_length===Vt&&e.strstart-e.match_start>4096)&&(e.match_length=Vt-1)),e.prev_length>=Vt&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Vt,n=Cs(e,e.strstart-1-e.prev_match,e.prev_length-Vt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Vt-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=Vt-1,e.strstart++,n&&(Kr(e,!1),e.strm.avail_out===0))return Rr}else if(e.match_available){if(n=Cs(e,0,e.window[e.strstart-1]),n&&Kr(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Rr}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Cs(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Vt-1?e.strstart:Vt-1,t===Mr?(Kr(e,!0),e.strm.avail_out===0?ua:Xa):e.last_lit&&(Kr(e,!1),e.strm.avail_out===0)?Rr:Xu}class ni{constructor(t,r,n,s,i){this.good_length=t,this.max_lazy=r,this.nice_length=n,this.max_chain=s,this.func=i}}const Bu=[new ni(0,0,0,0,function(e,t){let r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(va(e),e.lookahead===0&&t===Ei)return Rr;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;const n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Kr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Jn&&(Kr(e,!1),e.strm.avail_out===0))return Rr}return e.insert=0,t===Mr?(Kr(e,!0),e.strm.avail_out===0?ua:Xa):(e.strstart>e.block_start&&(Kr(e,!1),e.strm.avail_out),Rr)}),new ni(4,4,8,4,s0),new ni(4,5,16,8,s0),new ni(4,6,32,32,s0),new ni(4,4,16,16,ka),new ni(8,16,32,32,ka),new ni(8,16,128,128,ka),new ni(8,32,128,256,ka),new ni(32,128,258,1024,ka),new ni(32,258,258,4096,ka)];class lT{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ro,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new On(1146),this.dyn_dtree=new On(122),this.bl_tree=new On(78),_s(this.dyn_ltree),_s(this.dyn_dtree),_s(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new On(16),this.heap=new On(573),_s(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new On(573),_s(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}}function dT(e){const t=function(r){let n;return r&&r.state?(r.total_in=r.total_out=0,r.data_type=G8,n=r.state,n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap?Ef:ca,r.adler=n.wrap===2?0:1,n.last_flush=Ei,rT(n),er):Ps(r,_r)}(e);return t===er&&function(r){r.window_size=2*r.w_size,_s(r.head),r.max_lazy_match=Bu[r.level].max_lazy,r.good_match=Bu[r.level].good_length,r.nice_match=Bu[r.level].nice_length,r.max_chain_length=Bu[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Vt-1,r.match_available=0,r.ins_h=0}(e.state),t}function fT(e,t){let r,n,s,i;if(!e||!e.state||t>ty||t<0)return e?Ps(e,_r):_r;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Uu&&t!==Mr)return Ps(e,e.avail_out===0?Ju:_r);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Ef)if(n.wrap===2)e.adler=0,Jt(n,31),Jt(n,139),Jt(n,8),n.gzhead?(Jt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Jt(n,255&n.gzhead.time),Jt(n,n.gzhead.time>>8&255),Jt(n,n.gzhead.time>>16&255),Jt(n,n.gzhead.time>>24&255),Jt(n,n.level===9?2:n.strategy>=id||n.level<2?4:0),Jt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Jt(n,255&n.gzhead.extra.length),Jt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ir(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ny):(Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,0),Jt(n,n.level===9?2:n.strategy>=id||n.level<2?4:0),Jt(n,cT),n.status=ca);else{let a=ro+(n.w_bits-8<<4)<<8,f=-1;f=n.strategy>=id||n.level<2?0:n.level<6?1:n.level===6?2:3,a|=f<<6,n.strstart!==0&&(a|=oT),a+=31-a%31,n.status=ca,Ro(n,a),n.strstart!==0&&(Ro(n,e.adler>>>16),Ro(n,65535&e.adler)),e.adler=1}if(n.status===ny)if(n.gzhead.extra){for(s=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),ls(e),s=n.pending,n.pending!==n.pending_buf_size));)Jt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Gd)}else n.status=Gd;if(n.status===Gd)if(n.gzhead.name){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),ls(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Jt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.gzindex=0,n.status=zd)}else n.status=zd;if(n.status===zd)if(n.gzhead.comment){s=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),ls(e),s=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Jt(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>s&&(e.adler=Ir(e.adler,n.pending_buf,n.pending-s,s)),i===0&&(n.status=Wd)}else n.status=Wd;if(n.status===Wd&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ls(e),n.pending+2<=n.pending_buf_size&&(Jt(n,255&e.adler),Jt(n,e.adler>>8&255),e.adler=0,n.status=ca)):n.status=ca),n.pending!==0){if(ls(e),e.avail_out===0)return n.last_flush=-1,er}else if(e.avail_in===0&&ym(t)<=ym(r)&&t!==Mr)return Ps(e,Ju);if(n.status===Uu&&e.avail_in!==0)return Ps(e,Ju);if(e.avail_in!==0||n.lookahead!==0||t!==Ei&&n.status!==Uu){var o=n.strategy===id?function(a,f){let c;for(;;){if(a.lookahead===0&&(va(a),a.lookahead===0)){if(f===Ei)return Rr;break}if(a.match_length=0,c=Cs(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(Kr(a,!1),a.strm.avail_out===0))return Rr}return a.insert=0,f===Mr?(Kr(a,!0),a.strm.avail_out===0?ua:Xa):a.last_lit&&(Kr(a,!1),a.strm.avail_out===0)?Rr:Xu}(n,t):n.strategy===ZP?function(a,f){let c,l,u,p;const d=a.window;for(;;){if(a.lookahead<=Ss){if(va(a),a.lookahead<=Ss&&f===Ei)return Rr;if(a.lookahead===0)break}if(a.match_length=0,a.lookahead>=Vt&&a.strstart>0&&(u=a.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){p=a.strstart+Ss;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&u<p);a.match_length=Ss-(p-u),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=Vt?(c=Cs(a,1,a.match_length-Vt),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=Cs(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(Kr(a,!1),a.strm.avail_out===0))return Rr}return a.insert=0,f===Mr?(Kr(a,!0),a.strm.avail_out===0?ua:Xa):a.last_lit&&(Kr(a,!1),a.strm.avail_out===0)?Rr:Xu}(n,t):Bu[n.level].func(n,t);if(o!==ua&&o!==Xa||(n.status=Uu),o===Rr||o===ua)return e.avail_out===0&&(n.last_flush=-1),er;if(o===Xu&&(t===WP?nT(n):t!==ty&&(r7(n,0,0,!1),t===YP&&(_s(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ls(e),e.avail_out===0))return n.last_flush=-1,er}return t!==Mr?er:n.wrap<=0?Hi:(n.wrap===2?(Jt(n,255&e.adler),Jt(n,e.adler>>8&255),Jt(n,e.adler>>16&255),Jt(n,e.adler>>24&255),Jt(n,255&e.total_in),Jt(n,e.total_in>>8&255),Jt(n,e.total_in>>16&255),Jt(n,e.total_in>>24&255)):(Ro(n,e.adler>>>16),Ro(n,65535&e.adler)),ls(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?er:Hi)}try{String.fromCharCode.call(null,0)}catch{}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const iy=new yi(256);for(let e=0;e<256;e++)iy[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;function sy(e){let t,r,n,s,i=0;const o=e.length;for(n=0;n<o;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),i+=t<128?1:t<2048?2:t<65536?3:4;const a=new yi(i);for(s=0,n=0;s<i;n++)t=e.charCodeAt(n),(64512&t)==55296&&n+1<o&&(r=e.charCodeAt(n+1),(64512&r)==56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?a[s++]=t:t<2048?(a[s++]=192|t>>>6,a[s++]=128|63&t):t<65536?(a[s++]=224|t>>>12,a[s++]=128|t>>>6&63,a[s++]=128|63&t):(a[s++]=240|t>>>18,a[s++]=128|t>>>12&63,a[s++]=128|t>>>6&63,a[s++]=128|63&t);return a}iy[254]=iy[254]=1;class i7{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}class ay{constructor(t){this.options={level:rm,method:ro,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,...t||{}};const r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i7,this.strm.avail_out=0;var n,s,i=function(o,a,f,c,l,u){if(!o)return _r;let p=1;if(a===rm&&(a=6),c<0?(p=0,c=-c):c>15&&(p=2,c-=16),l<1||l>aT||f!==ro||c<8||c>15||a<0||a>9||u<0||u>H8)return Ps(o,_r);c===8&&(c=9);const d=new lT;return o.state=d,d.strm=o,d.wrap=p,d.gzhead=null,d.w_bits=c,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.hash_bits=l+7,d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+Vt-1)/Vt),d.window=new yi(2*d.w_size),d.head=new On(d.hash_size),d.prev=new On(d.w_size),d.lit_bufsize=1<<l+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new yi(d.pending_buf_size),d.d_buf=1*d.lit_bufsize,d.l_buf=3*d.lit_bufsize,d.level=a,d.strategy=u,d.method=f,dT(o)}(this.strm,r.level,r.method,r.windowBits,r.memLevel,r.strategy);if(i!==er)throw Error(hl[i]);if(r.header&&(n=this.strm,s=r.header,n&&n.state&&(n.state.wrap!==2||(n.state.gzhead=s))),r.dictionary){let o;if(o=typeof r.dictionary=="string"?sy(r.dictionary):r.dictionary instanceof ArrayBuffer?new Uint8Array(r.dictionary):r.dictionary,i=function(a,f){let c,l,u,p,d,h,y,g,m=f.length;if(!a||!a.state||(c=a.state,p=c.wrap,p===2||p===1&&c.status!==Ef||c.lookahead))return _r;for(p===1&&(a.adler=fl(a.adler,f,m,0)),c.wrap=0,m>=c.w_size&&(p===0&&(_s(c.head),c.strstart=0,c.block_start=0,c.insert=0),g=new yi(c.w_size),wi(g,f,m-c.w_size,c.w_size,0),f=g,m=c.w_size),d=a.avail_in,h=a.next_in,y=a.input,a.avail_in=m,a.next_in=0,a.input=f,va(c);c.lookahead>=Vt;){l=c.strstart,u=c.lookahead-(Vt-1);do c.ins_h=(c.ins_h<<c.hash_shift^c.window[l+Vt-1])&c.hash_mask,c.prev[l&c.w_mask]=c.head[c.ins_h],c.head[c.ins_h]=l,l++;while(--u);c.strstart=l,c.lookahead=Vt-1,va(c)}return c.strstart+=c.lookahead,c.block_start=c.strstart,c.insert=c.lookahead,c.lookahead=0,c.match_length=c.prev_length=Vt-1,c.match_available=0,a.next_in=h,a.input=y,a.avail_in=d,c.wrap=p,er}(this.strm,o),i!==er)throw Error(hl[i]);this._dict_set=!0}}push(t,r){const{strm:n,options:{chunkSize:s}}=this;var i,o;if(this.ended)return!1;o=r===~~r?r:r===!0?Mr:Ei,typeof t=="string"?n.input=sy(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new yi(s),n.next_out=0,n.avail_out=s),(i=fT(n,o))!==Hi&&i!==er)return this.onEnd(i),this.ended=!0,!1;n.avail_out!==0&&(n.avail_in!==0||o!==Mr&&o!==ol)||this.onData(j8(n.output,n.next_out))}while((n.avail_in>0||n.avail_out===0)&&i!==Hi);return o===Mr?(i=function(a){let f;return a&&a.state?(f=a.state.status,f!==Ef&&f!==ny&&f!==Gd&&f!==zd&&f!==Wd&&f!==ca&&f!==Uu?Ps(a,_r):(a.state=null,f===ca?Ps(a,Qy):er)):_r}(this.strm),this.onEnd(i),this.ended=!0,i===er):o!==ol||(this.onEnd(er),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===er&&(this.result=V8(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}const sd=30,hT=12;function pT(e,t){let r,n,s,i,o,a,f,c,l,u;const p=e.state;r=e.next_in;const d=e.input,h=r+(e.avail_in-5);n=e.next_out;const y=e.output,g=n-(t-e.avail_out),m=n+(e.avail_out-257),b=p.dmax,w=p.wsize,E=p.whave,C=p.wnext,R=p.window;s=p.hold,i=p.bits;const M=p.lencode,_=p.distcode,A=(1<<p.lenbits)-1,I=(1<<p.distbits)-1;e:do{i<15&&(s+=d[r++]<<i,i+=8,s+=d[r++]<<i,i+=8),o=M[s&A];t:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,a===0)y[n++]=65535&o;else{if(!(16&a)){if(!(64&a)){o=M[(65535&o)+(s&(1<<a)-1)];continue t}if(32&a){p.mode=hT;break e}e.msg="invalid literal/length code",p.mode=sd;break e}f=65535&o,a&=15,a&&(i<a&&(s+=d[r++]<<i,i+=8),f+=s&(1<<a)-1,s>>>=a,i-=a),i<15&&(s+=d[r++]<<i,i+=8,s+=d[r++]<<i,i+=8),o=_[s&I];r:for(;;){if(a=o>>>24,s>>>=a,i-=a,a=o>>>16&255,!(16&a)){if(!(64&a)){o=_[(65535&o)+(s&(1<<a)-1)];continue r}e.msg="invalid distance code",p.mode=sd;break e}if(c=65535&o,a&=15,i<a&&(s+=d[r++]<<i,i+=8,i<a&&(s+=d[r++]<<i,i+=8)),c+=s&(1<<a)-1,c>b){e.msg="invalid distance too far back",p.mode=sd;break e}if(s>>>=a,i-=a,a=n-g,c>a){if(a=c-a,a>E&&p.sane){e.msg="invalid distance too far back",p.mode=sd;break e}if(l=0,u=R,C===0){if(l+=w-a,a<f){f-=a;do y[n++]=R[l++];while(--a);l=n-c,u=y}}else if(C<a){if(l+=w+C-a,a-=C,a<f){f-=a;do y[n++]=R[l++];while(--a);if(l=0,C<f){a=C,f-=a;do y[n++]=R[l++];while(--a);l=n-c,u=y}}}else if(l+=C-a,a<f){f-=a;do y[n++]=R[l++];while(--a);l=n-c,u=y}for(;f>2;)y[n++]=u[l++],y[n++]=u[l++],y[n++]=u[l++],f-=3;f&&(y[n++]=u[l++],f>1&&(y[n++]=u[l++]))}else{l=n-c;do y[n++]=y[l++],y[n++]=y[l++],y[n++]=y[l++],f-=3;while(f>2);f&&(y[n++]=y[l++],f>1&&(y[n++]=y[l++]))}break}}break}}while(r<h&&n<m);f=i>>3,r-=f,i-=f<<3,s&=(1<<i)-1,e.next_in=r,e.next_out=n,e.avail_in=r<h?h-r+5:5-(r-h),e.avail_out=n<m?m-n+257:257-(n-m),p.hold=s,p.bits=i}const Ma=15,gm=852,mm=592,vm=0,a0=1,bm=2,yT=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],gT=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],mT=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],vT=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Qu(e,t,r,n,s,i,o,a){const f=a.bits;let c,l,u,p,d,h=0,y=0,g=0,m=0,b=0,w=0,E=0,C=0,R=0,M=0,_=null,A=0;const I=new On(Ma+1),P=new On(Ma+1);let v,S,T,N=null,D=0;for(h=0;h<=Ma;h++)I[h]=0;for(y=0;y<n;y++)I[t[r+y]]++;for(b=f,m=Ma;m>=1&&I[m]===0;m--);if(b>m&&(b=m),m===0)return s[i++]=20971520,s[i++]=20971520,a.bits=1,0;for(g=1;g<m&&I[g]===0;g++);for(b<g&&(b=g),C=1,h=1;h<=Ma;h++)if(C<<=1,C-=I[h],C<0)return-1;if(C>0&&(e===vm||m!==1))return-1;for(P[1]=0,h=1;h<Ma;h++)P[h+1]=P[h]+I[h];for(y=0;y<n;y++)t[r+y]!==0&&(o[P[t[r+y]]++]=y);e===vm?(_=N=o,d=19):e===a0?(_=yT,A-=257,N=gT,D-=257,d=256):(_=mT,N=vT,d=-1),M=0,y=0,h=g,p=i,w=b,E=0,u=-1,R=1<<b;const O=R-1;if(e===a0&&R>gm||e===bm&&R>mm)return 1;for(;;){v=h-E,o[y]<d?(S=0,T=o[y]):o[y]>d?(S=N[D+o[y]],T=_[A+o[y]]):(S=96,T=0),c=1<<h-E,l=1<<w,g=l;do l-=c,s[p+(M>>E)+l]=v<<24|S<<16|T|0;while(l!==0);for(c=1<<h-1;M&c;)c>>=1;if(c!==0?(M&=c-1,M+=c):M=0,y++,--I[h]==0){if(h===m)break;h=t[r+o[y]]}if(h>b&&(M&O)!==u){for(E===0&&(E=b),p+=g,w=h-E,C=1<<w;w+E<m&&(C-=I[w+E],!(C<=0));)w++,C<<=1;if(R+=1<<w,e===a0&&R>gm||e===bm&&R>mm)return 1;u=M&O,s[u]=b<<24|w<<16|p-i|0}}return M!==0&&(s[p+M]=h-E<<24|64<<16|0),a.bits=b,0}const bT=0,s7=1,a7=2,o7=1,_m=2,wm=3,Em=4,Am=5,Sm=6,Pm=7,Tm=8,Im=9,Cm=10,Af=11,Oi=12,o0=13,Rm=14,c0=15,km=16,Mm=17,Om=18,Nm=19,ad=20,od=21,Dm=22,xm=23,Um=24,Bm=25,Lm=26,u0=27,Km=28,jm=29,ur=30,_T=852,wT=592;function qm(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}class ET{constructor(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new On(320),this.work=new On(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}}function AT(e){let t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,function(r){let n;return r&&r.state?(n=r.state,r.total_in=r.total_out=n.total=0,r.msg="",n.wrap&&(r.adler=1&n.wrap),n.mode=o7,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new _f(_T),n.distcode=n.distdyn=new _f(wT),n.sane=1,n.back=-1,er):_r}(e)):_r}function ST(e,t){let r,n;return e?(n=new ET,e.state=n,n.window=null,r=function(s,i){let o,a;return s&&s.state?(a=s.state,i<0?(o=0,i=-i):(o=1+(i>>4),i<48&&(i&=15)),i&&(i<8||i>15)?_r:(a.window!==null&&a.wbits!==i&&(a.window=null),a.wrap=o,a.wbits=i,AT(s))):_r}(e,t),r!==er&&(e.state=null),r):_r}let l0,d0,$m=!0;function PT(e){if($m){let t;for(l0=new _f(512),d0=new _f(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Qu(s7,e.lens,0,288,l0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Qu(a7,e.lens,0,32,d0,0,e.work,{bits:5}),$m=!1}e.lencode=l0,e.lenbits=9,e.distcode=d0,e.distbits=5}function c7(e,t,r,n){let s;const i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new yi(i.wsize)),n>=i.wsize?(wi(i.window,t,r-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),wi(i.window,t,r-n,s,i.wnext),(n-=s)?(wi(i.window,t,r-n,n,0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=s))),0}function TT(e,t){let r,n,s,i,o,a,f,c,l,u,p,d,h,y,g,m,b,w,E,C,R,M,_,A,I=0,P=new yi(4);const v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return _r;r=e.state,r.mode===Oi&&(r.mode=o0),o=e.next_out,s=e.output,f=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,u=a,p=f,M=er;e:for(;;)switch(r.mode){case o7:if(r.wrap===0){r.mode=o0;break}for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(2&r.wrap&&c===35615){r.check=0,P[0]=255&c,P[1]=c>>>8&255,r.check=Ir(r.check,P,2,0),c=0,l=0,r.mode=_m;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=ur;break}if((15&c)!==ro){e.msg="unknown compression method",r.mode=ur;break}if(c>>>=4,l-=4,R=8+(15&c),r.wbits===0)r.wbits=R;else if(R>r.wbits){e.msg="invalid window size",r.mode=ur;break}r.dmax=1<<R,e.adler=r.check=1,r.mode=512&c?Cm:Oi,c=0,l=0;break;case _m:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.flags=c,(255&r.flags)!==ro){e.msg="unknown compression method",r.mode=ur;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=ur;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Ir(r.check,P,2,0)),c=0,l=0,r.mode=wm;case wm:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.time=c),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,P[2]=c>>>16&255,P[3]=c>>>24&255,r.check=Ir(r.check,P,4,0)),c=0,l=0,r.mode=Em;case Em:for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Ir(r.check,P,2,0)),c=0,l=0,r.mode=Am;case Am:if(1024&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(P[0]=255&c,P[1]=c>>>8&255,r.check=Ir(r.check,P,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=Sm;case Sm:if(1024&r.flags&&(d=r.length,d>a&&(d=a),d&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=Array(r.head.extra_len)),wi(r.head.extra,n,i,d,R)),512&r.flags&&(r.check=Ir(r.check,n,d,i)),a-=d,i+=d,r.length-=d),r.length))break e;r.length=0,r.mode=Pm;case Pm:if(2048&r.flags){if(a===0)break e;d=0;do R=n[i+d++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R));while(R&&d<a);if(512&r.flags&&(r.check=Ir(r.check,n,d,i)),a-=d,i+=d,R)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Tm;case Tm:if(4096&r.flags){if(a===0)break e;d=0;do R=n[i+d++],r.head&&R&&r.length<65536&&(r.head.comment+=String.fromCharCode(R));while(R&&d<a);if(512&r.flags&&(r.check=Ir(r.check,n,d,i)),a-=d,i+=d,R)break e}else r.head&&(r.head.comment=null);r.mode=Im;case Im:if(512&r.flags){for(;l<16;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=ur;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Oi;break;case Cm:for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}e.adler=r.check=qm(c),c=0,l=0,r.mode=Af;case Af:if(r.havedict===0)return e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,F8;e.adler=r.check=1,r.mode=Oi;case Oi:if(t===ty||t===nd)break e;case o0:if(r.last){c>>>=7&l,l-=7&l,r.mode=u0;break}for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}switch(r.last=1&c,c>>>=1,l-=1,3&c){case 0:r.mode=Rm;break;case 1:if(PT(r),r.mode=ad,t===nd){c>>>=2,l-=2;break e}break;case 2:r.mode=Mm;break;case 3:e.msg="invalid block type",r.mode=ur}c>>>=2,l-=2;break;case Rm:for(c>>>=7&l,l-=7&l;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=ur;break}if(r.length=65535&c,c=0,l=0,r.mode=c0,t===nd)break e;case c0:r.mode=km;case km:if(d=r.length,d){if(d>a&&(d=a),d>f&&(d=f),d===0)break e;wi(s,n,i,d,o),a-=d,i+=d,f-=d,o+=d,r.length-=d;break}r.mode=Oi;break;case Mm:for(;l<14;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(r.nlen=257+(31&c),c>>>=5,l-=5,r.ndist=1+(31&c),c>>>=5,l-=5,r.ncode=4+(15&c),c>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=ur;break}r.have=0,r.mode=Om;case Om:for(;r.have<r.ncode;){for(;l<3;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.lens[v[r.have++]]=7&c,c>>>=3,l-=3}for(;r.have<19;)r.lens[v[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,_={bits:r.lenbits},M=Qu(bT,r.lens,0,19,r.lencode,0,r.work,_),r.lenbits=_.bits,M){e.msg="invalid code lengths set",r.mode=ur;break}r.have=0,r.mode=Nm;case Nm:for(;r.have<r.nlen+r.ndist;){for(;I=r.lencode[c&(1<<r.lenbits)-1],g=I>>>24,m=I>>>16&255,b=65535&I,!(g<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(b<16)c>>>=g,l-=g,r.lens[r.have++]=b;else{if(b===16){for(A=g+2;l<A;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c>>>=g,l-=g,r.have===0){e.msg="invalid bit length repeat",r.mode=ur;break}R=r.lens[r.have-1],d=3+(3&c),c>>>=2,l-=2}else if(b===17){for(A=g+3;l<A;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=g,l-=g,R=0,d=3+(7&c),c>>>=3,l-=3}else{for(A=g+7;l<A;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=g,l-=g,R=0,d=11+(127&c),c>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=ur;break}for(;d--;)r.lens[r.have++]=R}}if(r.mode===ur)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=ur;break}if(r.lenbits=9,_={bits:r.lenbits},M=Qu(s7,r.lens,0,r.nlen,r.lencode,0,r.work,_),r.lenbits=_.bits,M){e.msg="invalid literal/lengths set",r.mode=ur;break}if(r.distbits=6,r.distcode=r.distdyn,_={bits:r.distbits},M=Qu(a7,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,_),r.distbits=_.bits,M){e.msg="invalid distances set",r.mode=ur;break}if(r.mode=ad,t===nd)break e;case ad:r.mode=od;case od:if(a>=6&&f>=258){e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,pT(e,p),o=e.next_out,s=e.output,f=e.avail_out,i=e.next_in,n=e.input,a=e.avail_in,c=r.hold,l=r.bits,r.mode===Oi&&(r.back=-1);break}for(r.back=0;I=r.lencode[c&(1<<r.lenbits)-1],g=I>>>24,m=I>>>16&255,b=65535&I,!(g<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(m&&!(240&m)){for(w=g,E=m,C=b;I=r.lencode[C+((c&(1<<w+E)-1)>>w)],g=I>>>24,m=I>>>16&255,b=65535&I,!(w+g<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=w,l-=w,r.back+=w}if(c>>>=g,l-=g,r.back+=g,r.length=b,m===0){r.mode=Lm;break}if(32&m){r.back=-1,r.mode=Oi;break}if(64&m){e.msg="invalid literal/length code",r.mode=ur;break}r.extra=15&m,r.mode=Dm;case Dm:if(r.extra){for(A=r.extra;l<A;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=xm;case xm:for(;I=r.distcode[c&(1<<r.distbits)-1],g=I>>>24,m=I>>>16&255,b=65535&I,!(g<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(!(240&m)){for(w=g,E=m,C=b;I=r.distcode[C+((c&(1<<w+E)-1)>>w)],g=I>>>24,m=I>>>16&255,b=65535&I,!(w+g<=l);){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}c>>>=w,l-=w,r.back+=w}if(c>>>=g,l-=g,r.back+=g,64&m){e.msg="invalid distance code",r.mode=ur;break}r.offset=b,r.extra=15&m,r.mode=Um;case Um:if(r.extra){for(A=r.extra;l<A;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=ur;break}r.mode=Bm;case Bm:if(f===0)break e;if(d=p-f,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=ur;break}d>r.wnext?(d-=r.wnext,h=r.wsize-d):h=r.wnext-d,d>r.length&&(d=r.length),y=r.window}else y=s,h=o-r.offset,d=r.length;d>f&&(d=f),f-=d,r.length-=d;do s[o++]=y[h++];while(--d);r.length===0&&(r.mode=od);break;case Lm:if(f===0)break e;s[o++]=r.length,f--,r.mode=od;break;case u0:if(r.wrap){for(;l<32;){if(a===0)break e;a--,c|=n[i++]<<l,l+=8}if(p-=f,e.total_out+=p,r.total+=p,p&&(e.adler=r.check=r.flags?Ir(r.check,s,p,o-p):fl(r.check,s,p,o-p)),p=f,(r.flags?c:qm(c))!==r.check){e.msg="incorrect data check",r.mode=ur;break}c=0,l=0}r.mode=Km;case Km:if(r.wrap&&r.flags){for(;l<32;){if(a===0)break e;a--,c+=n[i++]<<l,l+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=ur;break}c=0,l=0}r.mode=jm;case jm:M=Hi;break e;case ur:M=Qy;break e;default:return _r}return e.next_out=o,e.avail_out=f,e.next_in=i,e.avail_in=a,r.hold=c,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<ur&&(r.mode<u0||t!==Mr))&&c7(e,e.output,e.next_out,p-e.avail_out),u-=e.avail_in,p-=e.avail_out,e.total_in+=u,e.total_out+=p,r.total+=p,r.wrap&&p&&(e.adler=r.check=r.flags?Ir(r.check,s,p,e.next_out-p):fl(r.check,s,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Oi?128:0)+(r.mode===ad||r.mode===c0?256:0),(u===0&&p===0||t===Mr)&&M===er&&(M=Ju),M}function Vm(e,t){const r=t.length;let n,s;return e&&e.state?(n=e.state,n.wrap!==0&&n.mode!==Af?_r:n.mode===Af&&(s=1,s=fl(s,t,r,0),s!==n.check)?Qy:(c7(e,t,r,r),n.havedict=1,er)):_r}class IT{constructor(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}class Fm{constructor(t){this.options={chunkSize:16384,windowBits:0,...t||{}};const r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),!(r.windowBits>=0&&r.windowBits<16)||t&&t.windowBits||(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&!(15&r.windowBits)&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i7,this.strm.avail_out=0;let n=ST(this.strm,r.windowBits);if(n!==er||(this.header=new IT,function(s,i){let o;s&&s.state&&(o=s.state,!(2&o.wrap)||(o.head=i,i.done=!1))}(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=sy(r.dictionary):r.dictionary instanceof ArrayBuffer&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(n=Vm(this.strm,r.dictionary),n!==er))))throw Error(hl[n])}push(t,r){const{strm:n,options:{chunkSize:s,dictionary:i}}=this;let o,a,f=!1;if(this.ended)return!1;a=r===~~r?r:r===!0?Mr:Ei,typeof t=="string"?n.input=function(c){const l=new yi(c.length);for(let u=0,p=l.length;u<p;u++)l[u]=c.charCodeAt(u);return l}(t):t instanceof ArrayBuffer?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new yi(s),n.next_out=0,n.avail_out=s),o=TT(n,Ei),o===F8&&i&&(o=Vm(this.strm,i)),o===Ju&&f===!0&&(o=er,f=!1),o!==Hi&&o!==er)return this.onEnd(o),this.ended=!0,!1;n.next_out&&(n.avail_out!==0&&o!==Hi&&(n.avail_in!==0||a!==Mr&&a!==ol)||this.onData(j8(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(f=!0)}while((n.avail_in>0||n.avail_out===0)&&o!==Hi);return o===Hi&&(a=Mr),a===Mr?(o=function(c){if(!c||!c.state)return _r;const l=c.state;return l.window&&(l.window=null),c.state=null,er}(this.strm),this.onEnd(o),this.ended=!0,o===er):a!==ol||(this.onEnd(er),n.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===er&&(this.result=V8(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}var Hm=[0,1,3,7,15,31,63,127,255],Lu=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};Lu.prototype._ensureByte=function(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)},Lu.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=Hm[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var n=r-e;t|=(this.curByte&Hm[e]<<n)>>n,this.bitOffset+=e,e=0}}return t},Lu.prototype.seek=function(e){var t=e%8,r=(e-t)/8;this.bitOffset=t,this.stream.seek(r),this.hasByte=!1},Lu.prototype.pi=function(){var e,t=new Uint8Array(6);for(e=0;e<t.length;e++)t[e]=this.read(8);return function(r){return Array.prototype.map.call(r,n=>("00"+n.toString(16)).slice(-2)).join("")}(t)};var CT=Lu,ea=function(){};ea.prototype.readByte=function(){throw Error("abstract method readByte() not implemented")},ea.prototype.read=function(e,t,r){for(var n=0;n<r;){var s=this.readByte();if(s<0)return n===0?-1:n;e[t++]=s,n++}return n},ea.prototype.seek=function(e){throw Error("abstract method seek() not implemented")},ea.prototype.writeByte=function(e){throw Error("abstract method readByte() not implemented")},ea.prototype.write=function(e,t,r){var n;for(n=0;n<r;n++)this.writeByte(e[t++]);return r},ea.prototype.flush=function(){};var f0,u7=ea,RT=(f0=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]),function(){var e=4294967295;this.getCRC=function(){return~e>>>0},this.updateCRC=function(t){e=e<<8^f0[255&(e>>>24^t)]},this.updateCRCRun=function(t,r){for(;r-- >0;)e=e<<8^f0[255&(e>>>24^t)]}}),Gm=function(e,t){var r,n=e[t];for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},lr={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},ds={};ds[lr.LAST_BLOCK]="Bad file checksum",ds[lr.NOT_BZIP_DATA]="Not bzip data",ds[lr.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",ds[lr.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",ds[lr.DATA_ERROR]="Data error",ds[lr.OUT_OF_MEMORY]="Out of memory",ds[lr.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var Br=function(e,t){var r=ds[e]||"unknown error";t&&(r+=": "+t);var n=new TypeError(r);throw n.errorCode=e,n},Ku=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};Ku.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new RT,!0):(this.writeCount=-1,!1)},Ku.prototype._start_bunzip=function(e,t){var r=new Uint8Array(4);e.read(r,0,4)===4&&String.fromCharCode(r[0],r[1],r[2])==="BZh"||Br(lr.NOT_BZIP_DATA,"bad magic");var n=r[3]-48;(n<1||n>9)&&Br(lr.NOT_BZIP_DATA,"level out of range"),this.reader=new CT(e),this.dbufSize=1e5*n,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},Ku.prototype._get_next_block=function(){var e,t,r,n=this.reader,s=n.pi();if(s==="177245385090")return!1;s!=="314159265359"&&Br(lr.NOT_BZIP_DATA),this.targetBlockCRC=n.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,n.read(1)&&Br(lr.OBSOLETE_INPUT);var i=n.read(24);i>this.dbufSize&&Br(lr.DATA_ERROR,"initial position out of bounds");var o=n.read(16),a=new Uint8Array(256),f=0;for(e=0;e<16;e++)if(o&1<<15-e){var c=16*e;for(r=n.read(16),t=0;t<16;t++)r&1<<15-t&&(a[f++]=c+t)}var l=n.read(3);(l<2||l>6)&&Br(lr.DATA_ERROR);var u=n.read(15);u===0&&Br(lr.DATA_ERROR);var p=new Uint8Array(256);for(e=0;e<l;e++)p[e]=e;var d=new Uint8Array(u);for(e=0;e<u;e++){for(t=0;n.read(1);t++)t>=l&&Br(lr.DATA_ERROR);d[e]=Gm(p,t)}var h,y=f+2,g=[];for(t=0;t<l;t++){var m,b,w=new Uint8Array(y),E=new Uint16Array(21);for(o=n.read(5),e=0;e<y;e++){for(;(o<1||o>20)&&Br(lr.DATA_ERROR),n.read(1);)n.read(1)?o--:o++;w[e]=o}for(m=b=w[0],e=1;e<y;e++)w[e]>b?b=w[e]:w[e]<m&&(m=w[e]);h={},g.push(h),h.permute=new Uint16Array(258),h.limit=new Uint32Array(22),h.base=new Uint32Array(21),h.minLen=m,h.maxLen=b;var C=0;for(e=m;e<=b;e++)for(E[e]=h.limit[e]=0,o=0;o<y;o++)w[o]===e&&(h.permute[C++]=o);for(e=0;e<y;e++)E[w[e]]++;for(C=o=0,e=m;e<b;e++)C+=E[e],h.limit[e]=C-1,C<<=1,o+=E[e],h.base[e+1]=C-o;h.limit[b+1]=Number.MAX_VALUE,h.limit[b]=C+E[b]-1,h.base[m]=0}var R=new Uint32Array(256);for(e=0;e<256;e++)p[e]=e;var M,_=0,A=0,I=0,P=this.dbuf=new Uint32Array(this.dbufSize);for(y=0;;){for(y--||(y=49,I>=u&&Br(lr.DATA_ERROR),h=g[d[I++]]),e=h.minLen,t=n.read(e);e>h.maxLen&&Br(lr.DATA_ERROR),!(t<=h.limit[e]);e++)t=t<<1|n.read(1);((t-=h.base[e])<0||t>=258)&&Br(lr.DATA_ERROR);var v=h.permute[t];if(v!==0&&v!==1){if(_)for(_=0,A+o>this.dbufSize&&Br(lr.DATA_ERROR),R[M=a[p[0]]]+=o;o--;)P[A++]=M;if(v>f)break;A>=this.dbufSize&&Br(lr.DATA_ERROR),R[M=a[M=Gm(p,e=v-1)]]++,P[A++]=M}else _||(_=1,o=0),o+=v===0?_:2*_,_<<=1}for((i<0||i>=A)&&Br(lr.DATA_ERROR),t=0,e=0;e<256;e++)r=t+R[e],R[e]=t,t=r;for(e=0;e<A;e++)P[R[M=255&P[e]]]|=e<<8,R[M]++;var S=0,T=0,N=0;return A&&(T=255&(S=P[i]),S>>=8,N=-1),this.writePos=S,this.writeCurrent=T,this.writeCount=A,this.writeRun=N,!0},Ku.prototype._read_bunzip=function(e,t){var r,n,s;if(this.writeCount<0)return 0;var i=this.dbuf,o=this.writePos,a=this.writeCurrent,f=this.writeCount;this.outputsize;for(var c=this.writeRun;f;){for(f--,n=a,a=255&(o=i[o]),o>>=8,c++==3?(r=a,s=n,a=-1):(r=1,s=a),this.blockCRC.updateCRCRun(s,r);r--;)this.outputStream.writeByte(s),this.nextoutput++;a!=n&&(c=0)}return this.writeCount=f,this.blockCRC.getCRC()!==this.targetBlockCRC&&Br(lr.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var kT=function(e){if("readByte"in e)return e;var t=new u7;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(r){this.pos=r},t.eof=function(){return this.pos>=e.length},t},MT=function(e){var t=new u7,r=!0;if(e)if(typeof e=="number")t.buffer=new Uint8Array(e),r=!1;else{if("writeByte"in e)return e;t.buffer=e,r=!1}else t.buffer=new Uint8Array(16384);return t.pos=0,t.writeByte=function(n){if(r&&this.pos>=this.buffer.length){var s=new Uint8Array(2*this.buffer.length);s.set(this.buffer),this.buffer=s}this.buffer[this.pos++]=n},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var n=new Uint8Array(this.pos);n.set(this.buffer.subarray(0,this.pos)),this.buffer=n}return this.buffer},t._coerced=!0,t},zm=function(e,t,r){for(var n=kT(e),s=MT(t),i=new Ku(n,s);!("eof"in n)||!n.eof();)if(i._init_block())i._read_bunzip();else{var o=i.reader.read(32)>>>0;if(o!==i.streamCRC&&Br(lr.DATA_ERROR,"Bad stream CRC (got "+i.streamCRC.toString(16)+" expected "+o.toString(16)+")"),!r||!("eof"in n)||n.eof())break;i._start_bunzip(n,s)}if("getBuffer"in s)return s.getBuffer()};class Qi{static get tag(){return j.packet.literalData}constructor(t=new Date){this.format=j.literal.utf8,this.date=X.normalizeDate(t),this.text=null,this.data=null,this.filename=""}setText(t,r=j.literal.utf8){this.format=r,this.text=t,this.data=null}getText(t=!1){return(this.text===null||X.isStream(this.text))&&(this.text=X.decodeUTF8(X.nativeEOL(this.getBytes(t)))),this.text}setBytes(t,r){this.format=r,this.data=t,this.text=null}getBytes(t=!1){return this.data===null&&(this.data=X.canonicalizeEOL(X.encodeUTF8(this.text))),t?Ya(this.data):this.data}setFilename(t){this.filename=t}getFilename(){return this.filename}async read(t){await Xf(t,async r=>{const n=await r.readByte(),s=await r.readByte();this.filename=X.decodeUTF8(await r.readBytes(s)),this.date=X.readDate(await r.readBytes(4));let i=r.remainder();vr(i)&&(i=await mr(i)),this.setBytes(i,n)})}writeHeader(){const t=X.encodeUTF8(this.filename),r=new Uint8Array([t.length]),n=new Uint8Array([this.format]),s=X.writeDate(this.date);return X.concatUint8Array([n,r,t,s])}write(){const t=this.writeHeader(),r=this.getBytes();return X.concat([t,r])}}const ko=Symbol("verified"),OT=new Set([j.signatureSubpacket.issuer,j.signatureSubpacket.issuerFingerprint,j.signatureSubpacket.embeddedSignature]);class Or{static get tag(){return j.packet.signature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.signatureData=null,this.unhashedSubpackets=[],this.signedHashValue=null,this.created=null,this.signatureExpirationTime=null,this.signatureNeverExpires=!0,this.exportable=null,this.trustLevel=null,this.trustAmount=null,this.regularExpression=null,this.revocable=null,this.keyExpirationTime=null,this.keyNeverExpires=null,this.preferredSymmetricAlgorithms=null,this.revocationKeyClass=null,this.revocationKeyAlgorithm=null,this.revocationKeyFingerprint=null,this.issuerKeyID=new Ms,this.rawNotations=[],this.notations={},this.preferredHashAlgorithms=null,this.preferredCompressionAlgorithms=null,this.keyServerPreferences=null,this.preferredKeyServer=null,this.isPrimaryUserID=null,this.policyURI=null,this.keyFlags=null,this.signersUserID=null,this.reasonForRevocationFlag=null,this.reasonForRevocationString=null,this.features=null,this.signatureTargetPublicKeyAlgorithm=null,this.signatureTargetHashAlgorithm=null,this.signatureTargetHash=null,this.embeddedSignature=null,this.issuerKeyVersion=null,this.issuerFingerprint=null,this.preferredAEADAlgorithms=null,this.revoked=null,this[ko]=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new dr(`Version ${this.version} of the signature packet is unsupported.`);if(this.signatureType=t[r++],this.publicKeyAlgorithm=t[r++],this.hashAlgorithm=t[r++],r+=this.readSubPackets(t.subarray(r,t.length),!0),!this.created)throw Error("Missing signature creation time subpacket.");this.signatureData=t.subarray(0,r),r+=this.readSubPackets(t.subarray(r,t.length),!1),this.signedHashValue=t.subarray(r,r+2),r+=2,this.params=yt.signature.parseSignatureParams(this.publicKeyAlgorithm,t.subarray(r,t.length))}writeParams(){return this.params instanceof Promise?rs(async()=>yt.serializeParams(this.publicKeyAlgorithm,await this.params)):yt.serializeParams(this.publicKeyAlgorithm,this.params)}write(){const t=[];return t.push(this.signatureData),t.push(this.writeUnhashedSubPackets()),t.push(this.signedHashValue),t.push(this.writeParams()),X.concat(t)}async sign(t,r,n=new Date,s=!1){t.version===5?this.version=5:this.version=4;const i=[new Uint8Array([this.version,this.signatureType,this.publicKeyAlgorithm,this.hashAlgorithm])];this.created=X.normalizeDate(n),this.issuerKeyVersion=t.version,this.issuerFingerprint=t.getFingerprintBytes(),this.issuerKeyID=t.getKeyID(),i.push(this.writeHashedSubPackets()),this.unhashedSubpackets=[],this.signatureData=X.concat(i);const o=this.toHash(this.signatureType,r,s),a=await this.hash(this.signatureType,r,o,s);this.signedHashValue=jr(ma(a),0,2);const f=async()=>yt.signature.sign(this.publicKeyAlgorithm,this.hashAlgorithm,t.publicParams,t.privateParams,o,await mr(a));X.isStream(a)?this.params=f():(this.params=await f(),this[ko]=!0)}writeHashedSubPackets(){const t=j.signatureSubpacket,r=[];let n;if(this.created===null)throw Error("Missing signature creation time");r.push(sr(t.signatureCreationTime,!0,X.writeDate(this.created))),this.signatureExpirationTime!==null&&r.push(sr(t.signatureExpirationTime,!0,X.writeNumber(this.signatureExpirationTime,4))),this.exportable!==null&&r.push(sr(t.exportableCertification,!0,new Uint8Array([this.exportable?1:0]))),this.trustLevel!==null&&(n=new Uint8Array([this.trustLevel,this.trustAmount]),r.push(sr(t.trustSignature,!0,n))),this.regularExpression!==null&&r.push(sr(t.regularExpression,!0,this.regularExpression)),this.revocable!==null&&r.push(sr(t.revocable,!0,new Uint8Array([this.revocable?1:0]))),this.keyExpirationTime!==null&&r.push(sr(t.keyExpirationTime,!0,X.writeNumber(this.keyExpirationTime,4))),this.preferredSymmetricAlgorithms!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.preferredSymmetricAlgorithms)),r.push(sr(t.preferredSymmetricAlgorithms,!1,n))),this.revocationKeyClass!==null&&(n=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),n=X.concat([n,this.revocationKeyFingerprint]),r.push(sr(t.revocationKey,!1,n))),this.issuerKeyID.isNull()||this.issuerKeyVersion===5||r.push(sr(t.issuer,!0,this.issuerKeyID.write())),this.rawNotations.forEach(({name:o,value:a,humanReadable:f,critical:c})=>{n=[new Uint8Array([f?128:0,0,0,0])];const l=X.encodeUTF8(o);n.push(X.writeNumber(l.length,2)),n.push(X.writeNumber(a.length,2)),n.push(l),n.push(a),n=X.concat(n),r.push(sr(t.notationData,c,n))}),this.preferredHashAlgorithms!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.preferredHashAlgorithms)),r.push(sr(t.preferredHashAlgorithms,!1,n))),this.preferredCompressionAlgorithms!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.preferredCompressionAlgorithms)),r.push(sr(t.preferredCompressionAlgorithms,!1,n))),this.keyServerPreferences!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.keyServerPreferences)),r.push(sr(t.keyServerPreferences,!1,n))),this.preferredKeyServer!==null&&r.push(sr(t.preferredKeyServer,!1,X.encodeUTF8(this.preferredKeyServer))),this.isPrimaryUserID!==null&&r.push(sr(t.primaryUserID,!1,new Uint8Array([this.isPrimaryUserID?1:0]))),this.policyURI!==null&&r.push(sr(t.policyURI,!1,X.encodeUTF8(this.policyURI))),this.keyFlags!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.keyFlags)),r.push(sr(t.keyFlags,!0,n))),this.signersUserID!==null&&r.push(sr(t.signersUserID,!1,X.encodeUTF8(this.signersUserID))),this.reasonForRevocationFlag!==null&&(n=X.stringToUint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),r.push(sr(t.reasonForRevocation,!0,n))),this.features!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.features)),r.push(sr(t.features,!1,n))),this.signatureTargetPublicKeyAlgorithm!==null&&(n=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])],n.push(X.stringToUint8Array(this.signatureTargetHash)),n=X.concat(n),r.push(sr(t.signatureTarget,!0,n))),this.embeddedSignature!==null&&r.push(sr(t.embeddedSignature,!0,this.embeddedSignature.write())),this.issuerFingerprint!==null&&(n=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],n=X.concat(n),r.push(sr(t.issuerFingerprint,this.version===5,n))),this.preferredAEADAlgorithms!==null&&(n=X.stringToUint8Array(X.uint8ArrayToString(this.preferredAEADAlgorithms)),r.push(sr(t.preferredAEADAlgorithms,!1,n)));const s=X.concat(r),i=X.writeNumber(s.length,2);return X.concat([i,s])}writeUnhashedSubPackets(){const t=[];this.unhashedSubpackets.forEach(s=>{t.push(Il(s.length)),t.push(s)});const r=X.concat(t),n=X.writeNumber(r.length,2);return X.concat([n,r])}readSubPacket(t,r=!0){let n=0;const s=!!(128&t[n]),i=127&t[n];if(r||(this.unhashedSubpackets.push(t.subarray(n,t.length)),OT.has(i)))switch(n++,i){case j.signatureSubpacket.signatureCreationTime:this.created=X.readDate(t.subarray(n,t.length));break;case j.signatureSubpacket.signatureExpirationTime:{const o=X.readNumber(t.subarray(n,t.length));this.signatureNeverExpires=o===0,this.signatureExpirationTime=o;break}case j.signatureSubpacket.exportableCertification:this.exportable=t[n++]===1;break;case j.signatureSubpacket.trustSignature:this.trustLevel=t[n++],this.trustAmount=t[n++];break;case j.signatureSubpacket.regularExpression:this.regularExpression=t[n];break;case j.signatureSubpacket.revocable:this.revocable=t[n++]===1;break;case j.signatureSubpacket.keyExpirationTime:{const o=X.readNumber(t.subarray(n,t.length));this.keyExpirationTime=o,this.keyNeverExpires=o===0;break}case j.signatureSubpacket.preferredSymmetricAlgorithms:this.preferredSymmetricAlgorithms=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.revocationKey:this.revocationKeyClass=t[n++],this.revocationKeyAlgorithm=t[n++],this.revocationKeyFingerprint=t.subarray(n,n+20);break;case j.signatureSubpacket.issuer:this.issuerKeyID.read(t.subarray(n,t.length));break;case j.signatureSubpacket.notationData:{const o=!!(128&t[n]);n+=4;const a=X.readNumber(t.subarray(n,n+2));n+=2;const f=X.readNumber(t.subarray(n,n+2));n+=2;const c=X.decodeUTF8(t.subarray(n,n+a)),l=t.subarray(n+a,n+a+f);this.rawNotations.push({name:c,humanReadable:o,value:l,critical:s}),o&&(this.notations[c]=X.decodeUTF8(l));break}case j.signatureSubpacket.preferredHashAlgorithms:this.preferredHashAlgorithms=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.preferredCompressionAlgorithms:this.preferredCompressionAlgorithms=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.keyServerPreferences:this.keyServerPreferences=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.preferredKeyServer:this.preferredKeyServer=X.decodeUTF8(t.subarray(n,t.length));break;case j.signatureSubpacket.primaryUserID:this.isPrimaryUserID=t[n++]!==0;break;case j.signatureSubpacket.policyURI:this.policyURI=X.decodeUTF8(t.subarray(n,t.length));break;case j.signatureSubpacket.keyFlags:this.keyFlags=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.signersUserID:this.signersUserID=X.decodeUTF8(t.subarray(n,t.length));break;case j.signatureSubpacket.reasonForRevocation:this.reasonForRevocationFlag=t[n++],this.reasonForRevocationString=X.decodeUTF8(t.subarray(n,t.length));break;case j.signatureSubpacket.features:this.features=[...t.subarray(n,t.length)];break;case j.signatureSubpacket.signatureTarget:{this.signatureTargetPublicKeyAlgorithm=t[n++],this.signatureTargetHashAlgorithm=t[n++];const o=yt.getHashByteLength(this.signatureTargetHashAlgorithm);this.signatureTargetHash=X.uint8ArrayToString(t.subarray(n,n+o));break}case j.signatureSubpacket.embeddedSignature:this.embeddedSignature=new Or,this.embeddedSignature.read(t.subarray(n,t.length));break;case j.signatureSubpacket.issuerFingerprint:this.issuerKeyVersion=t[n++],this.issuerFingerprint=t.subarray(n,t.length),this.issuerKeyVersion===5?this.issuerKeyID.read(this.issuerFingerprint):this.issuerKeyID.read(this.issuerFingerprint.subarray(-8));break;case j.signatureSubpacket.preferredAEADAlgorithms:this.preferredAEADAlgorithms=[...t.subarray(n,t.length)];break;default:{const o=Error("Unknown signature subpacket type "+i);if(s)throw o;X.printDebug(o)}}}readSubPackets(t,r=!0,n){const s=X.readNumber(t.subarray(0,2));let i=2;for(;i<2+s;){const o=R8(t.subarray(i,t.length));i+=o.offset,this.readSubPacket(t.subarray(i,i+o.len),r,n),i+=o.len}return i}toSign(t,r){const n=j.signature;switch(t){case n.binary:return r.text!==null?X.encodeUTF8(r.getText(!0)):r.getBytes(!0);case n.text:{const s=r.getBytes(!0);return X.canonicalizeEOL(s)}case n.standalone:return new Uint8Array(0);case n.certGeneric:case n.certPersona:case n.certCasual:case n.certPositive:case n.certRevocation:{let s,i;if(r.userID)i=180,s=r.userID;else{if(!r.userAttribute)throw Error("Either a userID or userAttribute packet needs to be supplied for certification.");i=209,s=r.userAttribute}const o=s.write();return X.concat([this.toSign(n.key,r),new Uint8Array([i]),X.writeNumber(o.length,4),o])}case n.subkeyBinding:case n.subkeyRevocation:case n.keyBinding:return X.concat([this.toSign(n.key,r),this.toSign(n.key,{key:r.bind})]);case n.key:if(r.key===void 0)throw Error("Key packet is required for this signature.");return r.key.writeForHash(this.version);case n.keyRevocation:return this.toSign(n.key,r);case n.timestamp:return new Uint8Array(0);case n.thirdParty:throw Error("Not implemented");default:throw Error("Unknown signature type.")}}calculateTrailer(t,r){let n=0;return hr(ma(this.signatureData),s=>{n+=s.length},()=>{const s=[];return this.version!==5||this.signatureType!==j.signature.binary&&this.signatureType!==j.signature.text||(r?s.push(new Uint8Array(6)):s.push(t.writeHeader())),s.push(new Uint8Array([this.version,255])),this.version===5&&s.push(new Uint8Array(4)),s.push(X.writeNumber(n,4)),X.concat(s)})}toHash(t,r,n=!1){const s=this.toSign(t,r);return X.concat([s,this.signatureData,this.calculateTrailer(r,n)])}async hash(t,r,n,s=!1){return n||(n=this.toHash(t,r,s)),yt.hash.digest(this.hashAlgorithm,n)}async verify(t,r,n,s=new Date,i=!1,o=Xe){if(!this.issuerKeyID.equals(t.getKeyID()))throw Error("Signature was not issued by the given public key");if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Public key algorithm used to sign signature does not match issuer key algorithm.");const a=r===j.signature.binary||r===j.signature.text;if(!(this[ko]&&!a)){let c,l;if(this.hashed?l=await this.hashed:(c=this.toHash(r,n,i),l=await this.hash(r,n,c)),l=await mr(l),this.signedHashValue[0]!==l[0]||this.signedHashValue[1]!==l[1])throw Error("Signed digest did not match");if(this.params=await this.params,this[ko]=await yt.signature.verify(this.publicKeyAlgorithm,this.hashAlgorithm,this.params,t.publicParams,c,l),!this[ko])throw Error("Signature verification failed")}const f=X.normalizeDate(s);if(f&&this.created>f)throw Error("Signature creation time is in the future");if(f&&f>=this.getExpirationTime())throw Error("Signature is expired");if(o.rejectHashAlgorithms.has(this.hashAlgorithm))throw Error("Insecure hash algorithm: "+j.read(j.hash,this.hashAlgorithm).toUpperCase());if(o.rejectMessageHashAlgorithms.has(this.hashAlgorithm)&&[j.signature.binary,j.signature.text].includes(this.signatureType))throw Error("Insecure message hash algorithm: "+j.read(j.hash,this.hashAlgorithm).toUpperCase());if(this.rawNotations.forEach(({name:c,critical:l})=>{if(l&&o.knownNotations.indexOf(c)<0)throw Error("Unknown critical notation: "+c)}),this.revocationKeyClass!==null)throw Error("This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.")}isExpired(t=new Date){const r=X.normalizeDate(t);return r!==null&&!(this.created<=r&&r<this.getExpirationTime())}getExpirationTime(){return this.signatureNeverExpires?1/0:new Date(this.created.getTime()+1e3*this.signatureExpirationTime)}}function sr(e,t,r){const n=[];return n.push(Il(r.length+1)),n.push(new Uint8Array([(t?128:0)|e])),n.push(r),X.concat(n)}class Dn{static get tag(){return j.packet.onePassSignature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.issuerKeyID=null,this.flags=null}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new dr(`Version ${this.version} of the one-pass signature packet is unsupported.`);return this.signatureType=t[r++],this.hashAlgorithm=t[r++],this.publicKeyAlgorithm=t[r++],this.issuerKeyID=new Ms,this.issuerKeyID.read(t.subarray(r,r+8)),r+=8,this.flags=t[r++],this}write(){const t=new Uint8Array([3,this.signatureType,this.hashAlgorithm,this.publicKeyAlgorithm]),r=new Uint8Array([this.flags]);return X.concatUint8Array([t,this.issuerKeyID.write(),r])}calculateTrailer(...t){return rs(async()=>Or.prototype.calculateTrailer.apply(await this.correspondingSig,t))}async verify(){const t=await this.correspondingSig;if(!t||t.constructor.tag!==j.packet.signature)throw Error("Corresponding signature packet missing");if(t.signatureType!==this.signatureType||t.hashAlgorithm!==this.hashAlgorithm||t.publicKeyAlgorithm!==this.publicKeyAlgorithm||!t.issuerKeyID.equals(this.issuerKeyID))throw Error("Corresponding signature packet does not match one-pass signature packet");return t.hashed=this.hashed,t.verify.apply(t,arguments)}}function NT(e,t){if(!t[e]){let r;try{r=j.read(j.packet,e)}catch{throw new dr("Unknown packet type with tag: "+e)}throw Error("Packet not allowed in this context: "+r)}return new t[e]}Dn.prototype.hash=Or.prototype.hash,Dn.prototype.toHash=Or.prototype.toHash,Dn.prototype.toSign=Or.prototype.toSign;class Ft extends Array{static async fromBinary(t,r,n=Xe){const s=new Ft;return await s.read(t,r,n),s}async read(t,r,n=Xe){n.additionalAllowedPackets.length&&(r={...r,...X.constructAllowedPackets(n.additionalAllowedPackets)}),this.stream=Ai(t,async(i,o)=>{const a=gn(o);try{for(;;)if(await a.ready,await OP(i,async f=>{try{if(f.tag===j.packet.marker||f.tag===j.packet.trust)return;const c=NT(f.tag,r);c.packets=new Ft,c.fromStream=X.isStream(f.packet),await c.read(f.packet,n),await a.write(c)}catch(c){const l=!n.ignoreUnsupportedPackets&&c instanceof dr,u=!(n.ignoreMalformedPackets||c instanceof dr);if(l||u||Vd(f.tag))await a.abort(c);else{const p=new pf(f.tag,f.packet);await a.write(p)}X.printDebugError(c)}}))return await a.ready,void await a.close()}catch(f){await a.abort(f)}});const s=Ti(this.stream);for(;;){const{done:i,value:o}=await s.read();if(i?this.stream=null:this.push(o),i||Vd(o.constructor.tag))break}s.releaseLock()}write(){const t=[];for(let r=0;r<this.length;r++){const n=this[r]instanceof pf?this[r].tag:this[r].constructor.tag,s=this[r].write();if(X.isStream(s)&&Vd(this[r].constructor.tag)){let i=[],o=0;const a=512;t.push(k8(n)),t.push(hr(s,f=>{if(i.push(f),o+=f.length,o>=a){const c=Math.min(Math.log(o)/Math.LN2|0,30),l=2**c,u=X.concat([MP(c)].concat(i));return i=[u.subarray(1+l)],o=i[0].length,u.subarray(0,1+l)}},()=>X.concat([Il(o)].concat(i))))}else{if(X.isStream(s)){let i=0;t.push(hr(ma(s),o=>{i+=o.length},()=>Hg(n,i)))}else t.push(Hg(n,s.length));t.push(s)}}return X.concat(t)}filterByTag(...t){const r=new Ft,n=s=>i=>s===i;for(let s=0;s<this.length;s++)t.some(n(this[s].constructor.tag))&&r.push(this[s]);return r}findPacket(t){return this.find(r=>r.constructor.tag===t)}indexOfTag(...t){const r=[],n=this,s=i=>o=>i===o;for(let i=0;i<this.length;i++)t.some(s(n[i].constructor.tag))&&r.push(i);return r}}const DT=X.constructAllowedPackets([Qi,Dn,Or]);class lo{static get tag(){return j.packet.compressedData}constructor(t=Xe){this.packets=null,this.algorithm=t.preferredCompressionAlgorithm,this.compressed=null,this.deflateLevel=t.deflateLevel}async read(t,r=Xe){await Xf(t,async n=>{this.algorithm=await n.readByte(),this.compressed=n.remainder(),await this.decompress(r)})}write(){return this.compressed===null&&this.compress(),X.concat([new Uint8Array([this.algorithm]),this.compressed])}async decompress(t=Xe){const r=j.read(j.compression,this.algorithm),n=UT[r];if(!n)throw Error(r+" decompression not supported");this.packets=await Ft.fromBinary(n(this.compressed),DT,t)}compress(){const t=j.read(j.compression,this.algorithm),r=xT[t];if(!r)throw Error(t+" compression not supported");this.compressed=r(this.packets.write(),this.deflateLevel)}}const hi=X.getNodeZlib();function Wm(e){return e}function Sf(e,t,r={}){return function(n){return!X.isStream(n)||vr(n)?rs(()=>mr(n).then(s=>new Promise((i,o)=>{e(s,r,(a,f)=>{if(a)return o(a);i(f)})}))):Zf(Hy(n).pipe(t(r)))}}function Pf(e,t={}){return function(r){const n=new e(t);return hr(r,s=>{if(s.length)return n.push(s,ol),n.result},()=>{if(e===ay)return n.push([],Mr),n.result})}}function Ym(e){return function(t){return rs(async()=>e(await mr(t)))}}const xT=hi?{zip:(e,t)=>Sf(hi.deflateRaw,hi.createDeflateRaw,{level:t})(e),zlib:(e,t)=>Sf(hi.deflate,hi.createDeflate,{level:t})(e)}:{zip:(e,t)=>Pf(ay,{raw:!0,level:t})(e),zlib:(e,t)=>Pf(ay,{level:t})(e)},UT=hi?{uncompressed:Wm,zip:Sf(hi.inflateRaw,hi.createInflateRaw),zlib:Sf(hi.inflate,hi.createInflate),bzip2:Ym(zm)}:{uncompressed:Wm,zip:Pf(Fm,{raw:!0}),zlib:Pf(Fm),bzip2:Ym(zm)},BT=X.constructAllowedPackets([Qi,lo,Dn,Or]);class i2{static get tag(){return j.packet.symEncryptedIntegrityProtectedData}constructor(){this.version=1,this.encrypted=null,this.packets=null}async read(t){await Xf(t,async r=>{const n=await r.readByte();if(n!==1)throw new dr(`Version ${n} of the SEIP packet is unsupported.`);this.encrypted=r.remainder()})}write(){return X.concat([new Uint8Array([1]),this.encrypted])}async encrypt(t,r,n=Xe){const{blockSize:s}=yt.getCipher(t);let i=this.packets.write();vr(i)&&(i=await mr(i));const o=await yt.getPrefixRandom(t),a=new Uint8Array([211,20]),f=X.concat([o,i,a]),c=await yt.hash.sha1(Ya(f)),l=X.concat([f,c]);return this.encrypted=await yt.mode.cfb.encrypt(t,r,l,new Uint8Array(s),n),!0}async decrypt(t,r,n=Xe){const{blockSize:s}=yt.getCipher(t);let i=ma(this.encrypted);vr(i)&&(i=await mr(i));const o=await yt.mode.cfb.decrypt(t,r,i,new Uint8Array(s)),a=jr(Ya(o),-20),f=jr(o,0,-20),c=Promise.all([mr(await yt.hash.sha1(Ya(f))),mr(a)]).then(([p,d])=>{if(!X.equalsUint8Array(p,d))throw Error("Modification detected.");return new Uint8Array}),l=jr(f,s+2);let u=jr(l,0,-2);return u=on([u,rs(()=>c)]),X.isStream(i)&&n.allowUnauthenticatedStream||(u=await mr(u)),this.packets=await Ft.fromBinary(u,BT,n),!0}}const LT=X.constructAllowedPackets([Qi,lo,Dn,Or]);class kl{static get tag(){return j.packet.aeadEncryptedData}constructor(){this.version=1,this.cipherAlgorithm=null,this.aeadAlgorithm=j.aead.eax,this.chunkSizeByte=null,this.iv=null,this.encrypted=null,this.packets=null}async read(t){await Xf(t,async r=>{const n=await r.readByte();if(n!==1)throw new dr(`Version ${n} of the AEAD-encrypted data packet is not supported.`);this.cipherAlgorithm=await r.readByte(),this.aeadAlgorithm=await r.readByte(),this.chunkSizeByte=await r.readByte();const s=yt.getAEADMode(this.aeadAlgorithm);this.iv=await r.readBytes(s.ivLength),this.encrypted=r.remainder()})}write(){return X.concat([new Uint8Array([this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte]),this.iv,this.encrypted])}async decrypt(t,r,n=Xe){this.packets=await Ft.fromBinary(await this.crypt("decrypt",r,ma(this.encrypted)),LT,n)}async encrypt(t,r,n=Xe){this.cipherAlgorithm=t;const{ivLength:s}=yt.getAEADMode(this.aeadAlgorithm);this.iv=yt.random.getRandomBytes(s),this.chunkSizeByte=n.aeadChunkSizeByte;const i=this.packets.write();this.encrypted=await this.crypt("encrypt",r,i)}async crypt(t,r,n){const s=yt.getAEADMode(this.aeadAlgorithm),i=await s(this.cipherAlgorithm,r),o=t==="decrypt"?s.tagLength:0,a=t==="encrypt"?s.tagLength:0,f=2**(this.chunkSizeByte+6)+o,c=new ArrayBuffer(21),l=new Uint8Array(c,0,13),u=new Uint8Array(c),p=new DataView(c),d=new Uint8Array(c,5,8);l.set([192|kl.tag,this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte],0);let h=0,y=Promise.resolve(),g=0,m=0;const b=this.iv;return Ai(n,async(w,E)=>{if(X.isStream(w)!=="array"){const M=new to({},{highWaterMark:X.getHardwareConcurrency()*2**(this.chunkSizeByte+6),size:_=>_.length});Yi(M.readable,E),E=M.writable}const C=Ti(w),R=gn(E);try{for(;;){let M=await C.readBytes(f+o)||new Uint8Array;const _=M.subarray(M.length-o);let A,I;if(M=M.subarray(0,M.length-o),!h||M.length?(C.unshift(_),A=i[t](M,s.getNonce(b,d),l),m+=M.length-o+a):(p.setInt32(17,g),A=i[t](_,s.getNonce(b,d),u),m+=a,I=!0),g+=M.length-o,y=y.then(()=>A).then(async P=>{await R.ready,await R.write(P),m-=P.length}).catch(P=>R.abort(P)),(I||m>R.desiredSize)&&await y,I){await R.close();break}p.setInt32(9,++h)}}catch(M){await R.abort(M)}})}}class Tf{static get tag(){return j.packet.publicKeyEncryptedSessionKey}constructor(){this.version=3,this.publicKeyID=new Ms,this.publicKeyAlgorithm=null,this.sessionKey=null,this.sessionKeyAlgorithm=null,this.encrypted={}}read(t){let r=0;if(this.version=t[r++],this.version!==3)throw new dr(`Version ${this.version} of the PKESK packet is unsupported.`);r+=this.publicKeyID.read(t.subarray(r)),this.publicKeyAlgorithm=t[r++],this.encrypted=yt.parseEncSessionKeyParams(this.publicKeyAlgorithm,t.subarray(r),this.version),this.publicKeyAlgorithm===j.publicKey.x25519&&(this.sessionKeyAlgorithm=j.write(j.symmetric,this.encrypted.C.algorithm))}write(){const t=[new Uint8Array([this.version]),this.publicKeyID.write(),new Uint8Array([this.publicKeyAlgorithm]),yt.serializeParams(this.publicKeyAlgorithm,this.encrypted)];return X.concatUint8Array(t)}async encrypt(t){const r=j.write(j.publicKey,this.publicKeyAlgorithm),n=Jm(this.version,r,this.sessionKeyAlgorithm,this.sessionKey);this.encrypted=await yt.publicKeyEncrypt(r,this.sessionKeyAlgorithm,t.publicParams,n,t.getFingerprintBytes())}async decrypt(t,r){if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Decryption error");const n=r?Jm(this.version,this.publicKeyAlgorithm,r.sessionKeyAlgorithm,r.sessionKey):null,s=await yt.publicKeyDecrypt(this.publicKeyAlgorithm,t.publicParams,t.privateParams,this.encrypted,t.getFingerprintBytes(),n),{sessionKey:i,sessionKeyAlgorithm:o}=function(a,f,c,l){switch(f){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.elgamal:case j.publicKey.ecdh:{const u=c.subarray(0,c.length-2),p=c.subarray(c.length-2),d=X.writeChecksum(u.subarray(u.length%8)),h=d[0]===p[0]&d[1]===p[1],y={sessionKeyAlgorithm:u[0],sessionKey:u.subarray(1)};if(l){const g=h&y.sessionKeyAlgorithm===l.sessionKeyAlgorithm&y.sessionKey.length===l.sessionKey.length;return{sessionKey:X.selectUint8Array(g,y.sessionKey,l.sessionKey),sessionKeyAlgorithm:X.selectUint8(g,y.sessionKeyAlgorithm,l.sessionKeyAlgorithm)}}if(h&&j.read(j.symmetric,y.sessionKeyAlgorithm))return y;throw Error("Decryption error")}case j.publicKey.x25519:return{sessionKey:c};default:throw Error("Unsupported public key algorithm")}}(this.version,this.publicKeyAlgorithm,s,r);this.publicKeyAlgorithm!==j.publicKey.x25519&&(this.sessionKeyAlgorithm=o),this.sessionKey=i}}function Jm(e,t,r,n){switch(t){case j.publicKey.rsaEncrypt:case j.publicKey.rsaEncryptSign:case j.publicKey.elgamal:case j.publicKey.ecdh:return X.concatUint8Array([new Uint8Array([r]),n,X.writeChecksum(n.subarray(n.length%8))]);case j.publicKey.x25519:return n;default:throw Error("Unsupported public key algorithm")}}class el{constructor(t=Xe){this.algorithm=j.hash.sha256,this.type="iterated",this.c=t.s2kIterationCountByte,this.salt=null}getCount(){return 16+(15&this.c)<<6+(this.c>>4)}read(t){let r=0;try{this.type=j.read(j.s2k,t[r++])}catch{throw new dr("Unknown S2K type.")}switch(this.algorithm=t[r++],this.type){case"simple":break;case"salted":this.salt=t.subarray(r,r+8),r+=8;break;case"iterated":this.salt=t.subarray(r,r+8),r+=8,this.c=t[r++];break;case"gnu":if(X.uint8ArrayToString(t.subarray(r,r+3))!=="GNU")throw new dr("Unknown s2k type.");if(r+=3,1e3+t[r++]!==1001)throw new dr("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw new dr("Unknown s2k type.")}return r}write(){if(this.type==="gnu-dummy")return new Uint8Array([101,0,...X.stringToUint8Array("GNU"),1]);const t=[new Uint8Array([j.write(j.s2k,this.type),this.algorithm])];switch(this.type){case"simple":break;case"salted":t.push(this.salt);break;case"iterated":t.push(this.salt),t.push(new Uint8Array([this.c]));break;case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}return X.concatUint8Array(t)}async produceKey(t,r){t=X.encodeUTF8(t);const n=[];let s=0,i=0;for(;s<r;){let o;switch(this.type){case"simple":o=X.concatUint8Array([new Uint8Array(i),t]);break;case"salted":o=X.concatUint8Array([new Uint8Array(i),this.salt,t]);break;case"iterated":{const f=X.concatUint8Array([this.salt,t]);let c=f.length;const l=Math.max(this.getCount(),c);o=new Uint8Array(i+l),o.set(f,i);for(let u=i+c;u<l;u+=c,c*=2)o.copyWithin(u,i,u);break}case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}const a=await yt.hash.digest(this.algorithm,o);n.push(a),s+=a.length,i++}return X.concatUint8Array(n).subarray(0,r)}}class ba{static get tag(){return j.packet.symEncryptedSessionKey}constructor(t=Xe){this.version=t.aeadProtect?5:4,this.sessionKey=null,this.sessionKeyEncryptionAlgorithm=null,this.sessionKeyAlgorithm=j.symmetric.aes256,this.aeadAlgorithm=j.write(j.aead,t.preferredAEADAlgorithm),this.encrypted=null,this.s2k=null,this.iv=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new dr(`Version ${this.version} of the SKESK packet is unsupported.`);const n=t[r++];if(this.version===5&&(this.aeadAlgorithm=t[r++]),this.s2k=new el,r+=this.s2k.read(t.subarray(r,t.length)),this.version===5){const s=yt.getAEADMode(this.aeadAlgorithm);this.iv=t.subarray(r,r+=s.ivLength)}this.version===5||r<t.length?(this.encrypted=t.subarray(r,t.length),this.sessionKeyEncryptionAlgorithm=n):this.sessionKeyAlgorithm=n}write(){const t=this.encrypted===null?this.sessionKeyAlgorithm:this.sessionKeyEncryptionAlgorithm;let r;return this.version===5?r=X.concatUint8Array([new Uint8Array([this.version,t,this.aeadAlgorithm]),this.s2k.write(),this.iv,this.encrypted]):(r=X.concatUint8Array([new Uint8Array([this.version,t]),this.s2k.write()]),this.encrypted!==null&&(r=X.concatUint8Array([r,this.encrypted]))),r}async decrypt(t){const r=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm,{blockSize:n,keySize:s}=yt.getCipher(r),i=await this.s2k.produceKey(t,s);if(this.version===5){const o=yt.getAEADMode(this.aeadAlgorithm),a=new Uint8Array([192|ba.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),f=await o(r,i);this.sessionKey=await f.decrypt(this.encrypted,this.iv,a)}else if(this.encrypted!==null){const o=await yt.mode.cfb.decrypt(r,i,this.encrypted,new Uint8Array(n));this.sessionKeyAlgorithm=j.write(j.symmetric,o[0]),this.sessionKey=o.subarray(1,o.length)}else this.sessionKey=i}async encrypt(t,r=Xe){const n=this.sessionKeyEncryptionAlgorithm!==null?this.sessionKeyEncryptionAlgorithm:this.sessionKeyAlgorithm;this.sessionKeyEncryptionAlgorithm=n,this.s2k=new el(r),this.s2k.salt=yt.random.getRandomBytes(8);const{blockSize:s,keySize:i}=yt.getCipher(n),o=await this.s2k.produceKey(t,i);if(this.sessionKey===null&&(this.sessionKey=yt.generateSessionKey(this.sessionKeyAlgorithm)),this.version===5){const a=yt.getAEADMode(this.aeadAlgorithm);this.iv=yt.random.getRandomBytes(a.ivLength);const f=new Uint8Array([192|ba.tag,this.version,this.sessionKeyEncryptionAlgorithm,this.aeadAlgorithm]),c=await a(n,o);this.encrypted=await c.encrypt(this.sessionKey,this.iv,f)}else{const a=X.concatUint8Array([new Uint8Array([this.sessionKeyAlgorithm]),this.sessionKey]);this.encrypted=await yt.mode.cfb.encrypt(n,o,a,new Uint8Array(s),r)}}}class Wn{static get tag(){return j.packet.publicKey}constructor(t=new Date,r=Xe){this.version=r.v5Keys?5:4,this.created=X.normalizeDate(t),this.algorithm=null,this.publicParams=null,this.expirationTimeV3=0,this.fingerprint=null,this.keyID=null}static fromSecretKeyPacket(t){const r=new Wn,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:f}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=f,r}async read(t){let r=0;if(this.version=t[r++],this.version===4||this.version===5){this.created=X.readDate(t.subarray(r,r+4)),r+=4,this.algorithm=t[r++],this.version===5&&(r+=4);const{read:n,publicParams:s}=yt.parsePublicKeyParams(this.algorithm,t.subarray(r));return this.publicParams=s,r+=n,await this.computeFingerprintAndKeyID(),r}throw new dr(`Version ${this.version} of the key packet is unsupported.`)}write(){const t=[];t.push(new Uint8Array([this.version])),t.push(X.writeDate(this.created)),t.push(new Uint8Array([this.algorithm]));const r=yt.serializeParams(this.algorithm,this.publicParams);return this.version===5&&t.push(X.writeNumber(r.length,4)),t.push(r),X.concatUint8Array(t)}writeForHash(t){const r=this.writePublicKey();return t===5?X.concatUint8Array([new Uint8Array([154]),X.writeNumber(r.length,4),r]):X.concatUint8Array([new Uint8Array([153]),X.writeNumber(r.length,2),r])}isDecrypted(){return null}getCreationTime(){return this.created}getKeyID(){return this.keyID}async computeFingerprintAndKeyID(){if(await this.computeFingerprint(),this.keyID=new Ms,this.version===5)this.keyID.read(this.fingerprint.subarray(0,8));else{if(this.version!==4)throw Error("Unsupported key version");this.keyID.read(this.fingerprint.subarray(12,20))}}async computeFingerprint(){const t=this.writeForHash(this.version);if(this.version===5)this.fingerprint=await yt.hash.sha256(t);else{if(this.version!==4)throw Error("Unsupported key version");this.fingerprint=await yt.hash.sha1(t)}}getFingerprintBytes(){return this.fingerprint}getFingerprint(){return X.uint8ArrayToHex(this.getFingerprintBytes())}hasSameFingerprintAs(t){return this.version===t.version&&X.equalsUint8Array(this.writePublicKey(),t.writePublicKey())}getAlgorithmInfo(){const t={};t.algorithm=j.read(j.publicKey,this.algorithm);const r=this.publicParams.n||this.publicParams.p;return r?t.bits=X.uint8ArrayBitLength(r):this.publicParams.oid&&(t.curve=this.publicParams.oid.getName()),t}}Wn.prototype.readPublicKey=Wn.prototype.read,Wn.prototype.writePublicKey=Wn.prototype.write;const KT=X.constructAllowedPackets([Qi,lo,Dn,Or]);class l7{static get tag(){return j.packet.symmetricallyEncryptedData}constructor(){this.encrypted=null,this.packets=null}read(t){this.encrypted=t}write(){return this.encrypted}async decrypt(t,r,n=Xe){if(!n.allowUnauthenticatedMessages)throw Error("Message is not authenticated.");const{blockSize:s}=yt.getCipher(t),i=await mr(ma(this.encrypted)),o=await yt.mode.cfb.decrypt(t,r,i.subarray(s+2),i.subarray(2,s+2));this.packets=await Ft.fromBinary(o,KT,n)}async encrypt(t,r,n=Xe){const s=this.packets.write(),{blockSize:i}=yt.getCipher(t),o=await yt.getPrefixRandom(t),a=await yt.mode.cfb.encrypt(t,r,o,new Uint8Array(i),n),f=await yt.mode.cfb.encrypt(t,r,s,a.subarray(2),n);this.encrypted=X.concat([a,f])}}class jT{static get tag(){return j.packet.marker}read(t){return t[0]===80&&t[1]===71&&t[2]===80}write(){return new Uint8Array([80,71,80])}}class Ml extends Wn{static get tag(){return j.packet.publicSubkey}constructor(t,r){super(t,r)}static fromSecretSubkeyPacket(t){const r=new Ml,{version:n,created:s,algorithm:i,publicParams:o,keyID:a,fingerprint:f}=t;return r.version=n,r.created=s,r.algorithm=i,r.publicParams=o,r.keyID=a,r.fingerprint=f,r}}class sh{static get tag(){return j.packet.userAttribute}constructor(){this.attributes=[]}read(t){let r=0;for(;r<t.length;){const n=R8(t.subarray(r,t.length));r+=n.offset,this.attributes.push(X.uint8ArrayToString(t.subarray(r,r+n.len))),r+=n.len}}write(){const t=[];for(let r=0;r<this.attributes.length;r++)t.push(Il(this.attributes[r].length)),t.push(X.stringToUint8Array(this.attributes[r]));return X.concatUint8Array(t)}equals(t){return!!(t&&t instanceof sh)&&this.attributes.every(function(r,n){return r===t.attributes[n]})}}class ah extends Wn{static get tag(){return j.packet.secretKey}constructor(t=new Date,r=Xe){super(t,r),this.keyMaterial=null,this.isEncrypted=null,this.s2kUsage=0,this.s2k=null,this.symmetric=null,this.aead=null,this.privateParams=null}async read(t){let r=await this.readPublicKey(t);const n=r;this.s2kUsage=t[r++],this.version===5&&r++;try{if(this.s2kUsage===255||this.s2kUsage===254||this.s2kUsage===253){if(this.symmetric=t[r++],this.s2kUsage===253&&(this.aead=t[r++]),this.s2k=new el,r+=this.s2k.read(t.subarray(r,t.length)),this.s2k.type==="gnu-dummy")return}else this.s2kUsage&&(this.symmetric=this.s2kUsage);this.s2kUsage&&(this.iv=t.subarray(r,r+yt.getCipher(this.symmetric).blockSize),r+=this.iv.length)}catch(s){if(!this.s2kUsage)throw s;this.unparseableKeyMaterial=t.subarray(n),this.isEncrypted=!0}if(this.version===5&&(r+=4),this.keyMaterial=t.subarray(r),this.isEncrypted=!!this.s2kUsage,!this.isEncrypted){const s=this.keyMaterial.subarray(0,-2);if(!X.equalsUint8Array(X.writeChecksum(s),this.keyMaterial.subarray(-2)))throw Error("Key checksum mismatch");try{const{privateParams:i}=yt.parsePrivateKeyParams(this.algorithm,s,this.publicParams);this.privateParams=i}catch(i){throw i instanceof dr?i:Error("Error reading MPIs")}}}write(){const t=this.writePublicKey();if(this.unparseableKeyMaterial)return X.concatUint8Array([t,this.unparseableKeyMaterial]);const r=[t];r.push(new Uint8Array([this.s2kUsage]));const n=[];return this.s2kUsage!==255&&this.s2kUsage!==254&&this.s2kUsage!==253||(n.push(this.symmetric),this.s2kUsage===253&&n.push(this.aead),n.push(...this.s2k.write())),this.s2kUsage&&this.s2k.type!=="gnu-dummy"&&n.push(...this.iv),this.version===5&&r.push(new Uint8Array([n.length])),r.push(new Uint8Array(n)),this.isDummy()||(this.s2kUsage||(this.keyMaterial=yt.serializeParams(this.algorithm,this.privateParams)),this.version===5&&r.push(X.writeNumber(this.keyMaterial.length,4)),r.push(this.keyMaterial),this.s2kUsage||r.push(X.writeChecksum(this.keyMaterial))),X.concatUint8Array(r)}isDecrypted(){return this.isEncrypted===!1}isMissingSecretKeyMaterial(){return this.unparseableKeyMaterial!==void 0||this.isDummy()}isDummy(){return!(!this.s2k||this.s2k.type!=="gnu-dummy")}makeDummy(t=Xe){this.isDummy()||(this.isDecrypted()&&this.clearPrivateParams(),delete this.unparseableKeyMaterial,this.isEncrypted=null,this.keyMaterial=null,this.s2k=new el(t),this.s2k.algorithm=0,this.s2k.c=0,this.s2k.type="gnu-dummy",this.s2kUsage=254,this.symmetric=j.symmetric.aes256)}async encrypt(t,r=Xe){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key packet is already encrypted");if(!t)throw Error("A non-empty passphrase is required for key encryption.");this.s2k=new el(r),this.s2k.salt=yt.random.getRandomBytes(8);const n=yt.serializeParams(this.algorithm,this.privateParams);this.symmetric=j.symmetric.aes256;const s=await Zm(this.s2k,t,this.symmetric),{blockSize:i}=yt.getCipher(this.symmetric);if(this.iv=yt.random.getRandomBytes(i),r.aeadProtect){this.s2kUsage=253,this.aead=j.aead.eax;const o=yt.getAEADMode(this.aead),a=await o(this.symmetric,s);this.keyMaterial=await a.encrypt(n,this.iv.subarray(0,o.ivLength),new Uint8Array)}else this.s2kUsage=254,this.keyMaterial=await yt.mode.cfb.encrypt(this.symmetric,s,X.concatUint8Array([n,await yt.hash.sha1(n,r)]),this.iv,r)}async decrypt(t){if(this.isDummy())return!1;if(this.unparseableKeyMaterial)throw Error("Key packet cannot be decrypted: unsupported S2K or cipher algo");if(this.isDecrypted())throw Error("Key packet is already decrypted.");let r,n;if(this.s2kUsage!==254&&this.s2kUsage!==253)throw this.s2kUsage===255?Error("Encrypted private key is authenticated using an insecure two-byte hash"):Error("Private key is encrypted using an insecure S2K function: unsalted MD5");if(r=await Zm(this.s2k,t,this.symmetric),this.s2kUsage===253){const s=yt.getAEADMode(this.aead),i=await s(this.symmetric,r);try{n=await i.decrypt(this.keyMaterial,this.iv.subarray(0,s.ivLength),new Uint8Array)}catch(o){throw o.message==="Authentication tag mismatch"?Error("Incorrect key passphrase: "+o.message):o}}else{const s=await yt.mode.cfb.decrypt(this.symmetric,r,this.keyMaterial,this.iv);n=s.subarray(0,-20);const i=await yt.hash.sha1(n);if(!X.equalsUint8Array(i,s.subarray(-20)))throw Error("Incorrect key passphrase")}try{const{privateParams:s}=yt.parsePrivateKeyParams(this.algorithm,n,this.publicParams);this.privateParams=s}catch{throw Error("Error reading MPIs")}this.isEncrypted=!1,this.keyMaterial=null,this.s2kUsage=0}async validate(){if(this.isDummy())return;if(!this.isDecrypted())throw Error("Key is not decrypted");let t;try{t=await yt.validateParams(this.algorithm,this.publicParams,this.privateParams)}catch{t=!1}if(!t)throw Error("Key is invalid")}async generate(t,r){const{privateParams:n,publicParams:s}=await yt.generateParams(this.algorithm,t,r);this.privateParams=n,this.publicParams=s,this.isEncrypted=!1}clearPrivateParams(){this.isMissingSecretKeyMaterial()||(Object.keys(this.privateParams).forEach(t=>{this.privateParams[t].fill(0),delete this.privateParams[t]}),this.privateParams=null,this.isEncrypted=!0)}}async function Zm(e,t,r){const{keySize:n}=yt.getCipher(r);return e.produceKey(t,n)}var qT=Ci(function(e){(function(t){function r(s){function i(){return xe<Re}function o(){return xe}function a(we){xe=we}function f(){xe=0,Re=Ne.length}function c(we,Ce){return{name:we,tokens:Ce||"",semantic:Ce||"",children:[]}}function l(we,Ce){var Oe;return Ce===null?null:((Oe=c(we)).tokens=Ce.tokens,Oe.semantic=Ce.semantic,Oe.children.push(Ce),Oe)}function u(we,Ce){return Ce!==null&&(we.tokens+=Ce.tokens,we.semantic+=Ce.semantic),we.children.push(Ce),we}function p(we){var Ce;return i()&&we(Ce=Ne[xe])?(xe+=1,c("token",Ce)):null}function d(we){return function(){return l("literal",p(function(Ce){return Ce===we}))}}function h(){var we=arguments;return function(){var Ce,Oe,Ue,qe;for(qe=o(),Oe=c("and"),Ce=0;Ce<we.length;Ce+=1){if((Ue=we[Ce]())===null)return a(qe),null;u(Oe,Ue)}return Oe}}function y(){var we=arguments;return function(){var Ce,Oe,Ue;for(Ue=o(),Ce=0;Ce<we.length;Ce+=1){if((Oe=we[Ce]())!==null)return Oe;a(Ue)}return null}}function g(we){return function(){var Ce,Oe;return Oe=o(),(Ce=we())!==null?Ce:(a(Oe),c("opt"))}}function m(we){return function(){var Ce=we();return Ce!==null&&(Ce.semantic=""),Ce}}function b(we){return function(){var Ce=we();return Ce!==null&&Ce.semantic.length>0&&(Ce.semantic=" "),Ce}}function w(we,Ce){return function(){var Oe,Ue,qe,K,Y;for(K=o(),Oe=c("star"),qe=0,Y=Ce===void 0?0:Ce;(Ue=we())!==null;)qe+=1,u(Oe,Ue);return qe>=Y?Oe:(a(K),null)}}function E(we){return we.charCodeAt(0)>=128}function C(){return l("cr",d("\r")())}function R(){return l("crlf",h(C,A)())}function M(){return l("dquote",d('"')())}function _(){return l("htab",d(" ")())}function A(){return l("lf",d(`
37
+ `)())}function I(){return l("sp",d(" ")())}function P(){return l("vchar",p(function(we){var Ce=we.charCodeAt(0),Oe=33<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||E(we)),Oe}))}function v(){return l("wsp",y(I,_)())}function S(){var we=l("quoted-pair",y(h(d("\\"),y(P,v)),ce)());return we===null?null:(we.semantic=we.semantic[1],we)}function T(){return l("fws",y(le,h(g(h(w(v),m(R))),w(v,1)))())}function N(){return l("ctext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Oe=33<=Ce&&Ce<=39||42<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||E(we)),Oe})},He)())}function D(){return l("ccontent",y(N,S,O)())}function O(){return l("comment",h(d("("),w(h(g(T),D)),g(T),d(")"))())}function L(){return l("cfws",y(h(w(h(g(T),O),1),g(T)),T)())}function B(){return l("atext",p(function(we){var Ce="a"<=we&&we<="z"||"A"<=we&&we<="Z"||"0"<=we&&we<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(we)>=0;return s.rfc6532&&(Ce=Ce||E(we)),Ce}))}function k(){return l("atom",h(b(g(L)),w(B,1),b(g(L)))())}function q(){var we,Ce;return(we=l("dot-atom-text",w(B,1)()))===null||(Ce=w(h(d("."),w(B,1)))())!==null&&u(we,Ce),we}function W(){return l("dot-atom",h(m(g(L)),q,m(g(L)))())}function re(){return l("qtext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Oe=Ce===33||35<=Ce&&Ce<=91||93<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||E(we)),Oe})},he)())}function ue(){return l("qcontent",y(re,S)())}function H(){return l("quoted-string",h(m(g(L)),m(M),w(h(g(b(T)),ue)),g(m(T)),m(M),m(g(L)))())}function ae(){return l("word",y(k,H)())}function V(){return l("address",y(U,Pe)())}function U(){return l("mailbox",y(te,Fe)())}function te(){return l("name-addr",h(g(Te),ge)())}function ge(){return l("angle-addr",y(h(m(g(L)),d("<"),Fe,d(">"),m(g(L))),fe)())}function Pe(){return l("group",h(Te,d(":"),g(F),d(";"),m(g(L)))())}function Te(){return l("display-name",((we=l("phrase",y(pe,w(ae,1))()))!==null&&(we.semantic=function(Ce){return Ce.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}(we.semantic)),we));var we}function z(){return l("mailbox-list",y(h(U,w(h(d(","),U))),Z)())}function $(){return l("address-list",y(h(V,w(h(d(","),V))),$e)())}function F(){return l("group-list",y(z,m(L),Ve)())}function Q(){return l("local-part",y(Qe,W,H)())}function de(){return l("dtext",y(function(){return p(function(we){var Ce=we.charCodeAt(0),Oe=33<=Ce&&Ce<=90||94<=Ce&&Ce<=126;return s.rfc6532&&(Oe=Oe||E(we)),Oe})},rt)())}function oe(){return l("domain-literal",h(m(g(L)),d("["),w(h(g(T),de)),g(T),d("]"),m(g(L)))())}function ne(){return l("domain",(we=y(dt,W,oe)(),s.rejectTLD&&we&&we.semantic&&we.semantic.indexOf(".")<0?null:(we&&(we.semantic=we.semantic.replace(/\s+/g,"")),we)));var we}function Fe(){return l("addr-spec",h(Q,d("@"),ne)())}function je(){return s.strict?null:l("obs-NO-WS-CTL",p(function(we){var Ce=we.charCodeAt(0);return 1<=Ce&&Ce<=8||Ce===11||Ce===12||14<=Ce&&Ce<=31||Ce===127}))}function He(){return s.strict?null:l("obs-ctext",je())}function he(){return s.strict?null:l("obs-qtext",je())}function ce(){return s.strict?null:l("obs-qp",h(d("\\"),y(d("\0"),je,A,C))())}function pe(){return s.strict?null:s.atInDisplayName?l("obs-phrase",h(ae,w(y(ae,d("."),d("@"),b(L))))()):l("obs-phrase",h(ae,w(y(ae,d("."),b(L))))())}function le(){return s.strict?null:l("obs-FWS",w(h(m(g(R)),v),1)())}function fe(){return s.strict?null:l("obs-angle-addr",h(m(g(L)),d("<"),ye,Fe,d(">"),m(g(L)))())}function ye(){return s.strict?null:l("obs-route",h(ee,d(":"))())}function ee(){return s.strict?null:l("obs-domain-list",h(w(y(m(L),d(","))),d("@"),ne,w(h(d(","),m(g(L)),g(h(d("@"),ne)))))())}function Z(){return s.strict?null:l("obs-mbox-list",h(w(h(m(g(L)),d(","))),U,w(h(d(","),g(h(U,m(L))))))())}function $e(){return s.strict?null:l("obs-addr-list",h(w(h(m(g(L)),d(","))),V,w(h(d(","),g(h(V,m(L))))))())}function Ve(){return s.strict?null:l("obs-group-list",h(w(h(m(g(L)),d(",")),1),m(g(L)))())}function Qe(){return s.strict?null:l("obs-local-part",h(ae,w(h(d("."),ae)))())}function dt(){return s.strict?null:l("obs-domain",h(k,w(h(d("."),k)))())}function rt(){return s.strict?null:l("obs-dtext",y(je,S)())}function ve(we,Ce){var Oe,Ue,qe;if(Ce==null)return null;for(Ue=[Ce];Ue.length>0;){if((qe=Ue.pop()).name===we)return qe;for(Oe=qe.children.length-1;Oe>=0;Oe-=1)Ue.push(qe.children[Oe])}return null}function G(we,Ce){var Oe,Ue,qe,K,Y;if(Ce==null)return null;for(Ue=[Ce],K=[],Y={},Oe=0;Oe<we.length;Oe+=1)Y[we[Oe]]=!0;for(;Ue.length>0;)if((qe=Ue.pop()).name in Y)K.push(qe);else for(Oe=qe.children.length-1;Oe>=0;Oe-=1)Ue.push(qe.children[Oe]);return K}function se(we){var Ce,Oe,Ue,qe,K;if(we===null)return null;for(Ce=[],Oe=G(["group","mailbox"],we),Ue=0;Ue<Oe.length;Ue+=1)(qe=Oe[Ue]).name==="group"?Ce.push(me(qe)):qe.name==="mailbox"&&Ce.push(Se(qe));return K={ast:we,addresses:Ce},s.simple&&(K=function(Y){var J;if(Y&&Y.addresses)for(J=0;J<Y.addresses.length;J+=1)delete Y.addresses[J].node;return Y}(K)),s.oneResult?function(Y){return!Y||!s.partial&&Y.addresses.length>1?null:Y.addresses&&Y.addresses[0]}(K):s.simple?K&&K.addresses:K}function me(we){var Ce,Oe=ve("display-name",we),Ue=[],qe=G(["mailbox"],we);for(Ce=0;Ce<qe.length;Ce+=1)Ue.push(Se(qe[Ce]));return{node:we,parts:{name:Oe},type:we.name,name:Ae(Oe),addresses:Ue}}function Se(we){var Ce=ve("display-name",we),Oe=ve("addr-spec",we),Ue=function(J,x){var ie,Ee,Ie,De;if(x==null)return null;for(Ee=[x],De=[];Ee.length>0;)for((Ie=Ee.pop()).name===J&&De.push(Ie),ie=Ie.children.length-1;ie>=0;ie-=1)Ee.push(Ie.children[ie]);return De}("cfws",we),qe=G(["comment"],we),K=ve("local-part",Oe),Y=ve("domain",Oe);return{node:we,parts:{name:Ce,address:Oe,local:K,domain:Y,comments:Ue},type:we.name,name:Ae(Ce),address:Ae(Oe),local:Ae(K),domain:Ae(Y),comments:ke(qe),groupName:Ae(we.groupName)}}function Ae(we){return we!=null?we.semantic:null}function ke(we){var Ce="";if(we)for(var Oe=0;Oe<we.length;Oe+=1)Ce+=Ae(we[Oe]);return Ce}var Ne,xe,Re,Me,et;if((s=n(s,{}))===null)return null;if(Ne=s.input,et={address:V,"address-list":$,"angle-addr":ge,from:function(){return l("from",y(z,$)())},group:Pe,mailbox:U,"mailbox-list":z,"reply-to":function(){return l("reply-to",$())},sender:function(){return l("sender",y(U,V)())}}[s.startAt]||$,!s.strict){if(f(),s.strict=!0,Me=et(Ne),s.partial||!i())return se(Me);s.strict=!1}return f(),Me=et(Ne),!s.partial&&i()?null:se(Me)}function n(s,i){function o(l){return Object.prototype.toString.call(l)==="[object String]"}function a(l){return l==null}var f,c;if(o(s))s={input:s};else if(!function(l){return l===Object(l)}(s))return null;if(!o(s.input)||!i)return null;for(c in f={oneResult:!1,partial:!1,rejectTLD:!1,rfc6532:!1,simple:!1,startAt:"address-list",strict:!1,atInDisplayName:!1})a(s[c])&&(s[c]=a(i[c])?f[c]:i[c]);return s}r.parseOneAddress=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseAddressList=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"address-list"}))},r.parseFrom=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"from"}))},r.parseSender=function(s){return r(n(s,{oneResult:!0,rfc6532:!0,simple:!0,startAt:"sender"}))},r.parseReplyTo=function(s){return r(n(s,{rfc6532:!0,simple:!0,startAt:"reply-to"}))},e.exports=r})()});class Ol{static get tag(){return j.packet.userID}constructor(){this.userID="",this.name="",this.email="",this.comment=""}static fromObject(t){if(X.isString(t)||t.name&&!X.isString(t.name)||t.email&&!X.isEmailAddress(t.email)||t.comment&&!X.isString(t.comment))throw Error("Invalid user ID format");const r=new Ol;Object.assign(r,t);const n=[];return r.name&&n.push(r.name),r.comment&&n.push(`(${r.comment})`),r.email&&n.push(`<${r.email}>`),r.userID=n.join(" "),r}read(t,r=Xe){const n=X.decodeUTF8(t);if(n.length>r.maxUserIDLength)throw Error("User ID string is too long");try{const{name:s,address:i,comments:o}=qT.parseOneAddress({input:n,atInDisplayName:!0});this.comment=o.replace(/^\(|\)$/g,""),this.name=s,this.email=i}catch{}this.userID=n}write(){return X.encodeUTF8(this.userID)}equals(t){return t&&t.userID===this.userID}}class s2 extends ah{static get tag(){return j.packet.secretSubkey}constructor(t=new Date,r=Xe){super(t,r)}}class $T{static get tag(){return j.packet.trust}read(){throw new dr("Trust packets are not supported")}write(){throw new dr("Trust packets are not supported")}}const VT=X.constructAllowedPackets([Or]);class Rs{constructor(t){this.packets=t||new Ft}write(){return this.packets.write()}armor(t=Xe){return Ea(j.armor.signature,this.write(),void 0,void 0,void 0,t)}getSigningKeyIDs(){return this.packets.map(t=>t.issuerKeyID)}}async function FT({armoredSignature:e,binarySignature:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readSignature: must pass options object containing `armoredSignature` or `binarySignature`");if(e&&!X.isString(e))throw Error("readSignature: options.armoredSignature must be a string");if(t&&!X.isUint8Array(t))throw Error("readSignature: options.binarySignature must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:a,data:f}=await Ii(s,r);if(a!==j.armor.signature)throw Error("Armored text not of type signature");s=f}const o=await Ft.fromBinary(s,VT,r);return new Rs(o)}async function d7(e,t){const r=new s2(e.date,t);return r.packets=null,r.algorithm=j.write(j.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve),await r.computeFingerprintAndKeyID(),r}async function HT(e,t){const r=new ah(e.date,t);return r.packets=null,r.algorithm=j.write(j.publicKey,e.algorithm),await r.generate(e.rsaBits,e.curve,e.config),await r.computeFingerprintAndKeyID(),r}async function zn(e,t,r,n,s=new Date,i){let o,a;for(let f=e.length-1;f>=0;f--)try{(!o||e[f].created>=o.created)&&(await e[f].verify(t,r,n,s,void 0,i),o=e[f])}catch(c){a=c}if(!o)throw X.wrapError(`Could not find valid ${j.read(j.signature,r)} signature in key ${t.getKeyID().toHex()}`.replace("certGeneric ","self-").replace(/([a-z])([A-Z])/g,(f,c,l)=>c+" "+l.toLowerCase()),a);return o}function oy(e,t,r=new Date){const n=X.normalizeDate(r);if(n!==null){const s=If(e,t);return!(e.created<=n&&n<s)}return!1}async function f7(e,t,r,n){const s={};s.key=t,s.bind=e;const i={signatureType:j.signature.subkeyBinding};return r.sign?(i.keyFlags=[j.keyFlags.signData],i.embeddedSignature=await es(s,null,e,{signatureType:j.signature.keyBinding},r.date,void 0,void 0,void 0,n)):i.keyFlags=[j.keyFlags.encryptCommunication|j.keyFlags.encryptStorage],r.keyExpirationTime>0&&(i.keyExpirationTime=r.keyExpirationTime,i.keyNeverExpires=!1),await es(s,null,t,i,r.date,void 0,void 0,void 0,n)}async function h7(e,t,r=new Date,n={},s){let i=s.preferredHashAlgorithm,o=i;if(e){const a=await e.getPrimaryUser(r,n,s);a.selfCertification.preferredHashAlgorithms&&([o]=a.selfCertification.preferredHashAlgorithms,i=yt.hash.getHashByteLength(i)<=yt.hash.getHashByteLength(o)?o:i)}switch(t.algorithm){case j.publicKey.ecdsa:case j.publicKey.eddsaLegacy:case j.publicKey.ed25519:o=yt.getPreferredCurveHashAlgo(t.algorithm,t.publicParams.oid)}return yt.hash.getHashByteLength(i)<=yt.hash.getHashByteLength(o)?o:i}async function cy(e,t=[],r=new Date,n=[],s=Xe){const i={symmetric:j.symmetric.aes128,aead:j.aead.eax,compression:j.compression.uncompressed}[e],o={symmetric:s.preferredSymmetricAlgorithm,aead:s.preferredAEADAlgorithm,compression:s.preferredCompressionAlgorithm}[e],a={symmetric:"preferredSymmetricAlgorithms",aead:"preferredAEADAlgorithms",compression:"preferredCompressionAlgorithms"}[e];return(await Promise.all(t.map(async function(c,l){const u=(await c.getPrimaryUser(r,n[l],s)).selfCertification[a];return!!u&&u.indexOf(o)>=0}))).every(Boolean)?o:i}async function es(e,t,r,n,s,i,o=[],a=!1,f){if(r.isDummy())throw Error("Cannot sign with a gnu-dummy key.");if(!r.isDecrypted())throw Error("Signing key is not decrypted.");const c=new Or;return Object.assign(c,n),c.publicKeyAlgorithm=r.algorithm,c.hashAlgorithm=await h7(t,r,s,i,f),c.rawNotations=o,await c.sign(r,e,s,a),c}async function fa(e,t,r,n=new Date,s){(e=e[r])&&(t[r].length?await Promise.all(e.map(async function(i){i.isExpired(n)||s&&!await s(i)||t[r].some(function(o){return X.equalsUint8Array(o.writeParams(),i.writeParams())})||t[r].push(i)})):t[r]=e)}async function no(e,t,r,n,s,i,o=new Date,a){i=i||e;const f=[];return await Promise.all(n.map(async function(c){try{s&&!c.issuerKeyID.equals(s.issuerKeyID)||(await c.verify(i,t,r,a.revocationsExpire?o:null,!1,a),f.push(c.issuerKeyID))}catch{}})),s?(s.revoked=!!f.some(c=>c.equals(s.issuerKeyID))||s.revoked||!1,s.revoked):f.length>0}function If(e,t){let r;return t.keyNeverExpires===!1&&(r=e.created.getTime()+1e3*t.keyExpirationTime),r?new Date(r):1/0}function uy(e,t={}){switch(e.type=e.type||t.type,e.curve=e.curve||t.curve,e.rsaBits=e.rsaBits||t.rsaBits,e.keyExpirationTime=e.keyExpirationTime!==void 0?e.keyExpirationTime:t.keyExpirationTime,e.passphrase=X.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e.sign=e.sign||!1,e.type){case"ecc":try{e.curve=j.write(j.curve,e.curve)}catch{throw Error("Unknown curve")}e.curve!==j.curve.ed25519Legacy&&e.curve!==j.curve.curve25519Legacy||(e.curve=e.sign?j.curve.ed25519Legacy:j.curve.curve25519Legacy),e.sign?e.algorithm=e.curve===j.curve.ed25519Legacy?j.publicKey.eddsaLegacy:j.publicKey.ecdsa:e.algorithm=j.publicKey.ecdh;break;case"rsa":e.algorithm=j.publicKey.rsaEncryptSign;break;default:throw Error("Unsupported key type "+e.type)}return e}function Xm(e,t){const r=e.algorithm;return r!==j.publicKey.rsaEncrypt&&r!==j.publicKey.elgamal&&r!==j.publicKey.ecdh&&r!==j.publicKey.x25519&&(!t.keyFlags||(t.keyFlags[0]&j.keyFlags.signData)!=0)}function Qm(e,t){const r=e.algorithm;return r!==j.publicKey.dsa&&r!==j.publicKey.rsaSign&&r!==j.publicKey.ecdsa&&r!==j.publicKey.eddsaLegacy&&r!==j.publicKey.ed25519&&(!t.keyFlags||(t.keyFlags[0]&j.keyFlags.encryptCommunication)!=0||(t.keyFlags[0]&j.keyFlags.encryptStorage)!=0)}function e3(e,t){return!!t.allowInsecureDecryptionWithSigningKeys||!e.keyFlags||(e.keyFlags[0]&j.keyFlags.encryptCommunication)!=0||(e.keyFlags[0]&j.keyFlags.encryptStorage)!=0}function $a(e,t){const r=j.write(j.publicKey,e.algorithm),n=e.getAlgorithmInfo();if(t.rejectPublicKeyAlgorithms.has(r))throw Error(n.algorithm+" keys are considered too weak.");switch(r){case j.publicKey.rsaEncryptSign:case j.publicKey.rsaSign:case j.publicKey.rsaEncrypt:if(n.bits<t.minRSABits)throw Error(`RSA keys shorter than ${t.minRSABits} bits are considered too weak.`);break;case j.publicKey.ecdsa:case j.publicKey.eddsaLegacy:case j.publicKey.ecdh:if(t.rejectCurves.has(n.curve))throw Error(`Support for ${n.algorithm} keys using curve ${n.curve} is disabled.`)}}class tl{constructor(t,r){this.userID=t.constructor.tag===j.packet.userID?t:null,this.userAttribute=t.constructor.tag===j.packet.userAttribute?t:null,this.selfCertifications=[],this.otherCertifications=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Ft;return t.push(this.userID||this.userAttribute),t.push(...this.revocationSignatures),t.push(...this.selfCertifications),t.push(...this.otherCertifications),t}clone(){const t=new tl(this.userID||this.userAttribute,this.mainKey);return t.selfCertifications=[...this.selfCertifications],t.otherCertifications=[...this.otherCertifications],t.revocationSignatures=[...this.revocationSignatures],t}async certify(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s},o=new tl(i.userID||i.userAttribute,this.mainKey);return o.otherCertifications=await Promise.all(t.map(async function(a){if(!a.isPrivate())throw Error("Need private key for signing");if(a.hasSameFingerprintAs(s))throw Error("The user's own key can only be used for self-certifications");const f=await a.getSigningKey(void 0,r,void 0,n);return es(i,a,f.keyPacket,{signatureType:j.signature.certGeneric,keyFlags:[j.keyFlags.certifyKeys|j.keyFlags.signData]},r,void 0,void 0,void 0,n)})),await o.update(this,r,n),o}async isRevoked(t,r,n=new Date,s=Xe){const i=this.mainKey.keyPacket;return no(i,j.signature.certRevocation,{key:i,userID:this.userID,userAttribute:this.userAttribute},this.revocationSignatures,t,r,n,s)}async verifyCertificate(t,r,n=new Date,s){const i=this,o=this.mainKey.keyPacket,a={userID:this.userID,userAttribute:this.userAttribute,key:o},{issuerKeyID:f}=t,c=r.filter(l=>l.getKeys(f).length>0);return c.length===0?null:(await Promise.all(c.map(async l=>{const u=await l.getSigningKey(f,t.created,void 0,s);if(t.revoked||await i.isRevoked(t,u.keyPacket,n,s))throw Error("User certificate is revoked");try{await t.verify(u.keyPacket,j.signature.certGeneric,a,n,void 0,s)}catch(p){throw X.wrapError("User certificate is invalid",p)}})),!0)}async verifyAllCertifications(t,r=new Date,n){const s=this,i=this.selfCertifications.concat(this.otherCertifications);return Promise.all(i.map(async o=>({keyID:o.issuerKeyID,valid:await s.verifyCertificate(o,t,r,n).catch(()=>!1)})))}async verify(t=new Date,r){if(!this.selfCertifications.length)throw Error("No self-certifications found");const n=this,s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};let o;for(let a=this.selfCertifications.length-1;a>=0;a--)try{const f=this.selfCertifications[a];if(f.revoked||await n.isRevoked(f,void 0,t,r))throw Error("Self-certification is revoked");try{await f.verify(s,j.signature.certGeneric,i,t,void 0,r)}catch(c){throw X.wrapError("Self-certification is invalid",c)}return!0}catch(f){o=f}throw o}async update(t,r,n){const s=this.mainKey.keyPacket,i={userID:this.userID,userAttribute:this.userAttribute,key:s};await fa(t,this,"selfCertifications",r,async function(o){try{return await o.verify(s,j.signature.certGeneric,i,r,!1,n),!0}catch{return!1}}),await fa(t,this,"otherCertifications",r),await fa(t,this,"revocationSignatures",r,function(o){return no(s,j.signature.certRevocation,i,[o],void 0,void 0,r,n)})}async revoke(t,{flag:r=j.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Xe){const o={userID:this.userID,userAttribute:this.userAttribute,key:t},a=new tl(o.userID||o.userAttribute,this.mainKey);return a.revocationSignatures.push(await es(o,null,t,{signatureType:j.signature.certRevocation,reasonForRevocationFlag:j.write(j.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}}class _a{constructor(t,r){this.keyPacket=t,this.bindingSignatures=[],this.revocationSignatures=[],this.mainKey=r}toPacketList(){const t=new Ft;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.bindingSignatures),t}clone(){const t=new _a(this.keyPacket,this.mainKey);return t.bindingSignatures=[...this.bindingSignatures],t.revocationSignatures=[...this.revocationSignatures],t}async isRevoked(t,r,n=new Date,s=Xe){const i=this.mainKey.keyPacket;return no(i,j.signature.subkeyRevocation,{key:i,bind:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verify(t=new Date,r=Xe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket},i=await zn(this.bindingSignatures,n,j.signature.subkeyBinding,s,t,r);if(i.revoked||await this.isRevoked(i,null,t,r))throw Error("Subkey is revoked");if(oy(this.keyPacket,i,t))throw Error("Subkey is expired");return i}async getExpirationTime(t=new Date,r=Xe){const n=this.mainKey.keyPacket,s={key:n,bind:this.keyPacket};let i;try{i=await zn(this.bindingSignatures,n,j.signature.subkeyBinding,s,t,r)}catch{return null}const o=If(this.keyPacket,i),a=i.getExpirationTime();return o<a?o:a}async update(t,r=new Date,n=Xe){const s=this.mainKey.keyPacket;if(!this.hasSameFingerprintAs(t))throw Error("Subkey update method: fingerprints of subkeys not equal");this.keyPacket.constructor.tag===j.packet.publicSubkey&&t.keyPacket.constructor.tag===j.packet.secretSubkey&&(this.keyPacket=t.keyPacket);const i=this,o={key:s,bind:i.keyPacket};await fa(t,this,"bindingSignatures",r,async function(a){for(let f=0;f<i.bindingSignatures.length;f++)if(i.bindingSignatures[f].issuerKeyID.equals(a.issuerKeyID))return a.created>i.bindingSignatures[f].created&&(i.bindingSignatures[f]=a),!1;try{return await a.verify(s,j.signature.subkeyBinding,o,r,void 0,n),!0}catch{return!1}}),await fa(t,this,"revocationSignatures",r,function(a){return no(s,j.signature.subkeyRevocation,o,[a],void 0,void 0,r,n)})}async revoke(t,{flag:r=j.reasonForRevocation.noReason,string:n=""}={},s=new Date,i=Xe){const o={key:t,bind:this.keyPacket},a=new _a(this.keyPacket,this.mainKey);return a.revocationSignatures.push(await es(o,null,t,{signatureType:j.signature.subkeyRevocation,reasonForRevocationFlag:j.write(j.reasonForRevocation,r),reasonForRevocationString:n},s,void 0,void 0,!1,i)),await a.update(this),a}hasSameFingerprintAs(t){return this.keyPacket.hasSameFingerprintAs(t.keyPacket||t)}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach(e=>{_a.prototype[e]=function(){return this.keyPacket[e]()}});const GT=X.constructAllowedPackets([Or]),t3=new Set([j.packet.publicKey,j.packet.privateKey]),r3=new Set([j.packet.publicKey,j.packet.privateKey,j.packet.publicSubkey,j.packet.privateSubkey]);class p7{packetListToStructure(t,r=new Set){let n,s,i,o;for(const a of t){if(a instanceof pf){r3.has(a.tag)&&!o&&(o=t3.has(a.tag)?t3:r3);continue}const f=a.constructor.tag;if(o){if(!o.has(f))continue;o=null}if(r.has(f))throw Error("Unexpected packet type: "+f);switch(f){case j.packet.publicKey:case j.packet.secretKey:if(this.keyPacket)throw Error("Key block contains multiple keys");if(this.keyPacket=a,s=this.getKeyID(),!s)throw Error("Missing Key ID");break;case j.packet.userID:case j.packet.userAttribute:n=new tl(a,this),this.users.push(n);break;case j.packet.publicSubkey:case j.packet.secretSubkey:n=null,i=new _a(a,this),this.subkeys.push(i);break;case j.packet.signature:switch(a.signatureType){case j.signature.certGeneric:case j.signature.certPersona:case j.signature.certCasual:case j.signature.certPositive:if(!n){X.printDebug("Dropping certification signatures without preceding user packet");continue}a.issuerKeyID.equals(s)?n.selfCertifications.push(a):n.otherCertifications.push(a);break;case j.signature.certRevocation:n?n.revocationSignatures.push(a):this.directSignatures.push(a);break;case j.signature.key:this.directSignatures.push(a);break;case j.signature.subkeyBinding:if(!i){X.printDebug("Dropping subkey binding signature without preceding subkey packet");continue}i.bindingSignatures.push(a);break;case j.signature.keyRevocation:this.revocationSignatures.push(a);break;case j.signature.subkeyRevocation:if(!i){X.printDebug("Dropping subkey revocation signature without preceding subkey packet");continue}i.revocationSignatures.push(a)}}}}toPacketList(){const t=new Ft;return t.push(this.keyPacket),t.push(...this.revocationSignatures),t.push(...this.directSignatures),this.users.map(r=>t.push(...r.toPacketList())),this.subkeys.map(r=>t.push(...r.toPacketList())),t}clone(t=!1){const r=new this.constructor(this.toPacketList());return t&&r.getKeys().forEach(n=>{if(n.keyPacket=Object.create(Object.getPrototypeOf(n.keyPacket),Object.getOwnPropertyDescriptors(n.keyPacket)),!n.keyPacket.isDecrypted())return;const s={};Object.keys(n.keyPacket.privateParams).forEach(i=>{s[i]=new Uint8Array(n.keyPacket.privateParams[i])}),n.keyPacket.privateParams=s}),r}getSubkeys(t=null){return this.subkeys.filter(r=>!t||r.getKeyID().equals(t,!0))}getKeys(t=null){const r=[];return t&&!this.getKeyID().equals(t,!0)||r.push(this),r.concat(this.getSubkeys(t))}getKeyIDs(){return this.getKeys().map(t=>t.getKeyID())}getUserIDs(){return this.users.map(t=>t.userID?t.userID.userID:null).filter(t=>t!==null)}write(){return this.toPacketList().write()}async getSigningKey(t=null,r=new Date,n={},s=Xe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((f,c)=>c.keyPacket.created-f.keyPacket.created);let a;for(const f of o)if(!t||f.getKeyID().equals(t))try{await f.verify(r,s);const c={key:i,bind:f.keyPacket},l=await zn(f.bindingSignatures,i,j.signature.subkeyBinding,c,r,s);if(!Xm(f.keyPacket,l))continue;if(!l.embeddedSignature)throw Error("Missing embedded signature");return await zn([l.embeddedSignature],f.keyPacket,j.signature.keyBinding,c,r,s),$a(f.keyPacket,s),f}catch(c){a=c}try{const f=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&Xm(i,f.selfCertification))return $a(i,s),this}catch(f){a=f}throw X.wrapError("Could not find valid signing key packet in key "+this.getKeyID().toHex(),a)}async getEncryptionKey(t,r=new Date,n={},s=Xe){await this.verifyPrimaryKey(r,n,s);const i=this.keyPacket,o=this.subkeys.slice().sort((f,c)=>c.keyPacket.created-f.keyPacket.created);let a;for(const f of o)if(!t||f.getKeyID().equals(t))try{await f.verify(r,s);const c={key:i,bind:f.keyPacket},l=await zn(f.bindingSignatures,i,j.signature.subkeyBinding,c,r,s);if(Qm(f.keyPacket,l))return $a(f.keyPacket,s),f}catch(c){a=c}try{const f=await this.getPrimaryUser(r,n,s);if((!t||i.getKeyID().equals(t))&&Qm(i,f.selfCertification))return $a(i,s),this}catch(f){a=f}throw X.wrapError("Could not find valid encryption key packet in key "+this.getKeyID().toHex(),a)}async isRevoked(t,r,n=new Date,s=Xe){return no(this.keyPacket,j.signature.keyRevocation,{key:this.keyPacket},this.revocationSignatures,t,r,n,s)}async verifyPrimaryKey(t=new Date,r={},n=Xe){const s=this.keyPacket;if(await this.isRevoked(null,null,t,n))throw Error("Primary key is revoked");const{selfCertification:i}=await this.getPrimaryUser(t,r,n);if(oy(s,i,t))throw Error("Primary key is expired");const o=await zn(this.directSignatures,s,j.signature.key,{key:s},t,n).catch(()=>{});if(o&&oy(s,o,t))throw Error("Primary key is expired")}async getExpirationTime(t,r=Xe){let n;try{const{selfCertification:s}=await this.getPrimaryUser(null,t,r),i=If(this.keyPacket,s),o=s.getExpirationTime(),a=await zn(this.directSignatures,this.keyPacket,j.signature.key,{key:this.keyPacket},null,r).catch(()=>{});if(a){const f=If(this.keyPacket,a);n=Math.min(i,o,f)}else n=i<o?i:o}catch{n=null}return X.normalizeDate(n)}async getPrimaryUser(t=new Date,r={},n=Xe){const s=this.keyPacket,i=[];let o;for(let l=0;l<this.users.length;l++)try{const u=this.users[l];if(!u.userID)continue;if(r.name!==void 0&&u.userID.name!==r.name||r.email!==void 0&&u.userID.email!==r.email||r.comment!==void 0&&u.userID.comment!==r.comment)throw Error("Could not find user that matches that user ID");const p={userID:u.userID,key:s},d=await zn(u.selfCertifications,s,j.signature.certGeneric,p,t,n);i.push({index:l,user:u,selfCertification:d})}catch(u){o=u}if(!i.length)throw o||Error("Could not find primary user");await Promise.all(i.map(async function(l){return l.selfCertification.revoked||l.user.isRevoked(l.selfCertification,null,t,n)}));const a=i.sort(function(l,u){const p=l.selfCertification,d=u.selfCertification;return d.revoked-p.revoked||p.isPrimaryUserID-d.isPrimaryUserID||p.created-d.created}).pop(),{user:f,selfCertification:c}=a;if(c.revoked||await f.isRevoked(c,null,t,n))throw Error("Primary user is revoked");return a}async update(t,r=new Date,n=Xe){if(!this.hasSameFingerprintAs(t))throw Error("Primary key fingerprints must be equal to update the key");if(!this.isPrivate()&&t.isPrivate()){if(!(this.subkeys.length===t.subkeys.length&&this.subkeys.every(i=>t.subkeys.some(o=>i.hasSameFingerprintAs(o)))))throw Error("Cannot update public key with private key if subkeys mismatch");return t.update(this,n)}const s=this.clone();return await fa(t,s,"revocationSignatures",r,i=>no(s.keyPacket,j.signature.keyRevocation,s,[i],null,t.keyPacket,r,n)),await fa(t,s,"directSignatures",r),await Promise.all(t.users.map(async i=>{const o=s.users.filter(a=>i.userID&&i.userID.equals(a.userID)||i.userAttribute&&i.userAttribute.equals(a.userAttribute));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.users.push(a)}})),await Promise.all(t.subkeys.map(async i=>{const o=s.subkeys.filter(a=>a.hasSameFingerprintAs(i));if(o.length>0)await Promise.all(o.map(a=>a.update(i,r,n)));else{const a=i.clone();a.mainKey=s,s.subkeys.push(a)}})),s}async getRevocationCertificate(t=new Date,r=Xe){const n={key:this.keyPacket},s=await zn(this.revocationSignatures,this.keyPacket,j.signature.keyRevocation,n,t,r),i=new Ft;return i.push(s),Ea(j.armor.publicKey,i.write(),null,null,"This is a revocation certificate")}async applyRevocationCertificate(t,r=new Date,n=Xe){const s=await Ii(t,n),i=(await Ft.fromBinary(s.data,GT,n)).findPacket(j.packet.signature);if(!i||i.signatureType!==j.signature.keyRevocation)throw Error("Could not find revocation signature packet");if(!i.issuerKeyID.equals(this.getKeyID()))throw Error("Revocation signature does not match key");try{await i.verify(this.keyPacket,j.signature.keyRevocation,{key:this.keyPacket},r,void 0,n)}catch(a){throw X.wrapError("Could not verify revocation signature",a)}const o=this.clone();return o.revocationSignatures.push(i),o}async signPrimaryUser(t,r,n,s=Xe){const{index:i,user:o}=await this.getPrimaryUser(r,n,s),a=await o.certify(t,r,s),f=this.clone();return f.users[i]=a,f}async signAllUsers(t,r=new Date,n=Xe){const s=this.clone();return s.users=await Promise.all(this.users.map(function(i){return i.certify(t,r,n)})),s}async verifyPrimaryUser(t,r=new Date,n,s=Xe){const i=this.keyPacket,{user:o}=await this.getPrimaryUser(r,n,s);return t?await o.verifyAllCertifications(t,r,s):[{keyID:i.getKeyID(),valid:await o.verify(r,s).catch(()=>!1)}]}async verifyAllUsers(t,r=new Date,n=Xe){const s=this.keyPacket,i=[];return await Promise.all(this.users.map(async o=>{const a=t?await o.verifyAllCertifications(t,r,n):[{keyID:s.getKeyID(),valid:await o.verify(r,n).catch(()=>!1)}];i.push(...a.map(f=>({userID:o.userID?o.userID.userID:null,userAttribute:o.userAttribute,keyID:f.keyID,valid:f.valid})))})),i}}["getKeyID","getFingerprint","getAlgorithmInfo","getCreationTime","hasSameFingerprintAs"].forEach(e=>{p7.prototype[e]=_a.prototype[e]});class Cf extends p7{constructor(t){if(super(),this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subkeys=[],t&&(this.packetListToStructure(t,new Set([j.packet.secretKey,j.packet.secretSubkey])),!this.keyPacket))throw Error("Invalid key: missing public-key packet")}isPrivate(){return!1}toPublic(){return this}armor(t=Xe){return Ea(j.armor.publicKey,this.toPacketList().write(),void 0,void 0,void 0,t)}}class Sa extends Cf{constructor(t){if(super(),this.packetListToStructure(t,new Set([j.packet.publicKey,j.packet.publicSubkey])),!this.keyPacket)throw Error("Invalid key: missing private-key packet")}isPrivate(){return!0}toPublic(){const t=new Ft,r=this.toPacketList();for(const n of r)switch(n.constructor.tag){case j.packet.secretKey:{const s=Wn.fromSecretKeyPacket(n);t.push(s);break}case j.packet.secretSubkey:{const s=Ml.fromSecretSubkeyPacket(n);t.push(s);break}default:t.push(n)}return new Cf(t)}armor(t=Xe){return Ea(j.armor.privateKey,this.toPacketList().write(),void 0,void 0,void 0,t)}async getDecryptionKeys(t,r=new Date,n={},s=Xe){const i=this.keyPacket,o=[];for(let f=0;f<this.subkeys.length;f++)if(!t||this.subkeys[f].getKeyID().equals(t,!0))try{const c={key:i,bind:this.subkeys[f].keyPacket};e3(await zn(this.subkeys[f].bindingSignatures,i,j.signature.subkeyBinding,c,r,s),s)&&o.push(this.subkeys[f])}catch{}const a=await this.getPrimaryUser(r,n,s);return t&&!i.getKeyID().equals(t,!0)||!e3(a.selfCertification,s)||o.push(this),o}isDecrypted(){return this.getKeys().some(({keyPacket:t})=>t.isDecrypted())}async validate(t=Xe){if(!this.isPrivate())throw Error("Cannot validate a public key");let r;if(this.keyPacket.isDummy()){const n=await this.getSigningKey(null,null,void 0,{...t,rejectPublicKeyAlgorithms:new Set,minRSABits:0});n&&!n.keyPacket.isDummy()&&(r=n.keyPacket)}else r=this.keyPacket;if(r)return r.validate();{const n=this.getKeys();if(n.map(i=>i.keyPacket.isDummy()).every(Boolean))throw Error("Cannot validate an all-gnu-dummy key");return Promise.all(n.map(async i=>i.keyPacket.validate()))}}clearPrivateParams(){this.getKeys().forEach(({keyPacket:t})=>{t.isDecrypted()&&t.clearPrivateParams()})}async revoke({flag:t=j.reasonForRevocation.noReason,string:r=""}={},n=new Date,s=Xe){if(!this.isPrivate())throw Error("Need private key for revoking");const i={key:this.keyPacket},o=this.clone();return o.revocationSignatures.push(await es(i,null,this.keyPacket,{signatureType:j.signature.keyRevocation,reasonForRevocationFlag:j.write(j.reasonForRevocation,t),reasonForRevocationString:r},n,void 0,void 0,void 0,s)),o}async addSubkey(t={}){const r={...Xe,...t.config};if(t.passphrase)throw Error("Subkey could not be encrypted here, please encrypt whole key");if(t.rsaBits<r.minRSABits)throw Error(`rsaBits should be at least ${r.minRSABits}, got: ${t.rsaBits}`);const n=this.keyPacket;if(n.isDummy())throw Error("Cannot add subkey to gnu-dummy primary key");if(!n.isDecrypted())throw Error("Key is not decrypted");const s=n.getAlgorithmInfo();s.type=s.curve?"ecc":"rsa",s.rsaBits=s.bits||4096,s.curve=s.curve||"curve25519",t=uy(t,s);const i=await d7(t);$a(i,r);const o=await f7(i,n,t,r),a=this.toPacketList();return a.push(i,o),new Sa(a)}}const oh=X.constructAllowedPackets([Wn,Ml,ah,s2,Ol,sh,Or]);function y7(e){for(const t of e)switch(t.constructor.tag){case j.packet.secretKey:return new Sa(e);case j.packet.publicKey:return new Cf(e)}throw Error("No key packet found")}async function g7(e,t,r,n){r.passphrase&&await e.encrypt(r.passphrase,n),await Promise.all(t.map(async function(o,a){const f=r.subkeys[a].passphrase;f&&await o.encrypt(f,n)}));const s=new Ft;s.push(e),await Promise.all(r.userIDs.map(async function(o,a){function f(p,d){return[d,...p.filter(h=>h!==d)]}const c=Ol.fromObject(o),l={};l.userID=c,l.key=e;const u={};return u.signatureType=j.signature.certGeneric,u.keyFlags=[j.keyFlags.certifyKeys|j.keyFlags.signData],u.preferredSymmetricAlgorithms=f([j.symmetric.aes256,j.symmetric.aes128,j.symmetric.aes192],n.preferredSymmetricAlgorithm),n.aeadProtect&&(u.preferredAEADAlgorithms=f([j.aead.eax,j.aead.ocb],n.preferredAEADAlgorithm)),u.preferredHashAlgorithms=f([j.hash.sha256,j.hash.sha512],n.preferredHashAlgorithm),u.preferredCompressionAlgorithms=f([j.compression.zlib,j.compression.zip,j.compression.uncompressed],n.preferredCompressionAlgorithm),a===0&&(u.isPrimaryUserID=!0),u.features=[0],u.features[0]|=j.features.modificationDetection,n.aeadProtect&&(u.features[0]|=j.features.aead),n.v5Keys&&(u.features[0]|=j.features.v5Keys),r.keyExpirationTime>0&&(u.keyExpirationTime=r.keyExpirationTime,u.keyNeverExpires=!1),{userIDPacket:c,signaturePacket:await es(l,null,e,u,r.date,void 0,void 0,void 0,n)}})).then(o=>{o.forEach(({userIDPacket:a,signaturePacket:f})=>{s.push(a),s.push(f)})}),await Promise.all(t.map(async function(o,a){const f=r.subkeys[a];return{secretSubkeyPacket:o,subkeySignaturePacket:await f7(o,e,f,n)}})).then(o=>{o.forEach(({secretSubkeyPacket:a,subkeySignaturePacket:f})=>{s.push(a),s.push(f)})});const i={key:e};return s.push(await es(i,null,e,{signatureType:j.signature.keyRevocation,reasonForRevocationFlag:j.reasonForRevocation.noReason,reasonForRevocationString:""},r.date,void 0,void 0,void 0,n)),r.passphrase&&e.clearPrivateParams(),await Promise.all(t.map(async function(o,a){r.subkeys[a].passphrase&&o.clearPrivateParams()})),new Sa(s)}async function zT({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Xe,...r},!e&&!t)throw Error("readKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!X.isString(e))throw Error("readKey: options.armoredKey must be a string");if(t&&!X.isUint8Array(t))throw Error("readKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:o,data:a}=await Ii(e,r);if(o!==j.armor.publicKey&&o!==j.armor.privateKey)throw Error("Armored text not of type key");i=a}else i=t;return y7(await Ft.fromBinary(i,oh,r))}async function WT({armoredKey:e,binaryKey:t,config:r,...n}){if(r={...Xe,...r},!e&&!t)throw Error("readPrivateKey: must pass options object containing `armoredKey` or `binaryKey`");if(e&&!X.isString(e))throw Error("readPrivateKey: options.armoredKey must be a string");if(t&&!X.isUint8Array(t))throw Error("readPrivateKey: options.binaryKey must be a Uint8Array");const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));let i;if(e){const{type:a,data:f}=await Ii(e,r);if(a!==j.armor.privateKey)throw Error("Armored text not of type private key");i=f}else i=t;const o=await Ft.fromBinary(i,oh,r);return new Sa(o)}async function YT({armoredKeys:e,binaryKeys:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!X.isString(e))throw Error("readKeys: options.armoredKeys must be a string");if(t&&!X.isUint8Array(t))throw Error("readKeys: options.binaryKeys must be a Uint8Array");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));if(e){const{type:c,data:l}=await Ii(e,r);if(c!==j.armor.publicKey&&c!==j.armor.privateKey)throw Error("Armored text not of type key");s=l}const o=[],a=await Ft.fromBinary(s,oh,r),f=a.indexOfTag(j.packet.publicKey,j.packet.secretKey);if(f.length===0)throw Error("No key packet found");for(let c=0;c<f.length;c++){const l=y7(a.slice(f[c],f[c+1]));o.push(l)}return o}async function JT({armoredKeys:e,binaryKeys:t,config:r}){r={...Xe,...r};let n=e||t;if(!n)throw Error("readPrivateKeys: must pass options object containing `armoredKeys` or `binaryKeys`");if(e&&!X.isString(e))throw Error("readPrivateKeys: options.armoredKeys must be a string");if(t&&!X.isUint8Array(t))throw Error("readPrivateKeys: options.binaryKeys must be a Uint8Array");if(e){const{type:a,data:f}=await Ii(e,r);if(a!==j.armor.privateKey)throw Error("Armored text not of type private key");n=f}const s=[],i=await Ft.fromBinary(n,oh,r),o=i.indexOfTag(j.packet.secretKey);if(o.length===0)throw Error("No secret key packet found");for(let a=0;a<o.length;a++){const f=i.slice(o[a],o[a+1]),c=new Sa(f);s.push(c)}return s}const ZT=X.constructAllowedPackets([Qi,lo,kl,i2,l7,Tf,ba,Dn,Or]),XT=X.constructAllowedPackets([ba]),QT=X.constructAllowedPackets([Or]);class Qr{constructor(t){this.packets=t||new Ft}getEncryptionKeyIDs(){const t=[];return this.packets.filterByTag(j.packet.publicKeyEncryptedSessionKey).forEach(function(r){t.push(r.publicKeyID)}),t}getSigningKeyIDs(){const t=this.unwrapCompressed(),r=t.packets.filterByTag(j.packet.onePassSignature);return r.length>0?r.map(n=>n.issuerKeyID):t.packets.filterByTag(j.packet.signature).map(n=>n.issuerKeyID)}async decrypt(t,r,n,s=new Date,i=Xe){const o=n||await this.decryptSessionKeys(t,r,s,i),a=this.packets.filterByTag(j.packet.symmetricallyEncryptedData,j.packet.symEncryptedIntegrityProtectedData,j.packet.aeadEncryptedData);if(a.length===0)throw Error("No encrypted data found");const f=a[0];let c=null;const l=Promise.all(o.map(async({algorithm:p,data:d})=>{if(!X.isUint8Array(d)||!X.isString(p))throw Error("Invalid session key for decryption.");try{const h=j.write(j.symmetric,p);await f.decrypt(h,d,i)}catch(h){X.printDebugError(h),c=h}}));if(Yp(f.encrypted),f.encrypted=null,await l,!f.packets||!f.packets.length)throw c||Error("Decryption failed.");const u=new Qr(f.packets);return f.packets=new Ft,u}async decryptSessionKeys(t,r,n=new Date,s=Xe){let i,o=[];if(r){const a=this.packets.filterByTag(j.packet.symEncryptedSessionKey);if(a.length===0)throw Error("No symmetrically encrypted session key packet found.");await Promise.all(r.map(async function(f,c){let l;l=c?await Ft.fromBinary(a.write(),XT,s):a,await Promise.all(l.map(async function(u){try{await u.decrypt(f),o.push(u)}catch(p){X.printDebugError(p)}}))}))}else{if(!t)throw Error("No key or password specified.");{const a=this.packets.filterByTag(j.packet.publicKeyEncryptedSessionKey);if(a.length===0)throw Error("No public key encrypted session key packet found.");await Promise.all(a.map(async function(f){await Promise.all(t.map(async function(c){let l=[j.symmetric.aes256,j.symmetric.aes128,j.symmetric.tripledes,j.symmetric.cast5];try{const p=await c.getPrimaryUser(n,void 0,s);p.selfCertification.preferredSymmetricAlgorithms&&(l=l.concat(p.selfCertification.preferredSymmetricAlgorithms))}catch{}const u=(await c.getDecryptionKeys(f.publicKeyID,null,void 0,s)).map(p=>p.keyPacket);await Promise.all(u.map(async function(p){if(!(!p||p.isDummy())){if(!p.isDecrypted())throw Error("Decryption key is not decrypted.");if(s.constantTimePKCS1Decryption&&(f.publicKeyAlgorithm===j.publicKey.rsaEncrypt||f.publicKeyAlgorithm===j.publicKey.rsaEncryptSign||f.publicKeyAlgorithm===j.publicKey.rsaSign||f.publicKeyAlgorithm===j.publicKey.elgamal)){const d=f.write();await Promise.all(Array.from(s.constantTimePKCS1DecryptionSupportedSymmetricAlgorithms).map(async h=>{const y=new Tf;y.read(d);const g={sessionKeyAlgorithm:h,sessionKey:yt.generateSessionKey(h)};try{await y.decrypt(p,g),o.push(y)}catch(m){X.printDebugError(m),i=m}}))}else try{if(await f.decrypt(p),!l.includes(j.write(j.symmetric,f.sessionKeyAlgorithm)))throw Error("A non-preferred symmetric algorithm was used.");o.push(f)}catch(d){X.printDebugError(d),i=d}}}))})),Yp(f.encrypted),f.encrypted=null}))}}if(o.length>0){if(o.length>1){const a=new Set;o=o.filter(f=>{const c=f.sessionKeyAlgorithm+X.uint8ArrayToString(f.sessionKey);return!a.has(c)&&(a.add(c),!0)})}return o.map(a=>({data:a.sessionKey,algorithm:j.read(j.symmetric,a.sessionKeyAlgorithm)}))}throw i||Error("Session key decryption failed.")}getLiteralData(){const t=this.unwrapCompressed().packets.findPacket(j.packet.literalData);return t&&t.getBytes()||null}getFilename(){const t=this.unwrapCompressed().packets.findPacket(j.packet.literalData);return t&&t.getFilename()||null}getText(){const t=this.unwrapCompressed().packets.findPacket(j.packet.literalData);return t?t.getText():null}static async generateSessionKey(t=[],r=new Date,n=[],s=Xe){const i=await cy("symmetric",t,r,n,s),o=j.read(j.symmetric,i),a=s.aeadProtect&&await async function(f,c=new Date,l=[],u=Xe){let p=!0;return await Promise.all(f.map(async function(d,h){const y=await d.getPrimaryUser(c,l[h],u);y.selfCertification.features&&y.selfCertification.features[0]&j.features.aead||(p=!1)})),p}(t,r,n,s)?j.read(j.aead,await cy("aead",t,r,n,s)):void 0;return await Promise.all(t.map(f=>f.getEncryptionKey().catch(()=>null).then(c=>{if(c&&c.keyPacket.algorithm===j.publicKey.x25519&&!X.isAES(i))throw Error("Could not generate a session key compatible with the given `encryptionKeys`: X22519 keys can only be used to encrypt AES session keys; change `config.preferredSymmetricAlgorithm` accordingly.")}))),{data:yt.generateSessionKey(i),algorithm:o,aeadAlgorithm:a}}async encrypt(t,r,n,s=!1,i=[],o=new Date,a=[],f=Xe){if(n){if(!X.isUint8Array(n.data)||!X.isString(n.algorithm))throw Error("Invalid session key for encryption.")}else if(t&&t.length)n=await Qr.generateSessionKey(t,o,a,f);else{if(!r||!r.length)throw Error("No keys, passwords, or session key provided.");n=await Qr.generateSessionKey(void 0,void 0,void 0,f)}const{data:c,algorithm:l,aeadAlgorithm:u}=n,p=await Qr.encryptSessionKey(c,l,u,t,r,s,i,o,a,f);let d;u?(d=new kl,d.aeadAlgorithm=j.write(j.aead,u)):d=new i2,d.packets=this.packets;const h=j.write(j.symmetric,l);return await d.encrypt(h,c,f),p.packets.push(d),d.packets=new Ft,p}static async encryptSessionKey(t,r,n,s,i,o=!1,a=[],f=new Date,c=[],l=Xe){const u=new Ft,p=j.write(j.symmetric,r),d=n&&j.write(j.aead,n);if(s){const h=await Promise.all(s.map(async function(y,g){const m=await y.getEncryptionKey(a[g],f,c,l),b=new Tf;return b.publicKeyID=o?Ms.wildcard():m.getKeyID(),b.publicKeyAlgorithm=m.keyPacket.algorithm,b.sessionKey=t,b.sessionKeyAlgorithm=p,await b.encrypt(m.keyPacket),delete b.sessionKey,b}));u.push(...h)}if(i){const h=async function(b,w){try{return await b.decrypt(w),1}catch{return 0}},y=(b,w)=>b+w,g=async function(b,w,E,C){const R=new ba(l);return R.sessionKey=b,R.sessionKeyAlgorithm=w,E&&(R.aeadAlgorithm=E),await R.encrypt(C,l),l.passwordCollisionCheck&&(await Promise.all(i.map(M=>h(R,M)))).reduce(y)!==1?g(b,w,C):(delete R.sessionKey,R)},m=await Promise.all(i.map(b=>g(t,p,d,b)));u.push(...m)}return new Qr(u)}async sign(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Xe){const f=new Ft,c=this.packets.findPacket(j.packet.literalData);if(!c)throw Error("No literal data packet to sign.");let l,u;const p=c.text===null?j.signature.binary:j.signature.text;if(r)for(u=r.packets.filterByTag(j.packet.signature),l=u.length-1;l>=0;l--){const d=u[l],h=new Dn;h.signatureType=d.signatureType,h.hashAlgorithm=d.hashAlgorithm,h.publicKeyAlgorithm=d.publicKeyAlgorithm,h.issuerKeyID=d.issuerKeyID,t.length||l!==0||(h.flags=1),f.push(h)}return await Promise.all(Array.from(t).reverse().map(async function(d,h){if(!d.isPrivate())throw Error("Need private key for signing");const y=n[t.length-1-h],g=await d.getSigningKey(y,s,i,a),m=new Dn;return m.signatureType=p,m.hashAlgorithm=await h7(d,g.keyPacket,s,i,a),m.publicKeyAlgorithm=g.keyPacket.algorithm,m.issuerKeyID=g.getKeyID(),h===t.length-1&&(m.flags=1),m})).then(d=>{d.forEach(h=>f.push(h))}),f.push(c),f.push(...await ly(c,t,r,n,s,i,o,!1,a)),new Qr(f)}compress(t,r=Xe){if(t===j.compression.uncompressed)return this;const n=new lo(r);n.algorithm=t,n.packets=this.packets;const s=new Ft;return s.push(n),new Qr(s)}async signDetached(t=[],r=null,n=[],s=new Date,i=[],o=[],a=Xe){const f=this.packets.findPacket(j.packet.literalData);if(!f)throw Error("No literal data packet to sign.");return new Rs(await ly(f,t,r,n,s,i,o,!0,a))}async verify(t,r=new Date,n=Xe){const s=this.unwrapCompressed(),i=s.packets.filterByTag(j.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");let o=s.packets;vr(o.stream)&&(o=o.concat(await mr(o.stream,c=>c||[])));const a=o.filterByTag(j.packet.onePassSignature).reverse(),f=o.filterByTag(j.packet.signature);return a.length&&!f.length&&X.isStream(o.stream)&&!vr(o.stream)?(await Promise.all(a.map(async c=>{c.correspondingSig=new Promise((l,u)=>{c.correspondingSigResolve=l,c.correspondingSigReject=u}),c.signatureData=rs(async()=>(await c.correspondingSig).signatureData),c.hashed=mr(await c.hash(c.signatureType,i[0],void 0,!1)),c.hashed.catch(()=>{})})),o.stream=Ai(o.stream,async(c,l)=>{const u=Ti(c),p=gn(l);try{for(let d=0;d<a.length;d++){const{value:h}=await u.read();a[d].correspondingSigResolve(h)}await u.readToEnd(),await p.ready,await p.close()}catch(d){a.forEach(h=>{h.correspondingSigReject(d)}),await p.abort(d)}}),Yd(a,i,t,r,!1,n)):Yd(f,i,t,r,!1,n)}verifyDetached(t,r,n=new Date,s=Xe){const i=this.unwrapCompressed().packets.filterByTag(j.packet.literalData);if(i.length!==1)throw Error("Can only verify message with one literal data packet.");return Yd(t.packets.filterByTag(j.packet.signature),i,r,n,!0,s)}unwrapCompressed(){const t=this.packets.filterByTag(j.packet.compressedData);return t.length?new Qr(t[0].packets):this}async appendSignature(t,r=Xe){await this.packets.read(X.isUint8Array(t)?t:(await Ii(t)).data,QT,r)}write(){return this.packets.write()}armor(t=Xe){return Ea(j.armor.message,this.write(),null,null,null,t)}}async function ly(e,t,r=null,n=[],s=new Date,i=[],o=[],a=!1,f=Xe){const c=new Ft,l=e.text===null?j.signature.binary:j.signature.text;if(await Promise.all(t.map(async(u,p)=>{const d=i[p];if(!u.isPrivate())throw Error("Need private key for signing");const h=await u.getSigningKey(n[p],s,d,f);return es(e,u,h.keyPacket,{signatureType:l},s,d,o,a,f)})).then(u=>{c.push(...u)}),r){const u=r.packets.filterByTag(j.packet.signature);c.push(...u)}return c}async function Yd(e,t,r,n=new Date,s=!1,i=Xe){return Promise.all(e.filter(function(o){return["text","binary"].includes(j.read(j.signature,o.signatureType))}).map(async function(o){return async function(a,f,c,l=new Date,u=!1,p=Xe){let d,h;for(const m of c){const b=m.getKeys(a.issuerKeyID);if(b.length>0){d=m,h=b[0];break}}const y=a instanceof Dn?a.correspondingSig:a,g={keyID:a.issuerKeyID,verified:(async()=>{if(!h)throw Error("Could not find signing key with key ID "+a.issuerKeyID.toHex());await a.verify(h.keyPacket,a.signatureType,f[0],l,u,p);const m=await y;if(h.getCreationTime()>m.created)throw Error("Key is newer than the signature");try{await d.getSigningKey(h.getKeyID(),m.created,void 0,p)}catch(b){if(!p.allowInsecureVerificationWithReformattedKeys||!b.message.match(/Signature creation time is in the future/))throw b;await d.getSigningKey(h.getKeyID(),l,void 0,p)}return!0})(),signature:(async()=>{const m=await y,b=new Ft;return m&&b.push(m),new Rs(b)})()};return g.signature.catch(()=>{}),g.verified.catch(()=>{}),g}(o,t,r,n,s,i)}))}async function eI({armoredMessage:e,binaryMessage:t,config:r,...n}){r={...Xe,...r};let s=e||t;if(!s)throw Error("readMessage: must pass options object containing `armoredMessage` or `binaryMessage`");if(e&&!X.isString(e)&&!X.isStream(e))throw Error("readMessage: options.armoredMessage must be a string or stream");if(t&&!X.isUint8Array(t)&&!X.isStream(t))throw Error("readMessage: options.binaryMessage must be a Uint8Array or stream");const i=Object.keys(n);if(i.length>0)throw Error("Unknown option: "+i.join(", "));const o=X.isStream(s);if(o&&(await r8(),s=Al(s)),e){const{type:c,data:l}=await Ii(s,r);if(c!==j.armor.message)throw Error("Armored text not of type message");s=l}const a=await Ft.fromBinary(s,ZT,r),f=new Qr(a);return f.fromStream=o,f}async function tI({text:e,binary:t,filename:r,date:n=new Date,format:s=e!==void 0?"utf8":"binary",...i}){let o=e!==void 0?e:t;if(o===void 0)throw Error("createMessage: must pass options object containing `text` or `binary`");if(e&&!X.isString(e)&&!X.isStream(e))throw Error("createMessage: options.text must be a string or stream");if(t&&!X.isUint8Array(t)&&!X.isStream(t))throw Error("createMessage: options.binary must be a Uint8Array or stream");const a=Object.keys(i);if(a.length>0)throw Error("Unknown option: "+a.join(", "));const f=X.isStream(o);f&&(await r8(),o=Al(o));const c=new Qi(n);e!==void 0?c.setText(o,j.write(j.literal,s)):c.setBytes(o,j.write(j.literal,s)),r!==void 0&&c.setFilename(r);const l=new Ft;l.push(c);const u=new Qr(l);return u.fromStream=f,u}const rI=X.constructAllowedPackets([Or]);class Si{constructor(t,r){if(this.text=X.removeTrailingSpaces(t).replace(/\r?\n/g,`\r
38
+ `),r&&!(r instanceof Rs))throw Error("Invalid signature input");this.signature=r||new Rs(new Ft)}getSigningKeyIDs(){const t=[];return this.signature.packets.forEach(function(r){t.push(r.issuerKeyID)}),t}async sign(t,r=null,n=[],s=new Date,i=[],o=[],a=Xe){const f=new Qi;f.setText(this.text);const c=new Rs(await ly(f,t,r,n,s,i,o,!0,a));return new Si(this.text,c)}verify(t,r=new Date,n=Xe){const s=this.signature.packets.filterByTag(j.packet.signature),i=new Qi;return i.setText(this.text),Yd(s,[i],t,r,!0,n)}getText(){return this.text.replace(/\r\n/g,`
39
+ `)}armor(t=Xe){let r=this.signature.packets.map(function(s){return j.read(j.hash,s.hashAlgorithm).toUpperCase()});r=r.filter(function(s,i,o){return o.indexOf(s)===i});const n={hash:r.join(),text:this.text,data:this.signature.packets.write()};return Ea(j.armor.signed,n,void 0,void 0,void 0,t)}}async function nI({cleartextMessage:e,config:t,...r}){if(t={...Xe,...t},!e)throw Error("readCleartextMessage: must pass options object containing `cleartextMessage`");if(!X.isString(e))throw Error("readCleartextMessage: options.cleartextMessage must be a string");const n=Object.keys(r);if(n.length>0)throw Error("Unknown option: "+n.join(", "));const s=await Ii(e);if(s.type!==j.armor.signed)throw Error("No cleartext signed message.");const i=await Ft.fromBinary(s.data,rI,t);(function(a,f){const c=function(p){const d=h=>y=>h.hashAlgorithm===y;for(let h=0;h<f.length;h++)if(f[h].constructor.tag===j.packet.signature&&!p.some(d(f[h])))return!1;return!0};let l=null,u=[];if(a.forEach(function(p){if(l=p.match(/^Hash: (.+)$/),!l)throw Error('Only "Hash" header allowed in cleartext signed message');l=l[1].replace(/\s/g,""),l=l.split(","),l=l.map(function(d){d=d.toLowerCase();try{return j.write(j.hash,d)}catch{throw Error("Unknown hash algorithm in armor header: "+d)}}),u=u.concat(l)}),!u.length&&!c([j.hash.md5]))throw Error('If no "Hash" header in cleartext signed message, then only MD5 signatures allowed');if(u.length&&!c(u))throw Error("Hash algorithm mismatch in armor header and signature")})(s.headers,i);const o=new Rs(i);return new Si(s.text,o)}async function iI({text:e,...t}){if(!e)throw Error("createCleartextMessage: must pass options object containing `text`");if(!X.isString(e))throw Error("createCleartextMessage: options.text must be a string");const r=Object.keys(t);if(r.length>0)throw Error("Unknown option: "+r.join(", "));return new Si(e)}async function sI({userIDs:e=[],passphrase:t,type:r="ecc",rsaBits:n=4096,curve:s="curve25519",keyExpirationTime:i=0,date:o=new Date,subkeys:a=[{}],format:f="armored",config:c,...l}){Bn(c={...Xe,...c}),e=rr(e);const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));if(e.length===0)throw Error("UserIDs are required for key generation");if(r==="rsa"&&n<c.minRSABits)throw Error(`rsaBits should be at least ${c.minRSABits}, got: ${n}`);const p={userIDs:e,passphrase:t,type:r,rsaBits:n,curve:s,keyExpirationTime:i,date:o,subkeys:a};try{const{key:d,revocationCertificate:h}=await async function(y,g){y.sign=!0,(y=uy(y)).subkeys=y.subkeys.map((C,R)=>uy(y.subkeys[R],y));let m=[HT(y,g)];m=m.concat(y.subkeys.map(C=>d7(C,g)));const b=await Promise.all(m),w=await g7(b[0],b.slice(1),y,g),E=await w.getRevocationCertificate(y.date,g);return w.revocationSignatures=[],{key:w,revocationCertificate:E}}(p,c);return d.getKeys().forEach(({keyPacket:y})=>$a(y,c)),{privateKey:ks(d,f,c),publicKey:ks(d.toPublic(),f,c),revocationCertificate:h}}catch(d){throw X.wrapError("Error generating keypair",d)}}async function aI({privateKey:e,userIDs:t=[],passphrase:r,keyExpirationTime:n=0,date:s,format:i="armored",config:o,...a}){Bn(o={...Xe,...o}),t=rr(t);const f=Object.keys(a);if(f.length>0)throw Error("Unknown option: "+f.join(", "));if(t.length===0)throw Error("UserIDs are required for key reformat");const c={privateKey:e,userIDs:t,passphrase:r,keyExpirationTime:n,date:s};try{const{key:l,revocationCertificate:u}=await async function(p,d){p=w(p);const{privateKey:h}=p;if(!h.isPrivate())throw Error("Cannot reformat a public key");if(h.keyPacket.isDummy())throw Error("Cannot reformat a gnu-dummy primary key");if(!h.getKeys().every(({keyPacket:E})=>E.isDecrypted()))throw Error("Key is not decrypted");const y=h.keyPacket;p.subkeys||(p.subkeys=await Promise.all(h.subkeys.map(async E=>{const C=E.keyPacket,R={key:y,bind:C},M=await zn(E.bindingSignatures,y,j.signature.subkeyBinding,R,null,d).catch(()=>({}));return{sign:M.keyFlags&&M.keyFlags[0]&j.keyFlags.signData}})));const g=h.subkeys.map(E=>E.keyPacket);if(p.subkeys.length!==g.length)throw Error("Number of subkey options does not match number of subkeys");p.subkeys=p.subkeys.map(E=>w(E,p));const m=await g7(y,g,p,d),b=await m.getRevocationCertificate(p.date,d);return m.revocationSignatures=[],{key:m,revocationCertificate:b};function w(E,C={}){return E.keyExpirationTime=E.keyExpirationTime||C.keyExpirationTime,E.passphrase=X.isString(E.passphrase)?E.passphrase:C.passphrase,E.date=E.date||C.date,E}}(c,o);return{privateKey:ks(l,i,o),publicKey:ks(l.toPublic(),i,o),revocationCertificate:u}}catch(l){throw X.wrapError("Error reformatting keypair",l)}}async function oI({key:e,revocationCertificate:t,reasonForRevocation:r,date:n=new Date,format:s="armored",config:i,...o}){Bn(i={...Xe,...i});const a=Object.keys(o);if(a.length>0)throw Error("Unknown option: "+a.join(", "));try{const f=t?await e.applyRevocationCertificate(t,n,i):await e.revoke(r,n,i);return f.isPrivate()?{privateKey:ks(f,s,i),publicKey:ks(f.toPublic(),s,i)}:{privateKey:null,publicKey:ks(f,s,i)}}catch(f){throw X.wrapError("Error revoking key",f)}}async function cI({privateKey:e,passphrase:t,config:r,...n}){Bn(r={...Xe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot decrypt a public key");const i=e.clone(!0),o=X.isArray(t)?t:[t];try{return await Promise.all(i.getKeys().map(a=>X.anyPromise(o.map(f=>a.keyPacket.decrypt(f))))),await i.validate(r),i}catch(a){throw i.clearPrivateParams(),X.wrapError("Error decrypting private key",a)}}async function uI({privateKey:e,passphrase:t,config:r,...n}){Bn(r={...Xe,...r});const s=Object.keys(n);if(s.length>0)throw Error("Unknown option: "+s.join(", "));if(!e.isPrivate())throw Error("Cannot encrypt a public key");const i=e.clone(!0),o=i.getKeys(),a=X.isArray(t)?t:Array(o.length).fill(t);if(a.length!==o.length)throw Error("Invalid number of passphrases given for key encryption");try{return await Promise.all(o.map(async(f,c)=>{const{keyPacket:l}=f;await l.encrypt(a[c],r),l.clearPrivateParams()})),i}catch(f){throw i.clearPrivateParams(),X.wrapError("Error encrypting private key",f)}}async function lI({message:e,encryptionKeys:t,signingKeys:r,passwords:n,sessionKey:s,format:i="armored",signature:o=null,wildcard:a=!1,signingKeyIDs:f=[],encryptionKeyIDs:c=[],date:l=new Date,signingUserIDs:u=[],encryptionUserIDs:p=[],signatureNotations:d=[],config:h,...y}){if(Bn(h={...Xe,...h}),a2(e),o2(i),t=rr(t),r=rr(r),n=rr(n),f=rr(f),c=rr(c),u=rr(u),p=rr(p),d=rr(d),y.detached)throw Error("The `detached` option has been removed from openpgp.encrypt, separately call openpgp.sign instead. Don't forget to remove the `privateKeys` option as well.");if(y.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encrypt, pass `encryptionKeys` instead");if(y.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.encrypt, pass `signingKeys` instead");if(y.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.encrypt, pass `format` instead.");const g=Object.keys(y);if(g.length>0)throw Error("Unknown option: "+g.join(", "));r||(r=[]);const m=e.fromStream;try{if((r.length||o)&&(e=await e.sign(r,o,f,l,u,d,h)),e=e.compress(await cy("compression",t,l,p,h),h),e=await e.encrypt(t,n,s,a,c,l,p,h),i==="object")return e;const b=i==="armored";return ch(b?e.armor(h):e.write(),m,b?"utf8":"binary")}catch(b){throw X.wrapError("Error encrypting message",b)}}async function dI({message:e,decryptionKeys:t,passwords:r,sessionKeys:n,verificationKeys:s,expectSigned:i=!1,format:o="utf8",signature:a=null,date:f=new Date,config:c,...l}){if(Bn(c={...Xe,...c}),a2(e),s=rr(s),t=rr(t),r=rr(r),n=rr(n),l.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decrypt, pass `decryptionKeys` instead");if(l.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.decrypt, pass `verificationKeys` instead");const u=Object.keys(l);if(u.length>0)throw Error("Unknown option: "+u.join(", "));try{const p=await e.decrypt(t,r,n,f,c);s||(s=[]);const d={};if(d.signatures=a?await p.verifyDetached(a,s,f,c):await p.verify(s,f,c),d.data=o==="binary"?p.getLiteralData():p.getText(),d.filename=p.getFilename(),v7(d,e),i){if(s.length===0)throw Error("Verification keys are required to verify message signatures");if(d.signatures.length===0)throw Error("Message is not signed");d.data=on([d.data,rs(async()=>{await X.anyPromise(d.signatures.map(h=>h.verified))})])}return d.data=await ch(d.data,e.fromStream,o),d}catch(p){throw X.wrapError("Error decrypting message",p)}}async function fI({message:e,signingKeys:t,format:r="armored",detached:n=!1,signingKeyIDs:s=[],date:i=new Date,signingUserIDs:o=[],signatureNotations:a=[],config:f,...c}){if(Bn(f={...Xe,...f}),m7(e),o2(r),t=rr(t),s=rr(s),o=rr(o),a=rr(a),c.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.sign, pass `signingKeys` instead");if(c.armor!==void 0)throw Error("The `armor` option has been removed from openpgp.sign, pass `format` instead.");const l=Object.keys(c);if(l.length>0)throw Error("Unknown option: "+l.join(", "));if(e instanceof Si&&r==="binary")throw Error("Cannot return signed cleartext message in binary format");if(e instanceof Si&&n)throw Error("Cannot detach-sign a cleartext message");if(!t||t.length===0)throw Error("No signing keys provided");try{let u;if(u=n?await e.signDetached(t,void 0,s,i,o,a,f):await e.sign(t,void 0,s,i,o,a,f),r==="object")return u;const p=r==="armored";return u=p?u.armor(f):u.write(),n&&(u=Ai(e.packets.write(),async(d,h)=>{await Promise.all([Yi(u,h),mr(d).catch(()=>{})])})),ch(u,e.fromStream,p?"utf8":"binary")}catch(u){throw X.wrapError("Error signing message",u)}}async function hI({message:e,verificationKeys:t,expectSigned:r=!1,format:n="utf8",signature:s=null,date:i=new Date,config:o,...a}){if(Bn(o={...Xe,...o}),m7(e),t=rr(t),a.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.verify, pass `verificationKeys` instead");const f=Object.keys(a);if(f.length>0)throw Error("Unknown option: "+f.join(", "));if(e instanceof Si&&n==="binary")throw Error("Can't return cleartext message data as binary");if(e instanceof Si&&s)throw Error("Can't verify detached cleartext signature");try{const c={};if(c.signatures=s?await e.verifyDetached(s,t,i,o):await e.verify(t,i,o),c.data=n==="binary"?e.getLiteralData():e.getText(),e.fromStream&&!s&&v7(c,e),r){if(c.signatures.length===0)throw Error("Message is not signed");c.data=on([c.data,rs(async()=>{await X.anyPromise(c.signatures.map(l=>l.verified))})])}return c.data=await ch(c.data,e.fromStream,n),c}catch(c){throw X.wrapError("Error verifying signed message",c)}}async function pI({encryptionKeys:e,date:t=new Date,encryptionUserIDs:r=[],config:n,...s}){if(Bn(n={...Xe,...n}),e=rr(e),r=rr(r),s.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.generateSessionKey, pass `encryptionKeys` instead");const i=Object.keys(s);if(i.length>0)throw Error("Unknown option: "+i.join(", "));try{return await Qr.generateSessionKey(e,t,r,n)}catch(o){throw X.wrapError("Error generating session key",o)}}async function yI({data:e,algorithm:t,aeadAlgorithm:r,encryptionKeys:n,passwords:s,format:i="armored",wildcard:o=!1,encryptionKeyIDs:a=[],date:f=new Date,encryptionUserIDs:c=[],config:l,...u}){if(Bn(l={...Xe,...l}),function(d,h){if(!X.isUint8Array(d))throw Error("Parameter ["+(h||"data")+"] must be of type Uint8Array")}(e),function(d,h){if(!X.isString(d))throw Error("Parameter ["+(h||"data")+"] must be of type String")}(t,"algorithm"),o2(i),n=rr(n),s=rr(s),a=rr(a),c=rr(c),u.publicKeys)throw Error("The `publicKeys` option has been removed from openpgp.encryptSessionKey, pass `encryptionKeys` instead");const p=Object.keys(u);if(p.length>0)throw Error("Unknown option: "+p.join(", "));if(!(n&&n.length!==0||s&&s.length!==0))throw Error("No encryption keys or passwords provided.");try{return ks(await Qr.encryptSessionKey(e,t,r,n,s,o,a,f,c,l),i,l)}catch(d){throw X.wrapError("Error encrypting session key",d)}}async function gI({message:e,decryptionKeys:t,passwords:r,date:n=new Date,config:s,...i}){if(Bn(s={...Xe,...s}),a2(e),t=rr(t),r=rr(r),i.privateKeys)throw Error("The `privateKeys` option has been removed from openpgp.decryptSessionKeys, pass `decryptionKeys` instead");const o=Object.keys(i);if(o.length>0)throw Error("Unknown option: "+o.join(", "));try{return await e.decryptSessionKeys(t,r,n,s)}catch(a){throw X.wrapError("Error decrypting session keys",a)}}function a2(e){if(!(e instanceof Qr))throw Error("Parameter [message] needs to be of type Message")}function m7(e){if(!(e instanceof Si||e instanceof Qr))throw Error("Parameter [message] needs to be of type Message or CleartextMessage")}function o2(e){if(e!=="armored"&&e!=="binary"&&e!=="object")throw Error("Unsupported format "+e)}const mI=Object.keys(Xe).length;function Bn(e){const t=Object.keys(e);if(t.length!==mI){for(const r of t)if(Xe[r]===void 0)throw Error("Unknown config property: "+r)}}function rr(e){return e&&!X.isArray(e)&&(e=[e]),e}async function ch(e,t,r="utf8"){const n=X.isStream(e);return n==="array"?mr(e):t==="node"?(e=Hy(e),r!=="binary"&&e.setEncoding(r),e):t==="web"&&n==="ponyfill"?e8(e):e}function v7(e,t){e.data=Ai(t.packets.stream,async(r,n)=>{await Yi(e.data,n,{preventClose:!0});const s=gn(n);try{await mr(r,i=>i),await s.close()}catch(i){await s.abort(i)}})}function ks(e,t,r){switch(t){case"object":return e;case"armored":return e.armor(r);case"binary":return e.write();default:throw Error("Unsupported format "+t)}}const Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function c2(){}const n3=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:void 0;function mn(e){return typeof e=="object"&&e!==null||typeof e=="function"}const b7=c2,u2=Promise,vI=Promise.prototype.then,bI=Promise.resolve.bind(u2),_I=Promise.reject.bind(u2);function un(e){return new u2(e)}function or(e){return bI(e)}function kt(e){return _I(e)}function Gi(e,t,r){return vI.call(e,t,r)}function Zn(e,t,r){Gi(Gi(e,t,r),void 0,b7)}function h0(e,t){Zn(e,t)}function _7(e,t){Zn(e,void 0,t)}function ha(e,t,r){return Gi(e,t,r)}function Nl(e){Gi(e,void 0,b7)}const w7=(()=>{const e=n3&&n3.queueMicrotask;if(typeof e=="function")return e;const t=or(void 0);return r=>Gi(t,r)})();function uh(e,t,r){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function Pa(e,t,r){try{return or(uh(e,t,r))}catch(n){return kt(n)}}class Pi{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const r=this._back;let n=r;r._elements.length===16383&&(n={_elements:[],_next:void 0}),r._elements.push(t),n!==r&&(this._back=n,r._next=n),++this._size}shift(){const t=this._front;let r=t;const n=this._cursor;let s=n+1;const i=t._elements,o=i[n];return s===16384&&(r=t._next,s=0),--this._size,this._cursor=s,t!==r&&(this._front=r),i[n]=void 0,o}forEach(t){let r=this._cursor,n=this._front,s=n._elements;for(;!(r===s.length&&n._next===void 0||r===s.length&&(n=n._next,s=n._elements,r=0,s.length===0));)t(s[r]),++r}peek(){const t=this._front,r=this._cursor;return t._elements[r]}}function E7(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?dy(e):t._state==="closed"?function(r){dy(r),S7(r)}(e):A7(e,t._storedError)}function l2(e,t){return pa(e._ownerReadableStream,t)}function la(e){e._ownerReadableStream._state==="readable"?d2(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,r){A7(t,r)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function io(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function dy(e){e._closedPromise=un((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function A7(e,t){dy(e),d2(e,t)}function d2(e,t){e._closedPromise_reject!==void 0&&(Nl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function S7(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const P7=Ht("[[AbortSteps]]"),T7=Ht("[[ErrorSteps]]"),f2=Ht("[[CancelSteps]]"),h2=Ht("[[PullSteps]]"),i3=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},wI=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function zi(e,t){if(e!==void 0&&typeof(r=e)!="object"&&typeof r!="function")throw new TypeError(t+" is not an object.");var r}function Qn(e,t){if(typeof e!="function")throw new TypeError(t+" is not a function.")}function I7(e,t){if(!function(r){return typeof r=="object"&&r!==null||typeof r=="function"}(e))throw new TypeError(t+" is not an object.")}function ts(e,t,r){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function fy(e,t,r){if(e===void 0)throw new TypeError(`${t} is required in '${r}'.`)}function p2(e){return Number(e)}function s3(e){return e===0?0:e}function C7(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=s3(n),!i3(n))throw new TypeError(t+" is not a finite number");if(n=function(s){return s3(wI(s))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return i3(n)&&n!==0?n:0}function y2(e,t){if(!fs(e))throw new TypeError(t+" is not a ReadableStream.")}function Jd(e){return new Rf(e)}function R7(e,t){e._reader._readRequests.push(t)}function g2(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function lh(e){return e._reader._readRequests.length}function k7(e){const t=e._reader;return t!==void 0&&!!da(t)}class Rf{constructor(t){if(ts(t,1,"ReadableStreamDefaultReader"),y2(t,"First parameter"),Ts(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");E7(this,t),this._readRequests=new Pi}get closed(){return da(this)?this._closedPromise:kt(cd("closed"))}cancel(t=void 0){return da(this)?this._ownerReadableStream===void 0?kt(io("cancel")):l2(this,t):kt(cd("cancel"))}read(){if(!da(this))return kt(cd("read"));if(this._ownerReadableStream===void 0)return kt(io("read from"));let t,r;const n=un((s,i)=>{t=s,r=i});return dh(this,{_chunkSteps:s=>t({value:s,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:s=>r(s)}),n}releaseLock(){if(!da(this))throw cd("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");la(this)}}}function da(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function dh(e,t){const r=e._ownerReadableStream;r._disturbed=!0,r._state==="closed"?t._closeSteps():r._state==="errored"?t._errorSteps(r._storedError):r._readableStreamController[h2](t)}function cd(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}let kf;Object.defineProperties(Rf.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Rf.prototype,Ht.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),typeof Ht.asyncIterator=="symbol"&&(kf={[Ht.asyncIterator](){return this}},Object.defineProperty(kf,Ht.asyncIterator,{enumerable:!1}));class EI{constructor(t,r){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=r}next(){const t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?ha(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){const r=()=>this._returnSteps(t);return this._ongoingPromise?ha(this._ongoingPromise,r,r):r()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const t=this._reader;if(t._ownerReadableStream===void 0)return kt(io("iterate"));let r,n;const s=un((i,o)=>{r=i,n=o});return dh(t,{_chunkSteps:i=>{this._ongoingPromise=void 0,w7(()=>r({value:i,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,la(t),r({value:void 0,done:!0})},_errorSteps:i=>{this._ongoingPromise=void 0,this._isFinished=!0,la(t),n(i)}}),s}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;const r=this._reader;if(r._ownerReadableStream===void 0)return kt(io("finish iterating"));if(!this._preventCancel){const n=l2(r,t);return la(r),ha(n,()=>({value:t,done:!0}))}return la(r),or({value:t,done:!0})}}const M7={next(){return a3(this)?this._asyncIteratorImpl.next():kt(o3("next"))},return(e){return a3(this)?this._asyncIteratorImpl.return(e):kt(o3("return"))}};function a3(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function o3(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}kf!==void 0&&Object.setPrototypeOf(M7,kf);const O7=Number.isNaN||function(e){return e!=e};function N7(e){return!!function(t){return!(typeof t!="number"||O7(t)||t<0)}(e)&&e!==1/0}function hy(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function m2(e,t,r){if(!N7(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Us(e){e._queue=new Pi,e._queueTotalSize=0}function p0(e){return e.slice()}class Mf{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!y0(this))throw g0("view");return this._view}respond(t){if(!y0(this))throw g0("respond");if(ts(t,1,"respond"),t=C7(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(r,n){if(n=Number(n),!N7(n))throw new RangeError("bytesWritten must be a finite");c3(r,n)}(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!y0(this))throw g0("respondWithNewView");if(ts(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");(function(r,n){const s=r._pendingPullIntos.peek();if(s.byteOffset+s.bytesFilled!==n.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(s.byteLength!==n.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");s.buffer=n.buffer,c3(r,n.byteLength)})(this._associatedReadableByteStreamController,t)}}Object.defineProperties(Mf.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Mf.prototype,Ht.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Of{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!La(this))throw Mo("byobRequest");if(this._byobRequest===null&&this._pendingPullIntos.length>0){const t=this._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Mf.prototype);(function(s,i,o){s._associatedReadableByteStreamController=i,s._view=o})(n,this,r),this._byobRequest=n}return this._byobRequest}get desiredSize(){if(!La(this))throw Mo("desiredSize");return K7(this)}close(){if(!La(this))throw Mo("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);(function(r){const n=r._controlledReadableByteStream;if(!(r._closeRequested||n._state!=="readable")){if(r._queueTotalSize>0)return void(r._closeRequested=!0);if(r._pendingPullIntos.length>0&&r._pendingPullIntos.peek().bytesFilled>0){const s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw pl(r,s),s}Nf(r),Dl(n)}})(this)}enqueue(t){if(!La(this))throw Mo("enqueue");if(ts(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const r=this._controlledReadableByteStream._state;if(r!=="readable")throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`);(function(n,s){const i=n._controlledReadableByteStream;if(n._closeRequested||i._state!=="readable")return;const o=s.buffer,a=s.byteOffset,f=s.byteLength,c=o;k7(i)?lh(i)===0?Zd(n,c,a,f):g2(i,new Uint8Array(c,a,f),!1):b2(i)?(Zd(n,c,a,f),L7(n)):Zd(n,c,a,f),wa(n)})(this,t)}error(t=void 0){if(!La(this))throw Mo("error");pl(this,t)}[f2](t){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0),Us(this);const r=this._cancelAlgorithm(t);return Nf(this),r}[h2](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){const s=this._queue.shift();this._queueTotalSize-=s.byteLength,B7(this);const i=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return void t._chunkSteps(i)}const n=this._autoAllocateChunkSize;if(n!==void 0){let s;try{s=new ArrayBuffer(n)}catch(o){return void t._errorSteps(o)}const i={buffer:s,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}R7(r,t),wa(this)}}function La(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function y0(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function wa(e){if(function(r){const n=r._controlledReadableByteStream;return n._state!=="readable"||r._closeRequested||!r._started?!1:!!(k7(n)&&lh(n)>0||b2(n)&&j7(n)>0||K7(r)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,Zn(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,wa(e))},r=>{pl(e,r)})}}function py(e,t){let r=!1;e._state==="closed"&&(r=!0);const n=D7(t);t.readerType==="default"?g2(e,n,r):function(s,i,o){const a=s._reader,f=a._readIntoRequests.shift();o?f._closeSteps(i):f._chunkSteps(i)}(e,n,r)}function D7(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Zd(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function x7(e,t){const r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,s=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),i=t.bytesFilled+s,o=i-i%r;let a=s,f=!1;o>n&&(a=o-t.bytesFilled,f=!0);const c=e._queue;for(;a>0;){const y=c.peek(),g=Math.min(a,y.byteLength),m=t.byteOffset+t.bytesFilled;l=t.buffer,u=m,p=y.buffer,d=y.byteOffset,h=g,new Uint8Array(l).set(new Uint8Array(p,d,h),u),y.byteLength===g?c.shift():(y.byteOffset+=g,y.byteLength-=g),e._queueTotalSize-=g,U7(e,g,t),a-=g}var l,u,p,d,h;return f}function U7(e,t,r){v2(e),r.bytesFilled+=t}function B7(e){e._queueTotalSize===0&&e._closeRequested?(Nf(e),Dl(e._controlledReadableByteStream)):wa(e)}function v2(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function L7(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;const t=e._pendingPullIntos.peek();x7(e,t)&&(yy(e),py(e._controlledReadableByteStream,t))}}function c3(e,t){const r=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");(function(n,s){s.buffer=s.buffer;const i=n._controlledReadableByteStream;if(b2(i))for(;j7(i)>0;)py(i,yy(n))})(e,r)}else(function(n,s,i){if(i.bytesFilled+s>i.byteLength)throw new RangeError("bytesWritten out of range");if(U7(n,s,i),i.bytesFilled<i.elementSize)return;yy(n);const o=i.bytesFilled%i.elementSize;if(o>0){const a=i.byteOffset+i.bytesFilled,f=i.buffer.slice(a-o,a);Zd(n,f,0,f.byteLength)}i.buffer=i.buffer,i.bytesFilled-=o,py(n._controlledReadableByteStream,i),L7(n)})(e,t,r);wa(e)}function yy(e){const t=e._pendingPullIntos.shift();return v2(e),t}function Nf(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function pl(e,t){const r=e._controlledReadableByteStream;r._state==="readable"&&(function(n){v2(n),n._pendingPullIntos=new Pi}(e),Us(e),Nf(e),s9(r,t))}function K7(e){const t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function AI(e,t,r){const n=Object.create(Of.prototype);let s=()=>{},i=()=>or(void 0),o=()=>or(void 0);t.start!==void 0&&(s=()=>t.start(n)),t.pull!==void 0&&(i=()=>t.pull(n)),t.cancel!==void 0&&(o=f=>t.cancel(f));const a=t.autoAllocateChunkSize;if(a===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");(function(f,c,l,u,p,d,h){c._controlledReadableByteStream=f,c._pullAgain=!1,c._pulling=!1,c._byobRequest=null,c._queue=c._queueTotalSize=void 0,Us(c),c._closeRequested=!1,c._started=!1,c._strategyHWM=d,c._pullAlgorithm=u,c._cancelAlgorithm=p,c._autoAllocateChunkSize=h,c._pendingPullIntos=new Pi,f._readableStreamController=c,Zn(or(l()),()=>{c._started=!0,wa(c)},y=>{pl(c,y)})})(e,n,s,i,o,r,a)}function g0(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Mo(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function u3(e,t){e._reader._readIntoRequests.push(t)}function j7(e){return e._reader._readIntoRequests.length}function b2(e){const t=e._reader;return t!==void 0&&!!ju(t)}Object.defineProperties(Of.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Of.prototype,Ht.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Df{constructor(t){if(ts(t,1,"ReadableStreamBYOBReader"),y2(t,"First parameter"),Ts(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!La(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");E7(this,t),this._readIntoRequests=new Pi}get closed(){return ju(this)?this._closedPromise:kt(ud("closed"))}cancel(t=void 0){return ju(this)?this._ownerReadableStream===void 0?kt(io("cancel")):l2(this,t):kt(ud("cancel"))}read(t){if(!ju(this))return kt(ud("read"));if(!ArrayBuffer.isView(t))return kt(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return kt(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return kt(new TypeError("view's buffer must have non-zero byteLength"));if(this._ownerReadableStream===void 0)return kt(io("read from"));let r,n;const s=un((i,o)=>{r=i,n=o});return function(i,o,a){const f=i._ownerReadableStream;f._disturbed=!0,f._state==="errored"?a._errorSteps(f._storedError):function(c,l,u){const p=c._controlledReadableByteStream;let d=1;l.constructor!==DataView&&(d=l.constructor.BYTES_PER_ELEMENT);const h=l.constructor,y={buffer:l.buffer,byteOffset:l.byteOffset,byteLength:l.byteLength,bytesFilled:0,elementSize:d,viewConstructor:h,readerType:"byob"};if(c._pendingPullIntos.length>0)return c._pendingPullIntos.push(y),void u3(p,u);if(p._state!=="closed"){if(c._queueTotalSize>0){if(x7(c,y)){const g=D7(y);return B7(c),void u._chunkSteps(g)}if(c._closeRequested){const g=new TypeError("Insufficient bytes to fill elements in the given buffer");return pl(c,g),void u._errorSteps(g)}}c._pendingPullIntos.push(y),u3(p,u),wa(c)}else{const g=new h(y.buffer,y.byteOffset,0);u._closeSteps(g)}}(f._readableStreamController,o,a)}(this,t,{_chunkSteps:i=>r({value:i,done:!1}),_closeSteps:i=>r({value:i,done:!0}),_errorSteps:i=>n(i)}),s}releaseLock(){if(!ju(this))throw ud("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");la(this)}}}function ju(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function ud(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function yl(e,t){const{highWaterMark:r}=e;if(r===void 0)return t;if(O7(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function xf(e){const{size:t}=e;return t||(()=>1)}function Uf(e,t){zi(e,t);const r=e==null?void 0:e.highWaterMark,n=e==null?void 0:e.size;return{highWaterMark:r===void 0?void 0:p2(r),size:n===void 0?void 0:SI(n,t+" has member 'size' that")}}function SI(e,t){return Qn(e,t),r=>p2(e(r))}function PI(e,t,r){return Qn(e,r),n=>Pa(e,t,[n])}function TI(e,t,r){return Qn(e,r),()=>Pa(e,t,[])}function II(e,t,r){return Qn(e,r),n=>uh(e,t,[n])}function CI(e,t,r){return Qn(e,r),(n,s)=>Pa(e,t,[n,s])}function q7(e,t){if(!Va(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(Df.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Df.prototype,Ht.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});class Bf{constructor(t={},r={}){t===void 0?t=null:I7(t,"First parameter");const n=Uf(r,"Second parameter"),s=function(o,a){zi(o,a);const f=o==null?void 0:o.abort,c=o==null?void 0:o.close,l=o==null?void 0:o.start,u=o==null?void 0:o.type,p=o==null?void 0:o.write;return{abort:f===void 0?void 0:PI(f,o,a+" has member 'abort' that"),close:c===void 0?void 0:TI(c,o,a+" has member 'close' that"),start:l===void 0?void 0:II(l,o,a+" has member 'start' that"),write:p===void 0?void 0:CI(p,o,a+" has member 'write' that"),type:u}}(t,"First parameter");if(V7(this),s.type!==void 0)throw new RangeError("Invalid type is specified");const i=xf(n);(function(o,a,f,c){const l=Object.create(gl.prototype);let u=()=>{},p=()=>or(void 0),d=()=>or(void 0),h=()=>or(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.write!==void 0&&(p=y=>a.write(y,l)),a.close!==void 0&&(d=()=>a.close()),a.abort!==void 0&&(h=y=>a.abort(y)),J7(o,l,u,p,d,h,f,c)})(this,s,yl(n,1),i)}get locked(){if(!Va(this))throw dd("locked");return Qa(this)}abort(t=void 0){return Va(this)?Qa(this)?kt(new TypeError("Cannot abort a stream that already has a writer")):Lf(this,t):kt(dd("abort"))}close(){return Va(this)?Qa(this)?kt(new TypeError("Cannot close a stream that already has a writer")):gi(this)?kt(new TypeError("Cannot close an already-closing stream")):F7(this):kt(dd("close"))}getWriter(){if(!Va(this))throw dd("getWriter");return $7(this)}}function $7(e){return new Kf(e)}function V7(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new Pi,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Va(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function Qa(e){return e._writer!==void 0}function Lf(e,t){const r=e._state;if(r==="closed"||r==="errored")return or(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let n=!1;r==="erroring"&&(n=!0,t=void 0);const s=un((i,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:i,_reject:o,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=s,n||_2(e,t),s}function F7(e){const t=e._state;if(t==="closed"||t==="errored")return kt(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=un((i,o)=>{const a={_resolve:i,_reject:o};e._closeRequest=a}),n=e._writer;var s;return n!==void 0&&e._backpressure&&t==="writable"&&P2(n),m2(s=e._writableStreamController,Y7,0),fh(s),r}function gy(e,t){e._state!=="writable"?w2(e):_2(e,t)}function _2(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;n!==void 0&&G7(n,t),!function(s){return!(s._inFlightWriteRequest===void 0&&s._inFlightCloseRequest===void 0)}(e)&&r._started&&w2(e)}function w2(e){e._state="errored",e._writableStreamController[T7]();const t=e._storedError;if(e._writeRequests.forEach(n=>{n._reject(t)}),e._writeRequests=new Pi,e._pendingAbortRequest===void 0)return void ld(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void ld(e);Zn(e._writableStreamController[P7](r._reason),()=>{r._resolve(),ld(e)},n=>{r._reject(n),ld(e)})}function gi(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function ld(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;t!==void 0&&S2(t,e._storedError)}function E2(e,t){const r=e._writer;r!==void 0&&t!==e._backpressure&&(t?function(n){hh(n)}(r):P2(r)),e._backpressure=t}Object.defineProperties(Bf.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Bf.prototype,Ht.toStringTag,{value:"WritableStream",configurable:!0});class Kf{constructor(t){if(ts(t,1,"WritableStreamDefaultWriter"),q7(t,"First parameter"),Qa(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;const r=t._state;if(r==="writable")!gi(t)&&t._backpressure?hh(this):l3(this),Xd(this);else if(r==="erroring")vy(this,t._storedError),Xd(this);else if(r==="closed")l3(this),Xd(n=this),e9(n);else{const s=t._storedError;vy(this,s),Q7(this,s)}var n}get closed(){return Vs(this)?this._closedPromise:kt(Fs("closed"))}get desiredSize(){if(!Vs(this))throw Fs("desiredSize");if(this._ownerWritableStream===void 0)throw qu("desiredSize");return function(t){const r=t._ownerWritableStream,n=r._state;return n==="errored"||n==="erroring"?null:n==="closed"?0:Z7(r._writableStreamController)}(this)}get ready(){return Vs(this)?this._readyPromise:kt(Fs("ready"))}abort(t=void 0){return Vs(this)?this._ownerWritableStream===void 0?kt(qu("abort")):function(r,n){const s=r._ownerWritableStream;return Lf(s,n)}(this,t):kt(Fs("abort"))}close(){if(!Vs(this))return kt(Fs("close"));const t=this._ownerWritableStream;return t===void 0?kt(qu("close")):gi(t)?kt(new TypeError("Cannot close an already-closing stream")):H7(this)}releaseLock(){if(!Vs(this))throw Fs("releaseLock");this._ownerWritableStream!==void 0&&z7(this)}write(t=void 0){return Vs(this)?this._ownerWritableStream===void 0?kt(qu("write to")):W7(this,t):kt(Fs("write"))}}function Vs(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function H7(e){return F7(e._ownerWritableStream)}function RI(e,t){e._closedPromiseState==="pending"?S2(e,t):function(r,n){Q7(r,n)}(e,t)}function G7(e,t){e._readyPromiseState==="pending"?t9(e,t):function(r,n){vy(r,n)}(e,t)}function z7(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");G7(e,r),RI(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function W7(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,s=function(a,f){try{return a._strategySizeAlgorithm(f)}catch(c){return my(a,c),1}}(n,t);if(r!==e._ownerWritableStream)return kt(qu("write to"));const i=r._state;if(i==="errored")return kt(r._storedError);if(gi(r)||i==="closed")return kt(new TypeError("The stream is closing or closed and cannot be written to"));if(i==="erroring")return kt(r._storedError);const o=function(a){return un((f,c)=>{const l={_resolve:f,_reject:c};a._writeRequests.push(l)})}(r);return function(a,f,c){try{m2(a,f,c)}catch(u){return void my(a,u)}const l=a._controlledWritableStream;!gi(l)&&l._state==="writable"&&E2(l,A2(a)),fh(a)}(n,t,s),o}Object.defineProperties(Kf.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Kf.prototype,Ht.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Y7={};class gl{constructor(){throw new TypeError("Illegal constructor")}error(t=void 0){if(!function(r){return!(!mn(r)||!Object.prototype.hasOwnProperty.call(r,"_controlledWritableStream"))}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");this._controlledWritableStream._state==="writable"&&X7(this,t)}[P7](t){const r=this._abortAlgorithm(t);return jf(this),r}[T7](){Us(this)}}function J7(e,t,r,n,s,i,o,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Us(t),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=s,t._abortAlgorithm=i;const f=A2(t);E2(e,f),Zn(or(r()),()=>{t._started=!0,fh(t)},c=>{t._started=!0,gy(e,c)})}function jf(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Z7(e){return e._strategyHWM-e._queueTotalSize}function fh(e){const t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring")return void w2(t);if(e._queue.length===0)return;const r=e._queue.peek().value;r===Y7?function(n){const s=n._controlledWritableStream;(function(o){o._inFlightCloseRequest=o._closeRequest,o._closeRequest=void 0})(s),hy(n);const i=n._closeAlgorithm();jf(n),Zn(i,()=>{(function(o){o._inFlightCloseRequest._resolve(void 0),o._inFlightCloseRequest=void 0,o._state==="erroring"&&(o._storedError=void 0,o._pendingAbortRequest!==void 0&&(o._pendingAbortRequest._resolve(),o._pendingAbortRequest=void 0)),o._state="closed";const a=o._writer;a!==void 0&&e9(a)})(s)},o=>{(function(a,f){a._inFlightCloseRequest._reject(f),a._inFlightCloseRequest=void 0,a._pendingAbortRequest!==void 0&&(a._pendingAbortRequest._reject(f),a._pendingAbortRequest=void 0),gy(a,f)})(s,o)})}(e):function(n,s){const i=n._controlledWritableStream;(function(a){a._inFlightWriteRequest=a._writeRequests.shift()})(i);const o=n._writeAlgorithm(s);Zn(o,()=>{(function(f){f._inFlightWriteRequest._resolve(void 0),f._inFlightWriteRequest=void 0})(i);const a=i._state;if(hy(n),!gi(i)&&a==="writable"){const f=A2(n);E2(i,f)}fh(n)},a=>{i._state==="writable"&&jf(n),function(f,c){f._inFlightWriteRequest._reject(c),f._inFlightWriteRequest=void 0,gy(f,c)}(i,a)})}(e,r)}function my(e,t){e._controlledWritableStream._state==="writable"&&X7(e,t)}function A2(e){return Z7(e)<=0}function X7(e,t){const r=e._controlledWritableStream;jf(e),_2(r,t)}function dd(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Fs(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function qu(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Xd(e){e._closedPromise=un((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function Q7(e,t){Xd(e),S2(e,t)}function S2(e,t){e._closedPromise_reject!==void 0&&(Nl(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function e9(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function hh(e){e._readyPromise=un((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function vy(e,t){hh(e),t9(e,t)}function l3(e){hh(e),P2(e)}function t9(e,t){e._readyPromise_reject!==void 0&&(Nl(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function P2(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(gl.prototype,{error:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(gl.prototype,Ht.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const d3=typeof DOMException<"u"?DOMException:void 0,kI=function(e){if(typeof e!="function"&&typeof e!="object")return!1;try{return new e,!0}catch{return!1}}(d3)?d3:function(){const e=function(t,r){this.message=t||"",this.name=r||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return Object.defineProperty(e.prototype=Object.create(Error.prototype),"constructor",{value:e,writable:!0,configurable:!0}),e}();function f3(e,t,r,n,s,i){const o=Jd(e),a=$7(t);e._disturbed=!0;let f=!1,c=or(void 0);return un((l,u)=>{let p;if(i!==void 0){if(p=()=>{const b=new kI("Aborted","AbortError"),w=[];n||w.push(()=>t._state==="writable"?Lf(t,b):or(void 0)),s||w.push(()=>e._state==="readable"?pa(e,b):or(void 0)),y(()=>Promise.all(w.map(E=>E())),!0,b)},i.aborted)return void p();i.addEventListener("abort",p)}if(h(e,o._closedPromise,b=>{n?g(!0,b):y(()=>Lf(t,b),!0,b)}),h(t,a._closedPromise,b=>{s?g(!0,b):y(()=>pa(e,b),!0,b)}),function(b,w,E){b._state==="closed"?E():h0(w,E)}(e,o._closedPromise,()=>{r?g():y(()=>function(b){const w=b._ownerWritableStream,E=w._state;return gi(w)||E==="closed"?or(void 0):E==="errored"?kt(w._storedError):H7(b)}(a))}),gi(t)||t._state==="closed"){const b=new TypeError("the destination writable stream closed before all data could be piped to it");s?g(!0,b):y(()=>pa(e,b),!0,b)}function d(){const b=c;return Gi(c,()=>b!==c?d():void 0)}function h(b,w,E){b._state==="errored"?E(b._storedError):_7(w,E)}function y(b,w,E){function C(){Zn(b(),()=>m(w,E),R=>m(!0,R))}f||(f=!0,t._state!=="writable"||gi(t)?C():h0(d(),C))}function g(b,w){f||(f=!0,t._state!=="writable"||gi(t)?m(b,w):h0(d(),()=>m(b,w)))}function m(b,w){z7(a),la(o),i!==void 0&&i.removeEventListener("abort",p),b?u(w):l(void 0)}Nl(un((b,w)=>{(function E(C){C?b():Gi(f?or(!0):Gi(a._readyPromise,()=>un((R,M)=>{dh(o,{_chunkSteps:_=>{c=Gi(W7(a,_),void 0,c2),R(!1)},_closeSteps:()=>R(!0),_errorSteps:M})})),E,w)})(!1)}))})}class ml{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!fd(this))throw hd("desiredSize");return T2(this)}close(){if(!fd(this))throw hd("close");if(!so(this))throw new TypeError("The stream is not in a state that permits close");bl(this)}enqueue(t=void 0){if(!fd(this))throw hd("enqueue");if(!so(this))throw new TypeError("The stream is not in a state that permits enqueue");return $f(this,t)}error(t=void 0){if(!fd(this))throw hd("error");Ns(this,t)}[f2](t){Us(this);const r=this._cancelAlgorithm(t);return qf(this),r}[h2](t){const r=this._controlledReadableStream;if(this._queue.length>0){const n=hy(this);this._closeRequested&&this._queue.length===0?(qf(this),Dl(r)):vl(this),t._chunkSteps(n)}else R7(r,t),vl(this)}}function fd(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function vl(e){if(r9(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,Zn(e._pullAlgorithm(),()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,vl(e))},t=>{Ns(e,t)})}}function r9(e){const t=e._controlledReadableStream;return!so(e)||!e._started?!1:Ts(t)&&lh(t)>0?!0:T2(e)>0}function qf(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function bl(e){if(!so(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(qf(e),Dl(t))}function $f(e,t){if(!so(e))return;const r=e._controlledReadableStream;if(Ts(r)&&lh(r)>0)g2(r,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(s){throw Ns(e,s),s}try{m2(e,t,n)}catch(s){throw Ns(e,s),s}}vl(e)}function Ns(e,t){const r=e._controlledReadableStream;r._state==="readable"&&(Us(e),qf(e),s9(r,t))}function T2(e){const t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function so(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function n9(e,t,r,n,s,i,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Us(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=s,e._readableStreamController=t,Zn(or(r()),()=>{t._started=!0,vl(t)},a=>{Ns(t,a)})}function hd(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function MI(e,t,r){return Qn(e,r),n=>Pa(e,t,[n])}function OI(e,t,r){return Qn(e,r),n=>Pa(e,t,[n])}function NI(e,t,r){return Qn(e,r),n=>uh(e,t,[n])}function DI(e,t){if((e=""+e)!="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function xI(e,t){if((e=""+e)!="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function h3(e,t){zi(e,t);const r=e==null?void 0:e.preventAbort,n=e==null?void 0:e.preventCancel,s=e==null?void 0:e.preventClose,i=e==null?void 0:e.signal;return i!==void 0&&function(o,a){if(!function(f){if(typeof f!="object"||f===null)return!1;try{return typeof f.aborted=="boolean"}catch{return!1}}(o))throw new TypeError(a+" is not an AbortSignal.")}(i,t+" has member 'signal' that"),{preventAbort:!!r,preventCancel:!!n,preventClose:!!s,signal:i}}Object.defineProperties(ml.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(ml.prototype,Ht.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class Fa{constructor(t={},r={}){t===void 0?t=null:I7(t,"First parameter");const n=Uf(r,"Second parameter"),s=function(i,o){zi(i,o);const a=i,f=a==null?void 0:a.autoAllocateChunkSize,c=a==null?void 0:a.cancel,l=a==null?void 0:a.pull,u=a==null?void 0:a.start,p=a==null?void 0:a.type;return{autoAllocateChunkSize:f===void 0?void 0:C7(f,o+" has member 'autoAllocateChunkSize' that"),cancel:c===void 0?void 0:MI(c,a,o+" has member 'cancel' that"),pull:l===void 0?void 0:OI(l,a,o+" has member 'pull' that"),start:u===void 0?void 0:NI(u,a,o+" has member 'start' that"),type:p===void 0?void 0:DI(p,o+" has member 'type' that")}}(t,"First parameter");if(i9(this),s.type==="bytes"){if(n.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");AI(this,s,yl(n,0))}else{const i=xf(n);(function(o,a,f,c){const l=Object.create(ml.prototype);let u=()=>{},p=()=>or(void 0),d=()=>or(void 0);a.start!==void 0&&(u=()=>a.start(l)),a.pull!==void 0&&(p=()=>a.pull(l)),a.cancel!==void 0&&(d=h=>a.cancel(h)),n9(o,l,u,p,d,f,c)})(this,s,yl(n,1),i)}}get locked(){if(!fs(this))throw Hs("locked");return Ts(this)}cancel(t=void 0){return fs(this)?Ts(this)?kt(new TypeError("Cannot cancel a stream that already has a reader")):pa(this,t):kt(Hs("cancel"))}getReader(t=void 0){if(!fs(this))throw Hs("getReader");return function(n,s){zi(n,s);const i=n==null?void 0:n.mode;return{mode:i===void 0?void 0:xI(i,s+" has member 'mode' that")}}(t,"First parameter").mode===void 0?Jd(this):function(n){return new Df(n)}(this)}pipeThrough(t,r={}){if(!fs(this))throw Hs("pipeThrough");ts(t,1,"pipeThrough");const n=function(i,o){zi(i,o);const a=i==null?void 0:i.readable;fy(a,"readable","ReadableWritablePair"),y2(a,o+" has member 'readable' that");const f=i==null?void 0:i.writable;return fy(f,"writable","ReadableWritablePair"),q7(f,o+" has member 'writable' that"),{readable:a,writable:f}}(t,"First parameter"),s=h3(r,"Second parameter");if(Ts(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Qa(n.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return Nl(f3(this,n.writable,s.preventClose,s.preventAbort,s.preventCancel,s.signal)),n.readable}pipeTo(t,r={}){if(!fs(this))return kt(Hs("pipeTo"));if(t===void 0)return kt("Parameter 1 is required in 'pipeTo'.");if(!Va(t))return kt(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let n;try{n=h3(r,"Second parameter")}catch(s){return kt(s)}return Ts(this)?kt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Qa(t)?kt(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):f3(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!fs(this))throw Hs("tee");const t=function(r,n){const s=Jd(r);let i,o,a,f,c,l=!1,u=!1,p=!1;const d=un(g=>{c=g});function h(){return l||(l=!0,dh(s,{_chunkSteps:g=>{w7(()=>{l=!1;const m=g,b=g;u||$f(a._readableStreamController,m),p||$f(f._readableStreamController,b)})},_closeSteps:()=>{l=!1,u||bl(a._readableStreamController),p||bl(f._readableStreamController),u&&p||c(void 0)},_errorSteps:()=>{l=!1}})),or(void 0)}function y(){}return a=by(y,h,function(g){if(u=!0,i=g,p){const m=p0([i,o]),b=pa(r,m);c(b)}return d}),f=by(y,h,function(g){if(p=!0,o=g,u){const m=p0([i,o]),b=pa(r,m);c(b)}return d}),_7(s._closedPromise,g=>{Ns(a._readableStreamController,g),Ns(f._readableStreamController,g),u&&p||c(void 0)}),[a,f]}(this);return p0(t)}values(t=void 0){if(!fs(this))throw Hs("values");return function(r,n){const s=Jd(r),i=new EI(s,n),o=Object.create(M7);return o._asyncIteratorImpl=i,o}(this,function(r,n){return zi(r,n),{preventCancel:!!(r!=null&&r.preventCancel)}}(t,"First parameter").preventCancel)}}function by(e,t,r,n=1,s=()=>1){const i=Object.create(Fa.prototype);return i9(i),n9(i,Object.create(ml.prototype),e,t,r,n,s),i}function i9(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function fs(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Ts(e){return e._reader!==void 0}function pa(e,t){return e._disturbed=!0,e._state==="closed"?or(void 0):e._state==="errored"?kt(e._storedError):(Dl(e),ha(e._readableStreamController[f2](t),c2))}function Dl(e){e._state="closed";const t=e._reader;t!==void 0&&(S7(t),da(t)&&(t._readRequests.forEach(r=>{r._closeSteps()}),t._readRequests=new Pi))}function s9(e,t){e._state="errored",e._storedError=t;const r=e._reader;r!==void 0&&(d2(r,t),da(r)?(r._readRequests.forEach(n=>{n._errorSteps(t)}),r._readRequests=new Pi):(r._readIntoRequests.forEach(n=>{n._errorSteps(t)}),r._readIntoRequests=new Pi))}function Hs(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function a9(e,t){zi(e,t);const r=e==null?void 0:e.highWaterMark;return fy(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:p2(r)}}Object.defineProperties(Fa.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Fa.prototype,Ht.toStringTag,{value:"ReadableStream",configurable:!0}),typeof Ht.asyncIterator=="symbol"&&Object.defineProperty(Fa.prototype,Ht.asyncIterator,{value:Fa.prototype.values,writable:!0,configurable:!0});const UI=function(e){return e.byteLength};class _y{constructor(t){ts(t,1,"ByteLengthQueuingStrategy"),t=a9(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!y3(this))throw p3("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!y3(this))throw p3("size");return UI}}function p3(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function y3(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(_y.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(_y.prototype,Ht.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const BI=function(){return 1};class wy{constructor(t){ts(t,1,"CountQueuingStrategy"),t=a9(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!m3(this))throw g3("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!m3(this))throw g3("size");return BI}}function g3(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function m3(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function LI(e,t,r){return Qn(e,r),n=>Pa(e,t,[n])}function KI(e,t,r){return Qn(e,r),n=>uh(e,t,[n])}function jI(e,t,r){return Qn(e,r),(n,s)=>Pa(e,t,[n,s])}Object.defineProperties(wy.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(wy.prototype,Ht.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Ey{constructor(t={},r={},n={}){t===void 0&&(t=null);const s=Uf(r,"Second parameter"),i=Uf(n,"Third parameter"),o=function(p,d){zi(p,d);const h=p==null?void 0:p.flush,y=p==null?void 0:p.readableType,g=p==null?void 0:p.start,m=p==null?void 0:p.transform,b=p==null?void 0:p.writableType;return{flush:h===void 0?void 0:LI(h,p,d+" has member 'flush' that"),readableType:y,start:g===void 0?void 0:KI(g,p,d+" has member 'start' that"),transform:m===void 0?void 0:jI(m,p,d+" has member 'transform' that"),writableType:b}}(t,"First parameter");if(o.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(o.writableType!==void 0)throw new RangeError("Invalid writableType specified");const a=yl(i,0),f=xf(i),c=yl(s,1),l=xf(s);let u;(function(p,d,h,y,g,m){function b(){return d}function w(_){return function(A,I){const P=A._transformStreamController;return A._backpressure?ha(A._backpressureChangePromise,()=>{const v=A._writable;if(v._state==="erroring")throw v._storedError;return b3(P,I)}):b3(P,I)}(p,_)}function E(_){return function(A,I){return Vf(A,I),or(void 0)}(p,_)}function C(){return function(_){const A=_._readable,I=_._transformStreamController,P=I._flushAlgorithm();return o9(I),ha(P,()=>{if(A._state==="errored")throw A._storedError;bl(A._readableStreamController)},v=>{throw Vf(_,v),A._storedError})}(p)}function R(){return function(_){return Ff(_,!1),_._backpressureChangePromise}(p)}function M(_){return ph(p,_),or(void 0)}p._writable=function(_,A,I,P,v=1,S=()=>1){const T=Object.create(Bf.prototype);return V7(T),J7(T,Object.create(gl.prototype),_,A,I,P,v,S),T}(b,w,C,E,h,y),p._readable=by(b,R,M,g,m),p._backpressure=void 0,p._backpressureChangePromise=void 0,p._backpressureChangePromise_resolve=void 0,Ff(p,!0),p._transformStreamController=void 0})(this,un(p=>{u=p}),c,l,a,f),function(p,d){const h=Object.create(Hf.prototype);let y=m=>{try{return c9(h,m),or(void 0)}catch(b){return kt(b)}},g=()=>or(void 0);d.transform!==void 0&&(y=m=>d.transform(m,h)),d.flush!==void 0&&(g=()=>d.flush(h)),function(m,b,w,E){b._controlledTransformStream=m,m._transformStreamController=b,b._transformAlgorithm=w,b._flushAlgorithm=E}(p,h,y,g)}(this,o),o.start!==void 0?u(o.start(this._transformStreamController)):u(void 0)}get readable(){if(!v3(this))throw _3("readable");return this._readable}get writable(){if(!v3(this))throw _3("writable");return this._writable}}function v3(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function Vf(e,t){Ns(e._readable._readableStreamController,t),ph(e,t)}function ph(e,t){o9(e._transformStreamController),my(e._writable._writableStreamController,t),e._backpressure&&Ff(e,!1)}function Ff(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=un(r=>{e._backpressureChangePromise_resolve=r}),e._backpressure=t}Object.defineProperties(Ey.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Ey.prototype,Ht.toStringTag,{value:"TransformStream",configurable:!0});class Hf{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!pd(this))throw yd("desiredSize");return T2(this._controlledTransformStream._readable._readableStreamController)}enqueue(t=void 0){if(!pd(this))throw yd("enqueue");c9(this,t)}error(t=void 0){if(!pd(this))throw yd("error");var r;r=t,Vf(this._controlledTransformStream,r)}terminate(){if(!pd(this))throw yd("terminate");(function(t){const r=t._controlledTransformStream,n=r._readable._readableStreamController;bl(n),ph(r,new TypeError("TransformStream terminated"))})(this)}}function pd(e){return!!mn(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function o9(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function c9(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!so(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{$f(n,t)}catch(i){throw ph(r,i),r._readable._storedError}(function(i){return!r9(i)})(n)!==r._backpressure&&Ff(r,!0)}function b3(e,t){return ha(e._transformAlgorithm(t),void 0,r=>{throw Vf(e._controlledTransformStream,r),r})}function yd(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function _3(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Hf.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof Ht.toStringTag=="symbol"&&Object.defineProperty(Hf.prototype,Ht.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var qI=Object.freeze({__proto__:null,ByteLengthQueuingStrategy:_y,CountQueuingStrategy:wy,ReadableByteStreamController:Of,ReadableStream:Fa,ReadableStreamBYOBReader:Df,ReadableStreamBYOBRequest:Mf,ReadableStreamDefaultController:ml,ReadableStreamDefaultReader:Rf,TransformStream:Ey,TransformStreamDefaultController:Hf,WritableStream:Bf,WritableStreamDefaultController:gl,WritableStreamDefaultWriter:Kf}),Ay=function(e,t){return Ay=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Ay(e,t)};/*! *****************************************************************************
40
+ Copyright (c) Microsoft Corporation.
41
+
42
+ Permission to use, copy, modify, and/or distribute this software for any
43
+ purpose with or without fee is hereby granted.
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
46
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
47
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
+ PERFORMANCE OF THIS SOFTWARE.
52
+ ***************************************************************************** */function u9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+t+" is not a constructor or null");function r(){this.constructor=e}Ay(e,t),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Tn(e){if(!e)throw new TypeError("Assertion failed")}function rl(){}function I2(e){return typeof e=="object"&&e!==null||typeof e=="function"}function m0(e){if(typeof e!="function")return!1;var t=!1;try{new e({start:function(){t=!0}})}catch{}return t}function C2(e){return!!I2(e)&&typeof e.getReader=="function"}function R2(e){return!!I2(e)&&typeof e.getWriter=="function"}function l9(e){return!!I2(e)&&!!C2(e.readable)&&!!R2(e.writable)}function d9(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch{return!1}}function v0(e,t){var r=(t===void 0?{}:t).type;return Tn(C2(e)),Tn(e.locked===!1),(r=f9(r))==="bytes"?new VI(e):new $I(e)}function f9(e){var t=e+"";if(t==="bytes")return t;if(e===void 0)return e;throw new RangeError("Invalid type is specified")}var h9=function(){function e(t){this._underlyingReader=void 0,this._readerMode=void 0,this._readableStreamController=void 0,this._pendingRead=void 0,this._underlyingStream=t,this._attachDefaultReader()}return e.prototype.start=function(t){this._readableStreamController=t},e.prototype.cancel=function(t){return Tn(this._underlyingReader!==void 0),this._underlyingReader.cancel(t)},e.prototype._attachDefaultReader=function(){if(this._readerMode!=="default"){this._detachReader();var t=this._underlyingStream.getReader();this._readerMode="default",this._attachReader(t)}},e.prototype._attachReader=function(t){var r=this;Tn(this._underlyingReader===void 0),this._underlyingReader=t;var n=this._underlyingReader.closed;n&&n.then(function(){return r._finishPendingRead()}).then(function(){t===r._underlyingReader&&r._readableStreamController.close()},function(s){t===r._underlyingReader&&r._readableStreamController.error(s)}).catch(rl)},e.prototype._detachReader=function(){this._underlyingReader!==void 0&&(this._underlyingReader.releaseLock(),this._underlyingReader=void 0,this._readerMode=void 0)},e.prototype._pullWithDefaultReader=function(){var t=this;this._attachDefaultReader();var r=this._underlyingReader.read().then(function(n){var s=t._readableStreamController;n.done?t._tryClose():s.enqueue(n.value)});return this._setPendingRead(r),r},e.prototype._tryClose=function(){try{this._readableStreamController.close()}catch{}},e.prototype._setPendingRead=function(t){var r,n=this,s=function(){n._pendingRead===r&&(n._pendingRead=void 0)};this._pendingRead=r=t.then(s,s)},e.prototype._finishPendingRead=function(){var t=this;if(this._pendingRead){var r=function(){return t._finishPendingRead()};return this._pendingRead.then(r,r)}},e}(),$I=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return u9(t,e),t.prototype.pull=function(){return this._pullWithDefaultReader()},t}(h9);function w3(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var VI=function(e){function t(r){var n=this,s=d9(r);return(n=e.call(this,r)||this)._supportsByob=s,n}return u9(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"bytes"},enumerable:!1,configurable:!0}),t.prototype._attachByobReader=function(){if(this._readerMode!=="byob"){Tn(this._supportsByob),this._detachReader();var r=this._underlyingStream.getReader({mode:"byob"});this._readerMode="byob",this._attachReader(r)}},t.prototype.pull=function(){if(this._supportsByob){var r=this._readableStreamController.byobRequest;if(r)return this._pullWithByobRequest(r)}return this._pullWithDefaultReader()},t.prototype._pullWithByobRequest=function(r){var n=this;this._attachByobReader();var s=new Uint8Array(r.view.byteLength),i=this._underlyingReader.read(s).then(function(o){var a,f,c;n._readableStreamController,o.done?(n._tryClose(),r.respond(0)):(a=o.value,f=r.view,c=w3(a),w3(f).set(c,0),r.respond(o.value.byteLength))});return this._setPendingRead(i),i},t}(h9);function E3(e){Tn(R2(e)),Tn(e.locked===!1);var t=e.getWriter();return new FI(t)}var FI=function(){function e(t){var r=this;this._writableStreamController=void 0,this._pendingWrite=void 0,this._state="writable",this._storedError=void 0,this._underlyingWriter=t,this._errorPromise=new Promise(function(n,s){r._errorPromiseReject=s}),this._errorPromise.catch(rl)}return e.prototype.start=function(t){var r=this;this._writableStreamController=t,this._underlyingWriter.closed.then(function(){r._state="closed"}).catch(function(n){return r._finishErroring(n)})},e.prototype.write=function(t){var r=this,n=this._underlyingWriter;if(n.desiredSize===null)return n.ready;var s=n.write(t);s.catch(function(o){return r._finishErroring(o)}),n.ready.catch(function(o){return r._startErroring(o)});var i=Promise.race([s,this._errorPromise]);return this._setPendingWrite(i),i},e.prototype.close=function(){var t=this;return this._pendingWrite===void 0?this._underlyingWriter.close():this._finishPendingWrite().then(function(){return t.close()})},e.prototype.abort=function(t){if(this._state!=="errored")return this._underlyingWriter.abort(t)},e.prototype._setPendingWrite=function(t){var r,n=this,s=function(){n._pendingWrite===r&&(n._pendingWrite=void 0)};this._pendingWrite=r=t.then(s,s)},e.prototype._finishPendingWrite=function(){var t=this;if(this._pendingWrite===void 0)return Promise.resolve();var r=function(){return t._finishPendingWrite()};return this._pendingWrite.then(r,r)},e.prototype._startErroring=function(t){var r=this;if(this._state==="writable"){this._state="erroring",this._storedError=t;var n=function(){return r._finishErroring(t)};this._pendingWrite===void 0?n():this._finishPendingWrite().then(n,n),this._writableStreamController.error(t)}},e.prototype._finishErroring=function(t){this._state==="writable"&&this._startErroring(t),this._state==="erroring"&&(this._state="errored",this._errorPromiseReject(this._storedError))},e}();function A3(e){Tn(l9(e));var t=e.readable,r=e.writable;Tn(t.locked===!1),Tn(r.locked===!1);var n,s=t.getReader();try{n=r.getWriter()}catch(i){throw s.releaseLock(),i}return new HI(s,n)}var HI=function(){function e(t,r){var n=this;this._transformStreamController=void 0,this._onRead=function(s){if(!s.done)return n._transformStreamController.enqueue(s.value),n._reader.read().then(n._onRead)},this._onError=function(s){n._flushReject(s),n._transformStreamController.error(s),n._reader.cancel(s).catch(rl),n._writer.abort(s).catch(rl)},this._onTerminate=function(){n._flushResolve(),n._transformStreamController.terminate();var s=new TypeError("TransformStream terminated");n._writer.abort(s).catch(rl)},this._reader=t,this._writer=r,this._flushPromise=new Promise(function(s,i){n._flushResolve=s,n._flushReject=i})}return e.prototype.start=function(t){this._transformStreamController=t,this._reader.read().then(this._onRead).then(this._onTerminate,this._onError);var r=this._reader.closed;r&&r.then(this._onTerminate,this._onError)},e.prototype.transform=function(t){return this._writer.write(t)},e.prototype.flush=function(){var t=this;return this._writer.close().then(function(){return t._flushPromise})},e}(),GI=Object.freeze({__proto__:null,createReadableStreamWrapper:function(e){Tn(function(r){return!!m0(r)&&!!C2(new r)}(e));var t=function(r){try{return new r({type:"bytes"}),!0}catch{return!1}}(e);return function(r,n){var s=(n===void 0?{}:n).type;if((s=f9(s))!=="bytes"||t||(s=void 0),r.constructor===e&&(s!=="bytes"||d9(r)))return r;if(s==="bytes"){var i=v0(r,{type:s});return new e(i)}return i=v0(r),new e(i)}},createTransformStreamWrapper:function(e){return Tn(function(t){return!!m0(t)&&!!l9(new t)}(e)),function(t){if(t.constructor===e)return t;var r=A3(t);return new e(r)}},createWrappingReadableSource:v0,createWrappingTransformer:A3,createWrappingWritableSink:E3,createWritableStreamWrapper:function(e){return Tn(function(t){return!!m0(t)&&!!R2(new t)}(e)),function(t){if(t.constructor===e)return t;var r=E3(t);return new e(r)}}}),pt=Ci(function(e){(function(t,r){function n(_,A){if(!_)throw Error(A||"Assertion failed")}function s(_,A){_.super_=A;var I=function(){};I.prototype=A.prototype,_.prototype=new I,_.prototype.constructor=_}function i(_,A,I){if(i.isBN(_))return _;this.negative=0,this.words=null,this.length=0,this.red=null,_!==null&&(A!=="le"&&A!=="be"||(I=A,A=10),this._init(_||0,A||10,I||"be"))}var o;typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;try{o=void 0}catch{}function a(_,A,I){for(var P=0,v=Math.min(_.length,I),S=A;S<v;S++){var T=_.charCodeAt(S)-48;P<<=4,P|=T>=49&&T<=54?T-49+10:T>=17&&T<=22?T-17+10:15&T}return P}function f(_,A,I,P){for(var v=0,S=Math.min(_.length,I),T=A;T<S;T++){var N=_.charCodeAt(T)-48;v*=P,v+=N>=49?N-49+10:N>=17?N-17+10:N}return v}i.isBN=function(_){return _ instanceof i||_!==null&&typeof _=="object"&&_.constructor.wordSize===i.wordSize&&Array.isArray(_.words)},i.max=function(_,A){return _.cmp(A)>0?_:A},i.min=function(_,A){return _.cmp(A)<0?_:A},i.prototype._init=function(_,A,I){if(typeof _=="number")return this._initNumber(_,A,I);if(typeof _=="object")return this._initArray(_,A,I);A==="hex"&&(A=16),n(A===(0|A)&&A>=2&&A<=36);var P=0;(_=_.toString().replace(/\s+/g,""))[0]==="-"&&P++,A===16?this._parseHex(_,P):this._parseBase(_,A,P),_[0]==="-"&&(this.negative=1),this.strip(),I==="le"&&this._initArray(this.toArray(),A,I)},i.prototype._initNumber=function(_,A,I){_<0&&(this.negative=1,_=-_),_<67108864?(this.words=[67108863&_],this.length=1):_<4503599627370496?(this.words=[67108863&_,_/67108864&67108863],this.length=2):(n(_<9007199254740992),this.words=[67108863&_,_/67108864&67108863,1],this.length=3),I==="le"&&this._initArray(this.toArray(),A,I)},i.prototype._initArray=function(_,A,I){if(n(typeof _.length=="number"),_.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(_.length/3),this.words=Array(this.length);for(var P=0;P<this.length;P++)this.words[P]=0;var v,S,T=0;if(I==="be")for(P=_.length-1,v=0;P>=0;P-=3)S=_[P]|_[P-1]<<8|_[P-2]<<16,this.words[v]|=S<<T&67108863,this.words[v+1]=S>>>26-T&67108863,(T+=24)>=26&&(T-=26,v++);else if(I==="le")for(P=0,v=0;P<_.length;P+=3)S=_[P]|_[P+1]<<8|_[P+2]<<16,this.words[v]|=S<<T&67108863,this.words[v+1]=S>>>26-T&67108863,(T+=24)>=26&&(T-=26,v++);return this.strip()},i.prototype._parseHex=function(_,A){this.length=Math.ceil((_.length-A)/6),this.words=Array(this.length);for(var I=0;I<this.length;I++)this.words[I]=0;var P,v,S=0;for(I=_.length-6,P=0;I>=A;I-=6)v=a(_,I,I+6),this.words[P]|=v<<S&67108863,this.words[P+1]|=v>>>26-S&4194303,(S+=24)>=26&&(S-=26,P++);I+6!==A&&(v=a(_,A,I+6),this.words[P]|=v<<S&67108863,this.words[P+1]|=v>>>26-S&4194303),this.strip()},i.prototype._parseBase=function(_,A,I){this.words=[0],this.length=1;for(var P=0,v=1;v<=67108863;v*=A)P++;P--,v=v/A|0;for(var S=_.length-I,T=S%P,N=Math.min(S,S-T)+I,D=0,O=I;O<N;O+=P)D=f(_,O,O+P,A),this.imuln(v),this.words[0]+D<67108864?this.words[0]+=D:this._iaddn(D);if(T!==0){var L=1;for(D=f(_,O,_.length,A),O=0;O<T;O++)L*=A;this.imuln(L),this.words[0]+D<67108864?this.words[0]+=D:this._iaddn(D)}},i.prototype.copy=function(_){_.words=Array(this.length);for(var A=0;A<this.length;A++)_.words[A]=this.words[A];_.length=this.length,_.negative=this.negative,_.red=this.red},i.prototype.clone=function(){var _=new i(null);return this.copy(_),_},i.prototype._expand=function(_){for(;this.length<_;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(_,A,I){I.negative=A.negative^_.negative;var P=_.length+A.length|0;I.length=P,P=P-1|0;var v=0|_.words[0],S=0|A.words[0],T=v*S,N=67108863&T,D=T/67108864|0;I.words[0]=N;for(var O=1;O<P;O++){for(var L=D>>>26,B=67108863&D,k=Math.min(O,A.length-1),q=Math.max(0,O-_.length+1);q<=k;q++){var W=O-q|0;L+=(T=(v=0|_.words[W])*(S=0|A.words[q])+B)/67108864|0,B=67108863&T}I.words[O]=0|B,D=0|L}return D!==0?I.words[O]=0|D:I.length--,I.strip()}i.prototype.toString=function(_,A){var I;if(A=0|A||1,(_=_||10)===16||_==="hex"){I="";for(var P=0,v=0,S=0;S<this.length;S++){var T=this.words[S],N=(16777215&(T<<P|v)).toString(16);I=(v=T>>>24-P&16777215)!==0||S!==this.length-1?c[6-N.length]+N+I:N+I,(P+=2)>=26&&(P-=26,S--)}for(v!==0&&(I=v.toString(16)+I);I.length%A!=0;)I="0"+I;return this.negative!==0&&(I="-"+I),I}if(_===(0|_)&&_>=2&&_<=36){var D=l[_],O=u[_];I="";var L=this.clone();for(L.negative=0;!L.isZero();){var B=L.modn(O).toString(_);I=(L=L.idivn(O)).isZero()?B+I:c[D-B.length]+B+I}for(this.isZero()&&(I="0"+I);I.length%A!=0;)I="0"+I;return this.negative!==0&&(I="-"+I),I}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var _=this.words[0];return this.length===2?_+=67108864*this.words[1]:this.length===3&&this.words[2]===1?_+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-_:_},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(_,A){return n(o!==void 0),this.toArrayLike(o,_,A)},i.prototype.toArray=function(_,A){return this.toArrayLike(Array,_,A)},i.prototype.toArrayLike=function(_,A,I){var P=this.byteLength(),v=I||Math.max(1,P);n(P<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0"),this.strip();var S,T,N=A==="le",D=new _(v),O=this.clone();if(N){for(T=0;!O.isZero();T++)S=O.andln(255),O.iushrn(8),D[T]=S;for(;T<v;T++)D[T]=0}else{for(T=0;T<v-P;T++)D[T]=0;for(T=0;!O.isZero();T++)S=O.andln(255),O.iushrn(8),D[v-T-1]=S}return D},i.prototype._countBits=Math.clz32?function(_){return 32-Math.clz32(_)}:function(_){var A=_,I=0;return A>=4096&&(I+=13,A>>>=13),A>=64&&(I+=7,A>>>=7),A>=8&&(I+=4,A>>>=4),A>=2&&(I+=2,A>>>=2),I+A},i.prototype._zeroBits=function(_){if(_===0)return 26;var A=_,I=0;return!(8191&A)&&(I+=13,A>>>=13),!(127&A)&&(I+=7,A>>>=7),!(15&A)&&(I+=4,A>>>=4),!(3&A)&&(I+=2,A>>>=2),!(1&A)&&I++,I},i.prototype.bitLength=function(){var _=this.words[this.length-1],A=this._countBits(_);return 26*(this.length-1)+A},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var _=0,A=0;A<this.length;A++){var I=this._zeroBits(this.words[A]);if(_+=I,I!==26)break}return _},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(_){return this.negative!==0?this.abs().inotn(_).iaddn(1):this.clone()},i.prototype.fromTwos=function(_){return this.testn(_-1)?this.notn(_).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(_){for(;this.length<_.length;)this.words[this.length++]=0;for(var A=0;A<_.length;A++)this.words[A]=this.words[A]|_.words[A];return this.strip()},i.prototype.ior=function(_){return n((this.negative|_.negative)==0),this.iuor(_)},i.prototype.or=function(_){return this.length>_.length?this.clone().ior(_):_.clone().ior(this)},i.prototype.uor=function(_){return this.length>_.length?this.clone().iuor(_):_.clone().iuor(this)},i.prototype.iuand=function(_){var A;A=this.length>_.length?_:this;for(var I=0;I<A.length;I++)this.words[I]=this.words[I]&_.words[I];return this.length=A.length,this.strip()},i.prototype.iand=function(_){return n((this.negative|_.negative)==0),this.iuand(_)},i.prototype.and=function(_){return this.length>_.length?this.clone().iand(_):_.clone().iand(this)},i.prototype.uand=function(_){return this.length>_.length?this.clone().iuand(_):_.clone().iuand(this)},i.prototype.iuxor=function(_){var A,I;this.length>_.length?(A=this,I=_):(A=_,I=this);for(var P=0;P<I.length;P++)this.words[P]=A.words[P]^I.words[P];if(this!==A)for(;P<A.length;P++)this.words[P]=A.words[P];return this.length=A.length,this.strip()},i.prototype.ixor=function(_){return n((this.negative|_.negative)==0),this.iuxor(_)},i.prototype.xor=function(_){return this.length>_.length?this.clone().ixor(_):_.clone().ixor(this)},i.prototype.uxor=function(_){return this.length>_.length?this.clone().iuxor(_):_.clone().iuxor(this)},i.prototype.inotn=function(_){n(typeof _=="number"&&_>=0);var A=0|Math.ceil(_/26),I=_%26;this._expand(A),I>0&&A--;for(var P=0;P<A;P++)this.words[P]=67108863&~this.words[P];return I>0&&(this.words[P]=~this.words[P]&67108863>>26-I),this.strip()},i.prototype.notn=function(_){return this.clone().inotn(_)},i.prototype.setn=function(_,A){n(typeof _=="number"&&_>=0);var I=_/26|0,P=_%26;return this._expand(I+1),this.words[I]=A?this.words[I]|1<<P:this.words[I]&~(1<<P),this.strip()},i.prototype.iadd=function(_){var A,I,P;if(this.negative!==0&&_.negative===0)return this.negative=0,A=this.isub(_),this.negative^=1,this._normSign();if(this.negative===0&&_.negative!==0)return _.negative=0,A=this.isub(_),_.negative=1,A._normSign();this.length>_.length?(I=this,P=_):(I=_,P=this);for(var v=0,S=0;S<P.length;S++)A=(0|I.words[S])+(0|P.words[S])+v,this.words[S]=67108863&A,v=A>>>26;for(;v!==0&&S<I.length;S++)A=(0|I.words[S])+v,this.words[S]=67108863&A,v=A>>>26;if(this.length=I.length,v!==0)this.words[this.length]=v,this.length++;else if(I!==this)for(;S<I.length;S++)this.words[S]=I.words[S];return this},i.prototype.add=function(_){var A;return _.negative!==0&&this.negative===0?(_.negative=0,A=this.sub(_),_.negative^=1,A):_.negative===0&&this.negative!==0?(this.negative=0,A=_.sub(this),this.negative=1,A):this.length>_.length?this.clone().iadd(_):_.clone().iadd(this)},i.prototype.isub=function(_){if(_.negative!==0){_.negative=0;var A=this.iadd(_);return _.negative=1,A._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(_),this.negative=1,this._normSign();var I,P,v=this.cmp(_);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;v>0?(I=this,P=_):(I=_,P=this);for(var S=0,T=0;T<P.length;T++)S=(A=(0|I.words[T])-(0|P.words[T])+S)>>26,this.words[T]=67108863&A;for(;S!==0&&T<I.length;T++)S=(A=(0|I.words[T])+S)>>26,this.words[T]=67108863&A;if(S===0&&T<I.length&&I!==this)for(;T<I.length;T++)this.words[T]=I.words[T];return this.length=Math.max(this.length,T),I!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(_){return this.clone().isub(_)};var d=function(_,A,I){var P,v,S,T=_.words,N=A.words,D=I.words,O=0,L=0|T[0],B=8191&L,k=L>>>13,q=0|T[1],W=8191&q,re=q>>>13,ue=0|T[2],H=8191&ue,ae=ue>>>13,V=0|T[3],U=8191&V,te=V>>>13,ge=0|T[4],Pe=8191&ge,Te=ge>>>13,z=0|T[5],$=8191&z,F=z>>>13,Q=0|T[6],de=8191&Q,oe=Q>>>13,ne=0|T[7],Fe=8191&ne,je=ne>>>13,He=0|T[8],he=8191&He,ce=He>>>13,pe=0|T[9],le=8191&pe,fe=pe>>>13,ye=0|N[0],ee=8191&ye,Z=ye>>>13,$e=0|N[1],Ve=8191&$e,Qe=$e>>>13,dt=0|N[2],rt=8191&dt,ve=dt>>>13,G=0|N[3],se=8191&G,me=G>>>13,Se=0|N[4],Ae=8191&Se,ke=Se>>>13,Ne=0|N[5],xe=8191&Ne,Re=Ne>>>13,Me=0|N[6],et=8191&Me,we=Me>>>13,Ce=0|N[7],Oe=8191&Ce,Ue=Ce>>>13,qe=0|N[8],K=8191&qe,Y=qe>>>13,J=0|N[9],x=8191&J,ie=J>>>13;I.negative=_.negative^A.negative,I.length=19;var Ee=(O+(P=Math.imul(B,ee))|0)+((8191&(v=(v=Math.imul(B,Z))+Math.imul(k,ee)|0))<<13)|0;O=((S=Math.imul(k,Z))+(v>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,P=Math.imul(W,ee),v=(v=Math.imul(W,Z))+Math.imul(re,ee)|0,S=Math.imul(re,Z);var Ie=(O+(P=P+Math.imul(B,Ve)|0)|0)+((8191&(v=(v=v+Math.imul(B,Qe)|0)+Math.imul(k,Ve)|0))<<13)|0;O=((S=S+Math.imul(k,Qe)|0)+(v>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,P=Math.imul(H,ee),v=(v=Math.imul(H,Z))+Math.imul(ae,ee)|0,S=Math.imul(ae,Z),P=P+Math.imul(W,Ve)|0,v=(v=v+Math.imul(W,Qe)|0)+Math.imul(re,Ve)|0,S=S+Math.imul(re,Qe)|0;var De=(O+(P=P+Math.imul(B,rt)|0)|0)+((8191&(v=(v=v+Math.imul(B,ve)|0)+Math.imul(k,rt)|0))<<13)|0;O=((S=S+Math.imul(k,ve)|0)+(v>>>13)|0)+(De>>>26)|0,De&=67108863,P=Math.imul(U,ee),v=(v=Math.imul(U,Z))+Math.imul(te,ee)|0,S=Math.imul(te,Z),P=P+Math.imul(H,Ve)|0,v=(v=v+Math.imul(H,Qe)|0)+Math.imul(ae,Ve)|0,S=S+Math.imul(ae,Qe)|0,P=P+Math.imul(W,rt)|0,v=(v=v+Math.imul(W,ve)|0)+Math.imul(re,rt)|0,S=S+Math.imul(re,ve)|0;var Ge=(O+(P=P+Math.imul(B,se)|0)|0)+((8191&(v=(v=v+Math.imul(B,me)|0)+Math.imul(k,se)|0))<<13)|0;O=((S=S+Math.imul(k,me)|0)+(v>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,P=Math.imul(Pe,ee),v=(v=Math.imul(Pe,Z))+Math.imul(Te,ee)|0,S=Math.imul(Te,Z),P=P+Math.imul(U,Ve)|0,v=(v=v+Math.imul(U,Qe)|0)+Math.imul(te,Ve)|0,S=S+Math.imul(te,Qe)|0,P=P+Math.imul(H,rt)|0,v=(v=v+Math.imul(H,ve)|0)+Math.imul(ae,rt)|0,S=S+Math.imul(ae,ve)|0,P=P+Math.imul(W,se)|0,v=(v=v+Math.imul(W,me)|0)+Math.imul(re,se)|0,S=S+Math.imul(re,me)|0;var ut=(O+(P=P+Math.imul(B,Ae)|0)|0)+((8191&(v=(v=v+Math.imul(B,ke)|0)+Math.imul(k,Ae)|0))<<13)|0;O=((S=S+Math.imul(k,ke)|0)+(v>>>13)|0)+(ut>>>26)|0,ut&=67108863,P=Math.imul($,ee),v=(v=Math.imul($,Z))+Math.imul(F,ee)|0,S=Math.imul(F,Z),P=P+Math.imul(Pe,Ve)|0,v=(v=v+Math.imul(Pe,Qe)|0)+Math.imul(Te,Ve)|0,S=S+Math.imul(Te,Qe)|0,P=P+Math.imul(U,rt)|0,v=(v=v+Math.imul(U,ve)|0)+Math.imul(te,rt)|0,S=S+Math.imul(te,ve)|0,P=P+Math.imul(H,se)|0,v=(v=v+Math.imul(H,me)|0)+Math.imul(ae,se)|0,S=S+Math.imul(ae,me)|0,P=P+Math.imul(W,Ae)|0,v=(v=v+Math.imul(W,ke)|0)+Math.imul(re,Ae)|0,S=S+Math.imul(re,ke)|0;var nt=(O+(P=P+Math.imul(B,xe)|0)|0)+((8191&(v=(v=v+Math.imul(B,Re)|0)+Math.imul(k,xe)|0))<<13)|0;O=((S=S+Math.imul(k,Re)|0)+(v>>>13)|0)+(nt>>>26)|0,nt&=67108863,P=Math.imul(de,ee),v=(v=Math.imul(de,Z))+Math.imul(oe,ee)|0,S=Math.imul(oe,Z),P=P+Math.imul($,Ve)|0,v=(v=v+Math.imul($,Qe)|0)+Math.imul(F,Ve)|0,S=S+Math.imul(F,Qe)|0,P=P+Math.imul(Pe,rt)|0,v=(v=v+Math.imul(Pe,ve)|0)+Math.imul(Te,rt)|0,S=S+Math.imul(Te,ve)|0,P=P+Math.imul(U,se)|0,v=(v=v+Math.imul(U,me)|0)+Math.imul(te,se)|0,S=S+Math.imul(te,me)|0,P=P+Math.imul(H,Ae)|0,v=(v=v+Math.imul(H,ke)|0)+Math.imul(ae,Ae)|0,S=S+Math.imul(ae,ke)|0,P=P+Math.imul(W,xe)|0,v=(v=v+Math.imul(W,Re)|0)+Math.imul(re,xe)|0,S=S+Math.imul(re,Re)|0;var Ct=(O+(P=P+Math.imul(B,et)|0)|0)+((8191&(v=(v=v+Math.imul(B,we)|0)+Math.imul(k,et)|0))<<13)|0;O=((S=S+Math.imul(k,we)|0)+(v>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,P=Math.imul(Fe,ee),v=(v=Math.imul(Fe,Z))+Math.imul(je,ee)|0,S=Math.imul(je,Z),P=P+Math.imul(de,Ve)|0,v=(v=v+Math.imul(de,Qe)|0)+Math.imul(oe,Ve)|0,S=S+Math.imul(oe,Qe)|0,P=P+Math.imul($,rt)|0,v=(v=v+Math.imul($,ve)|0)+Math.imul(F,rt)|0,S=S+Math.imul(F,ve)|0,P=P+Math.imul(Pe,se)|0,v=(v=v+Math.imul(Pe,me)|0)+Math.imul(Te,se)|0,S=S+Math.imul(Te,me)|0,P=P+Math.imul(U,Ae)|0,v=(v=v+Math.imul(U,ke)|0)+Math.imul(te,Ae)|0,S=S+Math.imul(te,ke)|0,P=P+Math.imul(H,xe)|0,v=(v=v+Math.imul(H,Re)|0)+Math.imul(ae,xe)|0,S=S+Math.imul(ae,Re)|0,P=P+Math.imul(W,et)|0,v=(v=v+Math.imul(W,we)|0)+Math.imul(re,et)|0,S=S+Math.imul(re,we)|0;var st=(O+(P=P+Math.imul(B,Oe)|0)|0)+((8191&(v=(v=v+Math.imul(B,Ue)|0)+Math.imul(k,Oe)|0))<<13)|0;O=((S=S+Math.imul(k,Ue)|0)+(v>>>13)|0)+(st>>>26)|0,st&=67108863,P=Math.imul(he,ee),v=(v=Math.imul(he,Z))+Math.imul(ce,ee)|0,S=Math.imul(ce,Z),P=P+Math.imul(Fe,Ve)|0,v=(v=v+Math.imul(Fe,Qe)|0)+Math.imul(je,Ve)|0,S=S+Math.imul(je,Qe)|0,P=P+Math.imul(de,rt)|0,v=(v=v+Math.imul(de,ve)|0)+Math.imul(oe,rt)|0,S=S+Math.imul(oe,ve)|0,P=P+Math.imul($,se)|0,v=(v=v+Math.imul($,me)|0)+Math.imul(F,se)|0,S=S+Math.imul(F,me)|0,P=P+Math.imul(Pe,Ae)|0,v=(v=v+Math.imul(Pe,ke)|0)+Math.imul(Te,Ae)|0,S=S+Math.imul(Te,ke)|0,P=P+Math.imul(U,xe)|0,v=(v=v+Math.imul(U,Re)|0)+Math.imul(te,xe)|0,S=S+Math.imul(te,Re)|0,P=P+Math.imul(H,et)|0,v=(v=v+Math.imul(H,we)|0)+Math.imul(ae,et)|0,S=S+Math.imul(ae,we)|0,P=P+Math.imul(W,Oe)|0,v=(v=v+Math.imul(W,Ue)|0)+Math.imul(re,Oe)|0,S=S+Math.imul(re,Ue)|0;var mt=(O+(P=P+Math.imul(B,K)|0)|0)+((8191&(v=(v=v+Math.imul(B,Y)|0)+Math.imul(k,K)|0))<<13)|0;O=((S=S+Math.imul(k,Y)|0)+(v>>>13)|0)+(mt>>>26)|0,mt&=67108863,P=Math.imul(le,ee),v=(v=Math.imul(le,Z))+Math.imul(fe,ee)|0,S=Math.imul(fe,Z),P=P+Math.imul(he,Ve)|0,v=(v=v+Math.imul(he,Qe)|0)+Math.imul(ce,Ve)|0,S=S+Math.imul(ce,Qe)|0,P=P+Math.imul(Fe,rt)|0,v=(v=v+Math.imul(Fe,ve)|0)+Math.imul(je,rt)|0,S=S+Math.imul(je,ve)|0,P=P+Math.imul(de,se)|0,v=(v=v+Math.imul(de,me)|0)+Math.imul(oe,se)|0,S=S+Math.imul(oe,me)|0,P=P+Math.imul($,Ae)|0,v=(v=v+Math.imul($,ke)|0)+Math.imul(F,Ae)|0,S=S+Math.imul(F,ke)|0,P=P+Math.imul(Pe,xe)|0,v=(v=v+Math.imul(Pe,Re)|0)+Math.imul(Te,xe)|0,S=S+Math.imul(Te,Re)|0,P=P+Math.imul(U,et)|0,v=(v=v+Math.imul(U,we)|0)+Math.imul(te,et)|0,S=S+Math.imul(te,we)|0,P=P+Math.imul(H,Oe)|0,v=(v=v+Math.imul(H,Ue)|0)+Math.imul(ae,Oe)|0,S=S+Math.imul(ae,Ue)|0,P=P+Math.imul(W,K)|0,v=(v=v+Math.imul(W,Y)|0)+Math.imul(re,K)|0,S=S+Math.imul(re,Y)|0;var vt=(O+(P=P+Math.imul(B,x)|0)|0)+((8191&(v=(v=v+Math.imul(B,ie)|0)+Math.imul(k,x)|0))<<13)|0;O=((S=S+Math.imul(k,ie)|0)+(v>>>13)|0)+(vt>>>26)|0,vt&=67108863,P=Math.imul(le,Ve),v=(v=Math.imul(le,Qe))+Math.imul(fe,Ve)|0,S=Math.imul(fe,Qe),P=P+Math.imul(he,rt)|0,v=(v=v+Math.imul(he,ve)|0)+Math.imul(ce,rt)|0,S=S+Math.imul(ce,ve)|0,P=P+Math.imul(Fe,se)|0,v=(v=v+Math.imul(Fe,me)|0)+Math.imul(je,se)|0,S=S+Math.imul(je,me)|0,P=P+Math.imul(de,Ae)|0,v=(v=v+Math.imul(de,ke)|0)+Math.imul(oe,Ae)|0,S=S+Math.imul(oe,ke)|0,P=P+Math.imul($,xe)|0,v=(v=v+Math.imul($,Re)|0)+Math.imul(F,xe)|0,S=S+Math.imul(F,Re)|0,P=P+Math.imul(Pe,et)|0,v=(v=v+Math.imul(Pe,we)|0)+Math.imul(Te,et)|0,S=S+Math.imul(Te,we)|0,P=P+Math.imul(U,Oe)|0,v=(v=v+Math.imul(U,Ue)|0)+Math.imul(te,Oe)|0,S=S+Math.imul(te,Ue)|0,P=P+Math.imul(H,K)|0,v=(v=v+Math.imul(H,Y)|0)+Math.imul(ae,K)|0,S=S+Math.imul(ae,Y)|0;var At=(O+(P=P+Math.imul(W,x)|0)|0)+((8191&(v=(v=v+Math.imul(W,ie)|0)+Math.imul(re,x)|0))<<13)|0;O=((S=S+Math.imul(re,ie)|0)+(v>>>13)|0)+(At>>>26)|0,At&=67108863,P=Math.imul(le,rt),v=(v=Math.imul(le,ve))+Math.imul(fe,rt)|0,S=Math.imul(fe,ve),P=P+Math.imul(he,se)|0,v=(v=v+Math.imul(he,me)|0)+Math.imul(ce,se)|0,S=S+Math.imul(ce,me)|0,P=P+Math.imul(Fe,Ae)|0,v=(v=v+Math.imul(Fe,ke)|0)+Math.imul(je,Ae)|0,S=S+Math.imul(je,ke)|0,P=P+Math.imul(de,xe)|0,v=(v=v+Math.imul(de,Re)|0)+Math.imul(oe,xe)|0,S=S+Math.imul(oe,Re)|0,P=P+Math.imul($,et)|0,v=(v=v+Math.imul($,we)|0)+Math.imul(F,et)|0,S=S+Math.imul(F,we)|0,P=P+Math.imul(Pe,Oe)|0,v=(v=v+Math.imul(Pe,Ue)|0)+Math.imul(Te,Oe)|0,S=S+Math.imul(Te,Ue)|0,P=P+Math.imul(U,K)|0,v=(v=v+Math.imul(U,Y)|0)+Math.imul(te,K)|0,S=S+Math.imul(te,Y)|0;var Et=(O+(P=P+Math.imul(H,x)|0)|0)+((8191&(v=(v=v+Math.imul(H,ie)|0)+Math.imul(ae,x)|0))<<13)|0;O=((S=S+Math.imul(ae,ie)|0)+(v>>>13)|0)+(Et>>>26)|0,Et&=67108863,P=Math.imul(le,se),v=(v=Math.imul(le,me))+Math.imul(fe,se)|0,S=Math.imul(fe,me),P=P+Math.imul(he,Ae)|0,v=(v=v+Math.imul(he,ke)|0)+Math.imul(ce,Ae)|0,S=S+Math.imul(ce,ke)|0,P=P+Math.imul(Fe,xe)|0,v=(v=v+Math.imul(Fe,Re)|0)+Math.imul(je,xe)|0,S=S+Math.imul(je,Re)|0,P=P+Math.imul(de,et)|0,v=(v=v+Math.imul(de,we)|0)+Math.imul(oe,et)|0,S=S+Math.imul(oe,we)|0,P=P+Math.imul($,Oe)|0,v=(v=v+Math.imul($,Ue)|0)+Math.imul(F,Oe)|0,S=S+Math.imul(F,Ue)|0,P=P+Math.imul(Pe,K)|0,v=(v=v+Math.imul(Pe,Y)|0)+Math.imul(Te,K)|0,S=S+Math.imul(Te,Y)|0;var bt=(O+(P=P+Math.imul(U,x)|0)|0)+((8191&(v=(v=v+Math.imul(U,ie)|0)+Math.imul(te,x)|0))<<13)|0;O=((S=S+Math.imul(te,ie)|0)+(v>>>13)|0)+(bt>>>26)|0,bt&=67108863,P=Math.imul(le,Ae),v=(v=Math.imul(le,ke))+Math.imul(fe,Ae)|0,S=Math.imul(fe,ke),P=P+Math.imul(he,xe)|0,v=(v=v+Math.imul(he,Re)|0)+Math.imul(ce,xe)|0,S=S+Math.imul(ce,Re)|0,P=P+Math.imul(Fe,et)|0,v=(v=v+Math.imul(Fe,we)|0)+Math.imul(je,et)|0,S=S+Math.imul(je,we)|0,P=P+Math.imul(de,Oe)|0,v=(v=v+Math.imul(de,Ue)|0)+Math.imul(oe,Oe)|0,S=S+Math.imul(oe,Ue)|0,P=P+Math.imul($,K)|0,v=(v=v+Math.imul($,Y)|0)+Math.imul(F,K)|0,S=S+Math.imul(F,Y)|0;var wt=(O+(P=P+Math.imul(Pe,x)|0)|0)+((8191&(v=(v=v+Math.imul(Pe,ie)|0)+Math.imul(Te,x)|0))<<13)|0;O=((S=S+Math.imul(Te,ie)|0)+(v>>>13)|0)+(wt>>>26)|0,wt&=67108863,P=Math.imul(le,xe),v=(v=Math.imul(le,Re))+Math.imul(fe,xe)|0,S=Math.imul(fe,Re),P=P+Math.imul(he,et)|0,v=(v=v+Math.imul(he,we)|0)+Math.imul(ce,et)|0,S=S+Math.imul(ce,we)|0,P=P+Math.imul(Fe,Oe)|0,v=(v=v+Math.imul(Fe,Ue)|0)+Math.imul(je,Oe)|0,S=S+Math.imul(je,Ue)|0,P=P+Math.imul(de,K)|0,v=(v=v+Math.imul(de,Y)|0)+Math.imul(oe,K)|0,S=S+Math.imul(oe,Y)|0;var _t=(O+(P=P+Math.imul($,x)|0)|0)+((8191&(v=(v=v+Math.imul($,ie)|0)+Math.imul(F,x)|0))<<13)|0;O=((S=S+Math.imul(F,ie)|0)+(v>>>13)|0)+(_t>>>26)|0,_t&=67108863,P=Math.imul(le,et),v=(v=Math.imul(le,we))+Math.imul(fe,et)|0,S=Math.imul(fe,we),P=P+Math.imul(he,Oe)|0,v=(v=v+Math.imul(he,Ue)|0)+Math.imul(ce,Oe)|0,S=S+Math.imul(ce,Ue)|0,P=P+Math.imul(Fe,K)|0,v=(v=v+Math.imul(Fe,Y)|0)+Math.imul(je,K)|0,S=S+Math.imul(je,Y)|0;var ct=(O+(P=P+Math.imul(de,x)|0)|0)+((8191&(v=(v=v+Math.imul(de,ie)|0)+Math.imul(oe,x)|0))<<13)|0;O=((S=S+Math.imul(oe,ie)|0)+(v>>>13)|0)+(ct>>>26)|0,ct&=67108863,P=Math.imul(le,Oe),v=(v=Math.imul(le,Ue))+Math.imul(fe,Oe)|0,S=Math.imul(fe,Ue),P=P+Math.imul(he,K)|0,v=(v=v+Math.imul(he,Y)|0)+Math.imul(ce,K)|0,S=S+Math.imul(ce,Y)|0;var ft=(O+(P=P+Math.imul(Fe,x)|0)|0)+((8191&(v=(v=v+Math.imul(Fe,ie)|0)+Math.imul(je,x)|0))<<13)|0;O=((S=S+Math.imul(je,ie)|0)+(v>>>13)|0)+(ft>>>26)|0,ft&=67108863,P=Math.imul(le,K),v=(v=Math.imul(le,Y))+Math.imul(fe,K)|0,S=Math.imul(fe,Y);var it=(O+(P=P+Math.imul(he,x)|0)|0)+((8191&(v=(v=v+Math.imul(he,ie)|0)+Math.imul(ce,x)|0))<<13)|0;O=((S=S+Math.imul(ce,ie)|0)+(v>>>13)|0)+(it>>>26)|0,it&=67108863;var lt=(O+(P=Math.imul(le,x))|0)+((8191&(v=(v=Math.imul(le,ie))+Math.imul(fe,x)|0))<<13)|0;return O=((S=Math.imul(fe,ie))+(v>>>13)|0)+(lt>>>26)|0,lt&=67108863,D[0]=Ee,D[1]=Ie,D[2]=De,D[3]=Ge,D[4]=ut,D[5]=nt,D[6]=Ct,D[7]=st,D[8]=mt,D[9]=vt,D[10]=At,D[11]=Et,D[12]=bt,D[13]=wt,D[14]=_t,D[15]=ct,D[16]=ft,D[17]=it,D[18]=lt,O!==0&&(D[19]=O,I.length++),I};function h(_,A,I){return new y().mulp(_,A,I)}function y(_,A){this.x=_,this.y=A}Math.imul||(d=p),i.prototype.mulTo=function(_,A){var I,P=this.length+_.length;return I=this.length===10&&_.length===10?d(this,_,A):P<63?p(this,_,A):P<1024?function(v,S,T){T.negative=S.negative^v.negative,T.length=v.length+S.length;for(var N=0,D=0,O=0;O<T.length-1;O++){var L=D;D=0;for(var B=67108863&N,k=Math.min(O,S.length-1),q=Math.max(0,O-v.length+1);q<=k;q++){var W=O-q,re=(0|v.words[W])*(0|S.words[q]),ue=67108863&re;B=67108863&(ue=ue+B|0),D+=(L=(L=L+(re/67108864|0)|0)+(ue>>>26)|0)>>>26,L&=67108863}T.words[O]=B,N=L,L=D}return N!==0?T.words[O]=N:T.length--,T.strip()}(this,_,A):h(this,_,A),I},y.prototype.makeRBT=function(_){for(var A=Array(_),I=i.prototype._countBits(_)-1,P=0;P<_;P++)A[P]=this.revBin(P,I,_);return A},y.prototype.revBin=function(_,A,I){if(_===0||_===I-1)return _;for(var P=0,v=0;v<A;v++)P|=(1&_)<<A-v-1,_>>=1;return P},y.prototype.permute=function(_,A,I,P,v,S){for(var T=0;T<S;T++)P[T]=A[_[T]],v[T]=I[_[T]]},y.prototype.transform=function(_,A,I,P,v,S){this.permute(S,_,A,I,P,v);for(var T=1;T<v;T<<=1)for(var N=T<<1,D=Math.cos(2*Math.PI/N),O=Math.sin(2*Math.PI/N),L=0;L<v;L+=N)for(var B=D,k=O,q=0;q<T;q++){var W=I[L+q],re=P[L+q],ue=I[L+q+T],H=P[L+q+T],ae=B*ue-k*H;H=B*H+k*ue,ue=ae,I[L+q]=W+ue,P[L+q]=re+H,I[L+q+T]=W-ue,P[L+q+T]=re-H,q!==N&&(ae=D*B-O*k,k=D*k+O*B,B=ae)}},y.prototype.guessLen13b=function(_,A){var I=1|Math.max(A,_),P=1&I,v=0;for(I=I/2|0;I;I>>>=1)v++;return 1<<v+1+P},y.prototype.conjugate=function(_,A,I){if(!(I<=1))for(var P=0;P<I/2;P++){var v=_[P];_[P]=_[I-P-1],_[I-P-1]=v,v=A[P],A[P]=-A[I-P-1],A[I-P-1]=-v}},y.prototype.normalize13b=function(_,A){for(var I=0,P=0;P<A/2;P++){var v=8192*Math.round(_[2*P+1]/A)+Math.round(_[2*P]/A)+I;_[P]=67108863&v,I=v<67108864?0:v/67108864|0}return _},y.prototype.convert13b=function(_,A,I,P){for(var v=0,S=0;S<A;S++)v+=0|_[S],I[2*S]=8191&v,v>>>=13,I[2*S+1]=8191&v,v>>>=13;for(S=2*A;S<P;++S)I[S]=0;n(v===0),n((-8192&v)==0)},y.prototype.stub=function(_){for(var A=Array(_),I=0;I<_;I++)A[I]=0;return A},y.prototype.mulp=function(_,A,I){var P=2*this.guessLen13b(_.length,A.length),v=this.makeRBT(P),S=this.stub(P),T=Array(P),N=Array(P),D=Array(P),O=Array(P),L=Array(P),B=Array(P),k=I.words;k.length=P,this.convert13b(_.words,_.length,T,P),this.convert13b(A.words,A.length,O,P),this.transform(T,S,N,D,P,v),this.transform(O,S,L,B,P,v);for(var q=0;q<P;q++){var W=N[q]*L[q]-D[q]*B[q];D[q]=N[q]*B[q]+D[q]*L[q],N[q]=W}return this.conjugate(N,D,P),this.transform(N,D,k,S,P,v),this.conjugate(k,S,P),this.normalize13b(k,P),I.negative=_.negative^A.negative,I.length=_.length+A.length,I.strip()},i.prototype.mul=function(_){var A=new i(null);return A.words=Array(this.length+_.length),this.mulTo(_,A)},i.prototype.mulf=function(_){var A=new i(null);return A.words=Array(this.length+_.length),h(this,_,A)},i.prototype.imul=function(_){return this.clone().mulTo(_,this)},i.prototype.imuln=function(_){n(typeof _=="number"),n(_<67108864);for(var A=0,I=0;I<this.length;I++){var P=(0|this.words[I])*_,v=(67108863&P)+(67108863&A);A>>=26,A+=P/67108864|0,A+=v>>>26,this.words[I]=67108863&v}return A!==0&&(this.words[I]=A,this.length++),this},i.prototype.muln=function(_){return this.clone().imuln(_)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(_){var A=function(S){for(var T=Array(S.bitLength()),N=0;N<T.length;N++){var D=N/26|0,O=N%26;T[N]=(S.words[D]&1<<O)>>>O}return T}(_);if(A.length===0)return new i(1);for(var I=this,P=0;P<A.length&&A[P]===0;P++,I=I.sqr());if(++P<A.length)for(var v=I.sqr();P<A.length;P++,v=v.sqr())A[P]!==0&&(I=I.mul(v));return I},i.prototype.iushln=function(_){n(typeof _=="number"&&_>=0);var A,I=_%26,P=(_-I)/26,v=67108863>>>26-I<<26-I;if(I!==0){var S=0;for(A=0;A<this.length;A++){var T=this.words[A]&v,N=(0|this.words[A])-T<<I;this.words[A]=N|S,S=T>>>26-I}S&&(this.words[A]=S,this.length++)}if(P!==0){for(A=this.length-1;A>=0;A--)this.words[A+P]=this.words[A];for(A=0;A<P;A++)this.words[A]=0;this.length+=P}return this.strip()},i.prototype.ishln=function(_){return n(this.negative===0),this.iushln(_)},i.prototype.iushrn=function(_,A,I){var P;n(typeof _=="number"&&_>=0),P=A?(A-A%26)/26:0;var v=_%26,S=Math.min((_-v)/26,this.length),T=67108863^67108863>>>v<<v,N=I;if(P=Math.max(0,P-=S),N){for(var D=0;D<S;D++)N.words[D]=this.words[D];N.length=S}if(S!==0)if(this.length>S)for(this.length-=S,D=0;D<this.length;D++)this.words[D]=this.words[D+S];else this.words[0]=0,this.length=1;var O=0;for(D=this.length-1;D>=0&&(O!==0||D>=P);D--){var L=0|this.words[D];this.words[D]=O<<26-v|L>>>v,O=L&T}return N&&O!==0&&(N.words[N.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(_,A,I){return n(this.negative===0),this.iushrn(_,A,I)},i.prototype.shln=function(_){return this.clone().ishln(_)},i.prototype.ushln=function(_){return this.clone().iushln(_)},i.prototype.shrn=function(_){return this.clone().ishrn(_)},i.prototype.ushrn=function(_){return this.clone().iushrn(_)},i.prototype.testn=function(_){n(typeof _=="number"&&_>=0);var A=_%26,I=(_-A)/26,P=1<<A;return!(this.length<=I)&&!!(this.words[I]&P)},i.prototype.imaskn=function(_){n(typeof _=="number"&&_>=0);var A=_%26,I=(_-A)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=I)return this;if(A!==0&&I++,this.length=Math.min(I,this.length),A!==0){var P=67108863^67108863>>>A<<A;this.words[this.length-1]&=P}return this.strip()},i.prototype.maskn=function(_){return this.clone().imaskn(_)},i.prototype.iaddn=function(_){return n(typeof _=="number"),n(_<67108864),_<0?this.isubn(-_):this.negative!==0?this.length===1&&(0|this.words[0])<_?(this.words[0]=_-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(_),this.negative=1,this):this._iaddn(_)},i.prototype._iaddn=function(_){this.words[0]+=_;for(var A=0;A<this.length&&this.words[A]>=67108864;A++)this.words[A]-=67108864,A===this.length-1?this.words[A+1]=1:this.words[A+1]++;return this.length=Math.max(this.length,A+1),this},i.prototype.isubn=function(_){if(n(typeof _=="number"),n(_<67108864),_<0)return this.iaddn(-_);if(this.negative!==0)return this.negative=0,this.iaddn(_),this.negative=1,this;if(this.words[0]-=_,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var A=0;A<this.length&&this.words[A]<0;A++)this.words[A]+=67108864,this.words[A+1]-=1;return this.strip()},i.prototype.addn=function(_){return this.clone().iaddn(_)},i.prototype.subn=function(_){return this.clone().isubn(_)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(_,A,I){var P,v,S=_.length+I;this._expand(S);var T=0;for(P=0;P<_.length;P++){v=(0|this.words[P+I])+T;var N=(0|_.words[P])*A;T=((v-=67108863&N)>>26)-(N/67108864|0),this.words[P+I]=67108863&v}for(;P<this.length-I;P++)T=(v=(0|this.words[P+I])+T)>>26,this.words[P+I]=67108863&v;if(T===0)return this.strip();for(n(T===-1),T=0,P=0;P<this.length;P++)T=(v=-(0|this.words[P])+T)>>26,this.words[P]=67108863&v;return this.negative=1,this.strip()},i.prototype._wordDiv=function(_,A){var I=(this.length,_.length),P=this.clone(),v=_,S=0|v.words[v.length-1];(I=26-this._countBits(S))!==0&&(v=v.ushln(I),P.iushln(I),S=0|v.words[v.length-1]);var T,N=P.length-v.length;if(A!=="mod"){(T=new i(null)).length=N+1,T.words=Array(T.length);for(var D=0;D<T.length;D++)T.words[D]=0}var O=P.clone()._ishlnsubmul(v,1,N);O.negative===0&&(P=O,T&&(T.words[N]=1));for(var L=N-1;L>=0;L--){var B=67108864*(0|P.words[v.length+L])+(0|P.words[v.length+L-1]);for(B=Math.min(B/S|0,67108863),P._ishlnsubmul(v,B,L);P.negative!==0;)B--,P.negative=0,P._ishlnsubmul(v,1,L),P.isZero()||(P.negative^=1);T&&(T.words[L]=B)}return T&&T.strip(),P.strip(),A!=="div"&&I!==0&&P.iushrn(I),{div:T||null,mod:P}},i.prototype.divmod=function(_,A,I){return n(!_.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&_.negative===0?(S=this.neg().divmod(_,A),A!=="mod"&&(P=S.div.neg()),A!=="div"&&(v=S.mod.neg(),I&&v.negative!==0&&v.iadd(_)),{div:P,mod:v}):this.negative===0&&_.negative!==0?(S=this.divmod(_.neg(),A),A!=="mod"&&(P=S.div.neg()),{div:P,mod:S.mod}):this.negative&_.negative?(S=this.neg().divmod(_.neg(),A),A!=="div"&&(v=S.mod.neg(),I&&v.negative!==0&&v.isub(_)),{div:S.div,mod:v}):_.length>this.length||this.cmp(_)<0?{div:new i(0),mod:this}:_.length===1?A==="div"?{div:this.divn(_.words[0]),mod:null}:A==="mod"?{div:null,mod:new i(this.modn(_.words[0]))}:{div:this.divn(_.words[0]),mod:new i(this.modn(_.words[0]))}:this._wordDiv(_,A);var P,v,S},i.prototype.div=function(_){return this.divmod(_,"div",!1).div},i.prototype.mod=function(_){return this.divmod(_,"mod",!1).mod},i.prototype.umod=function(_){return this.divmod(_,"mod",!0).mod},i.prototype.divRound=function(_){var A=this.divmod(_);if(A.mod.isZero())return A.div;var I=A.div.negative!==0?A.mod.isub(_):A.mod,P=_.ushrn(1),v=_.andln(1),S=I.cmp(P);return S<0||v===1&&S===0?A.div:A.div.negative!==0?A.div.isubn(1):A.div.iaddn(1)},i.prototype.modn=function(_){n(_<=67108863);for(var A=(1<<26)%_,I=0,P=this.length-1;P>=0;P--)I=(A*I+(0|this.words[P]))%_;return I},i.prototype.idivn=function(_){n(_<=67108863);for(var A=0,I=this.length-1;I>=0;I--){var P=(0|this.words[I])+67108864*A;this.words[I]=P/_|0,A=P%_}return this.strip()},i.prototype.divn=function(_){return this.clone().idivn(_)},i.prototype.egcd=function(_){n(_.negative===0),n(!_.isZero());var A=this,I=_.clone();A=A.negative!==0?A.umod(_):A.clone();for(var P=new i(1),v=new i(0),S=new i(0),T=new i(1),N=0;A.isEven()&&I.isEven();)A.iushrn(1),I.iushrn(1),++N;for(var D=I.clone(),O=A.clone();!A.isZero();){for(var L=0,B=1;!(A.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(A.iushrn(L);L-- >0;)(P.isOdd()||v.isOdd())&&(P.iadd(D),v.isub(O)),P.iushrn(1),v.iushrn(1);for(var k=0,q=1;!(I.words[0]&q)&&k<26;++k,q<<=1);if(k>0)for(I.iushrn(k);k-- >0;)(S.isOdd()||T.isOdd())&&(S.iadd(D),T.isub(O)),S.iushrn(1),T.iushrn(1);A.cmp(I)>=0?(A.isub(I),P.isub(S),v.isub(T)):(I.isub(A),S.isub(P),T.isub(v))}return{a:S,b:T,gcd:I.iushln(N)}},i.prototype._invmp=function(_){n(_.negative===0),n(!_.isZero());var A=this,I=_.clone();A=A.negative!==0?A.umod(_):A.clone();for(var P,v=new i(1),S=new i(0),T=I.clone();A.cmpn(1)>0&&I.cmpn(1)>0;){for(var N=0,D=1;!(A.words[0]&D)&&N<26;++N,D<<=1);if(N>0)for(A.iushrn(N);N-- >0;)v.isOdd()&&v.iadd(T),v.iushrn(1);for(var O=0,L=1;!(I.words[0]&L)&&O<26;++O,L<<=1);if(O>0)for(I.iushrn(O);O-- >0;)S.isOdd()&&S.iadd(T),S.iushrn(1);A.cmp(I)>=0?(A.isub(I),v.isub(S)):(I.isub(A),S.isub(v))}return(P=A.cmpn(1)===0?v:S).cmpn(0)<0&&P.iadd(_),P},i.prototype.gcd=function(_){if(this.isZero())return _.abs();if(_.isZero())return this.abs();var A=this.clone(),I=_.clone();A.negative=0,I.negative=0;for(var P=0;A.isEven()&&I.isEven();P++)A.iushrn(1),I.iushrn(1);for(;;){for(;A.isEven();)A.iushrn(1);for(;I.isEven();)I.iushrn(1);var v=A.cmp(I);if(v<0){var S=A;A=I,I=S}else if(v===0||I.cmpn(1)===0)break;A.isub(I)}return I.iushln(P)},i.prototype.invm=function(_){return this.egcd(_).a.umod(_)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(_){return this.words[0]&_},i.prototype.bincn=function(_){n(typeof _=="number");var A=_%26,I=(_-A)/26,P=1<<A;if(this.length<=I)return this._expand(I+1),this.words[I]|=P,this;for(var v=P,S=I;v!==0&&S<this.length;S++){var T=0|this.words[S];v=(T+=v)>>>26,T&=67108863,this.words[S]=T}return v!==0&&(this.words[S]=v,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(_){var A,I=_<0;if(this.negative!==0&&!I)return-1;if(this.negative===0&&I)return 1;if(this.strip(),this.length>1)A=1;else{I&&(_=-_),n(_<=67108863,"Number is too big");var P=0|this.words[0];A=P===_?0:P<_?-1:1}return this.negative!==0?0|-A:A},i.prototype.cmp=function(_){if(this.negative!==0&&_.negative===0)return-1;if(this.negative===0&&_.negative!==0)return 1;var A=this.ucmp(_);return this.negative!==0?0|-A:A},i.prototype.ucmp=function(_){if(this.length>_.length)return 1;if(this.length<_.length)return-1;for(var A=0,I=this.length-1;I>=0;I--){var P=0|this.words[I],v=0|_.words[I];if(P!==v){P<v?A=-1:P>v&&(A=1);break}}return A},i.prototype.gtn=function(_){return this.cmpn(_)===1},i.prototype.gt=function(_){return this.cmp(_)===1},i.prototype.gten=function(_){return this.cmpn(_)>=0},i.prototype.gte=function(_){return this.cmp(_)>=0},i.prototype.ltn=function(_){return this.cmpn(_)===-1},i.prototype.lt=function(_){return this.cmp(_)===-1},i.prototype.lten=function(_){return this.cmpn(_)<=0},i.prototype.lte=function(_){return this.cmp(_)<=0},i.prototype.eqn=function(_){return this.cmpn(_)===0},i.prototype.eq=function(_){return this.cmp(_)===0},i.red=function(_){return new R(_)},i.prototype.toRed=function(_){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),_.convertTo(this)._forceRed(_)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(_){return this.red=_,this},i.prototype.forceRed=function(_){return n(!this.red,"Already a number in reduction context"),this._forceRed(_)},i.prototype.redAdd=function(_){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,_)},i.prototype.redIAdd=function(_){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,_)},i.prototype.redSub=function(_){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,_)},i.prototype.redISub=function(_){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,_)},i.prototype.redShl=function(_){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,_)},i.prototype.redMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.mul(this,_)},i.prototype.redIMul=function(_){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,_),this.red.imul(this,_)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(_){return n(this.red&&!_.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,_)};var g={k256:null,p224:null,p192:null,p25519:null};function m(_,A){this.name=_,this.p=new i(A,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function C(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function R(_){if(typeof _=="string"){var A=i._prime(_);this.m=A.p,this.prime=A}else n(_.gtn(1),"modulus must be greater than 1"),this.m=_,this.prime=null}function M(_){R.call(this,_),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var _=new i(null);return _.words=Array(Math.ceil(this.n/13)),_},m.prototype.ireduce=function(_){var A,I=_;do this.split(I,this.tmp),A=(I=(I=this.imulK(I)).iadd(this.tmp)).bitLength();while(A>this.n);var P=A<this.n?-1:I.ucmp(this.p);return P===0?(I.words[0]=0,I.length=1):P>0?I.isub(this.p):I.strip(),I},m.prototype.split=function(_,A){_.iushrn(this.n,0,A)},m.prototype.imulK=function(_){return _.imul(this.k)},s(b,m),b.prototype.split=function(_,A){for(var I=4194303,P=Math.min(_.length,9),v=0;v<P;v++)A.words[v]=_.words[v];if(A.length=P,_.length<=9)return _.words[0]=0,void(_.length=1);var S=_.words[9];for(A.words[A.length++]=S&I,v=10;v<_.length;v++){var T=0|_.words[v];_.words[v-10]=(T&I)<<4|S>>>22,S=T}S>>>=22,_.words[v-10]=S,S===0&&_.length>10?_.length-=10:_.length-=9},b.prototype.imulK=function(_){_.words[_.length]=0,_.words[_.length+1]=0,_.length+=2;for(var A=0,I=0;I<_.length;I++){var P=0|_.words[I];A+=977*P,_.words[I]=67108863&A,A=64*P+(A/67108864|0)}return _.words[_.length-1]===0&&(_.length--,_.words[_.length-1]===0&&_.length--),_},s(w,m),s(E,m),s(C,m),C.prototype.imulK=function(_){for(var A=0,I=0;I<_.length;I++){var P=19*(0|_.words[I])+A,v=67108863&P;P>>>=26,_.words[I]=v,A=P}return A!==0&&(_.words[_.length++]=A),_},i._prime=function(_){if(g[_])return g[_];var A;if(_==="k256")A=new b;else if(_==="p224")A=new w;else if(_==="p192")A=new E;else{if(_!=="p25519")throw Error("Unknown prime "+_);A=new C}return g[_]=A,A},R.prototype._verify1=function(_){n(_.negative===0,"red works only with positives"),n(_.red,"red works only with red numbers")},R.prototype._verify2=function(_,A){n((_.negative|A.negative)==0,"red works only with positives"),n(_.red&&_.red===A.red,"red works only with red numbers")},R.prototype.imod=function(_){return this.prime?this.prime.ireduce(_)._forceRed(this):_.umod(this.m)._forceRed(this)},R.prototype.neg=function(_){return _.isZero()?_.clone():this.m.sub(_)._forceRed(this)},R.prototype.add=function(_,A){this._verify2(_,A);var I=_.add(A);return I.cmp(this.m)>=0&&I.isub(this.m),I._forceRed(this)},R.prototype.iadd=function(_,A){this._verify2(_,A);var I=_.iadd(A);return I.cmp(this.m)>=0&&I.isub(this.m),I},R.prototype.sub=function(_,A){this._verify2(_,A);var I=_.sub(A);return I.cmpn(0)<0&&I.iadd(this.m),I._forceRed(this)},R.prototype.isub=function(_,A){this._verify2(_,A);var I=_.isub(A);return I.cmpn(0)<0&&I.iadd(this.m),I},R.prototype.shl=function(_,A){return this._verify1(_),this.imod(_.ushln(A))},R.prototype.imul=function(_,A){return this._verify2(_,A),this.imod(_.imul(A))},R.prototype.mul=function(_,A){return this._verify2(_,A),this.imod(_.mul(A))},R.prototype.isqr=function(_){return this.imul(_,_.clone())},R.prototype.sqr=function(_){return this.mul(_,_)},R.prototype.sqrt=function(_){if(_.isZero())return _.clone();var A=this.m.andln(3);if(n(A%2==1),A===3){var I=this.m.add(new i(1)).iushrn(2);return this.pow(_,I)}for(var P=this.m.subn(1),v=0;!P.isZero()&&P.andln(1)===0;)v++,P.iushrn(1);n(!P.isZero());var S=new i(1).toRed(this),T=S.redNeg(),N=this.m.subn(1).iushrn(1),D=this.m.bitLength();for(D=new i(2*D*D).toRed(this);this.pow(D,N).cmp(T)!==0;)D.redIAdd(T);for(var O=this.pow(D,P),L=this.pow(_,P.addn(1).iushrn(1)),B=this.pow(_,P),k=v;B.cmp(S)!==0;){for(var q=B,W=0;q.cmp(S)!==0;W++)q=q.redSqr();n(W<k);var re=this.pow(O,new i(1).iushln(k-W-1));L=L.redMul(re),O=re.redSqr(),B=B.redMul(O),k=W}return L},R.prototype.invm=function(_){var A=_._invmp(this.m);return A.negative!==0?(A.negative=0,this.imod(A).redNeg()):this.imod(A)},R.prototype.pow=function(_,A){if(A.isZero())return new i(1).toRed(this);if(A.cmpn(1)===0)return _.clone();var I=Array(16);I[0]=new i(1).toRed(this),I[1]=_;for(var P=2;P<I.length;P++)I[P]=this.mul(I[P-1],_);var v=I[0],S=0,T=0,N=A.bitLength()%26;for(N===0&&(N=26),P=A.length-1;P>=0;P--){for(var D=A.words[P],O=N-1;O>=0;O--){var L=D>>O&1;v!==I[0]&&(v=this.sqr(v)),L!==0||S!==0?(S<<=1,S|=L,(++T===4||P===0&&O===0)&&(v=this.mul(v,I[S]),T=0,S=0)):T=0}N=26}return v},R.prototype.convertTo=function(_){var A=_.umod(this.m);return A===_?A.clone():A},R.prototype.convertFrom=function(_){var A=_.clone();return A.red=null,A},i.mont=function(_){return new M(_)},s(M,R),M.prototype.convertTo=function(_){return this.imod(_.ushln(this.shift))},M.prototype.convertFrom=function(_){var A=this.imod(_.mul(this.rinv));return A.red=null,A},M.prototype.imul=function(_,A){if(_.isZero()||A.isZero())return _.words[0]=0,_.length=1,_;var I=_.imul(A),P=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=I.isub(P).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(_,A){if(_.isZero()||A.isZero())return new i(0)._forceRed(this);var I=_.mul(A),P=I.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=I.isub(P).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(_){return this.imod(_._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,TS)}),$u=Object.freeze({__proto__:null,default:pt,__moduleExports:pt});class nl{constructor(t){if(t===void 0)throw Error("Invalid BigInteger input");this.value=new pt(t)}clone(){const t=new nl(null);return this.value.copy(t.value),t}iinc(){return this.value.iadd(new pt(1)),this}inc(){return this.clone().iinc()}idec(){return this.value.isub(new pt(1)),this}dec(){return this.clone().idec()}iadd(t){return this.value.iadd(t.value),this}add(t){return this.clone().iadd(t)}isub(t){return this.value.isub(t.value),this}sub(t){return this.clone().isub(t)}imul(t){return this.value.imul(t.value),this}mul(t){return this.clone().imul(t)}imod(t){return this.value=this.value.umod(t.value),this}mod(t){return this.clone().imod(t)}modExp(t,r){const n=r.isEven()?pt.red(r.value):pt.mont(r.value),s=this.clone();return s.value=s.value.toRed(n).redPow(t.value).fromRed(),s}modInv(t){if(!this.gcd(t).isOne())throw Error("Inverse does not exist");return new nl(this.value.invm(t.value))}gcd(t){return new nl(this.value.gcd(t.value))}ileftShift(t){return this.value.ishln(t.value.toNumber()),this}leftShift(t){return this.clone().ileftShift(t)}irightShift(t){return this.value.ishrn(t.value.toNumber()),this}rightShift(t){return this.clone().irightShift(t)}equal(t){return this.value.eq(t.value)}lt(t){return this.value.lt(t.value)}lte(t){return this.value.lte(t.value)}gt(t){return this.value.gt(t.value)}gte(t){return this.value.gte(t.value)}isZero(){return this.value.isZero()}isOne(){return this.value.eq(new pt(1))}isNegative(){return this.value.isNeg()}isEven(){return this.value.isEven()}abs(){const t=this.clone();return t.value=t.value.abs(),t}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}getBit(t){return this.value.testn(t)?1:0}bitLength(){return this.value.bitLength()}byteLength(){return this.value.byteLength()}toUint8Array(t="be",r){return this.value.toArrayLike(Uint8Array,t,r)}}var b0,zI=Object.freeze({__proto__:null,default:nl}),Yn=Ci(function(e,t){var r=t;function n(i){return i.length===1?"0"+i:i}function s(i){for(var o="",a=0;a<i.length;a++)o+=n(i[a].toString(16));return o}r.toArray=function(i,o){if(Array.isArray(i))return i.slice();if(!i)return[];var a=[];if(typeof i!="string"){for(var f=0;f<i.length;f++)a[f]=0|i[f];return a}if(o==="hex")for((i=i.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(i="0"+i),f=0;f<i.length;f+=2)a.push(parseInt(i[f]+i[f+1],16));else for(f=0;f<i.length;f++){var c=i.charCodeAt(f),l=c>>8,u=255&c;l?a.push(l,u):a.push(u)}return a},r.zero2=n,r.toHex=s,r.encode=function(i,o){return o==="hex"?s(i):i}}),Zt=Ci(function(e,t){var r=t;r.assert=xs,r.toArray=Yn.toArray,r.zero2=Yn.zero2,r.toHex=Yn.toHex,r.encode=Yn.encode,r.getNAF=function(n,s){for(var i=[],o=1<<s+1,a=n.clone();a.cmpn(1)>=0;){var f;if(a.isOdd()){var c=a.andln(o-1);f=c>(o>>1)-1?(o>>1)-c:c,a.isubn(f)}else f=0;i.push(f);for(var l=a.cmpn(0)!==0&&a.andln(o-1)===0?s+1:1,u=1;u<l;u++)i.push(0);a.iushrn(l)}return i},r.getJSF=function(n,s){var i=[[],[]];n=n.clone(),s=s.clone();for(var o=0,a=0;n.cmpn(-o)>0||s.cmpn(-a)>0;){var f,c,l,u=n.andln(3)+o&3,p=s.andln(3)+a&3;u===3&&(u=-1),p===3&&(p=-1),(1&u)==0?f=0:f=(l=n.andln(7)+o&7)!==3&&l!==5||p!==2?u:-u,i[0].push(f),(1&p)==0?c=0:c=(l=s.andln(7)+a&7)!==3&&l!==5||u!==2?p:-p,i[1].push(c),2*o===f+1&&(o=1-o),2*a===c+1&&(a=1-a),n.iushrn(1),s.iushrn(1)}return i},r.cachedProperty=function(n,s,i){var o="_"+s;n.prototype[s]=function(){return this[o]!==void 0?this[o]:this[o]=i.call(this)}},r.parseBytes=function(n){return typeof n=="string"?r.toArray(n,"hex"):n},r.intFromLE=function(n){return new pt(n,"hex","le")}}),yh=function(e){return b0||(b0=new vs(null)),b0.generate(e)};function vs(e){this.rand=e}var WI=vs;if(vs.prototype.generate=function(e){return this._rand(e)},vs.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},typeof self=="object")self.crypto&&self.crypto.getRandomValues?vs.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?vs.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window=="object"&&(vs.prototype._rand=function(){throw Error("Not implemented yet")});else try{var S3=void 0;if(typeof S3.randomBytes!="function")throw Error("Not supported");vs.prototype._rand=function(e){return S3.randomBytes(e)}}catch{}yh.Rand=WI;var gd=Zt.getNAF,YI=Zt.getJSF,md=Zt.assert;function hs(e,t){this.type=e,this.p=new pt(t.p,16),this.red=t.prime?pt.red(t.prime):pt.mont(this.p),this.zero=new pt(0).toRed(this.red),this.one=new pt(1).toRed(this.red),this.two=new pt(2).toRed(this.red),this.n=t.n&&new pt(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,];var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ln=hs;function Cn(e,t){this.curve=e,this.type=t,this.precomputed=null}hs.prototype.point=function(){throw Error("Not implemented")},hs.prototype.validate=function(){throw Error("Not implemented")},hs.prototype._fixedNafMul=function(e,t){md(e.precomputed);var r=e._getDoubles(),n=gd(t,1),s=(1<<r.step+1)-(r.step%2==0?2:1);s/=3;for(var i=[],o=0;o<n.length;o+=r.step){var a=0;for(t=o+r.step-1;t>=o;t--)a=(a<<1)+n[t];i.push(a)}for(var f=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=s;l>0;l--){for(o=0;o<i.length;o++)(a=i[o])===l?c=c.mixedAdd(r.points[o]):a===-l&&(c=c.mixedAdd(r.points[o].neg()));f=f.add(c)}return f.toP()},hs.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var s=n.points,i=gd(t,r),o=this.jpoint(null,null,null),a=i.length-1;a>=0;a--){for(t=0;a>=0&&i[a]===0;a--)t++;if(a>=0&&t++,o=o.dblp(t),a<0)break;var f=i[a];md(f!==0),o=e.type==="affine"?f>0?o.mixedAdd(s[f-1>>1]):o.mixedAdd(s[-f-1>>1].neg()):f>0?o.add(s[f-1>>1]):o.add(s[-f-1>>1].neg())}return e.type==="affine"?o.toP():o},hs.prototype._wnafMulAdd=function(e,t,r,n,s){for(var i=this._wnafT1,o=this._wnafT2,a=this._wnafT3,f=0,c=0;c<n;c++){var l=(M=t[c])._getNAFPoints(e);i[c]=l.wnd,o[c]=l.points}for(c=n-1;c>=1;c-=2){var u=c-1,p=c;if(i[u]===1&&i[p]===1){var d=[t[u],null,null,t[p]];t[u].y.cmp(t[p].y)===0?(d[1]=t[u].add(t[p]),d[2]=t[u].toJ().mixedAdd(t[p].neg())):t[u].y.cmp(t[p].y.redNeg())===0?(d[1]=t[u].toJ().mixedAdd(t[p]),d[2]=t[u].add(t[p].neg())):(d[1]=t[u].toJ().mixedAdd(t[p]),d[2]=t[u].toJ().mixedAdd(t[p].neg()));var h=[-3,-1,-5,-7,0,7,5,1,3],y=YI(r[u],r[p]);f=Math.max(y[0].length,f),a[u]=Array(f),a[p]=Array(f);for(var g=0;g<f;g++){var m=0|y[0][g],b=0|y[1][g];a[u][g]=h[3*(m+1)+(b+1)],a[p][g]=0,o[u]=d}}else a[u]=gd(r[u],i[u]),a[p]=gd(r[p],i[p]),f=Math.max(a[u].length,f),f=Math.max(a[p].length,f)}var w=this.jpoint(null,null,null),E=this._wnafT4;for(c=f;c>=0;c--){for(var C=0;c>=0;){var R=!0;for(g=0;g<n;g++)E[g]=0|a[g][c],E[g]!==0&&(R=!1);if(!R)break;C++,c--}if(c>=0&&C++,w=w.dblp(C),c<0)break;for(g=0;g<n;g++){var M,_=E[g];_!==0&&(_>0?M=o[g][_-1>>1]:_<0&&(M=o[g][-_-1>>1].neg()),w=M.type==="affine"?w.mixedAdd(M):w.add(M))}}for(c=0;c<n;c++)o[c]=null;return s?w:w.toP()},hs.BasePoint=Cn,Cn.prototype.eq=function(){throw Error("Not implemented")},Cn.prototype.validate=function(){return this.curve.validate(this)},hs.prototype.decodePoint=function(e,t){e=Zt.toArray(e,t);var r=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*r)return e[0]===6?md(e[e.length-1]%2==0):e[0]===7&&md(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((e[0]===2||e[0]===3)&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),e[0]===3);throw Error("Unknown point format")},Cn.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Cn.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Cn.prototype.encode=function(e,t){return Zt.encode(this._encode(t),e)},Cn.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Cn.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Cn.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,s=0;s<t;s+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},Cn.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=r===1?null:this.dbl(),s=1;s<r;s++)t[s]=t[s-1].add(n);return{wnd:e,points:t}},Cn.prototype._getBeta=function(){return null},Cn.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var JI=Zt.assert;function Mn(e){ln.call(this,"short",e),this.a=new pt(e.a,16).toRed(this.red),this.b=new pt(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}Is(Mn,ln);var ZI=Mn;function Sr(e,t,r,n){ln.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new pt(t,16),this.y=new pt(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Dr(e,t,r,n){ln.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new pt(0)):(this.x=new pt(t,16),this.y=new pt(r,16),this.z=new pt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}function Ha(e){ln.call(this,"mont",e),this.a=new pt(e.a,16).toRed(this.red),this.b=new pt(e.b,16).toRed(this.red),this.i4=new pt(4).toRed(this.red).redInvm(),this.two=new pt(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Mn.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&this.p.modn(3)===1){var t,r;if(e.beta)t=new pt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new pt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?r=s[0]:(r=s[1],JI(this.g.mul(r).x.cmp(this.g.x.redMul(t))===0))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(i){return{a:new pt(i.a,16),b:new pt(i.b,16)}}):this._getEndoBasis(r)}}},Mn.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:pt.mont(e),r=new pt(2).toRed(t).redInvm(),n=r.redNeg(),s=new pt(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(s).fromRed(),n.redSub(s).fromRed()]},Mn.prototype._getEndoBasis=function(e){for(var t,r,n,s,i,o,a,f,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,p=this.n.clone(),d=new pt(1),h=new pt(0),y=new pt(0),g=new pt(1),m=0;u.cmpn(0)!==0;){var b=p.div(u);f=p.sub(b.mul(u)),c=y.sub(b.mul(d));var w=g.sub(b.mul(h));if(!n&&f.cmp(l)<0)t=a.neg(),r=d,n=f.neg(),s=c;else if(n&&++m==2)break;a=f,p=u,u=f,y=d,d=c,g=h,h=w}i=f.neg(),o=c;var E=n.sqr().add(s.sqr());return i.sqr().add(o.sqr()).cmp(E)>=0&&(i=t,o=r),n.negative&&(n=n.neg(),s=s.neg()),i.negative&&(i=i.neg(),o=o.neg()),[{a:n,b:s},{a:i,b:o}]},Mn.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],s=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=s.mul(r.a),a=i.mul(n.a),f=s.mul(r.b),c=i.mul(n.b);return{k1:e.sub(o).sub(a),k2:f.add(c).neg()}},Mn.prototype.pointFromX=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw Error("invalid point");var s=n.fromRed().isOdd();return(t&&!s||!t&&s)&&(n=n.redNeg()),this.point(e,n)},Mn.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0},Mn.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,s=this._endoWnafT2,i=0;i<e.length;i++){var o=this._endoSplit(t[i]),a=e[i],f=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),f=f.neg(!0)),n[2*i]=a,n[2*i+1]=f,s[2*i]=o.k1,s[2*i+1]=o.k2}for(var c=this._wnafMulAdd(1,n,s,2*i,r),l=0;l<2*i;l++)n[l]=null,s[l]=null;return c},Is(Sr,ln.BasePoint),Mn.prototype.point=function(e,t,r){return new Sr(this,e,t,r)},Mn.prototype.pointFromJSON=function(e,t){return Sr.fromJSON(this,e,t)},Sr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(s){return r.point(s.x.redMul(r.endo.beta),s.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Sr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Sr.fromJSON=function(e,t,r){typeof t=="string"&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function s(o){return e.point(o[0],o[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(s))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(s))}},n},Sr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Sr.prototype.isInfinity=function(){return this.inf},Sr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Sr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,o)},Sr.prototype.getX=function(){return this.x.fromRed()},Sr.prototype.getY=function(){return this.y.fromRed()},Sr.prototype.mul=function(e){return e=new pt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Sr.prototype.mulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)},Sr.prototype.jmulAdd=function(e,t,r){var n=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)},Sr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},Sr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Sr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Is(Dr,ln.BasePoint),Mn.prototype.jpoint=function(e,t,r){return new Dr(this,e,t,r)},Dr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Dr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Dr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),s=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=n.redSub(s),f=i.redSub(o);if(a.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),l=c.redMul(a),u=n.redMul(c),p=f.redSqr().redIAdd(l).redISub(u).redISub(u),d=f.redMul(u.redISub(p)).redISub(i.redMul(l)),h=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(p,d,h)},Dr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),s=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),a=s.redSub(i);if(o.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),c=f.redMul(o),l=r.redMul(f),u=a.redSqr().redIAdd(c).redISub(l).redISub(l),p=a.redMul(l.redISub(u)).redISub(s.redMul(c)),d=this.z.redMul(o);return this.curve.jpoint(u,p,d)},Dr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,s=this.curve.tinv,i=this.x,o=this.y,a=this.z,f=a.redSqr().redSqr(),c=o.redAdd(o);for(r=0;r<e;r++){var l=i.redSqr(),u=c.redSqr(),p=u.redSqr(),d=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(f)),h=i.redMul(u),y=d.redSqr().redISub(h.redAdd(h)),g=h.redISub(y),m=d.redMul(g);m=m.redIAdd(m).redISub(p);var b=c.redMul(a);r+1<e&&(f=f.redMul(p)),i=y,a=b,c=m}return this.curve.jpoint(i,c.redMul(s),a)},Dr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Dr.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),f=a.redSqr().redISub(o).redISub(o),c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),e=f,t=a.redMul(o.redISub(f)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),u=this.y.redSqr(),p=u.redSqr(),d=this.x.redAdd(u).redSqr().redISub(l).redISub(p);d=d.redIAdd(d);var h=l.redAdd(l).redIAdd(l),y=h.redSqr(),g=p.redIAdd(p);g=(g=g.redIAdd(g)).redIAdd(g),e=y.redISub(d).redISub(d),t=h.redMul(d.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},Dr.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),i=s.redSqr(),o=this.x.redAdd(s).redSqr().redISub(n).redISub(i);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=a.redSqr().redISub(o).redISub(o);e=f;var c=i.redIAdd(i);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(o.redISub(f)).redISub(c),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),u=this.y.redSqr(),p=this.x.redMul(u),d=this.x.redSub(l).redMul(this.x.redAdd(l));d=d.redAdd(d).redIAdd(d);var h=p.redIAdd(p),y=(h=h.redIAdd(h)).redAdd(h);e=d.redSqr().redISub(y),r=this.y.redAdd(this.z).redSqr().redISub(u).redISub(l);var g=u.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=d.redMul(h.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},Dr.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,s=n.redSqr().redSqr(),i=t.redSqr(),o=r.redSqr(),a=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(s)),f=t.redAdd(t),c=(f=f.redIAdd(f)).redMul(o),l=a.redSqr().redISub(c.redAdd(c)),u=c.redISub(l),p=o.redSqr();p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var d=a.redMul(u).redISub(p),h=r.redAdd(r).redMul(n);return this.curve.jpoint(l,d,h)},Dr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),s=e.redAdd(e).redIAdd(e),i=s.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(i)).redSqr(),f=n.redIAdd(n);f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var c=s.redIAdd(o).redSqr().redISub(i).redISub(a).redISub(f),l=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var u=this.x.redMul(a).redISub(l);u=(u=u.redIAdd(u)).redIAdd(u);var p=this.y.redMul(c.redMul(f.redISub(c)).redISub(o.redMul(a)));p=(p=(p=p.redIAdd(p)).redIAdd(p)).redIAdd(p);var d=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(u,p,d)},Dr.prototype.mul=function(e,t){return e=new pt(e,t),this.curve._wnafMul(this,e)},Dr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var n=t.redMul(this.z),s=r.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0},Dr.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}},Dr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Dr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Is(Ha,ln);var XI=Ha;function Pr(e,t,r){ln.BasePoint.call(this,e,"projective"),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new pt(t,16),this.z=new pt(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Ha.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return n.redSqrt().redSqr().cmp(n)===0},Is(Pr,ln.BasePoint),Ha.prototype.decodePoint=function(e,t){if((e=Zt.toArray(e,t)).length===33&&e[0]===64&&(e=e.slice(1,33).reverse()),e.length!==32)throw Error("Unknown point compression format");return this.point(e,1)},Ha.prototype.point=function(e,t){return new Pr(this,e,t)},Ha.prototype.pointFromJSON=function(e){return Pr.fromJSON(this,e)},Pr.prototype.precompute=function(){},Pr.prototype._encode=function(e){var t=this.curve.p.byteLength();return e?[64].concat(this.getX().toArray("le",t)):this.getX().toArray("be",t)},Pr.fromJSON=function(e,t){return new Pr(e,t[0],t[1]||e.one)},Pr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Pr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Pr.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),s=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,s)},Pr.prototype.add=function(){throw Error("Not supported on Montgomery curve")},Pr.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(r),o=s.redMul(n),a=t.z.redMul(i.redAdd(o).redSqr()),f=t.x.redMul(i.redISub(o).redSqr());return this.curve.point(a,f)},Pr.prototype.mul=function(e){for(var t=(e=new pt(e,16)).clone(),r=this,n=this.curve.point(null,null),s=[];t.cmpn(0)!==0;t.iushrn(1))s.push(t.andln(1));for(var i=s.length-1;i>=0;i--)s[i]===0?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Pr.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},Pr.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},Pr.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Pr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Pr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var QI=Zt.assert;function ai(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,ln.call(this,"edwards",e),this.a=new pt(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new pt(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new pt(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),QI(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(0|e.c)==1}Is(ai,ln);var eC=ai;function nr(e,t,r,n,s){ln.BasePoint.call(this,e,"projective"),t===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new pt(t,16),this.y=new pt(r,16),this.z=n?new pt(n,16):this.curve.one,this.t=s&&new pt(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}ai.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},ai.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},ai.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},ai.prototype.pointFromX=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),i=n.redMul(s.redInvm()),o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");var a=o.fromRed().isOdd();return(t&&!a||!t&&a)&&(o=o.redNeg()),this.point(e,o)},ai.prototype.pointFromY=function(e,t){(e=new pt(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),i=n.redMul(s.redInvm());if(i.cmp(this.zero)===0){if(t)throw Error("invalid point");return this.point(this.zero,e)}var o=i.redSqrt();if(o.redSqr().redSub(i).cmp(this.zero)!==0)throw Error("invalid point");return o.fromRed().isOdd()!==t&&(o=o.redNeg()),this.point(o,e)},ai.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return n.cmp(s)===0},Is(nr,ln.BasePoint),ai.prototype.pointFromJSON=function(e){return nr.fromJSON(this,e)},ai.prototype.point=function(e,t,r,n){return new nr(this,e,t,r,n)},nr.fromJSON=function(e,t){return new nr(e,t[0],t[1],t[2])},nr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},nr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},nr.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=n.redAdd(t),o=i.redSub(r),a=n.redSub(t),f=s.redMul(o),c=i.redMul(a),l=s.redMul(a),u=o.redMul(i);return this.curve.point(f,c,u,l)},nr.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),i=this.y.redSqr();if(this.curve.twisted){var o=(c=this.curve._mulA(s)).redAdd(i);if(this.zOne)e=n.redSub(s).redSub(i).redMul(o.redSub(this.curve.two)),t=o.redMul(c.redSub(i)),r=o.redSqr().redSub(o).redSub(o);else{var a=this.z.redSqr(),f=o.redSub(a).redISub(a);e=n.redSub(s).redISub(i).redMul(f),t=o.redMul(c.redSub(i)),r=o.redMul(f)}}else{var c=s.redAdd(i);a=this.curve._mulC(this.z).redSqr(),f=c.redSub(a).redSub(a),e=this.curve._mulC(n.redISub(c)).redMul(f),t=this.curve._mulC(c).redMul(s.redISub(i)),r=c.redMul(f)}return this.curve.point(e,t,r)},nr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nr.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),i=r.redSub(t),o=s.redSub(n),a=s.redAdd(n),f=r.redAdd(t),c=i.redMul(o),l=a.redMul(f),u=i.redMul(f),p=o.redMul(a);return this.curve.point(c,l,p,u)},nr.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),s=n.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(o),f=s.redSub(a),c=s.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),u=n.redMul(f).redMul(l);return this.curve.twisted?(t=n.redMul(c).redMul(o.redSub(this.curve._mulA(i))),r=f.redMul(c)):(t=n.redMul(c).redMul(o.redSub(i)),r=this.curve._mulC(f).redMul(c)),this.curve.point(u,t,r)},nr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nr.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},nr.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},nr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nr.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},nr.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),this.x.cmp(t)===0)return!0}},nr.prototype.toP=nr.prototype.normalize,nr.prototype.mixedAdd=nr.prototype.add;var Qd=Ci(function(e,t){var r=t;r.base=ln,r.short=ZI,r.mont=XI,r.edwards=eC}),_0=Dt.rotl32,Oo=Dt.sum32,tC=Dt.sum32_5,rC=Aa.ft_1,p9=Tl.BlockHash,nC=[1518500249,1859775393,2400959708,3395469782];function di(){if(!(this instanceof di))return new di;p9.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}Dt.inherits(di,p9);var iC=di;di.blockSize=512,di.outSize=160,di.hmacStrength=80,di.padLength=64,di.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=_0(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var s=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var c=~~(n/20),l=tC(_0(s,5),rC(c,i,o,a),f,r[n],nC[c]);f=a,a=o,o=_0(i,30),i=s,s=l}this.h[0]=Oo(this.h[0],s),this.h[1]=Oo(this.h[1],i),this.h[2]=Oo(this.h[2],o),this.h[3]=Oo(this.h[3],a),this.h[4]=Oo(this.h[4],f)},di.prototype._digest=function(e){return e==="hex"?Dt.toHex32(this.h,"big"):Dt.split32(this.h,"big")};var sC={sha1:iC,sha224:v8,sha256:Wy,sha384:E8,sha512:ao};function eo(e,t,r){if(!(this instanceof eo))return new eo(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Dt.toArray(t,r))}var aC=eo;eo.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),xs(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},eo.prototype.update=function(e,t){return this.inner.update(e,t),this},eo.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var En=Ci(function(e,t){var r=t;r.utils=Dt,r.common=Tl,r.sha=sC,r.ripemd=hP,r.hmac=aC,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160}),oC={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}},il=Ci(function(e,t){var r,n=t,s=Zt.assert;function i(a){if(a.type==="short")this.curve=new Qd.short(a);else if(a.type==="edwards")this.curve=new Qd.edwards(a);else{if(a.type!=="mont")throw Error("Unknown curve type.");this.curve=new Qd.mont(a)}this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, n*G != O")}function o(a,f){Object.defineProperty(n,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(f);return Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:c}),c}})}n.PresetCurve=i,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:En.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:En.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:En.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:En.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:En.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:En.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:En.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]}),o("brainpoolP256r1",{type:"short",prime:null,p:"A9FB57DB A1EEA9BC 3E660A90 9D838D72 6E3BF623 D5262028 2013481D 1F6E5377",a:"7D5A0975 FC2C3057 EEF67530 417AFFE7 FB8055C1 26DC5C6C E94A4B44 F330B5D9",b:"26DC5C6C E94A4B44 F330B5D9 BBD77CBF 95841629 5CF7E1CE 6BCCDC18 FF8C07B6",n:"A9FB57DB A1EEA9BC 3E660A90 9D838D71 8C397AA3 B561A6F7 901E0E82 974856A7",hash:En.sha256,gRed:!1,g:["8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262","547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997"]}),o("brainpoolP384r1",{type:"short",prime:null,p:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B4 12B1DA19 7FB71123ACD3A729 901D1A71 87470013 3107EC53",a:"7BC382C6 3D8C150C 3C72080A CE05AFA0 C2BEA28E 4FB22787 139165EF BA91F90F8AA5814A 503AD4EB 04A8C7DD 22CE2826",b:"04A8C7DD 22CE2826 8B39B554 16F0447C 2FB77DE1 07DCD2A6 2E880EA5 3EEB62D57CB43902 95DBC994 3AB78696 FA504C11",n:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B3 1F166E6C AC0425A7CF3AB6AF 6B7FC310 3B883202 E9046565",hash:En.sha384,gRed:!1,g:["1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E","8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315"]}),o("brainpoolP512r1",{type:"short",prime:null,p:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 703308717D4D9B00 9BC66842 AECDA12A E6A380E6 2881FF2F 2D82C685 28AA6056 583A48F3",a:"7830A331 8B603B89 E2327145 AC234CC5 94CBDD8D 3DF91610 A83441CA EA9863BC2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A7 2BF2C7B9 E7C1AC4D 77FC94CA",b:"3DF91610 A83441CA EA9863BC 2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A72BF2C7B9 E7C1AC4D 77FC94CA DC083E67 984050B7 5EBAE5DD 2809BD63 8016F723",n:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 70330870553E5C41 4CA92619 41866119 7FAC1047 1DB1D381 085DDADD B5879682 9CA90069",hash:En.sha512,gRed:!1,g:["81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822","7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892"]});try{r=oC}catch{r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:En.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})});function ws(e){if(!(this instanceof ws))return new ws(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Yn.toArray(e.entropy,e.entropyEnc||"hex"),r=Yn.toArray(e.nonce,e.nonceEnc||"hex"),n=Yn.toArray(e.pers,e.persEnc||"hex");xs(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Sy=ws;ws.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},ws.prototype._hmac=function(){return new En.hmac(this.hash,this.K)},ws.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},ws.prototype.reseed=function(e,t,r,n){typeof t!="string"&&(n=r,r=t,t=null),e=Yn.toArray(e,t),r=Yn.toArray(r,n),xs(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},ws.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");typeof t!="string"&&(n=r,r=t,t=null),r&&(r=Yn.toArray(r,n||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var i=s.slice(0,e);return this._update(r),this._reseed++,Yn.encode(i,t)};var P3=Zt.assert;function Jr(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var w0=Jr;Jr.fromPublic=function(e,t,r){return t instanceof Jr?t:new Jr(e,{pub:t,pubEnc:r})},Jr.fromPrivate=function(e,t,r){return t instanceof Jr?t:new Jr(e,{priv:t,privEnc:r})},Jr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Jr.prototype.getPublic=function(e,t){return this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Jr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv},Jr.prototype._importPrivate=function(e,t){if(this.priv=new pt(e,t||16),this.ec.curve.type==="mont"){var r=this.ec.curve.one,n=r.ushln(252).sub(r).ushln(3);this.priv=this.priv.or(r.ushln(254)),this.priv=this.priv.and(n)}else this.priv=this.priv.umod(this.ec.curve.n)},Jr.prototype._importPublic=function(e,t){if(e.x||e.y)return this.ec.curve.type==="mont"?P3(e.x,"Need x coordinate"):this.ec.curve.type!=="short"&&this.ec.curve.type!=="edwards"||P3(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},Jr.prototype.derive=function(e){return e.mul(this.priv).getX()},Jr.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},Jr.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Jr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var cC=Zt.assert;function Gf(e,t){if(e instanceof Gf)return e;this._importDER(e,t)||(cC(e.r&&e.s,"Signature without r or s"),this.r=new pt(e.r,16),this.s=new pt(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var vd=Gf;function uC(){this.place=0}function E0(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,s=0,i=0,o=t.place;i<n;i++,o++)s<<=8,s|=e[o];return t.place=o,s}function T3(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return t===0?e:e.slice(t)}function A0(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Gf.prototype._importDER=function(e,t){e=Zt.toArray(e,t);var r=new uC;if(e[r.place++]!==48||E0(e,r)+r.place!==e.length||e[r.place++]!==2)return!1;var n=E0(e,r),s=e.slice(r.place,n+r.place);if(r.place+=n,e[r.place++]!==2)return!1;var i=E0(e,r);if(e.length!==i+r.place)return!1;var o=e.slice(r.place,i+r.place);return s[0]===0&&128&s[1]&&(s=s.slice(1)),o[0]===0&&128&o[1]&&(o=o.slice(1)),this.r=new pt(s),this.s=new pt(o),this.recoveryParam=null,!0},Gf.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=T3(t),r=T3(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];A0(n,t.length),(n=n.concat(t)).push(2),A0(n,r.length);var s=n.concat(r),i=[48];return A0(i,s.length),i=i.concat(s),Zt.encode(i,e)};var y9=Zt.assert;function hn(e){if(!(this instanceof hn))return new hn(e);typeof e=="string"&&(y9(il.hasOwnProperty(e),"Unknown curve "+e),e=il[e]),e instanceof il.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var lC=hn;hn.prototype.keyPair=function(e){return new w0(this,e)},hn.prototype.keyFromPrivate=function(e,t){return w0.fromPrivate(this,e,t)},hn.prototype.keyFromPublic=function(e,t){return w0.fromPublic(this,e,t)},hn.prototype.genKeyPair=function(e){e||(e={});var t=new Sy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||yh(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()});if(this.curve.type==="mont"){var r=new pt(t.generate(32));return this.keyFromPrivate(r)}for(var n=this.n.byteLength(),s=this.n.sub(new pt(2));;)if(!((r=new pt(t.generate(n))).cmp(s)>0))return r.iaddn(1),this.keyFromPrivate(r)},hn.prototype._truncateToN=function(e,t,r){var n=(r=r||8*e.byteLength())-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},hn.prototype.truncateMsg=function(e){var t;return e instanceof Uint8Array?(t=8*e.byteLength,e=this._truncateToN(new pt(e,16),!1,t)):typeof e=="string"?(t=4*e.length,e=this._truncateToN(new pt(e,16),!1,t)):e=this._truncateToN(new pt(e,16)),e},hn.prototype.sign=function(e,t,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this.truncateMsg(e);for(var s=this.n.byteLength(),i=t.getPrivate().toArray("be",s),o=e.toArray("be",s),a=new Sy({hash:this.hash,entropy:i,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new pt(1)),c=0;;c++){var l=n.k?n.k(c):new pt(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(f)>=0)){var u=this.g.mul(l);if(!u.isInfinity()){var p=u.getX(),d=p.umod(this.n);if(d.cmpn(0)!==0){var h=l.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if((h=h.umod(this.n)).cmpn(0)!==0){var y=(u.getY().isOdd()?1:0)|(p.cmp(d)!==0?2:0);return n.canonical&&h.cmp(this.nh)>0&&(h=this.n.sub(h),y^=1),new vd({r:d,s:h,recoveryParam:y})}}}}}},hn.prototype.verify=function(e,t,r,n){return r=this.keyFromPublic(r,n),t=new vd(t,"hex"),this._verify(this.truncateMsg(e),t,r)||this._verify(this._truncateToN(new pt(e,16)),t,r)},hn.prototype._verify=function(e,t,r){var n=t.r,s=t.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var i,o=s.invm(this.n),a=o.mul(e).umod(this.n),f=o.mul(n).umod(this.n);return this.curve._maxwellTrick?!(i=this.g.jmulAdd(a,r.getPublic(),f)).isInfinity()&&i.eqXToP(n):!(i=this.g.mulAdd(a,r.getPublic(),f)).isInfinity()&&i.getX().umod(this.n).cmp(n)===0},hn.prototype.recoverPubKey=function(e,t,r,n){y9((3&r)===r,"The recovery param is more than two bits"),t=new vd(t,n);var s=this.n,i=new pt(e),o=t.r,a=t.s,f=1&r,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw Error("Unable to find sencond key candinate");o=c?this.curve.pointFromX(o.add(this.curve.n),f):this.curve.pointFromX(o,f);var l=t.r.invm(s),u=s.sub(i).mul(l).umod(s),p=a.mul(l).umod(s);return this.g.mulAdd(u,o,p)},hn.prototype.getKeyRecoveryParam=function(e,t,r,n){if((t=new vd(t,n)).recoveryParam!==null)return t.recoveryParam;for(var s=0;s<4;s++){var i;try{i=this.recoverPubKey(e,t,s)}catch{continue}if(i.eq(r))return s}throw Error("Unable to find valid recovery factor")};var I3=Zt.assert,C3=Zt.parseBytes,Oa=Zt.cachedProperty;function Tr(e,t){if(this.eddsa=e,t.hasOwnProperty("secret")&&(this._secret=C3(t.secret)),e.isPoint(t.pub))this._pub=t.pub;else if(this._pubBytes=C3(t.pub),this._pubBytes&&this._pubBytes.length===33&&this._pubBytes[0]===64&&(this._pubBytes=this._pubBytes.slice(1,33)),this._pubBytes&&this._pubBytes.length!==32)throw Error("Unknown point compression format")}Tr.fromPublic=function(e,t){return t instanceof Tr?t:new Tr(e,{pub:t})},Tr.fromSecret=function(e,t){return t instanceof Tr?t:new Tr(e,{secret:t})},Tr.prototype.secret=function(){return this._secret},Oa(Tr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Oa(Tr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Oa(Tr,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n}),Oa(Tr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Oa(Tr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Oa(Tr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Tr.prototype.sign=function(e){return I3(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Tr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Tr.prototype.getSecret=function(e){return I3(this._secret,"KeyPair is public only"),Zt.encode(this.secret(),e)},Tr.prototype.getPublic=function(e,t){return Zt.encode((t?[64]:[]).concat(this.pubBytes()),e)};var S0=Tr,dC=Zt.assert,bd=Zt.cachedProperty,fC=Zt.parseBytes;function ta(e,t){this.eddsa=e,typeof t!="object"&&(t=fC(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),dC(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof pt&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}bd(ta,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),bd(ta,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),bd(ta,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),bd(ta,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),ta.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},ta.prototype.toHex=function(){return Zt.encode(this.toBytes(),"hex").toUpperCase()};var R3=ta,hC=Zt.assert,k3=Zt.parseBytes;function Xr(e){if(hC(e==="ed25519","only tested with ed25519 so far"),!(this instanceof Xr))return new Xr(e);e=il[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=En.sha512}var pC=Xr;Xr.prototype.sign=function(e,t){e=k3(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),s=this.g.mul(n),i=this.encodePoint(s),o=this.hashInt(i,r.pubBytes(),e).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:a,Rencoded:i})},Xr.prototype.verify=function(e,t,r){e=k3(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),s=this.hashInt(t.Rencoded(),n.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(n.pub().mul(s)).eq(i)},Xr.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Zt.intFromLE(e.digest()).umod(this.curve.n)},Xr.prototype.keyPair=function(e){return new S0(this,e)},Xr.prototype.keyFromPublic=function(e){return S0.fromPublic(this,e)},Xr.prototype.keyFromSecret=function(e){return S0.fromSecret(this,e)},Xr.prototype.genKeyPair=function(e){e||(e={});var t=new Sy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||yh(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.curve.n.toArray()});return this.keyFromSecret(t.generate(32))},Xr.prototype.makeSignature=function(e){return e instanceof R3?e:new R3(this,e)},Xr.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},Xr.prototype.decodePoint=function(e){var t=(e=Zt.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=(128&e[t])!=0,s=Zt.intFromLE(r);return this.curve.pointFromY(s,n)},Xr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},Xr.prototype.decodeInt=function(e){return Zt.intFromLE(e)},Xr.prototype.isPoint=function(e){return e instanceof this.pointClass};var M3=Ci(function(e,t){var r=t;r.utils=Zt,r.rand=yh,r.curve=Qd,r.curves=il,r.ec=lC,r.eddsa=pC}),yC=Object.freeze({__proto__:null,default:M3,__moduleExports:M3});const gC=Object.freeze(Object.defineProperty({__proto__:null,AEADEncryptedDataPacket:kl,CleartextMessage:Si,CompressedDataPacket:lo,LiteralDataPacket:Qi,MarkerPacket:jT,Message:Qr,OnePassSignaturePacket:Dn,PacketList:Ft,PrivateKey:Sa,PublicKey:Cf,PublicKeyEncryptedSessionKeyPacket:Tf,PublicKeyPacket:Wn,PublicSubkeyPacket:Ml,SecretKeyPacket:ah,SecretSubkeyPacket:s2,Signature:Rs,SignaturePacket:Or,Subkey:_a,SymEncryptedIntegrityProtectedDataPacket:i2,SymEncryptedSessionKeyPacket:ba,SymmetricallyEncryptedDataPacket:l7,TrustPacket:$T,UnparseablePacket:pf,UserAttributePacket:sh,UserIDPacket:Ol,armor:Ea,config:Xe,createCleartextMessage:iI,createMessage:tI,decrypt:dI,decryptKey:cI,decryptSessionKeys:gI,encrypt:lI,encryptKey:uI,encryptSessionKey:yI,enums:j,generateKey:sI,generateSessionKey:pI,readCleartextMessage:nI,readKey:zT,readKeys:YT,readMessage:eI,readPrivateKey:WT,readPrivateKeys:JT,readSignature:FT,reformatKey:aI,revokeKey:oI,sign:fI,unarmor:Ii,verify:hI},Symbol.toStringTag,{value:"Module"})),mC=El(gC);var O3;function gh(){if(O3)return rn;O3=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.pgpDecrypt=rn.verifySignature=rn.sign=rn.pgpEncrypt=rn.generateKeyPair=rn.PGPHelper=void 0;const e=Ke,t=mC,r={generateKeyPair(){return e.__awaiter(this,void 0,void 0,function*(){const f=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:f.privateKey,publicKeyArmored:f.publicKey}})},sign({message:f,signingKey:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.createMessage({text:f}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})})},pgpEncrypt({plainText:f,keys:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=[];for(let d=0;d<c.length;d++)l.push(yield t.readKey({armoredKey:c[d]}));const u=yield t.createMessage({text:f});return yield t.encrypt({message:u,encryptionKeys:l})})},pgpDecrypt({cipherText:f,toPrivateKeyArmored:c}){return e.__awaiter(this,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:f}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p})},verifySignature({messageContent:f,signatureArmored:c,publicKeyArmored:l}){return e.__awaiter(this,void 0,void 0,function*(){const u=yield t.createMessage({text:f}),p=yield t.readSignature({armoredSignature:c}),d=yield t.readKey({armoredKey:l}),h=yield t.verify({date:new Date(Date.now()+1e3*60*60*24),message:u,signature:p,verificationKeys:d}),{verified:y}=h.signatures[0];try{yield y}catch(g){throw new Error("Signature could not be verified: "+g)}})}};rn.PGPHelper=r;const n=()=>e.__awaiter(void 0,void 0,void 0,function*(){const f=yield t.generateKey({type:"rsa",rsaBits:2048,userIDs:[{name:"",email:""}]});return{privateKeyArmored:f.privateKey,publicKeyArmored:f.publicKey}});rn.generateKeyPair=n;const s=({plainText:f,keys:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=[];for(let d=0;d<c.length;d++)l.push(yield t.readKey({armoredKey:c[d]}));const u=yield t.createMessage({text:f});return yield t.encrypt({message:u,encryptionKeys:l})});rn.pgpEncrypt=s;const i=({message:f,signingKey:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.createMessage({text:f}),u=yield t.readPrivateKey({armoredKey:c});return yield t.sign({message:l,signingKeys:u,detached:!0})});rn.sign=i;const o=({messageContent:f,signatureArmored:c,publicKeyArmored:l})=>e.__awaiter(void 0,void 0,void 0,function*(){const u=yield t.createMessage({text:f}),p=yield t.readSignature({armoredSignature:c}),d=yield t.readKey({armoredKey:l}),h=yield t.verify({message:u,signature:p,verificationKeys:d}),{verified:y}=h.signatures[0];try{yield y}catch(g){throw new Error("Signature could not be verified: "+g)}});rn.verifySignature=o;const a=({cipherText:f,toPrivateKeyArmored:c})=>e.__awaiter(void 0,void 0,void 0,function*(){const l=yield t.readMessage({armoredMessage:f}),u=yield t.readPrivateKey({armoredKey:c}),{data:p}=yield t.decrypt({message:l,decryptionKeys:u});return p});return rn.pgpDecrypt=a,rn}var P0={},Gs={},N3;function g9(){if(N3)return Gs;N3=1,Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.getAccountAddress=Gs.getWallet=void 0;const e=Ke,t=tt(),r=s=>{const{account:i,signer:o}=s||{};return{account:i&&(0,t.pCAIP10ToWallet)(i),signer:o}};Gs.getWallet=r;const n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:i,signer:o}=s||{},a=new t.Signer(o);return i||(yield a.getAddress())||""});return Gs.getAccountAddress=n,Gs}var D3;function vC(){return D3||(D3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getConnectedUserV2Core=e.getConnectedUserV2=void 0;const t=Ke,r=Je(),n=In(),s=g9(),i=Mt(),o=(f,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getConnectedUserV2Core)(f,c,l,i.PGPHelper)});e.getConnectedUserV2=o;const a=(f,c,l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const p=yield(0,s.getAccountAddress)(f),d=yield(0,n.get)({account:p,env:l||r.default.ENV.PROD});if(d!=null&&d.encryptedPrivateKey){if(c)return Object.assign(Object.assign({},d),{privateKey:c});{console.warn("Please note that if you don't pass the pgpPrivateKey parameter, a wallet popup will appear every time the approveRequest endpoint is called. We strongly recommend passing this parameter, and it will become mandatory in future versions of the API.");const h=yield(0,i.getDecryptedPrivateKey)(f,d,p,l);return Object.assign(Object.assign({},d),{privateKey:h})}}else{const h={};f.account&&(h.account=f.account),d&&d.did&&(h.account=d.did),f.signer&&(h.signer=f.signer),h.env=l;const y=yield(0,n.createUserCore)(h,u),g=yield(0,i.getDecryptedPrivateKey)(f,y,p,l);return Object.assign(Object.assign({},y),{privateKey:g})}});e.getConnectedUserV2Core=a}(P0)),P0}var T0={},Kn={},No={},x3;function mh(){if(x3)return No;x3=1,Object.defineProperty(No,"__esModule",{value:!0}),No.populateDeprecatedUser=void 0;const e=t=>{if(!t)return t;t.name=t.profile.name,t.about=t.profile.desc,t.profilePicture=t.profile.picture,t.numMsg=t.msgSent,t.allowedNumMsg=t.maxMsgPersisted;let r="",n="",s="";try{const{version:i}=JSON.parse(t.encryptedPrivateKey);r=i}catch{}t.encryptionType=r;try{n=t.verificationProof.split(":")[0],s=t.verificationProof.split(":")[1]}catch{}return t.signature=s,t.sigType=n,t.encryptedPassword=null,t.nftOwner=null,t.linkedListHash=null,t.nfts=null,t};return No.populateDeprecatedUser=e,No}var jn={},_d={exports:{}},I0,U3;function m9(){return U3||(U3=1,I0=function(t,r){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return t.apply(r,s)}}),I0}var C0,B3;function $r(){if(B3)return C0;B3=1;var e=m9(),t=Object.prototype.toString,r=function(D){return function(O){var L=t.call(O);return D[L]||(D[L]=L.slice(8,-1).toLowerCase())}}(Object.create(null));function n(D){return D=D.toLowerCase(),function(L){return r(L)===D}}function s(D){return Array.isArray(D)}function i(D){return typeof D>"u"}function o(D){return D!==null&&!i(D)&&D.constructor!==null&&!i(D.constructor)&&typeof D.constructor.isBuffer=="function"&&D.constructor.isBuffer(D)}var a=n("ArrayBuffer");function f(D){var O;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?O=ArrayBuffer.isView(D):O=D&&D.buffer&&a(D.buffer),O}function c(D){return typeof D=="string"}function l(D){return typeof D=="number"}function u(D){return D!==null&&typeof D=="object"}function p(D){if(r(D)!=="object")return!1;var O=Object.getPrototypeOf(D);return O===null||O===Object.prototype}var d=n("Date"),h=n("File"),y=n("Blob"),g=n("FileList");function m(D){return t.call(D)==="[object Function]"}function b(D){return u(D)&&m(D.pipe)}function w(D){var O="[object FormData]";return D&&(typeof FormData=="function"&&D instanceof FormData||t.call(D)===O||m(D.toString)&&D.toString()===O)}var E=n("URLSearchParams");function C(D){return D.trim?D.trim():D.replace(/^\s+|\s+$/g,"")}function R(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function M(D,O){if(!(D===null||typeof D>"u"))if(typeof D!="object"&&(D=[D]),s(D))for(var L=0,B=D.length;L<B;L++)O.call(null,D[L],L,D);else for(var k in D)Object.prototype.hasOwnProperty.call(D,k)&&O.call(null,D[k],k,D)}function _(){var D={};function O(k,q){p(D[q])&&p(k)?D[q]=_(D[q],k):p(k)?D[q]=_({},k):s(k)?D[q]=k.slice():D[q]=k}for(var L=0,B=arguments.length;L<B;L++)M(arguments[L],O);return D}function A(D,O,L){return M(O,function(k,q){L&&typeof k=="function"?D[q]=e(k,L):D[q]=k}),D}function I(D){return D.charCodeAt(0)===65279&&(D=D.slice(1)),D}function P(D,O,L,B){D.prototype=Object.create(O.prototype,B),D.prototype.constructor=D,L&&Object.assign(D.prototype,L)}function v(D,O,L){var B,k,q,W={};O=O||{};do{for(B=Object.getOwnPropertyNames(D),k=B.length;k-- >0;)q=B[k],W[q]||(O[q]=D[q],W[q]=!0);D=Object.getPrototypeOf(D)}while(D&&(!L||L(D,O))&&D!==Object.prototype);return O}function S(D,O,L){D=String(D),(L===void 0||L>D.length)&&(L=D.length),L-=O.length;var B=D.indexOf(O,L);return B!==-1&&B===L}function T(D){if(!D)return null;var O=D.length;if(i(O))return null;for(var L=new Array(O);O-- >0;)L[O]=D[O];return L}var N=function(D){return function(O){return D&&O instanceof D}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));return C0={isArray:s,isArrayBuffer:a,isBuffer:o,isFormData:w,isArrayBufferView:f,isString:c,isNumber:l,isObject:u,isPlainObject:p,isUndefined:i,isDate:d,isFile:h,isBlob:y,isFunction:m,isStream:b,isURLSearchParams:E,isStandardBrowserEnv:R,forEach:M,merge:_,extend:A,trim:C,stripBOM:I,inherits:P,toFlatObject:v,kindOf:r,kindOfTest:n,endsWith:S,toArray:T,isTypedArray:N,isFileList:g},C0}var R0,L3;function v9(){if(L3)return R0;L3=1;var e=$r();function t(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return R0=function(n,s,i){if(!s)return n;var o;if(i)o=i(s);else if(e.isURLSearchParams(s))o=s.toString();else{var a=[];e.forEach(s,function(l,u){l===null||typeof l>"u"||(e.isArray(l)?u=u+"[]":l=[l],e.forEach(l,function(d){e.isDate(d)?d=d.toISOString():e.isObject(d)&&(d=JSON.stringify(d)),a.push(t(u)+"="+t(d))}))}),o=a.join("&")}if(o){var f=n.indexOf("#");f!==-1&&(n=n.slice(0,f)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n},R0}var k0,K3;function bC(){if(K3)return k0;K3=1;var e=$r();function t(){this.handlers=[]}return t.prototype.use=function(n,s,i){return this.handlers.push({fulfilled:n,rejected:s,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(n){this.handlers[n]&&(this.handlers[n]=null)},t.prototype.forEach=function(n){e.forEach(this.handlers,function(i){i!==null&&n(i)})},k0=t,k0}var M0,j3;function _C(){if(j3)return M0;j3=1;var e=$r();return M0=function(r,n){e.forEach(r,function(i,o){o!==n&&o.toUpperCase()===n.toUpperCase()&&(r[n]=i,delete r[o])})},M0}var O0,q3;function fo(){if(q3)return O0;q3=1;var e=$r();function t(s,i,o,a,f){Error.call(this),this.message=s,this.name="AxiosError",i&&(this.code=i),o&&(this.config=o),a&&(this.request=a),f&&(this.response=f)}e.inherits(t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=t.prototype,n={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(s){n[s]={value:s}}),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(s,i,o,a,f,c){var l=Object.create(r);return e.toFlatObject(s,l,function(p){return p!==Error.prototype}),t.call(l,s.message,i,o,a,f),l.name=s.name,c&&Object.assign(l,c),l},O0=t,O0}var N0,$3;function b9(){return $3||($3=1,N0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}),N0}var D0,V3;function _9(){if(V3)return D0;V3=1;var e=$r();function t(r,n){n=n||new FormData;var s=[];function i(a){return a===null?"":e.isDate(a)?a.toISOString():e.isArrayBuffer(a)||e.isTypedArray(a)?typeof Blob=="function"?new Blob([a]):at.from(a):a}function o(a,f){if(e.isPlainObject(a)||e.isArray(a)){if(s.indexOf(a)!==-1)throw Error("Circular reference detected in "+f);s.push(a),e.forEach(a,function(l,u){if(!e.isUndefined(l)){var p=f?f+"."+u:u,d;if(l&&!f&&typeof l=="object"){if(e.endsWith(u,"{}"))l=JSON.stringify(l);else if(e.endsWith(u,"[]")&&(d=e.toArray(l))){d.forEach(function(h){!e.isUndefined(h)&&n.append(p,i(h))});return}}o(l,p)}}),s.pop()}else n.append(f,i(a))}return o(r),n}return D0=t,D0}var x0,F3;function wC(){if(F3)return x0;F3=1;var e=fo();return x0=function(r,n,s){var i=s.config.validateStatus;!s.status||!i||i(s.status)?r(s):n(new e("Request failed with status code "+s.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))},x0}var U0,H3;function EC(){if(H3)return U0;H3=1;var e=$r();return U0=e.isStandardBrowserEnv()?function(){return{write:function(n,s,i,o,a,f){var c=[];c.push(n+"="+encodeURIComponent(s)),e.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),e.isString(o)&&c.push("path="+o),e.isString(a)&&c.push("domain="+a),f===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){var s=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),U0}var B0,G3;function AC(){return G3||(G3=1,B0=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),B0}var L0,z3;function SC(){return z3||(z3=1,L0=function(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),L0}var K0,W3;function w9(){if(W3)return K0;W3=1;var e=AC(),t=SC();return K0=function(n,s){return n&&!e(s)?t(n,s):s},K0}var j0,Y3;function PC(){if(Y3)return j0;Y3=1;var e=$r(),t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return j0=function(n){var s={},i,o,a;return n&&e.forEach(n.split(`
53
+ `),function(c){if(a=c.indexOf(":"),i=e.trim(c.substr(0,a)).toLowerCase(),o=e.trim(c.substr(a+1)),i){if(s[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?s[i]=(s[i]?s[i]:[]).concat([o]):s[i]=s[i]?s[i]+", "+o:o}}),s},j0}var q0,J3;function TC(){if(J3)return q0;J3=1;var e=$r();return q0=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),s;function i(o){var a=o;return r&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=i(window.location.href),function(a){var f=e.isString(a)?i(a):a;return f.protocol===s.protocol&&f.host===s.host}}():function(){return function(){return!0}}(),q0}var $0,Z3;function vh(){if(Z3)return $0;Z3=1;var e=fo(),t=$r();function r(n){e.call(this,n??"canceled",e.ERR_CANCELED),this.name="CanceledError"}return t.inherits(r,e,{__CANCEL__:!0}),$0=r,$0}var V0,X3;function IC(){return X3||(X3=1,V0=function(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""}),V0}var F0,Q3;function ev(){if(Q3)return F0;Q3=1;var e=$r(),t=wC(),r=EC(),n=v9(),s=w9(),i=PC(),o=TC(),a=b9(),f=fo(),c=vh(),l=IC();return F0=function(p){return new Promise(function(h,y){var g=p.data,m=p.headers,b=p.responseType,w;function E(){p.cancelToken&&p.cancelToken.unsubscribe(w),p.signal&&p.signal.removeEventListener("abort",w)}e.isFormData(g)&&e.isStandardBrowserEnv()&&delete m["Content-Type"];var C=new XMLHttpRequest;if(p.auth){var R=p.auth.username||"",M=p.auth.password?unescape(encodeURIComponent(p.auth.password)):"";m.Authorization="Basic "+btoa(R+":"+M)}var _=s(p.baseURL,p.url);C.open(p.method.toUpperCase(),n(_,p.params,p.paramsSerializer),!0),C.timeout=p.timeout;function A(){if(C){var v="getAllResponseHeaders"in C?i(C.getAllResponseHeaders()):null,S=!b||b==="text"||b==="json"?C.responseText:C.response,T={data:S,status:C.status,statusText:C.statusText,headers:v,config:p,request:C};t(function(D){h(D),E()},function(D){y(D),E()},T),C=null}}if("onloadend"in C?C.onloadend=A:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(A)},C.onabort=function(){C&&(y(new f("Request aborted",f.ECONNABORTED,p,C)),C=null)},C.onerror=function(){y(new f("Network Error",f.ERR_NETWORK,p,C,C)),C=null},C.ontimeout=function(){var S=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded",T=p.transitional||a;p.timeoutErrorMessage&&(S=p.timeoutErrorMessage),y(new f(S,T.clarifyTimeoutError?f.ETIMEDOUT:f.ECONNABORTED,p,C)),C=null},e.isStandardBrowserEnv()){var I=(p.withCredentials||o(_))&&p.xsrfCookieName?r.read(p.xsrfCookieName):void 0;I&&(m[p.xsrfHeaderName]=I)}"setRequestHeader"in C&&e.forEach(m,function(S,T){typeof g>"u"&&T.toLowerCase()==="content-type"?delete m[T]:C.setRequestHeader(T,S)}),e.isUndefined(p.withCredentials)||(C.withCredentials=!!p.withCredentials),b&&b!=="json"&&(C.responseType=p.responseType),typeof p.onDownloadProgress=="function"&&C.addEventListener("progress",p.onDownloadProgress),typeof p.onUploadProgress=="function"&&C.upload&&C.upload.addEventListener("progress",p.onUploadProgress),(p.cancelToken||p.signal)&&(w=function(v){C&&(y(!v||v&&v.type?new c:v),C.abort(),C=null)},p.cancelToken&&p.cancelToken.subscribe(w),p.signal&&(p.signal.aborted?w():p.signal.addEventListener("abort",w))),g||(g=null);var P=l(_);if(P&&["http","https","file"].indexOf(P)===-1){y(new f("Unsupported protocol "+P+":",f.ERR_BAD_REQUEST,p));return}C.send(g)})},F0}var H0,tv;function CC(){return tv||(tv=1,H0=null),H0}var G0,rv;function k2(){if(rv)return G0;rv=1;var e=$r(),t=_C(),r=fo(),n=b9(),s=_9(),i={"Content-Type":"application/x-www-form-urlencoded"};function o(l,u){!e.isUndefined(l)&&e.isUndefined(l["Content-Type"])&&(l["Content-Type"]=u)}function a(){var l;return(typeof XMLHttpRequest<"u"||typeof Cr<"u"&&Object.prototype.toString.call(Cr)==="[object process]")&&(l=ev()),l}function f(l,u,p){if(e.isString(l))try{return(u||JSON.parse)(l),e.trim(l)}catch(d){if(d.name!=="SyntaxError")throw d}return(p||JSON.stringify)(l)}var c={transitional:n,adapter:a(),transformRequest:[function(u,p){if(t(p,"Accept"),t(p,"Content-Type"),e.isFormData(u)||e.isArrayBuffer(u)||e.isBuffer(u)||e.isStream(u)||e.isFile(u)||e.isBlob(u))return u;if(e.isArrayBufferView(u))return u.buffer;if(e.isURLSearchParams(u))return o(p,"application/x-www-form-urlencoded;charset=utf-8"),u.toString();var d=e.isObject(u),h=p&&p["Content-Type"],y;if((y=e.isFileList(u))||d&&h==="multipart/form-data"){var g=this.env&&this.env.FormData;return s(y?{"files[]":u}:u,g&&new g)}else if(d||h==="application/json")return o(p,"application/json"),f(u);return u}],transformResponse:[function(u){var p=this.transitional||c.transitional,d=p&&p.silentJSONParsing,h=p&&p.forcedJSONParsing,y=!d&&this.responseType==="json";if(y||h&&e.isString(u)&&u.length)try{return JSON.parse(u)}catch(g){if(y)throw g.name==="SyntaxError"?r.from(g,r.ERR_BAD_RESPONSE,this,null,this.response):g}return u}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:CC()},validateStatus:function(u){return u>=200&&u<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(u){c.headers[u]={}}),e.forEach(["post","put","patch"],function(u){c.headers[u]=e.merge(i)}),G0=c,G0}var z0,nv;function RC(){if(nv)return z0;nv=1;var e=$r(),t=k2();return z0=function(n,s,i){var o=this||t;return e.forEach(i,function(f){n=f.call(o,n,s)}),n},z0}var W0,iv;function E9(){return iv||(iv=1,W0=function(t){return!!(t&&t.__CANCEL__)}),W0}var Y0,sv;function kC(){if(sv)return Y0;sv=1;var e=$r(),t=RC(),r=E9(),n=k2(),s=vh();function i(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new s}return Y0=function(a){i(a),a.headers=a.headers||{},a.data=t.call(a,a.data,a.headers,a.transformRequest),a.headers=e.merge(a.headers.common||{},a.headers[a.method]||{},a.headers),e.forEach(["delete","get","head","post","put","patch","common"],function(l){delete a.headers[l]});var f=a.adapter||n.adapter;return f(a).then(function(l){return i(a),l.data=t.call(a,l.data,l.headers,a.transformResponse),l},function(l){return r(l)||(i(a),l&&l.response&&(l.response.data=t.call(a,l.response.data,l.response.headers,a.transformResponse))),Promise.reject(l)})},Y0}var J0,av;function A9(){if(av)return J0;av=1;var e=$r();return J0=function(r,n){n=n||{};var s={};function i(u,p){return e.isPlainObject(u)&&e.isPlainObject(p)?e.merge(u,p):e.isPlainObject(p)?e.merge({},p):e.isArray(p)?p.slice():p}function o(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(r[u],n[u])}function a(u){if(!e.isUndefined(n[u]))return i(void 0,n[u])}function f(u){if(e.isUndefined(n[u])){if(!e.isUndefined(r[u]))return i(void 0,r[u])}else return i(void 0,n[u])}function c(u){if(u in n)return i(r[u],n[u]);if(u in r)return i(void 0,r[u])}var l={url:a,method:a,data:a,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:c};return e.forEach(Object.keys(r).concat(Object.keys(n)),function(p){var d=l[p]||o,h=d(p);e.isUndefined(h)&&d!==c||(s[p]=h)}),s},J0}var Z0,ov;function S9(){return ov||(ov=1,Z0={version:"0.27.2"}),Z0}var X0,cv;function MC(){if(cv)return X0;cv=1;var e=S9().version,t=fo(),r={};["object","boolean","number","function","string","symbol"].forEach(function(i,o){r[i]=function(f){return typeof f===i||"a"+(o<1?"n ":" ")+i}});var n={};r.transitional=function(o,a,f){function c(l,u){return"[Axios v"+e+"] Transitional option '"+l+"'"+u+(f?". "+f:"")}return function(l,u,p){if(o===!1)throw new t(c(u," has been removed"+(a?" in "+a:"")),t.ERR_DEPRECATED);return a&&!n[u]&&(n[u]=!0,console.warn(c(u," has been deprecated since v"+a+" and will be removed in the near future"))),o?o(l,u,p):!0}};function s(i,o,a){if(typeof i!="object")throw new t("options must be an object",t.ERR_BAD_OPTION_VALUE);for(var f=Object.keys(i),c=f.length;c-- >0;){var l=f[c],u=o[l];if(u){var p=i[l],d=p===void 0||u(p,l,i);if(d!==!0)throw new t("option "+l+" must be "+d,t.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new t("Unknown option "+l,t.ERR_BAD_OPTION)}}return X0={assertOptions:s,validators:r},X0}var Q0,uv;function OC(){if(uv)return Q0;uv=1;var e=$r(),t=v9(),r=bC(),n=kC(),s=A9(),i=w9(),o=MC(),a=o.validators;function f(c){this.defaults=c,this.interceptors={request:new r,response:new r}}return f.prototype.request=function(l,u){typeof l=="string"?(u=u||{},u.url=l):u=l||{},u=s(this.defaults,u),u.method?u.method=u.method.toLowerCase():this.defaults.method?u.method=this.defaults.method.toLowerCase():u.method="get";var p=u.transitional;p!==void 0&&o.assertOptions(p,{silentJSONParsing:a.transitional(a.boolean),forcedJSONParsing:a.transitional(a.boolean),clarifyTimeoutError:a.transitional(a.boolean)},!1);var d=[],h=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(u)===!1||(h=h&&R.synchronous,d.unshift(R.fulfilled,R.rejected))});var y=[];this.interceptors.response.forEach(function(R){y.push(R.fulfilled,R.rejected)});var g;if(!h){var m=[n,void 0];for(Array.prototype.unshift.apply(m,d),m=m.concat(y),g=Promise.resolve(u);m.length;)g=g.then(m.shift(),m.shift());return g}for(var b=u;d.length;){var w=d.shift(),E=d.shift();try{b=w(b)}catch(C){E(C);break}}try{g=n(b)}catch(C){return Promise.reject(C)}for(;y.length;)g=g.then(y.shift(),y.shift());return g},f.prototype.getUri=function(l){l=s(this.defaults,l);var u=i(l.baseURL,l.url);return t(u,l.params,l.paramsSerializer)},e.forEach(["delete","get","head","options"],function(l){f.prototype[l]=function(u,p){return this.request(s(p||{},{method:l,url:u,data:(p||{}).data}))}}),e.forEach(["post","put","patch"],function(l){function u(p){return function(h,y,g){return this.request(s(g||{},{method:l,headers:p?{"Content-Type":"multipart/form-data"}:{},url:h,data:y}))}}f.prototype[l]=u(),f.prototype[l+"Form"]=u(!0)}),Q0=f,Q0}var e1,lv;function NC(){if(lv)return e1;lv=1;var e=vh();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(o){n=o});var s=this;this.promise.then(function(i){if(s._listeners){var o,a=s._listeners.length;for(o=0;o<a;o++)s._listeners[o](i);s._listeners=null}}),this.promise.then=function(i){var o,a=new Promise(function(f){s.subscribe(f),o=f}).then(i);return a.cancel=function(){s.unsubscribe(o)},a},r(function(o){s.reason||(s.reason=new e(o),n(s.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},t.prototype.unsubscribe=function(n){if(this._listeners){var s=this._listeners.indexOf(n);s!==-1&&this._listeners.splice(s,1)}},t.source=function(){var n,s=new t(function(o){n=o});return{token:s,cancel:n}},e1=t,e1}var t1,dv;function DC(){return dv||(dv=1,t1=function(t){return function(n){return t.apply(null,n)}}),t1}var r1,fv;function xC(){if(fv)return r1;fv=1;var e=$r();return r1=function(r){return e.isObject(r)&&r.isAxiosError===!0},r1}var hv;function UC(){if(hv)return _d.exports;hv=1;var e=$r(),t=m9(),r=OC(),n=A9(),s=k2();function i(a){var f=new r(a),c=t(r.prototype.request,f);return e.extend(c,r.prototype,f),e.extend(c,f),c.create=function(u){return i(n(a,u))},c}var o=i(s);return o.Axios=r,o.CanceledError=vh(),o.CancelToken=NC(),o.isCancel=E9(),o.VERSION=S9().version,o.toFormData=_9(),o.AxiosError=fo(),o.Cancel=o.CanceledError,o.all=function(f){return Promise.all(f)},o.spread=DC(),o.isAxiosError=xC(),_d.exports=o,_d.exports.default=o,_d.exports}var n1,pv;function ho(){return pv||(pv=1,n1=UC()),n1}var yv;function Tt(){if(yv)return jn;yv=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.axiosDelete=jn.axiosPut=jn.axiosPost=jn.axiosGet=void 0;const e=Ke,t=ho(),n=Y4.version,s=l=>{const u=Object.assign(Object.assign({},l==null?void 0:l.headers),{"X-JS-SDK-VERSION":n});return Object.assign(Object.assign({},l),{headers:u})},i=l=>{var u;const p=l.headers["x-deprecation-notice"];if(p){const d=(u=l.config.method)===null||u===void 0?void 0:u.toUpperCase(),h=l.config.url;console.warn(`%cDeprecation Notice%c Method: ${d}, Path: ${h}, Notice: ${p}`,"color: white; background-color: red; font-weight: bold; padding: 2px 4px;","color: red; font-weight: bold;")}return l},o=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.get(l,s(u)).then(p=>i(p))});jn.axiosGet=o;const a=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.post(l,u,s(p)).then(d=>i(d))});jn.axiosPost=a;const f=(l,u,p)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.put(l,u,s(p)).then(d=>i(d))});jn.axiosPut=f;const c=(l,u)=>e.__awaiter(void 0,void 0,void 0,function*(){return t.default.delete(l,s(u)).then(p=>i(p))});return jn.axiosDelete=c,jn}var gv;function P9(){if(gv)return Kn;gv=1,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.getMessagesService=Kn.getConversationHashService=Kn.authUpdateUserService=Kn.createUserService=void 0;const e=Ke,t=Je(),r=tt(),n=_h(),s=mh(),i=Tt(),o=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{wallet:u,publicKey:p="",encryptedPrivateKey:d="",env:h=t.default.ENV.PROD,origin:y}=l||{};let{user:g}=l||{};const b=`${(0,r.getAPIBaseUrls)(h)}/v2/users/`;if((0,r.isValidNFTCAIP)(g)){const M=Math.floor(Date.now()/1e3);g.split(":").length!==6&&(g=`${g}:${M}`)}const w={caip10:(0,r.walletToPCAIP10)(g),did:(0,r.walletToPCAIP10)(g),publicKey:p,encryptedPrivateKey:d},E=(0,r.generateHash)(w),C=yield(0,n.getEip191Signature)(u,E,"v2"),R=Object.assign(Object.assign(Object.assign({},w),{origin:y}),C);return(0,i.axiosPost)(b,R).then(M=>e.__awaiter(void 0,void 0,void 0,function*(){return M.data&&(M.data.publicKey=yield(0,r.verifyProfileKeys)(M.data.encryptedPrivateKey,M.data.publicKey,M.data.did,M.data.wallets,M.data.verificationProof)),(0,s.populateDeprecatedUser)(M.data)})).catch(M=>{throw Error(`[Push SDK] - API ${b}: ${M}`)})});Kn.createUserService=o;const a=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:u,wallet:p,publicKey:d="",encryptedPrivateKey:h="",env:y=t.default.ENV.PROD}=l||{},m=`${(0,r.getAPIBaseUrls)(y)}/v2/users/${(0,r.walletToPCAIP10)(u)}/auth`,b={caip10:(0,r.walletToPCAIP10)(u),did:(0,r.walletToPCAIP10)(u),publicKey:d,encryptedPrivateKey:h},w=(0,r.generateHash)(b),E=yield(0,n.getEip191Signature)(p,w,"v2"),C=Object.assign(Object.assign({},b),E),R=e.__rest(C,["did"]);return(0,i.axiosPut)(m,R).then(M=>e.__awaiter(void 0,void 0,void 0,function*(){return M.data&&(M.data.publicKey=yield(0,r.verifyProfileKeys)(M.data.encryptedPrivateKey,M.data.publicKey,M.data.did,M.data.wallets,M.data.verificationProof)),(0,s.populateDeprecatedUser)(M.data)})).catch(M=>{throw Error(`[Push SDK] - API ${m}: ${M}`)})});Kn.authUpdateUserService=a;const f=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:u,account:p,env:d=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${(0,r.walletToPCAIP10)(p)}/conversations/${u}/hash`;return(0,i.axiosGet)(y).then(g=>g.data).catch(g=>{throw new Error(g)})});Kn.getConversationHashService=f;const c=l=>e.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:u,limit:p,env:d=t.default.ENV.PROD}=l||{},y=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/conversationhash/${u}`,g={fetchLimit:p},m=`${y}?${(0,r.getQueryParams)(g)}`;return(0,i.axiosGet)(m).then(b=>b.data).catch(b=>{throw new Error(b)})});return Kn.getMessagesService=c,Kn}var i1={},s1={},Ni={},a1={},o1={},mv;function M2(){return mv||(mv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=k4,r=Uy;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(o1)),o1}var Do={},vv;function BC(){return vv||(vv=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.GWEI_TO_WEI=void 0,Do.GWEI_TO_WEI=BigInt(1e9)),Do}var c1={},qn={},bv;function LC(){if(bv)return qn;bv=1,Object.defineProperty(qn,"__esModule",{value:!0}),qn.RLP=qn.utils=qn.decode=qn.encode=void 0;function e(m){if(Array.isArray(m)){const w=[];let E=0;for(let C=0;C<m.length;C++){const R=e(m[C]);w.push(R),E+=R.length}return l(n(E,192),...w)}const b=g(m);return b.length===1&&b[0]<128?b:l(n(b.length,128),b)}qn.encode=e;function t(m,b,w){if(w>m.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return m.slice(b,w)}function r(m){if(m[0]===0)throw new Error("invalid RLP: extra zeros");return f(a(m))}function n(m,b){if(m<56)return Uint8Array.from([m+b]);const w=p(m),E=w.length/2,C=p(b+55+E);return Uint8Array.from(c(C+w))}function s(m,b=!1){if(typeof m>"u"||m===null||m.length===0)return Uint8Array.from([]);const w=g(m),E=i(w);if(b)return E;if(E.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return E.data}qn.decode=s;function i(m){let b,w,E,C,R;const M=[],_=m[0];if(_<=127)return{data:m.slice(0,1),remainder:m.slice(1)};if(_<=183){if(b=_-127,_===128?E=Uint8Array.from([]):E=t(m,1,b),b===2&&E[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:E,remainder:m.slice(b)}}else if(_<=191){if(w=_-182,m.length-1<w)throw new Error("invalid RLP: not enough bytes for string length");if(b=r(t(m,1,w)),b<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return E=t(m,w,b+w),{data:E,remainder:m.slice(b+w)}}else if(_<=247){for(b=_-191,C=t(m,1,b);C.length;)R=i(C),M.push(R.data),C=R.remainder;return{data:M,remainder:m.slice(b)}}else{if(w=_-246,b=r(t(m,1,w)),b<56)throw new Error("invalid RLP: encoded list too short");const A=w+b;if(A>m.length)throw new Error("invalid RLP: total length is larger than the data");for(C=t(m,w,A);C.length;)R=i(C),M.push(R.data),C=R.remainder;return{data:M,remainder:m.slice(A)}}}const o=Array.from({length:256},(m,b)=>b.toString(16).padStart(2,"0"));function a(m){let b="";for(let w=0;w<m.length;w++)b+=o[m[w]];return b}function f(m){const b=Number.parseInt(m,16);if(Number.isNaN(b))throw new Error("Invalid byte sequence");return b}function c(m){if(typeof m!="string")throw new TypeError("hexToBytes: expected string, got "+typeof m);if(m.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const b=new Uint8Array(m.length/2);for(let w=0;w<b.length;w++){const E=w*2;b[w]=f(m.slice(E,E+2))}return b}function l(...m){if(m.length===1)return m[0];const b=m.reduce((E,C)=>E+C.length,0),w=new Uint8Array(b);for(let E=0,C=0;E<m.length;E++){const R=m[E];w.set(R,C),C+=R.length}return w}function u(m){return new TextEncoder().encode(m)}function p(m){if(m<0)throw new Error("Invalid integer as argument, must be unsigned!");const b=m.toString(16);return b.length%2?`0${b}`:b}function d(m){return m.length%2?`0${m}`:m}function h(m){return m.length>=2&&m[0]==="0"&&m[1]==="x"}function y(m){return typeof m!="string"?m:h(m)?m.slice(2):m}function g(m){if(m instanceof Uint8Array)return m;if(typeof m=="string")return h(m)?c(d(y(m))):u(m);if(typeof m=="number"||typeof m=="bigint")return m?c(p(m)):Uint8Array.from([]);if(m==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof m)}return qn.utils={bytesToHex:a,concatBytes:l,hexToBytes:c,utf8ToBytes:u},qn.RLP={encode:e,decode:s},qn}var $n={},tr={},Rt={},_v;function KC(){if(_v)return Rt;_v=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.add5L=Rt.add5H=Rt.add4H=Rt.add4L=Rt.add3H=Rt.add3L=Rt.add=Rt.rotlBL=Rt.rotlBH=Rt.rotlSL=Rt.rotlSH=Rt.rotr32L=Rt.rotr32H=Rt.rotrBL=Rt.rotrBH=Rt.rotrSL=Rt.rotrSH=Rt.shrSL=Rt.shrSH=Rt.toBig=Rt.split=Rt.fromBig=void 0;const e=BigInt(2**32-1),t=BigInt(32);function r(A,I=!1){return I?{h:Number(A&e),l:Number(A>>t&e)}:{h:Number(A>>t&e)|0,l:Number(A&e)|0}}Rt.fromBig=r;function n(A,I=!1){let P=new Uint32Array(A.length),v=new Uint32Array(A.length);for(let S=0;S<A.length;S++){const{h:T,l:N}=r(A[S],I);[P[S],v[S]]=[T,N]}return[P,v]}Rt.split=n;const s=(A,I)=>BigInt(A>>>0)<<t|BigInt(I>>>0);Rt.toBig=s;const i=(A,I,P)=>A>>>P;Rt.shrSH=i;const o=(A,I,P)=>A<<32-P|I>>>P;Rt.shrSL=o;const a=(A,I,P)=>A>>>P|I<<32-P;Rt.rotrSH=a;const f=(A,I,P)=>A<<32-P|I>>>P;Rt.rotrSL=f;const c=(A,I,P)=>A<<64-P|I>>>P-32;Rt.rotrBH=c;const l=(A,I,P)=>A>>>P-32|I<<64-P;Rt.rotrBL=l;const u=(A,I)=>I;Rt.rotr32H=u;const p=(A,I)=>A;Rt.rotr32L=p;const d=(A,I,P)=>A<<P|I>>>32-P;Rt.rotlSH=d;const h=(A,I,P)=>I<<P|A>>>32-P;Rt.rotlSL=h;const y=(A,I,P)=>I<<P-32|A>>>64-P;Rt.rotlBH=y;const g=(A,I,P)=>A<<P-32|I>>>64-P;Rt.rotlBL=g;function m(A,I,P,v){const S=(I>>>0)+(v>>>0);return{h:A+P+(S/2**32|0)|0,l:S|0}}Rt.add=m;const b=(A,I,P)=>(A>>>0)+(I>>>0)+(P>>>0);Rt.add3L=b;const w=(A,I,P,v)=>I+P+v+(A/2**32|0)|0;Rt.add3H=w;const E=(A,I,P,v)=>(A>>>0)+(I>>>0)+(P>>>0)+(v>>>0);Rt.add4L=E;const C=(A,I,P,v,S)=>I+P+v+S+(A/2**32|0)|0;Rt.add4H=C;const R=(A,I,P,v,S)=>(A>>>0)+(I>>>0)+(P>>>0)+(v>>>0)+(S>>>0);Rt.add5L=R;const M=(A,I,P,v,S,T)=>I+P+v+S+T+(A/2**32|0)|0;Rt.add5H=M;const _={fromBig:r,split:n,toBig:s,shrSH:i,shrSL:o,rotrSH:a,rotrSL:f,rotrBH:c,rotrBL:l,rotr32H:u,rotr32L:p,rotlSH:d,rotlSL:h,rotlBH:y,rotlBL:g,add:m,add3L:b,add3H:w,add4L:E,add4H:C,add5H:M,add5L:R};return Rt.default=_,Rt}var wv;function jC(){if(wv)return tr;wv=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.shake256=tr.shake128=tr.keccak_512=tr.keccak_384=tr.keccak_256=tr.keccak_224=tr.sha3_512=tr.sha3_384=tr.sha3_256=tr.sha3_224=tr.Keccak=tr.keccakP=void 0;const e=C4,t=KC(),r=zp,n=[],s=[],i=[],o=BigInt(0),a=BigInt(1),f=BigInt(2),c=BigInt(7),l=BigInt(256),u=BigInt(113);for(let E=0,C=a,R=1,M=0;E<24;E++){[R,M]=[M,(2*R+3*M)%5],n.push(2*(5*M+R)),s.push((E+1)*(E+2)/2%64);let _=o;for(let A=0;A<7;A++)C=(C<<a^(C>>c)*u)%l,C&f&&(_^=a<<(a<<BigInt(A))-a);i.push(_)}const[p,d]=(0,t.split)(i,!0),h=(E,C,R)=>R>32?(0,t.rotlBH)(E,C,R):(0,t.rotlSH)(E,C,R),y=(E,C,R)=>R>32?(0,t.rotlBL)(E,C,R):(0,t.rotlSL)(E,C,R);function g(E,C=24){const R=new Uint32Array(10);for(let M=24-C;M<24;M++){for(let I=0;I<10;I++)R[I]=E[I]^E[I+10]^E[I+20]^E[I+30]^E[I+40];for(let I=0;I<10;I+=2){const P=(I+8)%10,v=(I+2)%10,S=R[v],T=R[v+1],N=h(S,T,1)^R[P],D=y(S,T,1)^R[P+1];for(let O=0;O<50;O+=10)E[I+O]^=N,E[I+O+1]^=D}let _=E[2],A=E[3];for(let I=0;I<24;I++){const P=s[I],v=h(_,A,P),S=y(_,A,P),T=n[I];_=E[T],A=E[T+1],E[T]=v,E[T+1]=S}for(let I=0;I<50;I+=10){for(let P=0;P<10;P++)R[P]=E[I+P];for(let P=0;P<10;P++)E[I+P]^=~R[(P+2)%10]&R[(P+4)%10]}E[0]^=p[M],E[1]^=d[M]}R.fill(0)}tr.keccakP=g;class m extends r.Hash{constructor(C,R,M,_=!1,A=24){if(super(),this.blockLen=C,this.suffix=R,this.outputLen=M,this.enableXOF=_,this.rounds=A,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,e.number)(M),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,r.u32)(this.state)}keccak(){r.isLE||(0,r.byteSwap32)(this.state32),g(this.state32,this.rounds),r.isLE||(0,r.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(C){(0,e.exists)(this);const{blockLen:R,state:M}=this;C=(0,r.toBytes)(C);const _=C.length;for(let A=0;A<_;){const I=Math.min(R-this.pos,_-A);for(let P=0;P<I;P++)M[this.pos++]^=C[A++];this.pos===R&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:C,suffix:R,pos:M,blockLen:_}=this;C[M]^=R,R&128&&M===_-1&&this.keccak(),C[_-1]^=128,this.keccak()}writeInto(C){(0,e.exists)(this,!1),(0,e.bytes)(C),this.finish();const R=this.state,{blockLen:M}=this;for(let _=0,A=C.length;_<A;){this.posOut>=M&&this.keccak();const I=Math.min(M-this.posOut,A-_);C.set(R.subarray(this.posOut,this.posOut+I),_),this.posOut+=I,_+=I}return C}xofInto(C){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(C)}xof(C){return(0,e.number)(C),this.xofInto(new Uint8Array(C))}digestInto(C){if((0,e.output)(C,this),this.finished)throw new Error("digest() was already called");return this.writeInto(C),this.destroy(),C}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(C){const{blockLen:R,suffix:M,outputLen:_,rounds:A,enableXOF:I}=this;return C||(C=new m(R,M,_,I,A)),C.state32.set(this.state32),C.pos=this.pos,C.posOut=this.posOut,C.finished=this.finished,C.rounds=A,C.suffix=M,C.outputLen=_,C.enableXOF=I,C.destroyed=this.destroyed,C}}tr.Keccak=m;const b=(E,C,R)=>(0,r.wrapConstructor)(()=>new m(C,E,R));tr.sha3_224=b(6,144,224/8),tr.sha3_256=b(6,136,256/8),tr.sha3_384=b(6,104,384/8),tr.sha3_512=b(6,72,512/8),tr.keccak_224=b(1,144,224/8),tr.keccak_256=b(1,136,256/8),tr.keccak_384=b(1,104,384/8),tr.keccak_512=b(1,72,512/8);const w=(E,C,R)=>(0,r.wrapXOFConstructorWithOpts)((M={})=>new m(C,E,M.dkLen===void 0?R:M.dkLen,!0));return tr.shake128=w(31,168,128/8),tr.shake256=w(31,136,256/8),tr}var Vu={exports:{}};Vu.exports;var Ev;function T9(){return Ev||(Ev=1,function(e,t){var r=It&&It.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=f,t.hexToBytes=c,t.equalsBytes=l,t.wrapHash=u;const n=r(C4),s=zp,i=n.default.bool;t.assertBool=i;const o=n.default.bytes;t.assertBytes=o;var a=zp;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function f(p){if(!(p instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof p}`);return new TextDecoder().decode(p)}function c(p){const d=p.startsWith("0x")?p.substring(2):p;return(0,s.hexToBytes)(d)}function l(p,d){if(p.length!==d.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==d[h])return!1;return!0}function u(p){return d=>(n.default.bytes(d),p(d))}t.crypto=(()=>{const p=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,d=typeof nf=="function"&&nf.bind(e);return{node:d&&!p?d("crypto"):void 0,web:p}})()}(Vu,Vu.exports)),Vu.exports}var Av;function O2(){if(Av)return $n;Av=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.keccak512=$n.keccak384=$n.keccak256=$n.keccak224=void 0;const e=jC(),t=T9();return $n.keccak224=(0,t.wrapHash)(e.keccak_224),$n.keccak256=(()=>{const r=(0,t.wrapHash)(e.keccak_256);return r.create=e.keccak_256.create,r})(),$n.keccak384=(0,t.wrapHash)(e.keccak_384),$n.keccak512=(0,t.wrapHash)(e.keccak_512),$n}var u1={},Vn={},fr={},Sv;function xl(){if(Sv)return fr;Sv=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.isHexString=fr.getKeys=fr.fromAscii=fr.fromUtf8=fr.toAscii=fr.arrayContainsArray=fr.getBinarySize=fr.padToEven=fr.stripHexPrefix=fr.isHexPrefixed=void 0;function e(l){if(typeof l!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof l}`);return l[0]==="0"&&l[1]==="x"}fr.isHexPrefixed=e;const t=l=>{if(typeof l!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof l}`);return e(l)?l.slice(2):l};fr.stripHexPrefix=t;function r(l){let u=l;if(typeof u!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof u}`);return u.length%2&&(u=`0${u}`),u}fr.padToEven=r;function n(l){if(typeof l!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof l}`);return at.byteLength(l,"utf8")}fr.getBinarySize=n;function s(l,u,p){if(Array.isArray(l)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof l}'`);if(Array.isArray(u)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof u}'`);return u[p===!0?"some":"every"](d=>l.indexOf(d)>=0)}fr.arrayContainsArray=s;function i(l){let u="",p=0;const d=l.length;for(l.substring(0,2)==="0x"&&(p=2);p<d;p+=2){const h=parseInt(l.substr(p,2),16);u+=String.fromCharCode(h)}return u}fr.toAscii=i;function o(l){const u=at.from(l,"utf8");return`0x${r(u.toString("hex")).replace(/^0+|0+$/g,"")}`}fr.fromUtf8=o;function a(l){let u="";for(let p=0;p<l.length;p++){const h=l.charCodeAt(p).toString(16);u+=h.length<2?`0${h}`:h}return`0x${u}`}fr.fromAscii=a;function f(l,u,p){if(!Array.isArray(l))throw new Error(`[getKeys] method expects input 'params' to be an array, got ${typeof l}`);if(typeof u!="string")throw new Error(`[getKeys] method expects input 'key' to be type 'string', got ${typeof l}`);const d=[];for(let h=0;h<l.length;h++){let y=l[h][u];if(p===!0&&!y)y="";else if(typeof y!="string")throw new Error(`invalid abi - expected type 'string', received ${typeof y}`);d.push(y)}return d}fr.getKeys=f;function c(l,u){return!(typeof l!="string"||!l.match(/^0x[0-9A-Fa-f]*$/)||typeof u<"u"&&u>0&&l.length!==2+2*u)}return fr.isHexString=c,fr}var Pv;function N2(){if(Pv)return Vn;Pv=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.assertIsString=Vn.assertIsArray=Vn.assertIsBuffer=Vn.assertIsHexString=void 0;const e=xl(),t=function(i){if(!(0,e.isHexString)(i)){const o=`This method only supports 0x-prefixed hex strings but input was: ${i}`;throw new Error(o)}};Vn.assertIsHexString=t;const r=function(i){if(!at.isBuffer(i)){const o=`This method only supports Buffer but input was: ${i}`;throw new Error(o)}};Vn.assertIsBuffer=r;const n=function(i){if(!Array.isArray(i)){const o=`This method only supports number arrays but input was: ${i}`;throw new Error(o)}};Vn.assertIsArray=n;const s=function(i){if(typeof i!="string"){const o=`This method only supports strings but input was: ${i}`;throw new Error(o)}};return Vn.assertIsString=s,Vn}var Tv;function po(){return Tv||(Tv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=N2(),r=xl(),n=function(T){if(!Number.isSafeInteger(T)||T<0)throw new Error(`Received an invalid integer type: ${T}`);return`0x${T.toString(16)}`};e.intToHex=n;const s=function(T){const N=(0,e.intToHex)(T);return at.from((0,r.padToEven)(N.slice(2)),"hex")};e.intToBuffer=s;const i=function(T){return at.allocUnsafe(T).fill(0)};e.zeros=i;const o=function(T,N,D){const O=(0,e.zeros)(N);return D?T.length<N?(T.copy(O),O):T.slice(0,N):T.length<N?(T.copy(O,N-T.length),O):T.slice(-N)},a=function(T,N){return(0,t.assertIsBuffer)(T),o(T,N,!1)};e.setLengthLeft=a;const f=function(T,N){return(0,t.assertIsBuffer)(T),o(T,N,!0)};e.setLengthRight=f;const c=function(T){let N=T[0];for(;T.length>0&&N.toString()==="0";)T=T.slice(1),N=T[0];return T},l=function(T){return(0,t.assertIsBuffer)(T),c(T)};e.unpadBuffer=l;const u=function(T){return(0,t.assertIsArray)(T),c(T)};e.unpadArray=u;const p=function(T){return(0,t.assertIsHexString)(T),T=(0,r.stripHexPrefix)(T),"0x"+c(T)};e.unpadHexString=p;const d=function(T){if(T==null)return at.allocUnsafe(0);if(at.isBuffer(T))return at.from(T);if(Array.isArray(T)||T instanceof Uint8Array)return at.from(T);if(typeof T=="string"){if(!(0,r.isHexString)(T))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${T}`);return at.from((0,r.padToEven)((0,r.stripHexPrefix)(T)),"hex")}if(typeof T=="number")return(0,e.intToBuffer)(T);if(typeof T=="bigint"){if(T<BigInt(0))throw new Error(`Cannot convert negative bigint to buffer. Given: ${T}`);let N=T.toString(16);return N.length%2&&(N="0"+N),at.from(N,"hex")}if(T.toArray)return at.from(T.toArray());if(T.toBuffer)return at.from(T.toBuffer());throw new Error("invalid type")};e.toBuffer=d;const h=function(T){return T=(0,e.toBuffer)(T),"0x"+T.toString("hex")};e.bufferToHex=h;function y(T){const N=(0,e.bufferToHex)(T);return BigInt(N==="0x"?0:N)}e.bufferToBigInt=y;function g(T){return(0,e.toBuffer)("0x"+T.toString(16))}e.bigIntToBuffer=g;const m=function(T){const N=Number(y(T));if(!Number.isSafeInteger(N))throw new Error("Number exceeds 53 bits");return N};e.bufferToInt=m;const b=function(T){return BigInt.asIntN(256,y(T))};e.fromSigned=b;const w=function(T){return g(BigInt.asUintN(256,T))};e.toUnsigned=w;const E=function(T){return typeof T!="string"||(0,r.isHexPrefixed)(T)?T:"0x"+T};e.addHexPrefix=E;function C(T,N=50){const D=at.isBuffer(T)?T.toString("hex"):T;return D.length<=N?D:D.slice(0,N)+"…"}e.short=C;const R=function(T){const N=/^(00)+|(00)+$/g;if(T=(0,r.stripHexPrefix)(T),T.length%2!==0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return at.from(T.replace(N,""),"hex").toString("utf8")};e.toUtf8=R;const M=function(T){if(at.isBuffer(T))return`0x${T.toString("hex")}`;if(T instanceof Array){const N=[];for(let D=0;D<T.length;D++)N.push((0,e.baToJSON)(T[D]));return N}};e.baToJSON=M;const _=function(T){for(const[N,D]of Object.entries(T))if(D!==void 0&&D.length>0&&D[0]===0)throw new Error(`${N} cannot have leading zeroes, received: ${D.toString("hex")}`)};e.validateNoLeadingZeroes=_;function A(T){return Array.isArray(T)?T.map(N=>A(N)):at.from(T)}e.arrToBufArr=A;function I(T){return Array.isArray(T)?T.map(N=>I(N)):Uint8Array.from(T??[])}e.bufArrToArr=I;const P=T=>"0x"+T.toString(16);e.bigIntToHex=P;function v(T){return(0,e.unpadBuffer)(g(T))}e.bigIntToUnpaddedBuffer=v;function S(T){return(0,e.unpadBuffer)((0,e.intToBuffer)(T))}e.intToUnpaddedBuffer=S}(u1)),u1}var Iv;function I9(){return Iv||(Iv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=LC(),r=O2(),n=Uy,s=T9(),i=po(),o=M2(),a=N2(),f=xl(),c=BigInt(0);class l{constructor(S=c,T=c,N=o.KECCAK256_RLP,D=o.KECCAK256_NULL){this.nonce=S,this.balance=T,this.storageRoot=N,this.codeHash=D,this._validate()}static fromAccountData(S){const{nonce:T,balance:N,storageRoot:D,codeHash:O}=S;return new l(T!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(T)):void 0,N!==void 0?(0,i.bufferToBigInt)((0,i.toBuffer)(N)):void 0,D!==void 0?(0,i.toBuffer)(D):void 0,O!==void 0?(0,i.toBuffer)(O):void 0)}static fromRlpSerializedAccount(S){const T=(0,i.arrToBufArr)(t.RLP.decode(Uint8Array.from(S)));if(!Array.isArray(T))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(T)}static fromValuesArray(S){const[T,N,D,O]=S;return new l((0,i.bufferToBigInt)(T),(0,i.bufferToBigInt)(N),D,O)}_validate(){if(this.nonce<c)throw new Error("nonce must be greater than zero");if(this.balance<c)throw new Error("balance must be greater than zero");if(this.storageRoot.length!==32)throw new Error("storageRoot must have a length of 32");if(this.codeHash.length!==32)throw new Error("codeHash must have a length of 32")}raw(){return[(0,i.bigIntToUnpaddedBuffer)(this.nonce),(0,i.bigIntToUnpaddedBuffer)(this.balance),this.storageRoot,this.codeHash]}serialize(){return at.from(t.RLP.encode((0,i.bufArrToArr)(this.raw())))}isContract(){return!this.codeHash.equals(o.KECCAK256_NULL)}isEmpty(){return this.balance===c&&this.nonce===c&&this.codeHash.equals(o.KECCAK256_NULL)}}e.Account=l;const u=function(v){try{(0,a.assertIsString)(v)}catch{return!1}return/^0x[0-9a-fA-F]{40}$/.test(v)};e.isValidAddress=u;const p=function(v,S){(0,a.assertIsHexString)(v);const T=(0,f.stripHexPrefix)(v).toLowerCase();let N="";S!==void 0&&(N=(0,i.bufferToBigInt)((0,i.toBuffer)(S)).toString()+"0x");const D=at.from(N+T,"utf8"),O=(0,s.bytesToHex)((0,r.keccak256)(D));let L="0x";for(let B=0;B<T.length;B++)parseInt(O[B],16)>=8?L+=T[B].toUpperCase():L+=T[B];return L};e.toChecksumAddress=p;const d=function(v,S){return(0,e.isValidAddress)(v)&&(0,e.toChecksumAddress)(v,S)===v};e.isValidChecksumAddress=d;const h=function(v,S){return(0,a.assertIsBuffer)(v),(0,a.assertIsBuffer)(S),(0,i.bufferToBigInt)(S)===BigInt(0)?at.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([v,null])))).slice(-20):at.from((0,r.keccak256)(t.RLP.encode((0,i.bufArrToArr)([v,S])))).slice(-20)};e.generateAddress=h;const y=function(v,S,T){if((0,a.assertIsBuffer)(v),(0,a.assertIsBuffer)(S),(0,a.assertIsBuffer)(T),v.length!==20)throw new Error("Expected from to be of length 20");if(S.length!==32)throw new Error("Expected salt to be of length 32");const N=(0,r.keccak256)(at.concat([at.from("ff","hex"),v,S,(0,r.keccak256)(T)]));return(0,i.toBuffer)(N).slice(-20)};e.generateAddress2=y;const g=function(v){return n.secp256k1.utils.isValidPrivateKey(v)};e.isValidPrivate=g;const m=function(v,S=!1){if((0,a.assertIsBuffer)(v),v.length===64)try{return n.secp256k1.ProjectivePoint.fromHex(at.concat([at.from([4]),v])),!0}catch{return!1}if(!S)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(v),!0}catch{return!1}};e.isValidPublic=m;const b=function(v,S=!1){if((0,a.assertIsBuffer)(v),S&&v.length!==64&&(v=at.from(n.secp256k1.ProjectivePoint.fromHex(v).toRawBytes(!1).slice(1))),v.length!==64)throw new Error("Expected pubKey to be of length 64");return at.from((0,r.keccak256)(v)).slice(-20)};e.pubToAddress=b,e.publicToAddress=e.pubToAddress;const w=function(v){return(0,a.assertIsBuffer)(v),at.from(n.secp256k1.ProjectivePoint.fromPrivateKey(v).toRawBytes(!1).slice(1))};e.privateToPublic=w;const E=function(v){return(0,e.publicToAddress)((0,e.privateToPublic)(v))};e.privateToAddress=E;const C=function(v){return(0,a.assertIsBuffer)(v),v.length!==64&&(v=at.from(n.secp256k1.ProjectivePoint.fromHex(v).toRawBytes(!1).slice(1))),v};e.importPublic=C;const R=function(){const S=(0,i.zeros)(20);return(0,i.bufferToHex)(S)};e.zeroAddress=R;const M=function(v){try{(0,a.assertIsString)(v)}catch{return!1}return(0,e.zeroAddress)()===v};e.isZeroAddress=M;function _(v){const[S,T,N,D]=v;return[S,T,(0,i.arrToBufArr)(N).length===0?o.KECCAK256_RLP:N,(0,i.arrToBufArr)(D).length===0?o.KECCAK256_NULL:D]}e.accountBodyFromSlim=_;const A=new Uint8Array(0);function I(v){const[S,T,N,D]=v;return[S,T,(0,i.arrToBufArr)(N).equals(o.KECCAK256_RLP)?A:N,(0,i.arrToBufArr)(D).equals(o.KECCAK256_NULL)?A:D]}e.accountBodyToSlim=I;function P(v,S=!0){const T=S?_(v):v;return(0,i.arrToBufArr)(t.RLP.encode(T))}e.accountBodyToRLP=P}(c1)),c1}var xo={},Cv;function C9(){if(Cv)return xo;Cv=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.Address=void 0;const e=I9(),t=po();class r{constructor(s){if(s.length!==20)throw new Error("Invalid address length");this.buf=s}static zero(){return new r((0,t.zeros)(20))}static fromString(s){if(!(0,e.isValidAddress)(s))throw new Error("Invalid address");return new r((0,t.toBuffer)(s))}static fromPublicKey(s){if(!at.isBuffer(s))throw new Error("Public key should be Buffer");const i=(0,e.pubToAddress)(s);return new r(i)}static fromPrivateKey(s){if(!at.isBuffer(s))throw new Error("Private key should be Buffer");const i=(0,e.privateToAddress)(s);return new r(i)}static generate(s,i){if(typeof i!="bigint")throw new Error("Expected nonce to be a bigint");return new r((0,e.generateAddress)(s.buf,(0,t.bigIntToBuffer)(i)))}static generate2(s,i,o){if(!at.isBuffer(i))throw new Error("Expected salt to be a Buffer");if(!at.isBuffer(o))throw new Error("Expected initCode to be a Buffer");return new r((0,e.generateAddress2)(s.buf,i,o))}equals(s){return this.buf.equals(s.buf)}isZero(){return this.equals(r.zero())}isPrecompileOrSystemAddress(){const s=(0,t.bufferToBigInt)(this.buf),i=BigInt(0),o=BigInt("0xffff");return s>=i&&s<=o}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return at.from(this.buf)}}return xo.Address=r,xo}var Uo={},l1={},Rv;function R9(){return Rv||(Rv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=po(),r=xl();var n;(function(i){i[i.Number=0]="Number",i[i.BigInt=1]="BigInt",i[i.Buffer=2]="Buffer",i[i.PrefixedHexString=3]="PrefixedHexString"})(n=e.TypeOutput||(e.TypeOutput={}));function s(i,o){if(i===null)return null;if(i===void 0)return;if(typeof i=="string"&&!(0,r.isHexString)(i))throw new Error(`A string must be provided with a 0x-prefix, given: ${i}`);if(typeof i=="number"&&!Number.isSafeInteger(i))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const a=(0,t.toBuffer)(i);switch(o){case n.Buffer:return a;case n.BigInt:return(0,t.bufferToBigInt)(a);case n.Number:{const f=(0,t.bufferToBigInt)(a);if(f>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(f)}case n.PrefixedHexString:return(0,t.bufferToHex)(a);default:throw new Error("unknown outputType")}}e.toType=s}(l1)),l1}var kv;function qC(){if(kv)return Uo;kv=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.Withdrawal=void 0;const e=C9(),t=po(),r=R9();class n{constructor(i,o,a,f){this.index=i,this.validatorIndex=o,this.address=a,this.amount=f}static fromWithdrawalData(i){const{index:o,validatorIndex:a,address:f,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt),u=(0,r.toType)(a,r.TypeOutput.BigInt),p=new e.Address((0,r.toType)(f,r.TypeOutput.Buffer)),d=(0,r.toType)(c,r.TypeOutput.BigInt);return new n(l,u,p,d)}static fromValuesArray(i){if(i.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${i.length}`);const[o,a,f,c]=i;return n.fromWithdrawalData({index:o,validatorIndex:a,address:f,amount:c})}static toBufferArray(i){const{index:o,validatorIndex:a,address:f,amount:c}=i,l=(0,r.toType)(o,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(o,r.TypeOutput.Buffer),u=(0,r.toType)(a,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(a,r.TypeOutput.Buffer);let p;f instanceof e.Address?p=f.buf:p=(0,r.toType)(f,r.TypeOutput.Buffer);const d=(0,r.toType)(c,r.TypeOutput.BigInt)===BigInt(0)?at.alloc(0):(0,r.toType)(c,r.TypeOutput.Buffer);return[l,u,p,d]}raw(){return n.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,t.bigIntToHex)(this.index),validatorIndex:(0,t.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,t.bigIntToHex)(this.amount)}}}return Uo.Withdrawal=n,Uo}var xr={},Mv;function $C(){if(Mv)return xr;Mv=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.hashPersonalMessage=xr.isValidSignature=xr.fromRpcSig=xr.toCompactSig=xr.toRpcSig=xr.ecrecover=xr.ecsign=void 0;const e=O2(),t=Uy,r=po(),n=M2(),s=N2();function i(h,y,g){const m=t.secp256k1.sign(h,y),b=m.toCompactRawBytes(),w=at.from(b.slice(0,32)),E=at.from(b.slice(32,64)),C=g===void 0?BigInt(m.recovery+27):BigInt(m.recovery+35)+BigInt(g)*BigInt(2);return{r:w,s:E,v:C}}xr.ecsign=i;function o(h,y){return h===BigInt(0)||h===BigInt(1)?h:y===void 0?h-BigInt(27):h-(y*BigInt(2)+BigInt(35))}function a(h){return h===BigInt(0)||h===BigInt(1)}const f=function(h,y,g,m,b){const w=at.concat([(0,r.setLengthLeft)(g,32),(0,r.setLengthLeft)(m,32)],64),E=o(y,b);if(!a(E))throw new Error("Invalid signature v value");const R=t.secp256k1.Signature.fromCompact(w).addRecoveryBit(Number(E)).recoverPublicKey(h);return at.from(R.toRawBytes(!1).slice(1))};xr.ecrecover=f;const c=function(h,y,g,m){const b=o(h,m);if(!a(b))throw new Error("Invalid signature v value");return(0,r.bufferToHex)(at.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(g,32),(0,r.toBuffer)(h)]))};xr.toRpcSig=c;const l=function(h,y,g,m){const b=o(h,m);if(!a(b))throw new Error("Invalid signature v value");let w=g;return(h>BigInt(28)&&h%BigInt(2)===BigInt(1)||h===BigInt(1)||h===BigInt(28))&&(w=at.from(g),w[0]|=128),(0,r.bufferToHex)(at.concat([(0,r.setLengthLeft)(y,32),(0,r.setLengthLeft)(w,32)]))};xr.toCompactSig=l;const u=function(h){const y=(0,r.toBuffer)(h);let g,m,b;if(y.length>=65)g=y.slice(0,32),m=y.slice(32,64),b=(0,r.bufferToBigInt)(y.slice(64));else if(y.length===64)g=y.slice(0,32),m=y.slice(32,64),b=BigInt((0,r.bufferToInt)(y.slice(32,33))>>7),m[0]&=127;else throw new Error("Invalid signature length");return b<27&&(b=b+BigInt(27)),{v:b,r:g,s:m}};xr.fromRpcSig=u;const p=function(h,y,g,m=!0,b){if(y.length!==32||g.length!==32||!a(o(h,b)))return!1;const w=(0,r.bufferToBigInt)(y),E=(0,r.bufferToBigInt)(g);return!(w===BigInt(0)||w>=n.SECP256K1_ORDER||E===BigInt(0)||E>=n.SECP256K1_ORDER||m&&E>=n.SECP256K1_ORDER_DIV_2)};xr.isValidSignature=p;const d=function(h){(0,s.assertIsBuffer)(h);const y=at.from(`Ethereum Signed Message:
54
+ ${h.length}`,"utf-8");return at.from((0,e.keccak256)(at.concat([y,h])))};return xr.hashPersonalMessage=d,xr}var d1={},Ov;function VC(){return Ov||(Ov=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=o=>o.length>0&&o[o.length-1]===16;e.hasTerminator=t;const r=(o,a)=>{for(let f=0,c=0;c<o.length;f+=1,c+=2)a[f]=o[c]<<4|o[c+1]};e.nibblesToBytes=r;const n=o=>{let a=0;(0,e.hasTerminator)(o)&&(a=1,o=o.subarray(0,o.length-1));const f=new Uint8Array(o.length/2+1);return f[0]=a<<5,(o.length&1)===1&&(f[0]|=16,f[0]|=o[0],o=o.subarray(1)),(0,e.nibblesToBytes)(o,f.subarray(1)),f};e.nibblesToCompactBytes=n;const s=o=>{const a=o.length*2+1,f=new Uint8Array(a);for(let c=0;c<o.length;c++){const l=o[c];f[c*2]=l/16,f[c*2+1]=l%16}return f[a-1]=16,f};e.bytesToNibbles=s;const i=o=>{if(o.length===0)return o;let a=(0,e.bytesToNibbles)(o);a[0]<2&&(a=a.subarray(0,a.length-1));const f=2-(a[0]&1);return a.subarray(f)};e.compactBytesToNibbles=i}(d1)),d1}var Bo={},Nv;function FC(){if(Nv)return Bo;Nv=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.AsyncEventEmitter=void 0;const e=R4;async function t(n,s,i){let o;for await(const a of s)try{a.length<2?a.call(n,i):await new Promise((f,c)=>{a.call(n,i,l=>{l?c(l):f()})})}catch(f){o=f}if(o)throw o}class r extends e.EventEmitter{emit(s,...i){let[o,a]=i;const f=this;let c=f._events[s]??[];return a===void 0&&typeof o=="function"&&(a=o,o=void 0),(s==="newListener"||s==="removeListener")&&(o={event:o,fn:a},a=void 0),c=Array.isArray(c)?c:[c],t(f,c.slice(),o).then(a).catch(a),f.listenerCount(s)>0}once(s,i){const o=this;let a;if(typeof i!="function")throw new TypeError("listener must be a function");return i.length>=2?a=function(f,c){o.removeListener(s,a),i(f,c)}:a=function(f){o.removeListener(s,a),i(f,a)},o.on(s,a),o}first(s,i){let o=this._events[s]??[];if(typeof i!="function")throw new TypeError("listener must be a function");return Array.isArray(o)||(this._events[s]=o=[o]),o.unshift(i),this}before(s,i,o){return this.beforeOrAfter(s,i,o)}after(s,i,o){return this.beforeOrAfter(s,i,o,"after")}beforeOrAfter(s,i,o,a){let f=this._events[s]??[],c,l;const u=a==="after"?1:0;if(typeof o!="function")throw new TypeError("listener must be a function");if(typeof i!="function")throw new TypeError("target must be a function");for(Array.isArray(f)||(this._events[s]=f=[f]),l=f.length,c=f.length;c--;)if(f[c]===i){l=c+u;break}return f.splice(l,0,o),this}on(s,i){return super.on(s,i)}addListener(s,i){return super.addListener(s,i)}prependListener(s,i){return super.prependListener(s,i)}prependOnceListener(s,i){return super.prependOnceListener(s,i)}removeAllListeners(s){return super.removeAllListeners(s)}removeListener(s,i){return super.removeListener(s,i)}eventNames(){return super.eventNames()}listeners(s){return super.listeners(s)}listenerCount(s){return super.listenerCount(s)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(s){return super.setMaxListeners(s)}}return Bo.AsyncEventEmitter=r,Bo}var Lo={},Dv;function HC(){if(Dv)return Lo;Dv=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.Lock=void 0;class e{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(r=>this.promiseResolverQueue.push(r))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const r=this.promiseResolverQueue.shift();r&&r(!0)}}}return Lo.Lock=e,Lo}var zs={},ss={},f1={},h1={},p1,xv;function GC(){if(xv)return p1;xv=1;const e=(function*(){}).constructor;return p1=()=>e,p1}var y1,Uv;function zC(){if(Uv)return y1;Uv=1;var e=eA,t=lA(),r=t(/^\s*(?:function)?\*/),n=fA(),s=tA,i=e("Object.prototype.toString"),o=e("Function.prototype.toString"),a=GC();return y1=function(c){if(typeof c!="function")return!1;if(r(o(c)))return!0;if(!n){var l=i(c);return l==="[object GeneratorFunction]"}if(!s)return!1;var u=a();return u&&s(c)===u.prototype},y1}var Bv;function WC(){return Bv||(Bv=1,function(e){var t=dA,r=zC(),n=hA,s=sA();function i(ne){return ne.call.bind(ne)}var o=typeof BigInt<"u",a=typeof Symbol<"u",f=i(Object.prototype.toString),c=i(Number.prototype.valueOf),l=i(String.prototype.valueOf),u=i(Boolean.prototype.valueOf);if(o)var p=i(BigInt.prototype.valueOf);if(a)var d=i(Symbol.prototype.valueOf);function h(ne,Fe){if(typeof ne!="object")return!1;try{return Fe(ne),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=s;function y(ne){return typeof Promise<"u"&&ne instanceof Promise||ne!==null&&typeof ne=="object"&&typeof ne.then=="function"&&typeof ne.catch=="function"}e.isPromise=y;function g(ne){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(ne):s(ne)||re(ne)}e.isArrayBufferView=g;function m(ne){return n(ne)==="Uint8Array"}e.isUint8Array=m;function b(ne){return n(ne)==="Uint8ClampedArray"}e.isUint8ClampedArray=b;function w(ne){return n(ne)==="Uint16Array"}e.isUint16Array=w;function E(ne){return n(ne)==="Uint32Array"}e.isUint32Array=E;function C(ne){return n(ne)==="Int8Array"}e.isInt8Array=C;function R(ne){return n(ne)==="Int16Array"}e.isInt16Array=R;function M(ne){return n(ne)==="Int32Array"}e.isInt32Array=M;function _(ne){return n(ne)==="Float32Array"}e.isFloat32Array=_;function A(ne){return n(ne)==="Float64Array"}e.isFloat64Array=A;function I(ne){return n(ne)==="BigInt64Array"}e.isBigInt64Array=I;function P(ne){return n(ne)==="BigUint64Array"}e.isBigUint64Array=P;function v(ne){return f(ne)==="[object Map]"}v.working=typeof Map<"u"&&v(new Map);function S(ne){return typeof Map>"u"?!1:v.working?v(ne):ne instanceof Map}e.isMap=S;function T(ne){return f(ne)==="[object Set]"}T.working=typeof Set<"u"&&T(new Set);function N(ne){return typeof Set>"u"?!1:T.working?T(ne):ne instanceof Set}e.isSet=N;function D(ne){return f(ne)==="[object WeakMap]"}D.working=typeof WeakMap<"u"&&D(new WeakMap);function O(ne){return typeof WeakMap>"u"?!1:D.working?D(ne):ne instanceof WeakMap}e.isWeakMap=O;function L(ne){return f(ne)==="[object WeakSet]"}L.working=typeof WeakSet<"u"&&L(new WeakSet);function B(ne){return L(ne)}e.isWeakSet=B;function k(ne){return f(ne)==="[object ArrayBuffer]"}k.working=typeof ArrayBuffer<"u"&&k(new ArrayBuffer);function q(ne){return typeof ArrayBuffer>"u"?!1:k.working?k(ne):ne instanceof ArrayBuffer}e.isArrayBuffer=q;function W(ne){return f(ne)==="[object DataView]"}W.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&W(new DataView(new ArrayBuffer(1),0,1));function re(ne){return typeof DataView>"u"?!1:W.working?W(ne):ne instanceof DataView}e.isDataView=re;var ue=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function H(ne){return f(ne)==="[object SharedArrayBuffer]"}function ae(ne){return typeof ue>"u"?!1:(typeof H.working>"u"&&(H.working=H(new ue)),H.working?H(ne):ne instanceof ue)}e.isSharedArrayBuffer=ae;function V(ne){return f(ne)==="[object AsyncFunction]"}e.isAsyncFunction=V;function U(ne){return f(ne)==="[object Map Iterator]"}e.isMapIterator=U;function te(ne){return f(ne)==="[object Set Iterator]"}e.isSetIterator=te;function ge(ne){return f(ne)==="[object Generator]"}e.isGeneratorObject=ge;function Pe(ne){return f(ne)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=Pe;function Te(ne){return h(ne,c)}e.isNumberObject=Te;function z(ne){return h(ne,l)}e.isStringObject=z;function $(ne){return h(ne,u)}e.isBooleanObject=$;function F(ne){return o&&h(ne,p)}e.isBigIntObject=F;function Q(ne){return a&&h(ne,d)}e.isSymbolObject=Q;function de(ne){return Te(ne)||z(ne)||$(ne)||F(ne)||Q(ne)}e.isBoxedPrimitive=de;function oe(ne){return typeof Uint8Array<"u"&&(q(ne)||ae(ne))}e.isAnyArrayBuffer=oe,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(ne){Object.defineProperty(e,ne,{enumerable:!1,value:function(){throw new Error(ne+" is not supported in userland")}})})}(h1)),h1}var g1,Lv;function YC(){return Lv||(Lv=1,g1=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}),g1}var Kv;function JC(){return Kv||(Kv=1,function(e){var t=Object.getOwnPropertyDescriptors||function(re){for(var ue=Object.keys(re),H={},ae=0;ae<ue.length;ae++)H[ue[ae]]=Object.getOwnPropertyDescriptor(re,ue[ae]);return H},r=/%[sdj%]/g;e.format=function(W){if(!C(W)){for(var re=[],ue=0;ue<arguments.length;ue++)re.push(o(arguments[ue]));return re.join(" ")}for(var ue=1,H=arguments,ae=H.length,V=String(W).replace(r,function(te){if(te==="%%")return"%";if(ue>=ae)return te;switch(te){case"%s":return String(H[ue++]);case"%d":return Number(H[ue++]);case"%j":try{return JSON.stringify(H[ue++])}catch{return"[Circular]"}default:return te}}),U=H[ue];ue<ae;U=H[++ue])b(U)||!A(U)?V+=" "+U:V+=" "+o(U);return V},e.deprecate=function(W,re){if(typeof Cr<"u"&&Cr.noDeprecation===!0)return W;if(typeof Cr>"u")return function(){return e.deprecate(W,re).apply(this,arguments)};var ue=!1;function H(){if(!ue){if(Cr.throwDeprecation)throw new Error(re);Cr.traceDeprecation?console.trace(re):console.error(re),ue=!0}return W.apply(this,arguments)}return H};var n={},s=/^$/;if({}.NODE_DEBUG){var i={}.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+i+"$","i")}e.debuglog=function(W){if(W=W.toUpperCase(),!n[W])if(s.test(W)){var re=Cr.pid;n[W]=function(){var ue=e.format.apply(e,arguments);console.error("%s %d: %s",W,re,ue)}}else n[W]=function(){};return n[W]};function o(W,re){var ue={seen:[],stylize:f};return arguments.length>=3&&(ue.depth=arguments[2]),arguments.length>=4&&(ue.colors=arguments[3]),m(re)?ue.showHidden=re:re&&e._extend(ue,re),M(ue.showHidden)&&(ue.showHidden=!1),M(ue.depth)&&(ue.depth=2),M(ue.colors)&&(ue.colors=!1),M(ue.customInspect)&&(ue.customInspect=!0),ue.colors&&(ue.stylize=a),l(ue,W,ue.depth)}e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(W,re){var ue=o.styles[re];return ue?"\x1B["+o.colors[ue][0]+"m"+W+"\x1B["+o.colors[ue][1]+"m":W}function f(W,re){return W}function c(W){var re={};return W.forEach(function(ue,H){re[ue]=!0}),re}function l(W,re,ue){if(W.customInspect&&re&&v(re.inspect)&&re.inspect!==e.inspect&&!(re.constructor&&re.constructor.prototype===re)){var H=re.inspect(ue,W);return C(H)||(H=l(W,H,ue)),H}var ae=u(W,re);if(ae)return ae;var V=Object.keys(re),U=c(V);if(W.showHidden&&(V=Object.getOwnPropertyNames(re)),P(re)&&(V.indexOf("message")>=0||V.indexOf("description")>=0))return p(re);if(V.length===0){if(v(re)){var te=re.name?": "+re.name:"";return W.stylize("[Function"+te+"]","special")}if(_(re))return W.stylize(RegExp.prototype.toString.call(re),"regexp");if(I(re))return W.stylize(Date.prototype.toString.call(re),"date");if(P(re))return p(re)}var ge="",Pe=!1,Te=["{","}"];if(g(re)&&(Pe=!0,Te=["[","]"]),v(re)){var z=re.name?": "+re.name:"";ge=" [Function"+z+"]"}if(_(re)&&(ge=" "+RegExp.prototype.toString.call(re)),I(re)&&(ge=" "+Date.prototype.toUTCString.call(re)),P(re)&&(ge=" "+p(re)),V.length===0&&(!Pe||re.length==0))return Te[0]+ge+Te[1];if(ue<0)return _(re)?W.stylize(RegExp.prototype.toString.call(re),"regexp"):W.stylize("[Object]","special");W.seen.push(re);var $;return Pe?$=d(W,re,ue,U,V):$=V.map(function(F){return h(W,re,ue,U,F,Pe)}),W.seen.pop(),y($,ge,Te)}function u(W,re){if(M(re))return W.stylize("undefined","undefined");if(C(re)){var ue="'"+JSON.stringify(re).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return W.stylize(ue,"string")}if(E(re))return W.stylize(""+re,"number");if(m(re))return W.stylize(""+re,"boolean");if(b(re))return W.stylize("null","null")}function p(W){return"["+Error.prototype.toString.call(W)+"]"}function d(W,re,ue,H,ae){for(var V=[],U=0,te=re.length;U<te;++U)L(re,String(U))?V.push(h(W,re,ue,H,String(U),!0)):V.push("");return ae.forEach(function(ge){ge.match(/^\d+$/)||V.push(h(W,re,ue,H,ge,!0))}),V}function h(W,re,ue,H,ae,V){var U,te,ge;if(ge=Object.getOwnPropertyDescriptor(re,ae)||{value:re[ae]},ge.get?ge.set?te=W.stylize("[Getter/Setter]","special"):te=W.stylize("[Getter]","special"):ge.set&&(te=W.stylize("[Setter]","special")),L(H,ae)||(U="["+ae+"]"),te||(W.seen.indexOf(ge.value)<0?(b(ue)?te=l(W,ge.value,null):te=l(W,ge.value,ue-1),te.indexOf(`
55
+ `)>-1&&(V?te=te.split(`
56
+ `).map(function(Pe){return" "+Pe}).join(`
57
+ `).slice(2):te=`
58
+ `+te.split(`
59
+ `).map(function(Pe){return" "+Pe}).join(`
60
+ `))):te=W.stylize("[Circular]","special")),M(U)){if(V&&ae.match(/^\d+$/))return te;U=JSON.stringify(""+ae),U.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(U=U.slice(1,-1),U=W.stylize(U,"name")):(U=U.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),U=W.stylize(U,"string"))}return U+": "+te}function y(W,re,ue){var H=W.reduce(function(ae,V){return V.indexOf(`
61
+ `)>=0,ae+V.replace(/\u001b\[\d\d?m/g,"").length+1},0);return H>60?ue[0]+(re===""?"":re+`
62
+ `)+" "+W.join(`,
63
+ `)+" "+ue[1]:ue[0]+re+" "+W.join(", ")+" "+ue[1]}e.types=WC();function g(W){return Array.isArray(W)}e.isArray=g;function m(W){return typeof W=="boolean"}e.isBoolean=m;function b(W){return W===null}e.isNull=b;function w(W){return W==null}e.isNullOrUndefined=w;function E(W){return typeof W=="number"}e.isNumber=E;function C(W){return typeof W=="string"}e.isString=C;function R(W){return typeof W=="symbol"}e.isSymbol=R;function M(W){return W===void 0}e.isUndefined=M;function _(W){return A(W)&&T(W)==="[object RegExp]"}e.isRegExp=_,e.types.isRegExp=_;function A(W){return typeof W=="object"&&W!==null}e.isObject=A;function I(W){return A(W)&&T(W)==="[object Date]"}e.isDate=I,e.types.isDate=I;function P(W){return A(W)&&(T(W)==="[object Error]"||W instanceof Error)}e.isError=P,e.types.isNativeError=P;function v(W){return typeof W=="function"}e.isFunction=v;function S(W){return W===null||typeof W=="boolean"||typeof W=="number"||typeof W=="string"||typeof W=="symbol"||typeof W>"u"}e.isPrimitive=S,e.isBuffer=YC();function T(W){return Object.prototype.toString.call(W)}function N(W){return W<10?"0"+W.toString(10):W.toString(10)}var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var W=new Date,re=[N(W.getHours()),N(W.getMinutes()),N(W.getSeconds())].join(":");return[W.getDate(),D[W.getMonth()],re].join(" ")}e.log=function(){console.log("%s - %s",O(),e.format.apply(e,arguments))},e.inherits=rA,e._extend=function(W,re){if(!re||!A(re))return W;for(var ue=Object.keys(re),H=ue.length;H--;)W[ue[H]]=re[ue[H]];return W};function L(W,re){return Object.prototype.hasOwnProperty.call(W,re)}var B=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(re){if(typeof re!="function")throw new TypeError('The "original" argument must be of type Function');if(B&&re[B]){var ue=re[B];if(typeof ue!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(ue,B,{value:ue,enumerable:!1,writable:!1,configurable:!0}),ue}function ue(){for(var H,ae,V=new Promise(function(ge,Pe){H=ge,ae=Pe}),U=[],te=0;te<arguments.length;te++)U.push(arguments[te]);U.push(function(ge,Pe){ge?ae(ge):H(Pe)});try{re.apply(this,U)}catch(ge){ae(ge)}return V}return Object.setPrototypeOf(ue,Object.getPrototypeOf(re)),B&&Object.defineProperty(ue,B,{value:ue,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(ue,t(re))},e.promisify.custom=B;function k(W,re){if(!W){var ue=new Error("Promise was rejected with a falsy value");ue.reason=W,W=ue}return re(W)}function q(W){if(typeof W!="function")throw new TypeError('The "original" argument must be of type Function');function re(){for(var ue=[],H=0;H<arguments.length;H++)ue.push(arguments[H]);var ae=ue.pop();if(typeof ae!="function")throw new TypeError("The last argument must be of type Function");var V=this,U=function(){return ae.apply(V,arguments)};W.apply(this,ue).then(function(te){Cr.nextTick(U.bind(null,null,te))},function(te){Cr.nextTick(k.bind(null,te,U))})}return Object.setPrototypeOf(re,Object.getPrototypeOf(W)),Object.defineProperties(re,t(W)),re}e.callbackify=q}(f1)),f1}var jv;function ZC(){if(jv)return ss;jv=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.InvalidStatusCodeError=ss.InvalidCertError=void 0;const e=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class t extends Error{constructor(p,d){super(p),this.fingerprint256=d}}ss.InvalidCertError=t;class r extends Error{constructor(p){super(`Request Failed. Status Code: ${p}`),this.statusCode=p}}ss.InvalidStatusCodeError=r;function n(u,p){if(!p||p==="text"||p==="json")try{let d=new TextDecoder("utf8",{fatal:!0}).decode(u);if(p==="text")return d;try{return JSON.parse(d)}catch(h){if(p==="json")throw h;return d}}catch(d){if(p==="text"||p==="json")throw d}return u}let s={};function i(u,p){var M;let d={...e,...p};const h=Wa,y=Wa,g=Wa,{promisify:m}=JC(),{resolve:b}=nA,w=!!/^https/.test(u);let E={method:d.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const C=_=>_.replace(/:| /g,"").toLowerCase();if(d.keepAlive){const _={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},A=[w,w&&((M=d.sslPinnedCertificates)==null?void 0:M.map(I=>C(I)).sort())].join();E.agent=s[A]||(s[A]=new(w?y:h).Agent(_))}d.type==="json"&&(E.headers["Content-Type"]="application/json"),d.data&&(d.method||(E.method="POST"),E.body=d.type==="json"?JSON.stringify(d.data):d.data),E.headers={...E.headers,...d.headers},d.sslAllowSelfSigned&&(E.rejectUnauthorized=!1);const R=async _=>{const A=_.statusCode;if(d.redirect&&300<=A&&A<400&&_.headers.location){if(d._redirectCount==10)throw new Error("Request failed. Too much redirects.");return d._redirectCount+=1,await i(b(u,_.headers.location),d)}if(d.expectStatusCode&&A!==d.expectStatusCode)throw _.resume(),new r(A);let I=[];for await(const T of _)I.push(T);let P=at.concat(I);const v=_.headers["content-encoding"];v==="br"&&(P=await m(g.brotliDecompress)(P)),(v==="gzip"||v==="deflate")&&(P=await m(g.unzip)(P));const S=n(P,d.type);return d.full?{headers:_.headers,status:A,body:S}:S};return new Promise((_,A)=>{var T;const I=async N=>{if(N&&N.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await i(u,{...d,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(D){D&&D.fingerprint256&&(N=new t(`Self-signed SSL certificate: ${D.fingerprint256}`,D.fingerprint256))}A(N)},P=(w?y:h).request(u,E,N=>{N.on("error",I),(async()=>{try{_(await R(N))}catch(D){A(D)}})()});P.on("error",I);const v=(T=d.sslPinnedCertificates)==null?void 0:T.map(N=>C(N)),S=N=>{var O;const D=C(((O=N.getPeerCertificate())==null?void 0:O.fingerprint256)||"");if(!(!D&&N.isSessionReused())&&!v.includes(D))return P.emit("error",new t(`Invalid SSL certificate: ${D} Expected: ${v}`,D)),P.abort()};d.sslPinnedCertificates&&P.on("socket",N=>{N.listeners("secureConnect").map(O=>(O.name||"").replace("bound ","")).includes("mfetchSecureConnect")||N.on("secureConnect",S.bind(null,N))}),d.keepAlive&&P.setNoDelay(!0),E.body&&P.write(E.body),P.end()})}const o=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(u=>u.toLowerCase())),a=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(u=>u.toLowerCase()));async function f(u,p){let d={...e,...p};const h=new Headers;d.type==="json"&&h.set("Content-Type","application/json");let y=new URL(u);if(y.username){const w=btoa(`${y.username}:${y.password}`);h.set("Authorization",`Basic ${w}`),y.username="",y.password=""}u=""+y;for(let w in d.headers){const E=w.toLowerCase();(o.has(E)||d.cors&&!a.has(E))&&h.set(w,d.headers[w])}let g={headers:h,redirect:d.redirect?"follow":"manual"};d.referrer||(g.referrerPolicy="no-referrer"),d.cors&&(g.mode="cors"),d.data&&(d.method||(g.method="POST"),g.body=d.type==="json"?JSON.stringify(d.data):d.data);const m=await fetch(u,g);if(d.expectStatusCode&&m.status!==d.expectStatusCode)throw new r(m.status);const b=n(new Uint8Array(await m.arrayBuffer()),d.type);return d.full?{headers:Object.fromEntries(m.headers.entries()),status:m.status,body:b}:b}const c=!!(typeof Cr=="object"&&Cr.versions&&Cr.versions.node&&Cr.versions.v8);function l(u,p){return(c?i:f)(u,p)}return ss.default=l,ss}var qv;function XC(){if(qv)return zs;qv=1,Object.defineProperty(zs,"__esModule",{value:!0}),zs.getProvider=zs.fetchFromProvider=void 0;const e=ZC(),t=async(n,s)=>(await(0,e.default)(n,{headers:{"content-type":"application/json"},type:"json",data:{method:s.method,params:s.params,jsonrpc:"2.0",id:1}})).result;zs.fetchFromProvider=t;const r=n=>{var s;if(typeof n=="string")return n;if(((s=n==null?void 0:n.connection)==null?void 0:s.url)!==void 0)return n.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};return zs.getProvider=r,zs}var $v;function bh(){return $v||($v=1,function(e){var t=It&&It.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var f=Object.getOwnPropertyDescriptor(i,o);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,f)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=It&&It.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(M2(),e),r(BC(),e),r(I9(),e),r(C9(),e),r(qC(),e),r($C(),e),r(po(),e),r(R9(),e),r(VC(),e),r(FC(),e);var n=xl();Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(HC(),e),r(XC(),e)}(a1)),a1}var Ur={},m1,Vv;function k9(){return Vv||(Vv=1,m1=function(t){if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return t.slice(0,2)==="0x"}),m1}var v1,Fv;function QC(){if(Fv)return v1;Fv=1;var e=k9();return v1=function(r){return typeof r!="string"?r:e(r)?r.slice(2):r},v1}var b1,Hv;function D2(){if(Hv)return b1;Hv=1;var e=k9(),t=QC();function r(d){var h=d;if(typeof h!="string")throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof h+", while padToEven.");return h.length%2&&(h="0"+h),h}function n(d){var h=d.toString(16);return"0x"+h}function s(d){var h=n(d);return new at(r(h.slice(2)),"hex")}function i(d){if(typeof d!="string")throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof d+"'.");return at.byteLength(d,"utf8")}function o(d,h,y){if(Array.isArray(d)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof d+"'");if(Array.isArray(h)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof h+"'");return h[!!y&&"some"||"every"](function(g){return d.indexOf(g)>=0})}function a(d){var h=new at(r(t(d).replace(/^0+|0+$/g,"")),"hex");return h.toString("utf8")}function f(d){var h="",y=0,g=d.length;for(d.substring(0,2)==="0x"&&(y=2);y<g;y+=2){var m=parseInt(d.substr(y,2),16);h+=String.fromCharCode(m)}return h}function c(d){var h=new at(d,"utf8");return"0x"+r(h.toString("hex")).replace(/^0+|0+$/g,"")}function l(d){for(var h="",y=0;y<d.length;y++){var g=d.charCodeAt(y),m=g.toString(16);h+=m.length<2?"0"+m:m}return"0x"+h}function u(d,h,y){if(!Array.isArray(d))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof d+"'");if(typeof h!="string")throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof h+"'.");for(var g=[],m=0;m<d.length;m++){var b=d[m][h];if(y&&!b)b="";else if(typeof b!="string")throw new Error("invalid abi");g.push(b)}return g}function p(d,h){return!(typeof d!="string"||!d.match(/^0x[0-9A-Fa-f]*$/)||h&&d.length!==2+2*h)}return b1={arrayContainsArray:o,intToBuffer:s,getBinarySize:i,isHexPrefixed:e,stripHexPrefix:t,padToEven:r,intToHex:n,fromAscii:l,fromUtf8:c,toAscii:f,toUtf8:a,getKeys:u,isHexString:p},b1}var Gv;function Ul(){if(Gv)return Ur;Gv=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.numberToBuffer=Ur.normalize=Ur.recoverPublicKey=Ur.concatSig=Ur.legacyToBuffer=Ur.isNullish=Ur.padWithZeroes=void 0;const e=bh(),t=D2();function r(c,l){if(c!==""&&!/^[a-f0-9]+$/iu.test(c))throw new Error(`Expected an unprefixed hex string. Received: ${c}`);if(l<0)throw new Error(`Expected a non-negative integer target length. Received: ${l}`);return String.prototype.padStart.call(c,l,"0")}Ur.padWithZeroes=r;function n(c){return c==null}Ur.isNullish=n;function s(c){return typeof c=="string"&&!(0,t.isHexString)(c)?at.from(c):(0,e.toBuffer)(c)}Ur.legacyToBuffer=s;function i(c,l,u){const p=(0,e.fromSigned)(l),d=(0,e.fromSigned)(u),h=(0,e.bufferToInt)(c),y=r((0,e.toUnsigned)(p).toString("hex"),64),g=r((0,e.toUnsigned)(d).toString("hex"),64),m=(0,t.stripHexPrefix)((0,t.intToHex)(h));return(0,e.addHexPrefix)(y.concat(g,m))}Ur.concatSig=i;function o(c,l){const u=(0,e.fromRpcSig)(l);return(0,e.ecrecover)(c,u.v,u.r,u.s)}Ur.recoverPublicKey=o;function a(c){if(c){if(typeof c=="number"){if(c<0)return"0x";const l=(0,e.toBuffer)(c);c=(0,e.bufferToHex)(l)}if(typeof c!="string"){let l="eth-sig-util.normalize() requires hex string or integer input.";throw l+=` received ${typeof c}: ${c}`,new Error(l)}return(0,e.addHexPrefix)(c.toLowerCase())}}Ur.normalize=a;function f(c){const l=c.toString(16),u=l.length%2?"0":"";return at.from(u+l,"hex")}return Ur.numberToBuffer=f,Ur}var zv;function eR(){if(zv)return Ni;zv=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.extractPublicKey=Ni.recoverPersonalSignature=Ni.personalSign=void 0;const e=bh(),t=Ul();function r({privateKey:o,data:a}){if((0,t.isNullish)(a))throw new Error("Missing data parameter");if((0,t.isNullish)(o))throw new Error("Missing privateKey parameter");const f=(0,t.legacyToBuffer)(a),c=(0,e.hashPersonalMessage)(f),l=(0,e.ecsign)(c,o);return(0,t.concatSig)((0,e.toBuffer)(l.v),l.r,l.s)}Ni.personalSign=r;function n({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");const f=i(o,a),c=(0,e.publicToAddress)(f);return(0,e.bufferToHex)(c)}Ni.recoverPersonalSignature=n;function s({data:o,signature:a}){if((0,t.isNullish)(o))throw new Error("Missing data parameter");if((0,t.isNullish)(a))throw new Error("Missing signature parameter");return`0x${i(o,a).toString("hex")}`}Ni.extractPublicKey=s;function i(o,a){const f=(0,e.hashPersonalMessage)((0,t.legacyToBuffer)(o));return(0,t.recoverPublicKey)(f,a)}return Ni}var _1={},Di={},ef={exports:{}};ef.exports;var Wv;function tR(){return Wv||(Wv=1,function(e){(function(t,r){function n(P,v){if(!P)throw new Error(v||"Assertion failed")}function s(P,v){P.super_=v;var S=function(){};S.prototype=v.prototype,P.prototype=new S,P.prototype.constructor=P}function i(P,v,S){if(i.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((v==="le"||v==="be")&&(S=v,v=10),this._init(P||0,v||10,S||"be"))}typeof t=="object"?t.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Wa.Buffer}catch{}i.isBN=function(v){return v instanceof i?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===i.wordSize&&Array.isArray(v.words)},i.max=function(v,S){return v.cmp(S)>0?v:S},i.min=function(v,S){return v.cmp(S)<0?v:S},i.prototype._init=function(v,S,T){if(typeof v=="number")return this._initNumber(v,S,T);if(typeof v=="object")return this._initArray(v,S,T);S==="hex"&&(S=16),n(S===(S|0)&&S>=2&&S<=36),v=v.toString().replace(/\s+/g,"");var N=0;v[0]==="-"&&(N++,this.negative=1),N<v.length&&(S===16?this._parseHex(v,N,T):(this._parseBase(v,S,N),T==="le"&&this._initArray(this.toArray(),S,T)))},i.prototype._initNumber=function(v,S,T){v<0&&(this.negative=1,v=-v),v<67108864?(this.words=[v&67108863],this.length=1):v<4503599627370496?(this.words=[v&67108863,v/67108864&67108863],this.length=2):(n(v<9007199254740992),this.words=[v&67108863,v/67108864&67108863,1],this.length=3),T==="le"&&this._initArray(this.toArray(),S,T)},i.prototype._initArray=function(v,S,T){if(n(typeof v.length=="number"),v.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(v.length/3),this.words=new Array(this.length);for(var N=0;N<this.length;N++)this.words[N]=0;var D,O,L=0;if(T==="be")for(N=v.length-1,D=0;N>=0;N-=3)O=v[N]|v[N-1]<<8|v[N-2]<<16,this.words[D]|=O<<L&67108863,this.words[D+1]=O>>>26-L&67108863,L+=24,L>=26&&(L-=26,D++);else if(T==="le")for(N=0,D=0;N<v.length;N+=3)O=v[N]|v[N+1]<<8|v[N+2]<<16,this.words[D]|=O<<L&67108863,this.words[D+1]=O>>>26-L&67108863,L+=24,L>=26&&(L-=26,D++);return this.strip()};function a(P,v){var S=P.charCodeAt(v);return S>=65&&S<=70?S-55:S>=97&&S<=102?S-87:S-48&15}function f(P,v,S){var T=a(P,S);return S-1>=v&&(T|=a(P,S-1)<<4),T}i.prototype._parseHex=function(v,S,T){this.length=Math.ceil((v.length-S)/6),this.words=new Array(this.length);for(var N=0;N<this.length;N++)this.words[N]=0;var D=0,O=0,L;if(T==="be")for(N=v.length-1;N>=S;N-=2)L=f(v,S,N)<<D,this.words[O]|=L&67108863,D>=18?(D-=18,O+=1,this.words[O]|=L>>>26):D+=8;else{var B=v.length-S;for(N=B%2===0?S+1:S;N<v.length;N+=2)L=f(v,S,N)<<D,this.words[O]|=L&67108863,D>=18?(D-=18,O+=1,this.words[O]|=L>>>26):D+=8}this.strip()};function c(P,v,S,T){for(var N=0,D=Math.min(P.length,S),O=v;O<D;O++){var L=P.charCodeAt(O)-48;N*=T,L>=49?N+=L-49+10:L>=17?N+=L-17+10:N+=L}return N}i.prototype._parseBase=function(v,S,T){this.words=[0],this.length=1;for(var N=0,D=1;D<=67108863;D*=S)N++;N--,D=D/S|0;for(var O=v.length-T,L=O%N,B=Math.min(O,O-L)+T,k=0,q=T;q<B;q+=N)k=c(v,q,q+N,S),this.imuln(D),this.words[0]+k<67108864?this.words[0]+=k:this._iaddn(k);if(L!==0){var W=1;for(k=c(v,q,v.length,S),q=0;q<L;q++)W*=S;this.imuln(W),this.words[0]+k<67108864?this.words[0]+=k:this._iaddn(k)}this.strip()},i.prototype.copy=function(v){v.words=new Array(this.length);for(var S=0;S<this.length;S++)v.words[S]=this.words[S];v.length=this.length,v.negative=this.negative,v.red=this.red},i.prototype.clone=function(){var v=new i(null);return this.copy(v),v},i.prototype._expand=function(v){for(;this.length<v;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(v,S){v=v||10,S=S|0||1;var T;if(v===16||v==="hex"){T="";for(var N=0,D=0,O=0;O<this.length;O++){var L=this.words[O],B=((L<<N|D)&16777215).toString(16);D=L>>>24-N&16777215,N+=2,N>=26&&(N-=26,O--),D!==0||O!==this.length-1?T=l[6-B.length]+B+T:T=B+T}for(D!==0&&(T=D.toString(16)+T);T.length%S!==0;)T="0"+T;return this.negative!==0&&(T="-"+T),T}if(v===(v|0)&&v>=2&&v<=36){var k=u[v],q=p[v];T="";var W=this.clone();for(W.negative=0;!W.isZero();){var re=W.modn(q).toString(v);W=W.idivn(q),W.isZero()?T=re+T:T=l[k-re.length]+re+T}for(this.isZero()&&(T="0"+T);T.length%S!==0;)T="0"+T;return this.negative!==0&&(T="-"+T),T}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(v,S){return n(typeof o<"u"),this.toArrayLike(o,v,S)},i.prototype.toArray=function(v,S){return this.toArrayLike(Array,v,S)},i.prototype.toArrayLike=function(v,S,T){var N=this.byteLength(),D=T||Math.max(1,N);n(N<=D,"byte array longer than desired length"),n(D>0,"Requested array length <= 0"),this.strip();var O=S==="le",L=new v(D),B,k,q=this.clone();if(O){for(k=0;!q.isZero();k++)B=q.andln(255),q.iushrn(8),L[k]=B;for(;k<D;k++)L[k]=0}else{for(k=0;k<D-N;k++)L[k]=0;for(k=0;!q.isZero();k++)B=q.andln(255),q.iushrn(8),L[D-k-1]=B}return L},Math.clz32?i.prototype._countBits=function(v){return 32-Math.clz32(v)}:i.prototype._countBits=function(v){var S=v,T=0;return S>=4096&&(T+=13,S>>>=13),S>=64&&(T+=7,S>>>=7),S>=8&&(T+=4,S>>>=4),S>=2&&(T+=2,S>>>=2),T+S},i.prototype._zeroBits=function(v){if(v===0)return 26;var S=v,T=0;return S&8191||(T+=13,S>>>=13),S&127||(T+=7,S>>>=7),S&15||(T+=4,S>>>=4),S&3||(T+=2,S>>>=2),S&1||T++,T},i.prototype.bitLength=function(){var v=this.words[this.length-1],S=this._countBits(v);return(this.length-1)*26+S};function d(P){for(var v=new Array(P.bitLength()),S=0;S<v.length;S++){var T=S/26|0,N=S%26;v[S]=(P.words[T]&1<<N)>>>N}return v}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,S=0;S<this.length;S++){var T=this._zeroBits(this.words[S]);if(v+=T,T!==26)break}return v},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(v){return this.negative!==0?this.abs().inotn(v).iaddn(1):this.clone()},i.prototype.fromTwos=function(v){return this.testn(v-1)?this.notn(v).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(v){for(;this.length<v.length;)this.words[this.length++]=0;for(var S=0;S<v.length;S++)this.words[S]=this.words[S]|v.words[S];return this.strip()},i.prototype.ior=function(v){return n((this.negative|v.negative)===0),this.iuor(v)},i.prototype.or=function(v){return this.length>v.length?this.clone().ior(v):v.clone().ior(this)},i.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},i.prototype.iuand=function(v){var S;this.length>v.length?S=v:S=this;for(var T=0;T<S.length;T++)this.words[T]=this.words[T]&v.words[T];return this.length=S.length,this.strip()},i.prototype.iand=function(v){return n((this.negative|v.negative)===0),this.iuand(v)},i.prototype.and=function(v){return this.length>v.length?this.clone().iand(v):v.clone().iand(this)},i.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},i.prototype.iuxor=function(v){var S,T;this.length>v.length?(S=this,T=v):(S=v,T=this);for(var N=0;N<T.length;N++)this.words[N]=S.words[N]^T.words[N];if(this!==S)for(;N<S.length;N++)this.words[N]=S.words[N];return this.length=S.length,this.strip()},i.prototype.ixor=function(v){return n((this.negative|v.negative)===0),this.iuxor(v)},i.prototype.xor=function(v){return this.length>v.length?this.clone().ixor(v):v.clone().ixor(this)},i.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},i.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var S=Math.ceil(v/26)|0,T=v%26;this._expand(S),T>0&&S--;for(var N=0;N<S;N++)this.words[N]=~this.words[N]&67108863;return T>0&&(this.words[N]=~this.words[N]&67108863>>26-T),this.strip()},i.prototype.notn=function(v){return this.clone().inotn(v)},i.prototype.setn=function(v,S){n(typeof v=="number"&&v>=0);var T=v/26|0,N=v%26;return this._expand(T+1),S?this.words[T]=this.words[T]|1<<N:this.words[T]=this.words[T]&~(1<<N),this.strip()},i.prototype.iadd=function(v){var S;if(this.negative!==0&&v.negative===0)return this.negative=0,S=this.isub(v),this.negative^=1,this._normSign();if(this.negative===0&&v.negative!==0)return v.negative=0,S=this.isub(v),v.negative=1,S._normSign();var T,N;this.length>v.length?(T=this,N=v):(T=v,N=this);for(var D=0,O=0;O<N.length;O++)S=(T.words[O]|0)+(N.words[O]|0)+D,this.words[O]=S&67108863,D=S>>>26;for(;D!==0&&O<T.length;O++)S=(T.words[O]|0)+D,this.words[O]=S&67108863,D=S>>>26;if(this.length=T.length,D!==0)this.words[this.length]=D,this.length++;else if(T!==this)for(;O<T.length;O++)this.words[O]=T.words[O];return this},i.prototype.add=function(v){var S;return v.negative!==0&&this.negative===0?(v.negative=0,S=this.sub(v),v.negative^=1,S):v.negative===0&&this.negative!==0?(this.negative=0,S=v.sub(this),this.negative=1,S):this.length>v.length?this.clone().iadd(v):v.clone().iadd(this)},i.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var S=this.iadd(v);return v.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var T=this.cmp(v);if(T===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,D;T>0?(N=this,D=v):(N=v,D=this);for(var O=0,L=0;L<D.length;L++)S=(N.words[L]|0)-(D.words[L]|0)+O,O=S>>26,this.words[L]=S&67108863;for(;O!==0&&L<N.length;L++)S=(N.words[L]|0)+O,O=S>>26,this.words[L]=S&67108863;if(O===0&&L<N.length&&N!==this)for(;L<N.length;L++)this.words[L]=N.words[L];return this.length=Math.max(this.length,L),N!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(v){return this.clone().isub(v)};function h(P,v,S){S.negative=v.negative^P.negative;var T=P.length+v.length|0;S.length=T,T=T-1|0;var N=P.words[0]|0,D=v.words[0]|0,O=N*D,L=O&67108863,B=O/67108864|0;S.words[0]=L;for(var k=1;k<T;k++){for(var q=B>>>26,W=B&67108863,re=Math.min(k,v.length-1),ue=Math.max(0,k-P.length+1);ue<=re;ue++){var H=k-ue|0;N=P.words[H]|0,D=v.words[ue]|0,O=N*D+W,q+=O/67108864|0,W=O&67108863}S.words[k]=W|0,B=q|0}return B!==0?S.words[k]=B|0:S.length--,S.strip()}var y=function(v,S,T){var N=v.words,D=S.words,O=T.words,L=0,B,k,q,W=N[0]|0,re=W&8191,ue=W>>>13,H=N[1]|0,ae=H&8191,V=H>>>13,U=N[2]|0,te=U&8191,ge=U>>>13,Pe=N[3]|0,Te=Pe&8191,z=Pe>>>13,$=N[4]|0,F=$&8191,Q=$>>>13,de=N[5]|0,oe=de&8191,ne=de>>>13,Fe=N[6]|0,je=Fe&8191,He=Fe>>>13,he=N[7]|0,ce=he&8191,pe=he>>>13,le=N[8]|0,fe=le&8191,ye=le>>>13,ee=N[9]|0,Z=ee&8191,$e=ee>>>13,Ve=D[0]|0,Qe=Ve&8191,dt=Ve>>>13,rt=D[1]|0,ve=rt&8191,G=rt>>>13,se=D[2]|0,me=se&8191,Se=se>>>13,Ae=D[3]|0,ke=Ae&8191,Ne=Ae>>>13,xe=D[4]|0,Re=xe&8191,Me=xe>>>13,et=D[5]|0,we=et&8191,Ce=et>>>13,Oe=D[6]|0,Ue=Oe&8191,qe=Oe>>>13,K=D[7]|0,Y=K&8191,J=K>>>13,x=D[8]|0,ie=x&8191,Ee=x>>>13,Ie=D[9]|0,De=Ie&8191,Ge=Ie>>>13;T.negative=v.negative^S.negative,T.length=19,B=Math.imul(re,Qe),k=Math.imul(re,dt),k=k+Math.imul(ue,Qe)|0,q=Math.imul(ue,dt);var ut=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(ut>>>26)|0,ut&=67108863,B=Math.imul(ae,Qe),k=Math.imul(ae,dt),k=k+Math.imul(V,Qe)|0,q=Math.imul(V,dt),B=B+Math.imul(re,ve)|0,k=k+Math.imul(re,G)|0,k=k+Math.imul(ue,ve)|0,q=q+Math.imul(ue,G)|0;var nt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(nt>>>26)|0,nt&=67108863,B=Math.imul(te,Qe),k=Math.imul(te,dt),k=k+Math.imul(ge,Qe)|0,q=Math.imul(ge,dt),B=B+Math.imul(ae,ve)|0,k=k+Math.imul(ae,G)|0,k=k+Math.imul(V,ve)|0,q=q+Math.imul(V,G)|0,B=B+Math.imul(re,me)|0,k=k+Math.imul(re,Se)|0,k=k+Math.imul(ue,me)|0,q=q+Math.imul(ue,Se)|0;var Ct=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,B=Math.imul(Te,Qe),k=Math.imul(Te,dt),k=k+Math.imul(z,Qe)|0,q=Math.imul(z,dt),B=B+Math.imul(te,ve)|0,k=k+Math.imul(te,G)|0,k=k+Math.imul(ge,ve)|0,q=q+Math.imul(ge,G)|0,B=B+Math.imul(ae,me)|0,k=k+Math.imul(ae,Se)|0,k=k+Math.imul(V,me)|0,q=q+Math.imul(V,Se)|0,B=B+Math.imul(re,ke)|0,k=k+Math.imul(re,Ne)|0,k=k+Math.imul(ue,ke)|0,q=q+Math.imul(ue,Ne)|0;var st=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(st>>>26)|0,st&=67108863,B=Math.imul(F,Qe),k=Math.imul(F,dt),k=k+Math.imul(Q,Qe)|0,q=Math.imul(Q,dt),B=B+Math.imul(Te,ve)|0,k=k+Math.imul(Te,G)|0,k=k+Math.imul(z,ve)|0,q=q+Math.imul(z,G)|0,B=B+Math.imul(te,me)|0,k=k+Math.imul(te,Se)|0,k=k+Math.imul(ge,me)|0,q=q+Math.imul(ge,Se)|0,B=B+Math.imul(ae,ke)|0,k=k+Math.imul(ae,Ne)|0,k=k+Math.imul(V,ke)|0,q=q+Math.imul(V,Ne)|0,B=B+Math.imul(re,Re)|0,k=k+Math.imul(re,Me)|0,k=k+Math.imul(ue,Re)|0,q=q+Math.imul(ue,Me)|0;var mt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(mt>>>26)|0,mt&=67108863,B=Math.imul(oe,Qe),k=Math.imul(oe,dt),k=k+Math.imul(ne,Qe)|0,q=Math.imul(ne,dt),B=B+Math.imul(F,ve)|0,k=k+Math.imul(F,G)|0,k=k+Math.imul(Q,ve)|0,q=q+Math.imul(Q,G)|0,B=B+Math.imul(Te,me)|0,k=k+Math.imul(Te,Se)|0,k=k+Math.imul(z,me)|0,q=q+Math.imul(z,Se)|0,B=B+Math.imul(te,ke)|0,k=k+Math.imul(te,Ne)|0,k=k+Math.imul(ge,ke)|0,q=q+Math.imul(ge,Ne)|0,B=B+Math.imul(ae,Re)|0,k=k+Math.imul(ae,Me)|0,k=k+Math.imul(V,Re)|0,q=q+Math.imul(V,Me)|0,B=B+Math.imul(re,we)|0,k=k+Math.imul(re,Ce)|0,k=k+Math.imul(ue,we)|0,q=q+Math.imul(ue,Ce)|0;var vt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(vt>>>26)|0,vt&=67108863,B=Math.imul(je,Qe),k=Math.imul(je,dt),k=k+Math.imul(He,Qe)|0,q=Math.imul(He,dt),B=B+Math.imul(oe,ve)|0,k=k+Math.imul(oe,G)|0,k=k+Math.imul(ne,ve)|0,q=q+Math.imul(ne,G)|0,B=B+Math.imul(F,me)|0,k=k+Math.imul(F,Se)|0,k=k+Math.imul(Q,me)|0,q=q+Math.imul(Q,Se)|0,B=B+Math.imul(Te,ke)|0,k=k+Math.imul(Te,Ne)|0,k=k+Math.imul(z,ke)|0,q=q+Math.imul(z,Ne)|0,B=B+Math.imul(te,Re)|0,k=k+Math.imul(te,Me)|0,k=k+Math.imul(ge,Re)|0,q=q+Math.imul(ge,Me)|0,B=B+Math.imul(ae,we)|0,k=k+Math.imul(ae,Ce)|0,k=k+Math.imul(V,we)|0,q=q+Math.imul(V,Ce)|0,B=B+Math.imul(re,Ue)|0,k=k+Math.imul(re,qe)|0,k=k+Math.imul(ue,Ue)|0,q=q+Math.imul(ue,qe)|0;var At=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(At>>>26)|0,At&=67108863,B=Math.imul(ce,Qe),k=Math.imul(ce,dt),k=k+Math.imul(pe,Qe)|0,q=Math.imul(pe,dt),B=B+Math.imul(je,ve)|0,k=k+Math.imul(je,G)|0,k=k+Math.imul(He,ve)|0,q=q+Math.imul(He,G)|0,B=B+Math.imul(oe,me)|0,k=k+Math.imul(oe,Se)|0,k=k+Math.imul(ne,me)|0,q=q+Math.imul(ne,Se)|0,B=B+Math.imul(F,ke)|0,k=k+Math.imul(F,Ne)|0,k=k+Math.imul(Q,ke)|0,q=q+Math.imul(Q,Ne)|0,B=B+Math.imul(Te,Re)|0,k=k+Math.imul(Te,Me)|0,k=k+Math.imul(z,Re)|0,q=q+Math.imul(z,Me)|0,B=B+Math.imul(te,we)|0,k=k+Math.imul(te,Ce)|0,k=k+Math.imul(ge,we)|0,q=q+Math.imul(ge,Ce)|0,B=B+Math.imul(ae,Ue)|0,k=k+Math.imul(ae,qe)|0,k=k+Math.imul(V,Ue)|0,q=q+Math.imul(V,qe)|0,B=B+Math.imul(re,Y)|0,k=k+Math.imul(re,J)|0,k=k+Math.imul(ue,Y)|0,q=q+Math.imul(ue,J)|0;var Et=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(Et>>>26)|0,Et&=67108863,B=Math.imul(fe,Qe),k=Math.imul(fe,dt),k=k+Math.imul(ye,Qe)|0,q=Math.imul(ye,dt),B=B+Math.imul(ce,ve)|0,k=k+Math.imul(ce,G)|0,k=k+Math.imul(pe,ve)|0,q=q+Math.imul(pe,G)|0,B=B+Math.imul(je,me)|0,k=k+Math.imul(je,Se)|0,k=k+Math.imul(He,me)|0,q=q+Math.imul(He,Se)|0,B=B+Math.imul(oe,ke)|0,k=k+Math.imul(oe,Ne)|0,k=k+Math.imul(ne,ke)|0,q=q+Math.imul(ne,Ne)|0,B=B+Math.imul(F,Re)|0,k=k+Math.imul(F,Me)|0,k=k+Math.imul(Q,Re)|0,q=q+Math.imul(Q,Me)|0,B=B+Math.imul(Te,we)|0,k=k+Math.imul(Te,Ce)|0,k=k+Math.imul(z,we)|0,q=q+Math.imul(z,Ce)|0,B=B+Math.imul(te,Ue)|0,k=k+Math.imul(te,qe)|0,k=k+Math.imul(ge,Ue)|0,q=q+Math.imul(ge,qe)|0,B=B+Math.imul(ae,Y)|0,k=k+Math.imul(ae,J)|0,k=k+Math.imul(V,Y)|0,q=q+Math.imul(V,J)|0,B=B+Math.imul(re,ie)|0,k=k+Math.imul(re,Ee)|0,k=k+Math.imul(ue,ie)|0,q=q+Math.imul(ue,Ee)|0;var bt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(bt>>>26)|0,bt&=67108863,B=Math.imul(Z,Qe),k=Math.imul(Z,dt),k=k+Math.imul($e,Qe)|0,q=Math.imul($e,dt),B=B+Math.imul(fe,ve)|0,k=k+Math.imul(fe,G)|0,k=k+Math.imul(ye,ve)|0,q=q+Math.imul(ye,G)|0,B=B+Math.imul(ce,me)|0,k=k+Math.imul(ce,Se)|0,k=k+Math.imul(pe,me)|0,q=q+Math.imul(pe,Se)|0,B=B+Math.imul(je,ke)|0,k=k+Math.imul(je,Ne)|0,k=k+Math.imul(He,ke)|0,q=q+Math.imul(He,Ne)|0,B=B+Math.imul(oe,Re)|0,k=k+Math.imul(oe,Me)|0,k=k+Math.imul(ne,Re)|0,q=q+Math.imul(ne,Me)|0,B=B+Math.imul(F,we)|0,k=k+Math.imul(F,Ce)|0,k=k+Math.imul(Q,we)|0,q=q+Math.imul(Q,Ce)|0,B=B+Math.imul(Te,Ue)|0,k=k+Math.imul(Te,qe)|0,k=k+Math.imul(z,Ue)|0,q=q+Math.imul(z,qe)|0,B=B+Math.imul(te,Y)|0,k=k+Math.imul(te,J)|0,k=k+Math.imul(ge,Y)|0,q=q+Math.imul(ge,J)|0,B=B+Math.imul(ae,ie)|0,k=k+Math.imul(ae,Ee)|0,k=k+Math.imul(V,ie)|0,q=q+Math.imul(V,Ee)|0,B=B+Math.imul(re,De)|0,k=k+Math.imul(re,Ge)|0,k=k+Math.imul(ue,De)|0,q=q+Math.imul(ue,Ge)|0;var wt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(wt>>>26)|0,wt&=67108863,B=Math.imul(Z,ve),k=Math.imul(Z,G),k=k+Math.imul($e,ve)|0,q=Math.imul($e,G),B=B+Math.imul(fe,me)|0,k=k+Math.imul(fe,Se)|0,k=k+Math.imul(ye,me)|0,q=q+Math.imul(ye,Se)|0,B=B+Math.imul(ce,ke)|0,k=k+Math.imul(ce,Ne)|0,k=k+Math.imul(pe,ke)|0,q=q+Math.imul(pe,Ne)|0,B=B+Math.imul(je,Re)|0,k=k+Math.imul(je,Me)|0,k=k+Math.imul(He,Re)|0,q=q+Math.imul(He,Me)|0,B=B+Math.imul(oe,we)|0,k=k+Math.imul(oe,Ce)|0,k=k+Math.imul(ne,we)|0,q=q+Math.imul(ne,Ce)|0,B=B+Math.imul(F,Ue)|0,k=k+Math.imul(F,qe)|0,k=k+Math.imul(Q,Ue)|0,q=q+Math.imul(Q,qe)|0,B=B+Math.imul(Te,Y)|0,k=k+Math.imul(Te,J)|0,k=k+Math.imul(z,Y)|0,q=q+Math.imul(z,J)|0,B=B+Math.imul(te,ie)|0,k=k+Math.imul(te,Ee)|0,k=k+Math.imul(ge,ie)|0,q=q+Math.imul(ge,Ee)|0,B=B+Math.imul(ae,De)|0,k=k+Math.imul(ae,Ge)|0,k=k+Math.imul(V,De)|0,q=q+Math.imul(V,Ge)|0;var _t=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(_t>>>26)|0,_t&=67108863,B=Math.imul(Z,me),k=Math.imul(Z,Se),k=k+Math.imul($e,me)|0,q=Math.imul($e,Se),B=B+Math.imul(fe,ke)|0,k=k+Math.imul(fe,Ne)|0,k=k+Math.imul(ye,ke)|0,q=q+Math.imul(ye,Ne)|0,B=B+Math.imul(ce,Re)|0,k=k+Math.imul(ce,Me)|0,k=k+Math.imul(pe,Re)|0,q=q+Math.imul(pe,Me)|0,B=B+Math.imul(je,we)|0,k=k+Math.imul(je,Ce)|0,k=k+Math.imul(He,we)|0,q=q+Math.imul(He,Ce)|0,B=B+Math.imul(oe,Ue)|0,k=k+Math.imul(oe,qe)|0,k=k+Math.imul(ne,Ue)|0,q=q+Math.imul(ne,qe)|0,B=B+Math.imul(F,Y)|0,k=k+Math.imul(F,J)|0,k=k+Math.imul(Q,Y)|0,q=q+Math.imul(Q,J)|0,B=B+Math.imul(Te,ie)|0,k=k+Math.imul(Te,Ee)|0,k=k+Math.imul(z,ie)|0,q=q+Math.imul(z,Ee)|0,B=B+Math.imul(te,De)|0,k=k+Math.imul(te,Ge)|0,k=k+Math.imul(ge,De)|0,q=q+Math.imul(ge,Ge)|0;var ct=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(ct>>>26)|0,ct&=67108863,B=Math.imul(Z,ke),k=Math.imul(Z,Ne),k=k+Math.imul($e,ke)|0,q=Math.imul($e,Ne),B=B+Math.imul(fe,Re)|0,k=k+Math.imul(fe,Me)|0,k=k+Math.imul(ye,Re)|0,q=q+Math.imul(ye,Me)|0,B=B+Math.imul(ce,we)|0,k=k+Math.imul(ce,Ce)|0,k=k+Math.imul(pe,we)|0,q=q+Math.imul(pe,Ce)|0,B=B+Math.imul(je,Ue)|0,k=k+Math.imul(je,qe)|0,k=k+Math.imul(He,Ue)|0,q=q+Math.imul(He,qe)|0,B=B+Math.imul(oe,Y)|0,k=k+Math.imul(oe,J)|0,k=k+Math.imul(ne,Y)|0,q=q+Math.imul(ne,J)|0,B=B+Math.imul(F,ie)|0,k=k+Math.imul(F,Ee)|0,k=k+Math.imul(Q,ie)|0,q=q+Math.imul(Q,Ee)|0,B=B+Math.imul(Te,De)|0,k=k+Math.imul(Te,Ge)|0,k=k+Math.imul(z,De)|0,q=q+Math.imul(z,Ge)|0;var ft=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(ft>>>26)|0,ft&=67108863,B=Math.imul(Z,Re),k=Math.imul(Z,Me),k=k+Math.imul($e,Re)|0,q=Math.imul($e,Me),B=B+Math.imul(fe,we)|0,k=k+Math.imul(fe,Ce)|0,k=k+Math.imul(ye,we)|0,q=q+Math.imul(ye,Ce)|0,B=B+Math.imul(ce,Ue)|0,k=k+Math.imul(ce,qe)|0,k=k+Math.imul(pe,Ue)|0,q=q+Math.imul(pe,qe)|0,B=B+Math.imul(je,Y)|0,k=k+Math.imul(je,J)|0,k=k+Math.imul(He,Y)|0,q=q+Math.imul(He,J)|0,B=B+Math.imul(oe,ie)|0,k=k+Math.imul(oe,Ee)|0,k=k+Math.imul(ne,ie)|0,q=q+Math.imul(ne,Ee)|0,B=B+Math.imul(F,De)|0,k=k+Math.imul(F,Ge)|0,k=k+Math.imul(Q,De)|0,q=q+Math.imul(Q,Ge)|0;var it=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(it>>>26)|0,it&=67108863,B=Math.imul(Z,we),k=Math.imul(Z,Ce),k=k+Math.imul($e,we)|0,q=Math.imul($e,Ce),B=B+Math.imul(fe,Ue)|0,k=k+Math.imul(fe,qe)|0,k=k+Math.imul(ye,Ue)|0,q=q+Math.imul(ye,qe)|0,B=B+Math.imul(ce,Y)|0,k=k+Math.imul(ce,J)|0,k=k+Math.imul(pe,Y)|0,q=q+Math.imul(pe,J)|0,B=B+Math.imul(je,ie)|0,k=k+Math.imul(je,Ee)|0,k=k+Math.imul(He,ie)|0,q=q+Math.imul(He,Ee)|0,B=B+Math.imul(oe,De)|0,k=k+Math.imul(oe,Ge)|0,k=k+Math.imul(ne,De)|0,q=q+Math.imul(ne,Ge)|0;var lt=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(lt>>>26)|0,lt&=67108863,B=Math.imul(Z,Ue),k=Math.imul(Z,qe),k=k+Math.imul($e,Ue)|0,q=Math.imul($e,qe),B=B+Math.imul(fe,Y)|0,k=k+Math.imul(fe,J)|0,k=k+Math.imul(ye,Y)|0,q=q+Math.imul(ye,J)|0,B=B+Math.imul(ce,ie)|0,k=k+Math.imul(ce,Ee)|0,k=k+Math.imul(pe,ie)|0,q=q+Math.imul(pe,Ee)|0,B=B+Math.imul(je,De)|0,k=k+Math.imul(je,Ge)|0,k=k+Math.imul(He,De)|0,q=q+Math.imul(He,Ge)|0;var ht=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(ht>>>26)|0,ht&=67108863,B=Math.imul(Z,Y),k=Math.imul(Z,J),k=k+Math.imul($e,Y)|0,q=Math.imul($e,J),B=B+Math.imul(fe,ie)|0,k=k+Math.imul(fe,Ee)|0,k=k+Math.imul(ye,ie)|0,q=q+Math.imul(ye,Ee)|0,B=B+Math.imul(ce,De)|0,k=k+Math.imul(ce,Ge)|0,k=k+Math.imul(pe,De)|0,q=q+Math.imul(pe,Ge)|0;var ot=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(ot>>>26)|0,ot&=67108863,B=Math.imul(Z,ie),k=Math.imul(Z,Ee),k=k+Math.imul($e,ie)|0,q=Math.imul($e,Ee),B=B+Math.imul(fe,De)|0,k=k+Math.imul(fe,Ge)|0,k=k+Math.imul(ye,De)|0,q=q+Math.imul(ye,Ge)|0;var Be=(L+B|0)+((k&8191)<<13)|0;L=(q+(k>>>13)|0)+(Be>>>26)|0,Be&=67108863,B=Math.imul(Z,De),k=Math.imul(Z,Ge),k=k+Math.imul($e,De)|0,q=Math.imul($e,Ge);var Le=(L+B|0)+((k&8191)<<13)|0;return L=(q+(k>>>13)|0)+(Le>>>26)|0,Le&=67108863,O[0]=ut,O[1]=nt,O[2]=Ct,O[3]=st,O[4]=mt,O[5]=vt,O[6]=At,O[7]=Et,O[8]=bt,O[9]=wt,O[10]=_t,O[11]=ct,O[12]=ft,O[13]=it,O[14]=lt,O[15]=ht,O[16]=ot,O[17]=Be,O[18]=Le,L!==0&&(O[19]=L,T.length++),T};Math.imul||(y=h);function g(P,v,S){S.negative=v.negative^P.negative,S.length=P.length+v.length;for(var T=0,N=0,D=0;D<S.length-1;D++){var O=N;N=0;for(var L=T&67108863,B=Math.min(D,v.length-1),k=Math.max(0,D-P.length+1);k<=B;k++){var q=D-k,W=P.words[q]|0,re=v.words[k]|0,ue=W*re,H=ue&67108863;O=O+(ue/67108864|0)|0,H=H+L|0,L=H&67108863,O=O+(H>>>26)|0,N+=O>>>26,O&=67108863}S.words[D]=L,T=O,O=N}return T!==0?S.words[D]=T:S.length--,S.strip()}function m(P,v,S){var T=new b;return T.mulp(P,v,S)}i.prototype.mulTo=function(v,S){var T,N=this.length+v.length;return this.length===10&&v.length===10?T=y(this,v,S):N<63?T=h(this,v,S):N<1024?T=g(this,v,S):T=m(this,v,S),T};function b(P,v){this.x=P,this.y=v}b.prototype.makeRBT=function(v){for(var S=new Array(v),T=i.prototype._countBits(v)-1,N=0;N<v;N++)S[N]=this.revBin(N,T,v);return S},b.prototype.revBin=function(v,S,T){if(v===0||v===T-1)return v;for(var N=0,D=0;D<S;D++)N|=(v&1)<<S-D-1,v>>=1;return N},b.prototype.permute=function(v,S,T,N,D,O){for(var L=0;L<O;L++)N[L]=S[v[L]],D[L]=T[v[L]]},b.prototype.transform=function(v,S,T,N,D,O){this.permute(O,v,S,T,N,D);for(var L=1;L<D;L<<=1)for(var B=L<<1,k=Math.cos(2*Math.PI/B),q=Math.sin(2*Math.PI/B),W=0;W<D;W+=B)for(var re=k,ue=q,H=0;H<L;H++){var ae=T[W+H],V=N[W+H],U=T[W+H+L],te=N[W+H+L],ge=re*U-ue*te;te=re*te+ue*U,U=ge,T[W+H]=ae+U,N[W+H]=V+te,T[W+H+L]=ae-U,N[W+H+L]=V-te,H!==B&&(ge=k*re-q*ue,ue=k*ue+q*re,re=ge)}},b.prototype.guessLen13b=function(v,S){var T=Math.max(S,v)|1,N=T&1,D=0;for(T=T/2|0;T;T=T>>>1)D++;return 1<<D+1+N},b.prototype.conjugate=function(v,S,T){if(!(T<=1))for(var N=0;N<T/2;N++){var D=v[N];v[N]=v[T-N-1],v[T-N-1]=D,D=S[N],S[N]=-S[T-N-1],S[T-N-1]=-D}},b.prototype.normalize13b=function(v,S){for(var T=0,N=0;N<S/2;N++){var D=Math.round(v[2*N+1]/S)*8192+Math.round(v[2*N]/S)+T;v[N]=D&67108863,D<67108864?T=0:T=D/67108864|0}return v},b.prototype.convert13b=function(v,S,T,N){for(var D=0,O=0;O<S;O++)D=D+(v[O]|0),T[2*O]=D&8191,D=D>>>13,T[2*O+1]=D&8191,D=D>>>13;for(O=2*S;O<N;++O)T[O]=0;n(D===0),n((D&-8192)===0)},b.prototype.stub=function(v){for(var S=new Array(v),T=0;T<v;T++)S[T]=0;return S},b.prototype.mulp=function(v,S,T){var N=2*this.guessLen13b(v.length,S.length),D=this.makeRBT(N),O=this.stub(N),L=new Array(N),B=new Array(N),k=new Array(N),q=new Array(N),W=new Array(N),re=new Array(N),ue=T.words;ue.length=N,this.convert13b(v.words,v.length,L,N),this.convert13b(S.words,S.length,q,N),this.transform(L,O,B,k,N,D),this.transform(q,O,W,re,N,D);for(var H=0;H<N;H++){var ae=B[H]*W[H]-k[H]*re[H];k[H]=B[H]*re[H]+k[H]*W[H],B[H]=ae}return this.conjugate(B,k,N),this.transform(B,k,ue,O,N,D),this.conjugate(ue,O,N),this.normalize13b(ue,N),T.negative=v.negative^S.negative,T.length=v.length+S.length,T.strip()},i.prototype.mul=function(v){var S=new i(null);return S.words=new Array(this.length+v.length),this.mulTo(v,S)},i.prototype.mulf=function(v){var S=new i(null);return S.words=new Array(this.length+v.length),m(this,v,S)},i.prototype.imul=function(v){return this.clone().mulTo(v,this)},i.prototype.imuln=function(v){n(typeof v=="number"),n(v<67108864);for(var S=0,T=0;T<this.length;T++){var N=(this.words[T]|0)*v,D=(N&67108863)+(S&67108863);S>>=26,S+=N/67108864|0,S+=D>>>26,this.words[T]=D&67108863}return S!==0&&(this.words[T]=S,this.length++),this.length=v===0?1:this.length,this},i.prototype.muln=function(v){return this.clone().imuln(v)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(v){var S=d(v);if(S.length===0)return new i(1);for(var T=this,N=0;N<S.length&&S[N]===0;N++,T=T.sqr());if(++N<S.length)for(var D=T.sqr();N<S.length;N++,D=D.sqr())S[N]!==0&&(T=T.mul(D));return T},i.prototype.iushln=function(v){n(typeof v=="number"&&v>=0);var S=v%26,T=(v-S)/26,N=67108863>>>26-S<<26-S,D;if(S!==0){var O=0;for(D=0;D<this.length;D++){var L=this.words[D]&N,B=(this.words[D]|0)-L<<S;this.words[D]=B|O,O=L>>>26-S}O&&(this.words[D]=O,this.length++)}if(T!==0){for(D=this.length-1;D>=0;D--)this.words[D+T]=this.words[D];for(D=0;D<T;D++)this.words[D]=0;this.length+=T}return this.strip()},i.prototype.ishln=function(v){return n(this.negative===0),this.iushln(v)},i.prototype.iushrn=function(v,S,T){n(typeof v=="number"&&v>=0);var N;S?N=(S-S%26)/26:N=0;var D=v%26,O=Math.min((v-D)/26,this.length),L=67108863^67108863>>>D<<D,B=T;if(N-=O,N=Math.max(0,N),B){for(var k=0;k<O;k++)B.words[k]=this.words[k];B.length=O}if(O!==0)if(this.length>O)for(this.length-=O,k=0;k<this.length;k++)this.words[k]=this.words[k+O];else this.words[0]=0,this.length=1;var q=0;for(k=this.length-1;k>=0&&(q!==0||k>=N);k--){var W=this.words[k]|0;this.words[k]=q<<26-D|W>>>D,q=W&L}return B&&q!==0&&(B.words[B.length++]=q),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(v,S,T){return n(this.negative===0),this.iushrn(v,S,T)},i.prototype.shln=function(v){return this.clone().ishln(v)},i.prototype.ushln=function(v){return this.clone().iushln(v)},i.prototype.shrn=function(v){return this.clone().ishrn(v)},i.prototype.ushrn=function(v){return this.clone().iushrn(v)},i.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var S=v%26,T=(v-S)/26,N=1<<S;if(this.length<=T)return!1;var D=this.words[T];return!!(D&N)},i.prototype.imaskn=function(v){n(typeof v=="number"&&v>=0);var S=v%26,T=(v-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=T)return this;if(S!==0&&T++,this.length=Math.min(T,this.length),S!==0){var N=67108863^67108863>>>S<<S;this.words[this.length-1]&=N}return this.strip()},i.prototype.maskn=function(v){return this.clone().imaskn(v)},i.prototype.iaddn=function(v){return n(typeof v=="number"),n(v<67108864),v<0?this.isubn(-v):this.negative!==0?this.length===1&&(this.words[0]|0)<v?(this.words[0]=v-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(v),this.negative=1,this):this._iaddn(v)},i.prototype._iaddn=function(v){this.words[0]+=v;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},i.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this.strip()},i.prototype.addn=function(v){return this.clone().iaddn(v)},i.prototype.subn=function(v){return this.clone().isubn(v)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(v,S,T){var N=v.length+T,D;this._expand(N);var O,L=0;for(D=0;D<v.length;D++){O=(this.words[D+T]|0)+L;var B=(v.words[D]|0)*S;O-=B&67108863,L=(O>>26)-(B/67108864|0),this.words[D+T]=O&67108863}for(;D<this.length-T;D++)O=(this.words[D+T]|0)+L,L=O>>26,this.words[D+T]=O&67108863;if(L===0)return this.strip();for(n(L===-1),L=0,D=0;D<this.length;D++)O=-(this.words[D]|0)+L,L=O>>26,this.words[D]=O&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(v,S){var T=this.length-v.length,N=this.clone(),D=v,O=D.words[D.length-1]|0,L=this._countBits(O);T=26-L,T!==0&&(D=D.ushln(T),N.iushln(T),O=D.words[D.length-1]|0);var B=N.length-D.length,k;if(S!=="mod"){k=new i(null),k.length=B+1,k.words=new Array(k.length);for(var q=0;q<k.length;q++)k.words[q]=0}var W=N.clone()._ishlnsubmul(D,1,B);W.negative===0&&(N=W,k&&(k.words[B]=1));for(var re=B-1;re>=0;re--){var ue=(N.words[D.length+re]|0)*67108864+(N.words[D.length+re-1]|0);for(ue=Math.min(ue/O|0,67108863),N._ishlnsubmul(D,ue,re);N.negative!==0;)ue--,N.negative=0,N._ishlnsubmul(D,1,re),N.isZero()||(N.negative^=1);k&&(k.words[re]=ue)}return k&&k.strip(),N.strip(),S!=="div"&&T!==0&&N.iushrn(T),{div:k||null,mod:N}},i.prototype.divmod=function(v,S,T){if(n(!v.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var N,D,O;return this.negative!==0&&v.negative===0?(O=this.neg().divmod(v,S),S!=="mod"&&(N=O.div.neg()),S!=="div"&&(D=O.mod.neg(),T&&D.negative!==0&&D.iadd(v)),{div:N,mod:D}):this.negative===0&&v.negative!==0?(O=this.divmod(v.neg(),S),S!=="mod"&&(N=O.div.neg()),{div:N,mod:O.mod}):this.negative&v.negative?(O=this.neg().divmod(v.neg(),S),S!=="div"&&(D=O.mod.neg(),T&&D.negative!==0&&D.isub(v)),{div:O.div,mod:D}):v.length>this.length||this.cmp(v)<0?{div:new i(0),mod:this}:v.length===1?S==="div"?{div:this.divn(v.words[0]),mod:null}:S==="mod"?{div:null,mod:new i(this.modn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new i(this.modn(v.words[0]))}:this._wordDiv(v,S)},i.prototype.div=function(v){return this.divmod(v,"div",!1).div},i.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},i.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},i.prototype.divRound=function(v){var S=this.divmod(v);if(S.mod.isZero())return S.div;var T=S.div.negative!==0?S.mod.isub(v):S.mod,N=v.ushrn(1),D=v.andln(1),O=T.cmp(N);return O<0||D===1&&O===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},i.prototype.modn=function(v){n(v<=67108863);for(var S=(1<<26)%v,T=0,N=this.length-1;N>=0;N--)T=(S*T+(this.words[N]|0))%v;return T},i.prototype.idivn=function(v){n(v<=67108863);for(var S=0,T=this.length-1;T>=0;T--){var N=(this.words[T]|0)+S*67108864;this.words[T]=N/v|0,S=N%v}return this.strip()},i.prototype.divn=function(v){return this.clone().idivn(v)},i.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var S=this,T=v.clone();S.negative!==0?S=S.umod(v):S=S.clone();for(var N=new i(1),D=new i(0),O=new i(0),L=new i(1),B=0;S.isEven()&&T.isEven();)S.iushrn(1),T.iushrn(1),++B;for(var k=T.clone(),q=S.clone();!S.isZero();){for(var W=0,re=1;!(S.words[0]&re)&&W<26;++W,re<<=1);if(W>0)for(S.iushrn(W);W-- >0;)(N.isOdd()||D.isOdd())&&(N.iadd(k),D.isub(q)),N.iushrn(1),D.iushrn(1);for(var ue=0,H=1;!(T.words[0]&H)&&ue<26;++ue,H<<=1);if(ue>0)for(T.iushrn(ue);ue-- >0;)(O.isOdd()||L.isOdd())&&(O.iadd(k),L.isub(q)),O.iushrn(1),L.iushrn(1);S.cmp(T)>=0?(S.isub(T),N.isub(O),D.isub(L)):(T.isub(S),O.isub(N),L.isub(D))}return{a:O,b:L,gcd:T.iushln(B)}},i.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var S=this,T=v.clone();S.negative!==0?S=S.umod(v):S=S.clone();for(var N=new i(1),D=new i(0),O=T.clone();S.cmpn(1)>0&&T.cmpn(1)>0;){for(var L=0,B=1;!(S.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(S.iushrn(L);L-- >0;)N.isOdd()&&N.iadd(O),N.iushrn(1);for(var k=0,q=1;!(T.words[0]&q)&&k<26;++k,q<<=1);if(k>0)for(T.iushrn(k);k-- >0;)D.isOdd()&&D.iadd(O),D.iushrn(1);S.cmp(T)>=0?(S.isub(T),N.isub(D)):(T.isub(S),D.isub(N))}var W;return S.cmpn(1)===0?W=N:W=D,W.cmpn(0)<0&&W.iadd(v),W},i.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var S=this.clone(),T=v.clone();S.negative=0,T.negative=0;for(var N=0;S.isEven()&&T.isEven();N++)S.iushrn(1),T.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;T.isEven();)T.iushrn(1);var D=S.cmp(T);if(D<0){var O=S;S=T,T=O}else if(D===0||T.cmpn(1)===0)break;S.isub(T)}while(!0);return T.iushln(N)},i.prototype.invm=function(v){return this.egcd(v).a.umod(v)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(v){return this.words[0]&v},i.prototype.bincn=function(v){n(typeof v=="number");var S=v%26,T=(v-S)/26,N=1<<S;if(this.length<=T)return this._expand(T+1),this.words[T]|=N,this;for(var D=N,O=T;D!==0&&O<this.length;O++){var L=this.words[O]|0;L+=D,D=L>>>26,L&=67108863,this.words[O]=L}return D!==0&&(this.words[O]=D,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(v){var S=v<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this.strip();var T;if(this.length>1)T=1;else{S&&(v=-v),n(v<=67108863,"Number is too big");var N=this.words[0]|0;T=N===v?0:N<v?-1:1}return this.negative!==0?-T|0:T},i.prototype.cmp=function(v){if(this.negative!==0&&v.negative===0)return-1;if(this.negative===0&&v.negative!==0)return 1;var S=this.ucmp(v);return this.negative!==0?-S|0:S},i.prototype.ucmp=function(v){if(this.length>v.length)return 1;if(this.length<v.length)return-1;for(var S=0,T=this.length-1;T>=0;T--){var N=this.words[T]|0,D=v.words[T]|0;if(N!==D){N<D?S=-1:N>D&&(S=1);break}}return S},i.prototype.gtn=function(v){return this.cmpn(v)===1},i.prototype.gt=function(v){return this.cmp(v)===1},i.prototype.gten=function(v){return this.cmpn(v)>=0},i.prototype.gte=function(v){return this.cmp(v)>=0},i.prototype.ltn=function(v){return this.cmpn(v)===-1},i.prototype.lt=function(v){return this.cmp(v)===-1},i.prototype.lten=function(v){return this.cmpn(v)<=0},i.prototype.lte=function(v){return this.cmp(v)<=0},i.prototype.eqn=function(v){return this.cmpn(v)===0},i.prototype.eq=function(v){return this.cmp(v)===0},i.red=function(v){return new A(v)},i.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(v){return this.red=v,this},i.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},i.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},i.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},i.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},i.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},i.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},i.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},i.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var w={k256:null,p224:null,p192:null,p25519:null};function E(P,v){this.name=P,this.p=new i(v,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}E.prototype._tmp=function(){var v=new i(null);return v.words=new Array(Math.ceil(this.n/13)),v},E.prototype.ireduce=function(v){var S=v,T;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),T=S.bitLength();while(T>this.n);var N=T<this.n?-1:S.ucmp(this.p);return N===0?(S.words[0]=0,S.length=1):N>0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},E.prototype.split=function(v,S){v.iushrn(this.n,0,S)},E.prototype.imulK=function(v){return v.imul(this.k)};function C(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(C,E),C.prototype.split=function(v,S){for(var T=4194303,N=Math.min(v.length,9),D=0;D<N;D++)S.words[D]=v.words[D];if(S.length=N,v.length<=9){v.words[0]=0,v.length=1;return}var O=v.words[9];for(S.words[S.length++]=O&T,D=10;D<v.length;D++){var L=v.words[D]|0;v.words[D-10]=(L&T)<<4|O>>>22,O=L}O>>>=22,v.words[D-10]=O,O===0&&v.length>10?v.length-=10:v.length-=9},C.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var S=0,T=0;T<v.length;T++){var N=v.words[T]|0;S+=N*977,v.words[T]=S&67108863,S=N*64+(S/67108864|0)}return v.words[v.length-1]===0&&(v.length--,v.words[v.length-1]===0&&v.length--),v};function R(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(R,E);function M(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(M,E);function _(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(_,E),_.prototype.imulK=function(v){for(var S=0,T=0;T<v.length;T++){var N=(v.words[T]|0)*19+S,D=N&67108863;N>>>=26,v.words[T]=D,S=N}return S!==0&&(v.words[v.length++]=S),v},i._prime=function(v){if(w[v])return w[v];var S;if(v==="k256")S=new C;else if(v==="p224")S=new R;else if(v==="p192")S=new M;else if(v==="p25519")S=new _;else throw new Error("Unknown prime "+v);return w[v]=S,S};function A(P){if(typeof P=="string"){var v=i._prime(P);this.m=v.p,this.prime=v}else n(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}A.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},A.prototype._verify2=function(v,S){n((v.negative|S.negative)===0,"red works only with positives"),n(v.red&&v.red===S.red,"red works only with red numbers")},A.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):v.umod(this.m)._forceRed(this)},A.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},A.prototype.add=function(v,S){this._verify2(v,S);var T=v.add(S);return T.cmp(this.m)>=0&&T.isub(this.m),T._forceRed(this)},A.prototype.iadd=function(v,S){this._verify2(v,S);var T=v.iadd(S);return T.cmp(this.m)>=0&&T.isub(this.m),T},A.prototype.sub=function(v,S){this._verify2(v,S);var T=v.sub(S);return T.cmpn(0)<0&&T.iadd(this.m),T._forceRed(this)},A.prototype.isub=function(v,S){this._verify2(v,S);var T=v.isub(S);return T.cmpn(0)<0&&T.iadd(this.m),T},A.prototype.shl=function(v,S){return this._verify1(v),this.imod(v.ushln(S))},A.prototype.imul=function(v,S){return this._verify2(v,S),this.imod(v.imul(S))},A.prototype.mul=function(v,S){return this._verify2(v,S),this.imod(v.mul(S))},A.prototype.isqr=function(v){return this.imul(v,v.clone())},A.prototype.sqr=function(v){return this.mul(v,v)},A.prototype.sqrt=function(v){if(v.isZero())return v.clone();var S=this.m.andln(3);if(n(S%2===1),S===3){var T=this.m.add(new i(1)).iushrn(2);return this.pow(v,T)}for(var N=this.m.subn(1),D=0;!N.isZero()&&N.andln(1)===0;)D++,N.iushrn(1);n(!N.isZero());var O=new i(1).toRed(this),L=O.redNeg(),B=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new i(2*k*k).toRed(this);this.pow(k,B).cmp(L)!==0;)k.redIAdd(L);for(var q=this.pow(k,N),W=this.pow(v,N.addn(1).iushrn(1)),re=this.pow(v,N),ue=D;re.cmp(O)!==0;){for(var H=re,ae=0;H.cmp(O)!==0;ae++)H=H.redSqr();n(ae<ue);var V=this.pow(q,new i(1).iushln(ue-ae-1));W=W.redMul(V),q=V.redSqr(),re=re.redMul(q),ue=ae}return W},A.prototype.invm=function(v){var S=v._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},A.prototype.pow=function(v,S){if(S.isZero())return new i(1).toRed(this);if(S.cmpn(1)===0)return v.clone();var T=4,N=new Array(1<<T);N[0]=new i(1).toRed(this),N[1]=v;for(var D=2;D<N.length;D++)N[D]=this.mul(N[D-1],v);var O=N[0],L=0,B=0,k=S.bitLength()%26;for(k===0&&(k=26),D=S.length-1;D>=0;D--){for(var q=S.words[D],W=k-1;W>=0;W--){var re=q>>W&1;if(O!==N[0]&&(O=this.sqr(O)),re===0&&L===0){B=0;continue}L<<=1,L|=re,B++,!(B!==T&&(D!==0||W!==0))&&(O=this.mul(O,N[L]),B=0,L=0)}k=26}return O},A.prototype.convertTo=function(v){var S=v.umod(this.m);return S===v?S.clone():S},A.prototype.convertFrom=function(v){var S=v.clone();return S.red=null,S},i.mont=function(v){return new I(v)};function I(P){A.call(this,P),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(I,A),I.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},I.prototype.convertFrom=function(v){var S=this.imod(v.mul(this.rinv));return S.red=null,S},I.prototype.imul=function(v,S){if(v.isZero()||S.isZero())return v.words[0]=0,v.length=1,v;var T=v.imul(S),N=T.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=T.isub(N).iushrn(this.shift),O=D;return D.cmp(this.m)>=0?O=D.isub(this.m):D.cmpn(0)<0&&(O=D.iadd(this.m)),O._forceRed(this)},I.prototype.mul=function(v,S){if(v.isZero()||S.isZero())return new i(0)._forceRed(this);var T=v.mul(S),N=T.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),D=T.isub(N).iushrn(this.shift),O=D;return D.cmp(this.m)>=0?O=D.isub(this.m):D.cmpn(0)<0&&(O=D.iadd(this.m)),O._forceRed(this)},I.prototype.invm=function(v){var S=this.imod(v._invmp(this.m).mul(this.r2));return S._forceRed(this)}})(e,It)}(ef)),ef.exports}var Yv;function rR(){if(Yv)return Di;Yv=1;var e=It&&It.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.rawEncode=Di.parseNumber=Di.solidityPack=void 0;const t=bh(),r=e(tR()),n=D2(),s=Ul();function i(g,m){if(g.length!==m.length)throw new Error("Number of types are not matching the values");const b=[];for(let w=0;w<g.length;w++){const E=u(g[w]),C=m[w];b.push(l(E,C,null))}return at.concat(b)}Di.solidityPack=i;function o(g){return g.endsWith("]")}function a(g){const m=g.match(/(.*)\[(.*?)\]$/u);return m?m[2]===""?"dynamic":parseInt(m[2],10):null}function f(g){const m=/^\D+(\d+)$/u.exec(g);if(m===null)throw new Error(`Invalid parseTypeN input "${g}".`);return parseInt(m[1],10)}function c(g){const m=typeof g;if(m==="string")return(0,t.isHexPrefixed)(g)?new r.default((0,n.stripHexPrefix)(g),16):new r.default(g,10);if(m==="number")return new r.default(g);if(g&&Object.prototype.hasOwnProperty.call(g,"toArray")||r.default.isBN(g))return g;throw new Error("Argument is not a number")}Di.parseNumber=c;function l(g,m,b){if(o(g)){const w=g.replace(/\[.*?\]/u,"");if(!o(w)){const C=a(g);if(C!=="dynamic"&&C!==0&&C!==null&&m.length>C)throw new Error(`Elements exceed array size: ${C}`)}const E=m.map(C=>l(w,C,256));return at.concat(E)}else{if(g==="bytes")return m;if(g==="string")return at.from(m,"utf8");if(g==="bool"){b=b||8;const w=Array(b/4).join("0");return at.from(m?`${w}1`:`${w}0`,"hex")}else if(g==="address"){let w=20;return b&&(w=b/8),(0,t.setLengthLeft)((0,t.toBuffer)(m),w)}else if(g.startsWith("bytes")){const w=f(g);if(w<1||w>32)throw new Error(`Invalid bytes<N> width: ${w}`);return typeof m=="number"&&(m=(0,s.normalize)(m)),(0,t.setLengthRight)((0,t.toBuffer)(m),w)}else if(g.startsWith("uint")){const w=f(g);if(w%8||w<8||w>256)throw new Error(`Invalid uint<N> width: ${w}`);const E=c(m);if(E.bitLength()>w)throw new Error(`Supplied uint exceeds width: ${w} vs ${E.bitLength()}`);return b=b||w,E.toArrayLike(at,"be",b/8)}else if(g.startsWith("int")){const w=f(g);if(w%8||w<8||w>256)throw new Error(`Invalid int<N> width: ${w}`);const E=c(m);if(E.bitLength()>w)throw new Error(`Supplied int exceeds width: ${w} vs ${E.bitLength()}`);return b=b||w,E.toTwos(w).toArrayLike(at,"be",b/8)}}throw new Error(`Unsupported or invalid type: ${JSON.stringify(g)}`)}function u(g){return g.startsWith("int[")?`int256${g.slice(3)}`:g==="int"?"int256":g.startsWith("uint[")?`uint256${g.slice(4)}`:g==="uint"?"uint256":g.startsWith("fixed[")?`fixed128x128${g.slice(5)}`:g==="fixed"?"fixed128x128":g.startsWith("ufixed[")?`ufixed128x128${g.slice(6)}`:g==="ufixed"?"ufixed128x128":g}function p(g,m){const b=[],w=[];let E=0;g.forEach(C=>{if(o(C)){const R=a(C);R!=="dynamic"&&R!==null?E+=32*R:E+=32}else E+=32});for(let C=0;C<g.length;C++){const R=u(g[C]),M=m[C],_=d(R,M);h(R)?(b.push(d("uint256",E)),w.push(_),E+=_.length):b.push(_)}return at.concat(b.concat(w))}Di.rawEncode=p;function d(g,m){if(g==="address")return d("uint160",c(m));if(g==="bool")return d("uint8",m?1:0);if(g==="string")return d("bytes",at.from(m,"utf8"));if(o(g)){if(typeof m.length>"u")throw new Error("Not an array?");const b=a(g);if(b!=="dynamic"&&b!==0&&b!==null&&m.length>b)throw new Error(`Elements exceed array size: ${b}`);const w=[];g=g.slice(0,g.lastIndexOf("[")),typeof m=="string"&&(m=JSON.parse(m));for(const E in m)Object.prototype.hasOwnProperty.call(m,E)&&w.push(d(g,m[E]));if(b==="dynamic"){const E=d("uint256",m.length);w.unshift(E)}return at.concat(w)}else if(g==="bytes"){m=at.from(m);let b=at.concat([d("uint256",m.length),m]);return m.length%32!==0&&(b=at.concat([b,(0,t.zeros)(32-m.length%32)])),b}else if(g.startsWith("bytes")){const b=f(g);if(b<1||b>32)throw new Error(`Invalid bytes<N> width: ${b}`);const w=typeof m=="number"?(0,s.normalize)(m):m;return(0,t.setLengthRight)((0,t.toBuffer)(w),32)}else if(g.startsWith("uint")){const b=f(g);if(b%8||b<8||b>256)throw new Error(`Invalid uint<N> width: ${b}`);const w=c(m);if(w.bitLength()>b)throw new Error(`Supplied uint exceeds width: ${b} vs ${w.bitLength()}`);if(w.isNeg())throw new Error("Supplied uint is negative");return w.toArrayLike(at,"be",32)}else if(g.startsWith("int")){const b=f(g);if(b%8||b<8||b>256)throw new Error(`Invalid int<N> width: ${b}`);const w=c(m);if(w.bitLength()>b)throw new Error(`Supplied int exceeds width: ${b} vs ${w.bitLength()}`);return w.toTwos(256).toArrayLike(at,"be",32)}else if(g.startsWith("ufixed")){const b=y(g),w=c(m);if(w.isNeg())throw new Error("Supplied ufixed is negative");return d("uint256",w.mul(new r.default(2).pow(new r.default(b[1]))))}else if(g.startsWith("fixed")){const b=y(g);return d("int256",c(m).mul(new r.default(2).pow(new r.default(b[1]))))}throw new Error(`Unsupported or invalid type: ${JSON.stringify(g)}`)}function h(g){return g==="string"||g==="bytes"||a(g)==="dynamic"}function y(g){const m=/^\D+(\d+)x(\d+)$/u.exec(g);if(m===null||m.length<1)throw new Error(`Invalid parseTypeNxM input "${g}".`);return[parseInt(m[1],10),parseInt(m[2],10)]}return Di}var Jv;function nR(){return Jv||(Jv=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=bh(),r=O2(),n=D2(),s=rR(),i=Ul();var o;(function(C){C.V1="V1",C.V3="V3",C.V4="V4"})(o=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};function a(C,R){if(Object.keys(o).includes(C)){if(R&&!R.includes(C))throw new Error(`SignTypedDataVersion not allowed: '${C}'. Allowed versions are: ${R.join(", ")}`)}else throw new Error(`Invalid version: '${C}'`)}function f(C,R,M,_,A){if(a(A,[o.V3,o.V4]),C[M]!==void 0)return["bytes32",A===o.V4&&_==null?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,r.keccak256)(c(M,_,C,A)))];if(_===void 0)throw new Error(`missing value for field ${R} of type ${M}`);if(M==="bytes"){if(typeof _=="number")_=(0,i.numberToBuffer)(_);else if((0,n.isHexString)(_)){const I=_.length%2?"0":"";_=at.from(I+_.slice(2),"hex")}else _=at.from(_,"utf8");return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(_))]}if(M==="string")return typeof _=="number"?_=(0,i.numberToBuffer)(_):_=at.from(_??"","utf8"),["bytes32",(0,t.arrToBufArr)((0,r.keccak256)(_))];if(M.endsWith("]")){if(A===o.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const I=M.slice(0,M.lastIndexOf("[")),P=_.map(v=>f(C,R,I,v,A));return["bytes32",(0,t.arrToBufArr)((0,r.keccak256)((0,s.rawEncode)(P.map(([v])=>v),P.map(([,v])=>v))))]}return[M,_]}function c(C,R,M,_){a(_,[o.V3,o.V4]);const A=["bytes32"],I=[d(C,M)];for(const P of M[C]){if(_===o.V3&&R[P.name]===void 0)continue;const[v,S]=f(M,P.name,P.type,R[P.name],_);A.push(v),I.push(S)}return(0,s.rawEncode)(A,I)}function l(C,R){let M="";const _=u(C,R);_.delete(C);const A=[C,...Array.from(_).sort()];for(const I of A){if(!R[I])throw new Error(`No type definition specified: ${I}`);M+=`${I}(${R[I].map(({name:v,type:S})=>`${S} ${v}`).join(",")})`}return M}function u(C,R,M=new Set){if(typeof C!="string")throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(C)}`);if([C]=C.match(/^\w*/u),M.has(C)||R[C]===void 0)return M;M.add(C);for(const A of R[C])u(A.type,R,M);return M}function p(C,R,M,_){a(_,[o.V3,o.V4]);const A=c(C,R,M,_),I=(0,r.keccak256)(A);return(0,t.arrToBufArr)(I)}function d(C,R){const M=at.from(l(C,R),"utf-8");return(0,t.arrToBufArr)((0,r.keccak256)(M))}function h(C){const R={};for(const M in e.TYPED_MESSAGE_SCHEMA.properties)C[M]&&(R[M]=C[M]);return"types"in R&&(R.types=Object.assign({EIP712Domain:[]},R.types)),R}function y(C,R){a(R,[o.V3,o.V4]);const M=h(C),{domain:_}=M,A={EIP712Domain:M.types.EIP712Domain};return p("EIP712Domain",_,A,R)}function g(C,R){a(R,[o.V3,o.V4]);const M=h(C),_=[at.from("1901","hex")];return _.push(y(C,R)),M.primaryType!=="EIP712Domain"&&_.push(p(M.primaryType,M.message,M.types,R)),(0,t.arrToBufArr)((0,r.keccak256)(at.concat(_)))}e.TypedDataUtils={encodeData:c,encodeType:l,findTypeDependencies:u,hashStruct:p,hashType:d,sanitizeData:h,eip712Hash:g,eip712DomainHash:y};function m(C){const R=b(C);return(0,t.bufferToHex)(R)}e.typedSignatureHash=m;function b(C){const R=new Error("Expect argument to be non-empty array");if(typeof C!="object"||!("length"in C)||!C.length)throw R;const M=C.map(function(I){return I.type!=="bytes"?I.value:(0,i.legacyToBuffer)(I.value)}),_=C.map(function(I){return I.type}),A=C.map(function(I){if(!I.name)throw R;return`${I.type} ${I.name}`});return(0,t.arrToBufArr)((0,r.keccak256)((0,s.solidityPack)(["bytes32","bytes32"],[(0,r.keccak256)((0,s.solidityPack)(new Array(C.length).fill("string"),A)),(0,r.keccak256)((0,s.solidityPack)(_,M))])))}function w({privateKey:C,data:R,version:M}){if(a(M),(0,i.isNullish)(R))throw new Error("Missing data parameter");if((0,i.isNullish)(C))throw new Error("Missing private key parameter");const _=M===o.V1?b(R):e.TypedDataUtils.eip712Hash(R,M),A=(0,t.ecsign)(_,C);return(0,i.concatSig)((0,t.toBuffer)(A.v),A.r,A.s)}e.signTypedData=w;function E({data:C,signature:R,version:M}){if(a(M),(0,i.isNullish)(C))throw new Error("Missing data parameter");if((0,i.isNullish)(R))throw new Error("Missing signature parameter");const _=M===o.V1?b(C):e.TypedDataUtils.eip712Hash(C,M),A=(0,i.recoverPublicKey)(_,R),I=(0,t.publicToAddress)(A);return(0,t.bufferToHex)(I)}e.recoverTypedSignature=E}(_1)),_1}var vn={},w1={exports:{}},Zv;function iR(){return Zv||(Zv=1,function(e){(function(t){var r=function(K){var Y,J=new Float64Array(16);if(K)for(Y=0;Y<K.length;Y++)J[Y]=K[Y];return J},n=function(){throw new Error("no PRNG")},s=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=r(),a=r([1]),f=r([56129,1]),c=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),d=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function h(K,Y,J,x){K[Y]=J>>24&255,K[Y+1]=J>>16&255,K[Y+2]=J>>8&255,K[Y+3]=J&255,K[Y+4]=x>>24&255,K[Y+5]=x>>16&255,K[Y+6]=x>>8&255,K[Y+7]=x&255}function y(K,Y,J,x,ie){var Ee,Ie=0;for(Ee=0;Ee<ie;Ee++)Ie|=K[Y+Ee]^J[x+Ee];return(1&Ie-1>>>8)-1}function g(K,Y,J,x){return y(K,Y,J,x,16)}function m(K,Y,J,x){return y(K,Y,J,x,32)}function b(K,Y,J,x){for(var ie=x[0]&255|(x[1]&255)<<8|(x[2]&255)<<16|(x[3]&255)<<24,Ee=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Ie=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,De=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,Ge=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,ut=x[4]&255|(x[5]&255)<<8|(x[6]&255)<<16|(x[7]&255)<<24,nt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,Ct=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,st=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,mt=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,vt=x[8]&255|(x[9]&255)<<8|(x[10]&255)<<16|(x[11]&255)<<24,At=J[16]&255|(J[17]&255)<<8|(J[18]&255)<<16|(J[19]&255)<<24,Et=J[20]&255|(J[21]&255)<<8|(J[22]&255)<<16|(J[23]&255)<<24,bt=J[24]&255|(J[25]&255)<<8|(J[26]&255)<<16|(J[27]&255)<<24,wt=J[28]&255|(J[29]&255)<<8|(J[30]&255)<<16|(J[31]&255)<<24,_t=x[12]&255|(x[13]&255)<<8|(x[14]&255)<<16|(x[15]&255)<<24,ct=ie,ft=Ee,it=Ie,lt=De,ht=Ge,ot=ut,Be=nt,Le=Ct,Ye=st,ze=mt,We=vt,Ze=At,St=Et,xt=bt,Bt=wt,Ut=_t,_e,qt=0;qt<20;qt+=2)_e=ct+St|0,ht^=_e<<7|_e>>>32-7,_e=ht+ct|0,Ye^=_e<<9|_e>>>32-9,_e=Ye+ht|0,St^=_e<<13|_e>>>32-13,_e=St+Ye|0,ct^=_e<<18|_e>>>32-18,_e=ot+ft|0,ze^=_e<<7|_e>>>32-7,_e=ze+ot|0,xt^=_e<<9|_e>>>32-9,_e=xt+ze|0,ft^=_e<<13|_e>>>32-13,_e=ft+xt|0,ot^=_e<<18|_e>>>32-18,_e=We+Be|0,Bt^=_e<<7|_e>>>32-7,_e=Bt+We|0,it^=_e<<9|_e>>>32-9,_e=it+Bt|0,Be^=_e<<13|_e>>>32-13,_e=Be+it|0,We^=_e<<18|_e>>>32-18,_e=Ut+Ze|0,lt^=_e<<7|_e>>>32-7,_e=lt+Ut|0,Le^=_e<<9|_e>>>32-9,_e=Le+lt|0,Ze^=_e<<13|_e>>>32-13,_e=Ze+Le|0,Ut^=_e<<18|_e>>>32-18,_e=ct+lt|0,ft^=_e<<7|_e>>>32-7,_e=ft+ct|0,it^=_e<<9|_e>>>32-9,_e=it+ft|0,lt^=_e<<13|_e>>>32-13,_e=lt+it|0,ct^=_e<<18|_e>>>32-18,_e=ot+ht|0,Be^=_e<<7|_e>>>32-7,_e=Be+ot|0,Le^=_e<<9|_e>>>32-9,_e=Le+Be|0,ht^=_e<<13|_e>>>32-13,_e=ht+Le|0,ot^=_e<<18|_e>>>32-18,_e=We+ze|0,Ze^=_e<<7|_e>>>32-7,_e=Ze+We|0,Ye^=_e<<9|_e>>>32-9,_e=Ye+Ze|0,ze^=_e<<13|_e>>>32-13,_e=ze+Ye|0,We^=_e<<18|_e>>>32-18,_e=Ut+Bt|0,St^=_e<<7|_e>>>32-7,_e=St+Ut|0,xt^=_e<<9|_e>>>32-9,_e=xt+St|0,Bt^=_e<<13|_e>>>32-13,_e=Bt+xt|0,Ut^=_e<<18|_e>>>32-18;ct=ct+ie|0,ft=ft+Ee|0,it=it+Ie|0,lt=lt+De|0,ht=ht+Ge|0,ot=ot+ut|0,Be=Be+nt|0,Le=Le+Ct|0,Ye=Ye+st|0,ze=ze+mt|0,We=We+vt|0,Ze=Ze+At|0,St=St+Et|0,xt=xt+bt|0,Bt=Bt+wt|0,Ut=Ut+_t|0,K[0]=ct>>>0&255,K[1]=ct>>>8&255,K[2]=ct>>>16&255,K[3]=ct>>>24&255,K[4]=ft>>>0&255,K[5]=ft>>>8&255,K[6]=ft>>>16&255,K[7]=ft>>>24&255,K[8]=it>>>0&255,K[9]=it>>>8&255,K[10]=it>>>16&255,K[11]=it>>>24&255,K[12]=lt>>>0&255,K[13]=lt>>>8&255,K[14]=lt>>>16&255,K[15]=lt>>>24&255,K[16]=ht>>>0&255,K[17]=ht>>>8&255,K[18]=ht>>>16&255,K[19]=ht>>>24&255,K[20]=ot>>>0&255,K[21]=ot>>>8&255,K[22]=ot>>>16&255,K[23]=ot>>>24&255,K[24]=Be>>>0&255,K[25]=Be>>>8&255,K[26]=Be>>>16&255,K[27]=Be>>>24&255,K[28]=Le>>>0&255,K[29]=Le>>>8&255,K[30]=Le>>>16&255,K[31]=Le>>>24&255,K[32]=Ye>>>0&255,K[33]=Ye>>>8&255,K[34]=Ye>>>16&255,K[35]=Ye>>>24&255,K[36]=ze>>>0&255,K[37]=ze>>>8&255,K[38]=ze>>>16&255,K[39]=ze>>>24&255,K[40]=We>>>0&255,K[41]=We>>>8&255,K[42]=We>>>16&255,K[43]=We>>>24&255,K[44]=Ze>>>0&255,K[45]=Ze>>>8&255,K[46]=Ze>>>16&255,K[47]=Ze>>>24&255,K[48]=St>>>0&255,K[49]=St>>>8&255,K[50]=St>>>16&255,K[51]=St>>>24&255,K[52]=xt>>>0&255,K[53]=xt>>>8&255,K[54]=xt>>>16&255,K[55]=xt>>>24&255,K[56]=Bt>>>0&255,K[57]=Bt>>>8&255,K[58]=Bt>>>16&255,K[59]=Bt>>>24&255,K[60]=Ut>>>0&255,K[61]=Ut>>>8&255,K[62]=Ut>>>16&255,K[63]=Ut>>>24&255}function w(K,Y,J,x){for(var ie=x[0]&255|(x[1]&255)<<8|(x[2]&255)<<16|(x[3]&255)<<24,Ee=J[0]&255|(J[1]&255)<<8|(J[2]&255)<<16|(J[3]&255)<<24,Ie=J[4]&255|(J[5]&255)<<8|(J[6]&255)<<16|(J[7]&255)<<24,De=J[8]&255|(J[9]&255)<<8|(J[10]&255)<<16|(J[11]&255)<<24,Ge=J[12]&255|(J[13]&255)<<8|(J[14]&255)<<16|(J[15]&255)<<24,ut=x[4]&255|(x[5]&255)<<8|(x[6]&255)<<16|(x[7]&255)<<24,nt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,Ct=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,st=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,mt=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,vt=x[8]&255|(x[9]&255)<<8|(x[10]&255)<<16|(x[11]&255)<<24,At=J[16]&255|(J[17]&255)<<8|(J[18]&255)<<16|(J[19]&255)<<24,Et=J[20]&255|(J[21]&255)<<8|(J[22]&255)<<16|(J[23]&255)<<24,bt=J[24]&255|(J[25]&255)<<8|(J[26]&255)<<16|(J[27]&255)<<24,wt=J[28]&255|(J[29]&255)<<8|(J[30]&255)<<16|(J[31]&255)<<24,_t=x[12]&255|(x[13]&255)<<8|(x[14]&255)<<16|(x[15]&255)<<24,ct=ie,ft=Ee,it=Ie,lt=De,ht=Ge,ot=ut,Be=nt,Le=Ct,Ye=st,ze=mt,We=vt,Ze=At,St=Et,xt=bt,Bt=wt,Ut=_t,_e,qt=0;qt<20;qt+=2)_e=ct+St|0,ht^=_e<<7|_e>>>32-7,_e=ht+ct|0,Ye^=_e<<9|_e>>>32-9,_e=Ye+ht|0,St^=_e<<13|_e>>>32-13,_e=St+Ye|0,ct^=_e<<18|_e>>>32-18,_e=ot+ft|0,ze^=_e<<7|_e>>>32-7,_e=ze+ot|0,xt^=_e<<9|_e>>>32-9,_e=xt+ze|0,ft^=_e<<13|_e>>>32-13,_e=ft+xt|0,ot^=_e<<18|_e>>>32-18,_e=We+Be|0,Bt^=_e<<7|_e>>>32-7,_e=Bt+We|0,it^=_e<<9|_e>>>32-9,_e=it+Bt|0,Be^=_e<<13|_e>>>32-13,_e=Be+it|0,We^=_e<<18|_e>>>32-18,_e=Ut+Ze|0,lt^=_e<<7|_e>>>32-7,_e=lt+Ut|0,Le^=_e<<9|_e>>>32-9,_e=Le+lt|0,Ze^=_e<<13|_e>>>32-13,_e=Ze+Le|0,Ut^=_e<<18|_e>>>32-18,_e=ct+lt|0,ft^=_e<<7|_e>>>32-7,_e=ft+ct|0,it^=_e<<9|_e>>>32-9,_e=it+ft|0,lt^=_e<<13|_e>>>32-13,_e=lt+it|0,ct^=_e<<18|_e>>>32-18,_e=ot+ht|0,Be^=_e<<7|_e>>>32-7,_e=Be+ot|0,Le^=_e<<9|_e>>>32-9,_e=Le+Be|0,ht^=_e<<13|_e>>>32-13,_e=ht+Le|0,ot^=_e<<18|_e>>>32-18,_e=We+ze|0,Ze^=_e<<7|_e>>>32-7,_e=Ze+We|0,Ye^=_e<<9|_e>>>32-9,_e=Ye+Ze|0,ze^=_e<<13|_e>>>32-13,_e=ze+Ye|0,We^=_e<<18|_e>>>32-18,_e=Ut+Bt|0,St^=_e<<7|_e>>>32-7,_e=St+Ut|0,xt^=_e<<9|_e>>>32-9,_e=xt+St|0,Bt^=_e<<13|_e>>>32-13,_e=Bt+xt|0,Ut^=_e<<18|_e>>>32-18;K[0]=ct>>>0&255,K[1]=ct>>>8&255,K[2]=ct>>>16&255,K[3]=ct>>>24&255,K[4]=ot>>>0&255,K[5]=ot>>>8&255,K[6]=ot>>>16&255,K[7]=ot>>>24&255,K[8]=We>>>0&255,K[9]=We>>>8&255,K[10]=We>>>16&255,K[11]=We>>>24&255,K[12]=Ut>>>0&255,K[13]=Ut>>>8&255,K[14]=Ut>>>16&255,K[15]=Ut>>>24&255,K[16]=Be>>>0&255,K[17]=Be>>>8&255,K[18]=Be>>>16&255,K[19]=Be>>>24&255,K[20]=Le>>>0&255,K[21]=Le>>>8&255,K[22]=Le>>>16&255,K[23]=Le>>>24&255,K[24]=Ye>>>0&255,K[25]=Ye>>>8&255,K[26]=Ye>>>16&255,K[27]=Ye>>>24&255,K[28]=ze>>>0&255,K[29]=ze>>>8&255,K[30]=ze>>>16&255,K[31]=ze>>>24&255}function E(K,Y,J,x){b(K,Y,J,x)}function C(K,Y,J,x){w(K,Y,J,x)}var R=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function M(K,Y,J,x,ie,Ee,Ie){var De=new Uint8Array(16),Ge=new Uint8Array(64),ut,nt;for(nt=0;nt<16;nt++)De[nt]=0;for(nt=0;nt<8;nt++)De[nt]=Ee[nt];for(;ie>=64;){for(E(Ge,De,Ie,R),nt=0;nt<64;nt++)K[Y+nt]=J[x+nt]^Ge[nt];for(ut=1,nt=8;nt<16;nt++)ut=ut+(De[nt]&255)|0,De[nt]=ut&255,ut>>>=8;ie-=64,Y+=64,x+=64}if(ie>0)for(E(Ge,De,Ie,R),nt=0;nt<ie;nt++)K[Y+nt]=J[x+nt]^Ge[nt];return 0}function _(K,Y,J,x,ie){var Ee=new Uint8Array(16),Ie=new Uint8Array(64),De,Ge;for(Ge=0;Ge<16;Ge++)Ee[Ge]=0;for(Ge=0;Ge<8;Ge++)Ee[Ge]=x[Ge];for(;J>=64;){for(E(Ie,Ee,ie,R),Ge=0;Ge<64;Ge++)K[Y+Ge]=Ie[Ge];for(De=1,Ge=8;Ge<16;Ge++)De=De+(Ee[Ge]&255)|0,Ee[Ge]=De&255,De>>>=8;J-=64,Y+=64}if(J>0)for(E(Ie,Ee,ie,R),Ge=0;Ge<J;Ge++)K[Y+Ge]=Ie[Ge];return 0}function A(K,Y,J,x,ie){var Ee=new Uint8Array(32);C(Ee,x,ie,R);for(var Ie=new Uint8Array(8),De=0;De<8;De++)Ie[De]=x[De+16];return _(K,Y,J,Ie,Ee)}function I(K,Y,J,x,ie,Ee,Ie){var De=new Uint8Array(32);C(De,Ee,Ie,R);for(var Ge=new Uint8Array(8),ut=0;ut<8;ut++)Ge[ut]=Ee[ut+16];return M(K,Y,J,x,ie,Ge,De)}var P=function(K){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var Y,J,x,ie,Ee,Ie,De,Ge;Y=K[0]&255|(K[1]&255)<<8,this.r[0]=Y&8191,J=K[2]&255|(K[3]&255)<<8,this.r[1]=(Y>>>13|J<<3)&8191,x=K[4]&255|(K[5]&255)<<8,this.r[2]=(J>>>10|x<<6)&7939,ie=K[6]&255|(K[7]&255)<<8,this.r[3]=(x>>>7|ie<<9)&8191,Ee=K[8]&255|(K[9]&255)<<8,this.r[4]=(ie>>>4|Ee<<12)&255,this.r[5]=Ee>>>1&8190,Ie=K[10]&255|(K[11]&255)<<8,this.r[6]=(Ee>>>14|Ie<<2)&8191,De=K[12]&255|(K[13]&255)<<8,this.r[7]=(Ie>>>11|De<<5)&8065,Ge=K[14]&255|(K[15]&255)<<8,this.r[8]=(De>>>8|Ge<<8)&8191,this.r[9]=Ge>>>5&127,this.pad[0]=K[16]&255|(K[17]&255)<<8,this.pad[1]=K[18]&255|(K[19]&255)<<8,this.pad[2]=K[20]&255|(K[21]&255)<<8,this.pad[3]=K[22]&255|(K[23]&255)<<8,this.pad[4]=K[24]&255|(K[25]&255)<<8,this.pad[5]=K[26]&255|(K[27]&255)<<8,this.pad[6]=K[28]&255|(K[29]&255)<<8,this.pad[7]=K[30]&255|(K[31]&255)<<8};P.prototype.blocks=function(K,Y,J){for(var x=this.fin?0:2048,ie,Ee,Ie,De,Ge,ut,nt,Ct,st,mt,vt,At,Et,bt,wt,_t,ct,ft,it,lt=this.h[0],ht=this.h[1],ot=this.h[2],Be=this.h[3],Le=this.h[4],Ye=this.h[5],ze=this.h[6],We=this.h[7],Ze=this.h[8],St=this.h[9],xt=this.r[0],Bt=this.r[1],Ut=this.r[2],_e=this.r[3],qt=this.r[4],Wt=this.r[5],Yt=this.r[6],Kt=this.r[7],Gt=this.r[8],zt=this.r[9];J>=16;)ie=K[Y+0]&255|(K[Y+1]&255)<<8,lt+=ie&8191,Ee=K[Y+2]&255|(K[Y+3]&255)<<8,ht+=(ie>>>13|Ee<<3)&8191,Ie=K[Y+4]&255|(K[Y+5]&255)<<8,ot+=(Ee>>>10|Ie<<6)&8191,De=K[Y+6]&255|(K[Y+7]&255)<<8,Be+=(Ie>>>7|De<<9)&8191,Ge=K[Y+8]&255|(K[Y+9]&255)<<8,Le+=(De>>>4|Ge<<12)&8191,Ye+=Ge>>>1&8191,ut=K[Y+10]&255|(K[Y+11]&255)<<8,ze+=(Ge>>>14|ut<<2)&8191,nt=K[Y+12]&255|(K[Y+13]&255)<<8,We+=(ut>>>11|nt<<5)&8191,Ct=K[Y+14]&255|(K[Y+15]&255)<<8,Ze+=(nt>>>8|Ct<<8)&8191,St+=Ct>>>5|x,st=0,mt=st,mt+=lt*xt,mt+=ht*(5*zt),mt+=ot*(5*Gt),mt+=Be*(5*Kt),mt+=Le*(5*Yt),st=mt>>>13,mt&=8191,mt+=Ye*(5*Wt),mt+=ze*(5*qt),mt+=We*(5*_e),mt+=Ze*(5*Ut),mt+=St*(5*Bt),st+=mt>>>13,mt&=8191,vt=st,vt+=lt*Bt,vt+=ht*xt,vt+=ot*(5*zt),vt+=Be*(5*Gt),vt+=Le*(5*Kt),st=vt>>>13,vt&=8191,vt+=Ye*(5*Yt),vt+=ze*(5*Wt),vt+=We*(5*qt),vt+=Ze*(5*_e),vt+=St*(5*Ut),st+=vt>>>13,vt&=8191,At=st,At+=lt*Ut,At+=ht*Bt,At+=ot*xt,At+=Be*(5*zt),At+=Le*(5*Gt),st=At>>>13,At&=8191,At+=Ye*(5*Kt),At+=ze*(5*Yt),At+=We*(5*Wt),At+=Ze*(5*qt),At+=St*(5*_e),st+=At>>>13,At&=8191,Et=st,Et+=lt*_e,Et+=ht*Ut,Et+=ot*Bt,Et+=Be*xt,Et+=Le*(5*zt),st=Et>>>13,Et&=8191,Et+=Ye*(5*Gt),Et+=ze*(5*Kt),Et+=We*(5*Yt),Et+=Ze*(5*Wt),Et+=St*(5*qt),st+=Et>>>13,Et&=8191,bt=st,bt+=lt*qt,bt+=ht*_e,bt+=ot*Ut,bt+=Be*Bt,bt+=Le*xt,st=bt>>>13,bt&=8191,bt+=Ye*(5*zt),bt+=ze*(5*Gt),bt+=We*(5*Kt),bt+=Ze*(5*Yt),bt+=St*(5*Wt),st+=bt>>>13,bt&=8191,wt=st,wt+=lt*Wt,wt+=ht*qt,wt+=ot*_e,wt+=Be*Ut,wt+=Le*Bt,st=wt>>>13,wt&=8191,wt+=Ye*xt,wt+=ze*(5*zt),wt+=We*(5*Gt),wt+=Ze*(5*Kt),wt+=St*(5*Yt),st+=wt>>>13,wt&=8191,_t=st,_t+=lt*Yt,_t+=ht*Wt,_t+=ot*qt,_t+=Be*_e,_t+=Le*Ut,st=_t>>>13,_t&=8191,_t+=Ye*Bt,_t+=ze*xt,_t+=We*(5*zt),_t+=Ze*(5*Gt),_t+=St*(5*Kt),st+=_t>>>13,_t&=8191,ct=st,ct+=lt*Kt,ct+=ht*Yt,ct+=ot*Wt,ct+=Be*qt,ct+=Le*_e,st=ct>>>13,ct&=8191,ct+=Ye*Ut,ct+=ze*Bt,ct+=We*xt,ct+=Ze*(5*zt),ct+=St*(5*Gt),st+=ct>>>13,ct&=8191,ft=st,ft+=lt*Gt,ft+=ht*Kt,ft+=ot*Yt,ft+=Be*Wt,ft+=Le*qt,st=ft>>>13,ft&=8191,ft+=Ye*_e,ft+=ze*Ut,ft+=We*Bt,ft+=Ze*xt,ft+=St*(5*zt),st+=ft>>>13,ft&=8191,it=st,it+=lt*zt,it+=ht*Gt,it+=ot*Kt,it+=Be*Yt,it+=Le*Wt,st=it>>>13,it&=8191,it+=Ye*qt,it+=ze*_e,it+=We*Ut,it+=Ze*Bt,it+=St*xt,st+=it>>>13,it&=8191,st=(st<<2)+st|0,st=st+mt|0,mt=st&8191,st=st>>>13,vt+=st,lt=mt,ht=vt,ot=At,Be=Et,Le=bt,Ye=wt,ze=_t,We=ct,Ze=ft,St=it,Y+=16,J-=16;this.h[0]=lt,this.h[1]=ht,this.h[2]=ot,this.h[3]=Be,this.h[4]=Le,this.h[5]=Ye,this.h[6]=ze,this.h[7]=We,this.h[8]=Ze,this.h[9]=St},P.prototype.finish=function(K,Y){var J=new Uint16Array(10),x,ie,Ee,Ie;if(this.leftover){for(Ie=this.leftover,this.buffer[Ie++]=1;Ie<16;Ie++)this.buffer[Ie]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(x=this.h[1]>>>13,this.h[1]&=8191,Ie=2;Ie<10;Ie++)this.h[Ie]+=x,x=this.h[Ie]>>>13,this.h[Ie]&=8191;for(this.h[0]+=x*5,x=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=x,x=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=x,J[0]=this.h[0]+5,x=J[0]>>>13,J[0]&=8191,Ie=1;Ie<10;Ie++)J[Ie]=this.h[Ie]+x,x=J[Ie]>>>13,J[Ie]&=8191;for(J[9]-=8192,ie=(x^1)-1,Ie=0;Ie<10;Ie++)J[Ie]&=ie;for(ie=~ie,Ie=0;Ie<10;Ie++)this.h[Ie]=this.h[Ie]&ie|J[Ie];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Ee=this.h[0]+this.pad[0],this.h[0]=Ee&65535,Ie=1;Ie<8;Ie++)Ee=(this.h[Ie]+this.pad[Ie]|0)+(Ee>>>16)|0,this.h[Ie]=Ee&65535;K[Y+0]=this.h[0]>>>0&255,K[Y+1]=this.h[0]>>>8&255,K[Y+2]=this.h[1]>>>0&255,K[Y+3]=this.h[1]>>>8&255,K[Y+4]=this.h[2]>>>0&255,K[Y+5]=this.h[2]>>>8&255,K[Y+6]=this.h[3]>>>0&255,K[Y+7]=this.h[3]>>>8&255,K[Y+8]=this.h[4]>>>0&255,K[Y+9]=this.h[4]>>>8&255,K[Y+10]=this.h[5]>>>0&255,K[Y+11]=this.h[5]>>>8&255,K[Y+12]=this.h[6]>>>0&255,K[Y+13]=this.h[6]>>>8&255,K[Y+14]=this.h[7]>>>0&255,K[Y+15]=this.h[7]>>>8&255},P.prototype.update=function(K,Y,J){var x,ie;if(this.leftover){for(ie=16-this.leftover,ie>J&&(ie=J),x=0;x<ie;x++)this.buffer[this.leftover+x]=K[Y+x];if(J-=ie,Y+=ie,this.leftover+=ie,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(J>=16&&(ie=J-J%16,this.blocks(K,Y,ie),Y+=ie,J-=ie),J){for(x=0;x<J;x++)this.buffer[this.leftover+x]=K[Y+x];this.leftover+=J}};function v(K,Y,J,x,ie,Ee){var Ie=new P(Ee);return Ie.update(J,x,ie),Ie.finish(K,Y),0}function S(K,Y,J,x,ie,Ee){var Ie=new Uint8Array(16);return v(Ie,0,J,x,ie,Ee),g(K,Y,Ie,0)}function T(K,Y,J,x,ie){var Ee;if(J<32)return-1;for(I(K,0,Y,0,J,x,ie),v(K,16,K,32,J-32,K),Ee=0;Ee<16;Ee++)K[Ee]=0;return 0}function N(K,Y,J,x,ie){var Ee,Ie=new Uint8Array(32);if(J<32||(A(Ie,0,32,x,ie),S(Y,16,Y,32,J-32,Ie)!==0))return-1;for(I(K,0,Y,0,J,x,ie),Ee=0;Ee<32;Ee++)K[Ee]=0;return 0}function D(K,Y){var J;for(J=0;J<16;J++)K[J]=Y[J]|0}function O(K){var Y,J,x=1;for(Y=0;Y<16;Y++)J=K[Y]+x+65535,x=Math.floor(J/65536),K[Y]=J-x*65536;K[0]+=x-1+37*(x-1)}function L(K,Y,J){for(var x,ie=~(J-1),Ee=0;Ee<16;Ee++)x=ie&(K[Ee]^Y[Ee]),K[Ee]^=x,Y[Ee]^=x}function B(K,Y){var J,x,ie,Ee=r(),Ie=r();for(J=0;J<16;J++)Ie[J]=Y[J];for(O(Ie),O(Ie),O(Ie),x=0;x<2;x++){for(Ee[0]=Ie[0]-65517,J=1;J<15;J++)Ee[J]=Ie[J]-65535-(Ee[J-1]>>16&1),Ee[J-1]&=65535;Ee[15]=Ie[15]-32767-(Ee[14]>>16&1),ie=Ee[15]>>16&1,Ee[14]&=65535,L(Ie,Ee,1-ie)}for(J=0;J<16;J++)K[2*J]=Ie[J]&255,K[2*J+1]=Ie[J]>>8}function k(K,Y){var J=new Uint8Array(32),x=new Uint8Array(32);return B(J,K),B(x,Y),m(J,0,x,0)}function q(K){var Y=new Uint8Array(32);return B(Y,K),Y[0]&1}function W(K,Y){var J;for(J=0;J<16;J++)K[J]=Y[2*J]+(Y[2*J+1]<<8);K[15]&=32767}function re(K,Y,J){for(var x=0;x<16;x++)K[x]=Y[x]+J[x]}function ue(K,Y,J){for(var x=0;x<16;x++)K[x]=Y[x]-J[x]}function H(K,Y,J){var x,ie,Ee=0,Ie=0,De=0,Ge=0,ut=0,nt=0,Ct=0,st=0,mt=0,vt=0,At=0,Et=0,bt=0,wt=0,_t=0,ct=0,ft=0,it=0,lt=0,ht=0,ot=0,Be=0,Le=0,Ye=0,ze=0,We=0,Ze=0,St=0,xt=0,Bt=0,Ut=0,_e=J[0],qt=J[1],Wt=J[2],Yt=J[3],Kt=J[4],Gt=J[5],zt=J[6],br=J[7],Qt=J[8],pr=J[9],yr=J[10],gr=J[11],Er=J[12],Vr=J[13],Fr=J[14],Hr=J[15];x=Y[0],Ee+=x*_e,Ie+=x*qt,De+=x*Wt,Ge+=x*Yt,ut+=x*Kt,nt+=x*Gt,Ct+=x*zt,st+=x*br,mt+=x*Qt,vt+=x*pr,At+=x*yr,Et+=x*gr,bt+=x*Er,wt+=x*Vr,_t+=x*Fr,ct+=x*Hr,x=Y[1],Ie+=x*_e,De+=x*qt,Ge+=x*Wt,ut+=x*Yt,nt+=x*Kt,Ct+=x*Gt,st+=x*zt,mt+=x*br,vt+=x*Qt,At+=x*pr,Et+=x*yr,bt+=x*gr,wt+=x*Er,_t+=x*Vr,ct+=x*Fr,ft+=x*Hr,x=Y[2],De+=x*_e,Ge+=x*qt,ut+=x*Wt,nt+=x*Yt,Ct+=x*Kt,st+=x*Gt,mt+=x*zt,vt+=x*br,At+=x*Qt,Et+=x*pr,bt+=x*yr,wt+=x*gr,_t+=x*Er,ct+=x*Vr,ft+=x*Fr,it+=x*Hr,x=Y[3],Ge+=x*_e,ut+=x*qt,nt+=x*Wt,Ct+=x*Yt,st+=x*Kt,mt+=x*Gt,vt+=x*zt,At+=x*br,Et+=x*Qt,bt+=x*pr,wt+=x*yr,_t+=x*gr,ct+=x*Er,ft+=x*Vr,it+=x*Fr,lt+=x*Hr,x=Y[4],ut+=x*_e,nt+=x*qt,Ct+=x*Wt,st+=x*Yt,mt+=x*Kt,vt+=x*Gt,At+=x*zt,Et+=x*br,bt+=x*Qt,wt+=x*pr,_t+=x*yr,ct+=x*gr,ft+=x*Er,it+=x*Vr,lt+=x*Fr,ht+=x*Hr,x=Y[5],nt+=x*_e,Ct+=x*qt,st+=x*Wt,mt+=x*Yt,vt+=x*Kt,At+=x*Gt,Et+=x*zt,bt+=x*br,wt+=x*Qt,_t+=x*pr,ct+=x*yr,ft+=x*gr,it+=x*Er,lt+=x*Vr,ht+=x*Fr,ot+=x*Hr,x=Y[6],Ct+=x*_e,st+=x*qt,mt+=x*Wt,vt+=x*Yt,At+=x*Kt,Et+=x*Gt,bt+=x*zt,wt+=x*br,_t+=x*Qt,ct+=x*pr,ft+=x*yr,it+=x*gr,lt+=x*Er,ht+=x*Vr,ot+=x*Fr,Be+=x*Hr,x=Y[7],st+=x*_e,mt+=x*qt,vt+=x*Wt,At+=x*Yt,Et+=x*Kt,bt+=x*Gt,wt+=x*zt,_t+=x*br,ct+=x*Qt,ft+=x*pr,it+=x*yr,lt+=x*gr,ht+=x*Er,ot+=x*Vr,Be+=x*Fr,Le+=x*Hr,x=Y[8],mt+=x*_e,vt+=x*qt,At+=x*Wt,Et+=x*Yt,bt+=x*Kt,wt+=x*Gt,_t+=x*zt,ct+=x*br,ft+=x*Qt,it+=x*pr,lt+=x*yr,ht+=x*gr,ot+=x*Er,Be+=x*Vr,Le+=x*Fr,Ye+=x*Hr,x=Y[9],vt+=x*_e,At+=x*qt,Et+=x*Wt,bt+=x*Yt,wt+=x*Kt,_t+=x*Gt,ct+=x*zt,ft+=x*br,it+=x*Qt,lt+=x*pr,ht+=x*yr,ot+=x*gr,Be+=x*Er,Le+=x*Vr,Ye+=x*Fr,ze+=x*Hr,x=Y[10],At+=x*_e,Et+=x*qt,bt+=x*Wt,wt+=x*Yt,_t+=x*Kt,ct+=x*Gt,ft+=x*zt,it+=x*br,lt+=x*Qt,ht+=x*pr,ot+=x*yr,Be+=x*gr,Le+=x*Er,Ye+=x*Vr,ze+=x*Fr,We+=x*Hr,x=Y[11],Et+=x*_e,bt+=x*qt,wt+=x*Wt,_t+=x*Yt,ct+=x*Kt,ft+=x*Gt,it+=x*zt,lt+=x*br,ht+=x*Qt,ot+=x*pr,Be+=x*yr,Le+=x*gr,Ye+=x*Er,ze+=x*Vr,We+=x*Fr,Ze+=x*Hr,x=Y[12],bt+=x*_e,wt+=x*qt,_t+=x*Wt,ct+=x*Yt,ft+=x*Kt,it+=x*Gt,lt+=x*zt,ht+=x*br,ot+=x*Qt,Be+=x*pr,Le+=x*yr,Ye+=x*gr,ze+=x*Er,We+=x*Vr,Ze+=x*Fr,St+=x*Hr,x=Y[13],wt+=x*_e,_t+=x*qt,ct+=x*Wt,ft+=x*Yt,it+=x*Kt,lt+=x*Gt,ht+=x*zt,ot+=x*br,Be+=x*Qt,Le+=x*pr,Ye+=x*yr,ze+=x*gr,We+=x*Er,Ze+=x*Vr,St+=x*Fr,xt+=x*Hr,x=Y[14],_t+=x*_e,ct+=x*qt,ft+=x*Wt,it+=x*Yt,lt+=x*Kt,ht+=x*Gt,ot+=x*zt,Be+=x*br,Le+=x*Qt,Ye+=x*pr,ze+=x*yr,We+=x*gr,Ze+=x*Er,St+=x*Vr,xt+=x*Fr,Bt+=x*Hr,x=Y[15],ct+=x*_e,ft+=x*qt,it+=x*Wt,lt+=x*Yt,ht+=x*Kt,ot+=x*Gt,Be+=x*zt,Le+=x*br,Ye+=x*Qt,ze+=x*pr,We+=x*yr,Ze+=x*gr,St+=x*Er,xt+=x*Vr,Bt+=x*Fr,Ut+=x*Hr,Ee+=38*ft,Ie+=38*it,De+=38*lt,Ge+=38*ht,ut+=38*ot,nt+=38*Be,Ct+=38*Le,st+=38*Ye,mt+=38*ze,vt+=38*We,At+=38*Ze,Et+=38*St,bt+=38*xt,wt+=38*Bt,_t+=38*Ut,ie=1,x=Ee+ie+65535,ie=Math.floor(x/65536),Ee=x-ie*65536,x=Ie+ie+65535,ie=Math.floor(x/65536),Ie=x-ie*65536,x=De+ie+65535,ie=Math.floor(x/65536),De=x-ie*65536,x=Ge+ie+65535,ie=Math.floor(x/65536),Ge=x-ie*65536,x=ut+ie+65535,ie=Math.floor(x/65536),ut=x-ie*65536,x=nt+ie+65535,ie=Math.floor(x/65536),nt=x-ie*65536,x=Ct+ie+65535,ie=Math.floor(x/65536),Ct=x-ie*65536,x=st+ie+65535,ie=Math.floor(x/65536),st=x-ie*65536,x=mt+ie+65535,ie=Math.floor(x/65536),mt=x-ie*65536,x=vt+ie+65535,ie=Math.floor(x/65536),vt=x-ie*65536,x=At+ie+65535,ie=Math.floor(x/65536),At=x-ie*65536,x=Et+ie+65535,ie=Math.floor(x/65536),Et=x-ie*65536,x=bt+ie+65535,ie=Math.floor(x/65536),bt=x-ie*65536,x=wt+ie+65535,ie=Math.floor(x/65536),wt=x-ie*65536,x=_t+ie+65535,ie=Math.floor(x/65536),_t=x-ie*65536,x=ct+ie+65535,ie=Math.floor(x/65536),ct=x-ie*65536,Ee+=ie-1+37*(ie-1),ie=1,x=Ee+ie+65535,ie=Math.floor(x/65536),Ee=x-ie*65536,x=Ie+ie+65535,ie=Math.floor(x/65536),Ie=x-ie*65536,x=De+ie+65535,ie=Math.floor(x/65536),De=x-ie*65536,x=Ge+ie+65535,ie=Math.floor(x/65536),Ge=x-ie*65536,x=ut+ie+65535,ie=Math.floor(x/65536),ut=x-ie*65536,x=nt+ie+65535,ie=Math.floor(x/65536),nt=x-ie*65536,x=Ct+ie+65535,ie=Math.floor(x/65536),Ct=x-ie*65536,x=st+ie+65535,ie=Math.floor(x/65536),st=x-ie*65536,x=mt+ie+65535,ie=Math.floor(x/65536),mt=x-ie*65536,x=vt+ie+65535,ie=Math.floor(x/65536),vt=x-ie*65536,x=At+ie+65535,ie=Math.floor(x/65536),At=x-ie*65536,x=Et+ie+65535,ie=Math.floor(x/65536),Et=x-ie*65536,x=bt+ie+65535,ie=Math.floor(x/65536),bt=x-ie*65536,x=wt+ie+65535,ie=Math.floor(x/65536),wt=x-ie*65536,x=_t+ie+65535,ie=Math.floor(x/65536),_t=x-ie*65536,x=ct+ie+65535,ie=Math.floor(x/65536),ct=x-ie*65536,Ee+=ie-1+37*(ie-1),K[0]=Ee,K[1]=Ie,K[2]=De,K[3]=Ge,K[4]=ut,K[5]=nt,K[6]=Ct,K[7]=st,K[8]=mt,K[9]=vt,K[10]=At,K[11]=Et,K[12]=bt,K[13]=wt,K[14]=_t,K[15]=ct}function ae(K,Y){H(K,Y,Y)}function V(K,Y){var J=r(),x;for(x=0;x<16;x++)J[x]=Y[x];for(x=253;x>=0;x--)ae(J,J),x!==2&&x!==4&&H(J,J,Y);for(x=0;x<16;x++)K[x]=J[x]}function U(K,Y){var J=r(),x;for(x=0;x<16;x++)J[x]=Y[x];for(x=250;x>=0;x--)ae(J,J),x!==1&&H(J,J,Y);for(x=0;x<16;x++)K[x]=J[x]}function te(K,Y,J){var x=new Uint8Array(32),ie=new Float64Array(80),Ee,Ie,De=r(),Ge=r(),ut=r(),nt=r(),Ct=r(),st=r();for(Ie=0;Ie<31;Ie++)x[Ie]=Y[Ie];for(x[31]=Y[31]&127|64,x[0]&=248,W(ie,J),Ie=0;Ie<16;Ie++)Ge[Ie]=ie[Ie],nt[Ie]=De[Ie]=ut[Ie]=0;for(De[0]=nt[0]=1,Ie=254;Ie>=0;--Ie)Ee=x[Ie>>>3]>>>(Ie&7)&1,L(De,Ge,Ee),L(ut,nt,Ee),re(Ct,De,ut),ue(De,De,ut),re(ut,Ge,nt),ue(Ge,Ge,nt),ae(nt,Ct),ae(st,De),H(De,ut,De),H(ut,Ge,Ct),re(Ct,De,ut),ue(De,De,ut),ae(Ge,De),ue(ut,nt,st),H(De,ut,f),re(De,De,nt),H(ut,ut,De),H(De,nt,st),H(nt,Ge,ie),ae(Ge,Ct),L(De,Ge,Ee),L(ut,nt,Ee);for(Ie=0;Ie<16;Ie++)ie[Ie+16]=De[Ie],ie[Ie+32]=ut[Ie],ie[Ie+48]=Ge[Ie],ie[Ie+64]=nt[Ie];var mt=ie.subarray(32),vt=ie.subarray(16);return V(mt,mt),H(vt,vt,mt),B(K,vt),0}function ge(K,Y){return te(K,Y,i)}function Pe(K,Y){return n(Y,32),ge(K,Y)}function Te(K,Y,J){var x=new Uint8Array(32);return te(x,J,Y),C(K,s,x,R)}var z=T,$=N;function F(K,Y,J,x,ie,Ee){var Ie=new Uint8Array(32);return Te(Ie,ie,Ee),z(K,Y,J,x,Ie)}function Q(K,Y,J,x,ie,Ee){var Ie=new Uint8Array(32);return Te(Ie,ie,Ee),$(K,Y,J,x,Ie)}var de=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function oe(K,Y,J,x){for(var ie=new Int32Array(16),Ee=new Int32Array(16),Ie,De,Ge,ut,nt,Ct,st,mt,vt,At,Et,bt,wt,_t,ct,ft,it,lt,ht,ot,Be,Le,Ye,ze,We,Ze,St=K[0],xt=K[1],Bt=K[2],Ut=K[3],_e=K[4],qt=K[5],Wt=K[6],Yt=K[7],Kt=Y[0],Gt=Y[1],zt=Y[2],br=Y[3],Qt=Y[4],pr=Y[5],yr=Y[6],gr=Y[7],Er=0;x>=128;){for(ht=0;ht<16;ht++)ot=8*ht+Er,ie[ht]=J[ot+0]<<24|J[ot+1]<<16|J[ot+2]<<8|J[ot+3],Ee[ht]=J[ot+4]<<24|J[ot+5]<<16|J[ot+6]<<8|J[ot+7];for(ht=0;ht<80;ht++)if(Ie=St,De=xt,Ge=Bt,ut=Ut,nt=_e,Ct=qt,st=Wt,mt=Yt,vt=Kt,At=Gt,Et=zt,bt=br,wt=Qt,_t=pr,ct=yr,ft=gr,Be=Yt,Le=gr,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=(_e>>>14|Qt<<32-14)^(_e>>>18|Qt<<32-18)^(Qt>>>41-32|_e<<32-(41-32)),Le=(Qt>>>14|_e<<32-14)^(Qt>>>18|_e<<32-18)^(_e>>>41-32|Qt<<32-(41-32)),Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,Be=_e&qt^~_e&Wt,Le=Qt&pr^~Qt&yr,Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,Be=de[ht*2],Le=de[ht*2+1],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,Be=ie[ht%16],Le=Ee[ht%16],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,it=We&65535|Ze<<16,lt=Ye&65535|ze<<16,Be=it,Le=lt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=(St>>>28|Kt<<32-28)^(Kt>>>34-32|St<<32-(34-32))^(Kt>>>39-32|St<<32-(39-32)),Le=(Kt>>>28|St<<32-28)^(St>>>34-32|Kt<<32-(34-32))^(St>>>39-32|Kt<<32-(39-32)),Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,Be=St&xt^St&Bt^xt&Bt,Le=Kt&Gt^Kt&zt^Gt&zt,Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,mt=We&65535|Ze<<16,ft=Ye&65535|ze<<16,Be=ut,Le=bt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=it,Le=lt,Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,ut=We&65535|Ze<<16,bt=Ye&65535|ze<<16,xt=Ie,Bt=De,Ut=Ge,_e=ut,qt=nt,Wt=Ct,Yt=st,St=mt,Gt=vt,zt=At,br=Et,Qt=bt,pr=wt,yr=_t,gr=ct,Kt=ft,ht%16===15)for(ot=0;ot<16;ot++)Be=ie[ot],Le=Ee[ot],Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=ie[(ot+9)%16],Le=Ee[(ot+9)%16],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,it=ie[(ot+1)%16],lt=Ee[(ot+1)%16],Be=(it>>>1|lt<<32-1)^(it>>>8|lt<<32-8)^it>>>7,Le=(lt>>>1|it<<32-1)^(lt>>>8|it<<32-8)^(lt>>>7|it<<32-7),Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,it=ie[(ot+14)%16],lt=Ee[(ot+14)%16],Be=(it>>>19|lt<<32-19)^(lt>>>61-32|it<<32-(61-32))^it>>>6,Le=(lt>>>19|it<<32-19)^(it>>>61-32|lt<<32-(61-32))^(lt>>>6|it<<32-6),Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,ie[ot]=We&65535|Ze<<16,Ee[ot]=Ye&65535|ze<<16;Be=St,Le=Kt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[0],Le=Y[0],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[0]=St=We&65535|Ze<<16,Y[0]=Kt=Ye&65535|ze<<16,Be=xt,Le=Gt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[1],Le=Y[1],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[1]=xt=We&65535|Ze<<16,Y[1]=Gt=Ye&65535|ze<<16,Be=Bt,Le=zt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[2],Le=Y[2],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[2]=Bt=We&65535|Ze<<16,Y[2]=zt=Ye&65535|ze<<16,Be=Ut,Le=br,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[3],Le=Y[3],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[3]=Ut=We&65535|Ze<<16,Y[3]=br=Ye&65535|ze<<16,Be=_e,Le=Qt,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[4],Le=Y[4],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[4]=_e=We&65535|Ze<<16,Y[4]=Qt=Ye&65535|ze<<16,Be=qt,Le=pr,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[5],Le=Y[5],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[5]=qt=We&65535|Ze<<16,Y[5]=pr=Ye&65535|ze<<16,Be=Wt,Le=yr,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[6],Le=Y[6],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[6]=Wt=We&65535|Ze<<16,Y[6]=yr=Ye&65535|ze<<16,Be=Yt,Le=gr,Ye=Le&65535,ze=Le>>>16,We=Be&65535,Ze=Be>>>16,Be=K[7],Le=Y[7],Ye+=Le&65535,ze+=Le>>>16,We+=Be&65535,Ze+=Be>>>16,ze+=Ye>>>16,We+=ze>>>16,Ze+=We>>>16,K[7]=Yt=We&65535|Ze<<16,Y[7]=gr=Ye&65535|ze<<16,Er+=128,x-=128}return x}function ne(K,Y,J){var x=new Int32Array(8),ie=new Int32Array(8),Ee=new Uint8Array(256),Ie,De=J;for(x[0]=1779033703,x[1]=3144134277,x[2]=1013904242,x[3]=2773480762,x[4]=1359893119,x[5]=2600822924,x[6]=528734635,x[7]=1541459225,ie[0]=4089235720,ie[1]=2227873595,ie[2]=4271175723,ie[3]=1595750129,ie[4]=2917565137,ie[5]=725511199,ie[6]=4215389547,ie[7]=327033209,oe(x,ie,Y,J),J%=128,Ie=0;Ie<J;Ie++)Ee[Ie]=Y[De-J+Ie];for(Ee[J]=128,J=256-128*(J<112?1:0),Ee[J-9]=0,h(Ee,J-8,De/536870912|0,De<<3),oe(x,ie,Ee,J),Ie=0;Ie<8;Ie++)h(K,8*Ie,x[Ie],ie[Ie]);return 0}function Fe(K,Y){var J=r(),x=r(),ie=r(),Ee=r(),Ie=r(),De=r(),Ge=r(),ut=r(),nt=r();ue(J,K[1],K[0]),ue(nt,Y[1],Y[0]),H(J,J,nt),re(x,K[0],K[1]),re(nt,Y[0],Y[1]),H(x,x,nt),H(ie,K[3],Y[3]),H(ie,ie,l),H(Ee,K[2],Y[2]),re(Ee,Ee,Ee),ue(Ie,x,J),ue(De,Ee,ie),re(Ge,Ee,ie),re(ut,x,J),H(K[0],Ie,De),H(K[1],ut,Ge),H(K[2],Ge,De),H(K[3],Ie,ut)}function je(K,Y,J){var x;for(x=0;x<4;x++)L(K[x],Y[x],J)}function He(K,Y){var J=r(),x=r(),ie=r();V(ie,Y[2]),H(J,Y[0],ie),H(x,Y[1],ie),B(K,x),K[31]^=q(J)<<7}function he(K,Y,J){var x,ie;for(D(K[0],o),D(K[1],a),D(K[2],a),D(K[3],o),ie=255;ie>=0;--ie)x=J[ie/8|0]>>(ie&7)&1,je(K,Y,x),Fe(Y,K),Fe(K,K),je(K,Y,x)}function ce(K,Y){var J=[r(),r(),r(),r()];D(J[0],u),D(J[1],p),D(J[2],a),H(J[3],u,p),he(K,J,Y)}function pe(K,Y,J){var x=new Uint8Array(64),ie=[r(),r(),r(),r()],Ee;for(J||n(Y,32),ne(x,Y,32),x[0]&=248,x[31]&=127,x[31]|=64,ce(ie,x),He(K,ie),Ee=0;Ee<32;Ee++)Y[Ee+32]=K[Ee];return 0}var le=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function fe(K,Y){var J,x,ie,Ee;for(x=63;x>=32;--x){for(J=0,ie=x-32,Ee=x-12;ie<Ee;++ie)Y[ie]+=J-16*Y[x]*le[ie-(x-32)],J=Math.floor((Y[ie]+128)/256),Y[ie]-=J*256;Y[ie]+=J,Y[x]=0}for(J=0,ie=0;ie<32;ie++)Y[ie]+=J-(Y[31]>>4)*le[ie],J=Y[ie]>>8,Y[ie]&=255;for(ie=0;ie<32;ie++)Y[ie]-=J*le[ie];for(x=0;x<32;x++)Y[x+1]+=Y[x]>>8,K[x]=Y[x]&255}function ye(K){var Y=new Float64Array(64),J;for(J=0;J<64;J++)Y[J]=K[J];for(J=0;J<64;J++)K[J]=0;fe(K,Y)}function ee(K,Y,J,x){var ie=new Uint8Array(64),Ee=new Uint8Array(64),Ie=new Uint8Array(64),De,Ge,ut=new Float64Array(64),nt=[r(),r(),r(),r()];ne(ie,x,32),ie[0]&=248,ie[31]&=127,ie[31]|=64;var Ct=J+64;for(De=0;De<J;De++)K[64+De]=Y[De];for(De=0;De<32;De++)K[32+De]=ie[32+De];for(ne(Ie,K.subarray(32),J+32),ye(Ie),ce(nt,Ie),He(K,nt),De=32;De<64;De++)K[De]=x[De];for(ne(Ee,K,J+64),ye(Ee),De=0;De<64;De++)ut[De]=0;for(De=0;De<32;De++)ut[De]=Ie[De];for(De=0;De<32;De++)for(Ge=0;Ge<32;Ge++)ut[De+Ge]+=Ee[De]*ie[Ge];return fe(K.subarray(32),ut),Ct}function Z(K,Y){var J=r(),x=r(),ie=r(),Ee=r(),Ie=r(),De=r(),Ge=r();return D(K[2],a),W(K[1],Y),ae(ie,K[1]),H(Ee,ie,c),ue(ie,ie,K[2]),re(Ee,K[2],Ee),ae(Ie,Ee),ae(De,Ie),H(Ge,De,Ie),H(J,Ge,ie),H(J,J,Ee),U(J,J),H(J,J,ie),H(J,J,Ee),H(J,J,Ee),H(K[0],J,Ee),ae(x,K[0]),H(x,x,Ee),k(x,ie)&&H(K[0],K[0],d),ae(x,K[0]),H(x,x,Ee),k(x,ie)?-1:(q(K[0])===Y[31]>>7&&ue(K[0],o,K[0]),H(K[3],K[0],K[1]),0)}function $e(K,Y,J,x){var ie,Ee=new Uint8Array(32),Ie=new Uint8Array(64),De=[r(),r(),r(),r()],Ge=[r(),r(),r(),r()];if(J<64||Z(Ge,x))return-1;for(ie=0;ie<J;ie++)K[ie]=Y[ie];for(ie=0;ie<32;ie++)K[ie+32]=x[ie];if(ne(Ie,K,J),ye(Ie),he(De,Ge,Ie),ce(Ge,Y.subarray(32)),Fe(De,Ge),He(Ee,De),J-=64,m(Y,0,Ee,0)){for(ie=0;ie<J;ie++)K[ie]=0;return-1}for(ie=0;ie<J;ie++)K[ie]=Y[ie+64];return J}var Ve=32,Qe=24,dt=32,rt=16,ve=32,G=32,se=32,me=32,Se=32,Ae=Qe,ke=dt,Ne=rt,xe=64,Re=32,Me=64,et=32,we=64;t.lowlevel={crypto_core_hsalsa20:C,crypto_stream_xor:I,crypto_stream:A,crypto_stream_salsa20_xor:M,crypto_stream_salsa20:_,crypto_onetimeauth:v,crypto_onetimeauth_verify:S,crypto_verify_16:g,crypto_verify_32:m,crypto_secretbox:T,crypto_secretbox_open:N,crypto_scalarmult:te,crypto_scalarmult_base:ge,crypto_box_beforenm:Te,crypto_box_afternm:z,crypto_box:F,crypto_box_open:Q,crypto_box_keypair:Pe,crypto_hash:ne,crypto_sign:ee,crypto_sign_keypair:pe,crypto_sign_open:$e,crypto_secretbox_KEYBYTES:Ve,crypto_secretbox_NONCEBYTES:Qe,crypto_secretbox_ZEROBYTES:dt,crypto_secretbox_BOXZEROBYTES:rt,crypto_scalarmult_BYTES:ve,crypto_scalarmult_SCALARBYTES:G,crypto_box_PUBLICKEYBYTES:se,crypto_box_SECRETKEYBYTES:me,crypto_box_BEFORENMBYTES:Se,crypto_box_NONCEBYTES:Ae,crypto_box_ZEROBYTES:ke,crypto_box_BOXZEROBYTES:Ne,crypto_sign_BYTES:xe,crypto_sign_PUBLICKEYBYTES:Re,crypto_sign_SECRETKEYBYTES:Me,crypto_sign_SEEDBYTES:et,crypto_hash_BYTES:we,gf:r,D:c,L:le,pack25519:B,unpack25519:W,M:H,A:re,S:ae,Z:ue,pow2523:U,add:Fe,set25519:D,modL:fe,scalarmult:he,scalarbase:ce};function Ce(K,Y){if(K.length!==Ve)throw new Error("bad key size");if(Y.length!==Qe)throw new Error("bad nonce size")}function Oe(K,Y){if(K.length!==se)throw new Error("bad public key size");if(Y.length!==me)throw new Error("bad secret key size")}function Ue(){for(var K=0;K<arguments.length;K++)if(!(arguments[K]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function qe(K){for(var Y=0;Y<K.length;Y++)K[Y]=0}t.randomBytes=function(K){var Y=new Uint8Array(K);return n(Y,K),Y},t.secretbox=function(K,Y,J){Ue(K,Y,J),Ce(J,Y);for(var x=new Uint8Array(dt+K.length),ie=new Uint8Array(x.length),Ee=0;Ee<K.length;Ee++)x[Ee+dt]=K[Ee];return T(ie,x,x.length,Y,J),ie.subarray(rt)},t.secretbox.open=function(K,Y,J){Ue(K,Y,J),Ce(J,Y);for(var x=new Uint8Array(rt+K.length),ie=new Uint8Array(x.length),Ee=0;Ee<K.length;Ee++)x[Ee+rt]=K[Ee];return x.length<32||N(ie,x,x.length,Y,J)!==0?null:ie.subarray(dt)},t.secretbox.keyLength=Ve,t.secretbox.nonceLength=Qe,t.secretbox.overheadLength=rt,t.scalarMult=function(K,Y){if(Ue(K,Y),K.length!==G)throw new Error("bad n size");if(Y.length!==ve)throw new Error("bad p size");var J=new Uint8Array(ve);return te(J,K,Y),J},t.scalarMult.base=function(K){if(Ue(K),K.length!==G)throw new Error("bad n size");var Y=new Uint8Array(ve);return ge(Y,K),Y},t.scalarMult.scalarLength=G,t.scalarMult.groupElementLength=ve,t.box=function(K,Y,J,x){var ie=t.box.before(J,x);return t.secretbox(K,Y,ie)},t.box.before=function(K,Y){Ue(K,Y),Oe(K,Y);var J=new Uint8Array(Se);return Te(J,K,Y),J},t.box.after=t.secretbox,t.box.open=function(K,Y,J,x){var ie=t.box.before(J,x);return t.secretbox.open(K,Y,ie)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var K=new Uint8Array(se),Y=new Uint8Array(me);return Pe(K,Y),{publicKey:K,secretKey:Y}},t.box.keyPair.fromSecretKey=function(K){if(Ue(K),K.length!==me)throw new Error("bad secret key size");var Y=new Uint8Array(se);return ge(Y,K),{publicKey:Y,secretKey:new Uint8Array(K)}},t.box.publicKeyLength=se,t.box.secretKeyLength=me,t.box.sharedKeyLength=Se,t.box.nonceLength=Ae,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(K,Y){if(Ue(K,Y),Y.length!==Me)throw new Error("bad secret key size");var J=new Uint8Array(xe+K.length);return ee(J,K,K.length,Y),J},t.sign.open=function(K,Y){if(Ue(K,Y),Y.length!==Re)throw new Error("bad public key size");var J=new Uint8Array(K.length),x=$e(J,K,K.length,Y);if(x<0)return null;for(var ie=new Uint8Array(x),Ee=0;Ee<ie.length;Ee++)ie[Ee]=J[Ee];return ie},t.sign.detached=function(K,Y){for(var J=t.sign(K,Y),x=new Uint8Array(xe),ie=0;ie<x.length;ie++)x[ie]=J[ie];return x},t.sign.detached.verify=function(K,Y,J){if(Ue(K,Y,J),Y.length!==xe)throw new Error("bad signature size");if(J.length!==Re)throw new Error("bad public key size");var x=new Uint8Array(xe+K.length),ie=new Uint8Array(xe+K.length),Ee;for(Ee=0;Ee<xe;Ee++)x[Ee]=Y[Ee];for(Ee=0;Ee<K.length;Ee++)x[Ee+xe]=K[Ee];return $e(ie,x,x.length,J)>=0},t.sign.keyPair=function(){var K=new Uint8Array(Re),Y=new Uint8Array(Me);return pe(K,Y),{publicKey:K,secretKey:Y}},t.sign.keyPair.fromSecretKey=function(K){if(Ue(K),K.length!==Me)throw new Error("bad secret key size");for(var Y=new Uint8Array(Re),J=0;J<Y.length;J++)Y[J]=K[32+J];return{publicKey:Y,secretKey:new Uint8Array(K)}},t.sign.keyPair.fromSeed=function(K){if(Ue(K),K.length!==et)throw new Error("bad seed size");for(var Y=new Uint8Array(Re),J=new Uint8Array(Me),x=0;x<32;x++)J[x]=K[x];return pe(Y,J,!0),{publicKey:Y,secretKey:J}},t.sign.publicKeyLength=Re,t.sign.secretKeyLength=Me,t.sign.seedLength=et,t.sign.signatureLength=xe,t.hash=function(K){Ue(K);var Y=new Uint8Array(we);return ne(Y,K,K.length),Y},t.hash.hashLength=we,t.verify=function(K,Y){return Ue(K,Y),K.length===0||Y.length===0||K.length!==Y.length?!1:y(K,0,Y,0,K.length)===0},t.setPRNG=function(K){n=K},function(){var K=typeof self<"u"?self.crypto||self.msCrypto:null;if(K&&K.getRandomValues){var Y=65536;t.setPRNG(function(J,x){var ie,Ee=new Uint8Array(x);for(ie=0;ie<x;ie+=Y)K.getRandomValues(Ee.subarray(ie,ie+Math.min(x-ie,Y)));for(ie=0;ie<x;ie++)J[ie]=Ee[ie];qe(Ee)})}else typeof nf<"u"&&(K=Wa,K&&K.randomBytes&&t.setPRNG(function(J,x){var ie,Ee=K.randomBytes(x);for(ie=0;ie<x;ie++)J[ie]=Ee[ie];qe(Ee)}))}()})(e.exports?e.exports:self.nacl=self.nacl||{})}(w1)),w1.exports}var E1={exports:{}},Xv;function sR(){return Xv||(Xv=1,function(e){(function(t,r){e.exports?e.exports=r():(t.nacl||(t.nacl={}),t.nacl.util=r())})(It,function(){var t={};function r(n){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(n))throw new TypeError("invalid encoding")}return t.decodeUTF8=function(n){if(typeof n!="string")throw new TypeError("expected string");var s,i=unescape(encodeURIComponent(n)),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o},t.encodeUTF8=function(n){var s,i=[];for(s=0;s<n.length;s++)i.push(String.fromCharCode(n[s]));return decodeURIComponent(escape(i.join("")))},typeof atob>"u"?typeof at.from<"u"?(t.encodeBase64=function(n){return at.from(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(at.from(n,"base64"),0))}):(t.encodeBase64=function(n){return new at(n).toString("base64")},t.decodeBase64=function(n){return r(n),new Uint8Array(Array.prototype.slice.call(new at(n,"base64"),0))}):(t.encodeBase64=function(n){var s,i=[],o=n.length;for(s=0;s<o;s++)i.push(String.fromCharCode(n[s]));return btoa(i.join(""))},t.decodeBase64=function(n){r(n);var s,i=atob(n),o=new Uint8Array(i.length);for(s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}),t})}(E1)),E1.exports}var Qv;function aR(){if(Qv)return vn;Qv=1;var e=It&&It.__createBinding||(Object.create?function(p,d,h,y){y===void 0&&(y=h);var g=Object.getOwnPropertyDescriptor(d,h);(!g||("get"in g?!d.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return d[h]}}),Object.defineProperty(p,y,g)}:function(p,d,h,y){y===void 0&&(y=h),p[y]=d[h]}),t=It&&It.__setModuleDefault||(Object.create?function(p,d){Object.defineProperty(p,"default",{enumerable:!0,value:d})}:function(p,d){p.default=d}),r=It&&It.__importStar||function(p){if(p&&p.__esModule)return p;var d={};if(p!=null)for(var h in p)h!=="default"&&Object.prototype.hasOwnProperty.call(p,h)&&e(d,p,h);return t(d,p),d};Object.defineProperty(vn,"__esModule",{value:!0}),vn.getEncryptionPublicKey=vn.decryptSafely=vn.decrypt=vn.encryptSafely=vn.encrypt=void 0;const n=r(iR()),s=r(sR()),i=Ul();function o({publicKey:p,data:d,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(d))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");switch(h){case"x25519-xsalsa20-poly1305":{if(typeof d!="string")throw new Error("Message data must be given as a string");const y=n.box.keyPair();let g;try{g=s.decodeBase64(p)}catch{throw new Error("Bad public key")}const m=s.decodeUTF8(d),b=n.randomBytes(n.box.nonceLength),w=n.box(m,b,g,y.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:s.encodeBase64(b),ephemPublicKey:s.encodeBase64(y.publicKey),ciphertext:s.encodeBase64(w)}}default:throw new Error("Encryption type/version not supported")}}vn.encrypt=o;function a({publicKey:p,data:d,version:h}){if((0,i.isNullish)(p))throw new Error("Missing publicKey parameter");if((0,i.isNullish)(d))throw new Error("Missing data parameter");if((0,i.isNullish)(h))throw new Error("Missing version parameter");const y=2**11,g=16;if(typeof d=="object"&&d&&"toJSON"in d)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const m={data:d,padding:""},w=at.byteLength(JSON.stringify(m),"utf-8")%y;let E=0;w>0&&(E=y-w-g),m.padding="0".repeat(E);const C=JSON.stringify(m);return o({publicKey:p,data:C,version:h})}vn.encryptSafely=a;function f({encryptedData:p,privateKey:d}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(d))throw new Error("Missing privateKey parameter");switch(p.version){case"x25519-xsalsa20-poly1305":{const h=u(d),y=n.box.keyPair.fromSecretKey(h).secretKey,g=s.decodeBase64(p.nonce),m=s.decodeBase64(p.ciphertext),b=s.decodeBase64(p.ephemPublicKey),w=n.box.open(m,g,b,y);try{if(!w)throw new Error;const E=s.encodeUTF8(w);if(!E)throw new Error;return E}catch(E){throw E&&typeof E.message=="string"&&E.message.length?new Error(`Decryption failed: ${E.message}`):new Error("Decryption failed.")}}default:throw new Error("Encryption type/version not supported.")}}vn.decrypt=f;function c({encryptedData:p,privateKey:d}){if((0,i.isNullish)(p))throw new Error("Missing encryptedData parameter");if((0,i.isNullish)(d))throw new Error("Missing privateKey parameter");return JSON.parse(f({encryptedData:p,privateKey:d})).data}vn.decryptSafely=c;function l(p){const d=u(p),h=n.box.keyPair.fromSecretKey(d).publicKey;return s.encodeBase64(h)}vn.getEncryptionPublicKey=l;function u(p){const d=at.from(p,"hex").toString("base64");return s.decodeBase64(d)}return vn}var eb;function Py(){return eb||(eb=1,function(e){var t=It&&It.__createBinding||(Object.create?function(s,i,o,a){a===void 0&&(a=o);var f=Object.getOwnPropertyDescriptor(i,o);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(s,a,f)}:function(s,i,o,a){a===void 0&&(a=o),s[a]=i[o]}),r=It&&It.__exportStar||function(s,i){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(eR(),e),r(nR(),e),r(aR(),e);var n=Ul();Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(s1)),s1}var tb;function M9(){return tb||(tb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.verifyProfileSignature=e.getTypedData=e.getTypeInformation=e.getDomainInformation=void 0;const t=Ke,r=Py(),n=ya,s=f=>({name:"PUSH CHAT ID",chainId:f,verifyingContract:"0x0000000000000000000000000000000000000000"});e.getDomainInformation=s;const i=()=>({Data:[{name:"data",type:"string"}]});e.getTypeInformation=i;const o=(f,c,l)=>{const u={data:f},p=(0,e.getTypeInformation)(),d=(0,e.getDomainInformation)(c),h="Data";let y,g={};return l==="V1"?y={EIP712Domain:[],Data:p.Data}:(y={EIP712Domain:[{name:"name",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Data:p.Data},g=d),{types:y,primaryType:h,domain:g,message:u}};e.getTypedData=o;const a=(f,c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const u="eip712v2",p="eip191",d="eip191v2";let h=null,y;const g=f.split(":")[0];if(g!==u&&g!==p&&g!==d||f.split(":").length>3)return!1;if(f.split(":").length===2?y=f.split(":")[1]:(h=parseInt(f.split(":")[1]),y=f.split(":")[2]),g===u)try{const m=(0,e.getTypedData)(c,h,"V2");return(0,r.recoverTypedSignature)({data:m,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}catch{const b=(0,e.getTypedData)(c,h,"V1");return(0,r.recoverTypedSignature)({data:b,signature:y,version:r.SignTypedDataVersion.V4}).toLowerCase()===l.toLowerCase()}else try{return(yield n.recoverAddress({hash:n.hashMessage(c),signature:y})).toLowerCase()===l.toLowerCase()}catch{return!1}});e.verifyProfileSignature=a}(i1)),i1}var A1={},rb;function oR(){return rb||(rb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getEncryptedSecret=void 0;const t=Ke,r=ho(),n=Je(),s=tt(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{sessionKey:a,env:f=n.default.ENV.PROD}=o||{};try{if(a==null)throw new Error("sessionKey is required");const l=`${(0,s.getAPIBaseUrls)(f)}/v1/chat/encryptedsecret/sessionKey/${a}`;return r.default.get(l).then(u=>u.data.encryptedSecret).catch(u=>{var p,d;throw!((p=u==null?void 0:u.response)===null||p===void 0)&&p.data?new Error((d=u==null?void 0:u.response)===null||d===void 0?void 0:d.data):new Error(u)})}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getEncryptedSecret.name} -: ${c}`)}});e.getEncryptedSecret=i}(A1)),A1}var S1={},Fn={},P1={},nb;function cR(){return nb||(nb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HttpStatus=void 0,function(t){t[t.BadRequest=400]="BadRequest",t[t.NotFound=404]="NotFound",t[t.Forbidden=403]="Forbidden",t[t.InternalError=500]="InternalError"}(e.HttpStatus||(e.HttpStatus={}))}(P1)),P1}var ib;function Xt(){if(ib)return Fn;ib=1,Object.defineProperty(Fn,"__esModule",{value:!0}),Fn.handleError=Fn.isErrorWithResponseV2=Fn.isErrorWithResponse=Fn.ValidationError=void 0;const e=cR();class t extends Error{constructor(o,a,f,c){super(f),this.name="ValidationError",this.status=o,this.errorCode=a,this.details=c}format(){return{status:this.status,errorCode:this.errorCode,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}Fn.ValidationError=t;function r(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"status"in i.response.data&&"errorCode"in i.response.data&&"message"in i.response.data&&"details"in i.response.data&&"timestamp"in i.response.data}Fn.isErrorWithResponse=r;function n(i){return typeof i=="object"&&i!==null&&"response"in i&&typeof i.response=="object"&&i.response!==null&&"status"in i.response&&"data"in i.response&&typeof i.response.data=="object"&&"error"in i.response.data&&"message"in i.response.data&&"validation"in i.response.data}Fn.isErrorWithResponseV2=n;function s(i,o){var a,f,c;let l=e.HttpStatus.InternalError,u="00000000000",p="An unexpected error occurred. Please contact support or try again later.",d="";if(r(i)){if(l=((a=i.response)===null||a===void 0?void 0:a.status)||e.HttpStatus.InternalError,!((f=i.response)===null||f===void 0)&&f.data){const g=i.response.data;u=g.errorCode||u,p=g.message||p,d=g.details||JSON.stringify(g)}}else if(n(i)){l=((c=i.response)===null||c===void 0?void 0:c.status)||e.HttpStatus.InternalError;const g=i.response.data;p=g.message||p,d=g.validation||JSON.stringify(g)}else i instanceof Error&&(p=i.message,d=i.stack||"");const h=new t(l,u,p,d),y=`[Error - API ${o}]`;return console.error(`${y} ${JSON.stringify(h.format(),null,2)}`),h}return Fn.handleError=s,Fn}var sb;function Bl(){return sb||(sb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroup=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=n.default.ENV.PROD}=a||{};try{if(f==null||f.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups/${f}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroup.name)}});e.getGroup=o}(S1)),S1}var Ko={},jo={},ab;function uR(){var p,d,y,g,m,b,w,E,C,R,M,_,A,I,P,v,S,T,N,D,O,L,B,k,q,W,Ty,ue,H,ae,V,U,O9,ge,Pe,Te,z,ps,F,ys,de,Iy,ne,Fe,tf,He,rf,ce,ar,le,Cy,ye,Fu,Z,gs,Ve,Ry;if(ab)return jo;ab=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.LRUCache=void 0;const e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t=new Set,r=typeof Cr=="object"&&Cr?Cr:{},n=(rt,ve,G,se)=>{typeof r.emitWarning=="function"?r.emitWarning(rt,ve,G,se):console.error(`[${G}] ${ve}: ${rt}`)};let s=globalThis.AbortController,i=globalThis.AbortSignal;if(typeof s>"u"){i=class{constructor(){cr(this,"onabort");cr(this,"_onabort",[]);cr(this,"reason");cr(this,"aborted",!1)}addEventListener(se,me){this._onabort.push(me)}},s=class{constructor(){cr(this,"signal",new i);ve()}abort(se){var me,Se;if(!this.signal.aborted){this.signal.reason=se,this.signal.aborted=!0;for(const Ae of this.signal._onabort)Ae(se);(Se=(me=this.signal).onabort)==null||Se.call(me,se)}}};let rt=((p=r.env)==null?void 0:p.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const ve=()=>{rt&&(rt=!1,n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",ve))}}const o=rt=>!t.has(rt),a=rt=>rt&&rt===Math.floor(rt)&&rt>0&&isFinite(rt),f=rt=>a(rt)?rt<=Math.pow(2,8)?Uint8Array:rt<=Math.pow(2,16)?Uint16Array:rt<=Math.pow(2,32)?Uint32Array:rt<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(ve){super(ve),this.fill(0)}}const h=class h{constructor(ve,G){cr(this,"heap");cr(this,"length");if(!be(h,d))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new G(ve),this.length=0}static create(ve){const G=f(ve);if(!G)return[];Pt(h,d,!0);const se=new h(ve,G);return Pt(h,d,!1),se}push(ve){this.heap[this.length++]=ve}pop(){return this.heap[--this.length]}};d=new WeakMap,Ot(h,d,!1);let l=h;const dt=class dt{constructor(ve){Ot(this,W);Ot(this,U);Ot(this,z);Ot(this,F);Ot(this,de);Ot(this,Fe);Ot(this,He);Ot(this,ce);Ot(this,le);Ot(this,ye);Ot(this,Z);Ot(this,Ve);Ot(this,y,void 0);Ot(this,g,void 0);Ot(this,m,void 0);Ot(this,b,void 0);Ot(this,w,void 0);Ot(this,E,void 0);cr(this,"ttl");cr(this,"ttlResolution");cr(this,"ttlAutopurge");cr(this,"updateAgeOnGet");cr(this,"updateAgeOnHas");cr(this,"allowStale");cr(this,"noDisposeOnSet");cr(this,"noUpdateTTL");cr(this,"maxEntrySize");cr(this,"sizeCalculation");cr(this,"noDeleteOnFetchRejection");cr(this,"noDeleteOnStaleGet");cr(this,"allowStaleOnFetchAbort");cr(this,"allowStaleOnFetchRejection");cr(this,"ignoreFetchAbort");Ot(this,C,void 0);Ot(this,R,void 0);Ot(this,M,void 0);Ot(this,_,void 0);Ot(this,A,void 0);Ot(this,I,void 0);Ot(this,P,void 0);Ot(this,v,void 0);Ot(this,S,void 0);Ot(this,T,void 0);Ot(this,N,void 0);Ot(this,D,void 0);Ot(this,O,void 0);Ot(this,L,void 0);Ot(this,B,void 0);Ot(this,k,void 0);Ot(this,q,void 0);Ot(this,ue,()=>{});Ot(this,H,()=>{});Ot(this,ae,()=>{});Ot(this,V,()=>!1);Ot(this,ge,ve=>{});Ot(this,Pe,(ve,G,se)=>{});Ot(this,Te,(ve,G,se,me)=>{if(se||me)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});cr(this,ne,"LRUCache");const{max:G=0,ttl:se,ttlResolution:me=1,ttlAutopurge:Se,updateAgeOnGet:Ae,updateAgeOnHas:ke,allowStale:Ne,dispose:xe,disposeAfter:Re,noDisposeOnSet:Me,noUpdateTTL:et,maxSize:we=0,maxEntrySize:Ce=0,sizeCalculation:Oe,fetchMethod:Ue,memoMethod:qe,noDeleteOnFetchRejection:K,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:J,allowStaleOnFetchAbort:x,ignoreFetchAbort:ie}=ve;if(G!==0&&!a(G))throw new TypeError("max option must be a nonnegative integer");const Ee=G?f(G):Array;if(!Ee)throw new Error("invalid max value: "+G);if(Pt(this,y,G),Pt(this,g,we),this.maxEntrySize=Ce||be(this,g),this.sizeCalculation=Oe,this.sizeCalculation){if(!be(this,g)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(qe!==void 0&&typeof qe!="function")throw new TypeError("memoMethod must be a function if defined");if(Pt(this,E,qe),Ue!==void 0&&typeof Ue!="function")throw new TypeError("fetchMethod must be a function if specified");if(Pt(this,w,Ue),Pt(this,k,!!Ue),Pt(this,M,new Map),Pt(this,_,new Array(G).fill(void 0)),Pt(this,A,new Array(G).fill(void 0)),Pt(this,I,new Ee(G)),Pt(this,P,new Ee(G)),Pt(this,v,0),Pt(this,S,0),Pt(this,T,l.create(G)),Pt(this,C,0),Pt(this,R,0),typeof xe=="function"&&Pt(this,m,xe),typeof Re=="function"?(Pt(this,b,Re),Pt(this,N,[])):(Pt(this,b,void 0),Pt(this,N,void 0)),Pt(this,B,!!be(this,m)),Pt(this,q,!!be(this,b)),this.noDisposeOnSet=!!Me,this.noUpdateTTL=!!et,this.noDeleteOnFetchRejection=!!K,this.allowStaleOnFetchRejection=!!J,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!ie,this.maxEntrySize!==0){if(be(this,g)!==0&&!a(be(this,g)))throw new TypeError("maxSize must be a positive integer if specified");if(!a(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");gt(this,U,O9).call(this)}if(this.allowStale=!!Ne,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!Ae,this.updateAgeOnHas=!!ke,this.ttlResolution=a(me)||me===0?me:1,this.ttlAutopurge=!!Se,this.ttl=se||0,this.ttl){if(!a(this.ttl))throw new TypeError("ttl must be a positive integer if specified");gt(this,W,Ty).call(this)}if(be(this,y)===0&&this.ttl===0&&be(this,g)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!be(this,y)&&!be(this,g)){const Ie="LRU_CACHE_UNBOUNDED";o(Ie)&&(t.add(Ie),n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ie,dt))}}static unsafeExposeInternals(ve){return{starts:be(ve,O),ttls:be(ve,L),sizes:be(ve,D),keyMap:be(ve,M),keyList:be(ve,_),valList:be(ve,A),next:be(ve,I),prev:be(ve,P),get head(){return be(ve,v)},get tail(){return be(ve,S)},free:be(ve,T),isBackgroundFetch:G=>{var se;return gt(se=ve,ce,ar).call(se,G)},backgroundFetch:(G,se,me,Se)=>{var Ae;return gt(Ae=ve,He,rf).call(Ae,G,se,me,Se)},moveToTail:G=>{var se;return gt(se=ve,ye,Fu).call(se,G)},indexes:G=>{var se;return gt(se=ve,z,ps).call(se,G)},rindexes:G=>{var se;return gt(se=ve,F,ys).call(se,G)},isStale:G=>{var se;return be(se=ve,V).call(se,G)}}}get max(){return be(this,y)}get maxSize(){return be(this,g)}get calculatedSize(){return be(this,R)}get size(){return be(this,C)}get fetchMethod(){return be(this,w)}get memoMethod(){return be(this,E)}get dispose(){return be(this,m)}get disposeAfter(){return be(this,b)}getRemainingTTL(ve){return be(this,M).has(ve)?1/0:0}*entries(){for(const ve of gt(this,z,ps).call(this))be(this,A)[ve]!==void 0&&be(this,_)[ve]!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield[be(this,_)[ve],be(this,A)[ve]])}*rentries(){for(const ve of gt(this,F,ys).call(this))be(this,A)[ve]!==void 0&&be(this,_)[ve]!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield[be(this,_)[ve],be(this,A)[ve]])}*keys(){for(const ve of gt(this,z,ps).call(this)){const G=be(this,_)[ve];G!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield G)}}*rkeys(){for(const ve of gt(this,F,ys).call(this)){const G=be(this,_)[ve];G!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield G)}}*values(){for(const ve of gt(this,z,ps).call(this))be(this,A)[ve]!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield be(this,A)[ve])}*rvalues(){for(const ve of gt(this,F,ys).call(this))be(this,A)[ve]!==void 0&&!gt(this,ce,ar).call(this,be(this,A)[ve])&&(yield be(this,A)[ve])}[Symbol.iterator](){return this.entries()}find(ve,G={}){for(const se of gt(this,z,ps).call(this)){const me=be(this,A)[se],Se=gt(this,ce,ar).call(this,me)?me.__staleWhileFetching:me;if(Se!==void 0&&ve(Se,be(this,_)[se],this))return this.get(be(this,_)[se],G)}}forEach(ve,G=this){for(const se of gt(this,z,ps).call(this)){const me=be(this,A)[se],Se=gt(this,ce,ar).call(this,me)?me.__staleWhileFetching:me;Se!==void 0&&ve.call(G,Se,be(this,_)[se],this)}}rforEach(ve,G=this){for(const se of gt(this,F,ys).call(this)){const me=be(this,A)[se],Se=gt(this,ce,ar).call(this,me)?me.__staleWhileFetching:me;Se!==void 0&&ve.call(G,Se,be(this,_)[se],this)}}purgeStale(){let ve=!1;for(const G of gt(this,F,ys).call(this,{allowStale:!0}))be(this,V).call(this,G)&&(gt(this,Z,gs).call(this,be(this,_)[G],"expire"),ve=!0);return ve}info(ve){const G=be(this,M).get(ve);if(G===void 0)return;const se=be(this,A)[G],me=gt(this,ce,ar).call(this,se)?se.__staleWhileFetching:se;if(me===void 0)return;const Se={value:me};if(be(this,L)&&be(this,O)){const Ae=be(this,L)[G],ke=be(this,O)[G];if(Ae&&ke){const Ne=Ae-(e.now()-ke);Se.ttl=Ne,Se.start=Date.now()}}return be(this,D)&&(Se.size=be(this,D)[G]),Se}dump(){const ve=[];for(const G of gt(this,z,ps).call(this,{allowStale:!0})){const se=be(this,_)[G],me=be(this,A)[G],Se=gt(this,ce,ar).call(this,me)?me.__staleWhileFetching:me;if(Se===void 0||se===void 0)continue;const Ae={value:Se};if(be(this,L)&&be(this,O)){Ae.ttl=be(this,L)[G];const ke=e.now()-be(this,O)[G];Ae.start=Math.floor(Date.now()-ke)}be(this,D)&&(Ae.size=be(this,D)[G]),ve.unshift([se,Ae])}return ve}load(ve){this.clear();for(const[G,se]of ve){if(se.start){const me=Date.now()-se.start;se.start=e.now()-me}this.set(G,se.value,se)}}set(ve,G,se={}){var et,we,Ce,Oe,Ue;if(G===void 0)return this.delete(ve),this;const{ttl:me=this.ttl,start:Se,noDisposeOnSet:Ae=this.noDisposeOnSet,sizeCalculation:ke=this.sizeCalculation,status:Ne}=se;let{noUpdateTTL:xe=this.noUpdateTTL}=se;const Re=be(this,Te).call(this,ve,G,se.size||0,ke);if(this.maxEntrySize&&Re>this.maxEntrySize)return Ne&&(Ne.set="miss",Ne.maxEntrySizeExceeded=!0),gt(this,Z,gs).call(this,ve,"set"),this;let Me=be(this,C)===0?void 0:be(this,M).get(ve);if(Me===void 0)Me=be(this,C)===0?be(this,S):be(this,T).length!==0?be(this,T).pop():be(this,C)===be(this,y)?gt(this,Fe,tf).call(this,!1):be(this,C),be(this,_)[Me]=ve,be(this,A)[Me]=G,be(this,M).set(ve,Me),be(this,I)[be(this,S)]=Me,be(this,P)[Me]=be(this,S),Pt(this,S,Me),Hl(this,C)._++,be(this,Pe).call(this,Me,Re,Ne),Ne&&(Ne.set="add"),xe=!1;else{gt(this,ye,Fu).call(this,Me);const qe=be(this,A)[Me];if(G!==qe){if(be(this,k)&&gt(this,ce,ar).call(this,qe)){qe.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:K}=qe;K!==void 0&&!Ae&&(be(this,B)&&((et=be(this,m))==null||et.call(this,K,ve,"set")),be(this,q)&&((we=be(this,N))==null||we.push([K,ve,"set"])))}else Ae||(be(this,B)&&((Ce=be(this,m))==null||Ce.call(this,qe,ve,"set")),be(this,q)&&((Oe=be(this,N))==null||Oe.push([qe,ve,"set"])));if(be(this,ge).call(this,Me),be(this,Pe).call(this,Me,Re,Ne),be(this,A)[Me]=G,Ne){Ne.set="replace";const K=qe&&gt(this,ce,ar).call(this,qe)?qe.__staleWhileFetching:qe;K!==void 0&&(Ne.oldValue=K)}}else Ne&&(Ne.set="update")}if(me!==0&&!be(this,L)&&gt(this,W,Ty).call(this),be(this,L)&&(xe||be(this,ae).call(this,Me,me,Se),Ne&&be(this,H).call(this,Ne,Me)),!Ae&&be(this,q)&&be(this,N)){const qe=be(this,N);let K;for(;K=qe==null?void 0:qe.shift();)(Ue=be(this,b))==null||Ue.call(this,...K)}return this}pop(){var ve;try{for(;be(this,C);){const G=be(this,A)[be(this,v)];if(gt(this,Fe,tf).call(this,!0),gt(this,ce,ar).call(this,G)){if(G.__staleWhileFetching)return G.__staleWhileFetching}else if(G!==void 0)return G}}finally{if(be(this,q)&&be(this,N)){const G=be(this,N);let se;for(;se=G==null?void 0:G.shift();)(ve=be(this,b))==null||ve.call(this,...se)}}}has(ve,G={}){const{updateAgeOnHas:se=this.updateAgeOnHas,status:me}=G,Se=be(this,M).get(ve);if(Se!==void 0){const Ae=be(this,A)[Se];if(gt(this,ce,ar).call(this,Ae)&&Ae.__staleWhileFetching===void 0)return!1;if(be(this,V).call(this,Se))me&&(me.has="stale",be(this,H).call(this,me,Se));else return se&&be(this,ue).call(this,Se),me&&(me.has="hit",be(this,H).call(this,me,Se)),!0}else me&&(me.has="miss");return!1}peek(ve,G={}){const{allowStale:se=this.allowStale}=G,me=be(this,M).get(ve);if(me===void 0||!se&&be(this,V).call(this,me))return;const Se=be(this,A)[me];return gt(this,ce,ar).call(this,Se)?Se.__staleWhileFetching:Se}async fetch(ve,G={}){const{allowStale:se=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:Se=this.noDeleteOnStaleGet,ttl:Ae=this.ttl,noDisposeOnSet:ke=this.noDisposeOnSet,size:Ne=0,sizeCalculation:xe=this.sizeCalculation,noUpdateTTL:Re=this.noUpdateTTL,noDeleteOnFetchRejection:Me=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:et=this.allowStaleOnFetchRejection,ignoreFetchAbort:we=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ce=this.allowStaleOnFetchAbort,context:Oe,forceRefresh:Ue=!1,status:qe,signal:K}=G;if(!be(this,k))return qe&&(qe.fetch="get"),this.get(ve,{allowStale:se,updateAgeOnGet:me,noDeleteOnStaleGet:Se,status:qe});const Y={allowStale:se,updateAgeOnGet:me,noDeleteOnStaleGet:Se,ttl:Ae,noDisposeOnSet:ke,size:Ne,sizeCalculation:xe,noUpdateTTL:Re,noDeleteOnFetchRejection:Me,allowStaleOnFetchRejection:et,allowStaleOnFetchAbort:Ce,ignoreFetchAbort:we,status:qe,signal:K};let J=be(this,M).get(ve);if(J===void 0){qe&&(qe.fetch="miss");const x=gt(this,He,rf).call(this,ve,J,Y,Oe);return x.__returned=x}else{const x=be(this,A)[J];if(gt(this,ce,ar).call(this,x)){const Ge=se&&x.__staleWhileFetching!==void 0;return qe&&(qe.fetch="inflight",Ge&&(qe.returnedStale=!0)),Ge?x.__staleWhileFetching:x.__returned=x}const ie=be(this,V).call(this,J);if(!Ue&&!ie)return qe&&(qe.fetch="hit"),gt(this,ye,Fu).call(this,J),me&&be(this,ue).call(this,J),qe&&be(this,H).call(this,qe,J),x;const Ee=gt(this,He,rf).call(this,ve,J,Y,Oe),De=Ee.__staleWhileFetching!==void 0&&se;return qe&&(qe.fetch=ie?"stale":"refresh",De&&ie&&(qe.returnedStale=!0)),De?Ee.__staleWhileFetching:Ee.__returned=Ee}}async forceFetch(ve,G={}){const se=await this.fetch(ve,G);if(se===void 0)throw new Error("fetch() returned undefined");return se}memo(ve,G={}){const se=be(this,E);if(!se)throw new Error("no memoMethod provided to constructor");const{context:me,forceRefresh:Se,...Ae}=G,ke=this.get(ve,Ae);if(!Se&&ke!==void 0)return ke;const Ne=se(ve,ke,{options:Ae,context:me});return this.set(ve,Ne,Ae),Ne}get(ve,G={}){const{allowStale:se=this.allowStale,updateAgeOnGet:me=this.updateAgeOnGet,noDeleteOnStaleGet:Se=this.noDeleteOnStaleGet,status:Ae}=G,ke=be(this,M).get(ve);if(ke!==void 0){const Ne=be(this,A)[ke],xe=gt(this,ce,ar).call(this,Ne);return Ae&&be(this,H).call(this,Ae,ke),be(this,V).call(this,ke)?(Ae&&(Ae.get="stale"),xe?(Ae&&se&&Ne.__staleWhileFetching!==void 0&&(Ae.returnedStale=!0),se?Ne.__staleWhileFetching:void 0):(Se||gt(this,Z,gs).call(this,ve,"expire"),Ae&&se&&(Ae.returnedStale=!0),se?Ne:void 0)):(Ae&&(Ae.get="hit"),xe?Ne.__staleWhileFetching:(gt(this,ye,Fu).call(this,ke),me&&be(this,ue).call(this,ke),Ne))}else Ae&&(Ae.get="miss")}delete(ve){return gt(this,Z,gs).call(this,ve,"delete")}clear(){return gt(this,Ve,Ry).call(this,"delete")}};ne=Symbol.toStringTag,y=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap,w=new WeakMap,E=new WeakMap,C=new WeakMap,R=new WeakMap,M=new WeakMap,_=new WeakMap,A=new WeakMap,I=new WeakMap,P=new WeakMap,v=new WeakMap,S=new WeakMap,T=new WeakMap,N=new WeakMap,D=new WeakMap,O=new WeakMap,L=new WeakMap,B=new WeakMap,k=new WeakMap,q=new WeakMap,W=new WeakSet,Ty=function(){const ve=new c(be(this,y)),G=new c(be(this,y));Pt(this,L,ve),Pt(this,O,G),Pt(this,ae,(Se,Ae,ke=e.now())=>{if(G[Se]=Ae!==0?ke:0,ve[Se]=Ae,Ae!==0&&this.ttlAutopurge){const Ne=setTimeout(()=>{be(this,V).call(this,Se)&&gt(this,Z,gs).call(this,be(this,_)[Se],"expire")},Ae+1);Ne.unref&&Ne.unref()}}),Pt(this,ue,Se=>{G[Se]=ve[Se]!==0?e.now():0}),Pt(this,H,(Se,Ae)=>{if(ve[Ae]){const ke=ve[Ae],Ne=G[Ae];if(!ke||!Ne)return;Se.ttl=ke,Se.start=Ne,Se.now=se||me();const xe=Se.now-Ne;Se.remainingTTL=ke-xe}});let se=0;const me=()=>{const Se=e.now();if(this.ttlResolution>0){se=Se;const Ae=setTimeout(()=>se=0,this.ttlResolution);Ae.unref&&Ae.unref()}return Se};this.getRemainingTTL=Se=>{const Ae=be(this,M).get(Se);if(Ae===void 0)return 0;const ke=ve[Ae],Ne=G[Ae];if(!ke||!Ne)return 1/0;const xe=(se||me())-Ne;return ke-xe},Pt(this,V,Se=>{const Ae=G[Se],ke=ve[Se];return!!ke&&!!Ae&&(se||me())-Ae>ke})},ue=new WeakMap,H=new WeakMap,ae=new WeakMap,V=new WeakMap,U=new WeakSet,O9=function(){const ve=new c(be(this,y));Pt(this,R,0),Pt(this,D,ve),Pt(this,ge,G=>{Pt(this,R,be(this,R)-ve[G]),ve[G]=0}),Pt(this,Te,(G,se,me,Se)=>{if(gt(this,ce,ar).call(this,se))return 0;if(!a(me))if(Se){if(typeof Se!="function")throw new TypeError("sizeCalculation must be a function");if(me=Se(se,G),!a(me))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return me}),Pt(this,Pe,(G,se,me)=>{if(ve[G]=se,be(this,g)){const Se=be(this,g)-ve[G];for(;be(this,R)>Se;)gt(this,Fe,tf).call(this,!0)}Pt(this,R,be(this,R)+ve[G]),me&&(me.entrySize=se,me.totalCalculatedSize=be(this,R))})},ge=new WeakMap,Pe=new WeakMap,Te=new WeakMap,z=new WeakSet,ps=function*({allowStale:ve=this.allowStale}={}){if(be(this,C))for(let G=be(this,S);!(!gt(this,de,Iy).call(this,G)||((ve||!be(this,V).call(this,G))&&(yield G),G===be(this,v)));)G=be(this,P)[G]},F=new WeakSet,ys=function*({allowStale:ve=this.allowStale}={}){if(be(this,C))for(let G=be(this,v);!(!gt(this,de,Iy).call(this,G)||((ve||!be(this,V).call(this,G))&&(yield G),G===be(this,S)));)G=be(this,I)[G]},de=new WeakSet,Iy=function(ve){return ve!==void 0&&be(this,M).get(be(this,_)[ve])===ve},Fe=new WeakSet,tf=function(ve){var Se,Ae;const G=be(this,v),se=be(this,_)[G],me=be(this,A)[G];return be(this,k)&&gt(this,ce,ar).call(this,me)?me.__abortController.abort(new Error("evicted")):(be(this,B)||be(this,q))&&(be(this,B)&&((Se=be(this,m))==null||Se.call(this,me,se,"evict")),be(this,q)&&((Ae=be(this,N))==null||Ae.push([me,se,"evict"]))),be(this,ge).call(this,G),ve&&(be(this,_)[G]=void 0,be(this,A)[G]=void 0,be(this,T).push(G)),be(this,C)===1?(Pt(this,v,Pt(this,S,0)),be(this,T).length=0):Pt(this,v,be(this,I)[G]),be(this,M).delete(se),Hl(this,C)._--,G},He=new WeakSet,rf=function(ve,G,se,me){const Se=G===void 0?void 0:be(this,A)[G];if(gt(this,ce,ar).call(this,Se))return Se;const Ae=new s,{signal:ke}=se;ke==null||ke.addEventListener("abort",()=>Ae.abort(ke.reason),{signal:Ae.signal});const Ne={signal:Ae.signal,options:se,context:me},xe=(Oe,Ue=!1)=>{const{aborted:qe}=Ae.signal,K=se.ignoreFetchAbort&&Oe!==void 0;if(se.status&&(qe&&!Ue?(se.status.fetchAborted=!0,se.status.fetchError=Ae.signal.reason,K&&(se.status.fetchAbortIgnored=!0)):se.status.fetchResolved=!0),qe&&!K&&!Ue)return Me(Ae.signal.reason);const Y=we;return be(this,A)[G]===we&&(Oe===void 0?Y.__staleWhileFetching?be(this,A)[G]=Y.__staleWhileFetching:gt(this,Z,gs).call(this,ve,"fetch"):(se.status&&(se.status.fetchUpdated=!0),this.set(ve,Oe,Ne.options))),Oe},Re=Oe=>(se.status&&(se.status.fetchRejected=!0,se.status.fetchError=Oe),Me(Oe)),Me=Oe=>{const{aborted:Ue}=Ae.signal,qe=Ue&&se.allowStaleOnFetchAbort,K=qe||se.allowStaleOnFetchRejection,Y=K||se.noDeleteOnFetchRejection,J=we;if(be(this,A)[G]===we&&(!Y||J.__staleWhileFetching===void 0?gt(this,Z,gs).call(this,ve,"fetch"):qe||(be(this,A)[G]=J.__staleWhileFetching)),K)return se.status&&J.__staleWhileFetching!==void 0&&(se.status.returnedStale=!0),J.__staleWhileFetching;if(J.__returned===J)throw Oe},et=(Oe,Ue)=>{var K;const qe=(K=be(this,w))==null?void 0:K.call(this,ve,Se,Ne);qe&&qe instanceof Promise&&qe.then(Y=>Oe(Y===void 0?void 0:Y),Ue),Ae.signal.addEventListener("abort",()=>{(!se.ignoreFetchAbort||se.allowStaleOnFetchAbort)&&(Oe(void 0),se.allowStaleOnFetchAbort&&(Oe=Y=>xe(Y,!0)))})};se.status&&(se.status.fetchDispatched=!0);const we=new Promise(et).then(xe,Re),Ce=Object.assign(we,{__abortController:Ae,__staleWhileFetching:Se,__returned:void 0});return G===void 0?(this.set(ve,Ce,{...Ne.options,status:void 0}),G=be(this,M).get(ve)):be(this,A)[G]=Ce,Ce},ce=new WeakSet,ar=function(ve){if(!be(this,k))return!1;const G=ve;return!!G&&G instanceof Promise&&G.hasOwnProperty("__staleWhileFetching")&&G.__abortController instanceof s},le=new WeakSet,Cy=function(ve,G){be(this,P)[G]=ve,be(this,I)[ve]=G},ye=new WeakSet,Fu=function(ve){ve!==be(this,S)&&(ve===be(this,v)?Pt(this,v,be(this,I)[ve]):gt(this,le,Cy).call(this,be(this,P)[ve],be(this,I)[ve]),gt(this,le,Cy).call(this,be(this,S),ve),Pt(this,S,ve))},Z=new WeakSet,gs=function(ve,G){var me,Se,Ae,ke;let se=!1;if(be(this,C)!==0){const Ne=be(this,M).get(ve);if(Ne!==void 0)if(se=!0,be(this,C)===1)gt(this,Ve,Ry).call(this,G);else{be(this,ge).call(this,Ne);const xe=be(this,A)[Ne];if(gt(this,ce,ar).call(this,xe)?xe.__abortController.abort(new Error("deleted")):(be(this,B)||be(this,q))&&(be(this,B)&&((me=be(this,m))==null||me.call(this,xe,ve,G)),be(this,q)&&((Se=be(this,N))==null||Se.push([xe,ve,G]))),be(this,M).delete(ve),be(this,_)[Ne]=void 0,be(this,A)[Ne]=void 0,Ne===be(this,S))Pt(this,S,be(this,P)[Ne]);else if(Ne===be(this,v))Pt(this,v,be(this,I)[Ne]);else{const Re=be(this,P)[Ne];be(this,I)[Re]=be(this,I)[Ne];const Me=be(this,I)[Ne];be(this,P)[Me]=be(this,P)[Ne]}Hl(this,C)._--,be(this,T).push(Ne)}}if(be(this,q)&&((Ae=be(this,N))!=null&&Ae.length)){const Ne=be(this,N);let xe;for(;xe=Ne==null?void 0:Ne.shift();)(ke=be(this,b))==null||ke.call(this,...xe)}return se},Ve=new WeakSet,Ry=function(ve){var G,se,me;for(const Se of gt(this,F,ys).call(this,{allowStale:!0})){const Ae=be(this,A)[Se];if(gt(this,ce,ar).call(this,Ae))Ae.__abortController.abort(new Error("deleted"));else{const ke=be(this,_)[Se];be(this,B)&&((G=be(this,m))==null||G.call(this,Ae,ke,ve)),be(this,q)&&((se=be(this,N))==null||se.push([Ae,ke,ve]))}}if(be(this,M).clear(),be(this,A).fill(void 0),be(this,_).fill(void 0),be(this,L)&&be(this,O)&&(be(this,L).fill(0),be(this,O).fill(0)),be(this,D)&&be(this,D).fill(0),Pt(this,v,0),Pt(this,S,0),be(this,T).length=0,Pt(this,R,0),Pt(this,C,0),be(this,q)&&be(this,N)){const Se=be(this,N);let Ae;for(;Ae=Se==null?void 0:Se.shift();)(me=be(this,b))==null||me.call(this,...Ae)}};let u=dt;return jo.LRUCache=u,jo}var ob;function x2(){if(ob)return Ko;ob=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.cache=void 0;const e=uR();return Ko.cache=new e.LRUCache({max:200,maxSize:500*1024,sizeCalculation:(t,r)=>typeof t=="string"?t.length:new TextEncoder().encode(JSON.stringify(t)).length,ttl:1e3*60*5,allowStale:!1}),Ko}var qo={},cb;function N9(){if(cb)return qo;cb=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.getCID=void 0;const e=Ke,t=Je(),r=Xt(),n=tt(),s=Tt();function i(o,a){return e.__awaiter(this,void 0,void 0,function*(){const{env:f=t.default.ENV.PROD}=a||{},l=`${(0,n.getAPIBaseUrls)(f)}/v1/ipfs/${o}`;try{return(yield(0,s.axiosGet)(l)).data}catch(u){throw(0,r.handleError)(u,i.name)}})}return qo.getCID=i,qo}var ub;function _h(){return ub||(ub=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAndVerifyMessage=e.getDecryptedPrivateKey=e.getEip712Signature=e.getEip191Signature=e.getEncryptedRequestCore=e.getEncryptedRequest=e.decryptFeeds=e.signMessageWithPGPCore=e.signMessageWithPGP=e.encryptAndSignCore=e.encryptAndSign=void 0;const t=Ke,r=gh(),n=ga(),s=qr,i=In(),o=tt(),a=In(),f=P9(),c=Je(),l=M9(),u=ga(),p=oR(),d=Bl(),h=x2(),y=N9(),g="eip712v2",m=({plainText:v,keys:S,privateKeyArmored:T,secretKey:N})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.encryptAndSignCore)({plainText:v,keys:S,privateKeyArmored:T,secretKey:N,pgpHelper:r.PGPHelper})});e.encryptAndSign=m;const b=({plainText:v,keys:S,privateKeyArmored:T,secretKey:N,pgpHelper:D})=>t.__awaiter(void 0,void 0,void 0,function*(){const O=n.aesEncrypt({plainText:v,secretKey:N}),L=yield D.pgpEncrypt({plainText:N,keys:S}),B=yield D.sign({message:O,signingKey:T});return{cipherText:O,encryptedSecret:L,signature:B,sigType:"pgp",encType:"pgp"}});e.encryptAndSignCore=b;const w=({message:v,privateKeyArmored:S})=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.signMessageWithPGPCore)({message:v,privateKeyArmored:S,pgpHelper:r.PGPHelper})});e.signMessageWithPGP=w;const E=({message:v,privateKeyArmored:S,pgpHelper:T})=>t.__awaiter(void 0,void 0,void 0,function*(){return{signature:yield T.sign({message:v,signingKey:S}),sigType:"pgp"}});e.signMessageWithPGPCore=E;const C=({feeds:v,connectedUser:S,pgpPrivateKey:T,env:N=c.default.ENV.PROD,pgpHelper:D})=>t.__awaiter(void 0,void 0,void 0,function*(){const O=L=>t.__awaiter(void 0,void 0,void 0,function*(){if(!T)throw new Error("Decrypted private key is necessary");if(L.msg.encType!=="PlainText"){const B=L.msg.fromCAIP10,k=B===S.wallets.split(",")[0];let q;if(k)q=S.publicKey;else{const W=`pgpPubKey-${B}`;if(h.cache.has(W))q=h.cache.get(W);else{const re=yield(0,a.get)({account:B,env:N});h.cache.set(W,re.publicKey),q=re.publicKey}}L.msg=yield(0,e.decryptAndVerifyMessage)(L.msg,q,T,N,D)}});for(const L of v)yield O(L);return v});e.decryptFeeds=C;const R=(v,S,T,N,D,O,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.getEncryptedRequestCore)(v,S,T,N,D,O,L,r.PGPHelper)});e.getEncryptedRequest=R;const M=(v,S,T,N,D,O,L,B)=>t.__awaiter(void 0,void 0,void 0,function*(){if(N)if(O)if(O.isPublic){const{signature:k}=yield(0,e.signMessageWithPGPCore)({message:T,privateKeyArmored:S.privateKey,pgpHelper:B});return{message:T,encryptionType:"PlainText",aesEncryptedSecret:"",signature:k}}else if(O.sessionKey&&O.encryptedSecret){const k=n.aesEncrypt({plainText:T,secretKey:L}),q=yield B.sign({message:k,signingKey:S.privateKey});return{message:k,encryptionType:"pgpv1:group",aesEncryptedSecret:null,signature:q}}else{const q=(yield(0,d.getGroup)({chatId:O.chatId,env:D})).members.map(H=>H.publicKey),{cipherText:W,encryptedSecret:re,signature:ue}=yield(0,e.encryptAndSignCore)({plainText:T,keys:q,privateKeyArmored:S.privateKey,secretKey:L,pgpHelper:B});return{message:W,encryptionType:"pgp",aesEncryptedSecret:re,signature:ue}}else throw new Error("Unable to find Group Data");else{const k=yield(0,i.get)({account:v,env:D});if(k!=null&&k.publicKey)if(k.publicKey.includes("-----BEGIN PGP PUBLIC KEY BLOCK-----")){const{cipherText:q,encryptedSecret:W,signature:re}=yield(0,e.encryptAndSignCore)({plainText:T,keys:[k.publicKey,S.publicKey],privateKeyArmored:S.privateKey,secretKey:L,pgpHelper:B});return{message:q,encryptionType:"pgp",aesEncryptedSecret:W,signature:re}}else{const{signature:q}=yield(0,e.signMessageWithPGPCore)({message:T,privateKeyArmored:S.privateKey,pgpHelper:B});return{message:T,encryptionType:"PlainText",aesEncryptedSecret:"",signature:q}}else{if(!(0,o.isValidPushCAIP)(v))throw new Error("Invalid receiver address!");yield(0,f.createUserService)({user:v,publicKey:"",encryptedPrivateKey:"",env:D});const{signature:q}=yield(0,e.signMessageWithPGPCore)({message:T,privateKeyArmored:S.privateKey,pgpHelper:B});return{message:T,encryptionType:"PlainText",aesEncryptedSecret:"",signature:q}}}});e.getEncryptedRequestCore=M;const _=(v,S,T="v1")=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(v!=null&&v.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const N=v==null?void 0:v.signer,O=yield new o.Signer(N).signMessage(S);return{verificationProof:`${T==="v1"?"eip191":"eip191v2"}:${O}`}});e.getEip191Signature=_;const A=(v,S,T)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(v!=null&&v.signer))return console.warn("This method is deprecated. Provide signer in the function"),{signature:"xyz",sigType:"a"};const N=(0,l.getTypeInformation)(),D=v==null?void 0:v.signer,O=new o.Signer(D);let L;try{L=yield O.getChainId()}catch{L=1}const B=(0,l.getDomainInformation)(L),k=yield O.signTypedData(T?{}:B,N,{data:S},"Data");return{verificationProof:T?`${g}:${k}`:`${g}:${L}:${k}`}});e.getEip712Signature=A;function I(v,S,T,N){return t.__awaiter(this,void 0,void 0,function*(){let D;return v.signer?D=yield(0,o.decryptPGPKey)({signer:v.signer,encryptedPGPPrivateKey:S.encryptedPrivateKey,env:N}):D=yield(0,o.decryptWithWalletRPCMethod)(S.encryptedPrivateKey,T),D})}e.getDecryptedPrivateKey=I;const P=(v,S,T,N,D=r.PGPHelper)=>t.__awaiter(void 0,void 0,void 0,function*(){if(v.verificationProof&&v.verificationProof.split(":")[0]==="pgpv2"){const L={fromDID:v.fromDID,toDID:v.fromDID,fromCAIP10:v.fromCAIP10,toCAIP10:v.toCAIP10,messageObj:v.messageObj,messageType:v.messageType,encType:v.encType,encryptedSecret:v.encryptedSecret},B=s.SHA256(JSON.stringify(L)).toString(),k=v.verificationProof.split(":")[1];yield D.verifySignature({messageContent:B,signatureArmored:k,publicKeyArmored:S})}else if(v.verificationProof&&v.verificationProof.split(":")[0]==="pgpv3"){const L={fromDID:v.fromDID,toDID:v.fromDID,fromCAIP10:v.fromCAIP10,toCAIP10:v.toCAIP10,messageObj:v.messageObj,messageType:v.messageType,encType:v.encType,sessionKey:v.sessionKey,encryptedSecret:v.encryptedSecret},B=s.SHA256(JSON.stringify(L)).toString(),k=v.verificationProof.split(":")[1];yield D.verifySignature({messageContent:B,signatureArmored:k,publicKeyArmored:S})}else if(v.link==null){const L={fromDID:v.fromDID,toDID:v.toDID,messageContent:v.messageContent,messageType:v.messageType},B=s.SHA256(JSON.stringify(L)).toString();try{yield D.verifySignature({messageContent:B,signatureArmored:v.signature,publicKeyArmored:S})}catch{yield D.verifySignature({messageContent:v.messageContent,signatureArmored:v.signature,publicKeyArmored:S})}}else yield D.verifySignature({messageContent:v.messageContent,signatureArmored:v.signature,publicKeyArmored:S});const O=Object.assign({},v);try{let L;if(v.encType==="pgpv1:group"){const B=`sessionKey-${v.sessionKey}`;if(h.cache.has(B))L=h.cache.get(B);else{const k=yield(0,p.getEncryptedSecret)({sessionKey:v.sessionKey,env:N});L=yield D.pgpDecrypt({cipherText:k,toPrivateKeyArmored:T}),h.cache.set(B,L)}}else L=yield D.pgpDecrypt({cipherText:v.encryptedSecret,toPrivateKeyArmored:T});if(O.messageContent=(0,u.aesDecrypt)({cipherText:v.messageContent,secretKey:L}),v.messageObj){const B=(0,u.aesDecrypt)({cipherText:v.messageObj,secretKey:L});try{O.messageObj=JSON.parse(B)}catch{O.messageObj=B}try{if(O.messageObj.reference){const k=O.messageObj.reference;if(k&&k.split(":").length===1){const q=yield(0,y.getCID)(k,{env:N});O.messageObj.reference=q.cid}}}catch{}}}catch{O.messageContent=O.messageObj="Unable to Decrypt Message"}return O});e.decryptAndVerifyMessage=P}(T0)),T0}var nn={},lb;function lR(){if(lb)return nn;lb=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.addDeprecatedInfoToMessages=nn.addDeprecatedInfo=nn.decryptConversation=nn.getTrendingSpaceInboxLists=nn.getSpaceInboxLists=nn.getInboxLists=void 0;const e=Ke,t=gh(),r=Je(),n=tt(),s=In(),i=N9(),o=_h(),a=x2(),f=(p,d=t.PGPHelper)=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:h,user:y,toDecrypt:g,pgpPrivateKey:m,env:b=r.default.ENV.PROD}=p||{};if(g){const w=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(y),env:b});return(0,o.decryptFeeds)({feeds:h,connectedUser:w,pgpPrivateKey:m,pgpHelper:d,env:b})}return h});nn.getInboxLists=f;const c=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:d,user:h,toDecrypt:y,pgpPrivateKey:g,env:m=r.default.ENV.PROD}=p||{},b=yield(0,s.get)({account:(0,n.pCAIP10ToWallet)(h),env:m}),w=[];for(const E of d){let C;E.threadhash!==null?C=yield(0,i.getCID)(E.threadhash,{env:m}):C={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},w.push(Object.assign(Object.assign({},E),{msg:C,spaceInformation:E.spaceInformation}))}return y?(0,o.decryptFeeds)({feeds:w,connectedUser:b,pgpPrivateKey:g,pgpHelper:t.PGPHelper,env:m}):w});nn.getSpaceInboxLists=c;const l=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{lists:d,env:h=r.default.ENV.PROD}=p||{},y=[];for(const g of d){let m;g.threadhash!==null?m=yield(0,i.getCID)(g.threadhash,{env:h}):m={encType:"PlainText",encryptedSecret:"",fromCAIP10:"",fromDID:"",link:"",messageContent:"",messageType:"",sigType:"",signature:"",toCAIP10:"",toDID:""},y.push(Object.assign(Object.assign({},g),{msg:m,spaceInformation:g.spaceInformation}))}return y});nn.getTrendingSpaceInboxLists=l;const u=p=>e.__awaiter(void 0,void 0,void 0,function*(){const{messages:d,connectedUser:h,pgpPrivateKey:y,pgpHelper:g=t.PGPHelper,env:m=r.default.ENV.PROD}=p||{};let b;for(let w=0;w<d.length;w++){const E=d[w];if(E.encType!=="PlainText"&&(E.messageObj===void 0||typeof E.messageObj=="string")){if(!y)throw Error("Decrypted private key is necessary");if(E.fromCAIP10!==h.wallets.split(",")[0]){const C=`pgpPubKey-${E.fromCAIP10}`;if(a.cache.has(C))b=a.cache.get(C);else{const R=yield(0,s.get)({account:E.fromCAIP10,env:m});a.cache.set(C,R.publicKey),b=R.publicKey}}else b=h.publicKey;d[w]=yield(0,o.decryptAndVerifyMessage)(E,b,y,m,g)}}return d});return nn.decryptConversation=u,nn.addDeprecatedInfo=(()=>{const p={};return d=>(d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":"),g=h.did.split(":")[5];(!p[y]||g>p[y].split(":")[5])&&(p[y]=h.did)}}),d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.did)){const y=h.did.split(":").slice(0,5).join(":");p[y]!==h.did&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),d)})(),nn.addDeprecatedInfoToMessages=(()=>{const p={};return d=>(d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":"),g=h.fromDID.split(":")[5];(!p[y]||g>p[y].split(":")[5])&&(p[y]=h.fromDID)}}),d.forEach(h=>{if((0,n.isValidNFTCAIP)(h.fromDID)){const y=h.fromDID.split(":").slice(0,5).join(":");p[y]!==h.fromDID&&(h.deprecated=!0,h.deprecatedCode="NFT Owner Changed")}}),d)})(),nn}var T1={},$o={},I1={},db;function D9(){return db||(db=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembers=void 0;const t=Ke,r=ho(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,page:c=1,limit:l=20,env:u=s.default.ENV.PROD,pending:p,role:d}=a;try{if(!f)throw new Error("Chat ID is required.");let y=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${f}/members?pageNumber=${c}&pageSize=${l}`;return p!==void 0&&(y+=`&pending=${p}`),d&&(y+=`&role=${encodeURIComponent(d)}`),(yield r.default.get(y)).data.members}catch(h){throw(0,i.handleError)(h,e.getGroupMembers.name)}});e.getGroupMembers=o}(I1)),I1}var C1={},fb;function U2(){return fb||(fb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberCount=void 0;const t=Ke,r=ho(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=s.default.ENV.PROD}=a;try{if(!f)throw new Error("Chat ID is required.");const u=`${(0,n.getAPIBaseUrls)(c)}/v1/chat/groups/${f}/members/count`,p=yield r.default.get(u),{totalMembersCount:d}=p.data;return d}catch(l){throw(0,i.handleError)(l,e.getGroupMemberCount.name)}});e.getGroupMemberCount=o}(C1)),C1}var hb;function dR(){if(hb)return $o;hb=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.getAllGroupMembers=void 0;const e=Ke,t=D9(),r=U2(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,f=(yield(0,r.getGroupMemberCount)({chatId:i,env:o})).overallCount,c=5e3,l=Math.ceil(f/c),u=Array.from({length:l},(y,g)=>g+1),p=[],d=u.map(y=>(0,t.getGroupMembers)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(d)).forEach(y=>{y.length>0&&p.push(...y)}),p});return $o.getAllGroupMembers=n,$o}var R1={},pb;function Ll(){return pb||(pb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SpaceListType=e.ChatListType=void 0,function(t){t.CHATS="CHATS",t.REQUESTS="REQUESTS"}(e.ChatListType||(e.ChatListType={})),function(t){t.SPACES="SPACES",t.REQUESTS="REQUESTS"}(e.SpaceListType||(e.SpaceListType={}))}(R1)),R1}var yb;function x9(){return yb||(yb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSpacesMembersList=e.getMembersList=e.convertToWalletAddressList=e.getSpaceAdminsList=e.getAdminsList=e.updateGroupPayload=e.groupAccessToSpaceAccess=e.convertRulesToSpaceRules=e.convertSpaceRulesToRules=e.mapSpaceListTypeToChatListType=e.spaceDtoToSpaceInfoDto=e.groupInfoDtoToSpaceInfoDto=e.groupDtoToSpaceDtoV2=e.groupDtoToSpaceDto=e.createGroupPayload=e.rejectRequestPayload=e.sendMessagePayloadCore=e.sendMessagePayload=void 0;const t=Ke,r=tt(),n=_h(),s=Je(),i=gh(),o=ga(),a=qr,f=dR(),c=Ll(),l=(v,S,T,N,D,O,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendMessagePayloadCore)(v,S,T,N,D,O,L,i.PGPHelper)});e.sendMessagePayload=l;const u=(v,S,T,N,D,O,L,B)=>t.__awaiter(void 0,void 0,void 0,function*(){const k=O!==null;let q;k&&(O!=null&&O.encryptedSecret)&&O.sessionKey?q=yield(0,i.pgpDecrypt)({cipherText:O.encryptedSecret,toPrivateKeyArmored:S.privateKey}):q=o.generateRandomSecret(15);const{message:W,signature:re}=yield(0,n.getEncryptedRequestCore)(v,S,N,k,L,O,q,B),{message:ue,encryptionType:H,aesEncryptedSecret:ae}=yield(0,n.getEncryptedRequestCore)(v,S,JSON.stringify(T),k,L,O,q,B),V={fromDID:(0,r.walletToPCAIP10)(S.wallets.split(",")[0]),toDID:k?v:(0,r.walletToPCAIP10)(v),fromCAIP10:(0,r.walletToPCAIP10)(S.wallets.split(",")[0]),toCAIP10:k?v:(0,r.walletToPCAIP10)(v),messageType:D,messageObj:H==="PlainText"?T:ue,encType:H,sessionKey:O&&!O.isPublic&&H==="pgpv1:group"?O.sessionKey:null,encryptedSecret:ae,messageContent:W,signature:re,sigType:"pgpv3"},U={fromDID:V.fromDID,toDID:V.fromDID,fromCAIP10:V.fromCAIP10,toCAIP10:V.toCAIP10,messageObj:V.messageObj,messageType:V.messageType,encType:V.encType,sessionKey:V.sessionKey,encryptedSecret:V.encryptedSecret},te=a.SHA256(JSON.stringify(U)).toString(),ge=yield B.sign({message:te,signingKey:S.privateKey});return V.verificationProof=`pgpv3:${ge}`,V});e.sendMessagePayloadCore=u;const p=(v,S,T,N)=>({fromDID:v,toDID:S,verificationProof:T+":"+N});e.rejectRequestPayload=p;const d=(v,S,T,N,D,O,L,B,k,q,W,re,ue,H,ae,V,U)=>({groupName:v,groupDescription:L,members:S,groupImage:B,admins:T,isPublic:N,contractAddressNFT:k,numberOfNFTs:q,contractAddressERC20:W,numberOfERC20:re,groupCreator:D,verificationProof:O,meta:ue,groupType:H,scheduleAt:ae,scheduleEnd:V,rules:U});e.createGroupPayload=d;const h=v=>{var S;const T={members:v.members.map(N=>({wallet:N.wallet,publicKey:N.publicKey,isSpeaker:N.isAdmin,image:N.image})),pendingMembers:v.pendingMembers.map(N=>({wallet:N.wallet,publicKey:N.publicKey,isSpeaker:N.isAdmin,image:N.image})),contractAddressERC20:v.contractAddressERC20,numberOfERC20:v.numberOfERC20,contractAddressNFT:v.contractAddressNFT,numberOfNFTTokens:v.numberOfNFTTokens,verificationProof:v.verificationProof,spaceImage:v.groupImage,spaceName:v.groupName,isPublic:v.isPublic,spaceDescription:v.groupDescription,spaceCreator:v.groupCreator,spaceId:v.chatId,scheduleAt:v.scheduleAt,scheduleEnd:v.scheduleEnd,status:(S=v.status)!==null&&S!==void 0?S:null,meta:v.meta};return v.rules&&(T.rules={entry:v.rules.entry}),T};e.groupDtoToSpaceDto=h;const y=(v,S=s.ENV.PROD)=>t.__awaiter(void 0,void 0,void 0,function*(){var T;const N=yield(0,f.getAllGroupMembers)({chatId:v.chatId,env:S}),D={members:N.filter(O=>O.intent).map(O=>{var L,B;return{wallet:O.address,publicKey:(L=O.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:O.role==="admin",image:(B=O.userInfo.profile.picture)!==null&&B!==void 0?B:""}}),pendingMembers:N.filter(O=>!O.intent).map(O=>{var L,B;return{wallet:O.address,publicKey:(L=O.userInfo.publicKey)!==null&&L!==void 0?L:"",isSpeaker:O.role==="admin",image:(B=O.userInfo.profile.picture)!==null&&B!==void 0?B:""}}),contractAddressERC20:null,numberOfERC20:0,contractAddressNFT:null,numberOfNFTTokens:0,verificationProof:"a",spaceImage:v.groupImage,spaceName:v.groupName,isPublic:v.isPublic,spaceDescription:v.groupDescription,spaceCreator:v.groupCreator,spaceId:v.chatId,scheduleAt:v.scheduleAt,scheduleEnd:v.scheduleEnd,status:(T=v.status)!==null&&T!==void 0?T:null,meta:v.meta};return v.rules&&(D.rules={entry:v.rules.entry}),D});e.groupDtoToSpaceDtoV2=y;const g=v=>{var S,T,N,D,O;return{spaceName:v.groupName,spaceImage:v.groupImage,spaceDescription:v.groupDescription,isPublic:v.isPublic,spaceCreator:v.groupCreator,spaceId:v.chatId,scheduleAt:v.scheduleAt,scheduleEnd:v.scheduleEnd,status:(S=v.status)!==null&&S!==void 0?S:null,rules:(T=v.rules)!==null&&T!==void 0?T:null,meta:(N=v.meta)!==null&&N!==void 0?N:null,sessionKey:(D=v.sessionKey)!==null&&D!==void 0?D:null,encryptedSecret:(O=v.encryptedSecret)!==null&&O!==void 0?O:null}};e.groupInfoDtoToSpaceInfoDto=g;const m=v=>({spaceName:v.spaceName,spaceImage:v.spaceImage,spaceDescription:v.spaceDescription,isPublic:v.isPublic,spaceCreator:v.spaceCreator,spaceId:v.spaceId,scheduleAt:v.scheduleAt,scheduleEnd:v.scheduleEnd,status:v.status,rules:v.rules,meta:v.meta,sessionKey:null,encryptedSecret:null,inviteeDetails:v.inviteeDetails});e.spaceDtoToSpaceInfoDto=m;const b=v=>{switch(v){case c.SpaceListType.SPACES:return c.ChatListType.CHATS;case c.SpaceListType.REQUESTS:return c.ChatListType.REQUESTS;default:throw new Error(`Unsupported SpaceListType: ${v}`)}};e.mapSpaceListTypeToChatListType=b;const w=v=>({entry:v.entry,chat:void 0});e.convertSpaceRulesToRules=w;const E=v=>({entry:v.entry});e.convertRulesToSpaceRules=E;const C=v=>{const S={entry:v.entry};return v.rules&&(S.rules=(0,e.convertRulesToSpaceRules)(v.rules)),S};e.groupAccessToSpaceAccess=C;const R=(v,S,T,N,D,O,L,B,k,q,W,re,ue)=>Object.assign(Object.assign({groupName:v,groupImage:B,groupDescription:L,members:S,admins:T,address:N,verificationProof:D,encryptedSecret:O,scheduleAt:k,scheduleEnd:q,status:W},re!==void 0&&{meta:re}),ue!==void 0&&{rules:ue});e.updateGroupPayload=R;const M=(v,S)=>{const T=v?(0,e.convertToWalletAddressList)(v.filter(O=>O.isAdmin)):[],N=S?(0,e.convertToWalletAddressList)(S.filter(O=>O.isAdmin)):[];return[...T,...N]};e.getAdminsList=M;const _=(v,S)=>{const T=v?(0,e.convertToWalletAddressList)(v.filter(O=>O.isSpeaker)):[],N=S?(0,e.convertToWalletAddressList)(S.filter(O=>O.isSpeaker)):[];return[...T,...N]};e.getSpaceAdminsList=_;const A=v=>v?v.map(S=>S.wallet):[];e.convertToWalletAddressList=A;const I=(v,S)=>{const T=[...v||[],...S||[]];return(0,e.convertToWalletAddressList)(T)};e.getMembersList=I;const P=(v,S)=>{const T=[...v||[],...S||[]];return(0,e.convertToWalletAddressList)(T)};e.getSpacesMembersList=P}(T1)),T1}var bn={},gb;function fR(){if(gb)return bn;gb=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.validateGroupMemberUpdateOptions=bn.updateGroupRequestValidator=bn.validateScheduleDates=bn.createSpaceRequestValidator=bn.createGroupRequestValidator=void 0;const e=tt(),t=(o,a,f,c,l,u,p,d)=>{if(o==null||o.length==0)throw new Error("groupName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(c&&c.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(a==null)throw new Error("members cannot be null");for(let h=0;h<a.length;h++)if(a[h]&&!(0,e.isValidPushCAIP)(a[h]))throw new Error("Invalid member address!");if(f==null)throw new Error("admins cannot be null");for(let h=0;h<f.length;h++)if(!(0,e.isValidPushCAIP)(f[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(d!=null&&d<0)throw new Error("numberOfERC20 cannot be negative number")};bn.createGroupRequestValidator=t;const r=(o,a,f,c,l,u,p,d)=>{if(o==null||o.length==0)throw new Error("spaceName cannot be null or empty");if(o.length>50)throw new Error("groupName cannot be more than 50 characters");if(a&&a.length>150)throw new Error("spaceDescription cannot be more than 150 characters");if(f==null)throw new Error("members cannot be null");for(let h=0;h<f.length;h++)if(f[h]&&!(0,e.isValidPushCAIP)(f[h]))throw new Error("Invalid member address!");if(c==null)throw new Error("admins cannot be null");for(let h=0;h<c.length;h++)if(!(0,e.isValidPushCAIP)(c[h]))throw new Error("Invalid admin address!");if(l!=null&&(l==null?void 0:l.length)>0&&!(0,e.isValidFullCAIP10)(l))throw new Error("Invalid contractAddressNFT address!");if(u!=null&&u<0)throw new Error("numberOfNFTs cannot be negative number");if(p!=null&&(p==null?void 0:p.length)>0&&!(0,e.isValidFullCAIP10)(p))throw new Error("Invalid contractAddressERC20 address!");if(d!=null&&d<0)throw new Error("numberOfERC20 cannot be negative number")};bn.createSpaceRequestValidator=r;const n=(o,a)=>{if(o){const f=new Date(o),c=new Date;if(f<c)throw new Error("Schedule start time must be in the future.");if(a){const l=new Date(a);if(l<c)throw new Error("Schedule end time must be in the future.");if(f>=l)throw new Error("Schedule start time must be earlier than end time.")}}};bn.validateScheduleDates=n;const s=(o,a,f,c,l,u)=>{if(o==null||o.length==0)throw new Error("chatId cannot be null or empty");if(a==null||a.length==0)throw new Error("groupName cannot be null or empty");if(a!=null&&a.length>50)throw new Error("groupName cannot be more than 50 characters");if(u&&u!=null&&u.length>150)throw new Error("groupDescription cannot be more than 150 characters");if(f!=null&&f.length>0){for(let p=0;p<f.length;p++)if(!(0,e.isValidPushCAIP)(f[p]))throw new Error("Invalid member address in members list!")}if(c!=null&&c.length>0){for(let p=0;p<c.length;p++)if(!(0,e.isValidPushCAIP)(c[p]))throw new Error("Invalid member address in admins list!")}if(l!=null&&!(0,e.isValidPushCAIP)(l))throw new Error("Invalid address field!")};bn.updateGroupRequestValidator=s;const i=o=>{const{chatId:a,upsert:f,remove:c}=o;if(!a||a.trim().length===0)throw new Error("Chat ID cannot be null or empty.");const l=["members","admins"];if(Object.keys(f).forEach(u=>{if(!l.includes(u))throw new Error(`Invalid role: ${u}. Allowed roles are ${l.join(", ")}.`);if(f[u]&&f[u].length>1e3)throw new Error(`${u} array cannot have more than 1000 addresses.`);f[u].forEach(p=>{if(!(0,e.isValidPushCAIP)(p))throw new Error(`Invalid address found in ${u} list.`)})}),c&&c.length>1e3)throw new Error("Remove array cannot have more than 1000 addresses.");c.forEach(u=>{if(!(0,e.isValidPushCAIP)(u))throw new Error("Invalid address found in remove list.")})};return bn.validateGroupMemberUpdateOptions=i,bn}var Vo={},mb;function hR(){if(mb)return Vo;mb=1,Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.getGroup=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=(i,o)=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:a=r.default.ENV.PROD}=i||{},c=`${(0,t.getAPIBaseUrls)(a)}/v1/chat/groups/${o}`;return(0,n.axiosGet)(c).then(l=>l.data).catch(l=>{throw console.error(`[Push SDK] - API ${c}: `,l),Error(`[Push SDK] - API ${c}: ${l}`)})});return Vo.getGroup=s,Vo}var vb;function Mt(){return vb||(vb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Ke;t.__exportStar(ga(),e),t.__exportStar(gh(),e),t.__exportStar(vC(),e),t.__exportStar(_h(),e),t.__exportStar(P9(),e),t.__exportStar(lR(),e),t.__exportStar(x9(),e),t.__exportStar(fR(),e),t.__exportStar(hR(),e),t.__exportStar(g9(),e)}($h)),$h}var wd={},bb;function Ta(){if(bb)return wd;bb=1,Object.defineProperty(wd,"__esModule",{value:!0});const e={"PUSH-CREATE-01":{progressId:"PUSH-CREATE-01",progressTitle:"Generating Secure Profile Signature",progressInfo:"This step is only done for first time users and might take a few seconds. PGP keys are getting generated to provide you with secure yet seamless web3 communication",level:"INFO"},"PUSH-CREATE-02":{progressId:"PUSH-CREATE-02",progressTitle:"Signing Generated Profile",progressInfo:"This step is only done for first time users. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-03":{progressId:"PUSH-CREATE-03",progressTitle:"Encrypting Generated Profile",progressInfo:"Encrypting your keys. Please sign the message to continue.",level:"INFO"},"PUSH-CREATE-04":{progressId:"PUSH-CREATE-04",progressTitle:"Syncing Generated Profile",progressInfo:"Please sign the message to continue. Great job! You are almost fully onboarded to Push Protocol!",level:"INFO"},"PUSH-CREATE-05":{progressId:"PUSH-CREATE-05",progressTitle:"Setup Complete",progressInfo:"",level:"SUCCESS"},"PUSH-UPGRADE-01":{progressId:"PUSH-UPGRADE-01",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-02":{progressId:"PUSH-UPGRADE-02",progressTitle:"Decrypting Old Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-03":{progressId:"PUSH-UPGRADE-03",progressTitle:"Generating Encrypted New Profile",progressInfo:"Trying to Upgrade Push Keys to latest version. Encrypting Push Keys with latest version. Please sign the message to continue.",level:"INFO"},"PUSH-UPGRADE-04":{progressId:"PUSH-UPGRADE-04",progressTitle:"Syncing New Profile",progressInfo:"Please sign the message to continue. Upgraded keys are almost ready!",level:"INFO"},"PUSH-UPGRADE-05":{progressId:"PUSH-UPGRADE-05",progressTitle:"Upgrade Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-DECRYPT-01":{progressId:"PUSH-DECRYPT-01",progressTitle:"Decrypting Profile",progressInfo:"Please sign the transaction to decrypt profile",level:"INFO"},"PUSH-DECRYPT-02":{progressId:"PUSH-DECRYPT-02",progressTitle:"Push Profile Unlocked",progressInfo:"Unlocking push profile",level:"SUCCESS"},"PUSH-AUTH-UPDATE-01":t=>({progressId:"PUSH-AUTH-UPDATE-01",progressTitle:"Generating New Profile Signature",progressInfo:`Trying to Update Push Keys to ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-02":t=>({progressId:"PUSH-AUTH-UPDATE-02",progressTitle:"Generating New Encrypted Profile",progressInfo:`Encrypting Push Keys with ${t} version. Please sign the message to continue.`,level:"INFO"}),"PUSH-AUTH-UPDATE-03":{progressId:"PUSH-AUTH-UPDATE-03",progressTitle:"Syncing Updated Profile",progressInfo:"Please sign the message to continue. Updated keys are almost ready!",level:"INFO"},"PUSH-AUTH-UPDATE-04":{progressId:"PUSH-AUTH-UPDATE-04",progressTitle:"Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-AUTH-UPDATE-05":{progressId:"PUSH-AUTH-UPDATE-05",progressTitle:"Generating New Profile Signature",progressInfo:"Trying to Update Push Profile creds. Please sign the message to continue.",level:"INFO"},"PUSH-AUTH-UPDATE-06":{progressId:"PUSH-AUTH-UPDATE-06",progressTitle:"Generating New Profile Signature",progressInfo:"Encrypting Push Keys with new creds. Please sign the message to continue.",level:"INFO"},"PUSH-DECRYPT-AUTH-01":{progressId:"PUSH-DECRYPT-AUTH-01",progressTitle:"Decrypting Profile Creds",progressInfo:"Please sign the transaction to decrypt profile creds.",level:"INFO"},"PUSH-DECRYPT-AUTH-02":{progressId:"PUSH-DECRYPT-AUTH-02",progressTitle:"Push Profile Creds Unlocked",progressInfo:"Unlocking push profile creds.",level:"SUCCESS"},"PUSH-PROFILE-UPDATE-01":{progressId:"PUSH-PROFILE-UPDATE-01",progressTitle:"Syncing Updated Profile",progressInfo:"Steady lads, your profile is getting a new look!",level:"INFO"},"PUSH-PROFILE-UPDATE-02":{progressId:"PUSH-PROFILE-UPDATE-02",progressTitle:"Profile Update Completed, Welcome to Push Protocol",progressInfo:"",level:"SUCCESS"},"PUSH-CHANNEL-CREATE-01":{progressId:"PUSH-CHANNEL-CREATE-01",progressTitle:"Uploading data to IPFS",progressInfo:"The channel’s data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-CREATE-02":{progressId:"PUSH-CHANNEL-CREATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-CREATE-03":{progressId:"PUSH-CHANNEL-CREATE-03",progressTitle:"Channel is getting created",progressInfo:"Calls Push Core contract to create your channel",level:"INFO"},"PUSH-CHANNEL-CREATE-04":{progressId:"PUSH-CHANNEL-CREATE-04",progressTitle:"Channel creation is done, Welcome to Push Ecosystem",progressInfo:"Channel creation is completed",level:"SUCCESS"},"PUSH-CHANNEL-UPDATE-01":{progressId:"PUSH-CHANNEL-UPDATE-01",progressTitle:"Uploading new data to IPFS",progressInfo:"The channel’s new data is getting uploaded to IPFS",level:"INFO"},"PUSH-CHANNEL-UPDATE-02":{progressId:"PUSH-CHANNEL-UPDATE-02",progressTitle:"Approving PUSH tokens",progressInfo:"Gives approval to Push Core contract to spend 50 PUSH",level:"INFO"},"PUSH-CHANNEL-UPDATE-03":{progressId:"PUSH-CHANNEL-UPDATE-03",progressTitle:"Channel is getting updated",progressInfo:"Calls Push Core contract to update your channel details",level:"INFO"},"PUSH-CHANNEL-UPDATE-04":{progressId:"PUSH-CHANNEL-UPDATE-04",progressTitle:"Channel is updated with new data",progressInfo:"Channel is successfully updated",level:"SUCCESS"},"PUSH-ERROR-00":(t,r)=>({progressId:"PUSH-ERROR-00",progressTitle:"Non Specific Error",progressInfo:`[Push SDK] - API - Error - API ${t}() -: ${r}`,level:"ERROR"}),"PUSH-ERROR-01":t=>({progressId:"PUSH-ERROR-01",progressTitle:"Upgrade Profile Failed",progressInfo:`[Push SDK] - API - Error - API decryptPgpKey() -: ${t}`,level:"WARN"}),"PUSH-ERROR-02":(t,r)=>({progressId:"PUSH-ERROR-02",progressTitle:"Transaction failed",progressInfo:`[Push SDK] - Contract - Error - ${t} -: ${r}`,level:"ERROR"})};return wd.default=e,wd}var Fo={},_b;function wh(){if(_b)return Fo;_b=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.get=void 0;const e=Ke,t=Eh(),r=tt(),n=Je(),s=mh(),i=Tt(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{account:f,env:c=n.default.ENV.PROD}=a||{};if(!(0,t.isValidPushCAIP)(f))throw new Error("Invalid address!");const l=(0,t.walletToPCAIP10)(f),p=`${(0,r.getAPIBaseUrls)(c)}/v2/users/?caip10=${l}`;return(0,i.axiosGet)(p).then(d=>e.__awaiter(void 0,void 0,void 0,function*(){return d.data&&(d.data.publicKey=yield(0,r.verifyProfileKeys)(d.data.encryptedPrivateKey,d.data.publicKey,d.data.did,d.data.wallets,d.data.verificationProof)),(0,s.populateDeprecatedUser)(d.data)})).catch(d=>{throw console.error(`[Push SDK] - API ${p}: `,d),Error(`[Push SDK] - API ${p}: ${d}`)})});return Fo.get=o,Fo}var wb;function U9(){return wb||(wb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.authUpdate=void 0;const t=Ke,r=Mt(),n=Je(),s=tt(),i=Ta(),o=wh();var a;(function(c){c["x25519-xsalsa20-poly1305"]="PGP_V1",c.aes256GcmHkdfSha256="PGP_V2",c["eip191-aes256-gcm-hkdf-sha256"]="PGP_V3",c["pgpv1:nft"]="NFTPGP_V1",c["pgpv1:scw"]="SCWPGP_V1"})(a||(a={}));const f=c=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u;const{pgpPrivateKey:p,pgpEncryptionVersion:d,signer:h,pgpPublicKey:y,account:g=null,env:m=n.default.ENV.PROD,additionalMeta:b,progressHook:w}=c||{};try{const E=(0,r.getWallet)({account:g,signer:h}),C=yield(0,r.getAccountAddress)(E),R=d===n.default.ENCRYPTION_TYPE.NFTPGP_V1||d===n.default.ENCRYPTION_TYPE.SCWPGP_V1;if(!(0,s.isValidPushCAIP)(C))throw new Error("Invalid address!");const M=(0,s.walletToPCAIP10)(C),_=yield(0,o.get)({account:M,env:m});if(!_||!_.encryptedPrivateKey)throw new Error("User not Found!");R?w==null||w(i.default["PUSH-AUTH-UPDATE-05"]):w==null||w(i.default["PUSH-AUTH-UPDATE-01"](a[d]));const A=yield(0,s.preparePGPPublicKey)(d,y,E);R?w==null||w(i.default["PUSH-AUTH-UPDATE-06"]):w==null||w(i.default["PUSH-AUTH-UPDATE-02"](a[d]));const I=yield(0,s.encryptPGPKey)(d,p,E,b);if(d===n.ENCRYPTION_TYPE.NFTPGP_V1){const S=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(l=b==null?void 0:b.NFTPGP_V1)===null||l===void 0?void 0:l.password,E,b);I.encryptedPassword=S}else if(d===n.ENCRYPTION_TYPE.SCWPGP_V1){const S=yield(0,s.encryptPGPKey)(n.ENCRYPTION_TYPE.PGP_V3,(u=b==null?void 0:b.SCWPGP_V1)===null||u===void 0?void 0:u.password,E,b);I.encryptedPassword=S}w==null||w(i.default["PUSH-AUTH-UPDATE-03"]);const P={user:_.did,wallet:E,publicKey:A,encryptedPrivateKey:JSON.stringify(I),env:m},v=yield(0,r.authUpdateUserService)(P);return w==null||w(i.default["PUSH-AUTH-UPDATE-04"]),v}catch(E){const C=i.default["PUSH-ERROR-00"];throw w==null||w(C(e.authUpdate.name,E)),Error(`[Push SDK] - API - Error - API ${e.authUpdate.name} -: ${E}`)}});e.authUpdate=f}(qh)),qh}var k1={},Eb;function B9(){return Eb||(Eb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profileUpdateCore=e.profileUpdate=void 0;const t=Ke,r=qr,n=Mt(),s=Je(),i=tt(),o=wh(),a=mh(),f=Ta(),c=Tt(),l=p=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,e.profileUpdateCore)(p,n.PGPHelper)});e.profileUpdate=l;const u=(p,d)=>t.__awaiter(void 0,void 0,void 0,function*(){const{pgpPrivateKey:h,account:y,profile:g,env:m=s.default.ENV.PROD,progressHook:b}=p||{};try{if(!(0,i.isValidPushCAIP)(y))throw new Error("Invalid account!");const w=yield(0,o.get)({account:y,env:m});if(!w||!w.did)throw new Error("User not Found!");let E=null;if(g.blockedUsersList){for(const N of g.blockedUsersList)if(!(0,i.isValidPushCAIP)(N))throw new Error("Invalid address in the blockedUsersList: "+N);const T=g.blockedUsersList.map(N=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,i.convertToValidDID)(N,m)}));E=yield Promise.all(T),E=Array.from(new Set(E))}const C={name:g.name?g.name:w.profile.name,desc:g.desc?g.desc:w.profile.desc,picture:g.picture?g.picture:w.profile.picture,blockedUsersList:g.blockedUsersList?E:[]},R=r.SHA256(JSON.stringify(C)).toString(),A=`pgpv2:${yield d.sign({message:R,signingKey:h})}`,I=Object.assign(Object.assign({},C),{verificationProof:A}),v=`${(0,i.getAPIBaseUrls)(m)}/v2/users/${w.did}/profile`;b==null||b(f.default["PUSH-PROFILE-UPDATE-01"]);const S=yield(0,c.axiosPut)(v,I);return S.data&&(S.data.publicKey=yield(0,i.verifyProfileKeys)(S.data.encryptedPrivateKey,S.data.publicKey,S.data.did,S.data.wallets,S.data.verificationProof)),b==null||b(f.default["PUSH-PROFILE-UPDATE-02"]),(0,a.populateDeprecatedUser)(S.data)}catch(w){const E=f.default["PUSH-ERROR-00"];throw b==null||b(E(e.profileUpdate.name,w)),Error(`[Push SDK] - API - Error - API ${e.profileUpdate.name} -: ${w}`)}});e.profileUpdateCore=u}(k1)),k1}var M1={},Ab;function L9(){return Ab||(Ab=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createUserCore=e.create=void 0;const t=Ke,r=Mt(),n=Je(),s=tt(),i=Ta(),o=f=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createUserCore)(f,r.PGPHelper)});e.create=o;const a=(f,c)=>t.__awaiter(void 0,void 0,void 0,function*(){var l,u,p,d;const h="$0Pc",{env:y=n.default.ENV.PROD,account:g=null,signer:m=null,version:b=n.default.ENC_TYPE_V3,additionalMeta:w={NFTPGP_V1:{password:h+(0,r.generateRandomSecret)(10)},SCWPGP_V1:{password:h+(0,r.generateRandomSecret)(10)}},progressHook:E,origin:C}=f||{};try{if(g==null&&m==null)throw new Error("At least one from account or signer is necessary!");const R=(0,r.getWallet)({account:g,signer:m}),M=yield(0,r.getAccountAddress)(R);if(!(0,s.isValidPushCAIP)(M))throw new Error("Invalid address!");!((l=w==null?void 0:w.NFTPGP_V1)===null||l===void 0)&&l.password&&(0,s.validatePssword)(w.NFTPGP_V1.password),!((u=w==null?void 0:w.SCWPGP_V1)===null||u===void 0)&&u.password&&(0,s.validatePssword)(w.SCWPGP_V1.password);const _=(0,s.walletToPCAIP10)(M);let A=b;(0,s.isValidNFTCAIP)(_)?A=n.default.ENC_TYPE_V4:(0,s.isValidSCWCAIP)(_)?A=n.default.ENC_TYPE_V5:m||(A=n.default.ENC_TYPE_V1),E==null||E(i.default["PUSH-CREATE-01"]);const I=yield c.generateKeyPair();E==null||E(i.default["PUSH-CREATE-02"]);const P=yield(0,s.preparePGPPublicKey)(A,I.publicKeyArmored,R);E==null||E(i.default["PUSH-CREATE-03"]);const v=yield(0,s.encryptPGPKey)(A,I.privateKeyArmored,R,w);if(A===n.default.ENC_TYPE_V4||A===n.default.ENC_TYPE_V5){const N=((p=w.NFTPGP_V1)===null||p===void 0?void 0:p.password)||((d=w.SCWPGP_V1)===null||d===void 0?void 0:d.password),D=yield(0,s.encryptPGPKey)(n.default.ENC_TYPE_V3,N,R,w);v.encryptedPassword=D}E==null||E(i.default["PUSH-CREATE-04"]);const S={user:_,wallet:R,publicKey:P,encryptedPrivateKey:JSON.stringify(v),env:y,origin:C},T=yield(0,r.createUserService)(S);return E==null||E(i.default["PUSH-CREATE-05"]),T.decryptedPrivateKey=I.privateKeyArmored,T}catch(R){const M=i.default["PUSH-ERROR-00"];throw E==null||E(M(e.create.name,R)),Error(`[Push SDK] - API - Error - API ${e.create.name} -: ${R}`)}});e.createUserCore=a}(M1)),M1}var Ho={},O1={},Go={},Sb;function pR(){if(Sb)return Go;Sb=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.parseApiResponse=void 0;function e(t){return t.map(r=>{const{payload:{data:{acta:n="",amsg:s="",asub:i="",icon:o="",url:a="",sid:f="",app:c="",aimg:l="",secret:u=""},notification:p},source:d}=r;return{cta:n,title:i||"",message:s||p.body||"",icon:o,url:a,sid:f,app:c,image:l,blockchain:d,notification:p,secret:u}})}return Go.parseApiResponse=e,Go}var Pb;function B2(){return Pb||(Pb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ke.__exportStar(pR(),e)}(O1)),O1}var Tb;function yR(){if(Tb)return Ho;Tb=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.getFeeds=void 0;const e=Ke,t=tt(),r=Je(),n=B2(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1}=o||{},d=yield(0,t.getCAIPAddress)(f,a,"User"),y=`${(0,t.getAPIBaseUrls)(f)}/v1/users/${d}/feeds`,g={page:c,limit:(0,t.getLimit)(l),spam:u},m=`${y}?${(0,t.getQueryParams)(g)}`;return(0,s.axiosGet)(m).then(b=>{var w,E;return p?((w=b==null?void 0:b.data)===null||w===void 0?void 0:w.feeds)||[]:(0,n.parseApiResponse)((E=b==null?void 0:b.data)===null||E===void 0?void 0:E.feeds)||[]}).catch(b=>{console.error(`[Push SDK] - API ${m}: `,b)})});return Ho.getFeeds=i,Ho}var zo={},Wo={},Yo={},Ib;function L2(){if(Ib)return Yo;Ib=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.parseSettings=void 0;const e=t=>{var r,n;let s;try{s=JSON.parse(t)}catch{s=t}const i=[];for(let o=0;o<s.length;o++){const a=s[o];a.type==1?i.push(Object.assign({type:a.type,description:a.description},a.user?{userPreferance:{value:a.user,enabled:a.user}}:{default:a.default})):a.type==2?i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(r=a.ticker)!==null&&r!==void 0?r:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default})):a.type==3&&i.push(Object.assign({type:a.type,description:a.description,data:{upper:a.upperLimit,lower:a.lowerLimit,ticker:(n=a.ticker)!==null&&n!==void 0?n:1}},a.user?{userPreferance:{value:a.user,enabled:a.enabled}}:{default:a.default}))}return i};return Yo.parseSettings=e,Yo}var Cb;function gR(){if(Cb)return Wo;Cb=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.parseSubscriptionsApiResponse=void 0;const e=L2();function t(r){return r.map(n=>({channel:n.channel,user_settings:n.user_settings?(0,e.parseSettings)(n.user_settings):null}))}return Wo.parseSubscriptionsApiResponse=t,Wo}var Rb;function mR(){if(Rb)return zo;Rb=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.getSubscriptions=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=gR(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,channel:c=null,raw:l=!0}=o||{},u=yield(0,t.getCAIPAddress)(f,a,"User"),d=`${(0,t.getAPIBaseUrls)(f)}/v1/users/${u}/subscriptions`,h=c?(0,t.getQueryParams)({channel:c}):"",y=`${d}?${h}`;return(0,n.axiosGet)(y).then(g=>{var m,b;return l?((m=g.data)===null||m===void 0?void 0:m.subscriptions)||[]:(0,s.parseSubscriptionsApiResponse)(((b=g.data)===null||b===void 0?void 0:b.subscriptions)||[])}).catch(g=>{console.error(`[Push SDK] - API ${y}: `,g)})});return zo.getSubscriptions=i,zo}var Jo={},kb;function vR(){if(kb)return Jo;kb=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.getDelegations=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"User"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/users/${f}/delegations`}`;return(0,n.axiosGet)(u).then(p=>{var d;return((d=p.data)===null||d===void 0?void 0:d.delegations)||[]}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return Jo.getDelegations=s,Jo}var Zo={},Mb;function bR(){if(Mb)return Zo;Mb=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.getBatch=void 0;const e=Ke,t=Eh(),r=tt(),n=Je(),s=mh(),i=Tt(),o=a=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:f=n.default.ENV.PROD,userIds:c}=a||{},u=`${(0,r.getAPIBaseUrls)(f)}/v2/users/batch`,p=100;if(c.length>p)throw new Error(`Too many user IDs. Maximum allowed: ${p}`);for(let y=0;y<c.length;y++)if(!(0,t.isValidPushCAIP)(c[y]))throw new Error("Invalid user address!");const h={userIds:c.map(t.walletToPCAIP10)};return(0,i.axiosPost)(u,h).then(y=>(y.data.users.forEach((g,m)=>e.__awaiter(void 0,void 0,void 0,function*(){y.data.users[m].publicKey=yield(0,r.verifyProfileKeys)(g.encryptedPrivateKey,g.publicKey,g.did,g.caip10,g.verificationProof),y.data.users[m]=(0,s.populateDeprecatedUser)(y.data.users[m])})),y.data)).catch(y=>{throw console.error(`[Push SDK] - API ${u}: `,y),Error(`[Push SDK] - API ${u}: ${y}`)})});return Zo.getBatch=o,Zo}var N1={},Ob;function K9(){return Ob||(Ob=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.upgrade=void 0;const t=Ke,r=Mt(),n=Je(),s=tt(),i=U9(),o=wh(),a=Ta(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:l=n.default.ENV.PROD,account:u=null,signer:p,additionalMeta:d,progressHook:h}=c||{};try{const y=(0,r.getWallet)({account:u,signer:p}),g=yield(0,r.getAccountAddress)(y);if(!(0,s.isValidPushCAIP)(g))throw new Error("Invalid address!");const m=yield(0,o.get)({account:g,env:l});if(!m||!m.encryptedPrivateKey)throw new Error("User Not Found!");const b=n.default.ENCRYPTION_TYPE.PGP_V3,{version:w}=JSON.parse(m.encryptedPrivateKey);if(w===b||w===n.default.ENCRYPTION_TYPE.NFTPGP_V1||w===n.default.ENCRYPTION_TYPE.SCWPGP_V1)return m;h==null||h(a.default["PUSH-UPGRADE-02"]);const E=yield(0,s.decryptPGPKey)({encryptedPGPPrivateKey:m.encryptedPrivateKey,signer:p,env:l,toUpgrade:!1,additionalMeta:d}),C=yield(0,i.authUpdate)({pgpPrivateKey:E,pgpEncryptionVersion:b,signer:p,pgpPublicKey:m.publicKey,account:m.did,env:l,additionalMeta:d,progressHook:h});return h==null||h(a.default["PUSH-UPGRADE-05"]),C}catch(y){const g=a.default["PUSH-ERROR-00"];throw h==null||h(g(e.upgrade.name,y)),Error(`[Push SDK] - API - Error - API ${e.upgrade.name} -: ${y}`)}});e.upgrade=f}(N1)),N1}var D1={},Nb;function _R(){return Nb||(Nb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptAuth=void 0;const t=Ke,r=Je(),n=tt(),s=Ta(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){var a,f;const{account:c,signer:l,env:u=r.default.ENV.PROD,additionalMeta:p,progressHook:d}=o||{};try{if(!(0,n.isValidNFTCAIP)(c)&&!(0,n.isValidSCWCAIP)(c))return null;d==null||d(s.default["PUSH-DECRYPT-AUTH-01"]);const h=((a=p==null?void 0:p.NFTPGP_V1)===null||a===void 0?void 0:a.encryptedPassword)||((f=p==null?void 0:p.SCWPGP_V1)===null||f===void 0?void 0:f.encryptedPassword);if(!h)throw new Error("encryptedPassword is required!");const y=yield(0,n.decryptPGPKey)({encryptedPGPPrivateKey:h,signer:l,account:c,env:u});return d==null||d(s.default["PUSH-DECRYPT-AUTH-02"]),y}catch(h){throw d==null||d(s.default["PUSH-ERROR-00"](e.decryptAuth.name,h)),Error(`[Push SDK] - API - Error - API ${e.decryptAuth.name} -: ${h}`)}});e.decryptAuth=i}(D1)),D1}var Xo={},Db;function wR(){if(Db)return Xo;Db=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.createUserWithProfile=void 0;const e=Ke,t=L9(),r=B9(),n=tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){try{let o=yield(0,t.create)(i);if(i.profile){const a=yield(0,n.decryptPGPKey)({account:o.did,encryptedPGPPrivateKey:o.encryptedPrivateKey,env:i.env,signer:i.signer});o=yield(0,r.profileUpdate)({account:o.did,env:i.env,pgpPrivateKey:a,profile:i.profile})}return o}catch(o){throw new Error(`[Push SDK] - Error in createUserWithProfile -: ${o}`)}});return Xo.createUserWithProfile=s,Xo}var Qo={},xb;function ER(){if(xb)return Qo;xb=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getFeedsPerChannel=void 0;const e=Ke,t=tt(),r=Je(),n=B2(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{user:a,env:f=r.default.ENV.PROD,page:c=r.default.PAGINATION.INITIAL_PAGE,limit:l=r.default.PAGINATION.LIMIT,spam:u=!1,raw:p=!1,channels:d=[]}=o||{},h=yield(0,t.getCAIPAddress)(f,a,"User"),y=(0,t.getAPIBaseUrls)(f);if(d.length==0)throw new Error("channels cannot be empty");const g=yield(0,t.getCAIPAddress)(f,d[0],"Channel"),m=`${y}/v1/users/${h}/channels/${g}/feeds`,b={page:c,limit:(0,t.getLimit)(l),spam:u},w=`${m}?${(0,t.getQueryParams)(b)}`;return(0,s.axiosGet)(w).then(E=>{var C,R;return p?((C=E==null?void 0:E.data)===null||C===void 0?void 0:C.feeds)||[]:(0,n.parseApiResponse)((R=E==null?void 0:E.data)===null||R===void 0?void 0:R.feeds)||[]}).catch(E=>{console.error(`[Push SDK] - API ${w}: `,E)})});return Qo.getFeedsPerChannel=i,Qo}var Ub;function In(){return Ub||(Ub=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.profile=e.auth=void 0;const t=Ke,r=U9(),n=B9();t.__exportStar(L9(),e),t.__exportStar(yR(),e),t.__exportStar(mR(),e),t.__exportStar(wh(),e),t.__exportStar(vR(),e),t.__exportStar(bR(),e),t.__exportStar(K9(),e),t.__exportStar(_R(),e),t.__exportStar(wR(),e),t.__exportStar(ER(),e),e.auth={update:r.authUpdate},e.profile={update:n.profileUpdate,updateCore:n.profileUpdateCore}}(jh)),jh}var Bb;function Eh(){return Bb||(Bb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.pCAIP10ToWallet=e.walletToPCAIP10=e.getCAIPWithChainId=e.getCAIPAddress=e.getFallbackETHCAIPAddress=e.getCAIPDetails=e.validateCAIP=e.isValidFullCAIP10=e.convertToValidDID=e.isValidPushCAIP=e.isValidEOACAIP=e.isValidNFTCAIP=e.isValidSCWCAIP=void 0;const t=Ke,r=ya,n=Je(),s=In(),i=w=>{try{const E=w.split(":");return E.length===4&&E[0]==="scw"&&E[1]==="eip155"&&!isNaN(Number(E[2]))&&Number(E[2])>0&&r.isAddress(E[3])}catch{return!1}};e.isValidSCWCAIP=i;const o=w=>{try{const E=w.split(":");return(E.length===5||E.length===6)&&E[0].toLowerCase()==="nft"&&!isNaN(Number(E[4]))&&Number(E[4])>0&&!isNaN(Number(E[2]))&&Number(E[2])>0&&r.isAddress(E[3])&&E[1]==="eip155"}catch{return!1}};e.isValidNFTCAIP=o;const a=w=>{try{const E=w.split(":");return E.length===3?E[0]==="eip155"&&!isNaN(Number(E[1]))&&Number(E[1])>0&&r.isAddress(E[2]):E.length===2?E[0]==="eip155"&&r.isAddress(E[1]):!1}catch{return!1}};e.isValidEOACAIP=a;const f=w=>(0,e.isValidEOACAIP)(w)||(0,e.isValidSCWCAIP)(w)||(0,e.isValidNFTCAIP)(w)||r.isAddress(w);e.isValidPushCAIP=f;const c=(w,E=n.ENV.STAGING,C,R)=>t.__awaiter(void 0,void 0,void 0,function*(){if(!(0,e.isValidPushCAIP)(w)||(0,e.isValidEOACAIP)(w)||(0,e.isValidSCWCAIP)(w)||(0,e.isValidNFTCAIP)(w)&&w.split(":").length===6)return w;if((0,e.isValidNFTCAIP)(w)){const M=yield(0,s.get)({account:w,env:E});if(M&&M.did)return M.did;const _=Math.floor(Date.now()/1e3);return`${w}:${_}`}return C?`eip155:${C}:${w}`:`eip155:${w}`});e.convertToValidDID=c;const l=w=>{const E=w.split(":");return isNaN(Number(E[1]))?!1:E[0]==="eip155"&&!isNaN(Number(E[1]))&&Number(E[1])>0&&r.isAddress(E[2])};e.isValidFullCAIP10=l;const u={eip155:({address:w})=>(0,e.isValidPushCAIP)(w)};function p(w){const[E,C,R]=w.split(":");if(!E||!C||!R)return!1;if((0,e.isValidNFTCAIP)(w))return!0;const M=u[E];return M({address:R})}e.validateCAIP=p;function d(w){if(p(w)){const[E,C,R]=w.split(":");return{blockchain:E,networkId:C,address:R}}return null}e.getCAIPDetails=d;function h(w,E){let C=1;return(w===n.default.ENV.DEV||w===n.default.ENV.STAGING||w===n.default.ENV.LOCAL)&&(C=11155111),`eip155:${C}:${E}`}e.getFallbackETHCAIPAddress=h;function y(w,E,C){return t.__awaiter(this,void 0,void 0,function*(){if((0,e.isValidNFTCAIP)(E)||(0,e.isValidSCWCAIP)(E))return yield(0,e.convertToValidDID)(E,w);if(p(E))return E;if((0,e.isValidPushCAIP)(E))return h(w,E);throw Error(`Invalid Address! ${C}
64
+ Address: ${E}`)})}e.getCAIPAddress=y;const g=(w,E,C)=>{if((0,e.isValidPushCAIP)(w))return w.includes("eip155:")?w:`eip155:${E}:${w}`;throw Error(`Invalid Address! ${C}
65
+ Address: ${w}`)};e.getCAIPWithChainId=g;const m=w=>(0,e.isValidNFTCAIP)(w)||(0,e.isValidSCWCAIP)(w)||w.includes("eip155:")?w:"eip155:"+w;e.walletToPCAIP10=m;const b=w=>((0,e.isValidNFTCAIP)(w)||(0,e.isValidSCWCAIP)(w)||(w=w.replace("eip155:","")),w);e.pCAIP10ToWallet=b}(Kh)),Kh}var Ws={},Lb;function AR(){if(Lb)return Ws;Lb=1,Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.getLimit=Ws.getQueryParams=void 0;const e=Je();function t(n){return Object.keys(n).map(s=>`${s}=${encodeURIComponent(n[s])}`).join("&")}Ws.getQueryParams=t;function r(n){return n||e.default.PAGINATION.LIMIT}return Ws.getLimit=r,Ws}var x1={},ec={},Kb;function j9(){if(Kb)return ec;Kb=1,Object.defineProperty(ec,"__esModule",{value:!0}),ec.Signer=void 0;const e=Ke;class t{constructor(n){this.signer=n}isViemSigner(n){return typeof n.signTypedData=="function"&&typeof n.getChainId=="function"&&n.signMessage.length===1&&n.signTypedData.length===1}signMessage(n){return e.__awaiter(this,void 0,void 0,function*(){if("signMessage"in this.signer&&typeof this.signer.signMessage=="function")return this.isViemSigner(this.signer)?this.signer.signMessage({message:n,account:this.signer.account}):this.signer.signMessage(n);throw new Error("Signer does not support signMessage")})}signTypedData(n,s,i,o){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.signTypedData({domain:n,types:s,primaryType:o,message:i,account:this.signer.account});if("_signTypedData"in this.signer)return this.signer._signTypedData(n,s,i);if("signTypedData"in this.signer)return this.signer.signTypedData(n,s,i);throw new Error("Signer does not support signTypedData")})}getAddress(){var n;return e.__awaiter(this,void 0,void 0,function*(){return this.isViemSigner(this.signer)?(n=this.signer.account.address)!==null&&n!==void 0?n:"":yield this.signer.getAddress()})}getChainId(){return e.__awaiter(this,void 0,void 0,function*(){if(this.isViemSigner(this.signer))return this.signer.getChainId();if("provider"in this.signer&&this.signer.provider){const n=yield this.signer.provider.getNetwork();return Number(n.chainId)}else return 1})}}return ec.Signer=t,ec}var jb;function ky(){return jb||(jb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validatePssword=e.verifyProfileKeys=e.preparePGPPublicKey=e.encryptPGPKey=e.decryptV2=e.encryptV2=e.stringToHex=e.hexToBytes=e.generateHash=e.decryptPGPKey=e.decryptWithWalletRPCMethod=e.encryptV1=e.getPublicKey=void 0;const t=Ke,r=Py(),n=Py(),s=qr,i=Mt(),o=Je(),a=Eh(),f=M9(),c=K9(),l=Ta(),u=j9(),p=ya,d=J4,h=32,y=12;let g;if(typeof window<"u"&&window.crypto)g=window.crypto;else if(typeof nf<"u")try{g=Wa.webcrypto}catch{throw new Error("Unable To load crypto")}const m=O=>t.__awaiter(void 0,void 0,void 0,function*(){var L;const{account:B,signer:k}=O||{},q=k?new u.Signer(k):void 0,W=B||(yield q==null?void 0:q.getAddress())||"",re=p.createWalletClient({chain:d.mainnet,transport:p.custom(window.ethereum)});return yield(((L=k==null?void 0:k.provider)===null||L===void 0?void 0:L.provider)||re).request({method:"eth_getEncryptionPublicKey",params:[W]})});e.getPublicKey=m;const b=(O,L,B)=>r.encrypt({publicKey:L,data:O,version:B});e.encryptV1=b;const w=(O,L)=>t.__awaiter(void 0,void 0,void 0,function*(){return console.warn("decryptWithWalletRPCMethod method is DEPRECATED. Use decryptPGPKey method with signer!"),yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:O,account:L})});e.decryptWithWalletRPCMethod=w;const E=O=>t.__awaiter(void 0,void 0,void 0,function*(){var L,B,k,q,W;const{encryptedPGPPrivateKey:re,account:ue=null,signer:H=null,env:ae=o.default.ENV.PROD,toUpgrade:V=!0,additionalMeta:U=null,progressHook:te}=O||{};try{if(ue==null&&H==null)throw new Error("At least one from account or signer is necessary!");const ge=(0,i.getWallet)({account:ue,signer:H}),Pe=yield(0,i.getAccountAddress)(ge);if(!(0,a.isValidPushCAIP)(Pe))throw new Error("Invalid address!");const{version:Te}=JSON.parse(re);let z;switch(te==null||te(l.default["PUSH-DECRYPT-01"]),Te){case o.default.ENC_TYPE_V1:{if(!((L=ge==null?void 0:ge.signer)===null||L===void 0)&&L.privateKey)z=(0,n.decrypt)({encryptedData:JSON.parse(re),privateKey:(B=ge==null?void 0:ge.signer)===null||B===void 0?void 0:B.privateKey.substring(2)});else{const $=p.createWalletClient({chain:d.mainnet,transport:p.custom(window.ethereum)});z=yield(((k=H==null?void 0:H.provider)===null||k===void 0?void 0:k.provider)||$).request({method:"eth_decrypt",params:[re,Pe]})}break}case o.default.ENC_TYPE_V2:{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:$}=JSON.parse(re),F=`Enable Push Chat Profile
66
+ `+$;let Q;try{const{verificationProof:oe}=yield(0,i.getEip712Signature)(ge,F,!0);Q=yield(0,e.decryptV2)(JSON.parse(re),(0,e.hexToBytes)(oe||""))}catch{const{verificationProof:ne}=yield(0,i.getEip712Signature)(ge,F,!1);Q=yield(0,e.decryptV2)(JSON.parse(re),(0,e.hexToBytes)(ne||""))}z=new TextDecoder().decode(Q);break}case o.default.ENC_TYPE_V3:{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{preKey:$}=JSON.parse(re),F=`Enable Push Profile
67
+ `+$,{verificationProof:Q}=yield(0,i.getEip191Signature)(ge,F),de=yield(0,e.decryptV2)(JSON.parse(re),(0,e.hexToBytes)(Q||""));z=new TextDecoder().decode(de);break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{let $=null;if(!((q=U==null?void 0:U.NFTPGP_V1)===null||q===void 0)&&q.password)$=U.NFTPGP_V1.password;else if(!((W=U==null?void 0:U.SCWPGP_V1)===null||W===void 0)&&W.password)$=U.SCWPGP_V1.password;else{if(!(ge!=null&&ge.signer))throw new Error("Cannot Decrypt this encryption version without signer!");const{encryptedPassword:de}=JSON.parse(re);$=yield(0,e.decryptPGPKey)({encryptedPGPPrivateKey:JSON.stringify(de),signer:H,env:ae})}const F=yield(0,e.decryptV2)(JSON.parse(re),(0,e.hexToBytes)((0,e.stringToHex)($)));z=new TextDecoder().decode(F);break}default:throw new Error("Invalid Encryption Type")}if(H&&V&&Te!==o.default.ENC_TYPE_V4&&Te!==o.default.ENC_TYPE_V5)try{yield(0,c.upgrade)({env:ae,account:Pe,signer:H,progressHook:te})}catch($){const F=l.default["PUSH-ERROR-01"];te==null||te(F($))}return te==null||te(l.default["PUSH-DECRYPT-02"]),z}catch(ge){const Pe=l.default["PUSH-ERROR-00"];throw te==null||te(Pe(e.decryptPGPKey.name,ge)),Error(`[Push SDK] - API - Error - API ${e.decryptPGPKey.name} -: ${ge}`)}});e.decryptPGPKey=E;const C=O=>s.SHA256(JSON.stringify(O)).toString(s.enc.Hex);e.generateHash=C;const R=O=>t.__awaiter(void 0,void 0,void 0,function*(){return g.getRandomValues(O)}),M=O=>O.reduce((L,B)=>L+B.toString(16).padStart(2,"0"),""),_=O=>{const L=new Uint8Array(O.length/2);for(let B=0;B<O.length;B+=2)L[B/2]=parseInt(O.slice(B,B+2),16);return L};e.hexToBytes=_;const A=O=>{let L="";for(let B=0;B<O.length;B++)L+=O.charCodeAt(B).toString(16).padStart(2,"0");return L};e.stringToHex=A;const I=(O,L)=>t.__awaiter(void 0,void 0,void 0,function*(){const B=yield g.subtle.importKey("raw",O,"HKDF",!1,["deriveKey"]);return g.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:L,info:new ArrayBuffer(0)},B,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}),P=(O,L,B)=>t.__awaiter(void 0,void 0,void 0,function*(){const k=g.getRandomValues(new Uint8Array(h)),q=g.getRandomValues(new Uint8Array(y)),W=yield I(L,k),re={name:"AES-GCM",iv:q};B&&(re.additionalData=B);const ue=yield g.subtle.encrypt(re,W,O);return{ciphertext:M(new Uint8Array(ue)),salt:M(k),nonce:M(q)}});e.encryptV2=P;const v=(O,L,B)=>t.__awaiter(void 0,void 0,void 0,function*(){const k=yield I(L,(0,e.hexToBytes)(O.salt)),q={name:"AES-GCM",iv:(0,e.hexToBytes)(O.nonce)};B&&(q.additionalData=B);const W=yield g.subtle.decrypt(q,k,(0,e.hexToBytes)(O.ciphertext));return new Uint8Array(W)});e.decryptV2=v;const S=(O,L,B,k)=>t.__awaiter(void 0,void 0,void 0,function*(){var q,W,re,ue,H,ae;let V;switch(O){case o.default.ENC_TYPE_V1:{let U;!((q=B==null?void 0:B.signer)===null||q===void 0)&&q.privateKey?U=(0,n.getEncryptionPublicKey)((W=B==null?void 0:B.signer)===null||W===void 0?void 0:W.privateKey.substring(2)):U=yield(0,e.getPublicKey)(B),V=(0,e.encryptV1)(L,U,O);break}case o.default.ENC_TYPE_V2:{const U=M(yield R(new Uint8Array(32))),te=`Enable Push Chat Profile
68
+ `+U,{verificationProof:ge}=yield(0,i.getEip712Signature)(B,te,!0),Te=new TextEncoder().encode(L);V=yield(0,e.encryptV2)(Te,(0,e.hexToBytes)(ge||"")),V.version=o.default.ENC_TYPE_V2,V.preKey=U;break}case o.default.ENC_TYPE_V3:{const U=M(yield R(new Uint8Array(32))),te=`Enable Push Profile
69
+ `+U,{verificationProof:ge}=yield(0,i.getEip191Signature)(B,te),Te=new TextEncoder().encode(L);V=yield(0,e.encryptV2)(Te,(0,e.hexToBytes)(ge||"")),V.version=o.default.ENC_TYPE_V3,V.preKey=U;break}case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{if(!(!((re=k==null?void 0:k.NFTPGP_V1)===null||re===void 0)&&re.password)&&!(!((ue=k==null?void 0:k.SCWPGP_V1)===null||ue===void 0)&&ue.password))throw new Error("Password is required!");const te=new TextEncoder().encode(L),ge=((H=k==null?void 0:k.NFTPGP_V1)===null||H===void 0?void 0:H.password)||((ae=k==null?void 0:k.SCWPGP_V1)===null||ae===void 0?void 0:ae.password);V=yield(0,e.encryptV2)(te,(0,e.hexToBytes)((0,e.stringToHex)(ge))),V.version=O,V.preKey="";break}default:throw new Error("Invalid Encryption Type")}return V});e.encryptPGPKey=S;const T=(O,L,B)=>t.__awaiter(void 0,void 0,void 0,function*(){let k;switch(O){case o.default.ENC_TYPE_V1:{k=L;break}case o.default.ENC_TYPE_V2:case o.default.ENC_TYPE_V3:case o.default.ENC_TYPE_V4:case o.default.ENC_TYPE_V5:{k=JSON.stringify({key:L,signature:"DEPRECATED"});break}default:throw new Error("Invalid Encryption Type")}return k});e.preparePGPPublicKey=T;const N=(O,L,B,k,q)=>t.__awaiter(void 0,void 0,void 0,function*(){let W;try{if(W=JSON.parse(L).key,W===void 0)throw new Error("Invalid Public Key")}catch{W=L}try{if(L&&L.length>0&&q&&q.split(":")[0]==="eip191v2"){const re={caip10:k,did:B,publicKey:L,encryptedPrivateKey:O};if((0,a.isValidNFTCAIP)(B)){const ae="owner",V=JSON.parse(O);ae in V&&delete V[ae],re.encryptedPrivateKey=JSON.stringify(V)}const ue=(0,e.generateHash)(re);if(yield(0,f.verifyProfileSignature)(q,ue,(0,a.isValidNFTCAIP)(B)?(0,a.pCAIP10ToWallet)(JSON.parse(O).owner):(0,a.pCAIP10ToWallet)(B)))return W;throw new Error("Invalid Signature")}return W}catch{return console.warn(`Cannot Verify keys for DID : ${B} !!!`),W}});e.verifyProfileKeys=N;const D=O=>{if(O.length<8)throw new Error("Password must be at least 8 characters long!");if(!/[A-Z]/.test(O))throw new Error("Password must contain at least one uppercase letter!");if(!/[a-z]/.test(O))throw new Error("Password must contain at least one lowercase letter!");if(!/\d/.test(O))throw new Error("Password must contain at least one digit!");if(!/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(O))throw new Error("Password must contain at least one special character!")};e.validatePssword=D}(x1)),x1}var qb;function tt(){return qb||(qb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Ke;t.__exportStar(yS(),e),t.__exportStar(Eh(),e),t.__exportStar(AR(),e),t.__exportStar(ky(),e),t.__exportStar(j9(),e)}(Uh)),Uh}var $b;function SR(){if($b)return Eo;$b=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.getAliasInfo=void 0;const e=Ke,t=tt(),r=Je(),n=en(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{alias:a,aliasChain:f,env:c=r.default.ENV.PROD}=o||{},l=n.ALIAS_CHAIN_ID[f][c],u=(0,t.getCAIPWithChainId)(a,l,"Alias"),h=`${`${(0,t.getAPIBaseUrls)(c)}/v1/alias`}/${u}/channel`;return yield(0,s.axiosGet)(h).then(y=>y.data).catch(y=>{console.error(`[EPNS-SDK] - API ${h}: `,y)})});return Eo.getAliasInfo=i,Eo}var Vb;function q9(){return Vb||(Vb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ke.__exportStar(SR(),e)}(xh)),xh}var U1={},tc={},Fb;function PR(){if(Fb)return tc;Fb=1,Object.defineProperty(tc,"__esModule",{value:!0}),tc._getSubscribers=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=`
70
+ [Push SDK]: _getSubscribers() Deprecation Warning!
71
+ This method has been deprecated, please use the below alternatives
72
+ if you need to,
73
+ * to check if user is subscribed or not: user.getSubscriptions()
74
+ * get channels count: channels.getChannels()
75
+ `,i=o=>e.__awaiter(void 0,void 0,void 0,function*(){console.warn(s);const{channel:a,env:f=r.default.ENV.PROD}=o||{},c=yield(0,t.getCAIPAddress)(f,a,"Channel"),l=(0,t.getCAIPDetails)(c);if(!l)throw Error("Invalid Channel CAIP!");const u=l.networkId,h=`${`${(0,t.getAPIBaseUrls)(f)}/channels/_get_subscribers`}`,y={channel:l.address,blockchain:u,op:"read"};return(yield(0,n.axiosPost)(h,y)).data.subscribers});return tc._getSubscribers=i,tc}var rc={},Hb;function TR(){if(Hb)return rc;Hb=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.getChannel=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=L2(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:a,env:f=r.default.ENV.PROD,raw:c=!0}=o||{},l=yield(0,t.getCAIPAddress)(f,a,"Channel"),d=`${`${(0,t.getAPIBaseUrls)(f)}/v1/channels`}/${l}`;return yield(0,n.axiosGet)(d).then(h=>(c||(h.data.channel_settings=h.data.channel_settings?(0,s.parseSettings)(h.data.channel_settings):null),h.data))});return rc.getChannel=i,rc}var nc={},Gb;function IR(){if(Gb)return nc;Gb=1,Object.defineProperty(nc,"__esModule",{value:!0}),nc.getChannelNotifications=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l=null,raw:u=!0}=i||{},p=yield(0,t.getCAIPAddress)(a,o,"Channel"),h=`${(0,t.getAPIBaseUrls)(a)}/v2/channels`,y=(0,t.getQueryParams)(l?{page:f,limit:c,notificationType:l,raw:u}:{page:f,limit:c,raw:u}),g=`${h}/${p}/notifications?${y}`;return yield(0,n.axiosGet)(g).then(m=>m.data)});return nc.getChannelNotifications=s,nc}var ic={},Ed={},B1={},zb;function Ah(){return zb||(zb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ChannelListOrderType=e.ChannelListSortType=e.ChannelListType=e.FeedType=void 0,function(t){t.INBOX="INBOX",t.SPAM="SPAM"}(e.FeedType||(e.FeedType={})),function(t){t.ALL="all",t.VERIFIED="verified",t.UNVERIFIED="unverified"}(e.ChannelListType||(e.ChannelListType={})),function(t){t.SUBSCRIBER="subscribers"}(e.ChannelListSortType||(e.ChannelListSortType={})),function(t){t.ASCENDING="asc",t.DESCENDING="desc"}(e.ChannelListOrderType||(e.ChannelListOrderType={}))}(B1)),B1}var L1={},Wb;function Sh(){return Wb||(Wb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EVENTS=e.NOTIFICATION=e.ProposedEventNames=e.VideoEventType=e.SpaceEventType=e.GroupEventType=e.MessageEventType=e.MessageOrigin=e.NotificationEventType=e.STREAM=void 0,function(t){t.PROFILE="STREAM.PROFILE",t.ENCRYPTION="STREAM.ENCRYPTION",t.NOTIF="STREAM.NOTIF",t.NOTIF_OPS="STREAM.NOTIF_OPS",t.CHAT="STREAM.CHAT",t.CHAT_OPS="STREAM.CHAT_OPS",t.SPACE="STREAM.SPACE",t.SPACE_OPS="STREAM.SPACE_OPS",t.VIDEO="STREAM.VIDEO",t.CONNECT="STREAM.CONNECT",t.DISCONNECT="STREAM.DISCONNECT"}(e.STREAM||(e.STREAM={})),function(t){t.INBOX="notification.inbox",t.SPAM="notification.spam"}(e.NotificationEventType||(e.NotificationEventType={})),function(t){t.Other="other",t.Self="self"}(e.MessageOrigin||(e.MessageOrigin={})),function(t){t.Message="message",t.Request="request",t.Accept="accept",t.Reject="reject"}(e.MessageEventType||(e.MessageEventType={})),function(t){t.CreateGroup="createGroup",t.UpdateGroup="updateGroup",t.JoinGroup="joinGroup",t.LeaveGroup="leaveGroup",t.Remove="remove",t.RoleChange="roleChange"}(e.GroupEventType||(e.GroupEventType={})),function(t){t.CreateSpace="createSpace",t.UpdateSpace="updateSpace",t.Join="joinSpace",t.Leave="leaveSpace",t.Remove="remove",t.Stop="stop",t.Start="start"}(e.SpaceEventType||(e.SpaceEventType={})),function(t){t.REQUEST="video.request",t.APPROVE="video.approve",t.DENY="video.deny",t.CONNECT="video.connect",t.DISCONNECT="video.disconnect",t.RETRY_REQUEST="video.retry.request",t.RETRY_APPROVE="video.retry.approve"}(e.VideoEventType||(e.VideoEventType={})),function(t){t.Message="chat.message",t.Request="chat.request",t.Accept="chat.accept",t.Reject="chat.reject",t.LeaveGroup="chat.group.participant.leave",t.JoinGroup="chat.group.participant.join",t.CreateGroup="chat.group.create",t.UpdateGroup="chat.group.update",t.Remove="chat.group.participant.remove",t.RoleChange="chat.group.participant.role",t.CreateSpace="space.create",t.UpdateSpace="space.update",t.SpaceRequest="space.request",t.SpaceAccept="space.accept",t.SpaceReject="space.reject",t.LeaveSpace="space.participant.leave",t.JoinSpace="space.participant.join",t.SpaceRemove="space.participant.remove",t.StartSpace="space.start",t.StopSpace="space.stop"}(e.ProposedEventNames||(e.ProposedEventNames={})),e.NOTIFICATION={TYPE:{BROADCAST:1,TARGETTED:3,SUBSET:4}},function(t){t.CONNECT="connect",t.DISCONNECT="disconnect",t.USER_FEEDS="userFeeds",t.USER_SPAM_FEEDS="userSpamFeeds",t.CHAT_RECEIVED_MESSAGE="CHATS",t.CHAT_GROUPS="CHAT_GROUPS"}(e.EVENTS||(e.EVENTS={}))}(L1)),L1}var K1={},Ad={},Yb;function K2(){if(Yb)return Ad;Yb=1,Object.defineProperty(Ad,"__esModule",{value:!0});const e=t=>t.replace("eip155:","");return Ad.default=e,Ad}var j1={},Jb;function CR(){return Jb||(Jb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaces=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,page:u=1,limit:p=10}=a||{};if(!(0,r.isValidPushCAIP)(f))throw new Error("Invalid address!");const d=yield(0,r.convertToValidDID)(f,l),g=`${`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${d}/spaces?page=${u}&limit=${p}`}`;try{const w=(yield(0,i.axiosGet)(g)).data.spaces;return yield(0,s.getSpaceInboxLists)({lists:w,user:d,toDecrypt:!1,pgpPrivateKey:c,env:l})}catch(m){throw console.error(`[Push SDK] - API ${e.spaces.name}: `,m),Error(`[Push SDK] - API ${e.spaces.name}: ${m}`)}});e.spaces=o}(j1)),j1}var q1={},Zb;function RR(){return Zb||(Zb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.trending=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{env:f=n.default.ENV.PROD,page:c=1,limit:l=10}=a||{},p=`${(0,r.getAPIBaseUrls)(f)}/v1/spaces/trending?page=${c}&limit=${l}`;try{const h=(yield(0,i.axiosGet)(p)).data.spaces;return yield(0,s.getTrendingSpaceInboxLists)({lists:h,env:f})}catch(d){throw console.error(`[Push SDK] - API ${e.trending.name}: `,d),Error(`[Push SDK] - API ${e.trending.name}: ${d}`)}});e.trending=o}(q1)),q1}var $1={},Xb;function Bs(){return Xb||(Xb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.get=void 0;const t=Ke,r=Je(),n=Mt(),s=Bl(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:f=r.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,s.getGroup)({chatId:a,env:f});return(0,n.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.get.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.get.name} -: ${c}`)}});e.get=i}($1)),$1}var V1={},Qb;function kR(){return Qb||(Qb=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.info=void 0;const t=Ke,r=Mt(),n=Bl(),s=Je(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,env:f=s.default.ENV.PROD}=o||{};try{if(a==null||a.length==0)throw new Error("spaceId cannot be null or empty");const c=yield(0,n.getGroup)({chatId:a,env:f});return(0,r.groupDtoToSpaceDto)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.info.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.info.name} -: ${c}`)}});e.info=i}(V1)),V1}var sc={},F1={},e5;function $9(){return e5||(e5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCore=e.createGroup=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=Xt(),f=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCore)(l,s.PGPHelper)});e.createGroup=f;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:p=null,signer:d=null,groupName:h,groupDescription:y,members:g,groupImage:m,admins:b,isPublic:w,contractAddressNFT:E,numberOfNFTs:C,contractAddressERC20:R,numberOfERC20:M,env:_=n.default.ENV.PROD,pgpPrivateKey:A=null,meta:I,groupType:P,scheduleAt:v,scheduleEnd:S,rules:T}=l||{};try{if(p==null&&d==null)throw new Error("At least one from account or signer is necessary!");(0,s.validateScheduleDates)(v,S);const N=(0,s.getWallet)({account:p,signer:d});(0,s.createGroupRequestValidator)(h,g,b,y,E,C,R,M);const D=g.map(ge=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ge,_)})),O=b.map(ge=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(ge,_)})),L=yield Promise.all(D),B=yield Promise.all(O),k=yield(0,s.getConnectedUserV2Core)(N,A,_,u),q={groupName:h,groupDescription:y??null,members:L,groupImage:m??null,admins:B,isPublic:w,contractAddressNFT:E??null,numberOfNFTs:C??0,contractAddressERC20:R??null,numberOfERC20:M??0,groupCreator:k.did},W=i.SHA256(JSON.stringify(q)).toString(),re=yield u.sign({message:W,signingKey:k.privateKey}),H="pgp"+":"+re,V=`${(0,r.getAPIBaseUrls)(_)}/v1/chat/groups`,U=(0,s.createGroupPayload)(h,L,B,w,k.did,H,y,m,E,C,R,M,I,P,v,S,T);return(yield(0,o.axiosPost)(V,U)).data}catch(N){throw(0,a.handleError)(N,e.createGroup.name)}});e.createGroupCore=c}(F1)),F1}var t5;function MR(){if(t5)return sc;t5=1,Object.defineProperty(sc,"__esModule",{value:!0}),sc.create=void 0;const e=Ke,t=Je(),r=Mt(),n=$9();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{signer:o,spaceName:a,spaceDescription:f,listeners:c,spaceImage:l,speakers:u,isPublic:p,contractAddressNFT:d,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:g,env:m=t.default.ENV.PROD,pgpPrivateKey:b=null,scheduleAt:w,scheduleEnd:E,rules:C}=i||{},R=C?(0,r.convertSpaceRulesToRules)(C):null;try{const M=yield(0,n.createGroup)({signer:o,groupName:a,groupDescription:f,members:c,groupImage:l,admins:u,isPublic:p,contractAddressNFT:d,numberOfNFTs:h,contractAddressERC20:y,numberOfERC20:g,env:m,pgpPrivateKey:b,groupType:"spaces",scheduleAt:w,scheduleEnd:E,rules:R});return(0,r.groupDtoToSpaceDto)(M)}catch(M){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,M),Error(`[Push SDK] - API - Error - API ${s.name} -: ${M}`)}})}return sc.create=s,sc}var H1={},G1={},ac={},r5;function Ia(){return r5||(r5=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.CHAT=void 0,ac.CHAT={META:{GROUP:{CREATE:"CREATE_GROUP",MEMBER:{ADD:"ADD_MEMBER",REMOVE:"REMOVE_MEMBER",PRIVILEGE:"ASSIGN_MEMBER_PRIVILEGE"},ADMIN:{PRVILEGE:"ASSIGN_ADMIN_PRIVILEGE"},UPDATE:"UPDATE_GROUP",PROFILE:{UPDATE:"UPDATE_GROUP_PROFILE"},META:{UPDATE:"UPDATE_GROUP_META"},USER:{INTERACTION:"USER_INTERACTION"}},SPACE:{CREATE:"CREATE_SPACE",LISTENER:{ADD:"ADD_LISTENER",REMOVE:"REMOVE_LISTENER",PRVILEGE:"ASSIGN_LISTENER_PRIVILEGE"},SPEAKER:{PRVILEGE:"ASSIGN_SPEAKER_PRIVILEGE"},COHOST:{PRVILEGE:"ASSIGN_COHOST_PRIVILEGE"}}},REACTION:{THUMBSUP:"👍",THUMBSDOWN:"👎",HEART:"❤️",CLAP:"👏",LAUGH:"😂",SAD:"😢",ANGRY:"😡",SUPRISE:"😲",FIRE:"🔥"},RECEIPT:{READ:"READ_RECEIPT"},UA:{LISTENER:{JOIN:"LISTENER_JOIN",LEAVE:"LISTENER_LEAVE",MICREQUEST:"LISTENER_REQUEST_MIC"},SPEAKER:{MIC_ON:"SPEAKER_MIC_ON",MIC_OFF:"SPEAKER_MIC_OFF"}},INTENT:{ACCEPT:"ACCEPT_INTENT",REJECT:"REJECT_INTENT",JOIN:"JOIN_GROUP",LEAVE:"LEAVE_GROUP"}}),ac}var z1={},n5;function OR(){return n5||(n5=1,Object.defineProperty(z1,"__esModule",{value:!0})),z1}var i5;function dn(){return i5||(i5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.NotifictaionType=e.VideoCallStatus=e.GROUP_INVITER_ROLE=e.GROUP_RULES_PERMISSION=e.GROUP_RULES_SUB_CATEGORY=e.GROUP_RULES_CATEGORY=e.ConditionType=e.ChatStatus=void 0;const t=Ke;t.__exportStar(Ia(),e),t.__exportStar(OR(),e),function(r){r.ACTIVE="ACTIVE",r.PENDING="PENDING",r.ENDED="ENDED"}(e.ChatStatus||(e.ChatStatus={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD"}(e.ConditionType||(e.ConditionType={})),function(r){r.PUSH="PUSH",r.GUILD="GUILD",r.ERC721="ERC721",r.ERC20="ERC20",r.CUSTOM_ENDPOINT="CustomEndpoint",r.INVITE="INVITE"}(e.GROUP_RULES_CATEGORY||(e.GROUP_RULES_CATEGORY={})),function(r){r.DEFAULT="DEFAULT",r.HOLDER="holder",r.GET="GET"}(e.GROUP_RULES_SUB_CATEGORY||(e.GROUP_RULES_SUB_CATEGORY={})),function(r){r.ENTRY="Entry",r.CHAT="Chat"}(e.GROUP_RULES_PERMISSION||(e.GROUP_RULES_PERMISSION={})),function(r){r.ADMIN="ADMIN",r.OWNER="OWNER"}(e.GROUP_INVITER_ROLE||(e.GROUP_INVITER_ROLE={})),function(r){r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.INITIALIZED=1]="INITIALIZED",r[r.RECEIVED=2]="RECEIVED",r[r.CONNECTED=3]="CONNECTED",r[r.DISCONNECTED=4]="DISCONNECTED",r[r.ENDED=5]="ENDED",r[r.RETRY_INITIALIZED=6]="RETRY_INITIALIZED",r[r.RETRY_RECEIVED=7]="RETRY_RECEIVED"}(e.VideoCallStatus||(e.VideoCallStatus={})),function(r){r[r.BROADCAT=1]="BROADCAT",r[r.TARGETTED=3]="TARGETTED",r[r.SUBSET=4]="SUBSET"}(e.NotifictaionType||(e.NotifictaionType={}))}(G1)),G1}var W1={},Y1={},s5;function j2(){return s5||(s5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMemberStatus=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(f==null||f.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),d=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${f}/members/${u}/status`;return(yield(0,s.axiosGet)(d)).data}catch(u){throw(0,i.handleError)(u,e.getGroupMemberStatus.name)}});e.getGroupMemberStatus=o}(Y1)),Y1}var a5;function Kl(){return a5||(a5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupCore=e.updateGroup=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=Bl(),f=ga(),c=j2(),l=Xt(),u=d=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.updateGroupCore)(d,s.PGPHelper)});e.updateGroup=u;const p=(d,h)=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,groupName:g,groupImage:m,groupDescription:b,members:w,admins:E,account:C=null,signer:R=null,env:M=n.default.ENV.PROD,pgpPrivateKey:_=null,scheduleAt:A,scheduleEnd:I,status:P,meta:v,rules:S}=d||{};try{if(C==null&&R==null)throw new Error("At least one from account or signer is necessary!");const T=(0,s.getWallet)({account:C,signer:R}),N=yield(0,s.getAccountAddress)(T);(0,s.updateGroupRequestValidator)(y,g,w,E,N,b);const D=yield(0,s.getConnectedUserV2Core)(T,_,M,h),O=w.map(F=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(F,M)})),L=E.map(F=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(F,M)})),B=yield Promise.all(O),k=yield Promise.all(L),q=yield(0,a.getGroup)({chatId:y,env:M}),W=new Set(B.map(F=>F.toLowerCase())),re=yield(0,c.getGroupMemberStatus)({chatId:y,did:D.did,env:M});let ue=!0;q.members.map(F=>{W.has(F.wallet.toLowerCase())||(ue=!1)});let H=null;if((!ue||!re.isMember)&&!q.isPublic){const F=f.generateRandomSecret(15),Q=[];q.members.map(de=>{W.has(de.wallet.toLowerCase())&&Q.push(de.publicKey)}),re.isMember||Q.push(D.publicKey),H=yield h.pgpEncrypt({plainText:F,keys:Q})}const ae={groupName:g,groupDescription:b??null,groupImage:m??null,members:B,admins:k,chatId:y},V=i.SHA256(JSON.stringify(ae)).toString(),U=yield h.sign({message:V,signingKey:D.privateKey}),ge="pgp"+":"+U+":"+C,Te=`${(0,r.getAPIBaseUrls)(M)}/v1/chat/groups/${y}`,z=(0,s.updateGroupPayload)(g,B,k,D.did,ge,H,b,m,A,I,P,v,S);return(yield(0,o.axiosPut)(Te,z)).data}catch(T){throw(0,l.handleError)(T,e.updateGroup.name)}});e.updateGroupCore=p}(W1)),W1}var o5;function NR(){return o5||(o5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.update=void 0;const t=Ke,r=Je(),n=dn(),s=Mt(),i=Kl(),o=Bs(),a=f=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:c,spaceName:l,spaceImage:u,spaceDescription:p,listeners:d,speakers:h,signer:y,env:g=r.default.ENV.PROD,pgpPrivateKey:m=null,scheduleAt:b,scheduleEnd:w,status:E}=f||{};try{const C=yield(0,o.get)({spaceId:c,env:g});if(C.status===n.ChatStatus.ACTIVE&&b)throw new Error("Unable change the start date/time of an active space");if(C.status===n.ChatStatus.ENDED&&w)throw new Error("Unable change the end date/time of an ended space");const R=yield(0,i.updateGroup)({chatId:c,groupName:l,groupImage:u,groupDescription:p,members:d,admins:h,signer:y,env:g,pgpPrivateKey:m,scheduleAt:b,scheduleEnd:w,status:E});return(0,s.groupDtoToSpaceDto)(R)}catch(C){throw console.error(`[Push SDK] - API - Error - API ${e.update.name} -: `,C),Error(`[Push SDK] - API - Error - API ${e.update.name} -: ${C}`)}});e.update=a}(H1)),H1}var oc={},J1={},Z1={},X1={},c5;function jl(){return c5||(c5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupInfo=void 0;const t=Ke,r=ho(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,env:c=s.default.ENV.PROD}=a||{};try{if(f==null||f.length==0)throw new Error("chatId cannot be null or empty");const u=`${(0,n.getAPIBaseUrls)(c)}/v2/chat/groups/${f}`;return r.default.get(u).then(p=>p.data).catch(p=>{var d,h;throw!((d=p==null?void 0:p.response)===null||d===void 0)&&d.data?new Error((h=p==null?void 0:p.response)===null||h===void 0?void 0:h.data):new Error(p)})}catch(l){throw(0,i.handleError)(l,e.getGroupInfo.name)}});e.getGroupInfo=o}(X1)),X1}var cc={},Q1={},u5;function V9(){return u5||(u5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupMembersPublicKeys=void 0;const t=Ke,r=ho(),n=tt(),s=Je(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,page:c=1,limit:l=20,env:u=s.default.ENV.PROD}=a;try{if(!f)throw new Error("Chat ID is required.");const d=`${(0,n.getAPIBaseUrls)(u)}/v1/chat/groups/${f}/members/publicKeys?pageNumber=${c}&pageSize=${l}`;return(yield r.default.get(d)).data}catch(p){throw(0,i.handleError)(p,e.getGroupMembersPublicKeys.name)}});e.getGroupMembersPublicKeys=o}(Q1)),Q1}var l5;function F9(){if(l5)return cc;l5=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.getAllGroupMembersPublicKeys=void 0;const e=Ke,t=U2(),r=V9(),n=s=>e.__awaiter(void 0,void 0,void 0,function*(){const{chatId:i,env:o}=s,f=(yield(0,t.getGroupMemberCount)({chatId:i,env:o})).approvedCount,c=5e3,l=Math.ceil(f/c),u=Array.from({length:l},(y,g)=>g+1),p=[],d=u.map(y=>(0,r.getGroupMembersPublicKeys)({chatId:i,env:o,page:y,limit:c}));return(yield Promise.all(d)).forEach(y=>{y.members.length>0&&p.push(...y.members)}),p});return cc.getAllGroupMembersPublicKeys=n,cc}var d5;function ql(){return d5||(d5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupMembers=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=jl(),a=j2(),f=ga(),c=F9(),l=en(),u=Tt(),p=Xt(),d=h=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:y,upsert:g,remove:m,account:b=null,signer:w=null,env:E=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:R=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h;try{(0,s.validateGroupMemberUpdateOptions)(h);const M=(0,s.getWallet)({account:b,signer:w}),_=yield(0,s.getConnectedUserV2Core)(M,C,E,s.PGPHelper),A=Object.entries(g).map(([re,ue])=>t.__awaiter(void 0,void 0,void 0,function*(){const H=yield Promise.all(ue.map(ae=>(0,r.convertToValidDID)(ae,E)));return[re,H]})),I=Object.fromEntries(yield Promise.all(A)),P=yield Promise.all(m.map(re=>(0,r.convertToValidDID)(re,E)));let v=null;const S=yield(0,o.getGroupInfo)({chatId:y,env:E});if(!S)throw new Error("Group not found");if(!S.isPublic&&(S.encryptedSecret||!R)){const{isMember:re}=yield(0,a.getGroupMemberStatus)({chatId:y,did:_.did,env:E}),ue=yield(0,c.getAllGroupMembersPublicKeys)({chatId:y,env:E}),H=new Set(P.map(V=>V.toLowerCase()));let ae=!0;if(ue.map(V=>{H.has(V.did.toLowerCase())&&(ae=!1)}),!ae||!re){const V=f.generateRandomSecret(15),U=[];ue.map(te=>{H.has(te.did.toLowerCase())||U.push(te.publicKey)}),re||U.push(_.publicKey),v=yield(0,s.pgpEncrypt)({plainText:V,keys:U})}}const T={upsert:I,remove:P,encryptedSecret:v},N=i.SHA256(JSON.stringify(T)).toString(),L=`pgpv2:${yield s.PGPHelper.sign({message:N,signingKey:_.privateKey})}:${_.did}`,k=`${(0,r.getAPIBaseUrls)(E)}/v1/chat/groups/${y}/members`,q={upsert:I,remove:P,encryptedSecret:v,deltaVerificationProof:L};return(yield(0,u.axiosPut)(k,q)).data}catch(M){throw(0,p.handleError)(M,e.updateGroupMembers.name)}});e.updateGroupMembers=d}(Z1)),Z1}var f5;function H9(){return f5||(f5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addAdmins=void 0;const t=Ke,r=en(),n=Je(),s=Xt(),i=ql(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const g={chatId:f,upsert:{members:[],admins:c},remove:[],account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(g)}catch(y){throw(0,s.handleError)(y,e.addAdmins.name)}});e.addAdmins=o}(J1)),J1}var h5;function q2(){if(h5)return oc;h5=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.addSpeakers=void 0;const e=Ke,t=Je(),r=Mt(),n=H9(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){var o,a;const{spaceId:f,speakers:c,signer:l=null,env:u=(o=i==null?void 0:i.env)!==null&&o!==void 0?o:t.default.ENV.PROD,pgpPrivateKey:p=(a=i==null?void 0:i.pgpPrivateKey)!==null&&a!==void 0?a:null}=i,d=yield(0,n.addAdmins)({chatId:f,admins:c,signer:l,env:u,pgpPrivateKey:p});return(0,r.groupDtoToSpaceDtoV2)(d,u)});return oc.addSpeakers=s,oc}var ep={},tp={},p5;function G9(){return p5||(p5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeAdmins=void 0;const t=Ke,r=en(),n=Je(),s=Xt(),i=ql(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,admins:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Admin address array cannot be empty!");const y={chatId:f,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeAdmins.name)}});e.removeAdmins=o}(tp)),tp}var y5;function DR(){return y5||(y5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeSpeakers=void 0;const t=Ke,r=Je(),n=Mt(),s=G9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,speakers:f,signer:c=null,env:l=r.default.ENV.PROD,pgpPrivateKey:u=null}=o||{};try{const p=yield(0,s.removeAdmins)({chatId:a,admins:f,signer:c,env:l,pgpPrivateKey:u});return(0,n.groupDtoToSpaceDtoV2)(p,l)}catch(p){throw console.error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: `,p),Error(`[Push SDK] - API - Error - API ${e.removeSpeakers.name} -: ${p}`)}});e.removeSpeakers=i}(ep)),ep}var rp={},np={},g5;function z9(){return g5||(g5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addMembers=void 0;const t=Ke,r=en(),n=Je(),s=Xt(),i=ql(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const g={chatId:f,upsert:{members:c,admins:[]},remove:[],account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(g)}catch(y){throw(0,s.handleError)(y,e.addMembers.name)}});e.addMembers=o}(np)),np}var m5;function xR(){return m5||(m5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.addListeners=void 0;const t=Ke,r=Je(),n=Mt(),s=z9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:f,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const d=yield(0,s.addMembers)({chatId:a,members:f,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(d,u)}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.addListeners.name} -: ${d}`)}});e.addListeners=i}(rp)),rp}var ip={},sp={},v5;function W9(){return v5||(v5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeMembers=void 0;const t=Ke,r=en(),n=Je(),s=Xt(),i=ql(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,members:c,account:l=null,signer:u=null,env:p=n.default.ENV.PROD,pgpPrivateKey:d=null,overrideSecretKeyGeneration:h=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");if(!c||c.length===0)throw new Error("Member address array cannot be empty!");const y={chatId:f,upsert:{members:[],admins:[]},remove:c,account:l,signer:u,pgpPrivateKey:d,env:p,overrideSecretKeyGeneration:h};return yield(0,i.updateGroupMembers)(y)}catch(y){throw(0,s.handleError)(y,e.removeMembers.name)}});e.removeMembers=o}(sp)),sp}var b5;function UR(){return b5||(b5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.removeListeners=void 0;const t=Ke,r=Je(),n=Mt(),s=W9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:a,listeners:f,account:c=null,signer:l=null,env:u=r.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{const d=yield(0,s.removeMembers)({chatId:a,members:f,account:c,signer:l,env:u,pgpPrivateKey:p});return(0,n.groupDtoToSpaceDtoV2)(d,u)}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.removeListeners.name} -: ${d}`)}});e.removeListeners=i}(ip)),ip}var ap={},op={},_5;function Y9(){return _5||(_5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approveCore=e.approve=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=ga(),f=jl(),c=F9(),l=en(),u=Xt(),p=h=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.approveCore)(h,s.PGPHelper)});e.approve=p;const d=(h,y)=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:g="Approved",account:m=null,signer:b=null,senderAddress:w,env:E=n.default.ENV.PROD,pgpPrivateKey:C=null,overrideSecretKeyGeneration:R=!l.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=h||{};if(m==null&&b==null)throw new Error("At least one from account or signer is necessary!");const M=(0,s.getWallet)({account:m,signer:b}),_=yield(0,s.getAccountAddress)(M),A=!(0,r.isValidPushCAIP)(w),I=yield(0,s.getConnectedUserV2Core)(M,C,E,y),P=A?yield(0,r.convertToValidDID)(_,E):yield(0,r.convertToValidDID)(w,E),v=A?yield(0,r.convertToValidDID)(w,E):yield(0,r.convertToValidDID)(_,E);let S=null,T="pgp";if(A){const W=yield(0,f.getGroupInfo)({chatId:w,env:E});if(W&&!W.isPublic&&(W.encryptedSecret||!R)){T="pgpv2";const re=a.generateRandomSecret(15),H=(yield(0,c.getAllGroupMembersPublicKeys)({chatId:W.chatId,env:E})).map(ae=>ae.publicKey);H.push(I.publicKey),S=yield y.pgpEncrypt({plainText:re,keys:H})}}let N;switch(T){case"pgp":{N={fromDID:P,toDID:v,status:g};break}case"pgpv2":{N={fromDID:P,toDID:v,status:g,encryptedSecret:S};break}}const D=i.SHA256(JSON.stringify(N)).toString(),O=yield y.sign({message:D,signingKey:I.privateKey}),L=`${T}:${O}`,B={fromDID:P,toDID:v,signature:O,status:g,sigType:T,verificationProof:L,encryptedSecret:S},q=`${(0,r.getAPIBaseUrls)(E)}/v1/chat/request/accept`;return(0,o.axiosPut)(q,B).then(W=>W.data).catch(W=>{throw(0,u.handleError)(W,e.approve.name)})});e.approveCore=d}(op)),op}var w5;function J9(){return w5||(w5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.approve=void 0;const t=Ke,r=tt(),n=Je(),s=Y9(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{status:a="Approved",account:f=null,signer:c=null,senderAddress:l,env:u=n.default.ENV.PROD,pgpPrivateKey:p=null}=o||{};try{if(f==null&&c==null)throw new Error("At least one from account or signer is necessary!");if(!(0,r.isValidPushCAIP)(l)&&!l.startsWith("spaces:"))throw new Error("Not a valid spaceId or ETH address");return yield(0,s.approve)({status:a,account:f,signer:c,senderAddress:l,env:u,pgpPrivateKey:p})}catch(d){throw console.error(`[Push SDK] - API - Error - API ${e.approve.name} -: `,d),Error(`[Push SDK] - API - Error - API ${e.approve.name} -: ${d}`)}});e.approve=i}(ap)),ap}var cp={},E5;function BR(){return E5||(E5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requests=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,page:p=1,limit:d=10}=a||{},h=yield(0,r.convertToValidDID)(f,l),g=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${h}/requests?page=${p}&limit=${d}`;try{if(!(0,r.isValidPushCAIP)(h))throw new Error("Invalid address!");const b=(yield(0,i.axiosGet)(g)).data.requests;return yield(0,s.getSpaceInboxLists)({lists:b,user:h,toDecrypt:u,pgpPrivateKey:c,env:l})}catch(m){throw console.error(`[Push SDK] - API ${e.requests.name}: `,m),Error(`[Push SDK] - API ${e.requests.name}: ${m}`)}});e.requests=o}(cp)),cp}var up={},lp={},dp={},A5;function LR(){return A5||(A5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chatsCore=e.chats=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Tt(),o=Xt(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.chatsCore)(c,s.PGPHelper)});e.chats=a;const f=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:d=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:g=10}=c||{};if(!(0,r.isValidPushCAIP)(u))throw new Error("Invalid address!");const m=yield(0,r.convertToValidDID)(u,d),E=`${`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${m}/chats?page=${y}&limit=${g}`}`;try{const R=(yield(0,i.axiosGet)(E)).data.chats,M=(0,s.addDeprecatedInfo)(R);return yield(0,s.getInboxLists)({lists:M,user:m,toDecrypt:h,pgpPrivateKey:p,env:d},l)}catch(C){throw(0,o.handleError)(C,e.chats.name)}});e.chatsCore=f}(dp)),dp}var fp={},S5;function KR(){return S5||(S5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.chat=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Mt(),o=Xt(),a=f=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:c,pgpPrivateKey:l,env:u=n.default.ENV.PROD,toDecrypt:p=!1,recipient:d}=f||{},h=yield(0,r.convertToValidDID)(c,u),y=yield(0,r.convertToValidDID)(d,u);if(!(0,r.isValidPushCAIP)(h))throw new Error(`Invalid address ${h}`);const m=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/users/${h}/chat/${y}`;try{const w=(yield(0,s.axiosGet)(m)).data;if(Object.keys(w).length!==0){const E=(0,i.addDeprecatedInfo)([w]),[C]=yield(0,i.getInboxLists)({lists:E,user:h,toDecrypt:p,pgpPrivateKey:l,env:u},i.PGPHelper);return C}else return w}catch(b){throw(0,o.handleError)(b,e.chat.name)}});e.chat=a}(fp)),fp}var hp={},P5;function jR(){return P5||(P5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.requestsCore=e.requests=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Mt(),o=Xt(),a=c=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.requestsCore)(c,i.PGPHelper)});e.requests=a;const f=(c,l)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:u,pgpPrivateKey:p,env:d=n.default.ENV.PROD,toDecrypt:h=!1,page:y=1,limit:g=10}=c||{},m=yield(0,r.convertToValidDID)(u,d),w=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/users/${m}/requests?page=${y}&limit=${g}`;try{if(!(0,r.isValidPushCAIP)(m))throw new Error("Invalid address!");const C=(yield(0,s.axiosGet)(w)).data.requests,R=(0,i.addDeprecatedInfo)(C);return yield(0,i.getInboxLists)({lists:R,user:m,toDecrypt:h,pgpPrivateKey:p,env:d},l)}catch(E){throw(0,o.handleError)(E,e.requests.name)}});e.requestsCore=f}(hp)),hp}var pp={},yp={},T5;function Z9(){return T5||(T5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.conversationHash=void 0;const t=Ke,r=Je(),n=Xt(),s=tt(),i=Mt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{conversationId:f,account:c,env:l=r.default.ENV.PROD}=a||{};try{if(!(0,s.isValidPushCAIP)(c))throw new Error("Invalid address!");const u=yield(0,s.convertToValidDID)(f,l),p=yield(0,s.convertToValidDID)(c,l);return yield(0,i.getConversationHashService)({conversationId:u,account:p,env:l})}catch(u){throw(0,n.handleError)(u,e.conversationHash.name)}});e.conversationHash=o}(yp)),yp}var uc={},gp={exports:{}},I5;function qR(){return I5||(I5=1,function(e,t){(function(r,n){e.exports=n()})(self,()=>{return r={7629:(s,i,o)=>{const a=o(375),f=o(8571),c=o(9474),l=o(1687),u=o(8652),p=o(8160),d=o(3292),h=o(6354),y=o(8901),g=o(9708),m=o(6914),b=o(2294),w=o(6133),E=o(1152),C=o(8863),R=o(2036),M={Base:class{constructor(_){this.type=_,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new b.Ids,this._preferences=null,this._refs=new w.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return a(typeof g.describe=="function","Manifest functionality disabled"),g.describe(this)}allow(..._){return p.verifyFlat(_,"allow"),this._values(_,"_valids")}alter(_){a(_&&typeof _=="object"&&!Array.isArray(_),"Invalid targets argument"),a(!this._inRuleset(),"Cannot set alterations inside a ruleset");const A=this.clone();A.$_terms.alterations=A.$_terms.alterations||[];for(const I in _){const P=_[I];a(typeof P=="function","Alteration adjuster for",I,"must be a function"),A.$_terms.alterations.push({target:I,adjuster:P})}return A.$_temp.ruleset=!1,A}artifact(_){return a(_!==void 0,"Artifact cannot be undefined"),a(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",_)}cast(_){return a(_===!1||typeof _=="string","Invalid to value"),a(_===!1||this._definition.cast[_],"Type",this.type,"does not support casting to",_),this.$_setFlag("cast",_===!1?void 0:_)}default(_,A){return this._default("default",_,A)}description(_){return a(_&&typeof _=="string","Description must be a non-empty string"),this.$_setFlag("description",_)}empty(_){const A=this.clone();return _!==void 0&&(_=A.$_compile(_,{override:!1})),A.$_setFlag("empty",_,{clone:!1})}error(_){return a(_,"Missing error"),a(_ instanceof Error||typeof _=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",_)}example(_,A={}){return a(_!==void 0,"Missing example"),p.assertOptions(A,["override"]),this._inner("examples",_,{single:!0,override:A.override})}external(_,A){return typeof _=="object"&&(a(!A,"Cannot combine options with description"),A=_.description,_=_.method),a(typeof _=="function","Method must be a function"),a(A===void 0||A&&typeof A=="string","Description must be a non-empty string"),this._inner("externals",{method:_,description:A},{single:!0})}failover(_,A){return this._default("failover",_,A)}forbidden(){return this.presence("forbidden")}id(_){return _?(a(typeof _=="string","id must be a non-empty string"),a(/^[^\.]+$/.test(_),"id cannot contain period character"),this.$_setFlag("id",_)):this.$_setFlag("id",void 0)}invalid(..._){return this._values(_,"_invalids")}label(_){return a(_&&typeof _=="string","Label name must be a non-empty string"),this.$_setFlag("label",_)}meta(_){return a(_!==void 0,"Meta cannot be undefined"),this._inner("metas",_,{single:!0})}note(..._){a(_.length,"Missing notes");for(const A of _)a(A&&typeof A=="string","Notes must be non-empty strings");return this._inner("notes",_)}only(_=!0){return a(typeof _=="boolean","Invalid mode:",_),this.$_setFlag("only",_)}optional(){return this.presence("optional")}prefs(_){a(_,"Missing preferences"),a(_.context===void 0,"Cannot override context"),a(_.externals===void 0,"Cannot override externals"),a(_.warnings===void 0,"Cannot override warnings"),a(_.debug===void 0,"Cannot override debug"),p.checkPreferences(_);const A=this.clone();return A._preferences=p.preferences(A._preferences,_),A}presence(_){return a(["optional","required","forbidden"].includes(_),"Unknown presence mode",_),this.$_setFlag("presence",_)}raw(_=!0){return this.$_setFlag("result",_?"raw":void 0)}result(_){return a(["raw","strip"].includes(_),"Unknown result mode",_),this.$_setFlag("result",_)}required(){return this.presence("required")}strict(_){const A=this.clone(),I=_!==void 0&&!_;return A._preferences=p.preferences(A._preferences,{convert:I}),A}strip(_=!0){return this.$_setFlag("result",_?"strip":void 0)}tag(..._){a(_.length,"Missing tags");for(const A of _)a(A&&typeof A=="string","Tags must be non-empty strings");return this._inner("tags",_)}unit(_){return a(_&&typeof _=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",_)}valid(..._){p.verifyFlat(_,"valid");const A=this.allow(..._);return A.$_setFlag("only",!!A._valids,{clone:!1}),A}when(_,A){const I=this.clone();I.$_terms.whens||(I.$_terms.whens=[]);const P=d.when(I,_,A);if(!["any","link"].includes(I.type)){const v=P.is?[P]:P.switch;for(const S of v)a(!S.then||S.then.type==="any"||S.then.type===I.type,"Cannot combine",I.type,"with",S.then&&S.then.type),a(!S.otherwise||S.otherwise.type==="any"||S.otherwise.type===I.type,"Cannot combine",I.type,"with",S.otherwise&&S.otherwise.type)}return I.$_terms.whens.push(P),I.$_mutateRebuild()}cache(_){a(!this._inRuleset(),"Cannot set caching inside a ruleset"),a(!this._cache,"Cannot override schema cache"),a(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const A=this.clone();return A._cache=_||u.provider.provision(),A.$_temp.ruleset=!1,A}clone(){const _=Object.create(Object.getPrototypeOf(this));return this._assign(_)}concat(_){a(p.isSchema(_),"Invalid schema object"),a(this.type==="any"||_.type==="any"||_.type===this.type,"Cannot merge type",this.type,"with another type:",_.type),a(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),a(!_._inRuleset(),"Cannot concatenate a schema with open ruleset");let A=this.clone();if(this.type==="any"&&_.type!=="any"){const I=_.clone();for(const P of Object.keys(A))P!=="type"&&(I[P]=A[P]);A=I}A._ids.concat(_._ids),A._refs.register(_,w.toSibling),A._preferences=A._preferences?p.preferences(A._preferences,_._preferences):_._preferences,A._valids=R.merge(A._valids,_._valids,_._invalids),A._invalids=R.merge(A._invalids,_._invalids,_._valids);for(const I of _._singleRules.keys())A._singleRules.has(I)&&(A._rules=A._rules.filter(P=>P.keep||P.name!==I),A._singleRules.delete(I));for(const I of _._rules)_._definition.rules[I.method].multi||A._singleRules.set(I.name,I),A._rules.push(I);if(A._flags.empty&&_._flags.empty){A._flags.empty=A._flags.empty.concat(_._flags.empty);const I=Object.assign({},_._flags);delete I.empty,l(A._flags,I)}else if(_._flags.empty){A._flags.empty=_._flags.empty;const I=Object.assign({},_._flags);delete I.empty,l(A._flags,I)}else l(A._flags,_._flags);for(const I in _.$_terms){const P=_.$_terms[I];P?A.$_terms[I]?A.$_terms[I]=A.$_terms[I].concat(P):A.$_terms[I]=P.slice():A.$_terms[I]||(A.$_terms[I]=P)}return this.$_root._tracer&&this.$_root._tracer._combine(A,[this,_]),A.$_mutateRebuild()}extend(_){return a(!_.base,"Cannot extend type with another base"),y.type(this,_)}extract(_){return _=Array.isArray(_)?_:_.split("."),this._ids.reach(_)}fork(_,A){a(!this._inRuleset(),"Cannot fork inside a ruleset");let I=this;for(let P of[].concat(_))P=Array.isArray(P)?P:P.split("."),I=I._ids.fork(P,A,I);return I.$_temp.ruleset=!1,I}rule(_){const A=this._definition;p.assertOptions(_,Object.keys(A.modifiers)),a(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const I=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;a(I>=0&&I<this._rules.length,"Cannot apply rules to empty ruleset");const P=this.clone();for(let v=I;v<P._rules.length;++v){const S=P._rules[v],T=f(S);for(const N in _)A.modifiers[N](T,_[N]),a(T.name===S.name,"Cannot change rule name");P._rules[v]=T,P._singleRules.get(T.name)===S&&P._singleRules.set(T.name,T)}return P.$_temp.ruleset=!1,P.$_mutateRebuild()}get ruleset(){a(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const _=this.clone();return _.$_temp.ruleset=_._rules.length,_}get $(){return this.ruleset}tailor(_){_=[].concat(_),a(!this._inRuleset(),"Cannot tailor inside a ruleset");let A=this;if(this.$_terms.alterations)for(const{target:I,adjuster:P}of this.$_terms.alterations)_.includes(I)&&(A=P(A),a(p.isSchema(A),"Alteration adjuster for",I,"failed to return a schema object"));return A=A.$_modify({each:I=>I.tailor(_),ref:!1}),A.$_temp.ruleset=!1,A.$_mutateRebuild()}tracer(){return E.location?E.location(this):this}validate(_,A){return C.entry(_,this,A)}validateAsync(_,A){return C.entryAsync(_,this,A)}$_addRule(_){typeof _=="string"&&(_={name:_}),a(_&&typeof _=="object","Invalid options"),a(_.name&&typeof _.name=="string","Invalid rule name");for(const S in _)a(S[0]!=="_","Cannot set private rule properties");const A=Object.assign({},_);A._resolve=[],A.method=A.method||A.name;const I=this._definition.rules[A.method],P=A.args;a(I,"Unknown rule",A.method);const v=this.clone();if(P){a(Object.keys(P).length===1||Object.keys(P).length===this._definition.rules[A.name].args.length,"Invalid rule definition for",this.type,A.name);for(const S in P){let T=P[S];if(I.argsByName){const N=I.argsByName.get(S);if(N.ref&&p.isResolvable(T))A._resolve.push(S),v.$_mutateRegister(T);else if(N.normalize&&(T=N.normalize(T),P[S]=T),N.assert){const D=p.validateArg(T,S,N);a(!D,D,"or reference")}}T!==void 0?P[S]=T:delete P[S]}}return I.multi||(v._ruleRemove(A.name,{clone:!1}),v._singleRules.set(A.name,A)),v.$_temp.ruleset===!1&&(v.$_temp.ruleset=null),I.priority?v._rules.unshift(A):v._rules.push(A),v}$_compile(_,A){return d.schema(this.$_root,_,A)}$_createError(_,A,I,P,v,S={}){const T=S.flags!==!1?this._flags:{},N=S.messages?m.merge(this._definition.messages,S.messages):this._definition.messages;return new h.Report(_,A,I,T,N,P,v)}$_getFlag(_){return this._flags[_]}$_getRule(_){return this._singleRules.get(_)}$_mapLabels(_){return _=Array.isArray(_)?_:_.split("."),this._ids.labels(_)}$_match(_,A,I,P){(I=Object.assign({},I)).abortEarly=!0,I._externals=!1,A.snapshot();const v=!C.validate(_,this,A,I,P).errors;return A.restore(),v}$_modify(_){return p.assertOptions(_,["each","once","ref","schema"]),b.schema(this,_)||this}$_mutateRebuild(){return a(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(_,{source:A,name:I,path:P,key:v})=>{const S=this._definition[A][I]&&this._definition[A][I].register;S!==!1&&this.$_mutateRegister(_,{family:S,key:v})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(_,{family:A,key:I}={}){this._refs.register(_,A),this._ids.register(_,{key:I})}$_property(_){return this._definition.properties[_]}$_reach(_){return this._ids.reach(_)}$_rootReferences(){return this._refs.roots()}$_setFlag(_,A,I={}){a(_[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const P=this._definition.flags[_]||{};if(c(A,P.default)&&(A=void 0),c(A,this._flags[_]))return this;const v=I.clone!==!1?this.clone():this;return A!==void 0?(v._flags[_]=A,v.$_mutateRegister(A)):delete v._flags[_],_[0]!=="_"&&(v.$_temp.ruleset=!1),v}$_parent(_,...A){return this[_][p.symbols.parent].call(this,...A)}$_validate(_,A,I){return C.validate(_,this,A,I)}_assign(_){_.type=this.type,_.$_root=this.$_root,_.$_temp=Object.assign({},this.$_temp),_.$_temp.whens={},_._ids=this._ids.clone(),_._preferences=this._preferences,_._valids=this._valids&&this._valids.clone(),_._invalids=this._invalids&&this._invalids.clone(),_._rules=this._rules.slice(),_._singleRules=f(this._singleRules,{shallow:!0}),_._refs=this._refs.clone(),_._flags=Object.assign({},this._flags),_._cache=null,_.$_terms={};for(const A in this.$_terms)_.$_terms[A]=this.$_terms[A]?this.$_terms[A].slice():null;_.$_super={};for(const A in this.$_super)_.$_super[A]=this._super[A].bind(_);return _}_bare(){const _=this.clone();_._reset();const A=_._definition.terms;for(const I in A){const P=A[I];_.$_terms[I]=P.init}return _.$_mutateRebuild()}_default(_,A,I={}){return p.assertOptions(I,"literal"),a(A!==void 0,"Missing",_,"value"),a(typeof A=="function"||!I.literal,"Only function value supports literal option"),typeof A=="function"&&I.literal&&(A={[p.symbols.literal]:!0,literal:A}),this.$_setFlag(_,A)}_generate(_,A,I){if(!this.$_terms.whens)return{schema:this};const P=[],v=[];for(let N=0;N<this.$_terms.whens.length;++N){const D=this.$_terms.whens[N];if(D.concat){P.push(D.concat),v.push(`${N}.concat`);continue}const O=D.ref?D.ref.resolve(_,A,I):_,L=D.is?[D]:D.switch,B=v.length;for(let k=0;k<L.length;++k){const{is:q,then:W,otherwise:re}=L[k],ue=`${N}${D.switch?"."+k:""}`;if(q.$_match(O,A.nest(q,`${ue}.is`),I)){if(W){const H=A.localize([...A.path,`${ue}.then`],A.ancestors,A.schemas),{schema:ae,id:V}=W._generate(_,H,I);P.push(ae),v.push(`${ue}.then${V?`(${V})`:""}`);break}}else if(re){const H=A.localize([...A.path,`${ue}.otherwise`],A.ancestors,A.schemas),{schema:ae,id:V}=re._generate(_,H,I);P.push(ae),v.push(`${ue}.otherwise${V?`(${V})`:""}`);break}}if(D.break&&v.length>B)break}const S=v.join(", ");if(A.mainstay.tracer.debug(A,"rule","when",S),!S)return{schema:this};if(!A.mainstay.tracer.active&&this.$_temp.whens[S])return{schema:this.$_temp.whens[S],id:S};let T=this;this._definition.generate&&(T=this._definition.generate(this,_,A,I));for(const N of P)T=T.concat(N);return this.$_root._tracer&&this.$_root._tracer._combine(T,[this,...P]),this.$_temp.whens[S]=T,{schema:T,id:S}}_inner(_,A,I={}){a(!this._inRuleset(),`Cannot set ${_} inside a ruleset`);const P=this.clone();return P.$_terms[_]&&!I.override||(P.$_terms[_]=[]),I.single?P.$_terms[_].push(A):P.$_terms[_].push(...A),P.$_temp.ruleset=!1,P}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(_,A={}){if(!this._singleRules.has(_))return this;const I=A.clone!==!1?this.clone():this;I._singleRules.delete(_);const P=[];for(let v=0;v<I._rules.length;++v){const S=I._rules[v];S.name!==_||S.keep?P.push(S):I._inRuleset()&&v<I.$_temp.ruleset&&--I.$_temp.ruleset}return I._rules=P,I}_values(_,A){p.verifyFlat(_,A.slice(1,-1));const I=this.clone(),P=_[0]===p.symbols.override;if(P&&(_=_.slice(1)),!I[A]&&_.length?I[A]=new R:P&&(I[A]=_.length?new R:null,I.$_mutateRebuild()),!I[A])return I;P&&I[A].override();for(const v of _){a(v!==void 0,"Cannot call allow/valid/invalid with undefined"),a(v!==p.symbols.override,"Override must be the first value");const S=A==="_invalids"?"_valids":"_invalids";I[S]&&(I[S].remove(v),I[S].length||(a(A==="_valids"||!I._flags.only,"Setting invalid value",v,"leaves schema rejecting all values due to previous valid rule"),I[S]=null)),I[A].add(v,I._refs)}return I}}};M.Base.prototype[p.symbols.any]={version:p.version,compile:d.compile,root:"$_root"},M.Base.prototype.isImmutable=!0,M.Base.prototype.deny=M.Base.prototype.invalid,M.Base.prototype.disallow=M.Base.prototype.invalid,M.Base.prototype.equal=M.Base.prototype.valid,M.Base.prototype.exist=M.Base.prototype.required,M.Base.prototype.not=M.Base.prototype.invalid,M.Base.prototype.options=M.Base.prototype.prefs,M.Base.prototype.preferences=M.Base.prototype.prefs,s.exports=new M.Base},8652:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8160),l={max:1e3,supported:new Set(["undefined","boolean","number","string"])};i.provider={provision:u=>new l.Cache(u)},l.Cache=class{constructor(u={}){c.assertOptions(u,["max"]),a(u.max===void 0||u.max&&u.max>0&&isFinite(u.max),"Invalid max cache size"),this._max=u.max||l.max,this._map=new Map,this._list=new l.List}get length(){return this._map.size}set(u,p){if(u!==null&&!l.supported.has(typeof u))return;let d=this._map.get(u);if(d)return d.value=p,void this._list.first(d);d=this._list.unshift({key:u,value:p}),this._map.set(u,d),this._compact()}get(u){const p=this._map.get(u);if(p)return this._list.first(p),f(p.value)}_compact(){if(this._map.size>this._max){const u=this._list.pop();this._map.delete(u.key)}}},l.List=class{constructor(){this.tail=null,this.head=null}unshift(u){return u.next=null,u.prev=this.head,this.head&&(this.head.next=u),this.head=u,this.tail||(this.tail=u),u}first(u){u!==this.head&&(this._remove(u),this.unshift(u))}pop(){return this._remove(this.tail)}_remove(u){const{next:p,prev:d}=u;return p.prev=d,d&&(d.next=p),u===this.tail&&(this.tail=p),u.prev=null,u.next=null,u}}},8160:(s,i,o)=>{const a=o(375),f=o(7916),c=o(5934);let l,u;const p={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};i.version=c.version,i.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},i.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},i.assertOptions=function(d,h,y="Options"){a(d&&typeof d=="object"&&!Array.isArray(d),"Options must be of type object");const g=Object.keys(d).filter(m=>!h.includes(m));a(g.length===0,`${y} contain unknown keys: ${g}`)},i.checkPreferences=function(d){u=u||o(3378);const h=u.preferences.validate(d);if(h.error)throw new f([h.error.details[0].message])},i.compare=function(d,h,y){switch(y){case"=":return d===h;case">":return d>h;case"<":return d<h;case">=":return d>=h;case"<=":return d<=h}},i.default=function(d,h){return d===void 0?h:d},i.isIsoDate=function(d){return p.isoDate.test(d)},i.isNumber=function(d){return typeof d=="number"&&!isNaN(d)},i.isResolvable=function(d){return!!d&&(d[i.symbols.ref]||d[i.symbols.template])},i.isSchema=function(d,h={}){const y=d&&d[i.symbols.any];return!!y&&(a(h.legacy||y.version===i.version,"Cannot mix different versions of joi schemas"),!0)},i.isValues=function(d){return d[i.symbols.values]},i.limit=function(d){return Number.isSafeInteger(d)&&d>=0},i.preferences=function(d,h){l=l||o(6914),d=d||{},h=h||{};const y=Object.assign({},d,h);return h.errors&&d.errors&&(y.errors=Object.assign({},d.errors,h.errors),y.errors.wrap=Object.assign({},d.errors.wrap,h.errors.wrap)),h.messages&&(y.messages=l.compile(h.messages,d.messages)),delete y[i.symbols.prefs],y},i.tryWithPath=function(d,h,y={}){try{return d()}catch(g){throw g.path!==void 0?g.path=h+"."+g.path:g.path=h,y.append&&(g.message=`${g.message} (${g.path})`),g}},i.validateArg=function(d,h,{assert:y,message:g}){if(i.isSchema(y)){const m=y.validate(d);return m.error?m.error.message:void 0}if(!y(d))return h?`${h} ${g}`:g},i.verifyFlat=function(d,h){for(const y of d)a(!Array.isArray(y),"Method no longer accepts array arguments:",h)}},3292:(s,i,o)=>{const a=o(375),f=o(8160),c=o(6133),l={};i.schema=function(u,p,d={}){f.assertOptions(d,["appendPath","override"]);try{return l.schema(u,p,d)}catch(h){throw d.appendPath&&h.path!==void 0&&(h.message=`${h.message} (${h.path})`),h}},l.schema=function(u,p,d){a(p!==void 0,"Invalid undefined schema"),Array.isArray(p)&&(a(p.length,"Invalid empty array schema"),p.length===1&&(p=p[0]));const h=(y,...g)=>d.override!==!1?y.valid(u.override,...g):y.valid(...g);if(l.simple(p))return h(u,p);if(typeof p=="function")return u.custom(p);if(a(typeof p=="object","Invalid schema content:",typeof p),f.isResolvable(p))return h(u,p);if(f.isSchema(p))return p;if(Array.isArray(p)){for(const y of p)if(!l.simple(y))return u.alternatives().try(...p);return h(u,...p)}return p instanceof RegExp?u.string().regex(p):p instanceof Date?h(u.date(),p):(a(Object.getPrototypeOf(p)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),u.object().keys(p))},i.ref=function(u,p){return c.isRef(u)?u:c.create(u,p)},i.compile=function(u,p,d={}){f.assertOptions(d,["legacy"]);const h=p&&p[f.symbols.any];if(h)return a(d.legacy||h.version===f.version,"Cannot mix different versions of joi schemas:",h.version,f.version),p;if(typeof p!="object"||!d.legacy)return i.schema(u,p,{appendPath:!0});const y=l.walk(p);return y?y.compile(y.root,p):i.schema(u,p,{appendPath:!0})},l.walk=function(u){if(typeof u!="object")return null;if(Array.isArray(u)){for(const d of u){const h=l.walk(d);if(h)return h}return null}const p=u[f.symbols.any];if(p)return{root:u[p.root],compile:p.compile};a(Object.getPrototypeOf(u)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const d in u){const h=l.walk(u[d]);if(h)return h}return null},l.simple=function(u){return u===null||["boolean","string","number"].includes(typeof u)},i.when=function(u,p,d){if(d===void 0&&(a(p&&typeof p=="object","Missing options"),d=p,p=c.create(".")),Array.isArray(d)&&(d={switch:d}),f.assertOptions(d,["is","not","then","otherwise","switch","break"]),f.isSchema(p))return a(d.is===void 0,'"is" can not be used with a schema condition'),a(d.not===void 0,'"not" can not be used with a schema condition'),a(d.switch===void 0,'"switch" can not be used with a schema condition'),l.condition(u,{is:p,then:d.then,otherwise:d.otherwise,break:d.break});if(a(c.isRef(p)||typeof p=="string","Invalid condition:",p),a(d.not===void 0||d.is===void 0,'Cannot combine "is" with "not"'),d.switch===void 0){let y=d;d.not!==void 0&&(y={is:d.not,then:d.otherwise,otherwise:d.then,break:d.break});let g=y.is!==void 0?u.$_compile(y.is):u.$_root.invalid(null,!1,0,"").required();return a(y.then!==void 0||y.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),a(y.break===void 0||y.then===void 0||y.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),d.is===void 0||c.isRef(d.is)||f.isSchema(d.is)||(g=g.required()),l.condition(u,{ref:i.ref(p),is:g,then:y.then,otherwise:y.otherwise,break:y.break})}a(Array.isArray(d.switch),'"switch" must be an array'),a(d.is===void 0,'Cannot combine "switch" with "is"'),a(d.not===void 0,'Cannot combine "switch" with "not"'),a(d.then===void 0,'Cannot combine "switch" with "then"');const h={ref:i.ref(p),switch:[],break:d.break};for(let y=0;y<d.switch.length;++y){const g=d.switch[y],m=y===d.switch.length-1;f.assertOptions(g,m?["is","then","otherwise"]:["is","then"]),a(g.is!==void 0,'Switch statement missing "is"'),a(g.then!==void 0,'Switch statement missing "then"');const b={is:u.$_compile(g.is),then:u.$_compile(g.then)};if(c.isRef(g.is)||f.isSchema(g.is)||(b.is=b.is.required()),m){a(d.otherwise===void 0||g.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const w=d.otherwise!==void 0?d.otherwise:g.otherwise;w!==void 0&&(a(h.break===void 0,"Cannot specify both otherwise and break"),b.otherwise=u.$_compile(w))}h.switch.push(b)}return h},l.condition=function(u,p){for(const d of["then","otherwise"])p[d]===void 0?delete p[d]:p[d]=u.$_compile(p[d]);return p}},6354:(s,i,o)=>{const a=o(5688),f=o(8160),c=o(3328);i.Report=class{constructor(l,u,p,d,h,y,g){if(this.code=l,this.flags=d,this.messages=h,this.path=y.path,this.prefs=g,this.state=y,this.value=u,this.message=null,this.template=null,this.local=p||{},this.local.label=i.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const m=this.path[this.path.length-1];typeof m!="object"&&(this.local.key=m)}}_setTemplate(l){if(this.template=l,!this.flags.label&&this.path.length===0){const u=this._template(this.template,"root");u&&(this.local.label=u)}}toString(){if(this.message)return this.message;const l=this.code;if(!this.prefs.errors.render)return this.code;const u=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return u===void 0?`Error code "${l}" is not defined, your custom type is missing the correct messages definition`:(this.message=u.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(l,u){return i.template(this.value,l,u||this.code,this.state,this.prefs)}},i.path=function(l){let u="";for(const p of l)typeof p!="object"&&(typeof p=="string"?(u&&(u+="."),u+=p):u+=`[${p}]`);return u},i.template=function(l,u,p,d,h){if(!u)return;if(c.isTemplate(u))return p!=="root"?u:null;let y=h.errors.language;if(f.isResolvable(y)&&(y=y.resolve(l,d,h)),y&&u[y]){if(u[y][p]!==void 0)return u[y][p];if(u[y]["*"]!==void 0)return u[y]["*"]}return u[p]?u[p]:u["*"]},i.label=function(l,u,p,d){if(!p.errors.label)return"";if(l.label)return l.label;let h=u.path;return p.errors.label==="key"&&u.path.length>1&&(h=u.path.slice(-1)),i.path(h)||i.template(null,p.messages,"root",u,p)||d&&i.template(null,d,"root",u,p)||"value"},i.process=function(l,u,p){if(!l)return null;const{override:d,message:h,details:y}=i.details(l);if(d)return d;if(p.errors.stack)return new i.ValidationError(h,y,u);const g=Error.stackTraceLimit;Error.stackTraceLimit=0;const m=new i.ValidationError(h,y,u);return Error.stackTraceLimit=g,m},i.details=function(l,u={}){let p=[];const d=[];for(const h of l){if(h instanceof Error){if(u.override!==!1)return{override:h};const g=h.toString();p.push(g),d.push({message:g,type:"override",context:{error:h}});continue}const y=h.toString();p.push(y),d.push({message:y,path:h.path.filter(g=>typeof g!="object"),type:h.code,context:h.local})}return p.length>1&&(p=[...new Set(p)]),{message:p.join(". "),details:d}},i.ValidationError=class extends Error{constructor(l,u,p){super(l),this._original=p,this.details=u}static isError(l){return l instanceof i.ValidationError}},i.ValidationError.prototype.isJoi=!0,i.ValidationError.prototype.name="ValidationError",i.ValidationError.prototype.annotate=a.error},8901:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8160),l=o(6914),u={};i.type=function(p,d){const h=Object.getPrototypeOf(p),y=f(h),g=p._assign(Object.create(y)),m=Object.assign({},d);delete m.base,y._definition=m;const b=h._definition||{};m.messages=l.merge(b.messages,m.messages),m.properties=Object.assign({},b.properties,m.properties),g.type=m.type,m.flags=Object.assign({},b.flags,m.flags);const w=Object.assign({},b.terms);if(m.terms)for(const M in m.terms){const _=m.terms[M];a(g.$_terms[M]===void 0,"Invalid term override for",m.type,M),g.$_terms[M]=_.init,w[M]=_}m.terms=w,m.args||(m.args=b.args),m.prepare=u.prepare(m.prepare,b.prepare),m.coerce&&(typeof m.coerce=="function"&&(m.coerce={method:m.coerce}),m.coerce.from&&!Array.isArray(m.coerce.from)&&(m.coerce={method:m.coerce.method,from:[].concat(m.coerce.from)})),m.coerce=u.coerce(m.coerce,b.coerce),m.validate=u.validate(m.validate,b.validate);const E=Object.assign({},b.rules);if(m.rules)for(const M in m.rules){const _=m.rules[M];a(typeof _=="object","Invalid rule definition for",m.type,M);let A=_.method;if(A===void 0&&(A=function(){return this.$_addRule(M)}),A&&(a(!y[M],"Rule conflict in",m.type,M),y[M]=A),a(!E[M],"Rule conflict in",m.type,M),E[M]=_,_.alias){const I=[].concat(_.alias);for(const P of I)y[P]=_.method}_.args&&(_.argsByName=new Map,_.args=_.args.map(I=>(typeof I=="string"&&(I={name:I}),a(!_.argsByName.has(I.name),"Duplicated argument name",I.name),c.isSchema(I.assert)&&(I.assert=I.assert.strict().label(I.name)),_.argsByName.set(I.name,I),I)))}m.rules=E;const C=Object.assign({},b.modifiers);if(m.modifiers)for(const M in m.modifiers){a(!y[M],"Rule conflict in",m.type,M);const _=m.modifiers[M];a(typeof _=="function","Invalid modifier definition for",m.type,M);const A=function(I){return this.rule({[M]:I})};y[M]=A,C[M]=_}if(m.modifiers=C,m.overrides){y._super=h,g.$_super={};for(const M in m.overrides)a(h[M],"Cannot override missing",M),m.overrides[M][c.symbols.parent]=h[M],g.$_super[M]=h[M].bind(g);Object.assign(y,m.overrides)}m.cast=Object.assign({},b.cast,m.cast);const R=Object.assign({},b.manifest,m.manifest);return R.build=u.build(m.manifest&&m.manifest.build,b.manifest&&b.manifest.build),m.manifest=R,m.rebuild=u.rebuild(m.rebuild,b.rebuild),g},u.build=function(p,d){return p&&d?function(h,y){return d(p(h,y),y)}:p||d},u.coerce=function(p,d){return p&&d?{from:p.from&&d.from?[...new Set([...p.from,...d.from])]:null,method(h,y){let g;if((!d.from||d.from.includes(typeof h))&&(g=d.method(h,y),g)){if(g.errors||g.value===void 0)return g;h=g.value}if(!p.from||p.from.includes(typeof h)){const m=p.method(h,y);if(m)return m}return g}}:p||d},u.prepare=function(p,d){return p&&d?function(h,y){const g=p(h,y);if(g){if(g.errors||g.value===void 0)return g;h=g.value}return d(h,y)||g}:p||d},u.rebuild=function(p,d){return p&&d?function(h){d(h),p(h)}:p||d},u.validate=function(p,d){return p&&d?function(h,y){const g=d(h,y);if(g){if(g.errors&&(!Array.isArray(g.errors)||g.errors.length))return g;h=g.value}return p(h,y)||g}:p||d}},5107:(s,i,o)=>{const a=o(375),f=o(8571),c=o(8652),l=o(8160),u=o(3292),p=o(6354),d=o(8901),h=o(9708),y=o(6133),g=o(3328),m=o(1152);let b;const w={types:{alternatives:o(4946),any:o(8068),array:o(546),boolean:o(4937),date:o(7500),function:o(390),link:o(8785),number:o(3832),object:o(8966),string:o(7417),symbol:o(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const E={_types:new Set(Object.keys(w.types))};for(const C of E._types)E[C]=function(...R){return a(!R.length||["alternatives","link","object"].includes(C),"The",C,"type does not allow arguments"),w.generate(this,w.types[C],R)};for(const C of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])E[C]=function(...R){return this.any()[C](...R)};Object.assign(E,w.methods);for(const C in w.aliases){const R=w.aliases[C];E[C]=E[R]}return E.x=E.expression,m.setup&&m.setup(E),E}};w.methods={ValidationError:p.ValidationError,version:l.version,cache:c.provider,assert(E,C,...R){w.assert(E,C,!0,R)},attempt:(E,C,...R)=>w.assert(E,C,!1,R),build(E){return a(typeof h.build=="function","Manifest functionality disabled"),h.build(this,E)},checkPreferences(E){l.checkPreferences(E)},compile(E,C){return u.compile(this,E,C)},defaults(E){a(typeof E=="function","modifier must be a function");const C=Object.assign({},this);for(const R of C._types){const M=E(C[R]());a(l.isSchema(M),"modifier must return a valid schema object"),C[R]=function(..._){return w.generate(this,M,_)}}return C},expression:(...E)=>new g(...E),extend(...E){l.verifyFlat(E,"extend"),b=b||o(3378),a(E.length,"You need to provide at least one extension"),this.assert(E,b.extensions);const C=Object.assign({},this);C._types=new Set(C._types);for(let R of E){typeof R=="function"&&(R=R(C)),this.assert(R,b.extension);const M=w.expandExtension(R,C);for(const _ of M){a(C[_.type]===void 0||C._types.has(_.type),"Cannot override name",_.type);const A=_.base||this.any(),I=d.type(A,_);C._types.add(_.type),C[_.type]=function(...P){return w.generate(this,I,P)}}}return C},isError:p.ValidationError.isError,isExpression:g.isTemplate,isRef:y.isRef,isSchema:l.isSchema,in:(...E)=>y.in(...E),override:l.symbols.override,ref:(...E)=>y.create(...E),types(){const E={};for(const C of this._types)E[C]=this[C]();for(const C in w.aliases)E[C]=this[C]();return E}},w.assert=function(E,C,R,M){const _=M[0]instanceof Error||typeof M[0]=="string"?M[0]:null,A=_!==null?M[1]:M[0],I=C.validate(E,l.preferences({errors:{stack:!0}},A||{}));let P=I.error;if(!P)return I.value;if(_ instanceof Error)throw _;const v=R&&typeof P.annotate=="function"?P.annotate():P.message;throw P instanceof p.ValidationError==0&&(P=f(P)),P.message=_?`${_} ${v}`:v,P},w.generate=function(E,C,R){return a(E,"Must be invoked on a Joi instance."),C.$_root=E,C._definition.args&&R.length?C._definition.args(C,...R):C},w.expandExtension=function(E,C){if(typeof E.type=="string")return[E];const R=[];for(const M of C._types)if(E.type.test(M)){const _=Object.assign({},E);_.type=M,_.base=C[M](),R.push(_)}return R},s.exports=w.root()},6914:(s,i,o)=>{const a=o(375),f=o(8571),c=o(3328);i.compile=function(l,u){if(typeof l=="string")return a(!u,"Cannot set single message string"),new c(l);if(c.isTemplate(l))return a(!u,"Cannot set single message template"),l;a(typeof l=="object"&&!Array.isArray(l),"Invalid message options"),u=u?f(u):{};for(let p in l){const d=l[p];if(p==="root"||c.isTemplate(d)){u[p]=d;continue}if(typeof d=="string"){u[p]=new c(d);continue}a(typeof d=="object"&&!Array.isArray(d),"Invalid message for",p);const h=p;for(p in u[h]=u[h]||{},d){const y=d[p];p==="root"||c.isTemplate(y)?u[h][p]=y:(a(typeof y=="string","Invalid message for",p,"in",h),u[h][p]=new c(y))}}return u},i.decompile=function(l){const u={};for(let p in l){const d=l[p];if(p==="root"){u.root=d;continue}if(c.isTemplate(d)){u[p]=d.describe({compact:!0});continue}const h=p;for(p in u[h]={},d){const y=d[p];p!=="root"?u[h][p]=y.describe({compact:!0}):u[h].root=y}}return u},i.merge=function(l,u){if(!l)return i.compile(u);if(!u)return l;if(typeof u=="string")return new c(u);if(c.isTemplate(u))return u;const p=f(l);for(let d in u){const h=u[d];if(d==="root"||c.isTemplate(h)){p[d]=h;continue}if(typeof h=="string"){p[d]=new c(h);continue}a(typeof h=="object"&&!Array.isArray(h),"Invalid message for",d);const y=d;for(d in p[y]=p[y]||{},h){const g=h[d];d==="root"||c.isTemplate(g)?p[y][d]=g:(a(typeof g=="string","Invalid message for",d,"in",y),p[y][d]=new c(g))}}return p}},2294:(s,i,o)=>{const a=o(375),f=o(8160),c=o(6133),l={};i.Ids=l.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const u=new l.Ids;return u._byId=new Map(this._byId),u._byKey=new Map(this._byKey),u._schemaChain=this._schemaChain,u}concat(u){u._schemaChain&&(this._schemaChain=!0);for(const[p,d]of u._byId.entries())a(!this._byKey.has(p),"Schema id conflicts with existing key:",p),this._byId.set(p,d);for(const[p,d]of u._byKey.entries())a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,d)}fork(u,p,d){const h=this._collect(u);h.push({schema:d});const y=h.shift();let g={id:y.id,schema:p(y.schema)};a(f.isSchema(g.schema),"adjuster function failed to return a joi schema type");for(const m of h)g={id:m.id,schema:l.fork(m.schema,g.id,g.schema)};return g.schema}labels(u,p=[]){const d=u[0],h=this._get(d);if(!h)return[...p,...u].join(".");const y=u.slice(1);return p=[...p,h.schema._flags.label||d],y.length?h.schema._ids.labels(y,p):p.join(".")}reach(u,p=[]){const d=u[0],h=this._get(d);a(h,"Schema does not contain path",[...p,...u].join("."));const y=u.slice(1);return y.length?h.schema._ids.reach(y,[...p,d]):h.schema}register(u,{key:p}={}){if(!u||!f.isSchema(u))return;(u.$_property("schemaChain")||u._ids._schemaChain)&&(this._schemaChain=!0);const d=u._flags.id;if(d){const h=this._byId.get(d);a(!h||h.schema===u,"Cannot add different schemas with the same id:",d),a(!this._byKey.has(d),"Schema id conflicts with existing key:",d),this._byId.set(d,{schema:u,id:d})}p&&(a(!this._byKey.has(p),"Schema already contains key:",p),a(!this._byId.has(p),"Schema key conflicts with existing id:",p),this._byKey.set(p,{schema:u,id:p}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(u,p=[],d=[]){const h=u[0],y=this._get(h);a(y,"Schema does not contain path",[...p,...u].join(".")),d=[y,...d];const g=u.slice(1);return g.length?y.schema._ids._collect(g,[...p,h],d):d}_get(u){return this._byId.get(u)||this._byKey.get(u)}},l.fork=function(u,p,d){const h=i.schema(u,{each:(y,{key:g})=>{if(p===(y._flags.id||g))return d},ref:!1});return h?h.$_mutateRebuild():u},i.schema=function(u,p){let d;for(const h in u._flags){if(h[0]==="_")continue;const y=l.scan(u._flags[h],{source:"flags",name:h},p);y!==void 0&&(d=d||u.clone(),d._flags[h]=y)}for(let h=0;h<u._rules.length;++h){const y=u._rules[h],g=l.scan(y.args,{source:"rules",name:y.name},p);if(g!==void 0){d=d||u.clone();const m=Object.assign({},y);m.args=g,d._rules[h]=m,d._singleRules.get(y.name)===y&&d._singleRules.set(y.name,m)}}for(const h in u.$_terms){if(h[0]==="_")continue;const y=l.scan(u.$_terms[h],{source:"terms",name:h},p);y!==void 0&&(d=d||u.clone(),d.$_terms[h]=y)}return d},l.scan=function(u,p,d,h,y){const g=h||[];if(u===null||typeof u!="object")return;let m;if(Array.isArray(u)){for(let b=0;b<u.length;++b){const w=p.source==="terms"&&p.name==="keys"&&u[b].key,E=l.scan(u[b],p,d,[b,...g],w);E!==void 0&&(m=m||u.slice(),m[b]=E)}return m}if(d.schema!==!1&&f.isSchema(u)||d.ref!==!1&&c.isRef(u)){const b=d.each(u,{...p,path:g,key:y});return b===u?void 0:b}for(const b in u){if(b[0]==="_")continue;const w=l.scan(u[b],p,d,[b,...g],y);w!==void 0&&(m=m||Object.assign({},u),m[b]=w)}return m}},6133:(s,i,o)=>{const a=o(375),f=o(8571),c=o(9621),l=o(8160);let u;const p={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};i.create=function(d,h={}){a(typeof d=="string","Invalid reference key:",d),l.assertOptions(h,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),a(!h.prefix||typeof h.prefix=="object","options.prefix must be of type object");const y=Object.assign({},p.defaults,h);delete y.prefix;const g=y.separator,m=p.context(d,g,h.prefix);if(y.type=m.type,d=m.key,y.type==="value")if(m.root&&(a(!g||d[0]!==g,"Cannot specify relative path with root prefix"),y.ancestor="root",d||(d=null)),g&&g===d)d=null,y.ancestor=0;else if(y.ancestor!==void 0)a(!g||!d||d[0]!==g,"Cannot combine prefix with ancestor option");else{const[b,w]=p.ancestor(d,g);w&&(d=d.slice(w))===""&&(d=null),y.ancestor=b}return y.path=g?d===null?[]:d.split(g):[d],new p.Ref(y)},i.in=function(d,h={}){return i.create(d,{...h,in:!0})},i.isRef=function(d){return!!d&&!!d[l.symbols.ref]},p.Ref=class{constructor(d){a(typeof d=="object","Invalid reference construction"),l.assertOptions(d,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),a([!1,void 0].includes(d.separator)||typeof d.separator=="string"&&d.separator.length===1,"Invalid separator"),a(!d.adjust||typeof d.adjust=="function","options.adjust must be a function"),a(!d.map||Array.isArray(d.map),"options.map must be an array"),a(!d.map||!d.adjust,"Cannot set both map and adjust options"),Object.assign(this,p.defaults,d),a(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(d,h,y,g,m={}){return a(!this.in||m.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(y.context,h,m):this.type==="local"?this._resolve(g,h,m):this.ancestor?this.ancestor==="root"?this._resolve(h.ancestors[h.ancestors.length-1],h,m):(a(this.ancestor<=h.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(h.ancestors[this.ancestor-1],h,m)):this._resolve(d,h,m)}_resolve(d,h,y){let g;if(this.type==="value"&&h.mainstay.shadow&&y.shadow!==!1&&(g=h.mainstay.shadow.get(this.absolute(h))),g===void 0&&(g=c(d,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(g=this.adjust(g)),this.map){const m=this.map.get(g);m!==void 0&&(g=m)}return h.mainstay&&h.mainstay.tracer.resolve(h,this,g),g}toString(){return this.display}absolute(d){return[...d.path.slice(0,-this.ancestor),...this.path]}clone(){return new p.Ref(this)}describe(){const d={path:this.path};this.type!=="value"&&(d.type=this.type),this.separator!=="."&&(d.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(d.ancestor=this.ancestor),this.map&&(d.map=[...this.map]);for(const h of["adjust","iterables","render"])this[h]!==null&&this[h]!==void 0&&(d[h]=this[h]);return this.in!==!1&&(d.in=!0),{ref:d}}updateDisplay(){const d=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${d}`);if(!this.separator)return void(this.display=`ref:${d}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${d}`);if(this.ancestor==="root")return void(this.display=`ref:root:${d}`);if(this.ancestor===1)return void(this.display=`ref:${d||".."}`);const h=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${h}${d||""}`}},p.Ref.prototype[l.symbols.ref]=!0,i.build=function(d){return(d=Object.assign({},p.defaults,d)).type==="value"&&d.ancestor===void 0&&(d.ancestor=1),new p.Ref(d)},p.context=function(d,h,y={}){if(d=d.trim(),y){const g=y.global===void 0?"$":y.global;if(g!==h&&d.startsWith(g))return{key:d.slice(g.length),type:"global"};const m=y.local===void 0?"#":y.local;if(m!==h&&d.startsWith(m))return{key:d.slice(m.length),type:"local"};const b=y.root===void 0?"/":y.root;if(b!==h&&d.startsWith(b))return{key:d.slice(b.length),type:"value",root:!0}}return{key:d,type:"value"}},p.ancestor=function(d,h){if(!h)return[1,0];if(d[0]!==h)return[1,0];if(d[1]!==h)return[0,1];let y=2;for(;d[y]===h;)++y;return[y-1,y]},i.toSibling=0,i.toParent=1,i.Manager=class{constructor(){this.refs=[]}register(d,h){if(d)if(h=h===void 0?i.toParent:h,Array.isArray(d))for(const y of d)this.register(y,h);else if(l.isSchema(d))for(const y of d._refs.refs)y.ancestor-h>=0&&this.refs.push({ancestor:y.ancestor-h,root:y.root});else i.isRef(d)&&d.type==="value"&&d.ancestor-h>=0&&this.refs.push({ancestor:d.ancestor-h,root:d.root}),u=u||o(3328),u.isTemplate(d)&&this.register(d.refs(),h)}get length(){return this.refs.length}clone(){const d=new i.Manager;return d.refs=f(this.refs),d}reset(){this.refs=[]}roots(){return this.refs.filter(d=>!d.ancestor).map(d=>d.root)}}},3378:(s,i,o)=>{const a=o(5107),f={};f.wrap=a.string().min(1).max(2).allow(!1),i.preferences=a.object({allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),context:a.object(),convert:a.boolean(),dateFormat:a.valid("date","iso","string","time","utc"),debug:a.boolean(),errors:{escapeHtml:a.boolean(),label:a.valid("path","key",!1),language:[a.string(),a.object().ref()],render:a.boolean(),stack:a.boolean(),wrap:{label:f.wrap,array:f.wrap,string:f.wrap}},externals:a.boolean(),messages:a.object(),noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:a.valid("required","optional","forbidden"),skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()}).strict(),f.nameRx=/^[a-zA-Z0-9]\w*$/,f.rule=a.object({alias:a.array().items(a.string().pattern(f.nameRx)).single(),args:a.array().items(a.string(),a.object({name:a.string().pattern(f.nameRx).required(),ref:a.boolean(),assert:a.alternatives([a.function(),a.object().schema()]).conditional("ref",{is:!0,then:a.required()}),normalize:a.function(),message:a.string().when("assert",{is:a.function(),then:a.required()})})),convert:a.boolean(),manifest:a.boolean(),method:a.function().allow(!1),multi:a.boolean(),validate:a.function()}),i.extension=a.object({type:a.alternatives([a.string(),a.object().regex()]).required(),args:a.function(),cast:a.object().pattern(f.nameRx,a.object({from:a.function().maxArity(1).required(),to:a.function().minArity(1).maxArity(2).required()})),base:a.object().schema().when("type",{is:a.object().regex(),then:a.forbidden()}),coerce:[a.function().maxArity(3),a.object({method:a.function().maxArity(3).required(),from:a.array().items(a.string()).single()})],flags:a.object().pattern(f.nameRx,a.object({setter:a.string(),default:a.any()})),manifest:{build:a.function().arity(2)},messages:[a.object(),a.string()],modifiers:a.object().pattern(f.nameRx,a.function().minArity(1).maxArity(2)),overrides:a.object().pattern(f.nameRx,a.function()),prepare:a.function().maxArity(3),rebuild:a.function().arity(1),rules:a.object().pattern(f.nameRx,f.rule),terms:a.object().pattern(f.nameRx,a.object({init:a.array().allow(null).required(),manifest:a.object().pattern(/.+/,[a.valid("schema","single"),a.object({mapped:a.object({from:a.string().required(),to:a.string().required()}).required()})])})),validate:a.function().maxArity(3)}).strict(),i.extensions=a.array().items(a.object(),a.function().arity(1)).strict(),f.desc={buffer:a.object({buffer:a.string()}),func:a.object({function:a.function().required(),options:{literal:!0}}),override:a.object({override:!0}),ref:a.object({ref:a.object({type:a.valid("value","global","local"),path:a.array().required(),separator:a.string().length(1).allow(!1),ancestor:a.number().min(0).integer().allow("root"),map:a.array().items(a.array().length(2)).min(1),adjust:a.function(),iterables:a.boolean(),in:a.boolean(),render:a.boolean()}).required()}),regex:a.object({regex:a.string().min(3)}),special:a.object({special:a.valid("deep").required()}),template:a.object({template:a.string().required(),options:a.object()}),value:a.object({value:a.alternatives([a.object(),a.array()]).required()})},f.desc.entity=a.alternatives([a.array().items(a.link("...")),a.boolean(),a.function(),a.number(),a.string(),f.desc.buffer,f.desc.func,f.desc.ref,f.desc.regex,f.desc.special,f.desc.template,f.desc.value,a.link("/")]),f.desc.values=a.array().items(null,a.boolean(),a.function(),a.number().allow(1/0,-1/0),a.string().allow(""),a.symbol(),f.desc.buffer,f.desc.func,f.desc.override,f.desc.ref,f.desc.regex,f.desc.template,f.desc.value),f.desc.messages=a.object().pattern(/.+/,[a.string(),f.desc.template,a.object().pattern(/.+/,[a.string(),f.desc.template])]),i.description=a.object({type:a.string().required(),flags:a.object({cast:a.string(),default:a.any(),description:a.string(),empty:a.link("/"),failover:f.desc.entity,id:a.string(),label:a.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:a.boolean(),unit:a.string()}).unknown(),preferences:{allowUnknown:a.boolean(),abortEarly:a.boolean(),artifacts:a.boolean(),cache:a.boolean(),convert:a.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:a.boolean(),label:["path","key"],language:[a.string(),f.desc.ref],wrap:{label:f.wrap,array:f.wrap}},externals:a.boolean(),messages:f.desc.messages,noDefaults:a.boolean(),nonEnumerables:a.boolean(),presence:["required","optional","forbidden"],skipFunctions:a.boolean(),stripUnknown:a.object({arrays:a.boolean(),objects:a.boolean()}).or("arrays","objects").allow(!0,!1),warnings:a.boolean()},allow:f.desc.values,invalid:f.desc.values,rules:a.array().min(1).items({name:a.string().required(),args:a.object().min(1),keep:a.boolean(),message:[a.string(),f.desc.messages],warn:a.boolean()}),keys:a.object().pattern(/.*/,a.link("/")),link:f.desc.ref}).pattern(/^[a-z]\w*$/,a.any())},493:(s,i,o)=>{const a=o(8571),f=o(9621),c=o(8160),l={value:Symbol("value")};s.exports=l.State=class{constructor(u,p,d){this.path=u,this.ancestors=p,this.mainstay=d.mainstay,this.schemas=d.schemas,this.debug=null}localize(u,p=null,d=null){const h=new l.State(u,p,this);return d&&h.schemas&&(h.schemas=[l.schemas(d),...h.schemas]),h}nest(u,p){const d=new l.State(this.path,this.ancestors,this);return d.schemas=d.schemas&&[l.schemas(u),...d.schemas],d.debug=p,d}shadow(u,p){this.mainstay.shadow=this.mainstay.shadow||new l.Shadow,this.mainstay.shadow.set(this.path,u,p)}snapshot(){this.mainstay.shadow&&(this._snapshot=a(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},l.schemas=function(u){return c.isSchema(u)?{schema:u}:u},l.Shadow=class{constructor(){this._values=null}set(u,p,d){if(!u.length||d==="strip"&&typeof u[u.length-1]=="number")return;this._values=this._values||new Map;let h=this._values;for(let y=0;y<u.length;++y){const g=u[y];let m=h.get(g);m||(m=new Map,h.set(g,m)),h=m}h[l.value]=p}get(u){const p=this.node(u);if(p)return p[l.value]}node(u){if(this._values)return f(this._values,u,{iterables:!0})}override(u,p){if(!this._values)return;const d=u.slice(0,-1),h=u[u.length-1],y=f(this._values,d,{iterables:!0});p?y.set(h,p):y&&y.delete(h)}}},3328:(s,i,o)=>{const a=o(375),f=o(8571),c=o(5277),l=o(1447),u=o(8160),p=o(6354),d=o(6133),h={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};s.exports=h.Template=class{constructor(y,g){if(a(typeof y=="string","Template source must be a string"),a(!y.includes("\0")&&!y.includes(""),"Template source cannot contain reserved control characters"),this.source=y,this.rendered=y,this._template=null,g){const{functions:m,...b}=g;this._settings=Object.keys(b).length?f(b):void 0,this._functions=m,this._functions&&(a(Object.keys(this._functions).every(w=>typeof w=="string"),"Functions keys must be strings"),a(Object.values(this._functions).every(w=>typeof w=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const y=h.encode(this.source),g=h.split(y);let m=!1;const b=[],w=g.shift();w&&b.push(w);for(const E of g){const C=E[0]!=="{",R=C?"}":"}}",M=E.indexOf(R);if(M===-1||E[1]==="{"){b.push(`{${h.decode(E)}`);continue}let _=E.slice(C?0:1,M);const A=_[0]===":";A&&(_=_.slice(1));const I=this._ref(h.decode(_),{raw:C,wrapped:A});b.push(I),typeof I!="string"&&(m=!0);const P=E.slice(M+R.length);P&&b.push(h.decode(P))}m?this._template=b:this.rendered=b.join("")}static date(y,g){return h.dateFormat[g.dateFormat].call(y)}describe(y={}){if(!this._settings&&y.compact)return this.source;const g={template:this.source};return this._settings&&(g.options=this._settings),this._functions&&(g.functions=this._functions),g}static build(y){return new h.Template(y.template,y.options||y.functions?{...y.options,functions:y.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(y){return!!y&&!!y[u.symbols.template]}refs(){if(!this._template)return;const y=[];for(const g of this._template)typeof g!="string"&&y.push(...g.refs);return y}resolve(y,g,m,b){return this._template&&this._template.length===1?this._part(this._template[0],y,g,m,b,{}):this.render(y,g,m,b)}_part(y,...g){return y.ref?y.ref.resolve(...g):y.formula.evaluate(g)}render(y,g,m,b,w={}){if(!this.isDynamic())return this.rendered;const E=[];for(const C of this._template)if(typeof C=="string")E.push(C);else{const R=this._part(C,y,g,m,b,w),M=h.stringify(R,y,g,m,b,w);if(M!==void 0){const _=C.raw||(w.errors&&w.errors.escapeHtml)===!1?M:c(M);E.push(h.wrap(_,C.wrapped&&m.errors.wrap.label))}}return E.join("")}_ref(y,{raw:g,wrapped:m}){const b=[],w=C=>{const R=d.create(C,this._settings);return b.push(R),M=>{const _=R.resolve(...M);return _!==void 0?_:null}};try{const C=this._functions?{...h.functions,...this._functions}:h.functions;var E=new l.Parser(y,{reference:w,functions:C,constants:h.constants})}catch(C){throw C.message=`Invalid template variable "${y}" fails due to: ${C.message}`,C}if(E.single){if(E.single.type==="reference"){const C=b[0];return{ref:C,raw:g,refs:b,wrapped:m||C.type==="local"&&C.key==="label"}}return h.stringify(E.single.value)}return{formula:E,raw:g,refs:b}}toString(){return this.source}},h.Template.prototype[u.symbols.template]=!0,h.Template.prototype.isImmutable=!0,h.encode=function(y){return y.replace(/\\(\{+)/g,(g,m)=>h.opens.slice(0,m.length)).replace(/\\(\}+)/g,(g,m)=>h.closes.slice(0,m.length))},h.decode=function(y){return y.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},h.split=function(y){const g=[];let m="";for(let b=0;b<y.length;++b){const w=y[b];if(w==="{"){let E="";for(;b+1<y.length&&y[b+1]==="{";)E+="{",++b;g.push(m),m=E}else m+=w}return g.push(m),g},h.wrap=function(y,g){return g?g.length===1?`${g}${y}${g}`:`${g[0]}${y}${g[1]}`:y},h.stringify=function(y,g,m,b,w,E={}){const C=typeof y,R=b&&b.errors&&b.errors.wrap||{};let M=!1;if(d.isRef(y)&&y.render&&(M=y.in,y=y.resolve(g,m,b,w,{in:y.in,...E})),y===null)return"null";if(C==="string")return h.wrap(y,E.arrayItems&&R.string);if(C==="number"||C==="function"||C==="symbol")return y.toString();if(C!=="object")return JSON.stringify(y);if(y instanceof Date)return h.Template.date(y,b);if(y instanceof Map){const A=[];for(const[I,P]of y.entries())A.push(`${I.toString()} -> ${P.toString()}`);y=A}if(!Array.isArray(y))return y.toString();const _=[];for(const A of y)_.push(h.stringify(A,g,m,b,w,{arrayItems:!0,...E}));return h.wrap(_.join(", "),!M&&R.array)},h.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},h.functions={if:(y,g,m)=>y?g:m,length:y=>typeof y=="string"?y.length:y&&typeof y=="object"?Array.isArray(y)?y.length:Object.keys(y).length:null,msg(y){const[g,m,b,w,E]=this,C=E.messages;if(!C)return"";const R=p.template(g,C[0],y,m,b)||p.template(g,C[1],y,m,b);return R?R.render(g,m,b,w,E):""},number:y=>typeof y=="number"?y:typeof y=="string"?parseFloat(y):typeof y=="boolean"?y?1:0:y instanceof Date?y.getTime():null}},4946:(s,i,o)=>{const a=o(375),f=o(1687),c=o(8068),l=o(8160),u=o(3292),p=o(6354),d=o(6133),h={};s.exports=c.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:d.toSibling}},args:(y,...g)=>g.length===1&&Array.isArray(g[0])?y.try(...g[0]):y.try(...g),validate(y,g){const{schema:m,error:b,state:w,prefs:E}=g;if(m._flags.match){const R=[],M=[];for(let A=0;A<m.$_terms.matches.length;++A){const I=m.$_terms.matches[A],P=w.nest(I.schema,`match.${A}`);P.snapshot();const v=I.schema.$_validate(y,P,E);v.errors?(M.push(v.errors),P.restore()):(R.push(v.value),P.commit())}if(R.length===0)return{errors:b("alternatives.any",{details:M.map(A=>p.details(A,{override:!1}))})};if(m._flags.match==="one")return R.length===1?{value:R[0]}:{errors:b("alternatives.one")};if(R.length!==m.$_terms.matches.length)return{errors:b("alternatives.all",{details:M.map(A=>p.details(A,{override:!1}))})};const _=A=>A.$_terms.matches.some(I=>I.schema.type==="object"||I.schema.type==="alternatives"&&_(I.schema));return _(m)?{value:R.reduce((A,I)=>f(A,I,{mergeArrays:!1}))}:{value:R[R.length-1]}}const C=[];for(let R=0;R<m.$_terms.matches.length;++R){const M=m.$_terms.matches[R];if(M.schema){const I=w.nest(M.schema,`match.${R}`);I.snapshot();const P=M.schema.$_validate(y,I,E);if(!P.errors)return I.commit(),P;I.restore(),C.push({schema:M.schema,reports:P.errors});continue}const _=M.ref?M.ref.resolve(y,w,E):y,A=M.is?[M]:M.switch;for(let I=0;I<A.length;++I){const P=A[I],{is:v,then:S,otherwise:T}=P,N=`match.${R}${M.switch?"."+I:""}`;if(v.$_match(_,w.nest(v,`${N}.is`),E)){if(S)return S.$_validate(y,w.nest(S,`${N}.then`),E)}else if(T)return T.$_validate(y,w.nest(T,`${N}.otherwise`),E)}}return h.errors(C,g)},rules:{conditional:{method(y,g){a(!this._flags._endedSwitch,"Unreachable condition"),a(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),a(g.break===void 0,"Cannot use break option with alternatives conditional");const m=this.clone(),b=u.when(m,y,g),w=b.is?[b]:b.switch;for(const E of w)if(E.then&&E.otherwise){m.$_setFlag("_endedSwitch",!0,{clone:!1});break}return m.$_terms.matches.push(b),m.$_mutateRebuild()}},match:{method(y){if(a(["any","one","all"].includes(y),"Invalid alternatives match mode",y),y!=="any")for(const g of this.$_terms.matches)a(g.schema,"Cannot combine match mode",y,"with conditional rules");return this.$_setFlag("match",y)}},try:{method(...y){a(y.length,"Missing alternative schemas"),l.verifyFlat(y,"try"),a(!this._flags._endedSwitch,"Unreachable condition");const g=this.clone();for(const m of y)g.$_terms.matches.push({schema:g.$_compile(m)});return g.$_mutateRebuild()}}},overrides:{label(y){return this.$_parent("label",y).$_modify({each:(g,m)=>m.path[0]!=="is"&&typeof g._flags.label!="string"?g.label(y):void 0,ref:!1})}},rebuild(y){y.$_modify({each:g=>{l.isSchema(g)&&g.type==="array"&&y.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(y,g){if(g.matches)for(const m of g.matches){const{schema:b,ref:w,is:E,not:C,then:R,otherwise:M}=m;y=b?y.try(b):w?y.conditional(w,{is:E,then:R,not:C,otherwise:M,switch:m.switch}):y.conditional(E,{then:R,otherwise:M})}return y}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),h.errors=function(y,{error:g,state:m}){if(!y.length)return{errors:g("alternatives.any")};if(y.length===1)return{errors:y[0].reports};const b=new Set,w=[];for(const{reports:E,schema:C}of y){if(E.length>1)return h.unmatched(y,g);const R=E[0];if(R instanceof p.Report==0)return h.unmatched(y,g);if(R.state.path.length!==m.path.length){w.push({type:C.type,report:R});continue}if(R.code==="any.only"){for(const A of R.local.valids)b.add(A);continue}const[M,_]=R.code.split(".");_!=="base"?w.push({type:C.type,report:R}):R.code==="object.base"?b.add(R.local.type):b.add(M)}return w.length?w.length===1?{errors:w[0].report}:h.unmatched(y,g):{errors:g("alternatives.types",{types:[...b]})}},h.unmatched=function(y,g){const m=[];for(const b of y)m.push(...b.reports);return{errors:g("alternatives.match",p.details(m,{override:!1}))}}},8068:(s,i,o)=>{const a=o(375),f=o(7629),c=o(8160),l=o(6914);s.exports=f.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(u,p){return a(typeof u=="function","Method must be a function"),a(p===void 0||p&&typeof p=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:u,description:p}})},validate(u,p,{method:d}){try{return d(u,p)}catch(h){return p.error("any.custom",{error:h})}},args:["method","description"],multi:!0},messages:{method(u){return this.prefs({messages:u})}},shared:{method(u){a(c.isSchema(u)&&u._flags.id,"Schema must be a schema with an id");const p=this.clone();return p.$_terms.shared=p.$_terms.shared||[],p.$_terms.shared.push(u),p.$_mutateRegister(u),p}},warning:{method(u,p){return a(u&&typeof u=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:u,local:p},warn:!0})},validate:(u,p,{code:d,local:h})=>p.error(d,h),args:["code","local"],multi:!0}},modifiers:{keep(u,p=!0){u.keep=p},message(u,p){u.message=l.compile(p)},warn(u,p=!0){u.warn=p}},manifest:{build(u,p){for(const d in p){const h=p[d];if(["examples","externals","metas","notes","tags"].includes(d))for(const y of h)u=u[d.slice(0,-1)](y);else if(d!=="alterations")if(d!=="whens"){if(d==="shared")for(const y of h)u=u.shared(y)}else for(const y of h){const{ref:g,is:m,not:b,then:w,otherwise:E,concat:C}=y;u=C?u.concat(C):g?u.when(g,{is:m,not:b,then:w,otherwise:E,switch:y.switch,break:y.break}):u.when(m,{then:w,otherwise:E,break:y.break})}else{const y={};for(const{target:g,adjuster:m}of h)y[g]=m;u=u.alter(y)}}return u}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(s,i,o)=>{const a=o(375),f=o(9474),c=o(9621),l=o(8068),u=o(8160),p=o(3292),d={};s.exports=l.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(h,{schema:y,state:g,prefs:m}){if(!Array.isArray(h))return;const b=y.$_getRule("sort");return b?d.sort(y,h,b.args.options,g,m):void 0}},validate(h,{schema:y,error:g}){if(!Array.isArray(h)){if(y._flags.single){const m=[h];return m[u.symbols.arraySingle]=!0,{value:m}}return{errors:g("array.base")}}if(y.$_getRule("items")||y.$_terms.externals)return{value:h.slice()}},rules:{has:{method(h){h=this.$_compile(h,{appendPath:!0});const y=this.$_addRule({name:"has",args:{schema:h}});return y.$_mutateRegister(h),y},validate(h,{state:y,prefs:g,error:m},{schema:b}){const w=[h,...y.ancestors];for(let C=0;C<h.length;++C){const R=y.localize([...y.path,C],w,b);if(b.$_match(h[C],R,g))return h}const E=b._flags.label;return E?m("array.hasKnown",{patternLabel:E}):m("array.hasUnknown",null)},multi:!0},items:{method(...h){u.verifyFlat(h,"items");const y=this.$_addRule("items");for(let g=0;g<h.length;++g){const m=u.tryWithPath(()=>this.$_compile(h[g]),g,{append:!0});y.$_terms.items.push(m)}return y.$_mutateRebuild()},validate(h,{schema:y,error:g,state:m,prefs:b,errorsArray:w}){const E=y.$_terms._requireds.slice(),C=y.$_terms.ordered.slice(),R=[...y.$_terms._inclusions,...E],M=!h[u.symbols.arraySingle];delete h[u.symbols.arraySingle];const _=w();let A=h.length;for(let I=0;I<A;++I){const P=h[I];let v=!1,S=!1;const T=M?I:new Number(I),N=[...m.path,T];if(!y._flags.sparse&&P===void 0){if(_.push(g("array.sparse",{key:T,path:N,pos:I,value:void 0},m.localize(N))),b.abortEarly)return _;C.shift();continue}const D=[h,...m.ancestors];for(const k of y.$_terms._exclusions)if(k.$_match(P,m.localize(N,D,k),b,{presence:"ignore"})){if(_.push(g("array.excludes",{pos:I,value:P},m.localize(N))),b.abortEarly)return _;v=!0,C.shift();break}if(v)continue;if(y.$_terms.ordered.length){if(C.length){const k=C.shift(),q=k.$_validate(P,m.localize(N,D,k),b);if(q.errors){if(_.push(...q.errors),b.abortEarly)return _}else if(k._flags.result==="strip")d.fastSplice(h,I),--I,--A;else{if(!y._flags.sparse&&q.value===void 0){if(_.push(g("array.sparse",{key:T,path:N,pos:I,value:void 0},m.localize(N))),b.abortEarly)return _;continue}h[I]=q.value}continue}if(!y.$_terms.items.length){if(_.push(g("array.orderedLength",{pos:I,limit:y.$_terms.ordered.length})),b.abortEarly)return _;break}}const O=[];let L=E.length;for(let k=0;k<L;++k){const q=m.localize(N,D,E[k]);q.snapshot();const W=E[k].$_validate(P,q,b);if(O[k]=W,!W.errors){if(q.commit(),h[I]=W.value,S=!0,d.fastSplice(E,k),--k,--L,!y._flags.sparse&&W.value===void 0&&(_.push(g("array.sparse",{key:T,path:N,pos:I,value:void 0},m.localize(N))),b.abortEarly))return _;break}q.restore()}if(S)continue;const B=b.stripUnknown&&!!b.stripUnknown.arrays||!1;L=R.length;for(const k of R){let q;const W=E.indexOf(k);if(W!==-1)q=O[W];else{const re=m.localize(N,D,k);if(re.snapshot(),q=k.$_validate(P,re,b),!q.errors){re.commit(),k._flags.result==="strip"?(d.fastSplice(h,I),--I,--A):y._flags.sparse||q.value!==void 0?h[I]=q.value:(_.push(g("array.sparse",{key:T,path:N,pos:I,value:void 0},m.localize(N))),v=!0),S=!0;break}re.restore()}if(L===1){if(B){d.fastSplice(h,I),--I,--A,S=!0;break}if(_.push(...q.errors),b.abortEarly)return _;v=!0;break}}if(!v&&(y.$_terms._inclusions.length||y.$_terms._requireds.length)&&!S){if(B){d.fastSplice(h,I),--I,--A;continue}if(_.push(g("array.includes",{pos:I,value:P},m.localize(N))),b.abortEarly)return _}}return E.length&&d.fillMissedErrors(y,_,E,h,m,b),C.length&&(d.fillOrderedErrors(y,_,C,h,m,b),_.length||d.fillDefault(C,h,m,b)),_.length?_:h},priority:!0,manifest:!1},length:{method(h){return this.$_addRule({name:"length",args:{limit:h},operator:"="})},validate:(h,y,{limit:g},{name:m,operator:b,args:w})=>u.compare(h.length,g,b)?h:y.error("array."+m,{limit:w.limit,value:h}),args:[{name:"limit",ref:!0,assert:u.limit,message:"must be a positive integer"}]},max:{method(h){return this.$_addRule({name:"max",method:"length",args:{limit:h},operator:"<="})}},min:{method(h){return this.$_addRule({name:"min",method:"length",args:{limit:h},operator:">="})}},ordered:{method(...h){u.verifyFlat(h,"ordered");const y=this.$_addRule("items");for(let g=0;g<h.length;++g){const m=u.tryWithPath(()=>this.$_compile(h[g]),g,{append:!0});d.validateSingle(m,y),y.$_mutateRegister(m),y.$_terms.ordered.push(m)}return y.$_mutateRebuild()}},single:{method(h){const y=h===void 0||!!h;return a(!y||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",y)}},sort:{method(h={}){u.assertOptions(h,["by","order"]);const y={order:h.order||"ascending"};return h.by&&(y.by=p.ref(h.by,{ancestor:0}),a(!y.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:y}})},validate(h,{error:y,state:g,prefs:m,schema:b},{options:w}){const{value:E,errors:C}=d.sort(b,h,w,g,m);if(C)return C;for(let R=0;R<h.length;++R)if(h[R]!==E[R])return y("array.sort",{order:w.order,by:w.by?w.by.key:"value"});return h},convert:!0},sparse:{method(h){const y=h===void 0||!!h;return this._flags.sparse===y?this:(y?this.clone():this.$_addRule("items")).$_setFlag("sparse",y,{clone:!1})}},unique:{method(h,y={}){a(!h||typeof h=="function"||typeof h=="string","comparator must be a function or a string"),u.assertOptions(y,["ignoreUndefined","separator"]);const g={name:"unique",args:{options:y,comparator:h}};if(h)if(typeof h=="string"){const m=u.default(y.separator,".");g.path=m?h.split(m):[h]}else g.comparator=h;return this.$_addRule(g)},validate(h,{state:y,error:g,schema:m},{comparator:b,options:w},{comparator:E,path:C}){const R={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},M=E||f,_=w.ignoreUndefined;for(let A=0;A<h.length;++A){const I=C?c(h[A],C):h[A],P=E?R.custom:R[typeof I];if(a(P,"Failed to find unique map container for type",typeof I),P instanceof Map){const v=P.entries();let S;for(;!(S=v.next()).done;)if(M(S.value[0],I)){const T=y.localize([...y.path,A],[h,...y.ancestors]),N={pos:A,value:h[A],dupePos:S.value[1],dupeValue:h[S.value[1]]};return C&&(N.path=b),g("array.unique",N,T)}P.set(I,A)}else{if((!_||I!==void 0)&&P[I]!==void 0){const v={pos:A,value:h[A],dupePos:P[I],dupeValue:h[P[I]]};return C&&(v.path=b),g("array.unique",v,y.localize([...y.path,A],[h,...y.ancestors]))}P[I]=A}}return h},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(h,y)=>new Set(h)}},rebuild(h){h.$_terms._inclusions=[],h.$_terms._exclusions=[],h.$_terms._requireds=[];for(const y of h.$_terms.items)d.validateSingle(y,h),y._flags.presence==="required"?h.$_terms._requireds.push(y):y._flags.presence==="forbidden"?h.$_terms._exclusions.push(y):h.$_terms._inclusions.push(y);for(const y of h.$_terms.ordered)d.validateSingle(y,h)},manifest:{build:(h,y)=>(y.items&&(h=h.items(...y.items)),y.ordered&&(h=h.ordered(...y.ordered)),h)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),d.fillMissedErrors=function(h,y,g,m,b,w){const E=[];let C=0;for(const R of g){const M=R._flags.label;M?E.push(M):++C}E.length?C?y.push(h.$_createError("array.includesRequiredBoth",m,{knownMisses:E,unknownMisses:C},b,w)):y.push(h.$_createError("array.includesRequiredKnowns",m,{knownMisses:E},b,w)):y.push(h.$_createError("array.includesRequiredUnknowns",m,{unknownMisses:C},b,w))},d.fillOrderedErrors=function(h,y,g,m,b,w){const E=[];for(const C of g)C._flags.presence==="required"&&E.push(C);E.length&&d.fillMissedErrors(h,y,E,m,b,w)},d.fillDefault=function(h,y,g,m){const b=[];let w=!0;for(let E=h.length-1;E>=0;--E){const C=h[E],R=[y,...g.ancestors],M=C.$_validate(void 0,g.localize(g.path,R,C),m).value;if(w){if(M===void 0)continue;w=!1}b.unshift(M)}b.length&&y.push(...b)},d.fastSplice=function(h,y){let g=y;for(;g<h.length;)h[g++]=h[g];--h.length},d.validateSingle=function(h,y){(h.type==="array"||h._flags._arrayItems)&&(a(!y._flags.single,"Cannot specify array item with single rule enabled"),y.$_setFlag("_arrayItems",!0,{clone:!1}))},d.sort=function(h,y,g,m,b){const w=g.order==="ascending"?1:-1,E=-1*w,C=w,R=(M,_)=>{let A=d.compare(M,_,E,C);if(A!==null||(g.by&&(M=g.by.resolve(M,m,b),_=g.by.resolve(_,m,b)),A=d.compare(M,_,E,C),A!==null))return A;const I=typeof M;if(I!==typeof _)throw h.$_createError("array.sort.mismatching",y,null,m,b);if(I!=="number"&&I!=="string")throw h.$_createError("array.sort.unsupported",y,{type:I},m,b);return I==="number"?(M-_)*w:M<_?E:C};try{return{value:y.slice().sort(R)}}catch(M){return{errors:M}}},d.compare=function(h,y,g,m){return h===y?0:h===void 0?1:y===void 0?-1:h===null?m:y===null?g:null}},4937:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(2036),u={isBool:function(p){return typeof p=="boolean"}};s.exports=f.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(p,{schema:d}){if(typeof p!="boolean"){if(typeof p=="string"){const h=d._flags.sensitive?p:p.toLowerCase();p=h==="true"||h!=="false"&&p}return typeof p!="boolean"&&(p=d.$_terms.truthy&&d.$_terms.truthy.has(p,null,null,!d._flags.sensitive)||(!d.$_terms.falsy||!d.$_terms.falsy.has(p,null,null,!d._flags.sensitive))&&p),{value:p}}},validate(p,{error:d}){if(typeof p!="boolean")return{value:p,errors:d("boolean.base")}},rules:{truthy:{method(...p){c.verifyFlat(p,"truthy");const d=this.clone();d.$_terms.truthy=d.$_terms.truthy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call truthy with undefined"),d.$_terms.truthy.add(y)}return d}},falsy:{method(...p){c.verifyFlat(p,"falsy");const d=this.clone();d.$_terms.falsy=d.$_terms.falsy||new l;for(let h=0;h<p.length;++h){const y=p[h];a(y!==void 0,"Cannot call falsy with undefined"),d.$_terms.falsy.add(y)}return d}},sensitive:{method(p=!0){return this.$_setFlag("sensitive",p)}}},cast:{number:{from:u.isBool,to:(p,d)=>p?1:0},string:{from:u.isBool,to:(p,d)=>p?"true":"false"}},manifest:{build:(p,d)=>(d.truthy&&(p=p.truthy(...d.truthy)),d.falsy&&(p=p.falsy(...d.falsy)),p)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(3328),u={isDate:function(p){return p instanceof Date}};s.exports=f.extend({type:"date",coerce:{from:["number","string"],method:(p,{schema:d})=>({value:u.parse(p,d._flags.format)||p})},validate(p,{schema:d,error:h,prefs:y}){if(p instanceof Date&&!isNaN(p.getTime()))return;const g=d._flags.format;return y.convert&&g&&typeof p=="string"?{value:p,errors:h("date.format",{format:g})}:{value:p,errors:h("date.base")}},rules:{compare:{method:!1,validate(p,d,{date:h},{name:y,operator:g,args:m}){const b=h==="now"?Date.now():h.getTime();return c.compare(p.getTime(),b,g)?p:d.error("date."+y,{limit:m.date,value:p})},args:[{name:"date",ref:!0,normalize:p=>p==="now"?p:u.parse(p),assert:p=>p!==null,message:"must have a valid date format"}]},format:{method(p){return a(["iso","javascript","unix"].includes(p),"Unknown date format",p),this.$_setFlag("format",p)}},greater:{method(p){return this.$_addRule({name:"greater",method:"compare",args:{date:p},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(p){return this.$_addRule({name:"less",method:"compare",args:{date:p},operator:"<"})}},max:{method(p){return this.$_addRule({name:"max",method:"compare",args:{date:p},operator:"<="})}},min:{method(p){return this.$_addRule({name:"min",method:"compare",args:{date:p},operator:">="})}},timestamp:{method(p="javascript"){return a(["javascript","unix"].includes(p),'"type" must be one of "javascript, unix"'),this.format(p)}}},cast:{number:{from:u.isDate,to:(p,d)=>p.getTime()},string:{from:u.isDate,to:(p,{prefs:d})=>l.date(p,d)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),u.parse=function(p,d){if(p instanceof Date)return p;if(typeof p!="string"&&(isNaN(p)||!isFinite(p))||/^\s*$/.test(p))return null;if(d==="iso")return c.isIsoDate(p)?u.date(p.toString()):null;const h=p;if(typeof p=="string"&&/^[+-]?\d+(\.\d+)?$/.test(p)&&(p=parseFloat(p)),d){if(d==="javascript")return u.date(1*p);if(d==="unix")return u.date(1e3*p);if(typeof h=="string")return null}return u.date(p)},u.date=function(p){const d=new Date(p);return isNaN(d.getTime())?null:d}},390:(s,i,o)=>{const a=o(375),f=o(7824);s.exports=f.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:c}})},validate:(c,l,{n:u})=>c.length===u?c:l.error("function.arity",{n:u})},class:{method(){return this.$_addRule("class")},validate:(c,l)=>/^\s*class\s/.test(c.toString())?c:l.error("function.class",{value:c})},minArity:{method(c){return a(Number.isSafeInteger(c)&&c>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length>=u?c:l.error("function.minArity",{n:u})},maxArity:{method(c){return a(Number.isSafeInteger(c)&&c>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:c}})},validate:(c,l,{n:u})=>c.length<=u?c:l.error("function.maxArity",{n:u})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(s,i,o)=>{const a=o(978),f=o(375),c=o(8571),l=o(3652),u=o(8068),p=o(8160),d=o(3292),h=o(6354),y=o(6133),g=o(3328),m={renameDefaults:{alias:!1,multiple:!1,override:!1}};s.exports=u.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(b,w)=>b.keys(w),validate(b,{schema:w,error:E,state:C,prefs:R}){if(!b||typeof b!==w.$_property("typeof")||Array.isArray(b))return{value:b,errors:E("object.base",{type:w.$_property("typeof")})};if(!(w.$_terms.renames||w.$_terms.dependencies||w.$_terms.keys||w.$_terms.patterns||w.$_terms.externals))return;b=m.clone(b,R);const M=[];if(w.$_terms.renames&&!m.rename(w,b,C,R,M))return{value:b,errors:M};if(!w.$_terms.keys&&!w.$_terms.patterns&&!w.$_terms.dependencies)return{value:b,errors:M};const _=new Set(Object.keys(b));if(w.$_terms.keys){const A=[b,...C.ancestors];for(const I of w.$_terms.keys){const P=I.key,v=b[P];_.delete(P);const S=C.localize([...C.path,P],A,I),T=I.schema.$_validate(v,S,R);if(T.errors){if(R.abortEarly)return{value:b,errors:T.errors};T.value!==void 0&&(b[P]=T.value),M.push(...T.errors)}else I.schema._flags.result==="strip"||T.value===void 0&&v!==void 0?delete b[P]:T.value!==void 0&&(b[P]=T.value)}}if(_.size||w._flags._hasPatternMatch){const A=m.unknown(w,b,_,M,C,R);if(A)return A}if(w.$_terms.dependencies)for(const A of w.$_terms.dependencies){if(A.key!==null&&m.isPresent(A.options)(A.key.resolve(b,C,R,null,{shadow:!1}))===!1)continue;const I=m.dependencies[A.rel](w,A,b,C,R);if(I){const P=w.$_createError(I.code,b,I.context,C,R);if(R.abortEarly)return{value:b,errors:P};M.push(P)}}return{value:b,errors:M}},rules:{and:{method(...b){return p.verifyFlat(b,"and"),m.dependency(this,"and",null,b)}},append:{method(b){return b==null||Object.keys(b).length===0?this:this.keys(b)}},assert:{method(b,w,E){g.isTemplate(b)||(b=d.ref(b)),f(E===void 0||typeof E=="string","Message must be a string"),w=this.$_compile(w,{appendPath:!0});const C=this.$_addRule({name:"assert",args:{subject:b,schema:w,message:E}});return C.$_mutateRegister(b),C.$_mutateRegister(w),C},validate(b,{error:w,prefs:E,state:C},{subject:R,schema:M,message:_}){const A=R.resolve(b,C,E),I=y.isRef(R)?R.absolute(C):[];return M.$_match(A,C.localize(I,[b,...C.ancestors],M),E)?b:w("object.assert",{subject:R,message:_})},args:["subject","schema","message"],multi:!0},instance:{method(b,w){return f(typeof b=="function","constructor must be a function"),w=w||b.name,this.$_addRule({name:"instance",args:{constructor:b,name:w}})},validate:(b,w,{constructor:E,name:C})=>b instanceof E?b:w.error("object.instance",{type:C,value:b}),args:["constructor","name"]},keys:{method(b){f(b===void 0||typeof b=="object","Object schema must be a valid object"),f(!p.isSchema(b),"Object schema cannot be a joi schema");const w=this.clone();if(b)if(Object.keys(b).length){w.$_terms.keys=w.$_terms.keys?w.$_terms.keys.filter(E=>!b.hasOwnProperty(E.key)):new m.Keys;for(const E in b)p.tryWithPath(()=>w.$_terms.keys.push({key:E,schema:this.$_compile(b[E])}),E)}else w.$_terms.keys=new m.Keys;else w.$_terms.keys=null;return w.$_mutateRebuild()}},length:{method(b){return this.$_addRule({name:"length",args:{limit:b},operator:"="})},validate:(b,w,{limit:E},{name:C,operator:R,args:M})=>p.compare(Object.keys(b).length,E,R)?b:w.error("object."+C,{limit:M.limit,value:b}),args:[{name:"limit",ref:!0,assert:p.limit,message:"must be a positive integer"}]},max:{method(b){return this.$_addRule({name:"max",method:"length",args:{limit:b},operator:"<="})}},min:{method(b){return this.$_addRule({name:"min",method:"length",args:{limit:b},operator:">="})}},nand:{method(...b){return p.verifyFlat(b,"nand"),m.dependency(this,"nand",null,b)}},or:{method(...b){return p.verifyFlat(b,"or"),m.dependency(this,"or",null,b)}},oxor:{method(...b){return m.dependency(this,"oxor",null,b)}},pattern:{method(b,w,E={}){const C=b instanceof RegExp;C||(b=this.$_compile(b,{appendPath:!0})),f(w!==void 0,"Invalid rule"),p.assertOptions(E,["fallthrough","matches"]),C&&f(!b.flags.includes("g")&&!b.flags.includes("y"),"pattern should not use global or sticky mode"),w=this.$_compile(w,{appendPath:!0});const R=this.clone();R.$_terms.patterns=R.$_terms.patterns||[];const M={[C?"regex":"schema"]:b,rule:w};return E.matches&&(M.matches=this.$_compile(E.matches),M.matches.type!=="array"&&(M.matches=M.matches.$_root.array().items(M.matches)),R.$_mutateRegister(M.matches),R.$_setFlag("_hasPatternMatch",!0,{clone:!1})),E.fallthrough&&(M.fallthrough=!0),R.$_terms.patterns.push(M),R.$_mutateRegister(w),R}},ref:{method(){return this.$_addRule("ref")},validate:(b,w)=>y.isRef(b)?b:w.error("object.refType",{value:b})},regex:{method(){return this.$_addRule("regex")},validate:(b,w)=>b instanceof RegExp?b:w.error("object.regex",{value:b})},rename:{method(b,w,E={}){f(typeof b=="string"||b instanceof RegExp,"Rename missing the from argument"),f(typeof w=="string"||w instanceof g,"Invalid rename to argument"),f(w!==b,"Cannot rename key to same name:",b),p.assertOptions(E,["alias","ignoreUndefined","override","multiple"]);const C=this.clone();C.$_terms.renames=C.$_terms.renames||[];for(const R of C.$_terms.renames)f(R.from!==b,"Cannot rename the same key multiple times");return w instanceof g&&C.$_mutateRegister(w),C.$_terms.renames.push({from:b,to:w,options:a(m.renameDefaults,E)}),C}},schema:{method(b="any"){return this.$_addRule({name:"schema",args:{type:b}})},validate:(b,w,{type:E})=>!p.isSchema(b)||E!=="any"&&b.type!==E?w.error("object.schema",{type:E}):b},unknown:{method(b){return this.$_setFlag("unknown",b!==!1)}},with:{method(b,w,E={}){return m.dependency(this,"with",b,w,E)}},without:{method(b,w,E={}){return m.dependency(this,"without",b,w,E)}},xor:{method(...b){return p.verifyFlat(b,"xor"),m.dependency(this,"xor",null,b)}}},overrides:{default(b,w){return b===void 0&&(b=p.symbols.deepDefault),this.$_parent("default",b,w)}},rebuild(b){if(b.$_terms.keys){const w=new l.Sorter;for(const E of b.$_terms.keys)p.tryWithPath(()=>w.add(E,{after:E.schema.$_rootReferences(),group:E.key}),E.key);b.$_terms.keys=new m.Keys(...w.nodes)}},manifest:{build(b,w){if(w.keys&&(b=b.keys(w.keys)),w.dependencies)for(const{rel:E,key:C=null,peers:R,options:M}of w.dependencies)b=m.dependency(b,E,C,R,M);if(w.patterns)for(const{regex:E,schema:C,rule:R,fallthrough:M,matches:_}of w.patterns)b=b.pattern(E||C,R,{fallthrough:M,matches:_});if(w.renames)for(const{from:E,to:C,options:R}of w.renames)b=b.rename(E,C,R);return b}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),m.clone=function(b,w){if(typeof b=="object"){if(w.nonEnumerables)return c(b,{shallow:!0});const C=Object.create(Object.getPrototypeOf(b));return Object.assign(C,b),C}const E=function(...C){return b.apply(this,C)};return E.prototype=c(b.prototype),Object.defineProperty(E,"name",{value:b.name,writable:!1}),Object.defineProperty(E,"length",{value:b.length,writable:!1}),Object.assign(E,b),E},m.dependency=function(b,w,E,C,R){f(E===null||typeof E=="string",w,"key must be a strings"),R||(R=C.length>1&&typeof C[C.length-1]=="object"?C.pop():{}),p.assertOptions(R,["separator","isPresent"]),C=[].concat(C);const M=p.default(R.separator,"."),_=[];for(const I of C)f(typeof I=="string",w,"peers must be strings"),_.push(d.ref(I,{separator:M,ancestor:0,prefix:!1}));E!==null&&(E=d.ref(E,{separator:M,ancestor:0,prefix:!1}));const A=b.clone();return A.$_terms.dependencies=A.$_terms.dependencies||[],A.$_terms.dependencies.push(new m.Dependency(w,E,_,C,R)),A},m.dependencies={and(b,w,E,C,R){const M=[],_=[],A=w.peers.length,I=m.isPresent(w.options);for(const P of w.peers)I(P.resolve(E,C,R,null,{shadow:!1}))===!1?M.push(P.key):_.push(P.key);if(M.length!==A&&_.length!==A)return{code:"object.and",context:{present:_,presentWithLabels:m.keysToLabels(b,_),missing:M,missingWithLabels:m.keysToLabels(b,M)}}},nand(b,w,E,C,R){const M=[],_=m.isPresent(w.options);for(const P of w.peers)_(P.resolve(E,C,R,null,{shadow:!1}))&&M.push(P.key);if(M.length!==w.peers.length)return;const A=w.paths[0],I=w.paths.slice(1);return{code:"object.nand",context:{main:A,mainWithLabel:m.keysToLabels(b,A),peers:I,peersWithLabels:m.keysToLabels(b,I)}}},or(b,w,E,C,R){const M=m.isPresent(w.options);for(const _ of w.peers)if(M(_.resolve(E,C,R,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:w.paths,peersWithLabels:m.keysToLabels(b,w.paths)}}},oxor(b,w,E,C,R){const M=[],_=m.isPresent(w.options);for(const I of w.peers)_(I.resolve(E,C,R,null,{shadow:!1}))&&M.push(I.key);if(!M.length||M.length===1)return;const A={peers:w.paths,peersWithLabels:m.keysToLabels(b,w.paths)};return A.present=M,A.presentWithLabels=m.keysToLabels(b,M),{code:"object.oxor",context:A}},with(b,w,E,C,R){const M=m.isPresent(w.options);for(const _ of w.peers)if(M(_.resolve(E,C,R,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:w.key.key,mainWithLabel:m.keysToLabels(b,w.key.key),peer:_.key,peerWithLabel:m.keysToLabels(b,_.key)}}},without(b,w,E,C,R){const M=m.isPresent(w.options);for(const _ of w.peers)if(M(_.resolve(E,C,R,null,{shadow:!1})))return{code:"object.without",context:{main:w.key.key,mainWithLabel:m.keysToLabels(b,w.key.key),peer:_.key,peerWithLabel:m.keysToLabels(b,_.key)}}},xor(b,w,E,C,R){const M=[],_=m.isPresent(w.options);for(const I of w.peers)_(I.resolve(E,C,R,null,{shadow:!1}))&&M.push(I.key);if(M.length===1)return;const A={peers:w.paths,peersWithLabels:m.keysToLabels(b,w.paths)};return M.length===0?{code:"object.missing",context:A}:(A.present=M,A.presentWithLabels=m.keysToLabels(b,M),{code:"object.xor",context:A})}},m.keysToLabels=function(b,w){return Array.isArray(w)?w.map(E=>b.$_mapLabels(E)):b.$_mapLabels(w)},m.isPresent=function(b){return typeof b.isPresent=="function"?b.isPresent:w=>w!==void 0},m.rename=function(b,w,E,C,R){const M={};for(const _ of b.$_terms.renames){const A=[],I=typeof _.from!="string";if(I)for(const P in w){if(w[P]===void 0&&_.options.ignoreUndefined||P===_.to)continue;const v=_.from.exec(P);v&&A.push({from:P,to:_.to,match:v})}else!Object.prototype.hasOwnProperty.call(w,_.from)||w[_.from]===void 0&&_.options.ignoreUndefined||A.push(_);for(const P of A){const v=P.from;let S=P.to;if(S instanceof g&&(S=S.render(w,E,C,P.match)),v!==S){if(!_.options.multiple&&M[S]&&(R.push(b.$_createError("object.rename.multiple",w,{from:v,to:S,pattern:I},E,C)),C.abortEarly)||Object.prototype.hasOwnProperty.call(w,S)&&!_.options.override&&!M[S]&&(R.push(b.$_createError("object.rename.override",w,{from:v,to:S,pattern:I},E,C)),C.abortEarly))return!1;w[v]===void 0?delete w[S]:w[S]=w[v],M[S]=!0,_.options.alias||delete w[v]}}}return!0},m.unknown=function(b,w,E,C,R,M){if(b.$_terms.patterns){let _=!1;const A=b.$_terms.patterns.map(P=>{if(P.matches)return _=!0,[]}),I=[w,...R.ancestors];for(const P of E){const v=w[P],S=[...R.path,P];for(let T=0;T<b.$_terms.patterns.length;++T){const N=b.$_terms.patterns[T];if(N.regex){const L=N.regex.test(P);if(R.mainstay.tracer.debug(R,"rule",`pattern.${T}`,L?"pass":"error"),!L)continue}else if(!N.schema.$_match(P,R.nest(N.schema,`pattern.${T}`),M))continue;E.delete(P);const D=R.localize(S,I,{schema:N.rule,key:P}),O=N.rule.$_validate(v,D,M);if(O.errors){if(M.abortEarly)return{value:w,errors:O.errors};C.push(...O.errors)}if(N.matches&&A[T].push(P),w[P]=O.value,!N.fallthrough)break}}if(_)for(let P=0;P<A.length;++P){const v=A[P];if(!v)continue;const S=b.$_terms.patterns[P].matches,T=R.localize(R.path,I,S),N=S.$_validate(v,T,M);if(N.errors){const D=h.details(N.errors,{override:!1});D.matches=v;const O=b.$_createError("object.pattern.match",w,D,R,M);if(M.abortEarly)return{value:w,errors:O};C.push(O)}}}if(E.size&&(b.$_terms.keys||b.$_terms.patterns)){if(M.stripUnknown&&b._flags.unknown===void 0||M.skipFunctions){const _=!(!M.stripUnknown||M.stripUnknown!==!0&&!M.stripUnknown.objects);for(const A of E)_?(delete w[A],E.delete(A)):typeof w[A]=="function"&&E.delete(A)}if(!p.default(b._flags.unknown,M.allowUnknown))for(const _ of E){const A=R.localize([...R.path,_],[]),I=b.$_createError("object.unknown",w[_],{child:_},A,M,{flags:!1});if(M.abortEarly)return{value:w,errors:I};C.push(I)}}},m.Dependency=class{constructor(b,w,E,C,R){this.rel=b,this.key=w,this.peers=E,this.paths=C,this.options=R}describe(){const b={rel:this.rel,peers:this.paths};return this.key!==null&&(b.key=this.key.key),this.peers[0].separator!=="."&&(b.options={...b.options,separator:this.peers[0].separator}),this.options.isPresent&&(b.options={...b.options,isPresent:this.options.isPresent}),b}},m.Keys=class extends Array{concat(b){const w=this.slice(),E=new Map;for(let C=0;C<w.length;++C)E.set(w[C].key,C);for(const C of b){const R=C.key,M=E.get(R);M!==void 0?w[M]={key:R,schema:w[M].schema.concat(C.schema)}:w.push(C)}return w}}},8785:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l=o(3292),u=o(6354),p={};s.exports=f.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(d,h)=>d.ref(h),validate(d,{schema:h,state:y,prefs:g}){a(h.$_terms.link,"Uninitialized link schema");const m=p.generate(h,d,y,g),b=h.$_terms.link[0].ref;return m.$_validate(d,y.nest(m,`link:${b.display}:${m.type}`),g)},generate:(d,h,y,g)=>p.generate(d,h,y,g),rules:{ref:{method(d){a(!this.$_terms.link,"Cannot reinitialize schema"),d=l.ref(d),a(d.type==="value"||d.type==="local","Invalid reference type:",d.type),a(d.type==="local"||d.ancestor==="root"||d.ancestor>0,"Link cannot reference itself");const h=this.clone();return h.$_terms.link=[{ref:d}],h}},relative:{method(d=!0){return this.$_setFlag("relative",d)}}},overrides:{concat(d){a(this.$_terms.link,"Uninitialized link schema"),a(c.isSchema(d),"Invalid schema object"),a(d.type!=="link","Cannot merge type link with another link");const h=this.clone();return h.$_terms.whens||(h.$_terms.whens=[]),h.$_terms.whens.push({concat:d}),h.$_mutateRebuild()}},manifest:{build:(d,h)=>(a(h.link,"Invalid link description missing link"),d.ref(h.link))}}),p.generate=function(d,h,y,g){let m=y.mainstay.links.get(d);if(m)return m._generate(h,y,g).schema;const b=d.$_terms.link[0].ref,{perspective:w,path:E}=p.perspective(b,y);p.assert(w,"which is outside of schema boundaries",b,d,y,g);try{m=E.length?w.$_reach(E):w}catch{p.assert(!1,"to non-existing schema",b,d,y,g)}return p.assert(m.type!=="link","which is another link",b,d,y,g),d._flags.relative||y.mainstay.links.set(d,m),m._generate(h,y,g).schema},p.perspective=function(d,h){if(d.type==="local"){for(const{schema:y,key:g}of h.schemas){if((y._flags.id||g)===d.path[0])return{perspective:y,path:d.path.slice(1)};if(y.$_terms.shared){for(const m of y.$_terms.shared)if(m._flags.id===d.path[0])return{perspective:m,path:d.path.slice(1)}}}return{perspective:null,path:null}}return d.ancestor==="root"?{perspective:h.schemas[h.schemas.length-1].schema,path:d.path}:{perspective:h.schemas[d.ancestor]&&h.schemas[d.ancestor].schema,path:d.path}},p.assert=function(d,h,y,g,m,b){d||a(!1,`"${u.label(g._flags,m,b)}" contains link reference "${y.display}" ${h}`)}},3832:(s,i,o)=>{const a=o(375),f=o(8068),c=o(8160),l={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(u){const p=u.toString(),d=p.indexOf("."),h=p.indexOf("e");return(d<0?0:(h<0?p.length:h)-d-1)+(h<0?0:Math.max(0,-parseInt(p.slice(h+1))))}};s.exports=f.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(u,{schema:p,error:d}){if(!u.match(l.numberRx))return;u=u.trim();const h={value:parseFloat(u)};if(h.value===0&&(h.value=0),!p._flags.unsafe)if(u.match(/e/i)){if(l.extractSignificantDigits(u)!==l.extractSignificantDigits(String(h.value)))return h.errors=d("number.unsafe"),h}else{const y=h.value.toString();if(y.match(/e/i))return h;if(y!==l.normalizeDecimal(u))return h.errors=d("number.unsafe"),h}return h}},validate(u,{schema:p,error:d,prefs:h}){if(u===1/0||u===-1/0)return{value:u,errors:d("number.infinity")};if(!c.isNumber(u))return{value:u,errors:d("number.base")};const y={value:u};if(h.convert){const g=p.$_getRule("precision");if(g){const m=Math.pow(10,g.args.limit);y.value=Math.round(y.value*m)/m}}return y.value===0&&(y.value=0),!p._flags.unsafe&&(u>Number.MAX_SAFE_INTEGER||u<Number.MIN_SAFE_INTEGER)&&(y.errors=d("number.unsafe")),y},rules:{compare:{method:!1,validate:(u,p,{limit:d},{name:h,operator:y,args:g})=>c.compare(u,d,y)?u:p.error("number."+h,{limit:g.limit,value:u}),args:[{name:"limit",ref:!0,assert:c.isNumber,message:"must be a number"}]},greater:{method(u){return this.$_addRule({name:"greater",method:"compare",args:{limit:u},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(u,p)=>Math.trunc(u)-u==0?u:p.error("number.integer")},less:{method(u){return this.$_addRule({name:"less",method:"compare",args:{limit:u},operator:"<"})}},max:{method(u){return this.$_addRule({name:"max",method:"compare",args:{limit:u},operator:"<="})}},min:{method(u){return this.$_addRule({name:"min",method:"compare",args:{limit:u},operator:">="})}},multiple:{method(u){const p=typeof u=="number"?l.decimalPlaces(u):null,d=Math.pow(10,p);return this.$_addRule({name:"multiple",args:{base:u,baseDecimalPlace:p,pfactor:d}})},validate:(u,p,{base:d,baseDecimalPlace:h,pfactor:y},g)=>l.decimalPlaces(u)>h?p.error("number.multiple",{multiple:g.args.base,value:u}):Math.round(y*u)%Math.round(y*d)==0?u:p.error("number.multiple",{multiple:g.args.base,value:u}),args:[{name:"base",ref:!0,assert:u=>typeof u=="number"&&isFinite(u)&&u>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(u,p)=>Number.isSafeInteger(u)&&u>=0&&u<=65535?u:p.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(u){return a(Number.isSafeInteger(u),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:u}})},validate(u,p,{limit:d}){const h=u.toString().match(l.precisionRx);return Math.max((h[1]?h[1].length:0)-(h[2]?parseInt(h[2],10):0),0)<=d?u:p.error("number.precision",{limit:d,value:u})},convert:!0},sign:{method(u){return a(["negative","positive"].includes(u),"Invalid sign",u),this.$_addRule({name:"sign",args:{sign:u}})},validate:(u,p,{sign:d})=>d==="negative"&&u<0||d==="positive"&&u>0?u:p.error(`number.${d}`)},unsafe:{method(u=!0){return a(typeof u=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",u)}}},cast:{string:{from:u=>typeof u=="number",to:(u,p)=>u.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),l.extractSignificantDigits=function(u){return u.replace(l.exponentialPartRegex,"").replace(l.dotRegex,"").replace(l.trailingZerosRegex,"").replace(l.leadingSignAndZerosRegex,"")},l.normalizeDecimal=function(u){return(u=u.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&u.endsWith("0")&&(u=u.replace(/0+$/,"")),u==="-0"?"0":u}},8966:(s,i,o)=>{const a=o(7824);s.exports=a.extend({type:"object",cast:{map:{from:f=>f&&typeof f=="object",to:(f,c)=>new Map(Object.entries(f))}}})},7417:(s,i,o)=>{const a=o(375),f=o(5380),c=o(1745),l=o(9959),u=o(6064),p=o(9926),d=o(5752),h=o(8068),y=o(8160),g={tlds:p instanceof Set&&{tlds:{allow:p,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:l.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};s.exports=h.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(m,{schema:b,state:w,prefs:E}){const C=b.$_getRule("normalize");C&&(m=m.normalize(C.args.form));const R=b.$_getRule("case");R&&(m=R.args.direction==="upper"?m.toLocaleUpperCase():m.toLocaleLowerCase());const M=b.$_getRule("trim");if(M&&M.args.enabled&&(m=m.trim()),b.$_terms.replacements)for(const A of b.$_terms.replacements)m=m.replace(A.pattern,A.replacement);const _=b.$_getRule("hex");if(_&&_.args.options.byteAligned&&m.length%2!=0&&(m=`0${m}`),b.$_getRule("isoDate")){const A=g.isoDate(m);A&&(m=A)}if(b._flags.truncate){const A=b.$_getRule("max");if(A){let I=A.args.limit;if(y.isResolvable(I)&&(I=I.resolve(m,w,E),!y.limit(I)))return{value:m,errors:b.$_createError("any.ref",I,{ref:A.args.limit,arg:"limit",reason:"must be a positive integer"},w,E)};m=m.slice(0,I)}}return{value:m}}},validate(m,{schema:b,error:w}){if(typeof m!="string")return{value:m,errors:w("string.base")};if(m===""){const E=b.$_getRule("min");return E&&E.args.limit===0?void 0:{value:m,errors:w("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(m,b)=>/^[a-zA-Z0-9]+$/.test(m)?m:b.error("string.alphanum")},base64:{method(m={}){return y.assertOptions(m,["paddingRequired","urlSafe"]),m={urlSafe:!1,paddingRequired:!0,...m},a(typeof m.paddingRequired=="boolean","paddingRequired must be boolean"),a(typeof m.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:m}})},validate:(m,b,{options:w})=>g.base64Regex[w.paddingRequired][w.urlSafe].test(m)?m:b.error("string.base64")},case:{method(m){return a(["lower","upper"].includes(m),"Invalid case:",m),this.$_addRule({name:"case",args:{direction:m}})},validate:(m,b,{direction:w})=>w==="lower"&&m===m.toLocaleLowerCase()||w==="upper"&&m===m.toLocaleUpperCase()?m:b.error(`string.${w}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(m,b){let w=m.length,E=0,C=1;for(;w--;){const R=m.charAt(w)*C;E+=R-9*(R>9),C^=3}return E>0&&E%10==0?m:b.error("string.creditCard")}},dataUri:{method(m={}){return y.assertOptions(m,["paddingRequired"]),m={paddingRequired:!0,...m},a(typeof m.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:m}})},validate(m,b,{options:w}){const E=m.match(g.dataUriRegex);return E&&(!E[2]||E[2]!=="base64"||g.base64Regex[w.paddingRequired].false.test(E[3]))?m:b.error("string.dataUri")}},domain:{method(m){m&&y.assertOptions(m,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const b=g.addressOptions(m);return this.$_addRule({name:"domain",args:{options:m},address:b})},validate:(m,b,w,{address:E})=>f.isValid(m,E)?m:b.error("string.domain")},email:{method(m={}){y.assertOptions(m,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),a(m.multiple===void 0||typeof m.multiple=="boolean","multiple option must be an boolean");const b=g.addressOptions(m),w=new RegExp(`\\s*[${m.separator?u(m.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:m},regex:w,address:b})},validate(m,b,{options:w},{regex:E,address:C}){const R=w.multiple?m.split(E):[m],M=[];for(const _ of R)c.isValid(_,C)||M.push(_);return M.length?b.error("string.email",{value:m,invalids:M}):m}},guid:{alias:"uuid",method(m={}){y.assertOptions(m,["version","separator"]);let b="";if(m.version){const C=[].concat(m.version);a(C.length>=1,"version must have at least 1 valid version specified");const R=new Set;for(let M=0;M<C.length;++M){const _=C[M];a(typeof _=="string","version at position "+M+" must be a string");const A=g.guidVersions[_.toLowerCase()];a(A,"version at position "+M+" must be one of "+Object.keys(g.guidVersions).join(", ")),a(!R.has(A),"version at position "+M+" must not be a duplicate"),b+=A,R.add(A)}}a(g.guidSeparators.has(m.separator),'separator must be one of true, false, "-", or ":"');const w=m.separator===void 0?"[:-]?":m.separator===!0?"[:-]":m.separator===!1?"[]?":`\\${m.separator}`,E=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${w})[0-9A-F]{4}\\2?[${b||"0-9A-F"}][0-9A-F]{3}\\2?[${b?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:m},regex:E})},validate(m,b,w,{regex:E}){const C=E.exec(m);return C?g.guidBrackets[C[1]]!==C[C.length-1]?b.error("string.guid"):m:b.error("string.guid")}},hex:{method(m={}){return y.assertOptions(m,["byteAligned","prefix"]),m={byteAligned:!1,prefix:!1,...m},a(typeof m.byteAligned=="boolean","byteAligned must be boolean"),a(typeof m.prefix=="boolean"||m.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:m}})},validate:(m,b,{options:w})=>(w.prefix==="optional"?g.hexRegex.withOptionalPrefix:w.prefix===!0?g.hexRegex.withPrefix:g.hexRegex.withoutPrefix).test(m)?w.byteAligned&&m.length%2!=0?b.error("string.hexAlign"):m:b.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(m,b)=>f.isValid(m,{minDomainSegments:1})||g.ipRegex.test(m)?m:b.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(m={}){y.assertOptions(m,["cidr","version"]);const{cidr:b,versions:w,regex:E}=l.regex(m),C=m.version?w:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:b,version:C}},regex:E})},validate:(m,b,{options:w},{regex:E})=>E.test(m)?m:w.version?b.error("string.ipVersion",{value:m,cidr:w.cidr,version:w.version}):b.error("string.ip",{value:m,cidr:w.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(m,{error:b})=>g.isoDate(m)?m:b("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(m,b)=>g.isoDurationRegex.test(m)?m:b.error("string.isoDuration")},length:{method(m,b){return g.length(this,"length",m,"=",b)},validate(m,b,{limit:w,encoding:E},{name:C,operator:R,args:M}){const _=!E&&m.length;return y.compare(_,w,R)?m:b.error("string."+C,{limit:M.limit,value:m,encoding:E})},args:[{name:"limit",ref:!0,assert:y.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(m,b){return g.length(this,"max",m,"<=",b)},args:["limit","encoding"]},min:{method(m,b){return g.length(this,"min",m,">=",b)},args:["limit","encoding"]},normalize:{method(m="NFC"){return a(g.normalizationForms.includes(m),"normalization form must be one of "+g.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:m}})},validate:(m,{error:b},{form:w})=>m===m.normalize(w)?m:b("string.normalize",{value:m,form:w}),convert:!0},pattern:{alias:"regex",method(m,b={}){a(m instanceof RegExp,"regex must be a RegExp"),a(!m.flags.includes("g")&&!m.flags.includes("y"),"regex should not use global or sticky mode"),typeof b=="string"&&(b={name:b}),y.assertOptions(b,["invert","name"]);const w=["string.pattern",b.invert?".invert":"",b.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:m,options:b},errorCode:w})},validate:(m,b,{regex:w,options:E},{errorCode:C})=>w.test(m)^E.invert?m:b.error(C,{name:E.name,regex:w,value:m}),args:["regex","options"],multi:!0},replace:{method(m,b){typeof m=="string"&&(m=new RegExp(u(m),"g")),a(m instanceof RegExp,"pattern must be a RegExp"),a(typeof b=="string","replacement must be a String");const w=this.clone();return w.$_terms.replacements||(w.$_terms.replacements=[]),w.$_terms.replacements.push({pattern:m,replacement:b}),w}},token:{method(){return this.$_addRule("token")},validate:(m,b)=>/^\w+$/.test(m)?m:b.error("string.token")},trim:{method(m=!0){return a(typeof m=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:m}})},validate:(m,b,{enabled:w})=>w&&m!==m.trim()?b.error("string.trim"):m,convert:!0},truncate:{method(m=!0){return a(typeof m=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",m)}},uppercase:{method(){return this.case("upper")}},uri:{method(m={}){y.assertOptions(m,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),m.domain&&y.assertOptions(m.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:b,scheme:w}=d.regex(m),E=m.domain?g.addressOptions(m.domain):null;return this.$_addRule({name:"uri",args:{options:m},regex:b,domain:E,scheme:w})},validate(m,b,{options:w},{regex:E,domain:C,scheme:R}){if(["http:/","https:/"].includes(m))return b.error("string.uri");let M=E.exec(m);if(!M&&b.prefs.convert&&w.encodeUri){const _=encodeURI(m);M=E.exec(_),M&&(m=_)}if(M){const _=M[1]||M[2];return!C||w.allowRelative&&!_||f.isValid(_,C)?m:b.error("string.domain",{value:_})}return w.relativeOnly?b.error("string.uriRelativeOnly"):w.scheme?b.error("string.uriCustomScheme",{scheme:R,value:m}):b.error("string.uri")}}},manifest:{build(m,b){if(b.replacements)for(const{pattern:w,replacement:E}of b.replacements)m=m.replace(w,E);return m}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),g.addressOptions=function(m){if(!m)return g.tlds||m;if(a(m.minDomainSegments===void 0||Number.isSafeInteger(m.minDomainSegments)&&m.minDomainSegments>0,"minDomainSegments must be a positive integer"),a(m.maxDomainSegments===void 0||Number.isSafeInteger(m.maxDomainSegments)&&m.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),m.tlds===!1)return m;if(m.tlds===!0||m.tlds===void 0)return a(g.tlds,"Built-in TLD list disabled"),Object.assign({},m,g.tlds);a(typeof m.tlds=="object","tlds must be true, false, or an object");const b=m.tlds.deny;if(b)return Array.isArray(b)&&(m=Object.assign({},m,{tlds:{deny:new Set(b)}})),a(m.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),a(!m.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),g.validateTlds(m.tlds.deny,"tlds.deny"),m;const w=m.tlds.allow;return w?w===!0?(a(g.tlds,"Built-in TLD list disabled"),Object.assign({},m,g.tlds)):(Array.isArray(w)&&(m=Object.assign({},m,{tlds:{allow:new Set(w)}})),a(m.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),g.validateTlds(m.tlds.allow,"tlds.allow"),m):m},g.validateTlds=function(m,b){for(const w of m)a(f.isValid(w,{minDomainSegments:1,maxDomainSegments:1}),`${b} must contain valid top level domain names`)},g.isoDate=function(m){if(!y.isIsoDate(m))return null;/.*T.*[+-]\d\d$/.test(m)&&(m+="00");const b=new Date(m);return isNaN(b.getTime())?null:b.toISOString()},g.length=function(m,b,w,E,C){return a(!C||!1,"Invalid encoding:",C),m.$_addRule({name:b,method:"length",args:{limit:w,encoding:C},operator:E})}},8826:(s,i,o)=>{const a=o(375),f=o(8068),c={};c.Map=class extends Map{slice(){return new c.Map(this)}},s.exports=f.extend({type:"symbol",terms:{map:{init:new c.Map}},coerce:{method(l,{schema:u,error:p}){const d=u.$_terms.map.get(l);return d&&(l=d),u._flags.only&&typeof l!="symbol"?{value:l,errors:p("symbol.map",{map:u.$_terms.map})}:{value:l}}},validate(l,{error:u}){if(typeof l!="symbol")return{value:l,errors:u("symbol.base")}},rules:{map:{method(l){l&&!l[Symbol.iterator]&&typeof l=="object"&&(l=Object.entries(l)),a(l&&l[Symbol.iterator],"Iterable must be an iterable or object");const u=this.clone(),p=[];for(const d of l){a(d&&d[Symbol.iterator],"Entry must be an iterable");const[h,y]=d;a(typeof h!="object"&&typeof h!="function"&&typeof h!="symbol","Key must not be of type object, function, or Symbol"),a(typeof y=="symbol","Value must be a Symbol"),u.$_terms.map.set(h,y),p.push(y)}return u.valid(...p)}}},manifest:{build:(l,u)=>(u.map&&(l=l.map(u.map)),l)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(s,i,o)=>{const a=o(375),f=o(8571),c=o(738),l=o(9621),u=o(8160),p=o(6354),d=o(493),h={result:Symbol("result")};i.entry=function(y,g,m){let b=u.defaults;m&&(a(m.warnings===void 0,"Cannot override warnings preference in synchronous validation"),a(m.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),b=u.preferences(u.defaults,m));const w=h.entry(y,g,b);a(!w.mainstay.externals.length,"Schema with external rules must use validateAsync()");const E={value:w.value};return w.error&&(E.error=w.error),w.mainstay.warnings.length&&(E.warning=p.details(w.mainstay.warnings)),w.mainstay.debug&&(E.debug=w.mainstay.debug),w.mainstay.artifacts&&(E.artifacts=w.mainstay.artifacts),E},i.entryAsync=async function(y,g,m){let b=u.defaults;m&&(b=u.preferences(u.defaults,m));const w=h.entry(y,g,b),E=w.mainstay;if(w.error)throw E.debug&&(w.error.debug=E.debug),w.error;if(E.externals.length){let R=w.value;const M=[];for(const _ of E.externals){const A=_.state.path,I=_.schema.type==="link"?E.links.get(_.schema):null;let P,v,S=R;const T=A.length?[R]:[],N=A.length?l(y,A):y;if(A.length){P=A[A.length-1];let D=R;for(const O of A.slice(0,-1))D=D[O],T.unshift(D);v=T[0],S=v[P]}try{const D=(L,B)=>(I||_.schema).$_createError(L,S,B,_.state,b),O=await _.method(S,{schema:_.schema,linked:I,state:_.state,prefs:m,original:N,error:D,errorsArray:h.errorsArray,warn:(L,B)=>E.warnings.push((I||_.schema).$_createError(L,S,B,_.state,b)),message:(L,B)=>(I||_.schema).$_createError("external",S,B,_.state,b,{messages:L})});if(O===void 0||O===S)continue;if(O instanceof p.Report){if(E.tracer.log(_.schema,_.state,"rule","external","error"),M.push(O),b.abortEarly)break;continue}if(Array.isArray(O)&&O[u.symbols.errors]){if(E.tracer.log(_.schema,_.state,"rule","external","error"),M.push(...O),b.abortEarly)break;continue}v?(E.tracer.value(_.state,"rule",S,O,"external"),v[P]=O):(E.tracer.value(_.state,"rule",R,O,"external"),R=O)}catch(D){throw b.errors.label&&(D.message+=` (${_.label})`),D}}if(w.value=R,M.length)throw w.error=p.process(M,y,b),E.debug&&(w.error.debug=E.debug),w.error}if(!b.warnings&&!b.debug&&!b.artifacts)return w.value;const C={value:w.value};return E.warnings.length&&(C.warning=p.details(E.warnings)),E.debug&&(C.debug=E.debug),E.artifacts&&(C.artifacts=E.artifacts),C},h.Mainstay=class{constructor(y,g,m){this.externals=[],this.warnings=[],this.tracer=y,this.debug=g,this.links=m,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const y=this._snapshots.pop();this.externals=y.externals,this.warnings=y.warnings}commit(){this._snapshots.pop()}},h.entry=function(y,g,m){const{tracer:b,cleanup:w}=h.tracer(g,m),E=m.debug?[]:null,C=g._ids._schemaChain?new Map:null,R=new h.Mainstay(b,E,C),M=g._ids._schemaChain?[{schema:g}]:null,_=new d([],[],{mainstay:R,schemas:M}),A=i.validate(y,g,_,m);w&&g.$_root.untrace();const I=p.process(A.errors,y,m);return{value:A.value,error:I,mainstay:R}},h.tracer=function(y,g){return y.$_root._tracer?{tracer:y.$_root._tracer._register(y)}:g.debug?(a(y.$_root.trace,"Debug mode not supported"),{tracer:y.$_root.trace()._register(y),cleanup:!0}):{tracer:h.ignore}},i.validate=function(y,g,m,b,w={}){if(g.$_terms.whens&&(g=g._generate(y,m,b).schema),g._preferences&&(b=h.prefs(g,b)),g._cache&&b.cache){const I=g._cache.get(y);if(m.mainstay.tracer.debug(m,"validate","cached",!!I),I)return I}const E=(I,P,v)=>g.$_createError(I,y,P,v||m,b),C={original:y,prefs:b,schema:g,state:m,error:E,errorsArray:h.errorsArray,warn:(I,P,v)=>m.mainstay.warnings.push(E(I,P,v)),message:(I,P)=>g.$_createError("custom",y,P,m,b,{messages:I})};m.mainstay.tracer.entry(g,m);const R=g._definition;if(R.prepare&&y!==void 0&&b.convert){const I=R.prepare(y,C);if(I){if(m.mainstay.tracer.value(m,"prepare",y,I.value),I.errors)return h.finalize(I.value,[].concat(I.errors),C);y=I.value}}if(R.coerce&&y!==void 0&&b.convert&&(!R.coerce.from||R.coerce.from.includes(typeof y))){const I=R.coerce.method(y,C);if(I){if(m.mainstay.tracer.value(m,"coerced",y,I.value),I.errors)return h.finalize(I.value,[].concat(I.errors),C);y=I.value}}const M=g._flags.empty;M&&M.$_match(h.trim(y,g),m.nest(M),u.defaults)&&(m.mainstay.tracer.value(m,"empty",y,void 0),y=void 0);const _=w.presence||g._flags.presence||(g._flags._endedSwitch?null:b.presence);if(y===void 0){if(_==="forbidden")return h.finalize(y,null,C);if(_==="required")return h.finalize(y,[g.$_createError("any.required",y,null,m,b)],C);if(_==="optional"){if(g._flags.default!==u.symbols.deepDefault)return h.finalize(y,null,C);m.mainstay.tracer.value(m,"default",y,{}),y={}}}else if(_==="forbidden")return h.finalize(y,[g.$_createError("any.unknown",y,null,m,b)],C);const A=[];if(g._valids){const I=g._valids.get(y,m,b,g._flags.insensitive);if(I)return b.convert&&(m.mainstay.tracer.value(m,"valids",y,I.value),y=I.value),m.mainstay.tracer.filter(g,m,"valid",I),h.finalize(y,null,C);if(g._flags.only){const P=g.$_createError("any.only",y,{valids:g._valids.values({display:!0})},m,b);if(b.abortEarly)return h.finalize(y,[P],C);A.push(P)}}if(g._invalids){const I=g._invalids.get(y,m,b,g._flags.insensitive);if(I){m.mainstay.tracer.filter(g,m,"invalid",I);const P=g.$_createError("any.invalid",y,{invalids:g._invalids.values({display:!0})},m,b);if(b.abortEarly)return h.finalize(y,[P],C);A.push(P)}}if(R.validate){const I=R.validate(y,C);if(I&&(m.mainstay.tracer.value(m,"base",y,I.value),y=I.value,I.errors)){if(!Array.isArray(I.errors))return A.push(I.errors),h.finalize(y,A,C);if(I.errors.length)return A.push(...I.errors),h.finalize(y,A,C)}}return g._rules.length?h.rules(y,A,C):h.finalize(y,A,C)},h.rules=function(y,g,m){const{schema:b,state:w,prefs:E}=m;for(const C of b._rules){const R=b._definition.rules[C.method];if(R.convert&&E.convert){w.mainstay.tracer.log(b,w,"rule",C.name,"full");continue}let M,_=C.args;if(C._resolve.length){_=Object.assign({},_);for(const I of C._resolve){const P=R.argsByName.get(I),v=_[I].resolve(y,w,E),S=P.normalize?P.normalize(v):v,T=u.validateArg(S,null,P);if(T){M=b.$_createError("any.ref",v,{arg:I,ref:_[I],reason:T},w,E);break}_[I]=S}}M=M||R.validate(y,m,_,C);const A=h.rule(M,C);if(A.errors){if(w.mainstay.tracer.log(b,w,"rule",C.name,"error"),C.warn){w.mainstay.warnings.push(...A.errors);continue}if(E.abortEarly)return h.finalize(y,A.errors,m);g.push(...A.errors)}else w.mainstay.tracer.log(b,w,"rule",C.name,"pass"),w.mainstay.tracer.value(w,"rule",y,A.value,C.name),y=A.value}return h.finalize(y,g,m)},h.rule=function(y,g){return y instanceof p.Report?(h.error(y,g),{errors:[y],value:null}):Array.isArray(y)&&y[u.symbols.errors]?(y.forEach(m=>h.error(m,g)),{errors:y,value:null}):{errors:null,value:y}},h.error=function(y,g){return g.message&&y._setTemplate(g.message),y},h.finalize=function(y,g,m){g=g||[];const{schema:b,state:w,prefs:E}=m;if(g.length){const R=h.default("failover",void 0,g,m);R!==void 0&&(w.mainstay.tracer.value(w,"failover",y,R),y=R,g=[])}if(g.length&&b._flags.error)if(typeof b._flags.error=="function"){g=b._flags.error(g),Array.isArray(g)||(g=[g]);for(const R of g)a(R instanceof Error||R instanceof p.Report,"error() must return an Error object")}else g=[b._flags.error];if(y===void 0){const R=h.default("default",y,g,m);w.mainstay.tracer.value(w,"default",y,R),y=R}if(b._flags.cast&&y!==void 0){const R=b._definition.cast[b._flags.cast];if(R.from(y)){const M=R.to(y,m);w.mainstay.tracer.value(w,"cast",y,M,b._flags.cast),y=M}}if(b.$_terms.externals&&E.externals&&E._externals!==!1)for(const{method:R}of b.$_terms.externals)w.mainstay.externals.push({method:R,schema:b,state:w,label:p.label(b._flags,w,E)});const C={value:y,errors:g.length?g:null};return b._flags.result&&(C.value=b._flags.result==="strip"?void 0:m.original,w.mainstay.tracer.value(w,b._flags.result,y,C.value),w.shadow(y,b._flags.result)),b._cache&&E.cache!==!1&&!b._refs.length&&b._cache.set(m.original,C),y===void 0||C.errors||b._flags.artifact===void 0||(w.mainstay.artifacts=w.mainstay.artifacts||new Map,w.mainstay.artifacts.has(b._flags.artifact)||w.mainstay.artifacts.set(b._flags.artifact,[]),w.mainstay.artifacts.get(b._flags.artifact).push(w.path)),C},h.prefs=function(y,g){const m=g===u.defaults;return m&&y._preferences[u.symbols.prefs]?y._preferences[u.symbols.prefs]:(g=u.preferences(g,y._preferences),m&&(y._preferences[u.symbols.prefs]=g),g)},h.default=function(y,g,m,b){const{schema:w,state:E,prefs:C}=b,R=w._flags[y];if(C.noDefaults||R===void 0)return g;if(E.mainstay.tracer.log(w,E,"rule",y,"full"),!R)return R;if(typeof R=="function"){const M=R.length?[f(E.ancestors[0]),b]:[];try{return R(...M)}catch(_){return void m.push(w.$_createError(`any.${y}`,null,{error:_},E,C))}}return typeof R!="object"?R:R[u.symbols.literal]?R.literal:u.isResolvable(R)?R.resolve(g,E,C):f(R)},h.trim=function(y,g){if(typeof y!="string")return y;const m=g.$_getRule("trim");return m&&m.args.enabled?y.trim():y},h.ignore={active:!1,debug:c,entry:c,filter:c,log:c,resolve:c,value:c},h.errorsArray=function(){const y=[];return y[u.symbols.errors]=!0,y}},2036:(s,i,o)=>{const a=o(375),f=o(9474),c=o(8160),l={};s.exports=l.Values=class{constructor(u,p){this._values=new Set(u),this._refs=new Set(p),this._lowercase=l.lowercases(u),this._override=!1}get length(){return this._values.size+this._refs.size}add(u,p){c.isResolvable(u)?this._refs.has(u)||(this._refs.add(u),p&&p.register(u)):this.has(u,null,null,!1)||(this._values.add(u),typeof u=="string"&&this._lowercase.set(u.toLowerCase(),u))}static merge(u,p,d){if(u=u||new l.Values,p){if(p._override)return p.clone();for(const h of[...p._values,...p._refs])u.add(h)}if(d)for(const h of[...d._values,...d._refs])u.remove(h);return u.length?u:null}remove(u){c.isResolvable(u)?this._refs.delete(u):(this._values.delete(u),typeof u=="string"&&this._lowercase.delete(u.toLowerCase()))}has(u,p,d,h){return!!this.get(u,p,d,h)}get(u,p,d,h){if(!this.length)return!1;if(this._values.has(u))return{value:u};if(typeof u=="string"&&u&&h){const y=this._lowercase.get(u.toLowerCase());if(y)return{value:y}}if(!this._refs.size&&typeof u!="object")return!1;if(typeof u=="object"){for(const y of this._values)if(f(y,u))return{value:y}}if(p)for(const y of this._refs){const g=y.resolve(u,p,d,null,{in:!0});if(g===void 0)continue;const m=y.in&&typeof g=="object"?Array.isArray(g)?g:Object.keys(g):[g];for(const b of m)if(typeof b==typeof u){if(h&&u&&typeof u=="string"){if(b.toLowerCase()===u.toLowerCase())return{value:b,ref:y}}else if(f(b,u))return{value:b,ref:y}}}return!1}override(){this._override=!0}values(u){if(u&&u.display){const p=[];for(const d of[...this._values,...this._refs])d!==void 0&&p.push(d);return p}return Array.from([...this._values,...this._refs])}clone(){const u=new l.Values(this._values,this._refs);return u._override=this._override,u}concat(u){a(!u._override,"Cannot concat override set of values");const p=new l.Values([...this._values,...u._values],[...this._refs,...u._refs]);return p._override=this._override,p}describe(){const u=[];this._override&&u.push({override:!0});for(const p of this._values.values())u.push(p&&typeof p=="object"?{value:p}:p);for(const p of this._refs.values())u.push(p.describe());return u}},l.Values.prototype[c.symbols.values]=!0,l.Values.prototype.slice=l.Values.prototype.clone,l.lowercases=function(u){const p=new Map;if(u)for(const d of u)typeof d=="string"&&p.set(d.toLowerCase(),d);return p}},978:(s,i,o)=>{const a=o(375),f=o(8571),c=o(1687),l=o(9621),u={};s.exports=function(p,d,h={}){if(a(p&&typeof p=="object","Invalid defaults value: must be an object"),a(!d||d===!0||typeof d=="object","Invalid source value: must be true, falsy or an object"),a(typeof h=="object","Invalid options: must be an object"),!d)return null;if(h.shallow)return u.applyToDefaultsWithShallow(p,d,h);const y=f(p);if(d===!0)return y;const g=h.nullOverride!==void 0&&h.nullOverride;return c(y,d,{nullOverride:g,mergeArrays:!1})},u.applyToDefaultsWithShallow=function(p,d,h){const y=h.shallow;a(Array.isArray(y),"Invalid keys");const g=new Map,m=d===!0?null:new Set;for(let E of y){E=Array.isArray(E)?E:E.split(".");const C=l(p,E);C&&typeof C=="object"?g.set(C,m&&l(d,E)||C):m&&m.add(E)}const b=f(p,{},g);if(!m)return b;for(const E of m)u.reachCopy(b,d,E);const w=h.nullOverride!==void 0&&h.nullOverride;return c(b,d,{nullOverride:w,mergeArrays:!1})},u.reachCopy=function(p,d,h){for(const m of h){if(!(m in d))return;const b=d[m];if(typeof b!="object"||b===null)return;d=b}const y=d;let g=p;for(let m=0;m<h.length-1;++m){const b=h[m];typeof g[b]!="object"&&(g[b]={}),g=g[b]}g[h[h.length-1]]=y}},375:(s,i,o)=>{const a=o(7916);s.exports=function(f,...c){if(!f)throw c.length===1&&c[0]instanceof Error?c[0]:new a(c)}},8571:(s,i,o)=>{const a=o(9621),f=o(4277),c=o(7043),l={needsProtoHack:new Set([f.set,f.map,f.weakSet,f.weakMap])};s.exports=l.clone=function(u,p={},d=null){if(typeof u!="object"||u===null)return u;let h=l.clone,y=d;if(p.shallow){if(p.shallow!==!0)return l.cloneWithShallow(u,p);h=w=>w}else if(y){const w=y.get(u);if(w)return w}else y=new Map;const g=f.getInternalProto(u);if(g===f.buffer)return!1;if(g===f.date)return new Date(u.getTime());if(g===f.regex)return new RegExp(u);const m=l.base(u,g,p);if(m===u)return u;if(y&&y.set(u,m),g===f.set)for(const w of u)m.add(h(w,p,y));else if(g===f.map)for(const[w,E]of u)m.set(w,h(E,p,y));const b=c.keys(u,p);for(const w of b){if(w==="__proto__")continue;if(g===f.array&&w==="length"){m.length=u.length;continue}const E=Object.getOwnPropertyDescriptor(u,w);E?E.get||E.set?Object.defineProperty(m,w,E):E.enumerable?m[w]=h(u[w],p,y):Object.defineProperty(m,w,{enumerable:!1,writable:!0,configurable:!0,value:h(u[w],p,y)}):Object.defineProperty(m,w,{enumerable:!0,writable:!0,configurable:!0,value:h(u[w],p,y)})}return m},l.cloneWithShallow=function(u,p){const d=p.shallow;(p=Object.assign({},p)).shallow=!1;const h=new Map;for(const y of d){const g=a(u,y);typeof g!="object"&&typeof g!="function"||h.set(g,g)}return l.clone(u,p,h)},l.base=function(u,p,d){if(d.prototype===!1)return l.needsProtoHack.has(p)?new p.constructor:p===f.array?[]:{};const h=Object.getPrototypeOf(u);if(h&&h.isImmutable)return u;if(p===f.array){const y=[];return h!==p&&Object.setPrototypeOf(y,h),y}if(l.needsProtoHack.has(p)){const y=new h.constructor;return h!==p&&Object.setPrototypeOf(y,h),y}return Object.create(h)}},9474:(s,i,o)=>{const a=o(4277),f={mismatched:null};s.exports=function(c,l,u){return u=Object.assign({prototype:!0},u),!!f.isDeepEqual(c,l,u,[])},f.isDeepEqual=function(c,l,u,p){if(c===l)return c!==0||1/c==1/l;const d=typeof c;if(d!==typeof l||c===null||l===null)return!1;if(d==="function"){if(!u.deepFunction||c.toString()!==l.toString())return!1}else if(d!=="object")return c!=c&&l!=l;const h=f.getSharedType(c,l,!!u.prototype);switch(h){case a.buffer:return!1;case a.promise:return c===l;case a.regex:return c.toString()===l.toString();case f.mismatched:return!1}for(let y=p.length-1;y>=0;--y)if(p[y].isSame(c,l))return!0;p.push(new f.SeenEntry(c,l));try{return!!f.isDeepEqualObj(h,c,l,u,p)}finally{p.pop()}},f.getSharedType=function(c,l,u){if(u)return Object.getPrototypeOf(c)!==Object.getPrototypeOf(l)?f.mismatched:a.getInternalProto(c);const p=a.getInternalProto(c);return p!==a.getInternalProto(l)?f.mismatched:p},f.valueOf=function(c){const l=c.valueOf;if(l===void 0)return c;try{return l.call(c)}catch(u){return u}},f.hasOwnEnumerableProperty=function(c,l){return Object.prototype.propertyIsEnumerable.call(c,l)},f.isSetSimpleEqual=function(c,l){for(const u of Set.prototype.values.call(c))if(!Set.prototype.has.call(l,u))return!1;return!0},f.isDeepEqualObj=function(c,l,u,p,d){const{isDeepEqual:h,valueOf:y,hasOwnEnumerableProperty:g}=f,{keys:m,getOwnPropertySymbols:b}=Object;if(c===a.array){if(!p.part){if(l.length!==u.length)return!1;for(let M=0;M<l.length;++M)if(!h(l[M],u[M],p,d))return!1;return!0}for(const M of l)for(const _ of u)if(h(M,_,p,d))return!0}else if(c===a.set){if(l.size!==u.size)return!1;if(!f.isSetSimpleEqual(l,u)){const M=new Set(Set.prototype.values.call(u));for(const _ of Set.prototype.values.call(l)){if(M.delete(_))continue;let A=!1;for(const I of M)if(h(_,I,p,d)){M.delete(I),A=!0;break}if(!A)return!1}}}else if(c===a.map){if(l.size!==u.size)return!1;for(const[M,_]of Map.prototype.entries.call(l))if(_===void 0&&!Map.prototype.has.call(u,M)||!h(_,Map.prototype.get.call(u,M),p,d))return!1}else if(c===a.error&&(l.name!==u.name||l.message!==u.message))return!1;const w=y(l),E=y(u);if((l!==w||u!==E)&&!h(w,E,p,d))return!1;const C=m(l);if(!p.part&&C.length!==m(u).length&&!p.skip)return!1;let R=0;for(const M of C)if(p.skip&&p.skip.includes(M))u[M]===void 0&&++R;else if(!g(u,M)||!h(l[M],u[M],p,d))return!1;if(!p.part&&C.length-R!==m(u).length)return!1;if(p.symbols!==!1){const M=b(l),_=new Set(b(u));for(const A of M){if(!p.skip||!p.skip.includes(A)){if(g(l,A)){if(!g(u,A)||!h(l[A],u[A],p,d))return!1}else if(g(u,A))return!1}_.delete(A)}for(const A of _)if(g(u,A))return!1}return!0},f.SeenEntry=class{constructor(c,l){this.obj=c,this.ref=l}isSame(c,l){return this.obj===c&&this.ref===l}}},7916:(s,i,o)=>{const a=o(8761);s.exports=class extends Error{constructor(f){super(f.filter(c=>c!=="").map(c=>typeof c=="string"?c:c instanceof Error?c.message:a(c)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.assert)}}},5277:s=>{const i={};s.exports=function(o){if(!o)return"";let a="";for(let f=0;f<o.length;++f){const c=o.charCodeAt(f);i.isSafe(c)?a+=o[f]:a+=i.escapeHtmlChar(c)}return a},i.escapeHtmlChar=function(o){return i.namedHtml.get(o)||(o>=256?"&#"+o+";":`&#x${o.toString(16).padStart(2,"0")};`)},i.isSafe=function(o){return i.safeCharCodes.has(o)},i.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),i.safeCharCodes=function(){const o=new Set;for(let a=32;a<123;++a)(a>=97||a>=65&&a<=90||a>=48&&a<=57||a===32||a===46||a===44||a===45||a===58||a===95)&&o.add(a);return o}()},6064:s=>{s.exports=function(i){return i.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:s=>{s.exports=function(){}},1687:(s,i,o)=>{const a=o(375),f=o(8571),c=o(7043),l={};s.exports=l.merge=function(u,p,d){if(a(u&&typeof u=="object","Invalid target value: must be an object"),a(p==null||typeof p=="object","Invalid source value: must be null, undefined, or an object"),!p)return u;if(d=Object.assign({nullOverride:!0,mergeArrays:!0},d),Array.isArray(p)){a(Array.isArray(u),"Cannot merge array onto an object"),d.mergeArrays||(u.length=0);for(let y=0;y<p.length;++y)u.push(f(p[y],{symbols:d.symbols}));return u}const h=c.keys(p,d);for(let y=0;y<h.length;++y){const g=h[y];if(g==="__proto__"||!Object.prototype.propertyIsEnumerable.call(p,g))continue;const m=p[g];if(m&&typeof m=="object"){if(u[g]===m)continue;!u[g]||typeof u[g]!="object"||Array.isArray(u[g])!==Array.isArray(m)||m instanceof Date||m instanceof RegExp?u[g]=f(m,{symbols:d.symbols}):l.merge(u[g],m,d)}else(m!=null||d.nullOverride)&&(u[g]=m)}return u}},9621:(s,i,o)=>{const a=o(375),f={};s.exports=function(c,l,u){if(l===!1||l==null)return c;typeof(u=u||{})=="string"&&(u={separator:u});const p=Array.isArray(l);a(!p||!u.separator,"Separator option is not valid for array-based chain");const d=p?l:l.split(u.separator||".");let h=c;for(let y=0;y<d.length;++y){let g=d[y];const m=u.iterables&&f.iterables(h);if(Array.isArray(h)||m==="set"){const b=Number(g);Number.isInteger(b)&&(g=b<0?h.length+b:b)}if(!h||typeof h=="function"&&u.functions===!1||!m&&h[g]===void 0){a(!u.strict||y+1===d.length,"Missing segment",g,"in reach path ",l),a(typeof h=="object"||u.functions===!0||typeof h!="function","Invalid segment",g,"in reach path ",l),h=u.default;break}h=m?m==="set"?[...h][g]:h.get(g):h[g]}return h},f.iterables=function(c){return c instanceof Set?"set":c instanceof Map?"map":void 0}},8761:s=>{s.exports=function(...i){try{return JSON.stringify(...i)}catch(o){return"[Cannot display object: "+o.message+"]"}}},4277:(s,i)=>{const o={};i=s.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},o.typeMap=new Map([["[object Error]",i.error],["[object Map]",i.map],["[object Promise]",i.promise],["[object Set]",i.set],["[object WeakMap]",i.weakMap],["[object WeakSet]",i.weakSet]]),i.getInternalProto=function(a){if(Array.isArray(a))return i.array;if(a instanceof Date)return i.date;if(a instanceof RegExp)return i.regex;if(a instanceof Error)return i.error;const f=Object.prototype.toString.call(a);return o.typeMap.get(f)||i.generic}},7043:(s,i)=>{i.keys=function(o,a={}){return a.symbols!==!1?Reflect.ownKeys(o):Object.getOwnPropertyNames(o)}},3652:(s,i,o)=>{const a=o(375),f={};i.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(c,l){const u=[].concat((l=l||{}).before||[]),p=[].concat(l.after||[]),d=l.group||"?",h=l.sort||0;a(!u.includes(d),`Item cannot come before itself: ${d}`),a(!u.includes("?"),"Item cannot come before unassociated items"),a(!p.includes(d),`Item cannot come after itself: ${d}`),a(!p.includes("?"),"Item cannot come after unassociated items"),Array.isArray(c)||(c=[c]);for(const y of c){const g={seq:this._items.length,sort:h,before:u,after:p,group:d,node:y};this._items.push(g)}if(!l.manual){const y=this._sort();a(y,"item",d!=="?"?`added into group ${d}`:"","created a dependencies error")}return this.nodes}merge(c){Array.isArray(c)||(c=[c]);for(const u of c)if(u)for(const p of u._items)this._items.push(Object.assign({},p));this._items.sort(f.mergeSort);for(let u=0;u<this._items.length;++u)this._items[u].seq=u;const l=this._sort();return a(l,"merge created a dependencies error"),this.nodes}sort(){const c=this._sort();return a(c,"sort created a dependencies error"),this.nodes}_sort(){const c={},l=Object.create(null),u=Object.create(null);for(const g of this._items){const m=g.seq,b=g.group;u[b]=u[b]||[],u[b].push(m),c[m]=g.before;for(const w of g.after)l[w]=l[w]||[],l[w].push(m)}for(const g in c){const m=[];for(const b in c[g]){const w=c[g][b];u[w]=u[w]||[],m.push(...u[w])}c[g]=m}for(const g in l)if(u[g])for(const m of u[g])c[m].push(...l[g]);const p={};for(const g in c){const m=c[g];for(const b of m)p[b]=p[b]||[],p[b].push(g)}const d={},h=[];for(let g=0;g<this._items.length;++g){let m=g;if(p[g]){m=null;for(let b=0;b<this._items.length;++b){if(d[b]===!0)continue;p[b]||(p[b]=[]);const w=p[b].length;let E=0;for(let C=0;C<w;++C)d[p[b][C]]&&++E;if(E===w){m=b;break}}}m!==null&&(d[m]=!0,h.push(m))}if(h.length!==this._items.length)return!1;const y={};for(const g of this._items)y[g.seq]=g;this._items=[],this.nodes=[];for(const g of h){const m=y[g];this.nodes.push(m.node),this._items.push(m)}return!0}},f.mergeSort=(c,l)=>c.sort===l.sort?0:c.sort<l.sort?-1:1},5380:(s,i,o)=>{const a=o(443),f=o(2178),c={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:a.URL||URL};i.analyze=function(l,u={}){if(!l)return f.code("DOMAIN_NON_EMPTY_STRING");if(typeof l!="string")throw new Error("Invalid input: domain must be a string");if(l.length>256)return f.code("DOMAIN_TOO_LONG");if(c.nonAsciiRx.test(l)){if(u.allowUnicode===!1)return f.code("DOMAIN_INVALID_UNICODE_CHARS");l=l.normalize("NFC")}if(c.domainControlRx.test(l))return f.code("DOMAIN_INVALID_CHARS");l=c.punycode(l),u.allowFullyQualified&&l[l.length-1]==="."&&(l=l.slice(0,-1));const p=u.minDomainSegments||c.minDomainSegments,d=l.split(".");if(d.length<p)return f.code("DOMAIN_SEGMENTS_COUNT");if(u.maxDomainSegments&&d.length>u.maxDomainSegments)return f.code("DOMAIN_SEGMENTS_COUNT_MAX");const h=u.tlds;if(h){const y=d[d.length-1].toLowerCase();if(h.deny&&h.deny.has(y)||h.allow&&!h.allow.has(y))return f.code("DOMAIN_FORBIDDEN_TLDS")}for(let y=0;y<d.length;++y){const g=d[y];if(!g.length)return f.code("DOMAIN_EMPTY_SEGMENT");if(g.length>63)return f.code("DOMAIN_LONG_SEGMENT");if(y<d.length-1){if(!c.domainSegmentRx.test(g))return f.code("DOMAIN_INVALID_CHARS")}else if(!c.tldSegmentRx.test(g))return f.code("DOMAIN_INVALID_TLDS_CHARS")}return null},i.isValid=function(l,u){return!i.analyze(l,u)},c.punycode=function(l){l.includes("%")&&(l=l.replace(/%/g,"%25"));try{return new c.URL(`http://${l}`).host}catch{return l}}},1745:(s,i,o)=>{const a=o(9848),f=o(5380),c=o(2178),l={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(a.TextEncoder||TextEncoder)};i.analyze=function(u,p){return l.email(u,p)},i.isValid=function(u,p){return!l.email(u,p)},l.email=function(u,p={}){if(typeof u!="string")throw new Error("Invalid input: email must be a string");if(!u)return c.code("EMPTY_STRING");const d=!l.nonAsciiRx.test(u);if(!d){if(p.allowUnicode===!1)return c.code("FORBIDDEN_UNICODE");u=u.normalize("NFC")}const h=u.split("@");if(h.length!==2)return h.length>2?c.code("MULTIPLE_AT_CHAR"):c.code("MISSING_AT_CHAR");const[y,g]=h;if(!y)return c.code("EMPTY_LOCAL");if(!p.ignoreLength){if(u.length>254)return c.code("ADDRESS_TOO_LONG");if(l.encoder.encode(y).length>64)return c.code("LOCAL_TOO_LONG")}return l.local(y,d)||f.analyze(g,p)},l.local=function(u,p){const d=u.split(".");for(const h of d){if(!h.length)return c.code("EMPTY_LOCAL_SEGMENT");if(p){if(!l.atextRx.test(h))return c.code("INVALID_LOCAL_CHARS")}else for(const y of h){if(l.atextRx.test(y))continue;const g=l.binary(y);if(!l.atomRx.test(g))return c.code("INVALID_LOCAL_CHARS")}}},l.binary=function(u){return Array.from(l.encoder.encode(u)).map(p=>String.fromCharCode(p)).join("")},l.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,l.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(s,i)=>{i.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},i.code=function(o){return{code:o,error:i.codes[o]}}},9959:(s,i,o)=>{const a=o(375),f=o(5752);i.regex=function(c={}){a(c.cidr===void 0||typeof c.cidr=="string","options.cidr must be a string");const l=c.cidr?c.cidr.toLowerCase():"optional";a(["required","optional","forbidden"].includes(l),"options.cidr must be one of required, optional, forbidden"),a(c.version===void 0||typeof c.version=="string"||Array.isArray(c.version),"options.version must be a string or an array of string");let u=c.version||["ipv4","ipv6","ipvfuture"];Array.isArray(u)||(u=[u]),a(u.length>=1,"options.version must have at least 1 version specified");for(let h=0;h<u.length;++h)a(typeof u[h]=="string","options.version must only contain strings"),u[h]=u[h].toLowerCase(),a(["ipv4","ipv6","ipvfuture"].includes(u[h]),"options.version contains unknown version "+u[h]+" - must be one of ipv4, ipv6, ipvfuture");u=Array.from(new Set(u));const p=`(?:${u.map(h=>{if(l==="forbidden")return f.ip[h];const y=`\\/${h==="ipv4"?f.ip.v4Cidr:f.ip.v6Cidr}`;return l==="required"?`${f.ip[h]}${y}`:`${f.ip[h]}(?:${y})?`}).join("|")})`,d=new RegExp(`^${p}$`);return{cidr:l,versions:u,regex:d,raw:p}}},5752:(s,i,o)=>{const a=o(375),f=o(6064),c={generate:function(){const l={},u="\\dA-Fa-f",p="["+u+"]",d="\\w-\\.~",h="!\\$&'\\(\\)\\*\\+,;=",y="%"+u,g=d+y+h+":@",m="["+g+"]",b="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";l.ipv4address="(?:"+b+"\\.){3}"+b;const w=p+"{1,4}",E="(?:"+w+":"+w+"|"+l.ipv4address+")",C="(?:"+w+":){6}"+E,R="::(?:"+w+":){5}"+E,M="(?:"+w+")?::(?:"+w+":){4}"+E,_="(?:(?:"+w+":){0,1}"+w+")?::(?:"+w+":){3}"+E,A="(?:(?:"+w+":){0,2}"+w+")?::(?:"+w+":){2}"+E,I="(?:(?:"+w+":){0,3}"+w+")?::"+w+":"+E,P="(?:(?:"+w+":){0,4}"+w+")?::"+E,v="(?:(?:"+w+":){0,5}"+w+")?::"+w,S="(?:(?:"+w+":){0,6}"+w+")?::";l.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",l.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",l.ipv6address="(?:"+C+"|"+R+"|"+M+"|"+_+"|"+A+"|"+I+"|"+P+"|"+v+"|"+S+")",l.ipvFuture="v"+p+"+\\.["+d+h+":]+",l.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",l.schemeRegex=new RegExp(l.scheme);const T="["+d+y+h+":]*",N="["+d+y+h+"]{1,255}",D="(?:\\[(?:"+l.ipv6address+"|"+l.ipvFuture+")\\]|"+l.ipv4address+"|"+N+")",O="(?:"+T+"@)?"+D+"(?::\\d*)?",L="(?:"+T+"@)?("+D+")(?::\\d*)?",B=m+"*",k=m+"+",q="(?:\\/"+B+")*",W="\\/(?:"+k+q+")?",re=k+q,ue="["+d+y+h+"@]+"+q,H="(?:\\/\\/\\/"+B+q+")";return l.hierPart="(?:(?:\\/\\/"+O+q+")|"+W+"|"+re+"|"+H+")",l.hierPartCapture="(?:(?:\\/\\/"+L+q+")|"+W+"|"+re+")",l.relativeRef="(?:(?:\\/\\/"+O+q+")|"+W+"|"+ue+"|)",l.relativeRefCapture="(?:(?:\\/\\/"+L+q+")|"+W+"|"+ue+"|)",l.query="["+g+"\\/\\?]*(?=#|$)",l.queryWithSquareBrackets="["+g+"\\[\\]\\/\\?]*(?=#|$)",l.fragment="["+g+"\\/\\?]*",l}};c.rfc3986=c.generate(),i.ip={v4Cidr:c.rfc3986.ipv4Cidr,v6Cidr:c.rfc3986.ipv6Cidr,ipv4:c.rfc3986.ipv4address,ipv6:c.rfc3986.ipv6address,ipvfuture:c.rfc3986.ipvFuture},c.createRegex=function(l){const u=c.rfc3986,p="(?:\\?"+(l.allowQuerySquareBrackets?u.queryWithSquareBrackets:u.query)+")?(?:#"+u.fragment+")?",d=l.domain?u.relativeRefCapture:u.relativeRef;if(l.relativeOnly)return c.wrap(d+p);let h="";if(l.scheme){a(l.scheme instanceof RegExp||typeof l.scheme=="string"||Array.isArray(l.scheme),"scheme must be a RegExp, String, or Array");const m=[].concat(l.scheme);a(m.length>=1,"scheme must have at least 1 scheme specified");const b=[];for(let w=0;w<m.length;++w){const E=m[w];a(E instanceof RegExp||typeof E=="string","scheme at position "+w+" must be a RegExp or String"),E instanceof RegExp?b.push(E.source.toString()):(a(u.schemeRegex.test(E),"scheme at position "+w+" must be a valid scheme"),b.push(f(E)))}h=b.join("|")}const y="(?:"+(h?"(?:"+h+")":u.scheme)+":"+(l.domain?u.hierPartCapture:u.hierPart)+")",g=l.allowRelative?"(?:"+y+"|"+d+")":y;return c.wrap(g+p,h)},c.wrap=function(l,u){return{raw:l=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${l}`,regex:new RegExp(`^${l}$`),scheme:u}},c.uriRegex=c.createRegex({}),i.regex=function(l={}){return l.scheme||l.allowRelative||l.relativeOnly||l.allowQuerySquareBrackets||l.domain?c.createRegex(l):c.uriRegex}},1447:(s,i)=>{const o={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};i.Parser=class{constructor(a,f={}){if(!f[o.settings]&&f.constants)for(const c in f.constants){const l=f.constants[c];if(l!==null&&!["boolean","number","string"].includes(typeof l))throw new Error(`Formula constant ${c} contains invalid ${typeof l} value type`)}this.settings=f[o.settings]?f:Object.assign({[o.settings]:!0,constants:{},functions:{}},f),this.single=null,this._parts=null,this._parse(a)}_parse(a){let f=[],c="",l=0,u=!1;const p=h=>{if(l)throw new Error("Formula missing closing parenthesis");const y=f.length?f[f.length-1]:null;if(u||c||h){if(y&&y.type==="reference"&&h===")")return y.type="function",y.value=this._subFormula(c,y.value),void(c="");if(h===")"){const g=new i.Parser(c,this.settings);f.push({type:"segment",value:g})}else if(u){if(u==="]")return f.push({type:"reference",value:c}),void(c="");f.push({type:"literal",value:c})}else if(o.operatorCharacters.includes(c))y&&y.type==="operator"&&o.operators.includes(y.value+c)?y.value+=c:f.push({type:"operator",value:c});else if(c.match(o.numberRx))f.push({type:"constant",value:parseFloat(c)});else if(this.settings.constants[c]!==void 0)f.push({type:"constant",value:this.settings.constants[c]});else{if(!c.match(o.tokenRx))throw new Error(`Formula contains invalid token: ${c}`);f.push({type:"reference",value:c})}c=""}};for(const h of a)u?h===u?(p(),u=!1):c+=h:l?h==="("?(c+=h,++l):h===")"?(--l,l?c+=h:p(h)):c+=h:h in o.literals?u=o.literals[h]:h==="("?(p(),++l):o.operatorCharacters.includes(h)?(p(),c=h,p()):h!==" "?c+=h:p();p(),f=f.map((h,y)=>h.type!=="operator"||h.value!=="-"||y&&f[y-1].type!=="operator"?h:{type:"operator",value:"n"});let d=!1;for(const h of f){if(h.type==="operator"){if(o.operatorsPrefix.includes(h.value))continue;if(!d)throw new Error("Formula contains an operator in invalid position");if(!o.operators.includes(h.value))throw new Error(`Formula contains an unknown operator ${h.value}`)}else if(d)throw new Error("Formula missing expected operator");d=!d}if(!d)throw new Error("Formula contains invalid trailing operator");f.length===1&&["reference","literal","constant"].includes(f[0].type)&&(this.single={type:f[0].type==="reference"?"reference":"value",value:f[0].value}),this._parts=f.map(h=>{if(h.type==="operator")return o.operatorsPrefix.includes(h.value)?h:h.value;if(h.type!=="reference")return h.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(h.value))throw new Error(`Formula contains invalid reference ${h.value}`);return this.settings.reference?this.settings.reference(h.value):o.reference(h.value)})}_subFormula(a,f){const c=this.settings.functions[f];if(typeof c!="function")throw new Error(`Formula contains unknown function ${f}`);let l=[];if(a){let u="",p=0,d=!1;const h=()=>{if(!u)throw new Error(`Formula contains function ${f} with invalid arguments ${a}`);l.push(u),u=""};for(let y=0;y<a.length;++y){const g=a[y];d?(u+=g,g===d&&(d=!1)):g in o.literals&&!p?(u+=g,d=o.literals[g]):g!==","||p?(u+=g,g==="("?++p:g===")"&&--p):h()}h()}return l=l.map(u=>new i.Parser(u,this.settings)),function(u){const p=[];for(const d of l)p.push(d.evaluate(u));return c.call(u,...p)}}evaluate(a){const f=this._parts.slice();for(let c=f.length-2;c>=0;--c){const l=f[c];if(l&&l.type==="operator"){const u=f[c+1];f.splice(c+1,1);const p=o.evaluate(u,a);f[c]=o.single(l.value,p)}}return o.operatorsOrder.forEach(c=>{for(let l=1;l<f.length-1;)if(c.includes(f[l])){const u=f[l],p=o.evaluate(f[l-1],a),d=o.evaluate(f[l+1],a);f.splice(l,2);const h=o.calculate(u,p,d);f[l-1]=h===0?0:h}else l+=2}),o.evaluate(f[0],a)}},i.Parser.prototype[o.symbol]=!0,o.reference=function(a){return function(f){return f&&f[a]!==void 0?f[a]:null}},o.evaluate=function(a,f){return a===null?null:typeof a=="function"?a(f):a[o.symbol]?a.evaluate(f):a},o.single=function(a,f){if(a==="!")return!f;const c=-f;return c===0?0:c},o.calculate=function(a,f,c){if(a==="??")return o.exists(f)?f:c;if(typeof f=="string"||typeof c=="string"){if(a==="+")return(f=o.exists(f)?f:"")+(o.exists(c)?c:"")}else switch(a){case"^":return Math.pow(f,c);case"*":return f*c;case"/":return f/c;case"%":return f%c;case"+":return f+c;case"-":return f-c}switch(a){case"<":return f<c;case"<=":return f<=c;case">":return f>c;case">=":return f>=c;case"==":return f===c;case"!=":return f!==c;case"&&":return f&&c;case"||":return f||c}return null},o.exists=function(a){return a!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:s=>{s.exports=JSON.parse('{"version":"17.13.3"}')}},n={},function s(i){var o=n[i];if(o!==void 0)return o.exports;var a=n[i]={exports:{}};return r[i](a,a.exports,s),a.exports}(5107);var r,n})}(gp)),gp.exports}var C5;function $R(){if(C5)return uc;C5=1,Object.defineProperty(uc,"__esModule",{value:!0}),uc.validateMessageObj=void 0;const e=qR(),t=Ia(),r=Je(),n=d=>{const h=[];for(const y in d)typeof d[y]=="string"?h.push(d[y]):typeof d[y]=="object"&&h.push(...n(d[y]));return h},s=e.object({content:e.string().required().allow("")}),i=e.object({content:e.string().valid(...Object.values(n(t.CHAT.META))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),o=e.object({content:e.string().valid(...Object.values(n(t.CHAT.REACTION))).required(),reference:e.string().required()}),a=e.object({content:e.string().valid(...Object.values(n(t.CHAT.RECEIPT))).required(),reference:e.string().required()}),f=e.object({content:e.string().valid(...Object.values(n(t.CHAT.UA))).required(),info:e.object({affected:e.array().items(e.string()).required(),arbitrary:e.object().pattern(e.string(),e.any())}).required()}),c=e.object({content:e.string().valid(...Object.values(n(t.CHAT.INTENT)))}),l=e.object({content:e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()}).required(),reference:e.string().required()}),u=e.object({content:e.array().items(e.object({messageType:e.string().valid(...Object.values([r.MessageType.TEXT,r.MessageType.IMAGE,r.MessageType.AUDIO,r.MessageType.VIDEO,r.MessageType.FILE,r.MessageType.MEDIA_EMBED])).required(),messageObj:e.object({content:e.string().required()}).required()})).required()}),p=(d,h)=>{let y;switch(h){case r.MessageType.TEXT:case r.MessageType.IMAGE:case r.MessageType.VIDEO:case r.MessageType.AUDIO:case r.MessageType.FILE:case r.MessageType.MEDIA_EMBED:case r.MessageType.GIF:{y=s.validate(d).error;break}case r.MessageType.META:{y=i.validate(d).error;break}case r.MessageType.REACTION:{y=o.validate(d).error;break}case r.MessageType.RECEIPT:{y=a.validate(d).error;break}case r.MessageType.USER_ACTIVITY:{y=f.validate(d).error;break}case r.MessageType.INTENT:{y=c.validate(d).error;break}case r.MessageType.REPLY:{y=l.validate(d).error;break}case r.MessageType.COMPOSITE:{y=u.validate(d).error;break}default:throw new Error("Invalid MessageType")}if(y)throw new Error("Unable to parse this messageType. Please ensure 'messageObj' is properly defined.")};return uc.validateMessageObj=p,uc}var R5;function VR(){return R5||(R5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendCore=e.send=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Z9(),o=Mt(),a=$R(),f=Tt(),c=jl(),l=Xt(),u=Xn(),p=g=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.sendCore)(g,s.PGPHelper)});e.send=p;const d=(g,m)=>t.__awaiter(void 0,void 0,void 0,function*(){var b,w,E;try{const C=y(g),{messageType:R,messageObj:M,account:_,signer:A,pgpPrivateKey:I,env:P}=C;let{to:v}=C;yield h(C);const S=(0,s.getWallet)({account:_,signer:A}),T=yield(0,s.getConnectedUserV2Core)(S,I,P,m);let N=yield(0,r.convertToValidDID)(v,P);const D=(0,r.getAPIBaseUrls)(P),O=!(0,r.isValidPushCAIP)(v);let L=!1,B=null;if(O){const H={recipient:v,account:_,env:P},ae=yield u.getChatInfo(H);L=(w=(b=ae==null?void 0:ae.meta)===null||b===void 0?void 0:b.group)!==null&&w!==void 0?w:!1,B=L?yield(0,c.getGroupInfo)({chatId:v,env:P}):null,L||(v=((E=ae.participants)!==null&&E!==void 0?E:[]).find(te=>te!==(0,r.walletToPCAIP10)(_)),N=v)}let k;R===n.MessageType.REPLY||R===n.MessageType.COMPOSITE?k="MessageType Not Supported by this sdk version. Plz upgrade !!!":k=M.content;const q=yield(0,i.conversationHash)({conversationId:N,account:T.did,env:P});let W;!L&&q&&!(q!=null&&q.threadHash)?W=`${D}/v1/chat/request`:W=`${D}/v1/chat/message`;const re=yield(0,o.sendMessagePayloadCore)(N,T,M,k,R,B,P,m);return(yield(0,f.axiosPost)(W,re)).data}catch(C){throw(0,l.handleError)(C,e.send.name)}});e.sendCore=d;const h=g=>t.__awaiter(void 0,void 0,void 0,function*(){const{messageType:m,messageObj:b,account:w,to:E,signer:C,pgpPrivateKey:R,env:M}=g;if(!w&&!C)throw new Error("Unable to detect sender. Please ensure that either 'account' or 'signer' is properly defined.");if(!C&&!R)throw new Error("Unable to decrypt keys. Please ensure that either 'signer' or 'pgpPrivateKey' is properly defined.");const _=(0,s.getWallet)({account:w,signer:C}),A=yield(0,s.getAccountAddress)(_);if(!(0,r.isValidPushCAIP)(A))throw new Error("Invalid sender. Please ensure that either 'account' or 'signer' is properly defined.");(0,a.validateMessageObj)(b,m)}),y=g=>{var m,b,w;const E=((m=g.message)===null||m===void 0?void 0:m.type)!==void 0?g.message.type:(b=g.messageType)!==null&&b!==void 0?b:"Text";let C=g.message;if(C===void 0){if(g.messageObj===void 0&&![n.MessageType.TEXT,n.MessageType.IMAGE,n.MessageType.FILE,n.MessageType.MEDIA_EMBED,n.MessageType.GIF].includes(E))throw new Error("Options.message is required");C=g.messageObj!==void 0?g.messageObj:{content:(w=g.messageContent)!==null&&w!==void 0?w:""}}else C=t.__rest(C,["type"]);if(E===n.MessageType.REPLY)if(typeof C.content=="object"){const P=C.content,{type:v}=P,S=t.__rest(P,["type"]);C.content={messageType:v,messageObj:S}}else throw new Error("Options.message is not properly defined for Reply");if(E===n.MessageType.COMPOSITE)if(C.content instanceof Array)C.content=C.content.map(P=>{const{type:v}=P,S=t.__rest(P,["type"]);return{messageType:v,messageObj:S}});else throw new Error("Options.message is not properly defined for Composite");const R=g.account!==void 0?g.account:null,M=g.to!==void 0?g.to:g.receiverAddress;if(M===void 0)throw new Error("Options.to is required");const _=g.signer!==void 0?g.signer:null,A=g.pgpPrivateKey!==void 0?g.pgpPrivateKey:null,I=g.env!==void 0?g.env:n.default.ENV.PROD;return{messageType:E,messageObj:C,account:R,to:M,signer:_,pgpPrivateKey:A,env:I}}}(pp)),pp}var mp={},k5;function X9(){return k5||(k5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.historyCore=e.history=void 0;const t=Ke,r=Je(),n=Xt(),s=tt(),i=In(),o=Mt();var a;(function(l){l[l.MIN=1]="MIN",l[l.DEFAULT=10]="DEFAULT",l[l.MAX=30]="MAX"})(a||(a={}));const f=l=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.historyCore)(l,o.PGPHelper)});e.history=f;const c=(l,u)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:p,limit:d=a.DEFAULT,pgpPrivateKey:h="",account:y,toDecrypt:g=!1,env:m=r.default.ENV.PROD}=l||{};try{if(d<a.MIN||d>a.MAX)throw d<a.MIN?new Error(`Limit must be more than equal to ${a.MIN}`):new Error(`Limit must be less than equal to ${a.MAX}`);const b=yield(0,o.getMessagesService)({threadhash:p,limit:d,env:m}),w=(0,o.addDeprecatedInfoToMessages)(b),E=yield(0,i.get)({account:(0,s.pCAIP10ToWallet)(y),env:m});return g?yield(0,o.decryptConversation)({messages:w,connectedUser:E,pgpPrivateKey:h,pgpHelper:u,env:m}):b}catch(b){throw(0,n.handleError)(b,e.history.name)}});e.historyCore=c}(mp)),mp}var vp={},M5;function FR(){return M5||(M5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.latestCore=e.latest=void 0;const t=Ke,r=Je(),n=Mt(),s=X9(),i=a=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.latestCore)(a,n.PGPHelper)});e.latest=i;const o=(a,f)=>t.__awaiter(void 0,void 0,void 0,function*(){const{threadhash:c,pgpPrivateKey:l="",account:u,toDecrypt:p=!1,env:d=r.default.ENV.PROD}=a||{};return(0,s.history)({threadhash:c,toDecrypt:p,limit:1,pgpPrivateKey:l,account:u,env:d})});e.latestCore=o}(vp)),vp}var bp={},O5;function HR(){return O5||(O5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createGroupCoreV2=e.createGroupV2=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Xt(),a=Tt(),f=u=>t.__awaiter(void 0,void 0,void 0,function*(){return yield(0,e.createGroupCoreV2)(u,s.PGPHelper)});e.createGroupV2=f;const c=(u,p)=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:d=null,signer:h=null,pgpPrivateKey:y=null,env:g=n.default.ENV.PROD,groupName:m,groupDescription:b,groupImage:w,rules:E,isPublic:C,groupType:R,config:{meta:M,scheduleAt:_,scheduleEnd:A,status:I},members:P,admins:v}=u;try{const S=(0,s.getWallet)({account:d,signer:h}),T=yield(0,s.getConnectedUserV2Core)(S,y,g,p),N=P.map(F=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(F,g)})),D=v.map(F=>t.__awaiter(void 0,void 0,void 0,function*(){return(0,r.convertToValidDID)(F,g)})),O=yield Promise.all(N),L=yield Promise.all(D);l(u);const B={groupName:m,groupDescription:b,groupImage:w,rules:E,isPublic:C,groupType:R},k=i.SHA256(JSON.stringify(B)).toString(),W=`pgpv2:${yield p.sign({message:k,signingKey:T.privateKey})}:${T.did}`,re={meta:M,scheduleAt:_,scheduleEnd:A,status:I},ue=i.SHA256(JSON.stringify(re)).toString(),ae=`pgpv2:${yield p.sign({message:ue,signingKey:T.privateKey})}:${T.did}`,V={members:O,admins:L},U=i.SHA256(JSON.stringify(V)).toString(),ge=`pgpv2:${yield p.sign({message:U,signingKey:T.privateKey})}:${T.did}`,Te=`${(0,r.getAPIBaseUrls)(g)}/v2/chat/groups`,z={groupName:m,groupDescription:b,groupImage:w,rules:E,isPublic:C,groupType:R,profileVerificationProof:W,config:{meta:M,scheduleAt:_,scheduleEnd:A,status:I,configVerificationProof:ae},members:O,admins:L,idempotentVerificationProof:ge};return(yield(0,a.axiosPost)(Te,z)).data}catch(S){throw(0,o.handleError)(S,e.createGroupV2.name)}});e.createGroupCoreV2=c;const l=u=>{const{account:p=null,signer:d=null,pgpPrivateKey:h=null,groupName:y,groupDescription:g,groupImage:m,rules:b,isPublic:w,groupType:E,config:{meta:C,scheduleAt:R,scheduleEnd:M,status:_},members:A,admins:I}=u;if(!h&&!d)throw new Error("At least one from pgpPrivateKey or signer is necessary!");if(y==null||y.length==0)throw new Error("groupName cannot be null or empty");if(y.length>50)throw new Error("groupName cannot be more than 50 characters");if(g&&g.length>150)throw new Error("groupDescription cannot be more than 150 characters");for(let P=0;P<A.length;P++)if(A[P]&&!(0,r.isValidPushCAIP)(A[P]))throw new Error("Invalid member address!");for(let P=0;P<I.length;P++)if(!(0,r.isValidPushCAIP)(I[P]))throw new Error("Invalid admin address!");(0,s.validateScheduleDates)(R,M)}}(bp)),bp}var _p={},N5;function GR(){return N5||(N5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupByName=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{groupName:f,env:c=n.default.ENV.PROD}=a||{};try{if(console.log("============================================="),console.log("NOTICE: The method 'getGroupByName' will be deprecated on January 1st, 2024. Please update your code to remove this."),console.log("============================================="),f==null||f.length==0)throw new Error("Group Name cannot be null or empty");const u=`${(0,r.getAPIBaseUrls)(c)}/v1/chat/groups?groupName=${f}`;return(yield(0,s.axiosGet)(u)).data}catch(l){throw(0,i.handleError)(l,e.getGroupByName.name)}});e.getGroupByName=o}(_p)),_p}var wp={},D5;function zR(){return D5||(D5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getGroupAccess=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,did:c,env:l=n.default.ENV.PROD}=a||{};try{if(f==null||f.length===0)throw new Error("chatId cannot be null or empty");if(c==null||c.length===0)throw new Error("did cannot be null or empty");const u=yield(0,r.convertToValidDID)(c,l),d=`${(0,r.getAPIBaseUrls)(l)}/v1/chat/groups/${f}/access/${u}`;return(yield(0,s.axiosGet)(d)).data}catch(u){throw(0,i.handleError)(u,e.getGroupAccess.name)}});e.getGroupAccess=o}(wp)),wp}var Ep={},x5;function WR(){return x5||(x5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=Xt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:f,pageNumber:c,pageSize:l,env:u=n.default.ENV.PROD}=a||{};try{const d=`${(0,r.getAPIBaseUrls)(u)}/v1/chat/groups/search`;return(yield(0,s.axiosPost)(d,{searchTerm:f,pageNumber:c,pageSize:l})).data}catch(p){throw(0,i.handleError)(p,e.search.name)}});e.search=o}(Ep)),Ep}var Ap={},U5;function YR(){return U5||(U5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.reject=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=Xt(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:l=null,signer:u=null,senderAddress:p,env:d=n.default.ENV.PROD,pgpPrivateKey:h=null}=c||{};if(l==null&&u==null)throw new Error("At least one from account or signer is necessary!");const y=(0,s.getWallet)({account:l,signer:u}),g=yield(0,s.getAccountAddress)(y),b=`${(0,r.getAPIBaseUrls)(d)}/v1/chat/request/reject`;let w=!0;(0,r.isValidPushCAIP)(p)&&(w=!1);const E=yield(0,s.getConnectedUserV2)(y,h,d);let C=yield(0,r.convertToValidDID)(p,d),R=yield(0,r.convertToValidDID)(g,d);w&&(C=yield(0,r.convertToValidDID)(g,d),R=yield(0,r.convertToValidDID)(p,d));const M={fromDID:C,toDID:R},_=i.SHA256(JSON.stringify(M)).toString(),A=yield(0,s.sign)({message:_,signingKey:E.privateKey}),I=(0,s.rejectRequestPayload)(C,R,"pgp",A);return(0,o.axiosPut)(b,I).then(P=>P.data).catch(P=>{throw(0,a.handleError)(P,e.reject.name)})});e.reject=f}(Ap)),Ap}var Sp={},B5;function JR(){return B5||(B5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.modifyRoles=void 0;const t=Ke,r=en(),n=Je(),s=Xt(),i=ql(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:f,newRole:c,members:l,account:u=null,signer:p=null,env:d=n.default.ENV.PROD,pgpPrivateKey:h=null,overrideSecretKeyGeneration:y=!r.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD].feature.includes(n.default.ALPHA_FEATURES.SCALABILITY_V2)}=a||{};try{if(u==null&&p==null)throw new Error("At least one from account or signer is necessary!");if(!l||l.length===0)throw new Error("Members array cannot be empty!");const m={chatId:f,upsert:{admins:c==="ADMIN"?l:[],members:c==="MEMBER"?l:[]},remove:[],account:u,signer:p,pgpPrivateKey:h,env:d,overrideSecretKeyGeneration:y};return yield(0,i.updateGroupMembers)(m)}catch(g){throw(0,s.handleError)(g,e.modifyRoles.name)}});e.modifyRoles=o}(Sp)),Sp}var Pp={},L5;function ZR(){return L5||(L5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getChatInfo=void 0;const t=Ke,r=Je(),n=Xt(),s=tt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{recipient:f,account:c,env:l=r.default.ENV.PROD}=a;try{if(!f||!c)throw new Error("receipient and account cannot be null or empty");const p=`${(0,s.getAPIBaseUrls)(l)}/v1/chat/${yield(0,s.convertToValidDID)(f,l)}/address/${yield(0,s.convertToValidDID)(c,l)}`;return(yield(0,i.axiosGet)(p)).data}catch(u){throw(0,n.handleError)(u,e.getChatInfo.name)}});e.getChatInfo=o}(Pp)),Pp}var K5;function Xn(){return K5||(K5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decryptConversation=e.decryptPGPKey=e.decryptWithWalletRPCMethod=void 0;const t=Ke;t.__exportStar(LR(),e),t.__exportStar(KR(),e),t.__exportStar(jR(),e),t.__exportStar(VR(),e),t.__exportStar(Z9(),e),t.__exportStar(Y9(),e),t.__exportStar(X9(),e),t.__exportStar(FR(),e);var r=ky();Object.defineProperty(e,"decryptWithWalletRPCMethod",{enumerable:!0,get:function(){return r.decryptWithWalletRPCMethod}});var n=ky();Object.defineProperty(e,"decryptPGPKey",{enumerable:!0,get:function(){return n.decryptPGPKey}});var s=Mt();Object.defineProperty(e,"decryptConversation",{enumerable:!0,get:function(){return s.decryptConversation}}),t.__exportStar(x9(),e),t.__exportStar($9(),e),t.__exportStar(HR(),e),t.__exportStar(Kl(),e),t.__exportStar(Bl(),e),t.__exportStar(GR(),e),t.__exportStar(z9(),e),t.__exportStar(H9(),e),t.__exportStar(W9(),e),t.__exportStar(G9(),e),t.__exportStar(zR(),e),t.__exportStar(WR(),e),t.__exportStar(YR(),e),t.__exportStar(j2(),e),t.__exportStar(D9(),e),t.__exportStar(jl(),e),t.__exportStar(U2(),e),t.__exportStar(V9(),e),t.__exportStar(JR(),e),t.__exportStar(ZR(),e)}(lp)),lp}var j5;function XR(){return j5||(j5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getAccess=void 0;const t=Ke,r=Je(),n=Xn(),s=i=>t.__awaiter(void 0,void 0,void 0,function*(){const{spaceId:o,did:a,env:f=r.default.ENV.PROD}=i||{};try{if(o==null||o.length===0)throw new Error("spaceId cannot be null or empty");if(a==null||a.length===0)throw new Error("did cannot be null or empty");const c=yield(0,n.getGroupAccess)({chatId:o,did:a,env:f});return(0,n.groupAccessToSpaceAccess)(c)}catch(c){throw console.error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: `,c),Error(`[Push SDK] - API - Error - API ${e.getAccess.name} -: ${c}`)}});e.getAccess=s}(up)),up}var Tp={},q5;function QR(){return q5||(q5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.search=void 0;const t=Ke,r=tt(),n=Je(),s=Tt(),i=o=>t.__awaiter(void 0,void 0,void 0,function*(){const{searchTerm:a,pageNumber:f,pageSize:c,env:l=n.default.ENV.PROD}=o||{};try{const p=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/search`;return(0,s.axiosPost)(p,{searchTerm:a,pageNumber:f,pageSize:c}).then(d=>d.data).catch(d=>{var h,y;throw!((h=d==null?void 0:d.response)===null||h===void 0)&&h.data?new Error((y=d==null?void 0:d.response)===null||y===void 0?void 0:y.data):new Error(d)})}catch(u){throw console.error(`[Push SDK] - API - Error - API ${e.search.name} -: `,u),Error(`[Push SDK] - API - Error - API ${e.search.name} -: ${u}`)}});e.search=i}(Tp)),Tp}var lc={},$5;function ek(){if($5)return lc;$5=1,Object.defineProperty(lc,"__esModule",{value:!0}),lc.createV2=void 0;const e=Ke,t=Je(),r=Mt(),n=Xn();function s(i){var o;return e.__awaiter(this,void 0,void 0,function*(){const{signer:a,spaceName:f,spaceDescription:c,listeners:l,spaceImage:u,speakers:p,isPublic:d,env:h=t.default.ENV.PROD,pgpPrivateKey:y=null,rules:g,config:m}=i||{},b=g?(0,r.convertSpaceRulesToRules)(g):null;try{const w=yield(0,n.createGroupV2)({signer:a,groupName:f,groupDescription:c,members:l,groupImage:u,admins:p,isPublic:d,env:h,pgpPrivateKey:y,groupType:"spaces",config:{meta:null,scheduleAt:m.scheduleAt,scheduleEnd:(o=m.scheduleEnd)!==null&&o!==void 0?o:null,status:"PENDING"},rules:b});return(0,r.groupInfoDtoToSpaceInfoDto)(w)}catch(w){throw console.error(`[Push SDK] - API - Error - API ${s.name} -: `,w),new Error(`[Push SDK] - API - Error - API ${s.name} -: ${w}`)}})}return lc.createV2=s,lc}var Ip={},V5;function tk(){return V5||(V5=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.spaceFeed=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=Tt(),o=a=>t.__awaiter(void 0,void 0,void 0,function*(){const{account:f,pgpPrivateKey:c,env:l=n.default.ENV.PROD,toDecrypt:u=!1,recipient:p}=a||{},d=yield(0,r.convertToValidDID)(f,l),h=yield(0,r.convertToValidDID)(p,l);if(!(0,r.isValidPushCAIP)(d))throw new Error(`Invalid address ${d}`);const g=`${(0,r.getAPIBaseUrls)(l)}/v1/spaces/users/${d}/space/${h}`;try{const b=(yield(0,i.axiosGet)(g)).data;if(Object.keys(b).length!==0){const[w]=yield(0,s.getSpaceInboxLists)({lists:[b],user:d,toDecrypt:u,pgpPrivateKey:c,env:l});return w}else return b}catch(m){throw console.error(`[Push SDK] - API ${e.spaceFeed.name}: `,m),Error(`[Push SDK] - API ${e.spaceFeed.name}: ${m}`)}});e.spaceFeed=o}(Ip)),Ip}var Cp={},Rp={exports:{}},kp,F5;function rk(){if(F5)return kp;F5=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,s=(G,se)=>{for(var me in se)e(G,me,{get:se[me],enumerable:!0})},i=(G,se,me,Se)=>{if(se&&typeof se=="object"||typeof se=="function")for(let Ae of r(se))!n.call(G,Ae)&&Ae!==me&&e(G,Ae,{get:()=>se[Ae],enumerable:!(Se=t(se,Ae))||Se.enumerable});return G},o=G=>i(e({},"__esModule",{value:!0}),G),a={};s(a,{Immer:()=>Fe,applyPatches:()=>Ve,castDraft:()=>rt,castImmutable:()=>ve,createDraft:()=>Qe,current:()=>He,enableMapSet:()=>pe,enablePatches:()=>ce,finishDraft:()=>dt,freeze:()=>S,immerable:()=>c,isDraft:()=>d,isDraftable:()=>h,nothing:()=>f,original:()=>b,produce:()=>fe,produceWithPatches:()=>ye,setAutoFreeze:()=>ee,setUseStrictIteration:()=>$e,setUseStrictShallowCopy:()=>Z}),kp=o(a);var f=Symbol.for("immer-nothing"),c=Symbol.for("immer-draftable"),l=Symbol.for("immer-state");function u(G,...se){throw new Error(`[Immer] minified error nr: ${G}. Full error at: https://bit.ly/3cXEKWf`)}var p=Object.getPrototypeOf;function d(G){return!!G&&!!G[l]}function h(G){var se;return G?m(G)||Array.isArray(G)||!!G[c]||!!((se=G.constructor)!=null&&se[c])||A(G)||I(G):!1}var y=Object.prototype.constructor.toString(),g=new WeakMap;function m(G){if(!G||typeof G!="object")return!1;let se=Object.getPrototypeOf(G);if(se===null||se===Object.prototype)return!0;let me=Object.hasOwnProperty.call(se,"constructor")&&se.constructor;if(me===Object)return!0;if(typeof me!="function")return!1;let Se=g.get(me);return Se===void 0&&(Se=Function.toString.call(me),g.set(me,Se)),Se===y}function b(G){return d(G)||u(15,G),G[l].t}function w(G,se,me=!0){E(G)===0?(me?Reflect.ownKeys(G):Object.keys(G)).forEach(Se=>{se(Se,G[Se],G)}):G.forEach((Se,Ae)=>se(Ae,Se,G))}function E(G){let se=G[l];return se?se.o:Array.isArray(G)?1:A(G)?2:I(G)?3:0}function C(G,se){return E(G)===2?G.has(se):Object.prototype.hasOwnProperty.call(G,se)}function R(G,se){return E(G)===2?G.get(se):G[se]}function M(G,se,me){let Se=E(G);Se===2?G.set(se,me):Se===3?G.add(me):G[se]=me}function _(G,se){return G===se?G!==0||1/G===1/se:G!==G&&se!==se}function A(G){return G instanceof Map}function I(G){return G instanceof Set}function P(G){return G.e||G.t}function v(G,se){if(A(G))return new Map(G);if(I(G))return new Set(G);if(Array.isArray(G))return Array.prototype.slice.call(G);let me=m(G);if(se===!0||se==="class_only"&&!me){let Se=Object.getOwnPropertyDescriptors(G);delete Se[l];let Ae=Reflect.ownKeys(Se);for(let ke=0;ke<Ae.length;ke++){let Ne=Ae[ke],xe=Se[Ne];xe.writable===!1&&(xe.writable=!0,xe.configurable=!0),(xe.get||xe.set)&&(Se[Ne]={configurable:!0,writable:!0,enumerable:xe.enumerable,value:G[Ne]})}return Object.create(p(G),Se)}else{let Se=p(G);if(Se!==null&&me)return{...G};let Ae=Object.create(Se);return Object.assign(Ae,G)}}function S(G,se=!1){return D(G)||d(G)||!h(G)||(E(G)>1&&Object.defineProperties(G,{set:N,add:N,clear:N,delete:N}),Object.freeze(G),se&&Object.values(G).forEach(me=>S(me,!0))),G}function T(){u(2)}var N={value:T};function D(G){return G===null||typeof G!="object"?!0:Object.isFrozen(G)}var O={};function L(G){let se=O[G];return se||u(0,G),se}function B(G,se){O[G]||(O[G]=se)}var k;function q(){return k}function W(G,se){return{a:[],i:G,f:se,P:!0,d:0}}function re(G,se){se&&(L("Patches"),G.u=[],G.h=[],G.I=se)}function ue(G){H(G),G.a.forEach(V),G.a=null}function H(G){G===k&&(k=G.i)}function ae(G){return k=W(k,G)}function V(G){let se=G[l];se.o===0||se.o===1?se.x():se.m=!0}function U(G,se){se.d=se.a.length;let me=se.a[0];return G!==void 0&&G!==me?(me[l].s&&(ue(se),u(4)),h(G)&&(G=te(se,G),se.i||Pe(se,G)),se.u&&L("Patches").T(me[l].t,G,se.u,se.h)):G=te(se,me,[]),ue(se),se.u&&se.I(se.u,se.h),G!==f?G:void 0}function te(G,se,me){if(D(se))return se;let Se=G.f.shouldUseStrictIteration(),Ae=se[l];if(!Ae)return w(se,(ke,Ne)=>ge(G,Ae,se,ke,Ne,me),Se),se;if(Ae.n!==G)return se;if(!Ae.s)return Pe(G,Ae.t,!0),Ae.t;if(!Ae.c){Ae.c=!0,Ae.n.d--;let ke=Ae.e,Ne=ke,xe=!1;Ae.o===3&&(Ne=new Set(ke),ke.clear(),xe=!0),w(Ne,(Re,Me)=>ge(G,Ae,ke,Re,Me,me,xe),Se),Pe(G,ke,!1),me&&G.u&&L("Patches").g(Ae,me,G.u,G.h)}return Ae.e}function ge(G,se,me,Se,Ae,ke,Ne){if(Ae==null||typeof Ae!="object"&&!Ne)return;let xe=D(Ae);if(!(xe&&!Ne)){if(d(Ae)){let Re=ke&&se&&se.o!==3&&!C(se.r,Se)?ke.concat(Se):void 0,Me=te(G,Ae,Re);if(M(me,Se,Me),d(Me))G.P=!1;else return}else Ne&&me.add(Ae);if(h(Ae)&&!xe){if(!G.f.y&&G.d<1||se&&se.t&&se.t[Se]===Ae&&xe)return;te(G,Ae),(!se||!se.n.i)&&typeof Se!="symbol"&&(A(me)?me.has(Se):Object.prototype.propertyIsEnumerable.call(me,Se))&&Pe(G,Ae)}}}function Pe(G,se,me=!1){!G.i&&G.f.y&&G.P&&S(se,me)}function Te(G,se){let me=Array.isArray(G),Se={o:me?1:0,n:se?se.n:q(),s:!1,c:!1,r:{},i:se,t:G,p:null,e:null,x:null,l:!1},Ae=Se,ke=z;me&&(Ae=[Se],ke=$);let{revoke:Ne,proxy:xe}=Proxy.revocable(Ae,ke);return Se.p=xe,Se.x=Ne,xe}var z={get(G,se){if(se===l)return G;let me=P(G);if(!C(me,se))return Q(G,me,se);let Se=me[se];return G.c||!h(Se)?Se:Se===F(G.t,se)?(ne(G),G.e[se]=je(Se,G)):Se},has(G,se){return se in P(G)},ownKeys(G){return Reflect.ownKeys(P(G))},set(G,se,me){let Se=de(P(G),se);if(Se!=null&&Se.set)return Se.set.call(G.p,me),!0;if(!G.s){let Ae=F(P(G),se),ke=Ae==null?void 0:Ae[l];if(ke&&ke.t===me)return G.e[se]=me,G.r[se]=!1,!0;if(_(me,Ae)&&(me!==void 0||C(G.t,se)))return!0;ne(G),oe(G)}return G.e[se]===me&&(me!==void 0||se in G.e)||Number.isNaN(me)&&Number.isNaN(G.e[se])||(G.e[se]=me,G.r[se]=!0),!0},deleteProperty(G,se){return F(G.t,se)!==void 0||se in G.t?(G.r[se]=!1,ne(G),oe(G)):delete G.r[se],G.e&&delete G.e[se],!0},getOwnPropertyDescriptor(G,se){let me=P(G),Se=Reflect.getOwnPropertyDescriptor(me,se);return Se&&{writable:!0,configurable:G.o!==1||se!=="length",enumerable:Se.enumerable,value:me[se]}},defineProperty(){u(11)},getPrototypeOf(G){return p(G.t)},setPrototypeOf(){u(12)}},$={};w(z,(G,se)=>{$[G]=function(){return arguments[0]=arguments[0][0],se.apply(this,arguments)}}),$.deleteProperty=function(G,se){return $.set.call(this,G,se,void 0)},$.set=function(G,se,me){return z.set.call(this,G[0],se,me,G[0])};function F(G,se){let me=G[l];return(me?P(me):G)[se]}function Q(G,se,me){var Ae;let Se=de(se,me);return Se?"value"in Se?Se.value:(Ae=Se.get)==null?void 0:Ae.call(G.p):void 0}function de(G,se){if(!(se in G))return;let me=p(G);for(;me;){let Se=Object.getOwnPropertyDescriptor(me,se);if(Se)return Se;me=p(me)}}function oe(G){G.s||(G.s=!0,G.i&&oe(G.i))}function ne(G){G.e||(G.e=v(G.t,G.n.f.S))}var Fe=class{constructor(G){this.y=!0,this.S=!1,this.b=!0,this.produce=(se,me,Se)=>{if(typeof se=="function"&&typeof me!="function"){let ke=me;me=se;let Ne=this;return function(xe=ke,...Re){return Ne.produce(xe,Me=>me.call(this,Me,...Re))}}typeof me!="function"&&u(6),Se!==void 0&&typeof Se!="function"&&u(7);let Ae;if(h(se)){let ke=ae(this),Ne=je(se,void 0),xe=!0;try{Ae=me(Ne),xe=!1}finally{xe?ue(ke):H(ke)}return re(ke,Se),U(Ae,ke)}else if(!se||typeof se!="object"){if(Ae=me(se),Ae===void 0&&(Ae=se),Ae===f&&(Ae=void 0),this.y&&S(Ae,!0),Se){let ke=[],Ne=[];L("Patches").T(se,Ae,ke,Ne),Se(ke,Ne)}return Ae}else u(1,se)},this.produceWithPatches=(se,me)=>{if(typeof se=="function")return(ke,...Ne)=>this.produceWithPatches(ke,xe=>se(xe,...Ne));let Se,Ae;return[this.produce(se,me,(ke,Ne)=>{Se=ke,Ae=Ne}),Se,Ae]},typeof(G==null?void 0:G.autoFreeze)=="boolean"&&this.setAutoFreeze(G.autoFreeze),typeof(G==null?void 0:G.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(G.useStrictShallowCopy),typeof(G==null?void 0:G.useStrictIteration)=="boolean"&&this.setUseStrictIteration(G.useStrictIteration)}createDraft(G){h(G)||u(8),d(G)&&(G=He(G));let se=ae(this),me=je(G,void 0);return me[l].l=!0,H(se),me}finishDraft(G,se){let me=G&&G[l];(!me||!me.l)&&u(9);let{n:Se}=me;return re(Se,se),U(void 0,Se)}setAutoFreeze(G){this.y=G}setUseStrictShallowCopy(G){this.S=G}setUseStrictIteration(G){this.b=G}shouldUseStrictIteration(){return this.b}applyPatches(G,se){let me;for(me=se.length-1;me>=0;me--){let Ae=se[me];if(Ae.path.length===0&&Ae.op==="replace"){G=Ae.value;break}}me>-1&&(se=se.slice(me+1));let Se=L("Patches").A;return d(G)?Se(G,se):this.produce(G,Ae=>Se(Ae,se))}};function je(G,se){let me=A(G)?L("MapSet").D(G,se):I(G)?L("MapSet").R(G,se):Te(G,se);return(se?se.n:q()).a.push(me),me}function He(G){return d(G)||u(10,G),he(G)}function he(G){if(!h(G)||D(G))return G;let se=G[l],me,Se=!0;if(se){if(!se.s)return se.t;se.c=!0,me=v(G,se.n.f.S),Se=se.n.f.shouldUseStrictIteration()}else me=v(G,!0);return w(me,(Ae,ke)=>{M(me,Ae,he(ke))},Se),se&&(se.c=!1),me}function ce(){let G="replace",se="add",me="remove";function Se(we,Ce,Oe,Ue){switch(we.o){case 0:case 2:return ke(we,Ce,Oe,Ue);case 1:return Ae(we,Ce,Oe,Ue);case 3:return Ne(we,Ce,Oe,Ue)}}function Ae(we,Ce,Oe,Ue){let{t:qe,r:K}=we,Y=we.e;Y.length<qe.length&&([qe,Y]=[Y,qe],[Oe,Ue]=[Ue,Oe]);for(let J=0;J<qe.length;J++)if(K[J]&&Y[J]!==qe[J]){let x=Ce.concat([J]);Oe.push({op:G,path:x,value:et(Y[J])}),Ue.push({op:G,path:x,value:et(qe[J])})}for(let J=qe.length;J<Y.length;J++){let x=Ce.concat([J]);Oe.push({op:se,path:x,value:et(Y[J])})}for(let J=Y.length-1;qe.length<=J;--J){let x=Ce.concat([J]);Ue.push({op:me,path:x})}}function ke(we,Ce,Oe,Ue){let{t:qe,e:K}=we;w(we.r,(Y,J)=>{let x=R(qe,Y),ie=R(K,Y),Ee=J?C(qe,Y)?G:se:me;if(x===ie&&Ee===G)return;let Ie=Ce.concat(Y);Oe.push(Ee===me?{op:Ee,path:Ie}:{op:Ee,path:Ie,value:ie}),Ue.push(Ee===se?{op:me,path:Ie}:Ee===me?{op:se,path:Ie,value:et(x)}:{op:G,path:Ie,value:et(x)})})}function Ne(we,Ce,Oe,Ue){let{t:qe,e:K}=we,Y=0;qe.forEach(J=>{if(!K.has(J)){let x=Ce.concat([Y]);Oe.push({op:me,path:x,value:J}),Ue.unshift({op:se,path:x,value:J})}Y++}),Y=0,K.forEach(J=>{if(!qe.has(J)){let x=Ce.concat([Y]);Oe.push({op:se,path:x,value:J}),Ue.unshift({op:me,path:x,value:J})}Y++})}function xe(we,Ce,Oe,Ue){Oe.push({op:G,path:[],value:Ce===f?void 0:Ce}),Ue.push({op:G,path:[],value:we})}function Re(we,Ce){return Ce.forEach(Oe=>{let{path:Ue,op:qe}=Oe,K=we;for(let ie=0;ie<Ue.length-1;ie++){let Ee=E(K),Ie=Ue[ie];typeof Ie!="string"&&typeof Ie!="number"&&(Ie=""+Ie),(Ee===0||Ee===1)&&(Ie==="__proto__"||Ie==="constructor")&&u(16+3),typeof K=="function"&&Ie==="prototype"&&u(16+3),K=R(K,Ie),typeof K!="object"&&u(16+2,Ue.join("/"))}let Y=E(K),J=Me(Oe.value),x=Ue[Ue.length-1];switch(qe){case G:switch(Y){case 2:return K.set(x,J);case 3:u(16);default:return K[x]=J}case se:switch(Y){case 1:return x==="-"?K.push(J):K.splice(x,0,J);case 2:return K.set(x,J);case 3:return K.add(J);default:return K[x]=J}case me:switch(Y){case 1:return K.splice(x,1);case 2:return K.delete(x);case 3:return K.delete(Oe.value);default:return delete K[x]}default:u(16+1,qe)}}),we}function Me(we){if(!h(we))return we;if(Array.isArray(we))return we.map(Me);if(A(we))return new Map(Array.from(we.entries()).map(([Oe,Ue])=>[Oe,Me(Ue)]));if(I(we))return new Set(Array.from(we).map(Me));let Ce=Object.create(p(we));for(let Oe in we)Ce[Oe]=Me(we[Oe]);return C(we,c)&&(Ce[c]=we[c]),Ce}function et(we){return d(we)?Me(we):we}B("Patches",{A:Re,g:Se,T:xe})}function pe(){class G extends Map{constructor(Re,Me){super(),this[l]={o:2,i:Me,n:Me?Me.n:q(),s:!1,c:!1,e:void 0,r:void 0,t:Re,p:this,l:!1,m:!1}}get size(){return P(this[l]).size}has(Re){return P(this[l]).has(Re)}set(Re,Me){let et=this[l];return Ne(et),(!P(et).has(Re)||P(et).get(Re)!==Me)&&(me(et),oe(et),et.r.set(Re,!0),et.e.set(Re,Me),et.r.set(Re,!0)),this}delete(Re){if(!this.has(Re))return!1;let Me=this[l];return Ne(Me),me(Me),oe(Me),Me.t.has(Re)?Me.r.set(Re,!1):Me.r.delete(Re),Me.e.delete(Re),!0}clear(){let Re=this[l];Ne(Re),P(Re).size&&(me(Re),oe(Re),Re.r=new Map,w(Re.t,Me=>{Re.r.set(Me,!1)}),Re.e.clear())}forEach(Re,Me){let et=this[l];P(et).forEach((we,Ce,Oe)=>{Re.call(Me,this.get(Ce),Ce,this)})}get(Re){let Me=this[l];Ne(Me);let et=P(Me).get(Re);if(Me.c||!h(et)||et!==Me.t.get(Re))return et;let we=je(et,Me);return me(Me),Me.e.set(Re,we),we}keys(){return P(this[l]).keys()}values(){let Re=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let Me=Re.next();return Me.done?Me:{done:!1,value:this.get(Me.value)}}}}entries(){let Re=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let Me=Re.next();if(Me.done)return Me;let et=this.get(Me.value);return{done:!1,value:[Me.value,et]}}}}[Symbol.iterator](){return this.entries()}}function se(xe,Re){return new G(xe,Re)}function me(xe){xe.e||(xe.r=new Map,xe.e=new Map(xe.t))}class Se extends Set{constructor(Re,Me){super(),this[l]={o:3,i:Me,n:Me?Me.n:q(),s:!1,c:!1,e:void 0,t:Re,p:this,a:new Map,m:!1,l:!1}}get size(){return P(this[l]).size}has(Re){let Me=this[l];return Ne(Me),Me.e?!!(Me.e.has(Re)||Me.a.has(Re)&&Me.e.has(Me.a.get(Re))):Me.t.has(Re)}add(Re){let Me=this[l];return Ne(Me),this.has(Re)||(ke(Me),oe(Me),Me.e.add(Re)),this}delete(Re){if(!this.has(Re))return!1;let Me=this[l];return Ne(Me),ke(Me),oe(Me),Me.e.delete(Re)||(Me.a.has(Re)?Me.e.delete(Me.a.get(Re)):!1)}clear(){let Re=this[l];Ne(Re),P(Re).size&&(ke(Re),oe(Re),Re.e.clear())}values(){let Re=this[l];return Ne(Re),ke(Re),Re.e.values()}entries(){let Re=this[l];return Ne(Re),ke(Re),Re.e.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(Re,Me){let et=this.values(),we=et.next();for(;!we.done;)Re.call(Me,we.value,we.value,this),we=et.next()}}function Ae(xe,Re){return new Se(xe,Re)}function ke(xe){xe.e||(xe.e=new Set,xe.t.forEach(Re=>{if(h(Re)){let Me=je(Re,xe);xe.a.set(Re,Me),xe.e.add(Me)}else xe.e.add(Re)}))}function Ne(xe){xe.m&&u(3,JSON.stringify(P(xe)))}B("MapSet",{D:se,R:Ae})}var le=new Fe,fe=le.produce,ye=le.produceWithPatches.bind(le),ee=le.setAutoFreeze.bind(le),Z=le.setUseStrictShallowCopy.bind(le),$e=le.setUseStrictIteration.bind(le),Ve=le.applyPatches.bind(le),Qe=le.createDraft.bind(le),dt=le.finishDraft.bind(le);function rt(G){return G}function ve(G){return G}return kp}var H5;function ei(){return H5||(H5=1,Rp.exports=rk()),Rp.exports}var Mp={},Op={},Np,G5;function nk(){return G5||(G5=1,Np=function(){if(typeof globalThis>"u")return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}),Np}var Sd={exports:{}},z5;function ik(){if(z5)return Sd.exports;z5=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
76
+ Use Chrome, Firefox or Internet Explorer 11`)}var n=aA().Buffer,s=It.crypto||It.msCrypto;s&&s.getRandomValues?Sd.exports=i:Sd.exports=r;function i(o,a){if(o>t)throw new RangeError("requested too many random bytes");var f=n.allocUnsafe(o);if(o>0)if(o>e)for(var c=0;c<o;c+=e)s.getRandomValues(f.slice(c,c+e));else s.getRandomValues(f);return typeof a=="function"?Cr.nextTick(function(){a(null,f)}):f}return Sd.exports}/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Dp,W5;function sk(){if(W5)return Dp;W5=1;let e;return Dp=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:It):t=>(e||(e=Promise.resolve())).then(t).catch(r=>setTimeout(()=>{throw r},0)),Dp}var xp,Y5;function ak(){if(Y5)return xp;Y5=1;function e(r,n){for(const s in n)Object.defineProperty(r,s,{value:n[s],enumerable:!0,configurable:!0});return r}function t(r,n,s){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");s||(s={}),typeof n=="object"&&(s=n,n=""),n&&(s.code=n);try{return e(r,s)}catch{s.message=r.message,s.stack=r.stack;const o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),e(new o,s)}}return xp=t,xp}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Up,J5;function ok(){if(J5)return Up;J5=1;const e=Un()("simple-peer"),t=nk(),r=ik(),n=oA(),s=sk(),i=ak(),{Buffer:o}=k4,a=64*1024,f=5*1e3,c=5*1e3;function l(d){return d.replace(/a=ice-options:trickle\s\n/g,"")}function u(d){console.warn(d)}class p extends n.Duplex{constructor(h){if(h=Object.assign({allowHalfOpen:!1},h),super(h),this._id=r(4).toString("hex").slice(0,7),this._debug("new peer %o",h),this.channelName=h.initiator?h.channelName||r(20).toString("hex"):null,this.initiator=h.initiator||!1,this.channelConfig=h.channelConfig||p.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},p.config,h.config),this.offerOptions=h.offerOptions||{},this.answerOptions=h.answerOptions||{},this.sdpTransform=h.sdpTransform||(y=>y),this.streams=h.streams||(h.stream?[h.stream]:[]),this.trickle=h.trickle!==void 0?h.trickle:!0,this.allowHalfTrickle=h.allowHalfTrickle!==void 0?h.allowHalfTrickle:!1,this.iceCompleteTimeout=h.iceCompleteTimeout||f,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=h.wrtc&&typeof h.wrtc=="object"?h.wrtc:t(),!this._wrtc)throw i(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(y){this.destroy(i(y,"ERR_PC_CONSTRUCTOR"));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=y=>{this._onIceCandidate(y)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(y=>{this.destroy(i(y,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=y=>{this._setupData(y)},this.streams&&this.streams.forEach(y=>{this.addStream(y)}),this._pc.ontrack=y=>{this._onTrack(y)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof h=="string")try{h=JSON.parse(h)}catch{h={}}this._debug("signal()"),h.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),h.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(h.transceiverRequest.kind,h.transceiverRequest.init)),h.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(h.candidate):this._pendingCandidates.push(h.candidate)),h.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(h)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(y=>{this._addIceCandidate(y)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(y=>{this.destroy(i(y,"ERR_SET_REMOTE_DESCRIPTION"))}),!h.sdp&&!h.candidate&&!h.renegotiate&&!h.transceiverRequest&&this.destroy(i(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(h){const y=new this._wrtc.RTCIceCandidate(h);this._pc.addIceCandidate(y).catch(g=>{!y.address||y.address.endsWith(".local")?u("Ignoring unsupported ICE candidate."):this.destroy(i(g,"ERR_ADD_ICE_CANDIDATE"))})}send(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(h)}}addTransceiver(h,y){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(h,y),this._needsNegotiation()}catch(g){this.destroy(i(g,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:h,init:y}})}}addStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),h.getTracks().forEach(y=>{this.addTrack(y,h)})}}addTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const g=this._senderMap.get(h)||new Map;let m=g.get(y);if(!m)m=this._pc.addTrack(h,y),g.set(y,m),this._senderMap.set(h,g),this._needsNegotiation();else throw m.removed?i(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):i(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(h,y,g){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const m=this._senderMap.get(h),b=m?m.get(g):null;if(!b)throw i(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");y&&this._senderMap.set(y,m),b.replaceTrack!=null?b.replaceTrack(y):this.destroy(i(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(h,y){if(this.destroying)return;if(this.destroyed)throw i(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const g=this._senderMap.get(h),m=g?g.get(y):null;if(!m)throw i(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{m.removed=!0,this._pc.removeTrack(m)}catch(b){b.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(m):this.destroy(i(b,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(h){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),h.getTracks().forEach(y=>{this.removeTrack(y,h)})}}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,s(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw i(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(h){this._destroy(h,()=>{})}_destroy(h,y){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",h&&(h.message||h)),s(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",h&&(h.message||h)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,h&&this.emit("error",h),this.emit("close"),y()}))}_setupData(h){if(!h.channel)return this.destroy(i(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=h.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=a),this.channelName=this._channel.label,this._channel.onmessage=g=>{this._onChannelMessage(g)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=g=>{const m=g.error instanceof Error?g.error:new Error(`Datachannel error: ${g.message} ${g.filename}:${g.lineno}:${g.colno}`);this.destroy(i(m,"ERR_DATA_CHANNEL"))};let y=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(y&&this._onChannelClose(),y=!0):y=!1},c)}_read(){}_write(h,y,g){if(this.destroyed)return g(i(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(h)}catch(m){return this.destroy(i(m,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>a?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=g):g(null)}else this._debug("write before connect"),this._chunk=h,this._cb=g}_onFinish(){if(this.destroyed)return;const h=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?h():this.once("connect",h)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const b=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:b.type,sdp:b.sdp})},g=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},m=b=>{this.destroy(i(b,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(g).catch(m)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(h=>{!h.mid&&h.sender.track&&!h.requested&&(h.requested=!0,this.addTransceiver(h.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(h=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(h.sdp=l(h.sdp)),h.sdp=this.sdpTransform(h.sdp);const y=()=>{if(this.destroyed)return;const b=this._pc.localDescription||h;this._debug("signal"),this.emit("signal",{type:b.type,sdp:b.sdp}),this.initiator||this._requestMissingTransceivers()},g=()=>{this.destroyed||(this.trickle||this._iceComplete?y():this.once("_iceComplete",y))},m=b=>{this.destroy(i(b,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(h).then(g).catch(m)}).catch(h=>{this.destroy(i(h,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(i(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const h=this._pc.iceConnectionState,y=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",h,y),this.emit("iceStateChange",h,y),(h==="connected"||h==="completed")&&(this._pcReady=!0,this._maybeReady()),h==="failed"&&this.destroy(i(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),h==="closed"&&this.destroy(i(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(h){const y=g=>(Object.prototype.toString.call(g.values)==="[object Array]"&&g.values.forEach(m=>{Object.assign(g,m)}),g);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(g=>{const m=[];g.forEach(b=>{m.push(y(b))}),h(null,m)},g=>h(g)):this._pc.getStats.length>0?this._pc.getStats(g=>{if(this.destroyed)return;const m=[];g.result().forEach(b=>{const w={};b.names().forEach(E=>{w[E]=b.stat(E)}),w.id=b.id,w.type=b.type,w.timestamp=b.timestamp,m.push(y(w))}),h(null,m)},g=>h(g)):h(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const h=()=>{this.destroyed||this.getStats((y,g)=>{if(this.destroyed)return;y&&(g=[]);const m={},b={},w={};let E=!1;g.forEach(R=>{(R.type==="remotecandidate"||R.type==="remote-candidate")&&(m[R.id]=R),(R.type==="localcandidate"||R.type==="local-candidate")&&(b[R.id]=R),(R.type==="candidatepair"||R.type==="candidate-pair")&&(w[R.id]=R)});const C=R=>{E=!0;let M=b[R.localCandidateId];M&&(M.ip||M.address)?(this.localAddress=M.ip||M.address,this.localPort=Number(M.port)):M&&M.ipAddress?(this.localAddress=M.ipAddress,this.localPort=Number(M.portNumber)):typeof R.googLocalAddress=="string"&&(M=R.googLocalAddress.split(":"),this.localAddress=M[0],this.localPort=Number(M[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let _=m[R.remoteCandidateId];_&&(_.ip||_.address)?(this.remoteAddress=_.ip||_.address,this.remotePort=Number(_.port)):_&&_.ipAddress?(this.remoteAddress=_.ipAddress,this.remotePort=Number(_.portNumber)):typeof R.googRemoteAddress=="string"&&(_=R.googRemoteAddress.split(":"),this.remoteAddress=_[0],this.remotePort=Number(_[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(g.forEach(R=>{R.type==="transport"&&R.selectedCandidatePairId&&C(w[R.selectedCandidatePairId]),(R.type==="googCandidatePair"&&R.googActiveConnection==="true"||(R.type==="candidatepair"||R.type==="candidate-pair")&&R.selected)&&C(R)}),!E&&(!Object.keys(w).length||Object.keys(b).length)){setTimeout(h,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(M){return this.destroy(i(M,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const R=this._cb;this._cb=null,R(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};h()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>a||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(h=>{this._pc.removeTrack(h),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(h){this.destroyed||(h.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:h.candidate.candidate,sdpMLineIndex:h.candidate.sdpMLineIndex,sdpMid:h.candidate.sdpMid}}):!h.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),h.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(h){if(this.destroyed)return;let y=h.data;y instanceof ArrayBuffer&&(y=o.from(y)),this.push(y)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const h=this._cb;this._cb=null,h(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(h){this.destroyed||h.streams.forEach(y=>{this._debug("on track"),this.emit("track",h.track,y),this._remoteTracks.push({track:h.track,stream:y}),!this._remoteStreams.some(g=>g.id===y.id)&&(this._remoteStreams.push(y),s(()=>{this._debug("on stream"),this.emit("stream",y)}))})}_debug(){const h=[].slice.call(arguments);h[0]="["+this._id+"] "+h[0],e.apply(null,h)}}return p.WEBRTC_SUPPORT=!!t(),p.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},p.channelConfig={},Up=p,Up}var Pd={},Bp={},dc={},Ar={},Lp={},fc={},Td={},Z5;function Q9(){if(Z5)return Td;Z5=1,Object.defineProperty(Td,"__esModule",{value:!0}),Td.default=r;let e;const t=new Uint8Array(16);function r(){if(!e&&(e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(t)}return Td}var Na={},hc={},pc={},X5;function ck(){if(X5)return pc;X5=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.default=void 0;var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return pc.default=e,pc}var Q5;function Ph(){if(Q5)return hc;Q5=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.default=void 0;var e=t(ck());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){return typeof s=="string"&&e.default.test(s)}var n=r;return hc.default=n,hc}var e6;function Th(){if(e6)return Na;e6=1,Object.defineProperty(Na,"__esModule",{value:!0}),Na.default=void 0,Na.unsafeStringify=n;var e=t(Ph());function t(o){return o&&o.__esModule?o:{default:o}}const r=[];for(let o=0;o<256;++o)r.push((o+256).toString(16).slice(1));function n(o,a=0){return r[o[a+0]]+r[o[a+1]]+r[o[a+2]]+r[o[a+3]]+"-"+r[o[a+4]]+r[o[a+5]]+"-"+r[o[a+6]]+r[o[a+7]]+"-"+r[o[a+8]]+r[o[a+9]]+"-"+r[o[a+10]]+r[o[a+11]]+r[o[a+12]]+r[o[a+13]]+r[o[a+14]]+r[o[a+15]]}function s(o,a=0){const f=n(o,a);if(!(0,e.default)(f))throw TypeError("Stringified UUID is invalid");return f}var i=s;return Na.default=i,Na}var t6;function uk(){if(t6)return fc;t6=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.default=void 0;var e=r(Q9()),t=Th();function r(c){return c&&c.__esModule?c:{default:c}}let n,s,i=0,o=0;function a(c,l,u){let p=l&&u||0;const d=l||new Array(16);c=c||{};let h=c.node||n,y=c.clockseq!==void 0?c.clockseq:s;if(h==null||y==null){const C=c.random||(c.rng||e.default)();h==null&&(h=n=[C[0]|1,C[1],C[2],C[3],C[4],C[5]]),y==null&&(y=s=(C[6]<<8|C[7])&16383)}let g=c.msecs!==void 0?c.msecs:Date.now(),m=c.nsecs!==void 0?c.nsecs:o+1;const b=g-i+(m-o)/1e4;if(b<0&&c.clockseq===void 0&&(y=y+1&16383),(b<0||g>i)&&c.nsecs===void 0&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=g,o=m,s=y,g+=122192928e5;const w=((g&268435455)*1e4+m)%4294967296;d[p++]=w>>>24&255,d[p++]=w>>>16&255,d[p++]=w>>>8&255,d[p++]=w&255;const E=g/4294967296*1e4&268435455;d[p++]=E>>>8&255,d[p++]=E&255,d[p++]=E>>>24&15|16,d[p++]=E>>>16&255,d[p++]=y>>>8|128,d[p++]=y&255;for(let C=0;C<6;++C)d[p+C]=h[C];return l||(0,t.unsafeStringify)(d)}var f=a;return fc.default=f,fc}var yc={},as={},gc={},r6;function ew(){if(r6)return gc;r6=1,Object.defineProperty(gc,"__esModule",{value:!0}),gc.default=void 0;var e=t(Ph());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");let i;const o=new Uint8Array(16);return o[0]=(i=parseInt(s.slice(0,8),16))>>>24,o[1]=i>>>16&255,o[2]=i>>>8&255,o[3]=i&255,o[4]=(i=parseInt(s.slice(9,13),16))>>>8,o[5]=i&255,o[6]=(i=parseInt(s.slice(14,18),16))>>>8,o[7]=i&255,o[8]=(i=parseInt(s.slice(19,23),16))>>>8,o[9]=i&255,o[10]=(i=parseInt(s.slice(24,36),16))/1099511627776&255,o[11]=i/4294967296&255,o[12]=i>>>24&255,o[13]=i>>>16&255,o[14]=i>>>8&255,o[15]=i&255,o}var n=r;return gc.default=n,gc}var n6;function tw(){if(n6)return as;n6=1,Object.defineProperty(as,"__esModule",{value:!0}),as.URL=as.DNS=void 0,as.default=o;var e=Th(),t=r(ew());function r(a){return a&&a.__esModule?a:{default:a}}function n(a){a=unescape(encodeURIComponent(a));const f=[];for(let c=0;c<a.length;++c)f.push(a.charCodeAt(c));return f}const s="6ba7b810-9dad-11d1-80b4-00c04fd430c8";as.DNS=s;const i="6ba7b811-9dad-11d1-80b4-00c04fd430c8";as.URL=i;function o(a,f,c){function l(u,p,d,h){var y;if(typeof u=="string"&&(u=n(u)),typeof p=="string"&&(p=(0,t.default)(p)),((y=p)===null||y===void 0?void 0:y.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let g=new Uint8Array(16+u.length);if(g.set(p),g.set(u,p.length),g=c(g),g[6]=g[6]&15|f,g[8]=g[8]&63|128,d){h=h||0;for(let m=0;m<16;++m)d[h+m]=g[m];return d}return(0,e.unsafeStringify)(g)}try{l.name=a}catch{}return l.DNS=s,l.URL=i,l}return as}var mc={},i6;function lk(){if(i6)return mc;i6=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.default=void 0;function e(d){if(typeof d=="string"){const h=unescape(encodeURIComponent(d));d=new Uint8Array(h.length);for(let y=0;y<h.length;++y)d[y]=h.charCodeAt(y)}return t(n(s(d),d.length*8))}function t(d){const h=[],y=d.length*32,g="0123456789abcdef";for(let m=0;m<y;m+=8){const b=d[m>>5]>>>m%32&255,w=parseInt(g.charAt(b>>>4&15)+g.charAt(b&15),16);h.push(w)}return h}function r(d){return(d+64>>>9<<4)+14+1}function n(d,h){d[h>>5]|=128<<h%32,d[r(h)-1]=h;let y=1732584193,g=-271733879,m=-1732584194,b=271733878;for(let w=0;w<d.length;w+=16){const E=y,C=g,R=m,M=b;y=f(y,g,m,b,d[w],7,-680876936),b=f(b,y,g,m,d[w+1],12,-389564586),m=f(m,b,y,g,d[w+2],17,606105819),g=f(g,m,b,y,d[w+3],22,-1044525330),y=f(y,g,m,b,d[w+4],7,-176418897),b=f(b,y,g,m,d[w+5],12,1200080426),m=f(m,b,y,g,d[w+6],17,-1473231341),g=f(g,m,b,y,d[w+7],22,-45705983),y=f(y,g,m,b,d[w+8],7,1770035416),b=f(b,y,g,m,d[w+9],12,-1958414417),m=f(m,b,y,g,d[w+10],17,-42063),g=f(g,m,b,y,d[w+11],22,-1990404162),y=f(y,g,m,b,d[w+12],7,1804603682),b=f(b,y,g,m,d[w+13],12,-40341101),m=f(m,b,y,g,d[w+14],17,-1502002290),g=f(g,m,b,y,d[w+15],22,1236535329),y=c(y,g,m,b,d[w+1],5,-165796510),b=c(b,y,g,m,d[w+6],9,-1069501632),m=c(m,b,y,g,d[w+11],14,643717713),g=c(g,m,b,y,d[w],20,-373897302),y=c(y,g,m,b,d[w+5],5,-701558691),b=c(b,y,g,m,d[w+10],9,38016083),m=c(m,b,y,g,d[w+15],14,-660478335),g=c(g,m,b,y,d[w+4],20,-405537848),y=c(y,g,m,b,d[w+9],5,568446438),b=c(b,y,g,m,d[w+14],9,-1019803690),m=c(m,b,y,g,d[w+3],14,-187363961),g=c(g,m,b,y,d[w+8],20,1163531501),y=c(y,g,m,b,d[w+13],5,-1444681467),b=c(b,y,g,m,d[w+2],9,-51403784),m=c(m,b,y,g,d[w+7],14,1735328473),g=c(g,m,b,y,d[w+12],20,-1926607734),y=l(y,g,m,b,d[w+5],4,-378558),b=l(b,y,g,m,d[w+8],11,-2022574463),m=l(m,b,y,g,d[w+11],16,1839030562),g=l(g,m,b,y,d[w+14],23,-35309556),y=l(y,g,m,b,d[w+1],4,-1530992060),b=l(b,y,g,m,d[w+4],11,1272893353),m=l(m,b,y,g,d[w+7],16,-155497632),g=l(g,m,b,y,d[w+10],23,-1094730640),y=l(y,g,m,b,d[w+13],4,681279174),b=l(b,y,g,m,d[w],11,-358537222),m=l(m,b,y,g,d[w+3],16,-722521979),g=l(g,m,b,y,d[w+6],23,76029189),y=l(y,g,m,b,d[w+9],4,-640364487),b=l(b,y,g,m,d[w+12],11,-421815835),m=l(m,b,y,g,d[w+15],16,530742520),g=l(g,m,b,y,d[w+2],23,-995338651),y=u(y,g,m,b,d[w],6,-198630844),b=u(b,y,g,m,d[w+7],10,1126891415),m=u(m,b,y,g,d[w+14],15,-1416354905),g=u(g,m,b,y,d[w+5],21,-57434055),y=u(y,g,m,b,d[w+12],6,1700485571),b=u(b,y,g,m,d[w+3],10,-1894986606),m=u(m,b,y,g,d[w+10],15,-1051523),g=u(g,m,b,y,d[w+1],21,-2054922799),y=u(y,g,m,b,d[w+8],6,1873313359),b=u(b,y,g,m,d[w+15],10,-30611744),m=u(m,b,y,g,d[w+6],15,-1560198380),g=u(g,m,b,y,d[w+13],21,1309151649),y=u(y,g,m,b,d[w+4],6,-145523070),b=u(b,y,g,m,d[w+11],10,-1120210379),m=u(m,b,y,g,d[w+2],15,718787259),g=u(g,m,b,y,d[w+9],21,-343485551),y=i(y,E),g=i(g,C),m=i(m,R),b=i(b,M)}return[y,g,m,b]}function s(d){if(d.length===0)return[];const h=d.length*8,y=new Uint32Array(r(h));for(let g=0;g<h;g+=8)y[g>>5]|=(d[g/8]&255)<<g%32;return y}function i(d,h){const y=(d&65535)+(h&65535);return(d>>16)+(h>>16)+(y>>16)<<16|y&65535}function o(d,h){return d<<h|d>>>32-h}function a(d,h,y,g,m,b){return i(o(i(i(h,d),i(g,b)),m),y)}function f(d,h,y,g,m,b,w){return a(h&y|~h&g,d,h,m,b,w)}function c(d,h,y,g,m,b,w){return a(h&g|y&~g,d,h,m,b,w)}function l(d,h,y,g,m,b,w){return a(h^y^g,d,h,m,b,w)}function u(d,h,y,g,m,b,w){return a(y^(h|~g),d,h,m,b,w)}var p=e;return mc.default=p,mc}var s6;function dk(){if(s6)return yc;s6=1,Object.defineProperty(yc,"__esModule",{value:!0}),yc.default=void 0;var e=r(tw()),t=r(lk());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v3",48,t.default);return yc.default=s,yc}var vc={},bc={},a6;function fk(){if(a6)return bc;a6=1,Object.defineProperty(bc,"__esModule",{value:!0}),bc.default=void 0;var t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};return bc.default=t,bc}var o6;function hk(){if(o6)return vc;o6=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.default=void 0;var e=n(fk()),t=n(Q9()),r=Th();function n(o){return o&&o.__esModule?o:{default:o}}function s(o,a,f){if(e.default.randomUUID&&!a&&!o)return e.default.randomUUID();o=o||{};const c=o.random||(o.rng||t.default)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,a){f=f||0;for(let l=0;l<16;++l)a[f+l]=c[l];return a}return(0,r.unsafeStringify)(c)}var i=s;return vc.default=i,vc}var _c={},wc={},c6;function pk(){if(c6)return wc;c6=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.default=void 0;function e(s,i,o,a){switch(s){case 0:return i&o^~i&a;case 1:return i^o^a;case 2:return i&o^i&a^o&a;case 3:return i^o^a}}function t(s,i){return s<<i|s>>>32-i}function r(s){const i=[1518500249,1859775393,2400959708,3395469782],o=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof s=="string"){const l=unescape(encodeURIComponent(s));s=[];for(let u=0;u<l.length;++u)s.push(l.charCodeAt(u))}else Array.isArray(s)||(s=Array.prototype.slice.call(s));s.push(128);const a=s.length/4+2,f=Math.ceil(a/16),c=new Array(f);for(let l=0;l<f;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=s[l*64+p*4]<<24|s[l*64+p*4+1]<<16|s[l*64+p*4+2]<<8|s[l*64+p*4+3];c[l]=u}c[f-1][14]=(s.length-1)*8/Math.pow(2,32),c[f-1][14]=Math.floor(c[f-1][14]),c[f-1][15]=(s.length-1)*8&4294967295;for(let l=0;l<f;++l){const u=new Uint32Array(80);for(let m=0;m<16;++m)u[m]=c[l][m];for(let m=16;m<80;++m)u[m]=t(u[m-3]^u[m-8]^u[m-14]^u[m-16],1);let p=o[0],d=o[1],h=o[2],y=o[3],g=o[4];for(let m=0;m<80;++m){const b=Math.floor(m/20),w=t(p,5)+e(b,d,h,y)+g+i[b]+u[m]>>>0;g=y,y=h,h=t(d,30)>>>0,d=p,p=w}o[0]=o[0]+p>>>0,o[1]=o[1]+d>>>0,o[2]=o[2]+h>>>0,o[3]=o[3]+y>>>0,o[4]=o[4]+g>>>0}return[o[0]>>24&255,o[0]>>16&255,o[0]>>8&255,o[0]&255,o[1]>>24&255,o[1]>>16&255,o[1]>>8&255,o[1]&255,o[2]>>24&255,o[2]>>16&255,o[2]>>8&255,o[2]&255,o[3]>>24&255,o[3]>>16&255,o[3]>>8&255,o[3]&255,o[4]>>24&255,o[4]>>16&255,o[4]>>8&255,o[4]&255]}var n=r;return wc.default=n,wc}var u6;function yk(){if(u6)return _c;u6=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.default=void 0;var e=r(tw()),t=r(pk());function r(i){return i&&i.__esModule?i:{default:i}}var s=(0,e.default)("v5",80,t.default);return _c.default=s,_c}var Ec={},l6;function gk(){if(l6)return Ec;l6=1,Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.default=void 0;var e="00000000-0000-0000-0000-000000000000";return Ec.default=e,Ec}var Ac={},d6;function mk(){if(d6)return Ac;d6=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.default=void 0;var e=t(Ph());function t(s){return s&&s.__esModule?s:{default:s}}function r(s){if(!(0,e.default)(s))throw TypeError("Invalid UUID");return parseInt(s.slice(14,15),16)}var n=r;return Ac.default=n,Ac}var f6;function $2(){return f6||(f6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return o.default}});var t=l(uk()),r=l(dk()),n=l(hk()),s=l(yk()),i=l(gk()),o=l(mk()),a=l(Ph()),f=l(Th()),c=l(ew());function l(u){return u&&u.__esModule?u:{default:u}}}(Lp)),Lp}var Kp={},h6;function Nr(){return h6||(h6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VIDEO_NOTIFICATION_ACCESS_TYPE=e.DEFAULT_DOMAIN=e.SPACE_ROLES=e.SPACE_INVITE_ROLES=e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.VIDEO_CALL_TYPE=e.ADDITIONAL_META_TYPE=e.NOTIFICATION_TYPE=e.IDENTITY_TYPE=e.SUPPORTED_CHAINS=e.SOURCE_TYPES=e.CHAIN_ID_TO_SOURCE=void 0,e.CHAIN_ID_TO_SOURCE={1:"ETH_MAINNET",11155111:"ETH_TEST_SEPOLIA",137:"POLYGON_MAINNET",80002:"POLYGON_TEST_AMOY",56:"BSC_MAINNET",97:"BSC_TESTNET",10:"OPTIMISM_MAINNET",11155420:"OPTIMISM_TESTNET",2442:"POLYGON_ZK_EVM_TESTNET",1101:"POLYGON_ZK_EVM_MAINNET",421614:"ARBITRUM_TESTNET",42161:"ARBITRUMONE_MAINNET",122:"FUSE_MAINNET",123:"FUSE_TESTNET",80085:"BERACHAIN_TESTNET",59141:"LINEA_TESTNET",59144:"LINEA_MAINNET",7560:"CYBER_CONNECT_MAINNET",111557560:"CYBER_CONNECT_TESTNET",84532:"BASE_TESTNET",8453:"BASE_MAINNET"},e.SOURCE_TYPES={ETH_MAINNET:"ETH_MAINNET",ETH_TEST_SEPOLIA:"ETH_TEST_SEPOLIA",POLYGON_MAINNET:"POLYGON_MAINNET",POLYGON_TEST_AMOY:"POLYGON_TEST_AMOY",BSC_MAINNET:"BSC_MAINNET",BSC_TESTNET:"BSC_TESTNET",OPTIMISM_MAINNET:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON_ZK_EVM_TESTNET:"POLYGON_ZK_EVM_TESTNET",POLYGON_ZK_EVM_MAINNET:"POLYGON_ZK_EVM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",ARBITRUMONE_MAINNET:"ARBITRUMONE_MAINNET",FUSE_TESTNET:"FUSE_TESTNET",FUSE_MAINNET:"FUSE_MAINNET",BERACHAIN_TESTNET:"BERACHAIN_TESTNET",LINEA_TESTNET:"LINEA_TESTNET",LINEA_MAINNET:"LINEA_MAINNET",THE_GRAPH:"THE_GRAPH",PUSH_VIDEO:"PUSH_VIDEO",SIMULATE:"SIMULATE",CYBER_CONNECT_TESTNET:"CYBER_CONNECT_TESTNET",CYBER_CONNECT_MAINNET:"CYBER_CONNECT_MAINNET",BASE_TESTNET:"BASE_TESTNET",BASE_MAINNET:"BASE_MAINNET"},e.SUPPORTED_CHAINS=[1,11155111,42,137,80002,56,97,10,11155420,2442,1101,421614,42161,122,123,80085,111557560,7560,59141,59144,84532,8453],function(t){t[t.MINIMAL=0]="MINIMAL",t[t.IPFS=1]="IPFS",t[t.DIRECT_PAYLOAD=2]="DIRECT_PAYLOAD",t[t.SUBGRAPH=3]="SUBGRAPH"}(e.IDENTITY_TYPE||(e.IDENTITY_TYPE={})),function(t){t[t.BROADCAST=1]="BROADCAST",t[t.TARGETTED=3]="TARGETTED",t[t.SUBSET=4]="SUBSET"}(e.NOTIFICATION_TYPE||(e.NOTIFICATION_TYPE={})),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.ADDITIONAL_META_TYPE||(e.ADDITIONAL_META_TYPE={})),function(t){t[t.PUSH_VIDEO=1]="PUSH_VIDEO",t[t.PUSH_SPACE=2]="PUSH_SPACE"}(e.VIDEO_CALL_TYPE||(e.VIDEO_CALL_TYPE={})),function(t){t[t.JOIN_SPEAKER=0]="JOIN_SPEAKER",t[t.ESTABLISH_MESH=1]="ESTABLISH_MESH",t[t.INVITE_TO_PROMOTE=2]="INVITE_TO_PROMOTE",t[t.REQUEST_TO_PROMOTE=3]="REQUEST_TO_PROMOTE"}(e.SPACE_REQUEST_TYPE||(e.SPACE_REQUEST_TYPE={})),function(t){t[t.ACCEPT_JOIN_SPEAKER=0]="ACCEPT_JOIN_SPEAKER",t[t.ACCEPT_INVITE=1]="ACCEPT_INVITE",t[t.ACCEPT_PROMOTION=2]="ACCEPT_PROMOTION"}(e.SPACE_ACCEPT_REQUEST_TYPE||(e.SPACE_ACCEPT_REQUEST_TYPE={})),function(t){t[t.STOP=0]="STOP",t[t.LEAVE=1]="LEAVE"}(e.SPACE_DISCONNECT_TYPE||(e.SPACE_DISCONNECT_TYPE={})),function(t){t[t.CO_HOST=0]="CO_HOST",t[t.SPEAKER=1]="SPEAKER"}(e.SPACE_INVITE_ROLES||(e.SPACE_INVITE_ROLES={})),function(t){t[t.HOST=0]="HOST",t[t.CO_HOST=1]="CO_HOST",t[t.SPEAKER=2]="SPEAKER",t[t.LISTENER=3]="LISTENER"}(e.SPACE_ROLES||(e.SPACE_ROLES={})),e.DEFAULT_DOMAIN="push.org",function(t){t.PUSH_CHAT="PUSH_CHAT"}(e.VIDEO_NOTIFICATION_ACCESS_TYPE||(e.VIDEO_NOTIFICATION_ACCESS_TYPE={}))}(Kp)),Kp}var p6;function vk(){if(p6)return Ar;p6=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.getCAIPFormat=Ar.getSource=Ar.getPayloadIdentity=Ar.getVerificationProof=Ar.getRecipientFieldForAPIPayload=Ar.getRecipients=Ar.getPayloadForAPIInput=Ar.getUUID=void 0;const e=Ke,t=$2(),r=tt(),n=qr,s=Nr(),i=Mt();function o(){return(0,t.v4)()}Ar.getUUID=o;function a(h,y){var g,m,b,w,E,C,R,M,_,A,I,P,v,S,T,N,D,O,L,B,k;return h!=null&&h.notification&&(h!=null&&h.payload)?{notification:{title:(g=h==null?void 0:h.notification)===null||g===void 0?void 0:g.title,body:(m=h==null?void 0:h.notification)===null||m===void 0?void 0:m.body},data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({acta:((b=h==null?void 0:h.payload)===null||b===void 0?void 0:b.cta)||"",aimg:((w=h==null?void 0:h.payload)===null||w===void 0?void 0:w.img)||"",amsg:((E=h==null?void 0:h.payload)===null||E===void 0?void 0:E.body)||"",asub:((C=h==null?void 0:h.payload)===null||C===void 0?void 0:C.title)||"",type:((R=h==null?void 0:h.type)===null||R===void 0?void 0:R.toString())||""},(h==null?void 0:h.expiry)&&{etime:h==null?void 0:h.expiry}),((M=h==null?void 0:h.payload)===null||M===void 0?void 0:M.etime)&&{etime:(_=h==null?void 0:h.payload)===null||_===void 0?void 0:_.etime}),(h==null?void 0:h.hidden)&&{hidden:h==null?void 0:h.hidden}),((A=h==null?void 0:h.payload)===null||A===void 0?void 0:A.hidden)&&{hidden:(I=h==null?void 0:h.payload)===null||I===void 0?void 0:I.hidden}),((P=h==null?void 0:h.payload)===null||P===void 0?void 0:P.silent)&&{silent:(v=h==null?void 0:h.payload)===null||v===void 0?void 0:v.silent}),((S=h==null?void 0:h.payload)===null||S===void 0?void 0:S.sectype)&&{sectype:(T=h==null?void 0:h.payload)===null||T===void 0?void 0:T.sectype}),((N=h==null?void 0:h.payload)===null||N===void 0?void 0:N.metadata)&&{metadata:(D=h==null?void 0:h.payload)===null||D===void 0?void 0:D.metadata}),((O=h==null?void 0:h.payload)===null||O===void 0?void 0:O.additionalMeta)&&{additionalMeta:(L=h==null?void 0:h.payload)===null||L===void 0?void 0:L.additionalMeta}),((B=h==null?void 0:h.payload)===null||B===void 0?void 0:B.index)&&{index:(k=h==null?void 0:h.payload)===null||k===void 0?void 0:k.index}),recipients:y}:null}Ar.getPayloadForAPIInput=a;function f({env:h,notificationType:y,channel:g,recipients:m,secretType:b}){return e.__awaiter(this,void 0,void 0,function*(){let w="";if(b){let E="";if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof m=="string")return w=yield(0,r.getCAIPAddress)(h,m,"Recipient"),E="",{[w]:E}}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(m))return m.reduce((R,M)=>e.__awaiter(this,void 0,void 0,function*(){return w=yield(0,r.getCAIPAddress)(h,M,"Recipient"),E="",Object.assign(Object.assign({},R),{[w]:E})}),{})}else{if(y===s.NOTIFICATION_TYPE.BROADCAST)return yield(0,r.getCAIPAddress)(h,g,"Recipient");if(y===s.NOTIFICATION_TYPE.TARGETTED){if(typeof m=="string")return yield(0,r.getCAIPAddress)(h,m,"Recipient")}else if(y===s.NOTIFICATION_TYPE.SUBSET&&Array.isArray(m)&&Array.isArray(m)){const E={};return m.map(C=>e.__awaiter(this,void 0,void 0,function*(){w=yield(0,r.getCAIPAddress)(h,C,"Recipient"),E[w]=null})),E}}return m})}Ar.getRecipients=f;function c({env:h,notificationType:y,recipients:g,channel:m}){return e.__awaiter(this,void 0,void 0,function*(){return y===s.NOTIFICATION_TYPE.TARGETTED&&typeof g=="string"?yield(0,r.getCAIPAddress)(h,g,"Recipient"):yield(0,r.getCAIPAddress)(h,m,"Recipient")})}Ar.getRecipientFieldForAPIPayload=c;function l({senderType:h,signer:y,chainId:g,notificationType:m,identityType:b,verifyingContract:w,payload:E,ipfsHash:C,graph:R={},uuid:M,chatId:_,wallet:A,pgpPrivateKey:I,env:P,rules:v}){return e.__awaiter(this,void 0,void 0,function*(){let S=null,T=null;switch(b){case s.IDENTITY_TYPE.MINIMAL:{S={data:`${b}+${m}+${E.notification.title}+${E.notification.body}`};break}case s.IDENTITY_TYPE.IPFS:{S={data:`1+${C}`};break}case s.IDENTITY_TYPE.DIRECT_PAYLOAD:{S={data:`2+${JSON.stringify(E)}`};break}case s.IDENTITY_TYPE.SUBGRAPH:{S={data:`3+graph:${R==null?void 0:R.id}+${R==null?void 0:R.counter}`};break}default:throw new Error("Invalid IdentityType")}switch(h){case 0:{if(I){const N=n.SHA256(JSON.stringify(S)).toString();T=`pgpv4:${yield(0,i.sign)({message:N,signingKey:I})}`}else{const N={Data:[{name:"data",type:"string"}]},D={name:"EPNS COMM V1",chainId:g,verifyingContract:w};T=`eip712v2:${yield new r.Signer(y).signTypedData(D,N,S,"Data")}::uid::${M}`}break}case 1:{const N=n.SHA256(JSON.stringify(S)).toString();T=`pgpv2:${yield(0,i.sign)({message:N,signingKey:I})}:meta:${_}::uid::${M}`;break}default:throw new Error("Invalid SenderType")}return T})}Ar.getVerificationProof=l;function u({identityType:h,payload:y,notificationType:g,ipfsHash:m,graph:b={}}){return h===s.IDENTITY_TYPE.MINIMAL?`0+${g}+${y.notification.title}+${y.notification.body}`:h===s.IDENTITY_TYPE.IPFS?`1+${m}`:h===s.IDENTITY_TYPE.DIRECT_PAYLOAD?`2+${JSON.stringify(y)}`:h===s.IDENTITY_TYPE.SUBGRAPH?`3+graph:${b==null?void 0:b.id}+${b==null?void 0:b.counter}`:null}Ar.getPayloadIdentity=u;function p(h,y,g){return g===1?s.SOURCE_TYPES.PUSH_VIDEO:y===s.IDENTITY_TYPE.SUBGRAPH?s.SOURCE_TYPES.THE_GRAPH:s.CHAIN_ID_TO_SOURCE[h]}Ar.getSource=p;function d(h,y){return s.SUPPORTED_CHAINS.includes(h)?`eip155:${h}:${y}`:y}return Ar.getCAIPFormat=d,Ar}var y6;function bk(){if(y6)return dc;y6=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.sendNotification=void 0;const e=Ke,t=vk(),r=tt(),n=Nr(),s=Je(),i=Tt();function o(c){var l,u;if(!(c!=null&&c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is mandatory!';if(!(0,r.isValidPushCAIP)(c.channel))throw'[Push SDK] - Error - sendNotification() - "channel" is invalid!';if(c.senderType===0&&c.signer===void 0)throw'[Push SDK] - Error - sendNotification() - "signer" is mandatory!';if(c.senderType===1&&c.pgpPrivateKey===void 0)throw'[Push SDK] - Error - sendNotification() - "pgpPrivateKey" is mandatory!';if((c==null?void 0:c.identityType)===n.IDENTITY_TYPE.DIRECT_PAYLOAD||(c==null?void 0:c.identityType)===n.IDENTITY_TYPE.MINIMAL){if(!c.notification)throw'[Push SDK] - Error - sendNotification() - "notification" mandatory for Identity Type: Direct Payload, Minimal!';if(!c.payload)throw'[Push SDK] - Error - sendNotification() - "payload" mandatory for Identity Type: Direct Payload, Minimal!'}const p=(l=c.payload)===null||l===void 0?void 0:l.additionalMeta,d=typeof((u=c.payload)===null||u===void 0?void 0:u.additionalMeta)=="object"&&(c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_VIDEO}+1`||c.payload.additionalMeta.type===`${n.VIDEO_CALL_TYPE.PUSH_SPACE}+1`);if(p&&d&&!c.chatId&&!c.rules)throw new Error("[Push SDK] - Error - sendNotification() - Either chatId or rules object is required to send a additional meta notification for video or spaces")}function a(c){return e.__awaiter(this,void 0,void 0,function*(){try{const{channelFound:l,channelorAlias:u,recipient:p,type:d,env:h,senderType:y}=c||{};if(y===1||l)return!1;const g=typeof p=="string"&&(p==null?void 0:p.split(":").length)==3?p.split(":")[2]:p;return u==g&&d==n.NOTIFICATION_TYPE.TARGETTED}catch{return!0}})}function f(c){var l;return e.__awaiter(this,void 0,void 0,function*(){try{const{senderType:u=0,signer:p,type:d,identityType:h,payload:y,recipients:g,channel:m,graph:b,ipfsHash:w,env:E=s.ENV.PROD,chatId:C,rules:R,pgpPrivateKey:M,channelFound:_=!0}=c||{};o(c),y&&y.additionalMeta&&typeof y.additionalMeta=="object"&&!y.additionalMeta.domain&&(y.additionalMeta.domain=n.DEFAULT_DOMAIN);const A=yield(0,r.getCAIPAddress)(E,m,"Channel"),I=(0,r.getCAIPDetails)(A);if(!I)throw Error("Invalid Channel CAIP!");const P=(0,t.getUUID)(),v=parseInt(I.networkId,10),S=(0,r.getAPIBaseUrls)(E);let T="";if(u===0){const{EPNS_COMMUNICATOR_CONTRACT:W}=(0,r.getConfig)(E,I);T=W}const N=yield(0,t.getRecipients)({env:E,notificationType:d,channel:A,recipients:g,secretType:y==null?void 0:y.sectype}),D=(0,t.getPayloadForAPIInput)(c,N),O=yield(0,t.getVerificationProof)({senderType:u,signer:p,chainId:v,identityType:h,notificationType:d,verifyingContract:T,payload:D,graph:b,ipfsHash:w,uuid:P,chatId:(l=R==null?void 0:R.access.data.chatId)!==null&&l!==void 0?l:C,pgpPrivateKey:M}),L=(0,t.getPayloadIdentity)({identityType:h,payload:D,notificationType:d,graph:b,ipfsHash:w}),B=(yield a({channelFound:_,channelorAlias:c.channel,recipient:c.recipients,type:c.type,env:c.env,senderType:c.senderType}))?n.SOURCE_TYPES.SIMULATE:(0,t.getSource)(v,h,u),k=Object.assign({verificationProof:O,identity:L,sender:u===1&&!(0,r.isValidNFTCAIP)(A)?`${I==null?void 0:I.blockchain}:${I==null?void 0:I.address}`:A,source:B,recipient:yield(0,t.getRecipientFieldForAPIPayload)({env:E,notificationType:d,recipients:g||"",channel:A})},R||C?{rules:R??{access:{data:{chatId:C},type:n.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT}}}:{}),q=`${S}/v1/payloads/`;return yield(0,i.axiosPost)(q,k,{headers:{"Content-Type":"application/json"}})}catch(u){throw console.error("[Push SDK] - Error - sendNotification() - ",JSON.stringify(u)),u}})}return dc.sendNotification=f,dc}var g6;function Ih(){return g6||(g6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SPACE_DISCONNECT_TYPE=e.SPACE_ACCEPT_REQUEST_TYPE=e.SPACE_REQUEST_TYPE=e.ADDITIONAL_META_TYPE=e.IDENTITY_TYPE=e.NOTIFICATION_TYPE=void 0,Ke.__exportStar(bk(),e);var r=Nr();Object.defineProperty(e,"NOTIFICATION_TYPE",{enumerable:!0,get:function(){return r.NOTIFICATION_TYPE}}),Object.defineProperty(e,"IDENTITY_TYPE",{enumerable:!0,get:function(){return r.IDENTITY_TYPE}}),Object.defineProperty(e,"ADDITIONAL_META_TYPE",{enumerable:!0,get:function(){return r.ADDITIONAL_META_TYPE}}),Object.defineProperty(e,"SPACE_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_ACCEPT_REQUEST_TYPE",{enumerable:!0,get:function(){return r.SPACE_ACCEPT_REQUEST_TYPE}}),Object.defineProperty(e,"SPACE_DISCONNECT_TYPE",{enumerable:!0,get:function(){return r.SPACE_DISCONNECT_TYPE}})}(Bp)),Bp}var m6;function _k(){if(m6)return Pd;m6=1,Object.defineProperty(Pd,"__esModule",{value:!0});const e=Ke,t=tt(),r=Ih(),n=Je(),s=Nr(),i=({signer:o,chainId:a,pgpPrivateKey:f},{recipientAddress:c,senderAddress:l,chatId:u,rules:p,status:d,signalData:h=null,env:y=n.default.ENV.PROD,callType:g=s.VIDEO_CALL_TYPE.PUSH_VIDEO,callDetails:m})=>e.__awaiter(void 0,void 0,void 0,function*(){var b;try{const w={recipientAddress:c,senderAddress:l,chatId:(b=p==null?void 0:p.access.data.chatId)!==null&&b!==void 0?b:u,signalData:h,status:d,callDetails:m},E=(0,t.getCAIPWithChainId)(l,a),C=(0,t.getCAIPWithChainId)(c,a),R=`Video Call from ${l}`,M=s.NOTIFICATION_TYPE.TARGETTED;yield(0,r.sendNotification)({senderType:1,signer:o,pgpPrivateKey:f,chatId:u,rules:p,type:M,identityType:2,notification:{title:R,body:R},payload:{title:"VideoCall",body:"VideoCall",cta:"",img:"",additionalMeta:{type:`${g}+1`,data:JSON.stringify(w)}},recipients:C,channel:E,env:y})}catch(w){console.error("Error occured while sending notification for video call",w)}});return Pd.default=i,Pd}var _n={},v6;function rw(){if(v6)return _n;v6=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.endStream=_n.stopAudioStream=_n.restartAudioStream=_n.stopVideoStream=_n.restartVideoStream=void 0;const e=i=>{i.getVideoTracks().forEach(a=>a.enabled=!0)};_n.restartVideoStream=e;const t=i=>{i.getVideoTracks().forEach(a=>a.enabled=!1)};_n.stopVideoStream=t;const r=i=>{i.getAudioTracks().forEach(a=>a.enabled=!0)};_n.restartAudioStream=r;const n=i=>{i.getAudioTracks().forEach(a=>a.enabled=!1)};_n.stopAudioStream=n;const s=i=>{i.getTracks().forEach(o=>o.stop())};return _n.endStream=s,_n}var Id={},b6;function wk(){if(b6)return Id;b6=1,Object.defineProperty(Id,"__esModule",{value:!0});const e=t=>{try{return JSON.parse(t)&&!!t}catch{return!1}};return Id.default=e,Id}var Sc={},_6;function Ek(){if(_6)return Sc;_6=1,Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.getIceServerConfig=void 0;const e=Ke,t=tt(),r=Je(),n=qr,s=Tt(),i="turnserversecret",o=(a=r.default.ENV.PROD)=>e.__awaiter(void 0,void 0,void 0,function*(){const c=`${(0,t.getAPIBaseUrls)(a)}/v1/turnserver/iceconfig`,{data:l}=yield(0,s.axiosGet)(c),{config:u}=JSON.parse(n.AES.decrypt(l,i).toString(n.enc.Utf8));return u});return Sc.getIceServerConfig=o,Sc}var Cd={},w6;function nw(){if(w6)return Cd;w6=1,Object.defineProperty(Cd,"__esModule",{value:!0});const e=(t,r)=>t.findIndex(n=>n.address===r);return Cd.default=e,Cd}var Rd={},E6;function Ak(){if(E6)return Rd;E6=1,Object.defineProperty(Rd,"__esModule",{value:!0});const e=K2(),t=dn(),r=({incomingPeers:n})=>{const s=[];return n.forEach(i=>{i.status===t.VideoCallStatus.CONNECTED&&s.push((0,e.default)(i.address))}),s};return Rd.default=r,Rd}var kd={},A6;function Sk(){if(A6)return kd;A6=1,Object.defineProperty(kd,"__esModule",{value:!0});const e=({localAddress:t,localConnectedAddresses:r,receivedConnectedAddresses:n})=>n.filter(s=>!r.includes(s)&&s!==t);return kd.default=e,kd}var Pc={},S6;function Pk(){if(S6)return Pc;S6=1,Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.validateVideoRules=void 0;const e=Nr(),t=r=>{if(r.access.type===e.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&(!r.access.data.chatId||r.access.data.chatId===""))throw new Error("Invalid rules object recieved. For access as Push Chat, chatId is required!")};return Pc.validateVideoRules=t,Pc}var P6;function iw(){return P6||(P6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Video=e.initVideoCallData=void 0;const t=Ke,r=ok(),n=ei(),s=Je(),i=_k(),o=rw(),a=wk(),f=Ek(),c=dn(),l=nw(),u=Ak(),p=Sk(),d=Nr(),h=Pk();e.initVideoCallData={meta:{chatId:"",initiator:{address:"",signal:null},broadcast:{livepeerInfo:null,hostAddress:"",coHostAddress:""}},local:{stream:null,audio:null,video:null,address:""},incoming:[{stream:null,audio:null,video:null,address:"",status:c.VideoCallStatus.UNINITIALIZED,retryCount:0}]};class y{constructor({signer:m,chainId:b,pgpPrivateKey:w,env:E=s.default.ENV.PROD,setData:C,callType:R=d.VIDEO_CALL_TYPE.PUSH_VIDEO,onReceiveStream:M=()=>t.__awaiter(this,void 0,void 0,function*(){return Promise.resolve()})}){this.peerInstances={},this.signer=m,this.chainId=b,this.pgpPrivateKey=w,this.env=E,this.callType=R,this.onReceiveStream=M,C(()=>e.initVideoCallData),this.data=e.initVideoCallData,this.setData=function(_){C(_),this.data=_(this.data)}}create(m){return t.__awaiter(this,void 0,void 0,function*(){const{audio:b=!0,video:w=!0,stream:E=null}=m||{};try{const C=E!==null?E:yield navigator.mediaDevices.getUserMedia({video:w,audio:b});this.setData(R=>(0,n.produce)(R,M=>{M.local.stream=C,M.local.video=w,M.local.audio=b}))}catch(C){console.error("error in create",C)}})}request(m){return t.__awaiter(this,void 0,void 0,function*(){const{senderAddress:b,recipientAddress:w,chatId:E,rules:C,onReceiveMessage:R,retry:M=!1,details:_}=m||{};C&&(0,h.validateVideoRules)(C);const A=Array.isArray(w)?w:[w];for(const I of A)try{this.setData(v=>(0,n.produce)(v,S=>{S.local.address=b,S.meta.chatId=E??C.access.data.chatId,S.meta.initiator.address=b;const T=(0,l.default)(v.incoming,I);T===-1?S.incoming.push({stream:null,audio:null,video:null,address:I,status:M?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:M?1:0}):(S.incoming[T].address=I,S.incoming[T].status=M?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,S.incoming[T].retryCount+=M?1:0)}));const P=yield(0,f.getIceServerConfig)(this.env);this.peerInstances[I]=new r({initiator:!0,trickle:!1,stream:this.data.local.stream,config:{iceServers:P}}),this.peerInstances[I].on("signal",v=>{this.setData(S=>(0,n.produce)(S,T=>{T.meta.initiator.signal=v})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:b,recipientAddress:I,status:M?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,chatId:E,rules:C,signalData:v,env:this.env,callType:this.callType,callDetails:_})}),this.peerInstances[I].on("connect",()=>{this.peerInstances[I].send(`initial message from ${b}`),this.peerInstances[I].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[I].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const v=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[I].send(JSON.stringify({type:"connectedAddresses",value:v}))}),this.peerInstances[I].on("data",v=>{var S,T,N,D,O;if((0,a.default)(v)){const L=JSON.parse(v);if(L.type==="connectedAddresses"){const B=L.value,k=(0,u.default)({incomingPeers:this.data.incoming}),q=(0,p.default)({localAddress:b,localConnectedAddresses:k,receivedConnectedAddresses:B});this.request({senderAddress:b,recipientAddress:q,chatId:E,rules:C,details:{type:d.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(L.type==="isVideoOn"&&this.setData(B=>(0,n.produce)(B,k=>{const q=(0,l.default)(B.incoming,I);k.incoming[q].video=L.value})),L.type==="isAudioOn"&&this.setData(B=>(0,n.produce)(B,k=>{const q=(0,l.default)(B.incoming,I);k.incoming[q].audio=L.value})),L.type==="endCall"){if(this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((S=L==null?void 0:L.details)===null||S===void 0?void 0:S.type)===d.SPACE_DISCONNECT_TYPE.LEAVE&&((T=this.peerInstances[I])===null||T===void 0||T.destroy(),this.peerInstances[I]=null,this.setData(B=>(0,n.produce)(B,k=>{const q=(0,l.default)(B.incoming,I);k.incoming.splice(q,1)}))),this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((N=L==null?void 0:L.details)===null||N===void 0?void 0:N.type)===d.SPACE_DISCONNECT_TYPE.STOP){for(const B in this.peerInstances)(D=this.peerInstances[B])===null||D===void 0||D.destroy(),this.peerInstances[B]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===d.VIDEO_CALL_TYPE.PUSH_VIDEO&&((O=this.peerInstances[I])===null||O===void 0||O.destroy(),this.peerInstances[I]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else R&&R(v)}),this.peerInstances[I].on("stream",v=>{const S=(0,l.default)(this.data.incoming,I);this.onReceiveStream(v,I,this.data.incoming[S].audio),this.setData(T=>(0,n.produce)(T,N=>{N.incoming[S].stream=v}))})}catch(P){console.error("error in request",P)}})}acceptRequest(m){return t.__awaiter(this,void 0,void 0,function*(){const{signalData:b,senderAddress:w,recipientAddress:E,chatId:C,rules:R,onReceiveMessage:M,retry:_=!1,details:A}=m||{};R&&(0,h.validateVideoRules)(R);try{if(this.peerInstances[E])return Promise.resolve();const I=yield(0,f.getIceServerConfig)(this.env);this.peerInstances[E]=new r({initiator:!1,trickle:!1,stream:this.data.local.stream,config:{iceServers:I}}),this.setData(P=>(0,n.produce)(P,v=>{v.local.address=w,v.meta.chatId=C??R.access.data.chatId,v.meta.initiator.address=w;const S=(0,l.default)(P.incoming,E);S===-1?v.incoming.push({stream:null,audio:null,video:null,address:E,status:_?c.VideoCallStatus.RETRY_INITIALIZED:c.VideoCallStatus.INITIALIZED,retryCount:_?1:0}):(v.incoming[S].address=E,v.incoming[S].status=_?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,v.incoming[S].retryCount+=_?1:0)})),this.peerInstances[E].on("error",P=>{this.data.incoming[0].retryCount>=5&&this.disconnect({peerAddress:E}),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:w,recipientAddress:E,status:c.VideoCallStatus.RETRY_INITIALIZED,chatId:C,rules:R,signalData:null,callType:this.callType,env:this.env})}),this.peerInstances[E].signal(b),this.peerInstances[E].on("signal",P=>{this.setData(v=>(0,n.produce)(v,S=>{S.meta.initiator.signal=P})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:w,recipientAddress:E,status:_?c.VideoCallStatus.RETRY_RECEIVED:c.VideoCallStatus.RECEIVED,chatId:C,rules:R,signalData:P,env:this.env,callType:this.callType,callDetails:A})}),this.peerInstances[E].on("connect",()=>{this.peerInstances[E].send(JSON.stringify({type:"isVideoOn",value:this.data.local.video})),this.peerInstances[E].send(JSON.stringify({type:"isAudioOn",value:this.data.local.audio}));const P=(0,u.default)({incomingPeers:this.data.incoming});this.peerInstances[E].send(JSON.stringify({type:"connectedAddresses",value:P})),this.setData(v=>(0,n.produce)(v,S=>{const T=(0,l.default)(v.incoming,E);S.incoming[T].status=c.VideoCallStatus.CONNECTED}))}),this.peerInstances[E].on("data",P=>{var v,S,T,N,D;if((0,a.default)(P)){const O=JSON.parse(P);if(O.type==="connectedAddresses"){const L=O.value,B=(0,u.default)({incomingPeers:this.data.incoming}),k=(0,p.default)({localAddress:w,localConnectedAddresses:B,receivedConnectedAddresses:L});this.request({senderAddress:w,recipientAddress:k,chatId:C,rules:R,details:{type:d.SPACE_REQUEST_TYPE.ESTABLISH_MESH,data:{}}})}if(O.type==="isVideoOn"&&this.setData(L=>(0,n.produce)(L,B=>{const k=(0,l.default)(L.incoming,E);B.incoming[k].video=O.value})),O.type==="isAudioOn"&&this.setData(L=>(0,n.produce)(L,B=>{const k=(0,l.default)(L.incoming,E);B.incoming[k].audio=O.value})),O.type==="endCall"){if(this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((v=O==null?void 0:O.details)===null||v===void 0?void 0:v.type)===d.SPACE_DISCONNECT_TYPE.LEAVE&&((S=this.peerInstances[E])===null||S===void 0||S.destroy(),this.peerInstances[E]=null,this.setData(L=>(0,n.produce)(L,B=>{const k=(0,l.default)(L.incoming,E);B.incoming.splice(k,1)}))),this.callType===d.VIDEO_CALL_TYPE.PUSH_SPACE&&((T=O==null?void 0:O.details)===null||T===void 0?void 0:T.type)===d.SPACE_DISCONNECT_TYPE.STOP){for(const L in this.peerInstances)(N=this.peerInstances[L])===null||N===void 0||N.destroy(),this.peerInstances[L]=null;this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}this.callType===d.VIDEO_CALL_TYPE.PUSH_VIDEO&&((D=this.peerInstances[E])===null||D===void 0||D.destroy(),this.peerInstances[E]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData))}}else M&&M(P)}),this.peerInstances[E].on("stream",P=>{const v=(0,l.default)(this.data.incoming,E);this.onReceiveStream(P,E,this.data.incoming[v].audio),this.setData(S=>(0,n.produce)(S,T=>{T.incoming[v].stream=P}))})}catch(I){console.error("error in accept request",I)}})}connect(m){var b;const{peerAddress:w,signalData:E}=m||{};try{w||console.warn("disconnect requires a peer address"),this.peerInstances[w||this.data.incoming[0].address].on("error",C=>{const R=w?(0,l.default)(this.data.incoming,w):0;this.data.incoming[R].retryCount>=5&&this.disconnect({peerAddress:w||this.data.incoming[0].address}),this.request({senderAddress:this.data.local.address,recipientAddress:this.data.incoming[R].address,chatId:this.data.meta.chatId,retry:!0})}),(b=this.peerInstances[w||this.data.incoming[0].address])===null||b===void 0||b.signal(E),this.setData(C=>(0,n.produce)(C,R=>{const M=w?(0,l.default)(C.incoming,w):0;R.incoming[M].status=c.VideoCallStatus.CONNECTED})),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:w||this.data.incoming[0].address,status:c.VideoCallStatus.CONNECTED,rules:{access:{type:d.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:this.data.meta.chatId}}},signalData:E,env:this.env})}catch(C){console.error("error in connect",C)}}disconnect(m){var b,w,E;const{peerAddress:C,details:R}=m||{};try{m!=null&&m.peerAddress||console.warn("disconnect requires a peer address");const M=C?(0,l.default)(this.data.incoming,C):0,_=this.data.incoming[M].status===c.VideoCallStatus.CONNECTED;_&&((b=this.peerInstances[C||this.data.incoming[0].address])===null||b===void 0||b.send(JSON.stringify({type:"endCall",value:!0,details:R})),(w=this.peerInstances[C||this.data.incoming[0].address])===null||w===void 0||w.destroy()),(0,i.default)({signer:this.signer,chainId:this.chainId,pgpPrivateKey:this.pgpPrivateKey},{senderAddress:this.data.local.address,recipientAddress:this.data.incoming[M].address,status:_?c.VideoCallStatus.ENDED:c.VideoCallStatus.DISCONNECTED,chatId:this.data.meta.chatId,signalData:null,env:this.env,callType:this.callType,callDetails:R}),(E=this.peerInstances[C||this.data.incoming[0].address])===null||E===void 0||E.destroy(),this.peerInstances[C||this.data.incoming[0].address]=null,this.data.local.stream&&(0,o.endStream)(this.data.local.stream),this.setData(()=>e.initVideoCallData)}catch(M){console.error("error in disconnect",M)}}enableVideo(m){var b;const{state:w}=m||{};if(this.data.local.video!==w){for(const E of this.data.incoming)E.status===c.VideoCallStatus.CONNECTED&&((b=this.peerInstances[E.address])===null||b===void 0||b.send(JSON.stringify({type:"isVideoOn",value:w})));this.data.local.stream&&(w?(0,o.restartVideoStream)(this.data.local.stream):(0,o.stopVideoStream)(this.data.local.stream),this.setData(E=>(0,n.produce)(E,C=>{C.local.video=w})))}}enableAudio(m){const{state:b}=m||{};if(this.data.local.audio!==b){for(const w of this.data.incoming)if(w.status===c.VideoCallStatus.CONNECTED&&this.peerInstances[w.address])try{this.peerInstances[w.address].send(JSON.stringify({type:"isAudioOn",value:b}))}catch(E){console.error("Error sending data:",E)}this.data.local.stream&&(b?(0,o.restartAudioStream)(this.data.local.stream):(0,o.stopAudioStream)(this.data.local.stream),this.setData(w=>(0,n.produce)(w,E=>{E.local.audio=b})))}}isInitiator(){return this.data.meta.initiator.address===""||this.data.local.address===""?!1:this.data.meta.initiator.address===this.data.local.address}}e.Video=y}(Op)),Op}var T6;function V2(){return T6||(T6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ke.__exportStar(iw(),e)}(Mp)),Mp}var Tc={},I6;function Tk(){if(I6)return Tc;I6=1,Object.defineProperty(Tc,"__esModule",{value:!0}),Tc.update=void 0;const e=Ke,t=dn(),r=Mt(),n=Kl(),s=Bs();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{spaceName:a,spaceImage:f,spaceDescription:c,scheduleAt:l,scheduleEnd:u,meta:p}=o||{};try{const d=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env}),h=(0,r.getSpacesMembersList)(d.members,d.pendingMembers),y=(0,r.getSpaceAdminsList)(d.members,d.pendingMembers);if(d.status===t.ChatStatus.ACTIVE&&l)throw new Error("Unable change the start date/time of an active space");if(d.status===t.ChatStatus.ENDED&&u)throw new Error("Unable change the end date/time of an ended space");const g=yield(0,n.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a||d.spaceName,groupImage:f||d.spaceImage,groupDescription:c||d.spaceDescription,members:h,admins:y,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l||d.scheduleAt,scheduleEnd:u||d.scheduleEnd,meta:p||d.meta});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(g)),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(d){throw console.error(`[Push SDK] - API - Error - API ${i.name} -: `,d),Error(`[Push SDK] - API - Error - API ${i.name} -: ${d}`)}})}return Tc.update=i,Tc}var Ic={},Md={},C6;function yo(){if(C6)return Md;C6=1,Object.defineProperty(Md,"__esModule",{value:!0});const e=Ke,t=Xn(),r=Je(),n=({liveSpaceData:s,action:i,spaceId:o,pgpPrivateKey:a,signer:f,env:c})=>e.__awaiter(void 0,void 0,void 0,function*(){yield(0,t.send)({receiverAddress:o,pgpPrivateKey:a,env:c,signer:f,messageType:r.MessageType.META,messageObj:{content:i,info:{affected:[],arbitrary:s}}})});return Md.default=n,Md}var R6;function Ik(){if(R6)return Ic;R6=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.start=void 0;const e=Ke,t=dn(),r=Mt(),n=Bs(),s=Kl(),i=ei(),o=tt(),a=Ia(),f=yo();function c(){return e.__awaiter(this,void 0,void 0,function*(){try{!this.data.local.stream&&(yield this.create({audio:!0,video:!1}));const l=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(l.status!==t.ChatStatus.PENDING)throw new Error("Unable to start the space as it is not in the pending state");if(this.data.local.address!==(0,o.pCAIP10ToWallet)(l.spaceCreator))throw new Error("Only host is allowed to start a space");const u=(0,r.getSpacesMembersList)(l.members,l.pendingMembers),p=(0,r.getSpaceAdminsList)(l.members,l.pendingMembers),d=yield(0,s.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:l.spaceName,groupImage:l.spaceImage,groupDescription:l.spaceDescription,members:u,admins:p,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:l.scheduleAt,scheduleEnd:l.scheduleEnd,status:t.ChatStatus.ACTIVE}),h={host:{address:this.data.local.address,audio:this.data.local.audio,emojiReactions:null},coHosts:[],speakers:[],listeners:[]};yield(0,f.default)({liveSpaceData:h,action:a.CHAT.META.SPACE.CREATE,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,env:this.env}),this.setSpaceData(y=>(0,i.produce)(y,g=>{g=Object.assign(Object.assign({},(0,r.groupDtoToSpaceDto)(d)),{liveSpaceData:h,connectionData:g.connectionData}),g.connectionData.meta.broadcast={livepeerInfo:null,hostAddress:this.data.local.address}}))}catch(l){throw console.error(`[Push SDK] - API - Error - API ${c.name} -: `,l),Error(`[Push SDK] - API - Error - API ${c.name} -: ${l}`)}})}return Ic.start=c,Ic}var Cc={},k6;function Ck(){if(k6)return Cc;k6=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.inviteToPromote=void 0;const e=Ke,t=ei(),r=Nr();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{inviteeAddress:i,role:o}=s||{};this.setSpaceSpecificData(a=>(0,t.produce)(a,f=>{f.inviteeDetails&&(f.inviteeDetails[i]=o)})),this.request({senderAddress:this.data.local.address,recipientAddress:i,chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.INVITE_TO_PROMOTE,data:{role:o}}})})}return Cc.inviteToPromote=n,Cc}var Rc={},M6;function Rk(){if(M6)return Rc;M6=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.acceptPromotionInvite=void 0;const e=Ke,t=Nr();function r(n){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:s,invitorAddress:i,spaceId:o}=n||{};this.acceptRequest({signalData:s,senderAddress:this.data.local.address,recipientAddress:i,chatId:o,details:{type:t.SPACE_ACCEPT_REQUEST_TYPE.ACCEPT_INVITE,data:{}}})})}return Rc.acceptPromotionInvite=r,Rc}var kc={},O6;function kk(){if(O6)return kc;O6=1,Object.defineProperty(kc,"__esModule",{value:!0}),kc.connectInvitee=void 0;const e=Ke,t=ei(),r=q2();function n(s){var i;return e.__awaiter(this,void 0,void 0,function*(){const{signalData:o,inviteeAddress:a}=s||{};if(!(!((i=this.spaceSpecificData)===null||i===void 0)&&i.inviteeDetails)||!Object.keys(this.spaceSpecificData.inviteeDetails).includes(a))return Promise.resolve();this.spaceSpecificData.inviteeDetails[a],this.setSpaceSpecificData(f=>(0,t.produce)(f,c=>{c.inviteeDetails&&delete c.inviteeDetails[a]})),yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[a]}),this.connect({signalData:o,peerAddress:a})})}return kc.connectInvitee=n,kc}var Mc={},N6;function Mk(){if(N6)return Mc;N6=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.rejectPromotionInvite=void 0;const e=Ke;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{invitorAddress:n}=r||{};this.disconnect({peerAddress:n})})}return Mc.rejectPromotionInvite=t,Mc}var Oc={},D6;function Ok(){if(D6)return Oc;D6=1,Object.defineProperty(Oc,"__esModule",{value:!0}),Oc.requestToBePromoted=void 0;const e=Ke,t=tt(),r=Nr();function n(s){return e.__awaiter(this,void 0,void 0,function*(){const{role:i,promotorAddress:o}=s||{};this.request({senderAddress:this.data.local.address,recipientAddress:(0,t.pCAIP10ToWallet)(o),chatId:this.spaceSpecificData.spaceId,details:{type:r.SPACE_REQUEST_TYPE.REQUEST_TO_PROMOTE,data:{role:i}}})})}return Oc.requestToBePromoted=n,Oc}var Nc={},x6;function Nk(){if(x6)return Nc;x6=1,Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.acceptPromotionRequest=void 0;const e=Ke,t=ei(),r=q2(),n=yo(),s=tt(),i=dn();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:f,promoteeAddress:c,spaceId:l,role:u}=a||{};yield(0,r.addSpeakers)({spaceId:this.spaceSpecificData.spaceId,signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,speakers:[(0,s.pCAIP10ToWallet)(c)],env:this.env});const p=(0,t.produce)(this.spaceSpecificData.liveSpaceData,d=>{const h=this.spaceSpecificData.liveSpaceData.listeners.findIndex(y=>(0,s.pCAIP10ToWallet)(y.address)===(0,s.pCAIP10ToWallet)(c));d.listeners.splice(h,1),d.speakers.push({address:(0,s.pCAIP10ToWallet)(c),emojiReactions:null,audio:null})});yield(0,n.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:p,action:i.CHAT.META.SPACE.SPEAKER.PRVILEGE})})}return Nc.acceptPromotionRequest=o,Nc}var Dc={},U6;function Dk(){if(U6)return Dc;U6=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.rejectPromotionRequest=void 0;const e=Ke,t=ei(),r=yo(),n=Ia(),s=tt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{};this.disconnect({peerAddress:(0,s.pCAIP10ToWallet)(a)});const f=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>u.address===(0,s.pCAIP10ToWallet)(a));l>-1&&(c.listeners[l].handRaised=!1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:f})),yield(0,r.default)({liveSpaceData:f,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return Dc.rejectPromotionRequest=i,Dc}var xc={},B6;function xk(){if(B6)return xc;B6=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.connectPromotor=void 0;const e=Ke;function t(r){return e.__awaiter(this,void 0,void 0,function*(){const{signalData:n,promotorAddress:s}=r||{};this.connect({signalData:n,peerAddress:s})})}return xc.connectPromotor=t,xc}var Uc={},L6;function Uk(){if(L6)return Uc;L6=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.join=void 0;const e=Ke,t=Nr(),r=dn(),n=J9(),s=Bs(),i=nw(),o=K2();function a(){return e.__awaiter(this,void 0,void 0,function*(){try{const f=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(f.status!==r.ChatStatus.ACTIVE)throw new Error("Space not active yet");let c=!1,l=!1;const u=(0,o.default)(this.data.local.address);f.members.forEach(g=>{(0,o.default)(g.wallet)===u&&(g.isSpeaker?c=!0:l=!0)});let p=!1;f.pendingMembers.forEach(g=>{(0,o.default)(g.wallet)===u&&g.isSpeaker&&(p=!0)});const d=(0,o.default)(f.spaceCreator),h=(0,i.default)(this.data.incoming,d);if((c||p)&&h>-1)return Promise.resolve();!c&&!l&&(yield(0,n.approve)({signer:this.signer,pgpPrivateKey:this.pgpPrivateKey,senderAddress:this.spaceSpecificData.spaceId,env:this.env})),(c||p)&&(!this.data.local.stream&&(yield this.create({audio:!0,video:!1})),yield this.request({senderAddress:this.data.local.address,recipientAddress:d,chatId:this.spaceSpecificData.spaceId,details:{type:t.SPACE_REQUEST_TYPE.JOIN_SPEAKER,data:{}}}));const y=yield(0,s.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},y),{liveSpaceData:this.spaceSpecificData.liveSpaceData}))}catch(f){throw console.error(`[Push SDK] - API - Error - API ${a.name} -: `,f),Error(`[Push SDK] - API - Error - API ${a.name} -: ${f}`)}})}return Uc.join=a,Uc}var Bc={},K6;function Bk(){if(K6)return Bc;K6=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.leave=void 0;const e=Ke,t=Nr();function r(){return e.__awaiter(this,void 0,void 0,function*(){try{this.data.incoming.slice(1).forEach(({address:n})=>{this.disconnect({peerAddress:n,details:{type:t.SPACE_DISCONNECT_TYPE.LEAVE,data:{}}})})}catch(n){throw console.error(`[Push SDK] - API - Error - API ${stop.name} -: `,n),Error(`[Push SDK] - API - Error - API ${stop.name} -: ${n}`)}})}return Bc.leave=r,Bc}var Lc={},j6;function Lk(){if(j6)return Lc;j6=1,Object.defineProperty(Lc,"__esModule",{value:!0}),Lc.stop=void 0;const e=Ke,t=Mt(),r=Kl(),n=Bs(),s=dn(),i=Nr();function o(){return e.__awaiter(this,void 0,void 0,function*(){try{const a=yield(0,n.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env});if(a.status===s.ChatStatus.ENDED)throw new Error("Space already ended");const f=(0,t.getSpacesMembersList)(a.members,a.pendingMembers),c=(0,t.getSpaceAdminsList)(a.members,a.pendingMembers),l=yield(0,r.updateGroup)({chatId:this.spaceSpecificData.spaceId,groupName:a.spaceName,groupImage:a.spaceImage,groupDescription:a.spaceDescription,members:f,admins:c,signer:this.signer,env:this.env,pgpPrivateKey:this.pgpPrivateKey,scheduleAt:a.scheduleAt,scheduleEnd:a.scheduleEnd,status:s.ChatStatus.ENDED});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},(0,t.groupDtoToSpaceDto)(l)),{liveSpaceData:this.spaceSpecificData.liveSpaceData})),this.data.incoming.slice(1).forEach(({address:u})=>{this.disconnect({peerAddress:u,details:{type:i.SPACE_DISCONNECT_TYPE.STOP,data:{}}})})}catch(a){throw console.error(`[Push SDK] - API - Error - API ${o.name} -: `,a),Error(`[Push SDK] - API - Error - API ${o.name} -: ${a}`)}})}return Lc.stop=o,Lc}var Kc={},Od={},q6;function Kk(){if(q6)return Od;q6=1,Object.defineProperty(Od,"__esModule",{value:!0});const e=Ke,t=Xn(),r=Je(),n=F2(),s=({localAddress:i,spaceId:o,pgpPrivateKey:a,env:f})=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const u=(yield(0,t.conversationHash)({account:i,conversationId:o,env:f})).threadHash;let p=n.initLiveSpaceData;const d=yield(0,t.history)({threadhash:u,account:i,pgpPrivateKey:a,toDecrypt:!0,env:f});let h=null;for(const y of d)if(y.messageType===r.MessageType.META&&typeof y.messageObj=="object"&&y.messageObj!==null){h=y;break}return h!==null&&typeof h.messageObj=="object"&&h.messageObj!==null&&(p=(l=(c=h.messageObj)===null||c===void 0?void 0:c.info)===null||l===void 0?void 0:l.arbitrary),p});return Od.default=s,Od}var $6;function jk(){if($6)return Kc;$6=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.initialize=void 0;const e=Ke,t=dn(),r=Bs(),n=Kk();function s(i){return e.__awaiter(this,void 0,void 0,function*(){const{spaceId:o}=i||{},a=yield(0,r.get)({spaceId:o,env:this.env});let f=this.spaceSpecificData.liveSpaceData;a.status===t.ChatStatus.ACTIVE&&(f=yield(0,n.default)({localAddress:this.data.local.address,spaceId:o,pgpPrivateKey:this.pgpPrivateKey,env:this.env})),this.setSpaceSpecificData(()=>Object.assign(Object.assign({},a),{liveSpaceData:f}))})}return Kc.initialize=s,Kc}var Nd={},V6;function qk(){if(V6)return Nd;V6=1,Object.defineProperty(Nd,"__esModule",{value:!0});const e=(t,r)=>{t.addStream(r,void 0)};return Nd.default=e,Nd}var jc={},F6;function $k(){if(F6)return jc;F6=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.broadcastRaisedHand=void 0;const e=Ke,t=ei(),r=yo(),n=Ia(),s=tt();function i(o){return e.__awaiter(this,void 0,void 0,function*(){const{promoteeAddress:a}=o||{},f=(0,t.produce)(this.spaceSpecificData.liveSpaceData,c=>{const l=this.spaceSpecificData.liveSpaceData.listeners.findIndex(u=>(0,s.pCAIP10ToWallet)(u.address)===(0,s.pCAIP10ToWallet)(a));l!==-1&&(c.listeners[l].handRaised=!0)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:f})),yield(0,r.default)({liveSpaceData:f,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:n.CHAT.META.GROUP.USER.INTERACTION})})}return jc.broadcastRaisedHand=i,jc}var qc={},H6;function Vk(){if(H6)return qc;H6=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.onReceiveMetaMessage=void 0;const e=Je();function t(r){var n,s;const{receivedMetaMessage:i}=r||{};if(i.messageType!==e.MessageType.META||typeof i.messageObj!="object"||!(!((s=(n=i==null?void 0:i.messageObj)===null||n===void 0?void 0:n.info)===null||s===void 0)&&s.arbitrary))return;const o=i.messageObj.info.arbitrary;this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:o}))}return qc.onReceiveMetaMessage=t,qc}var $c={},G6;function Fk(){if(G6)return $c;G6=1,Object.defineProperty($c,"__esModule",{value:!0}),$c.onJoinListener=void 0;const e=Ke,t=yo(),r=Bs(),n=tt(),s=ei(),i=Ia();function o(a){return e.__awaiter(this,void 0,void 0,function*(){const{receivedAddress:f}=a||{};if((0,n.pCAIP10ToWallet)(this.spaceSpecificData.spaceCreator)!==this.data.local.address||!(yield(0,r.get)({spaceId:this.spaceSpecificData.spaceId,env:this.env})).members.find(p=>(0,n.pCAIP10ToWallet)(p.wallet)===(0,n.pCAIP10ToWallet)(f)&&!p.isSpeaker))return;const u=(0,s.produce)(this.spaceSpecificData.liveSpaceData,p=>{this.spaceSpecificData.liveSpaceData.listeners.find(h=>(0,n.pCAIP10ToWallet)(h.address)===(0,n.pCAIP10ToWallet)(f))||p.listeners.push({address:(0,n.pCAIP10ToWallet)(f),handRaised:!1,emojiReactions:null})});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:u})),yield(0,t.default)({spaceId:this.spaceSpecificData.spaceId,pgpPrivateKey:this.pgpPrivateKey,env:this.env,signer:this.signer,liveSpaceData:u,action:i.CHAT.META.SPACE.LISTENER.ADD})})}return $c.onJoinListener=o,$c}var z6;function F2(){return z6||(z6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Space=e.initSpaceData=e.initSpaceSpecificData=e.initLiveSpaceData=void 0;const t=Ke,r=ei(),n=Je(),s=V2(),i=Tk(),o=Ik(),a=Ck(),f=Rk(),c=kk(),l=Mk(),u=Ok(),p=Nk(),d=Dk(),h=xk(),y=Uk(),g=Bk(),m=Lk(),b=jk(),w=qk(),E=dn(),C=Nr(),R=yo(),M=Ia(),_=$k(),A=Vk(),I=Fk(),P=tt();e.initLiveSpaceData={host:{address:"",audio:null,emojiReactions:null},coHosts:[],speakers:[],listeners:[]},e.initSpaceSpecificData={members:[],pendingMembers:[],contractAddressERC20:null,numberOfERC20:-1,contractAddressNFT:null,numberOfNFTTokens:-1,verificationProof:"",spaceImage:null,spaceName:"",isPublic:!1,spaceDescription:"",spaceCreator:"",spaceId:"",scheduleAt:null,scheduleEnd:null,status:null,inviteeDetails:{},liveSpaceData:e.initLiveSpaceData},e.initSpaceData=Object.assign(Object.assign({},e.initSpaceSpecificData),{connectionData:s.initVideoCallData});class v extends s.Video{constructor(T){const{signer:N,pgpPrivateKey:D,address:O,chainId:L,env:B=n.default.ENV.PROD,setSpaceData:k}=T||{};super({signer:N,chainId:L,pgpPrivateKey:D,env:B,callType:C.VIDEO_CALL_TYPE.PUSH_SPACE,onReceiveStream:(q,W,re)=>t.__awaiter(this,void 0,void 0,function*(){var ue;if(this.spaceSpecificData.status===E.ChatStatus.ACTIVE&&(!((ue=this.data.meta.broadcast)===null||ue===void 0)&&ue.hostAddress)&&this.data.meta.broadcast.hostAddress===this.data.local.address){(0,w.default)(this.mergedStream,q);const H=(0,r.produce)(this.spaceSpecificData.liveSpaceData,ae=>{const V=this.spaceSpecificData.liveSpaceData.listeners.findIndex(U=>U.address===W);ae.speakers.push({address:W,audio:re,emojiReactions:V>-1?this.spaceSpecificData.liveSpaceData.listeners[V].emojiReactions:null}),V>-1&&ae.listeners.splice(V,1)});this.setSpaceSpecificData(()=>Object.assign(Object.assign({},this.spaceSpecificData),{liveSpaceData:H})),yield(0,R.default)({liveSpaceData:H,pgpPrivateKey:this.pgpPrivateKey,env:this.env,spaceId:this.spaceSpecificData.spaceId,signer:this.signer,action:M.CHAT.META.GROUP.ADMIN.PRVILEGE})}}),setData:function(){}}),this.mergedStream=null,this.initialize=b.initialize,this.update=i.update,this.createAudioStream=()=>t.__awaiter(this,void 0,void 0,function*(){yield this.create({audio:!0,video:!1})}),this.start=o.start,this.onReceiveMetaMessage=A.onReceiveMetaMessage,this.onJoinListener=I.onJoinListener,this.inviteToPromote=a.inviteToPromote,this.acceptPromotionInvite=f.acceptPromotionInvite,this.connectInvitee=c.connectInvitee,this.rejectPromotionInvite=l.rejectPromotionInvite,this.requestToBePromoted=u.requestToBePromoted,this.broadcastRaisedHand=_.broadcastRaisedHand,this.acceptPromotionRequest=p.acceptPromotionRequest,this.connectPromotor=h.connectPromotor,this.rejectPromotionRequest=d.rejectPromotionRequest,this.join=y.join,this.leave=g.leave,this.stop=m.stop,this.setData=function(q){const W=q(this.data);k(()=>Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:W})),this.data=W},this.setSpaceSpecificData=function(q){const W=q(this.spaceSpecificData);k(()=>Object.assign(Object.assign({},W),{connectionData:this.data})),this.spaceSpecificData=W},this.setSpaceData=function(q){const W=q(Object.assign(Object.assign({},this.spaceSpecificData),{connectionData:this.data})),{connectionData:re}=W,ue=t.__rest(W,["connectionData"]);this.spaceSpecificData=ue,this.setData(()=>re)},this.setData(q=>(0,r.produce)(q,W=>{W.local.address=(0,P.pCAIP10ToWallet)(O)})),k(()=>e.initSpaceData),this.spaceSpecificData=e.initSpaceSpecificData}}e.Space=v,e.default=v}(Cp)),Cp}var W6;function H2(){return W6||(W6=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.space=void 0;const t=Ke;t.__exportStar(K2(),e),t.__exportStar(CR(),e),t.__exportStar(RR(),e),t.__exportStar(Bs(),e),t.__exportStar(kR(),e),t.__exportStar(MR(),e),t.__exportStar(NR(),e),t.__exportStar(q2(),e),t.__exportStar(DR(),e),t.__exportStar(xR(),e),t.__exportStar(UR(),e),t.__exportStar(J9(),e),t.__exportStar(BR(),e),t.__exportStar(XR(),e),t.__exportStar(QR(),e),t.__exportStar(ek(),e);var r=tk();Object.defineProperty(e,"space",{enumerable:!0,get:function(){return r.spaceFeed}}),t.__exportStar(F2(),e)}(K1)),K1}var Y6;function $l(){if(Y6)return Ed;Y6=1,Object.defineProperty(Ed,"__esModule",{value:!0});const e=Je(),t=Ah(),r=Ll(),n=Sh(),s=H2(),i=dn(),o=V2(),a={ENV:e.ENV,STREAM:n.STREAM,CHAT:{LIST_TYPE:r.ChatListType,MESSAGE_TYPE:e.MessageType,GROUP:{RULES:{CONDITION_TYPE:i.ConditionType,CATEGORY:i.GROUP_RULES_CATEGORY,SUBCATEGORY:i.GROUP_RULES_SUB_CATEGORY,PERMISSION:i.GROUP_RULES_PERMISSION,INVITER_ROLE:i.GROUP_INVITER_ROLE}}},VIDEO:{EVENT:n.VideoEventType,STATUS:i.VideoCallStatus,INITIAL_DATA:o.initVideoCallData},SPACE:{EVENT:n.SpaceEventType,INITIAL_DATA:s.initSpaceData},ALPHA_FEATURES:e.ALPHA_FEATURES,USER:{ENCRYPTION_TYPE:e.ENCRYPTION_TYPE},NOTIFICATION:{TYPE:i.NotifictaionType,CHANNEL:{LIST_TYPE:t.ChannelListType}},FILTER:{CHANNEL_LIST:{SORT:t.ChannelListSortType,ORDER:t.ChannelListOrderType},NOTIFICATION_TYPE:i.NotifictaionType,TAGS:{USER:"USER",PUSH:"PUSH",ALL:"*"}}};return Ed.default=a,Ed}var J6;function Hk(){if(J6)return ic;J6=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.getChannels=void 0;const e=Ke,t=$l(),r=tt(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{env:o=t.default.ENV.PROD,page:a=1,limit:f=10,sort:c=t.default.FILTER.CHANNEL_LIST.SORT.SUBSCRIBER,order:l=t.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:u,tag:p,user_subscribed:d}=i||{},g=`${`${(0,r.getAPIBaseUrls)(o)}/v1/channels`}?page=${a}&limit=${f}&sort=${c}&order=${l}${u?`&filter=${u}`:""}${p?`&tag=${p}`:""}${d?`&user_subscribed=${d}`:""}`;return yield(0,n.axiosGet)(g).then(m=>m.data).catch(m=>{throw console.error(`[Push SDK] - API ${g}: `,m),Error(`[Push SDK] - API - Error - API ${g} -: ${m}`)})});return ic.getChannels=s,ic}var Vc={},Z6;function Gk(){if(Z6)return Vc;Z6=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.getDelegates=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${f}/delegates`;return yield(0,n.axiosGet)(u).then(p=>{var d;return(d=p.data)===null||d===void 0?void 0:d.delegates}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return Vc.getDelegates=s,Vc}var Fc={},Hc={},X6;function zk(){if(X6)return Hc;X6=1,Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.parseSubscrbersApiResponse=void 0;const e=L2();function t(r){const n=r.subscribers.map(s=>({subscriber:s.subscriber,settings:s.settings?(0,e.parseSettings)(s.settings):null}));return{itemcount:r.itemcount,subscribers:[...n]}}return Hc.parseSubscrbersApiResponse=t,Hc}var Q6;function Wk(){if(Q6)return Fc;Q6=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.getSubscribers=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=zk(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){try{const{channel:a,page:f=1,limit:c=10,category:l=null,setting:u=!1,env:p=r.default.ENV.PROD,raw:d=!0}=o||{};try{if(a==null||a.length==0)throw new Error("channel cannot be null or empty");if(f<=0)throw new Error("page must be greater than 0");if(c<=0)throw new Error("limit must be greater than 0");if(c>30)throw new Error("limit must be lesser than or equal to 30");const h=yield(0,t.getCAIPAddress)(p,a,"Channel");let g=`${(0,t.getAPIBaseUrls)(p)}/v1/channels/${h}/subscribers?page=${f}&limit=${c}&setting=${u}`;return l&&(g=g+`&category=${l}`),yield(0,n.axiosGet)(g).then(m=>d?m.data:(0,s.parseSubscrbersApiResponse)(m.data)).catch(m=>{console.error(`[Push SDK] - API ${g}: `,m)})}catch(h){throw console.error("[Push SDK] - API - Error - API send() -: ",h),Error(`[Push SDK] - API - Error - API send() -: ${h}`)}}catch(a){throw console.error("[Push SDK] - API - Error - API send() -: ",a),Error(`[Push SDK] - API - Error - API send() -: ${a}`)}});return Fc.getSubscribers=i,Fc}var Gc={},e_;function Yk(){if(e_)return Gc;e_=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.search=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.PROD,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT,filter:l,tag:u,user_subscribed:p,oldFormat:d=!0}=i||{};if(!o)throw Error('"query" not provided!');const y=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/`,g=Object.assign(Object.assign(Object.assign({page:f,limit:(0,t.getLimit)(c),query:o},u&&{tag:u}),l&&{filter:l}),p&&{user_subscribed:p}),m=`${y}?${(0,t.getQueryParams)(g)}`;return(0,n.axiosGet)(m).then(b=>{const w=b.data.channels,C={itemCount:b.data.itemCount||w.length,result:w};return typeof d<"u"&&d?w:C}).catch(b=>{console.error(`[Push SDK] - API ${m}: `,b)})});return Gc.search=s,Gc}var zc={},t_;function Jk(){if(t_)return zc;t_=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.getTags=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{channel:o,env:a=r.default.ENV.PROD}=i||{},f=yield(0,t.getCAIPAddress)(a,o,"Channel"),u=`${`${(0,t.getAPIBaseUrls)(a)}/v1/channels`}/${f}/tags`;return yield(0,n.axiosGet)(u).then(p=>{var d;return(d=p.data)===null||d===void 0?void 0:d.tags}).catch(p=>{console.error(`[EPNS-SDK] - API ${u}: `,p)})});return zc.getTags=s,zc}var Wc={},r_;function Zk(){if(r_)return Wc;r_=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.searchTags=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=i=>e.__awaiter(void 0,void 0,void 0,function*(){const{query:o,env:a=r.default.ENV.LOCAL,page:f=r.default.PAGINATION.INITIAL_PAGE,limit:c=r.default.PAGINATION.LIMIT}=i||{};if(!o)throw Error('"query" not provided!');const u=`${(0,t.getAPIBaseUrls)(a)}/v1/channels/search/tags`,p={page:f,limit:(0,t.getLimit)(c),query:o},d=`${u}?${(0,t.getQueryParams)(p)}`;return(0,n.axiosGet)(d).then(h=>h.data.channels).catch(h=>{console.error(`[Push SDK] - API ${d}: `,h)})});return Wc.searchTags=s,Wc}var Yc={},wn={},n_;function Ch(){if(n_)return wn;n_=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.getTypeInformationV2=wn.getTypeInformation=wn.getSubscriptionMessageV2=wn.getSubscriptionMessage=wn.getDomainInformation=void 0;const e=(i,o)=>({name:"EPNS COMM V1",chainId:i,verifyingContract:o});wn.getDomainInformation=e;const t=(i,o,a)=>({channel:i,[a==="Unsubscribe"?"unsubscriber":"subscriber"]:o,action:a});wn.getSubscriptionMessage=t;const r=(i,o,a,f)=>{const c=a==="Unsubscribe"?"unsubscriber":"subscriber";return a=="Subscribe"?JSON.stringify({channel:i,[c]:o,action:a,userSetting:f??""},null,4):JSON.stringify({channel:i,[c]:o,action:a},null,4)};wn.getSubscriptionMessageV2=r;const n=i=>i==="Subscribe"?{Subscribe:[{name:"channel",type:"address"},{name:"subscriber",type:"address"},{name:"action",type:"string"}]}:{Unsubscribe:[{name:"channel",type:"address"},{name:"unsubscriber",type:"address"},{name:"action",type:"string"}]};wn.getTypeInformation=n;const s=()=>({Data:[{name:"data",type:"string"}]});return wn.getTypeInformationV2=s,wn}var i_;function Xk(){if(i_)return Yc;i_=1,Object.defineProperty(Yc,"__esModule",{value:!0}),Yc.subscribe=void 0;const e=Ke,t=tt(),r=Ch(),n=Je(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:f,userAddress:c,verifyingContractAddress:l,origin:u,env:p=n.default.ENV.PROD,onSuccess:d,onError:h}=o||{};try{const y=yield(0,t.getCAIPAddress)(p,f,"Channel"),g=(0,t.getCAIPDetails)(y);if(!g)throw Error("Invalid Channel CAIP!");const m=parseInt(g.networkId,10),b=yield(0,t.getCAIPAddress)(p,c,"User"),w=(0,t.getCAIPDetails)(b);if(!w)throw Error("Invalid User CAIP!");const{API_BASE_URL:E,EPNS_COMMUNICATOR_CONTRACT:C}=(0,t.getConfig)(p,g),R=`${E}/v1/channels/${y}/subscribe`,M=(0,r.getDomainInformation)(m,l||C),_=(0,r.getTypeInformation)("Subscribe"),A=(0,r.getSubscriptionMessage)(g.address,w.address,"Subscribe"),S={verificationProof:yield new t.Signer(a).signTypedData(M,_,A,"Subscribe"),message:Object.assign(Object.assign({},A),{channel:y,subscriber:b}),origin:u};return yield(0,s.axiosPost)(R,S),typeof d=="function"&&d(),{status:"success",message:"successfully opted into channel"}}catch(y){return typeof h=="function"&&h(y),{status:"error",message:y instanceof Error?y.message:JSON.stringify(y)}}});return Yc.subscribe=i,Yc}var Jc={},s_;function Qk(){if(s_)return Jc;s_=1,Object.defineProperty(Jc,"__esModule",{value:!0}),Jc.subscribeV2=void 0;const e=Ke,t=tt(),r=Ch(),n=Je(),s=Tt(),i=Mt(),o=qr,a=f=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:d,settings:h=void 0,verifyingContractAddress:y,env:g=n.default.ENV.PROD,origin:m,onSuccess:b,onError:w,pgpPrivateKey:E}=f||{};try{const C=yield(0,t.getCAIPAddress)(g,p,"Channel"),R=(0,t.getCAIPDetails)(C);if(!R)throw Error("Invalid Channel CAIP!");const M=parseInt(R.networkId,10),_=yield(0,t.getCAIPAddress)(g,d,"User"),A=(0,t.getCAIPDetails)(_);if(!A)throw Error("Invalid User CAIP!");const{API_BASE_URL:I,EPNS_COMMUNICATOR_CONTRACT:P}=(0,t.getConfig)(g,R),v=`${I}/v1/channels/${C}/subscribe`;let S,T={data:{}};if(E){T={data:(0,r.getSubscriptionMessageV2)(R.address,_,"Subscribe",h)};const L=o.SHA256(JSON.stringify(T)).toString();console.log(" hash ",L),S=`pgpv4:${yield(0,i.sign)({message:L,signingKey:E})}`}else{const O=(0,r.getDomainInformation)(M,y||P),L=(0,r.getTypeInformationV2)();T={data:(0,r.getSubscriptionMessageV2)(R.address,A.address,"Subscribe",h)},S=`eip712v2:${yield new t.Signer(u).signTypedData(O,L,T,"Data")}`}const N={verificationProof:S,message:T.data,origin:m},D=yield(0,s.axiosPost)(v,N);return typeof b=="function"&&b(),{status:D.status,message:"successfully opted into channel"}}catch(C){return typeof w=="function"&&w(C),{status:(l=(c=C==null?void 0:C.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:C instanceof Error?C.message:JSON.stringify(C)}}});return Jc.subscribeV2=a,Jc}var Zc={},a_;function eM(){if(a_)return Zc;a_=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.unsubscribe=void 0;const e=Ke,t=tt(),r=Ch(),n=Je(),s=Tt(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{signer:a,channelAddress:f,userAddress:c,verifyingContractAddress:l,env:u=n.default.ENV.PROD,onSuccess:p,onError:d}=o||{};try{const h=yield(0,t.getCAIPAddress)(u,f,"Channel"),y=(0,t.getCAIPDetails)(h);if(!y)throw Error("Invalid Channel CAIP!");const g=parseInt(y.networkId,10),m=yield(0,t.getCAIPAddress)(u,c,"User"),b=(0,t.getCAIPDetails)(m);if(!b)throw Error("Invalid User CAIP!");const{API_BASE_URL:w,EPNS_COMMUNICATOR_CONTRACT:E}=(0,t.getConfig)(u,y),C=`${w}/v1/channels/${h}/unsubscribe`,R=(0,r.getDomainInformation)(g,l||E),M=(0,r.getTypeInformation)("Unsubscribe"),_=(0,r.getSubscriptionMessage)(y.address,b.address,"Unsubscribe"),v={verificationProof:yield new t.Signer(a).signTypedData(R,M,_,"Unsubscribe"),message:Object.assign(Object.assign({},_),{channel:h,unsubscriber:m})};return yield(0,s.axiosPost)(C,v),typeof p=="function"&&p(),{status:"success",message:"successfully opted out channel"}}catch(h){return typeof d=="function"&&d(h),{status:"error",message:h instanceof Error?h.message:JSON.stringify(h)}}});return Zc.unsubscribe=i,Zc}var Xc={},o_;function tM(){if(o_)return Xc;o_=1,Object.defineProperty(Xc,"__esModule",{value:!0}),Xc.unsubscribeV2=void 0;const e=Ke,t=tt(),r=Ch(),n=Je(),s=Tt(),i=Mt(),o=qr,a=f=>e.__awaiter(void 0,void 0,void 0,function*(){var c,l;const{signer:u,channelAddress:p,userAddress:d,verifyingContractAddress:h,env:y=n.default.ENV.PROD,onSuccess:g,onError:m,pgpPrivateKey:b}=f||{};try{const w=yield(0,t.getCAIPAddress)(y,p,"Channel"),E=(0,t.getCAIPDetails)(w);if(!E)throw Error("Invalid Channel CAIP!");const C=parseInt(E.networkId,10),R=yield(0,t.getCAIPAddress)(y,d,"User"),M=(0,t.getCAIPDetails)(R);if(!M)throw Error("Invalid User CAIP!");const{API_BASE_URL:_,EPNS_COMMUNICATOR_CONTRACT:A}=(0,t.getConfig)(y,E),I=`${_}/v1/channels/${w}/unsubscribe`,P=(0,r.getDomainInformation)(C,h||A),v=(0,r.getTypeInformationV2)();let S={data:{}},T;if(b){S={data:(0,r.getSubscriptionMessageV2)(E.address,R,"Unsubscribe")};const L=o.SHA256(JSON.stringify(S)).toString();T=`pgpv4:${yield(0,i.sign)({message:L,signingKey:b})}`}else S={data:(0,r.getSubscriptionMessageV2)(E.address,M.address,"Unsubscribe")},T=`eip712v2:${yield new t.Signer(u).signTypedData(P,v,S,"Data")}`;const N={verificationProof:T,message:S.data},D=yield(0,s.axiosPost)(I,N);return typeof g=="function"&&g(),{status:D.status,message:"successfully opted out channel"}}catch(w){return typeof m=="function"&&m(w),{status:(l=(c=w==null?void 0:w.response)===null||c===void 0?void 0:c.status)!==null&&l!==void 0?l:"",message:w instanceof Error?w.message:JSON.stringify(w)}}});return Xc.unsubscribeV2=a,Xc}var Qc={},c_;function rM(){if(c_)return Qc;c_=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.getAllTags=void 0;const e=Ke,t=tt(),r=Je(),n=Tt(),s=$l(),i=o=>e.__awaiter(void 0,void 0,void 0,function*(){const{page:a=1,limit:f=10,order:c=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:l=s.default.FILTER.TAGS.PUSH,env:u=r.default.ENV.PROD}=o||{},d=`${(0,t.getAPIBaseUrls)(u)}/v1/channels`,h={page:a,limit:f,order:c,filter:l},y=`${d}/tags/all?${(0,t.getQueryParams)(h)}`;return yield(0,n.axiosGet)(y).then(g=>{var m;return(m=g.data)===null||m===void 0?void 0:m.tags}).catch(g=>{console.error(`[EPNS-SDK] - API ${y}: `,g)})});return Qc.getAllTags=i,Qc}var u_;function go(){return u_||(u_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Ke;t.__exportStar(PR(),e),t.__exportStar(TR(),e),t.__exportStar(IR(),e),t.__exportStar(Hk(),e),t.__exportStar(Gk(),e),t.__exportStar(Wk(),e),t.__exportStar(Yk(),e),t.__exportStar(Jk(),e),t.__exportStar(Zk(),e),t.__exportStar(Xk(),e),t.__exportStar(Qk(),e),t.__exportStar(eM(),e),t.__exportStar(tM(),e),t.__exportStar(rM(),e)}(U1)),U1}var eu={},tu={},jp={},l_;function sw(){return l_||(l_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupProfile=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=jl(),f=Xt(),c=l=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:u,groupName:p,groupImage:d,groupDescription:h,rules:y,account:g=null,signer:m=null,env:b=n.default.ENV.PROD,pgpPrivateKey:w=null}=l||{};try{if(g==null&&m==null)throw new Error("At least one from account or signer is necessary!");const E=(0,s.getWallet)({account:g,signer:m}),C=yield(0,s.getAccountAddress)(E);(0,s.updateGroupRequestValidator)(u,p,[],[],C,h);const R=yield(0,a.getGroupInfo)({chatId:u,env:b}),M={groupName:p,groupDescription:h,groupImage:d,rules:y??{},isPublic:R.isPublic,groupType:R.groupType},_=i.SHA256(JSON.stringify(M)).toString(),A=yield(0,s.getConnectedUserV2)(E,w,b),I=yield(0,s.sign)({message:_,signingKey:A.privateKey}),v="pgpv2"+":"+I+":"+A.did,T=`${(0,r.getAPIBaseUrls)(b)}/v1/chat/groups/${u}/profile`,{isPublic:N,groupType:D}=M,O=t.__rest(M,["isPublic","groupType"]);return O.profileVerificationProof=v,(yield(0,o.axiosPut)(T,O)).data}catch(E){throw(0,f.handleError)(E,e.updateGroupProfile.name)}});e.updateGroupProfile=c}(jp)),jp}var ru={},d_;function G2(){if(d_)return ru;d_=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.User=void 0;const e=Ke,t=In();class r{constructor(s,i){this.account=s,this.env=i}info(s){return e.__awaiter(this,void 0,void 0,function*(){const i=(s==null?void 0:s.overrideAccount)||this.account;return yield t.get({account:i,env:this.env})})}}return ru.User=r,ru}var qp={},f_;function aw(){return f_||(f_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.updateGroupConfig=void 0;const t=Ke,r=tt(),n=Je(),s=Mt(),i=qr,o=Tt(),a=Xt(),f=c=>t.__awaiter(void 0,void 0,void 0,function*(){const{chatId:l,meta:u,scheduleAt:p,scheduleEnd:d,status:h,account:y=null,signer:g=null,env:m=n.default.ENV.PROD,pgpPrivateKey:b=null}=c||{};try{if(y==null&&g==null)throw new Error("At least one from account or signer is necessary!");const w=(0,s.getWallet)({account:y,signer:g}),E={meta:u,scheduleAt:p,scheduleEnd:d,status:h},C=i.SHA256(JSON.stringify(E)).toString(),R=yield(0,s.getConnectedUserV2)(w,b,m),M=yield(0,s.sign)({message:C,signingKey:R.privateKey}),A="pgpv2"+":"+M+":"+R.did,P=`${(0,r.getAPIBaseUrls)(m)}/v1/chat/groups/${l}/config`,v=E;return v.configVerificationProof=A,(yield(0,o.axiosPut)(P,v)).data}catch(w){throw(0,a.handleError)(w,e.updateGroupConfig.name)}});e.updateGroupConfig=f}(qp)),qp}var h_;function z2(){if(h_)return tu;h_=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.Chat=void 0;const e=Ke,t=Je(),r=Ll(),n=In(),s=Xn(),i=Mt(),o=tt(),a=sw(),f=G2(),c=aw(),l=_o();class u{constructor(d,h,y,g,m,b){this.account=d,this.env=h,this.alpha=y,this.decryptedPgpPvtKey=g,this.signer=m,this.progressHook=b,this.group={create:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){var C,R,M;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const _={account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,groupName:w,groupDescription:(C=E==null?void 0:E.description)!==null&&C!==void 0?C:null,groupImage:(R=E==null?void 0:E.image)!==null&&R!==void 0?R:null,rules:(M=E==null?void 0:E.rules)!==null&&M!==void 0?M:{},isPublic:!(E!=null&&E.private),groupType:"default",config:{meta:null,scheduleAt:null,scheduleEnd:null,status:null},members:E!=null&&E.members?E.members:[],admins:E!=null&&E.admins?E.admins:[]},A=yield s.createGroupV2(_);return this.scalabilityV2Feature?A:yield s.getGroup({chatId:A.chatId,env:this.env})}),participants:{list:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){const{page:C=1,limit:R=20,filter:M={pending:void 0,role:void 0}}=E??{},_={chatId:w,page:C,limit:R,pending:M.pending,role:M.role,env:this.env};return{members:yield s.getGroupMembers(_)}}),count:w=>e.__awaiter(this,void 0,void 0,function*(){const E=yield s.getGroupMemberCount({chatId:w,env:this.env});return{participants:E.overallCount-E.pendingCount,pending:E.pendingCount}}),status:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){const C=(E==null?void 0:E.overrideAccount)||this.account,R=yield s.getGroupMemberStatus({chatId:w,did:C,env:this.env});return{pending:R.isPending,role:R.isAdmin?"admin":"member",participant:R.isMember}})},permissions:w=>e.__awaiter(this,void 0,void 0,function*(){const E={chatId:w,did:this.account,env:this.env};return yield s.getGroupAccess(E)}),info:w=>e.__awaiter(this,void 0,void 0,function*(){return this.scalabilityV2Feature?yield s.getGroupInfo({chatId:w,env:this.env}):yield s.getGroup({chatId:w,env:this.env})}),update:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const C=yield s.getGroupInfo({chatId:w,env:this.env});if(!C)throw new Error("Group not found");const R={chatId:w,groupName:E.name?E.name:C.groupName,groupDescription:E.description!==void 0?E.description:C.groupDescription,groupImage:E.image!==void 0?E.image:C.groupImage,rules:E.rules?E.rules:C.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},M={chatId:w,meta:E.meta?E.meta:C.meta,scheduleAt:E.scheduleAt?E.scheduleAt:C.scheduleAt,scheduleEnd:E.scheduleEnd?E.scheduleEnd:C.scheduleEnd,status:E.status?E.status:C.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,a.updateGroupProfile)(R);const _=yield(0,c.updateGroupConfig)(M);return this.scalabilityV2Feature?_:yield s.getGroup({chatId:_.chatId,env:this.env})}),add:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const{role:C,accounts:R}=E;if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!R||R.length===0)throw new Error("accounts array cannot be empty!");R.forEach(A=>{if(!(0,o.isValidPushCAIP)(A))throw new Error(`Invalid account address: ${A}`)});let _;return C==="ADMIN"?_=yield s.addAdmins({chatId:w,admins:R,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):_=yield s.addMembers({chatId:w,members:R,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?_:yield s.getGroup({chatId:_.chatId,env:this.env})}),remove:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){const{accounts:C}=E;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!C||C.length===0)throw new Error("Accounts array cannot be empty!");C.forEach(_=>{if(!(0,o.isValidPushCAIP)(_))throw new Error(`Invalid account address: ${_}`)});const R=[],M=[];for(const _ of C){const A=yield s.getGroupMemberStatus({chatId:w,did:_,env:this.env});A.isAdmin?R.push(_):A.isMember&&M.push(_)}return R.length>0&&(yield s.removeAdmins({chatId:w,admins:R,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),M.length>0&&(yield s.removeMembers({chatId:w,members:M,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(w)}),modify:(w,E)=>e.__awaiter(this,void 0,void 0,function*(){const{role:C,accounts:R}=E;if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());if(!["ADMIN","MEMBER"].includes(C))throw new Error("Invalid role provided.");if(!R||R.length===0)throw new Error("accounts array cannot be empty!");return R.forEach(_=>{if(!(0,o.isValidPushCAIP)(_))throw new Error(`Invalid account address: ${_}`)}),yield s.modifyRoles({chatId:w,newRole:C,members:R,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})}),join:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const E=yield s.getGroupMemberStatus({chatId:w,did:this.account,env:this.env});return E.isPending?yield s.approve({senderAddress:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):E.isMember||(yield s.addMembers({chatId:w,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})),yield this.group.info(w)}),leave:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const E=yield s.getGroupMemberStatus({chatId:w,did:this.account,env:this.env});let C;return E.isAdmin?C=yield s.removeAdmins({chatId:w,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}):C=yield s.removeMembers({chatId:w,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature}),this.scalabilityV2Feature?C:yield s.getGroup({chatId:C.chatId,env:this.env})}),reject:w=>e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})},this.userInstance=new f.User(this.account,this.env),this.scalabilityV2Feature=this.alpha.feature.includes(t.ALPHA_FEATURES.SCALABILITY_V2)}list(d,h){return e.__awaiter(this,void 0,void 0,function*(){const g={account:(h==null?void 0:h.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:h==null?void 0:h.page,limit:h==null?void 0:h.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(d){case r.ChatListType.CHATS:return yield s.chats(g);case r.ChatListType.REQUESTS:return yield s.requests(g);default:throw new Error("Invalid Chat List Type")}})}latest(d){return e.__awaiter(this,void 0,void 0,function*(){const{threadHash:h,intent:y}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(!h)return{};const g=yield s.latest({threadhash:h,toDecrypt:!!this.decryptedPgpPvtKey,pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,env:this.env}),m=y?"CHATS":"REQUESTS";return g.map(b=>Object.assign(Object.assign({},b),{listType:m}))})}history(d,h){return e.__awaiter(this,void 0,void 0,function*(){let y;const{threadHash:g,intent:m}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(h!=null&&h.reference?y=h.reference:y=g,!y)return[];const b=yield s.history({account:this.account,env:this.env,threadhash:y,pgpPrivateKey:this.decryptedPgpPvtKey,toDecrypt:!!this.decryptedPgpPvtKey,limit:h==null?void 0:h.limit}),w=m?"CHATS":"REQUESTS";return b.map(E=>Object.assign(Object.assign({},E),{listType:w}))})}message(d,h){return e.__awaiter(this,void 0,void 0,function*(){let y=null;const{threadHash:g,intent:m}=yield s.conversationHash({conversationId:d,account:this.account,env:this.env});if(y=(h==null?void 0:h.reference)||g,!y)return{};const b=yield this.history(d,{reference:y,limit:1}),w=m?"CHATS":"REQUESTS";return b.length>0?Object.assign(Object.assign({},b[0]),{listType:w}):null})}send(d,h){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());h.type||(h.type=t.MessageType.TEXT);const y={message:h,to:d,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};return yield s.send(y)})}decrypt(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.decryptConversation({pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,messages:d,pgpHelper:i.PGPHelper,connectedUser:yield this.userInstance.info()})})}accept(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield s.approve({senderAddress:d,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!this.scalabilityV2Feature})})}reject(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());yield s.reject({senderAddress:d,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey})})}block(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const y of d)if(!(0,o.isValidPushCAIP)(y))throw new Error("Invalid address in the users: "+y);if(h.profile.blockedUsersList||(h.profile.blockedUsersList=[]),h.profile.blockedUsersList=[...new Set([...h.profile.blockedUsersList,...d])],!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());return yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}unblock(d){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(l.PushAPI.ensureSignerMessage());const h=yield n.get({account:this.account,env:this.env});for(const m of d)if(!(0,o.isValidPushCAIP)(m))throw new Error("Invalid address in the users: "+m);if(!h.profile.blockedUsersList)return h;const y=d.map(m=>e.__awaiter(this,void 0,void 0,function*(){return(yield(0,o.convertToValidDID)(m,this.env)).toLowerCase()})),g=yield Promise.all(y);return h.profile.blockedUsersList=h.profile.blockedUsersList.filter(m=>{g.includes(m.toLowerCase())}),yield n.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:h.profile.name,desc:h.profile.desc,picture:h.profile.picture,blockedUsersList:h.profile.blockedUsersList},env:this.env,progressHook:this.progressHook})})}info(d,h){var y,g,m;return e.__awaiter(this,void 0,void 0,function*(){const b=(h==null?void 0:h.overrideAccount)||this.account,w={recipient:d,account:b,env:this.env};try{const E=yield s.getChatInfo(w),C=(g=(y=E.meta)===null||y===void 0?void 0:y.group)!==null&&g!==void 0?g:!1;let R=d;if(C)R=E.chatId;else{const A=((m=E.participants)!==null&&m!==void 0?m:[]).find(I=>I!==(0,o.walletToPCAIP10)(b));A&&(R=A)}return{meta:E.meta,list:E.list,participants:E.participants,chatId:E.chatId,recipient:R}}catch(E){throw console.error("Error in Chat.info: ",E),new Error(`Error fetching chat info: ${E}`)}})}}return tu.Chat=u,tu}var nu={},p_;function nM(){if(p_)return nu;p_=1,Object.defineProperty(nu,"__esModule",{value:!0}),nu.Profile=void 0;const e=Ke,t=In(),r=_o();class n{constructor(i,o,a,f,c){this.account=i,this.env=o,this.cache=a,this.decryptedPgpPvtKey=f,this.progressHook=c}info(i){return e.__awaiter(this,void 0,void 0,function*(){const o=(i==null?void 0:i.overrideAccount)||this.account,a=`profile-${o}`;if(this.cache.has(a))return this.cache.get(a);const f=yield t.get({account:o,env:this.env});return this.cache.set(a,f.profile),f.profile})}update(i){return e.__awaiter(this,void 0,void 0,function*(){if(!this.decryptedPgpPvtKey)throw new Error(r.PushAPI.ensureSignerMessage());const{name:o,desc:a,picture:f}=i,c=yield t.profile.update({pgpPrivateKey:this.decryptedPgpPvtKey,account:this.account,profile:{name:o,desc:a,picture:f},env:this.env,progressHook:this.progressHook}),l=`profile-${this.account}`;return this.cache.delete(l),c.profile})}}return nu.Profile=n,nu}var iu={},y_;function iM(){if(y_)return iu;y_=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.Encryption=void 0;const e=Ke,t=In(),r=_o(),n=G2();class s{constructor(o,a,f,c,l,u){this.account=o,this.env=a,this.decryptedPgpPvtKey=f,this.pgpPublicKey=c,this.signer=l,this.progressHook=u,this.userInstance=new n.User(this.account,this.env)}info(){return e.__awaiter(this,void 0,void 0,function*(){const o=yield this.userInstance.info();let a;if(this.signer){const f=JSON.stringify(JSON.parse(o.encryptedPrivateKey).encryptedPassword),c=this.account.toLowerCase().startsWith("scw")?{SCWPGP_V1:{encryptedPassword:f}}:{NFTPGP_V1:{encryptedPassword:f}};a=yield t.decryptAuth({account:this.account,env:this.env,signer:this.signer,progressHook:this.progressHook,additionalMeta:c})}return Object.assign({decryptedPgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey},a!=null?{decryptedPassword:a}:{})})}update(o,a){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(r.PushAPI.ensureSignerMessage());if(!this.decryptedPgpPvtKey||!this.pgpPublicKey)throw new Error(r.PushAPI.ensureSignerMessage());return yield t.auth.update({account:this.account,pgpEncryptionVersion:o,additionalMeta:a==null?void 0:a.versionMeta,progressHook:this.progressHook,signer:this.signer,env:this.env,pgpPrivateKey:this.decryptedPgpPvtKey,pgpPublicKey:this.pgpPublicKey})})}}return iu.Encryption=s,iu}var su={},au={},Dd={exports:{}},xd={},$p={},xi={},ou={},Ui={},cu={},Ys={},Vp={},Da={},Bi={},g_;function W2(){if(g_)return Bi;g_=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.ERROR_PACKET=Bi.PACKET_TYPES_REVERSE=Bi.PACKET_TYPES=void 0;const e=Object.create(null);Bi.PACKET_TYPES=e,e.open="0",e.close="1",e.ping="2",e.pong="3",e.message="4",e.upgrade="5",e.noop="6";const t=Object.create(null);Bi.PACKET_TYPES_REVERSE=t,Object.keys(e).forEach(n=>{t[e[n]]=n});const r={type:"error",data:"parser error"};return Bi.ERROR_PACKET=r,Bi}var m_;function sM(){if(m_)return Da;m_=1,Object.defineProperty(Da,"__esModule",{value:!0}),Da.encodePacket=void 0,Da.encodePacketToBinary=f;const e=W2(),t=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",r=typeof ArrayBuffer=="function",n=c=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer,s=({type:c,data:l},u,p)=>t&&l instanceof Blob?u?p(l):i(l,p):r&&(l instanceof ArrayBuffer||n(l))?u?p(l):i(new Blob([l]),p):p(e.PACKET_TYPES[c]+(l||""));Da.encodePacket=s;const i=(c,l)=>{const u=new FileReader;return u.onload=function(){const p=u.result.split(",")[1];l("b"+(p||""))},u.readAsDataURL(c)};function o(c){return c instanceof Uint8Array?c:c instanceof ArrayBuffer?new Uint8Array(c):new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}let a;function f(c,l){if(t&&c.data instanceof Blob)return c.data.arrayBuffer().then(o).then(l);if(r&&(c.data instanceof ArrayBuffer||n(c.data)))return l(o(c.data));s(c,!1,u=>{a||(a=new TextEncoder),l(a.encode(u))})}return Da}var uu={},Js={},v_;function aM(){if(v_)return Js;v_=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.decode=Js.encode=void 0;const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;const r=s=>{let i=new Uint8Array(s),o,a=i.length,f="";for(o=0;o<a;o+=3)f+=e[i[o]>>2],f+=e[(i[o]&3)<<4|i[o+1]>>4],f+=e[(i[o+1]&15)<<2|i[o+2]>>6],f+=e[i[o+2]&63];return a%3===2?f=f.substring(0,f.length-1)+"=":a%3===1&&(f=f.substring(0,f.length-2)+"=="),f};Js.encode=r;const n=s=>{let i=s.length*.75,o=s.length,a,f=0,c,l,u,p;s[s.length-1]==="="&&(i--,s[s.length-2]==="="&&i--);const d=new ArrayBuffer(i),h=new Uint8Array(d);for(a=0;a<o;a+=4)c=t[s.charCodeAt(a)],l=t[s.charCodeAt(a+1)],u=t[s.charCodeAt(a+2)],p=t[s.charCodeAt(a+3)],h[f++]=c<<2|l>>4,h[f++]=(l&15)<<4|u>>2,h[f++]=(u&3)<<6|p&63;return d};return Js.decode=n,Js}var b_;function oM(){if(b_)return uu;b_=1,Object.defineProperty(uu,"__esModule",{value:!0}),uu.decodePacket=void 0;const e=W2(),t=aM(),r=typeof ArrayBuffer=="function",n=(o,a)=>{if(typeof o!="string")return{type:"message",data:i(o,a)};const f=o.charAt(0);return f==="b"?{type:"message",data:s(o.substring(1),a)}:e.PACKET_TYPES_REVERSE[f]?o.length>1?{type:e.PACKET_TYPES_REVERSE[f],data:o.substring(1)}:{type:e.PACKET_TYPES_REVERSE[f]}:e.ERROR_PACKET};uu.decodePacket=n;const s=(o,a)=>{if(r){const f=(0,t.decode)(o);return i(f,a)}else return{base64:!0,data:o}},i=(o,a)=>{switch(a){case"blob":return o instanceof Blob?o:new Blob([o]);case"arraybuffer":default:return o instanceof ArrayBuffer?o:o.buffer}};return uu}var __;function Vl(){return __||(__=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodePayload=e.decodePacket=e.encodePayload=e.encodePacket=e.protocol=void 0,e.createPacketEncoderStream=a,e.createPacketDecoderStream=u;const t=sM();Object.defineProperty(e,"encodePacket",{enumerable:!0,get:function(){return t.encodePacket}});const r=oM();Object.defineProperty(e,"decodePacket",{enumerable:!0,get:function(){return r.decodePacket}});const n=W2(),s=String.fromCharCode(30),i=(p,d)=>{const h=p.length,y=new Array(h);let g=0;p.forEach((m,b)=>{(0,t.encodePacket)(m,!1,w=>{y[b]=w,++g===h&&d(y.join(s))})})};e.encodePayload=i;const o=(p,d)=>{const h=p.split(s),y=[];for(let g=0;g<h.length;g++){const m=(0,r.decodePacket)(h[g],d);if(y.push(m),m.type==="error")break}return y};e.decodePayload=o;function a(){return new TransformStream({transform(p,d){(0,t.encodePacketToBinary)(p,h=>{const y=h.length;let g;if(y<126)g=new Uint8Array(1),new DataView(g.buffer).setUint8(0,y);else if(y<65536){g=new Uint8Array(3);const m=new DataView(g.buffer);m.setUint8(0,126),m.setUint16(1,y)}else{g=new Uint8Array(9);const m=new DataView(g.buffer);m.setUint8(0,127),m.setBigUint64(1,BigInt(y))}p.data&&typeof p.data!="string"&&(g[0]|=128),d.enqueue(g),d.enqueue(h)})}})}let f;function c(p){return p.reduce((d,h)=>d+h.length,0)}function l(p,d){if(p[0].length===d)return p.shift();const h=new Uint8Array(d);let y=0;for(let g=0;g<d;g++)h[g]=p[0][y++],y===p[0].length&&(p.shift(),y=0);return p.length&&y<p[0].length&&(p[0]=p[0].slice(y)),h}function u(p,d){f||(f=new TextDecoder);const h=[];let y=0,g=-1,m=!1;return new TransformStream({transform(b,w){for(h.push(b);;){if(y===0){if(c(h)<1)break;const E=l(h,1);m=(E[0]&128)===128,g=E[0]&127,g<126?y=3:g===126?y=1:y=2}else if(y===1){if(c(h)<2)break;const E=l(h,2);g=new DataView(E.buffer,E.byteOffset,E.length).getUint16(0),y=3}else if(y===2){if(c(h)<8)break;const E=l(h,8),C=new DataView(E.buffer,E.byteOffset,E.length),R=C.getUint32(0);if(R>Math.pow(2,53-32)-1){w.enqueue(n.ERROR_PACKET);break}g=R*Math.pow(2,32)+C.getUint32(4),y=3}else{if(c(h)<g)break;const E=l(h,g);w.enqueue((0,r.decodePacket)(m?E:f.decode(E),d)),y=0}if(g===0||g>p){w.enqueue(n.ERROR_PACKET);break}}}})}e.protocol=4}(Vp)),Vp}function cn(e){if(e)return cM(e)}function cM(e){for(var t in cn.prototype)e[t]=cn.prototype[t];return e}cn.prototype.on=cn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};cn.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};cn.prototype.off=cn.prototype.removeListener=cn.prototype.removeAllListeners=cn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===t||n.fn===t){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+e],this};cn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,t)}return this};cn.prototype.emitReserved=cn.prototype.emit;cn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};cn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const uM=Object.freeze(Object.defineProperty({__proto__:null,Emitter:cn},Symbol.toStringTag,{value:"Module"})),mo=El(uM);var Zs={},ii={},w_;function vo(){if(w_)return ii;w_=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.defaultBinaryType=ii.globalThisShim=ii.nextTick=void 0,ii.createCookieJar=e,ii.nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?r=>Promise.resolve().then(r):(r,n)=>n(r,0))(),ii.globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),ii.defaultBinaryType="arraybuffer";function e(){}return ii}var E_;function bo(){if(E_)return Zs;E_=1,Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.pick=t,Zs.installTimerFunctions=s,Zs.byteLength=o,Zs.randomString=f;const e=vo();function t(c,...l){return l.reduce((u,p)=>(c.hasOwnProperty(p)&&(u[p]=c[p]),u),{})}const r=e.globalThisShim.setTimeout,n=e.globalThisShim.clearTimeout;function s(c,l){l.useNativeTimers?(c.setTimeoutFn=r.bind(e.globalThisShim),c.clearTimeoutFn=n.bind(e.globalThisShim)):(c.setTimeoutFn=e.globalThisShim.setTimeout.bind(e.globalThisShim),c.clearTimeoutFn=e.globalThisShim.clearTimeout.bind(e.globalThisShim))}const i=1.33;function o(c){return typeof c=="string"?a(c):Math.ceil((c.byteLength||c.size)*i)}function a(c){let l=0,u=0;for(let p=0,d=c.length;p<d;p++)l=c.charCodeAt(p),l<128?u+=1:l<2048?u+=2:l<55296||l>=57344?u+=3:(p++,u+=4);return u}function f(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}return Zs}var lu={},A_;function ow(){if(A_)return lu;A_=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.encode=e,lu.decode=t;function e(r){let n="";for(let s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=encodeURIComponent(s)+"="+encodeURIComponent(r[s]));return n}function t(r){let n={},s=r.split("&");for(let i=0,o=s.length;i<o;i++){let a=s[i].split("=");n[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return n}return lu}var S_;function Rh(){if(S_)return Ys;S_=1;var e=It&&It.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.Transport=Ys.TransportError=void 0;const t=Vl(),r=mo,n=bo(),s=ow(),o=(0,e(Un()).default)("engine.io-client:transport");class a extends Error{constructor(l,u,p){super(l),this.description=u,this.context=p,this.type="TransportError"}}Ys.TransportError=a;class f extends r.Emitter{constructor(l){super(),this.writable=!1,(0,n.installTimerFunctions)(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,u,p){return super.emitReserved("error",new a(l,u,p)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"?this.write(l):o("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const u=(0,t.decodePacket)(l,this.socket.binaryType);this.onPacket(u)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,u={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(u)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const u=(0,s.encode)(l);return u.length?"?"+u:""}}return Ys.Transport=f,Ys}var P_;function cw(){if(P_)return cu;P_=1;var e=It&&It.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(cu,"__esModule",{value:!0}),cu.Polling=void 0;const t=Rh(),r=bo(),n=Vl(),i=(0,e(Un()).default)("engine.io-client:polling");class o extends t.Transport{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(f){this.readyState="pausing";const c=()=>{i("paused"),this.readyState="paused",f()};if(this._polling||!this.writable){let l=0;this._polling&&(i("we are currently polling - waiting to pause"),l++,this.once("pollComplete",function(){i("pre-pause polling complete"),--l||c()})),this.writable||(i("we are currently writing - waiting to pause"),l++,this.once("drain",function(){i("pre-pause writing complete"),--l||c()}))}else c()}_poll(){i("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(f){i("polling got data %s",f);const c=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};(0,n.decodePayload)(f,this.socket.binaryType).forEach(c),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():i('ignoring poll - transport state "%s"',this.readyState))}doClose(){const f=()=>{i("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(i("transport open - closing"),f()):(i("transport not open - deferring close"),this.once("open",f))}write(f){this.writable=!1,(0,n.encodePayload)(f,c=>{this.doWrite(c,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const f=this.opts.secure?"https":"http",c=this.query||{};return this.opts.timestampRequests!==!1&&(c[this.opts.timestampParam]=(0,r.randomString)()),!this.supportsBinary&&!c.sid&&(c.b64=1),this.createUri(f,c)}}return cu.Polling=o,cu}var du={},T_;function lM(){if(T_)return du;T_=1,Object.defineProperty(du,"__esModule",{value:!0}),du.hasCORS=void 0;let e=!1;try{e=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}return du.hasCORS=e,du}var I_;function My(){if(I_)return Ui;I_=1;var e=It&&It.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.XHR=Ui.Request=Ui.BaseXHR=void 0;const t=cw(),r=mo,n=bo(),s=vo(),i=lM(),a=(0,e(Un()).default)("engine.io-client:polling");function f(){}class c extends t.Polling{constructor(g){if(super(g),typeof location<"u"){const m=location.protocol==="https:";let b=location.port;b||(b=m?"443":"80"),this.xd=typeof location<"u"&&g.hostname!==location.hostname||b!==g.port}}doWrite(g,m){const b=this.request({method:"POST",data:g});b.on("success",m),b.on("error",(w,E)=>{this.onError("xhr post error",w,E)})}doPoll(){a("xhr poll");const g=this.request();g.on("data",this.onData.bind(this)),g.on("error",(m,b)=>{this.onError("xhr poll error",m,b)}),this.pollXhr=g}}Ui.BaseXHR=c;class l extends r.Emitter{constructor(g,m,b){super(),this.createRequest=g,(0,n.installTimerFunctions)(this,b),this._opts=b,this._method=b.method||"GET",this._uri=m,this._data=b.data!==void 0?b.data:null,this._create()}_create(){var g;const m=(0,n.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");m.xdomain=!!this._opts.xd;const b=this._xhr=this.createRequest(m);try{a("xhr open %s: %s",this._method,this._uri),b.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){b.setDisableHeaderCheck&&b.setDisableHeaderCheck(!0);for(let w in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(w)&&b.setRequestHeader(w,this._opts.extraHeaders[w])}}catch{}if(this._method==="POST")try{b.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{b.setRequestHeader("Accept","*/*")}catch{}(g=this._opts.cookieJar)===null||g===void 0||g.addCookies(b),"withCredentials"in b&&(b.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(b.timeout=this._opts.requestTimeout),b.onreadystatechange=()=>{var w;b.readyState===3&&((w=this._opts.cookieJar)===null||w===void 0||w.parseCookies(b.getResponseHeader("set-cookie"))),b.readyState===4&&(b.status===200||b.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof b.status=="number"?b.status:0)},0))},a("xhr data %s",this._data),b.send(this._data)}catch(w){this.setTimeoutFn(()=>{this._onError(w)},0);return}typeof document<"u"&&(this._index=l.requestsCount++,l.requests[this._index]=this)}_onError(g){this.emitReserved("error",g,this._xhr),this._cleanup(!0)}_cleanup(g){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=f,g)try{this._xhr.abort()}catch{}typeof document<"u"&&delete l.requests[this._index],this._xhr=null}}_onLoad(){const g=this._xhr.responseText;g!==null&&(this.emitReserved("data",g),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Ui.Request=l,l.requestsCount=0,l.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",u);else if(typeof addEventListener=="function"){const y="onpagehide"in s.globalThisShim?"pagehide":"unload";addEventListener(y,u,!1)}}function u(){for(let y in l.requests)l.requests.hasOwnProperty(y)&&l.requests[y].abort()}const p=function(){const y=h({xdomain:!1});return y&&y.responseType!==null}();class d extends c{constructor(g){super(g);const m=g&&g.forceBase64;this.supportsBinary=p&&!m}request(g={}){return Object.assign(g,{xd:this.xd},this.opts),new l(h,this.uri(),g)}}Ui.XHR=d;function h(y){const g=y.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!g||i.hasCORS))return new XMLHttpRequest}catch{}if(!g)try{return new s.globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}return Ui}var Xs={},C_;function Oy(){if(C_)return Xs;C_=1;var e=It&&It.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.WS=Xs.BaseWS=void 0;const t=Rh(),r=bo(),n=Vl(),s=vo(),o=(0,e(Un()).default)("engine.io-client:websocket"),a=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class f extends t.Transport{get name(){return"websocket"}doOpen(){const p=this.uri(),d=this.opts.protocols,h=a?{}:(0,r.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(h.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(p,d,h)}catch(y){return this.emitReserved("error",y)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=p=>this.onClose({description:"websocket connection closed",context:p}),this.ws.onmessage=p=>this.onData(p.data),this.ws.onerror=p=>this.onError("websocket error",p)}write(p){this.writable=!1;for(let d=0;d<p.length;d++){const h=p[d],y=d===p.length-1;(0,n.encodePacket)(h,this.supportsBinary,g=>{try{this.doWrite(h,g)}catch{o("websocket closed before onclose event")}y&&(0,s.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const p=this.opts.secure?"wss":"ws",d=this.query||{};return this.opts.timestampRequests&&(d[this.opts.timestampParam]=(0,r.randomString)()),this.supportsBinary||(d.b64=1),this.createUri(p,d)}}Xs.BaseWS=f;const c=s.globalThisShim.WebSocket||s.globalThisShim.MozWebSocket;class l extends f{createSocket(p,d,h){return a?new c(p,d,h):d?new c(p,d):new c(p)}doWrite(p,d){this.ws.send(d)}}return Xs.WS=l,Xs}var fu={},R_;function uw(){if(R_)return fu;R_=1;var e=It&&It.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(fu,"__esModule",{value:!0}),fu.WT=void 0;const t=Rh(),r=vo(),n=Vl(),i=(0,e(Un()).default)("engine.io-client:webtransport");class o extends t.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(f){return this.emitReserved("error",f)}this._transport.closed.then(()=>{i("transport closed gracefully"),this.onClose()}).catch(f=>{i("transport closed due to %s",f),this.onError("webtransport error",f)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(f=>{const c=(0,n.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=f.readable.pipeThrough(c).getReader(),u=(0,n.createPacketEncoderStream)();u.readable.pipeTo(f.writable),this._writer=u.writable.getWriter();const p=()=>{l.read().then(({done:h,value:y})=>{if(h){i("session is closed");return}i("received chunk: %o",y),this.onPacket(y),p()}).catch(h=>{i("an error occurred while reading: %s",h)})};p();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(f){this.writable=!1;for(let c=0;c<f.length;c++){const l=f[c],u=c===f.length-1;this._writer.write(l).then(()=>{u&&(0,r.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var f;(f=this._transport)===null||f===void 0||f.close()}}return fu.WT=o,fu}var k_;function lw(){if(k_)return ou;k_=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.transports=void 0;const e=My(),t=Oy(),r=uw();return ou.transports={websocket:t.WS,webtransport:r.WT,polling:e.XHR},ou}var Ud={},M_;function dw(){if(M_)return Ud;M_=1,Object.defineProperty(Ud,"__esModule",{value:!0}),Ud.parse=r;const e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,t=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function r(i){if(i.length>8e3)throw"URI too long";const o=i,a=i.indexOf("["),f=i.indexOf("]");a!=-1&&f!=-1&&(i=i.substring(0,a)+i.substring(a,f).replace(/:/g,";")+i.substring(f,i.length));let c=e.exec(i||""),l={},u=14;for(;u--;)l[t[u]]=c[u]||"";return a!=-1&&f!=-1&&(l.source=o,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=n(l,l.path),l.queryKey=s(l,l.query),l}function n(i,o){const a=/\/{2,9}/g,f=o.replace(a,"/").split("/");return(o.slice(0,1)=="/"||o.length===0)&&f.splice(0,1),o.slice(-1)=="/"&&f.splice(f.length-1,1),f}function s(i,o){const a={};return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(f,c,l){c&&(a[c]=l)}),a}return Ud}var O_;function N_(){if(O_)return xi;O_=1;var e=It&&It.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(xi,"__esModule",{value:!0}),xi.Socket=xi.SocketWithUpgrade=xi.SocketWithoutUpgrade=void 0;const t=lw(),r=bo(),n=ow(),s=dw(),i=mo,o=Vl(),a=vo(),c=(0,e(Un()).default)("engine.io-client:socket"),l=typeof addEventListener=="function"&&typeof removeEventListener=="function",u=[];l&&addEventListener("offline",()=>{c("closing %d connection(s) because the network was lost",u.length),u.forEach(y=>y())},!1);class p extends i.Emitter{constructor(g,m){if(super(),this.binaryType=a.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,g&&typeof g=="object"&&(m=g,g=null),g){const b=(0,s.parse)(g);m.hostname=b.host,m.secure=b.protocol==="https"||b.protocol==="wss",m.port=b.port,b.query&&(m.query=b.query)}else m.host&&(m.hostname=(0,s.parse)(m.host).host);(0,r.installTimerFunctions)(this,m),this.secure=m.secure!=null?m.secure:typeof location<"u"&&location.protocol==="https:",m.hostname&&!m.port&&(m.port=this.secure?"443":"80"),this.hostname=m.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=m.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},m.transports.forEach(b=>{const w=b.prototype.name;this.transports.push(w),this._transportsByName[w]=b}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},m),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=(0,n.decode)(this.opts.query)),l&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(c("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},u.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=(0,a.createCookieJar)()),this._open()}createTransport(g){c('creating transport "%s"',g);const m=Object.assign({},this.opts.query);m.EIO=o.protocol,m.transport=g,this.id&&(m.sid=this.id);const b=Object.assign({},this.opts,{query:m,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[g]);return c("options: %j",b),new this._transportsByName[g](b)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const g=this.opts.rememberUpgrade&&p.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const m=this.createTransport(g);m.open(),this.setTransport(m)}setTransport(g){c("setting transport %s",g.name),this.transport&&(c("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=g,g.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",m=>this._onClose("transport close",m))}onOpen(){c("socket open"),this.readyState="open",p.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(g){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c('socket receive: type "%s", data "%s"',g.type,g.data),this.emitReserved("packet",g),this.emitReserved("heartbeat"),g.type){case"open":this.onHandshake(JSON.parse(g.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const m=new Error("server error");m.code=g.data,this._onError(m);break;case"message":this.emitReserved("data",g.data),this.emitReserved("message",g.data);break}else c('packet received with socket readyState "%s"',this.readyState)}onHandshake(g){this.emitReserved("handshake",g),this.id=g.sid,this.transport.query.sid=g.sid,this._pingInterval=g.pingInterval,this._pingTimeout=g.pingTimeout,this._maxPayload=g.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const g=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+g,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},g),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const g=this._getWritablePackets();c("flushing %d packets in socket",g.length),this.transport.send(g),this._prevBufferLen=g.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let m=1;for(let b=0;b<this.writeBuffer.length;b++){const w=this.writeBuffer[b].data;if(w&&(m+=(0,r.byteLength)(w)),b>0&&m>this._maxPayload)return c("only send %d out of %d packets",b,this.writeBuffer.length),this.writeBuffer.slice(0,b);m+=2}return c("payload size is %d (max: %d)",m,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const g=Date.now()>this._pingTimeoutTime;return g&&(c("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,a.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),g}write(g,m,b){return this._sendPacket("message",g,m,b),this}send(g,m,b){return this._sendPacket("message",g,m,b),this}_sendPacket(g,m,b,w){if(typeof m=="function"&&(w=m,m=void 0),typeof b=="function"&&(w=b,b=null),this.readyState==="closing"||this.readyState==="closed")return;b=b||{},b.compress=b.compress!==!1;const E={type:g,data:m,options:b};this.emitReserved("packetCreate",E),this.writeBuffer.push(E),w&&this.once("flush",w),this.flush()}close(){const g=()=>{this._onClose("forced close"),c("socket closing - telling transport to close"),this.transport.close()},m=()=>{this.off("upgrade",m),this.off("upgradeError",m),g()},b=()=>{this.once("upgrade",m),this.once("upgradeError",m)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?b():g()}):this.upgrading?b():g()),this}_onError(g){if(c("socket error %j",g),p.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return c("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",g),this._onClose("transport error",g)}_onClose(g,m){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(c('socket close with reason: "%s"',g),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),l&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const b=u.indexOf(this._offlineEventListener);b!==-1&&(c("removing listener for the 'offline' event"),u.splice(b,1))}this.readyState="closed",this.id=null,this.emitReserved("close",g,m),this.writeBuffer=[],this._prevBufferLen=0}}}xi.SocketWithoutUpgrade=p,p.protocol=o.protocol;class d extends p{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){c("starting upgrade probes");for(let g=0;g<this._upgrades.length;g++)this._probe(this._upgrades[g])}}_probe(g){c('probing transport "%s"',g);let m=this.createTransport(g),b=!1;p.priorWebsocketSuccess=!1;const w=()=>{b||(c('probe transport "%s" opened',g),m.send([{type:"ping",data:"probe"}]),m.once("packet",I=>{if(!b)if(I.type==="pong"&&I.data==="probe"){if(c('probe transport "%s" pong',g),this.upgrading=!0,this.emitReserved("upgrading",m),!m)return;p.priorWebsocketSuccess=m.name==="websocket",c('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{b||this.readyState!=="closed"&&(c("changing transport and sending upgrade packet"),A(),this.setTransport(m),m.send([{type:"upgrade"}]),this.emitReserved("upgrade",m),m=null,this.upgrading=!1,this.flush())})}else{c('probe transport "%s" failed',g);const P=new Error("probe error");P.transport=m.name,this.emitReserved("upgradeError",P)}}))};function E(){b||(b=!0,A(),m.close(),m=null)}const C=I=>{const P=new Error("probe error: "+I);P.transport=m.name,E(),c('probe transport "%s" failed because of error: %s',g,I),this.emitReserved("upgradeError",P)};function R(){C("transport closed")}function M(){C("socket closed")}function _(I){m&&I.name!==m.name&&(c('"%s" works - aborting "%s"',I.name,m.name),E())}const A=()=>{m.removeListener("open",w),m.removeListener("error",C),m.removeListener("close",R),this.off("close",M),this.off("upgrading",_)};m.once("open",w),m.once("error",C),m.once("close",R),this.once("close",M),this.once("upgrading",_),this._upgrades.indexOf("webtransport")!==-1&&g!=="webtransport"?this.setTimeoutFn(()=>{b||m.open()},200):m.open()}onHandshake(g){this._upgrades=this._filterUpgrades(g.upgrades),super.onHandshake(g)}_filterUpgrades(g){const m=[];for(let b=0;b<g.length;b++)~this.transports.indexOf(g[b])&&m.push(g[b]);return m}}xi.SocketWithUpgrade=d;class h extends d{constructor(g,m={}){const b=typeof g=="object"?g:m;(!b.transports||b.transports&&typeof b.transports[0]=="string")&&(b.transports=(b.transports||["polling","websocket","webtransport"]).map(w=>t.transports[w]).filter(w=>!!w)),super(g,b)}}return xi.Socket=h,xi}var hu={},D_;function dM(){if(D_)return hu;D_=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.Fetch=void 0;const e=cw();class t extends e.Polling{doPoll(){this._fetch().then(n=>{if(!n.ok)return this.onError("fetch read error",n.status,n);n.text().then(s=>this.onData(s))}).catch(n=>{this.onError("fetch read error",n)})}doWrite(n,s){this._fetch(n).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);s()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(n){var s;const i=n!==void 0,o=new Headers(this.opts.extraHeaders);return i&&o.set("content-type","text/plain;charset=UTF-8"),(s=this.socket._cookieJar)===null||s===void 0||s.appendCookies(o),fetch(this.uri(),{method:i?"POST":"GET",body:i?n:null,headers:o,credentials:this.opts.withCredentials?"include":"omit"}).then(a=>{var f;return(f=this.socket._cookieJar)===null||f===void 0||f.parseCookies(a.headers.getSetCookie()),a})}}return hu.Fetch=t,hu}var x_;function Y2(){return x_||(x_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebTransport=e.WebSocket=e.NodeWebSocket=e.XHR=e.NodeXHR=e.Fetch=e.nextTick=e.parse=e.installTimerFunctions=e.transports=e.TransportError=e.Transport=e.protocol=e.SocketWithUpgrade=e.SocketWithoutUpgrade=e.Socket=void 0;const t=N_();Object.defineProperty(e,"Socket",{enumerable:!0,get:function(){return t.Socket}});var r=N_();Object.defineProperty(e,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return r.SocketWithoutUpgrade}}),Object.defineProperty(e,"SocketWithUpgrade",{enumerable:!0,get:function(){return r.SocketWithUpgrade}}),e.protocol=t.Socket.protocol;var n=Rh();Object.defineProperty(e,"Transport",{enumerable:!0,get:function(){return n.Transport}}),Object.defineProperty(e,"TransportError",{enumerable:!0,get:function(){return n.TransportError}});var s=lw();Object.defineProperty(e,"transports",{enumerable:!0,get:function(){return s.transports}});var i=bo();Object.defineProperty(e,"installTimerFunctions",{enumerable:!0,get:function(){return i.installTimerFunctions}});var o=dw();Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return o.parse}});var a=vo();Object.defineProperty(e,"nextTick",{enumerable:!0,get:function(){return a.nextTick}});var f=dM();Object.defineProperty(e,"Fetch",{enumerable:!0,get:function(){return f.Fetch}});var c=My();Object.defineProperty(e,"NodeXHR",{enumerable:!0,get:function(){return c.XHR}});var l=My();Object.defineProperty(e,"XHR",{enumerable:!0,get:function(){return l.XHR}});var u=Oy();Object.defineProperty(e,"NodeWebSocket",{enumerable:!0,get:function(){return u.WS}});var p=Oy();Object.defineProperty(e,"WebSocket",{enumerable:!0,get:function(){return p.WS}});var d=uw();Object.defineProperty(e,"WebTransport",{enumerable:!0,get:function(){return d.WT}})}($p)),$p}var U_;function fM(){if(U_)return xd;U_=1;var e=It&&It.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(xd,"__esModule",{value:!0}),xd.url=s;const t=Y2(),n=(0,e(Un()).default)("socket.io-client:url");function s(i,o="",a){let f=i;a=a||typeof location<"u"&&location,i==null&&(i=a.protocol+"//"+a.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=a.protocol+i:i=a.host+i),/^(https?|wss?):\/\//.test(i)||(n("protocol-less url %s",i),typeof a<"u"?i=a.protocol+"//"+i:i="https://"+i),n("parse %s",i),f=(0,t.parse)(i)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/";const l=f.host.indexOf(":")!==-1?"["+f.host+"]":f.host;return f.id=f.protocol+"://"+l+":"+f.port+o,f.href=f.protocol+"://"+l+(a&&a.port===f.port?"":":"+f.port),f}return xd}var pu={},yu={},Rn={},gu={},mu={},B_;function fw(){if(B_)return mu;B_=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.isBinary=i,mu.hasBinary=o;const e=typeof ArrayBuffer=="function",t=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,r=Object.prototype.toString,n=typeof Blob=="function"||typeof Blob<"u"&&r.call(Blob)==="[object BlobConstructor]",s=typeof File=="function"||typeof File<"u"&&r.call(File)==="[object FileConstructor]";function i(a){return e&&(a instanceof ArrayBuffer||t(a))||n&&a instanceof Blob||s&&a instanceof File}function o(a,f){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let c=0,l=a.length;c<l;c++)if(o(a[c]))return!0;return!1}if(i(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return o(a.toJSON(),!0);for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&o(a[c]))return!0;return!1}return mu}var L_;function hM(){if(L_)return gu;L_=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.deconstructPacket=t,gu.reconstructPacket=n;const e=fw();function t(i){const o=[],a=i.data,f=i;return f.data=r(a,o),f.attachments=o.length,{packet:f,buffers:o}}function r(i,o){if(!i)return i;if((0,e.isBinary)(i)){const a={_placeholder:!0,num:o.length};return o.push(i),a}else if(Array.isArray(i)){const a=new Array(i.length);for(let f=0;f<i.length;f++)a[f]=r(i[f],o);return a}else if(typeof i=="object"&&!(i instanceof Date)){const a={};for(const f in i)Object.prototype.hasOwnProperty.call(i,f)&&(a[f]=r(i[f],o));return a}return i}function n(i,o){return i.data=s(i.data,o),delete i.attachments,i}function s(i,o){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<o.length)return o[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let a=0;a<i.length;a++)i[a]=s(i[a],o);else if(typeof i=="object")for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&(i[a]=s(i[a],o));return i}return gu}var K_;function J2(){if(K_)return Rn;K_=1,Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.Decoder=Rn.Encoder=Rn.PacketType=Rn.protocol=void 0,Rn.isPacketValid=y;const e=mo,t=hM(),r=fw(),s=(0,Un().default)("socket.io-parser"),i=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];Rn.protocol=5;var o;(function(g){g[g.CONNECT=0]="CONNECT",g[g.DISCONNECT=1]="DISCONNECT",g[g.EVENT=2]="EVENT",g[g.ACK=3]="ACK",g[g.CONNECT_ERROR=4]="CONNECT_ERROR",g[g.BINARY_EVENT=5]="BINARY_EVENT",g[g.BINARY_ACK=6]="BINARY_ACK"})(o||(Rn.PacketType=o={}));class a{constructor(m){this.replacer=m}encode(m){return s("encoding packet %j",m),(m.type===o.EVENT||m.type===o.ACK)&&(0,r.hasBinary)(m)?this.encodeAsBinary({type:m.type===o.EVENT?o.BINARY_EVENT:o.BINARY_ACK,nsp:m.nsp,data:m.data,id:m.id}):[this.encodeAsString(m)]}encodeAsString(m){let b=""+m.type;return(m.type===o.BINARY_EVENT||m.type===o.BINARY_ACK)&&(b+=m.attachments+"-"),m.nsp&&m.nsp!=="/"&&(b+=m.nsp+","),m.id!=null&&(b+=m.id),m.data!=null&&(b+=JSON.stringify(m.data,this.replacer)),s("encoded %j as %s",m,b),b}encodeAsBinary(m){const b=(0,t.deconstructPacket)(m),w=this.encodeAsString(b.packet),E=b.buffers;return E.unshift(w),E}}Rn.Encoder=a;class f extends e.Emitter{constructor(m){super(),this.reviver=m}add(m){let b;if(typeof m=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");b=this.decodeString(m);const w=b.type===o.BINARY_EVENT;w||b.type===o.BINARY_ACK?(b.type=w?o.EVENT:o.ACK,this.reconstructor=new c(b),b.attachments===0&&super.emitReserved("decoded",b)):super.emitReserved("decoded",b)}else if((0,r.isBinary)(m)||m.base64)if(this.reconstructor)b=this.reconstructor.takeBinaryData(m),b&&(this.reconstructor=null,super.emitReserved("decoded",b));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+m)}decodeString(m){let b=0;const w={type:Number(m.charAt(0))};if(o[w.type]===void 0)throw new Error("unknown packet type "+w.type);if(w.type===o.BINARY_EVENT||w.type===o.BINARY_ACK){const C=b+1;for(;m.charAt(++b)!=="-"&&b!=m.length;);const R=m.substring(C,b);if(R!=Number(R)||m.charAt(b)!=="-")throw new Error("Illegal attachments");w.attachments=Number(R)}if(m.charAt(b+1)==="/"){const C=b+1;for(;++b&&!(m.charAt(b)===","||b===m.length););w.nsp=m.substring(C,b)}else w.nsp="/";const E=m.charAt(b+1);if(E!==""&&Number(E)==E){const C=b+1;for(;++b;){const R=m.charAt(b);if(R==null||Number(R)!=R){--b;break}if(b===m.length)break}w.id=Number(m.substring(C,b+1))}if(m.charAt(++b)){const C=this.tryParse(m.substr(b));if(f.isPayloadValid(w.type,C))w.data=C;else throw new Error("invalid payload")}return s("decoded %s as %j",m,w),w}tryParse(m){try{return JSON.parse(m,this.reviver)}catch{return!1}}static isPayloadValid(m,b){switch(m){case o.CONNECT:return d(b);case o.DISCONNECT:return b===void 0;case o.CONNECT_ERROR:return typeof b=="string"||d(b);case o.EVENT:case o.BINARY_EVENT:return Array.isArray(b)&&(typeof b[0]=="number"||typeof b[0]=="string"&&i.indexOf(b[0])===-1);case o.ACK:case o.BINARY_ACK:return Array.isArray(b)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}Rn.Decoder=f;class c{constructor(m){this.packet=m,this.buffers=[],this.reconPack=m}takeBinaryData(m){if(this.buffers.push(m),this.buffers.length===this.reconPack.attachments){const b=(0,t.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),b}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function l(g){return typeof g=="string"}const u=Number.isInteger||function(g){return typeof g=="number"&&isFinite(g)&&Math.floor(g)===g};function p(g){return g===void 0||u(g)}function d(g){return Object.prototype.toString.call(g)==="[object Object]"}function h(g,m){switch(g){case o.CONNECT:return m===void 0||d(m);case o.DISCONNECT:return m===void 0;case o.EVENT:return Array.isArray(m)&&(typeof m[0]=="number"||typeof m[0]=="string"&&i.indexOf(m[0])===-1);case o.ACK:return Array.isArray(m);case o.CONNECT_ERROR:return typeof m=="string"||d(m);default:return!1}}function y(g){return l(g.nsp)&&p(g.id)&&h(g.type,g.data)}return Rn}var Bd={},j_;function hw(){if(j_)return Bd;j_=1,Object.defineProperty(Bd,"__esModule",{value:!0}),Bd.on=e;function e(t,r,n){return t.on(r,n),function(){t.off(r,n)}}return Bd}var q_;function pw(){if(q_)return yu;q_=1;var e=It&&It.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(yu,"__esModule",{value:!0}),yu.Socket=void 0;const t=J2(),r=hw(),n=mo,i=(0,e(Un()).default)("socket.io-client:socket"),o=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class a extends n.Emitter{constructor(c,l,u){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=c,this.nsp=l,u&&u.auth&&(this.auth=u.auth),this._opts=Object.assign({},u),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const c=this.io;this.subs=[(0,r.on)(c,"open",this.onopen.bind(this)),(0,r.on)(c,"packet",this.onpacket.bind(this)),(0,r.on)(c,"error",this.onerror.bind(this)),(0,r.on)(c,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...c){return c.unshift("message"),this.emit.apply(this,c),this}emit(c,...l){var u,p,d;if(o.hasOwnProperty(c))throw new Error('"'+c.toString()+'" is a reserved event name');if(l.unshift(c),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(l),this;const h={type:t.PacketType.EVENT,data:l};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof l[l.length-1]=="function"){const b=this.ids++;i("emitting packet with ack id %d",b);const w=l.pop();this._registerAckCallback(b,w),h.id=b}const y=(p=(u=this.io.engine)===null||u===void 0?void 0:u.transport)===null||p===void 0?void 0:p.writable,g=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!y?i("discard packet as the transport is not currently writable"):g?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h),this.flags={},this}_registerAckCallback(c,l){var u;const p=(u=this.flags.timeout)!==null&&u!==void 0?u:this._opts.ackTimeout;if(p===void 0){this.acks[c]=l;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[c];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===c&&(i("removing packet with ack id %d from the buffer",c),this.sendBuffer.splice(y,1));i("event with ack id %d has timed out after %d ms",c,p),l.call(this,new Error("operation has timed out"))},p),h=(...y)=>{this.io.clearTimeoutFn(d),l.apply(this,y)};h.withError=!0,this.acks[c]=h}emitWithAck(c,...l){return new Promise((u,p)=>{const d=(h,y)=>h?p(h):u(y);d.withError=!0,l.push(d),this.emit(c,...l)})}_addToQueue(c){let l;typeof c[c.length-1]=="function"&&(l=c.pop());const u={id:this._queueSeq++,tryCount:0,pending:!1,args:c,flags:Object.assign({fromQueue:!0},this.flags)};c.push((p,...d)=>u!==this._queue[0]?i("packet [%d] already acknowledged",u.id):(p!==null?u.tryCount>this._opts.retries&&(i("packet [%d] is discarded after %d tries",u.id,u.tryCount),this._queue.shift(),l&&l(p)):(i("packet [%d] was successfully sent",u.id),this._queue.shift(),l&&l(null,...d)),u.pending=!1,this._drainQueue())),this._queue.push(u),this._drainQueue()}_drainQueue(c=!1){if(i("draining queue"),!this.connected||this._queue.length===0)return;const l=this._queue[0];if(l.pending&&!c){i("packet [%d] has already been sent and is waiting for an ack",l.id);return}l.pending=!0,l.tryCount++,i("sending packet [%d] (try n°%d)",l.id,l.tryCount),this.flags=l.flags,this.emit.apply(this,l.args)}packet(c){c.nsp=this.nsp,this.io._packet(c)}onopen(){i("transport is open - connecting"),typeof this.auth=="function"?this.auth(c=>{this._sendConnectPacket(c)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(c){this.packet({type:t.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},c):c})}onerror(c){this.connected||this.emitReserved("connect_error",c)}onclose(c,l){i("close (%s)",c),this.connected=!1,delete this.id,this.emitReserved("disconnect",c,l),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(c=>{if(!this.sendBuffer.some(u=>String(u.id)===c)){const u=this.acks[c];delete this.acks[c],u.withError&&u.call(this,new Error("socket has been disconnected"))}})}onpacket(c){if(c.nsp===this.nsp)switch(c.type){case t.PacketType.CONNECT:c.data&&c.data.sid?this.onconnect(c.data.sid,c.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case t.PacketType.EVENT:case t.PacketType.BINARY_EVENT:this.onevent(c);break;case t.PacketType.ACK:case t.PacketType.BINARY_ACK:this.onack(c);break;case t.PacketType.DISCONNECT:this.ondisconnect();break;case t.PacketType.CONNECT_ERROR:this.destroy();const u=new Error(c.data.message);u.data=c.data.data,this.emitReserved("connect_error",u);break}}onevent(c){const l=c.data||[];i("emitting event %j",l),c.id!=null&&(i("attaching ack callback to event"),l.push(this.ack(c.id))),this.connected?this.emitEvent(l):this.receiveBuffer.push(Object.freeze(l))}emitEvent(c){if(this._anyListeners&&this._anyListeners.length){const l=this._anyListeners.slice();for(const u of l)u.apply(this,c)}super.emit.apply(this,c),this._pid&&c.length&&typeof c[c.length-1]=="string"&&(this._lastOffset=c[c.length-1])}ack(c){const l=this;let u=!1;return function(...p){u||(u=!0,i("sending ack %j",p),l.packet({type:t.PacketType.ACK,id:c,data:p}))}}onack(c){const l=this.acks[c.id];if(typeof l!="function"){i("bad ack %s",c.id);return}delete this.acks[c.id],i("calling ack %s with %j",c.id,c.data),l.withError&&c.data.unshift(null),l.apply(this,c.data)}onconnect(c,l){i("socket connected with id %s",c),this.id=c,this.recovered=l&&this._pid===l,this._pid=l,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(c=>this.emitEvent(c)),this.receiveBuffer=[],this.sendBuffer.forEach(c=>{this.notifyOutgoingListeners(c),this.packet(c)}),this.sendBuffer=[]}ondisconnect(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(c=>c()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:t.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(c){return this.flags.compress=c,this}get volatile(){return this.flags.volatile=!0,this}timeout(c){return this.flags.timeout=c,this}onAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(c),this}prependAny(c){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(c),this}offAny(c){if(!this._anyListeners)return this;if(c){const l=this._anyListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(c),this}prependAnyOutgoing(c){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(c),this}offAnyOutgoing(c){if(!this._anyOutgoingListeners)return this;if(c){const l=this._anyOutgoingListeners;for(let u=0;u<l.length;u++)if(c===l[u])return l.splice(u,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(c){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const l=this._anyOutgoingListeners.slice();for(const u of l)u.apply(this,c.data)}}}return yu.Socket=a,yu}var Ld={},$_;function pM(){if($_)return Ld;$_=1,Object.defineProperty(Ld,"__esModule",{value:!0}),Ld.Backoff=e;function e(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}return e.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),n=Math.floor(r*this.jitter*t);t=Math.floor(r*10)&1?t+n:t-n}return Math.min(t,this.max)|0},e.prototype.reset=function(){this.attempts=0},e.prototype.setMin=function(t){this.ms=t},e.prototype.setMax=function(t){this.max=t},e.prototype.setJitter=function(t){this.jitter=t},Ld}var V_;function yM(){if(V_)return pu;V_=1;var e=It&&It.__createBinding||(Object.create?function(d,h,y,g){g===void 0&&(g=y);var m=Object.getOwnPropertyDescriptor(h,y);(!m||("get"in m?!h.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return h[y]}}),Object.defineProperty(d,g,m)}:function(d,h,y,g){g===void 0&&(g=y),d[g]=h[y]}),t=It&&It.__setModuleDefault||(Object.create?function(d,h){Object.defineProperty(d,"default",{enumerable:!0,value:h})}:function(d,h){d.default=h}),r=It&&It.__importStar||function(d){if(d&&d.__esModule)return d;var h={};if(d!=null)for(var y in d)y!=="default"&&Object.prototype.hasOwnProperty.call(d,y)&&e(h,d,y);return t(h,d),h},n=It&&It.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(pu,"__esModule",{value:!0}),pu.Manager=void 0;const s=Y2(),i=pw(),o=r(J2()),a=hw(),f=pM(),c=mo,u=(0,n(Un()).default)("socket.io-client:manager");class p extends c.Emitter{constructor(h,y){var g;super(),this.nsps={},this.subs=[],h&&typeof h=="object"&&(y=h,h=void 0),y=y||{},y.path=y.path||"/socket.io",this.opts=y,(0,s.installTimerFunctions)(this,y),this.reconnection(y.reconnection!==!1),this.reconnectionAttempts(y.reconnectionAttempts||1/0),this.reconnectionDelay(y.reconnectionDelay||1e3),this.reconnectionDelayMax(y.reconnectionDelayMax||5e3),this.randomizationFactor((g=y.randomizationFactor)!==null&&g!==void 0?g:.5),this.backoff=new f.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(y.timeout==null?2e4:y.timeout),this._readyState="closed",this.uri=h;const m=y.parser||o;this.encoder=new m.Encoder,this.decoder=new m.Decoder,this._autoConnect=y.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(h){return arguments.length?(this._reconnection=!!h,h||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(h){return h===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=h,this)}reconnectionDelay(h){var y;return h===void 0?this._reconnectionDelay:(this._reconnectionDelay=h,(y=this.backoff)===null||y===void 0||y.setMin(h),this)}randomizationFactor(h){var y;return h===void 0?this._randomizationFactor:(this._randomizationFactor=h,(y=this.backoff)===null||y===void 0||y.setJitter(h),this)}reconnectionDelayMax(h){var y;return h===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=h,(y=this.backoff)===null||y===void 0||y.setMax(h),this)}timeout(h){return arguments.length?(this._timeout=h,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(h){if(u("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=new s.Socket(this.uri,this.opts);const y=this.engine,g=this;this._readyState="opening",this.skipReconnect=!1;const m=(0,a.on)(y,"open",function(){g.onopen(),h&&h()}),b=E=>{u("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",E),h?h(E):this.maybeReconnectOnOpen()},w=(0,a.on)(y,"error",b);if(this._timeout!==!1){const E=this._timeout;u("connect attempt will timeout after %d",E);const C=this.setTimeoutFn(()=>{u("connect attempt timed out after %d",E),m(),b(new Error("timeout")),y.close()},E);this.opts.autoUnref&&C.unref(),this.subs.push(()=>{this.clearTimeoutFn(C)})}return this.subs.push(m),this.subs.push(w),this}connect(h){return this.open(h)}onopen(){u("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");const h=this.engine;this.subs.push((0,a.on)(h,"ping",this.onping.bind(this)),(0,a.on)(h,"data",this.ondata.bind(this)),(0,a.on)(h,"error",this.onerror.bind(this)),(0,a.on)(h,"close",this.onclose.bind(this)),(0,a.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(h){try{this.decoder.add(h)}catch(y){this.onclose("parse error",y)}}ondecoded(h){(0,s.nextTick)(()=>{this.emitReserved("packet",h)},this.setTimeoutFn)}onerror(h){u("error",h),this.emitReserved("error",h)}socket(h,y){let g=this.nsps[h];return g?this._autoConnect&&!g.active&&g.connect():(g=new i.Socket(this,h,y),this.nsps[h]=g),g}_destroy(h){const y=Object.keys(this.nsps);for(const g of y)if(this.nsps[g].active){u("socket %s is still active, skipping close",g);return}this._close()}_packet(h){u("writing packet %j",h);const y=this.encoder.encode(h);for(let g=0;g<y.length;g++)this.engine.write(y[g],h.options)}cleanup(){u("cleanup"),this.subs.forEach(h=>h()),this.subs.length=0,this.decoder.destroy()}_close(){u("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(h,y){var g;u("closed due to %s",h),this.cleanup(),(g=this.engine)===null||g===void 0||g.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",h,y),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const h=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const y=this.backoff.duration();u("will wait %dms before reconnect attempt",y),this._reconnecting=!0;const g=this.setTimeoutFn(()=>{h.skipReconnect||(u("attempting reconnect"),this.emitReserved("reconnect_attempt",h.backoff.attempts),!h.skipReconnect&&h.open(m=>{m?(u("reconnect attempt error"),h._reconnecting=!1,h.reconnect(),this.emitReserved("reconnect_error",m)):(u("reconnect success"),h.onreconnect())}))},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}}onreconnect(){const h=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",h)}}return pu.Manager=p,pu}var F_;function gM(){return F_||(F_=1,function(e,t){var r=It&&It.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebTransport=t.WebSocket=t.NodeWebSocket=t.XHR=t.NodeXHR=t.Fetch=t.Socket=t.Manager=t.protocol=void 0,t.io=c,t.connect=c,t.default=c;const n=fM(),s=yM();Object.defineProperty(t,"Manager",{enumerable:!0,get:function(){return s.Manager}});const i=pw();Object.defineProperty(t,"Socket",{enumerable:!0,get:function(){return i.Socket}});const a=(0,r(Un()).default)("socket.io-client"),f={};function c(p,d){typeof p=="object"&&(d=p,p=void 0),d=d||{};const h=(0,n.url)(p,d.path||"/socket.io"),y=h.source,g=h.id,m=h.path,b=f[g]&&m in f[g].nsps,w=d.forceNew||d["force new connection"]||d.multiplex===!1||b;let E;return w?(a("ignoring socket cache for %s",y),E=new s.Manager(y,d)):(f[g]||(a("new io instance for %s",y),f[g]=new s.Manager(y,d)),E=f[g]),h.query&&!d.query&&(d.query=h.queryKey),E.socket(h.path,d)}Object.assign(c,{Manager:s.Manager,Socket:i.Socket,io:c,connect:c});var l=J2();Object.defineProperty(t,"protocol",{enumerable:!0,get:function(){return l.protocol}});var u=Y2();Object.defineProperty(t,"Fetch",{enumerable:!0,get:function(){return u.Fetch}}),Object.defineProperty(t,"NodeXHR",{enumerable:!0,get:function(){return u.NodeXHR}}),Object.defineProperty(t,"XHR",{enumerable:!0,get:function(){return u.XHR}}),Object.defineProperty(t,"NodeWebSocket",{enumerable:!0,get:function(){return u.NodeWebSocket}}),Object.defineProperty(t,"WebSocket",{enumerable:!0,get:function(){return u.WebSocket}}),Object.defineProperty(t,"WebTransport",{enumerable:!0,get:function(){return u.WebTransport}}),e.exports=c}(Dd,Dd.exports)),Dd.exports}var H_;function mM(){if(H_)return au;H_=1,Object.defineProperty(au,"__esModule",{value:!0}),au.createSocketConnection=void 0;const e=Ke,t=gM(),r=en(),n=tt();function s({user:i,env:o,socketType:a="notification",socketOptions:f}){return e.__awaiter(this,void 0,void 0,function*(){const{autoConnect:c=!0,reconnectionAttempts:l=5,reconnectionDelay:u,reconnectionDelayMax:p}=f||{};let d=r.API_BASE_URL[o];d.endsWith("/apis")&&(d=d.substring(0,d.length-5));const h=["websocket"];let y=null;try{const g=a==="chat"?(0,n.walletToPCAIP10)(i):yield(0,n.getCAIPAddress)(o,i,"User"),m=a==="notification"?{address:g}:{mode:"chat",did:g};y=(0,t.io)(d,Object.assign(Object.assign({transports:h,query:m,autoConnect:c,reconnectionAttempts:l},u!==void 0&&{reconnectionDelay:u}),p!==void 0&&{reconnectionDelayMax:p}))}catch(g){console.error("[PUSH-SDK] - Socket connection error: ",g)}return y})}return au.createSocketConnection=s,au}var vu={},G_;function vM(){if(G_)return vu;G_=1,Object.defineProperty(vu,"__esModule",{value:!0}),vu.DataModifier=void 0;const e=Sh(),t=dn(),r=Nr();let n=class yw{static handleChatGroupEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateGroupEvent(i,o);case"update":return this.mapToUpdateGroupEvent(i,o);case e.GroupEventType.JoinGroup:return this.mapToJoinGroupEvent(i,o);case e.GroupEventType.LeaveGroup:return this.mapToLeaveGroupEvent(i,o);case e.MessageEventType.Request:return this.mapToRequestEvent(i,o);case e.GroupEventType.Remove:return this.mapToRemoveEvent(i,o);case e.GroupEventType.RoleChange:return this.mapToRoleChangeEvent(i,o);default:return console.warn("Unknown eventType:",i.eventType),i}}static mapToJoinGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.JoinGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToLeaveGroupEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.LeaveGroup};return o?Object.assign(Object.assign({},a),{raw:{verificationProof:i.verificationProof}}):a}static mapToRequestEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.MessageEventType.Request,meta:{group:i.isGroup||!1}};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRemoveEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,event:e.GroupEventType.Remove};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToRoleChangeEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,chatId:i.chatId,from:i.from,to:i.to,newRole:i.newRole,event:e.GroupEventType.RoleChange};return o&&(a.raw={verificationProof:i.verificationProof}),a}static buildChatGroupEventMetaAndRaw(i,o){const a={name:i.groupName,description:i.groupDescription,image:i.groupImage,owner:i.groupCreator,private:!i.isPublic,rules:i.rules||{}};if(o){const f={verificationProof:i.verificationProof};return{meta:a,raw:f}}return{meta:a}}static mapToGroupEvent(i,o,a){const{meta:f,raw:c}=this.buildChatGroupEventMetaAndRaw(o,a),l={event:i,origin:o.messageOrigin,timestamp:o.timestamp,chatId:o.chatId,from:o.from,meta:f};return a&&(l.raw=c),l}static mapToCreateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.CreateGroup,i,o)}static mapToUpdateGroupEvent(i,o){return this.mapToGroupEvent(e.GroupEventType.UpdateGroup,i,o)}static mapToMessageEvent(i,o=!1,a){i.hasIntent===!1&&a==="message"&&(a=e.MessageEventType.Request);const f={event:a,origin:i.messageOrigin,timestamp:i.timestamp.toString(),chatId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10],message:Object.assign({type:i.messageType},i.messageObj),meta:{group:i.isGroup||!1},reference:i.cid};if(o){const c={fromCAIP10:i.fromCAIP10,toCAIP10:i.toCAIP10,fromDID:i.fromDID,toDID:i.toDID,encType:i.encType,encryptedSecret:i.encryptedSecret,signature:i.signature,sigType:i.sigType,verificationProof:i.verificationProof,previousReference:i.link};f.raw=c}return f}static handleChatEvent(i,o=!1){if(!i)throw console.error("Error in handleChatEvent: data is undefined or null"),new Error("data is undefined or null");const a={Chat:e.MessageEventType.Message,Request:e.MessageEventType.Request,Approve:e.MessageEventType.Accept,Reject:e.MessageEventType.Reject},f=i.eventType||i.messageCategory;if(!a[f])throw console.error("Error in handleChatEvent: Invalid eventType or messageCategory",JSON.stringify(i)),new Error("Invalid eventType or messageCategory in data");const c=a[f];return c?this.mapToMessageEvent(i,o,c):(console.warn("Unknown eventType:",i.eventType||i.messageCategory),i)}static mapToNotificationEvent(i,o,a,f=!1){var c,l,u;const p=Object.keys(e.NOTIFICATION.TYPE).find(y=>e.NOTIFICATION.TYPE[y]===i.payload.data.type)||"BROADCAST";let d;Array.isArray(i.payload.recipients)?d=i.payload.recipients:typeof i.payload.recipients=="string"?d=[i.payload.recipients]:d=Object.keys(i.payload.recipients);const h={event:o,origin:a,timestamp:i.epoch,from:i.sender,to:d,notifID:i.payload_id.toString(),channel:{name:i.payload.data.app,icon:i.payload.data.icon,url:i.payload.data.url},meta:{type:"NOTIFICATION."+p},message:{notification:{title:i.payload.notification.title,body:i.payload.notification.body},payload:{title:i.payload.data.asub,body:i.payload.data.amsg,cta:i.payload.data.acta,embed:i.payload.data.aimg,meta:{domain:((c=i.payload.data.additionalMeta)===null||c===void 0?void 0:c.domain)||"push.org",type:(l=i.payload.data.additionalMeta)===null||l===void 0?void 0:l.type,data:(u=i.payload.data.additionalMeta)===null||u===void 0?void 0:u.data}}},config:{expiry:i.payload.data.etime,silent:i.payload.data.silent==="1",hidden:i.payload.data.hidden==="1"},source:i.source};return f&&(h.raw={verificationProof:i.payload.verificationProof}),h}static convertToProposedName(i){switch(i){case"message":return e.ProposedEventNames.Message;case"request":return e.ProposedEventNames.Request;case"accept":return e.ProposedEventNames.Accept;case"reject":return e.ProposedEventNames.Reject;case"leaveGroup":return e.ProposedEventNames.LeaveGroup;case"joinGroup":return e.ProposedEventNames.JoinGroup;case"createGroup":return e.ProposedEventNames.CreateGroup;case"updateGroup":return e.ProposedEventNames.UpdateGroup;case"remove":return e.ProposedEventNames.Remove;case"roleChange":return e.ProposedEventNames.RoleChange;default:throw new Error(`Unknown current event name: ${i}`)}}static convertToProposedNameForSpace(i){switch(i){case"create":return e.ProposedEventNames.CreateSpace;case"update":return e.ProposedEventNames.UpdateSpace;case"request":return e.ProposedEventNames.SpaceRequest;case"accept":return e.ProposedEventNames.SpaceAccept;case"reject":return e.ProposedEventNames.SpaceReject;case"leaveSpace":return e.ProposedEventNames.LeaveSpace;case"joinSpace":return e.ProposedEventNames.JoinSpace;case"remove":return e.ProposedEventNames.SpaceRemove;case"start":return e.ProposedEventNames.StartSpace;case"stop":return e.ProposedEventNames.StopSpace;default:throw new Error(`Unknown current event name: ${i}`)}}static handleToField(i){var o;switch(i.event){case e.ProposedEventNames.LeaveGroup:case e.ProposedEventNames.JoinGroup:i.to=null;break;case e.ProposedEventNames.Accept:case e.ProposedEventNames.Reject:!((o=i.meta)===null||o===void 0)&&o.group&&(i.to=null);break}}static handleSpaceEvent(i,o=!1){switch(i.eventType){case"create":return this.mapToCreateSpaceEvent(i,o);case"update":return this.mapToUpdateSpaceEvent(i,o);case"request":return this.mapToRequestSpaceEvent(i,o);case"remove":return this.mapToRemoveSpaceEvent(i,o);case"joinSpace":return this.mapToJoinSpaceEvent(i,o);case"leaveSpace":return this.mapToLeaveSpaceEvent(i,o);case"start":return this.mapToStartSpaceEvent(i,o);case"stop":return this.mapToStopSpaceEvent(i,o);default:switch(i.messageCategory){case"Approve":return this.mapToSpaceApproveEvent(i,o);case"Reject":return this.mapToSpaceRejectEvent(i,o);default:return console.warn("Unknown eventType or messageCategory for space:",i.eventType,i.messageCategory),i}}}static mapToCreateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToUpdateSpaceEvent(i,o){const a={event:i.eventType,origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.spaceCreator,meta:{name:i.spaceName,description:i.spaceDescription,image:i.spaceImage,owner:i.spaceCreator,private:!i.isPublic,rules:i.rules||{}}};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRequestSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:e.MessageEventType.Request};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToSpaceApproveEvent(i,o){const a={event:"request",origin:i.messageOrigin==="other"?"self":"other",timestamp:i.timestamp,spaceId:i.chatId,from:i.fromCAIP10,to:[i.toCAIP10]};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToSpaceRejectEvent(i,o){const a={event:"reject",origin:i.messageOrigin==="other"?"other":"self",timestamp:i.timestamp.toString(),spaceId:i.chatId,from:i.fromCAIP10,to:null};return o&&(a.raw={verificationProof:i.verificationProof||""}),a}static mapToRemoveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:"remove"};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToJoinSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToLeaveSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:i.to,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStartSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static mapToStopSpaceEvent(i,o){const a={origin:i.messageOrigin,timestamp:i.timestamp,spaceId:i.spaceId,from:i.from,to:null,event:i.eventType};return o&&(a.raw={verificationProof:i.verificationProof}),a}static convertToProposedNameForVideo(i){switch(i){case t.VideoCallStatus.INITIALIZED:return e.VideoEventType.REQUEST;case t.VideoCallStatus.RECEIVED:return e.VideoEventType.APPROVE;case t.VideoCallStatus.CONNECTED:return e.VideoEventType.CONNECT;case t.VideoCallStatus.ENDED:return e.VideoEventType.DISCONNECT;case t.VideoCallStatus.DISCONNECTED:return e.VideoEventType.DENY;case t.VideoCallStatus.RETRY_INITIALIZED:return e.VideoEventType.RETRY_REQUEST;case t.VideoCallStatus.RETRY_RECEIVED:return e.VideoEventType.RETRY_APPROVE;default:throw new Error(`Unknown video call status: ${i}`)}}static mapToVideoEvent(i,o,a=!1){var f,c;const{senderAddress:l,signalData:u,status:p,chatId:d}=JSON.parse((f=i.payload.data.additionalMeta)===null||f===void 0?void 0:f.data),h=(c=i.payload.rules)!==null&&c!==void 0?c:{access:{type:r.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:d}}},y={address:l,signal:u,meta:{rules:h}},m={event:yw.convertToProposedNameForVideo(p),origin:o,timestamp:i.epoch,peerInfo:y};return a&&(m.raw={verificationProof:i.payload.verificationProof}),m}};return vu.DataModifier=n,vu}var z_;function bM(){if(z_)return su;z_=1,Object.defineProperty(su,"__esModule",{value:!0}),su.PushStream=void 0;const e=Ke,t=R4,r=mM(),n=Je(),s=Sh(),i=vM(),o=tt(),a=z2(),f=en(),c=Ih(),l=$2();let u=class gw extends t.EventEmitter{constructor(d,h,y,g,m,b){var w;super(),this._listen=h,this.decryptedPgpPvtKey=g,this.progressHook=m,this.signer=b,this.account=d,this.raw=(w=y.raw)!==null&&w!==void 0?w:!1,this.options=y,this.listen=h,this.disconnected=!1,this.uid=(0,l.v4)(),this.chatSocketCount=0,this.notifSocketCount=0,this.chatSocketConnected=!1,this.notifSocketConnected=!1,this.chatInstance=new a.Chat(this.account,this.options.env,f.ALPHA_FEATURE_CONFIG[n.PACKAGE_BUILD],this.decryptedPgpPvtKey,this.signer,this.progressHook)}static initialize(d,h,y,g,m,b,w){return e.__awaiter(this,void 0,void 0,function*(){const E={raw:!1,connection:{auto:!0,retries:3},env:y};if(!h||h.length===0)throw new Error("The listen property must have at least one STREAM type.");const C=Object.assign(Object.assign({},E),w),R=C.overrideAccount||d;return h.includes("*")&&(h=Object.values(s.STREAM)),new gw(R,h,C,g,m,b)})}reinit(d,h){return e.__awaiter(this,void 0,void 0,function*(){this.listen=d,this.options=Object.assign(Object.assign({},this.options),h),yield this.connect(!0)})}connect(d=!1){return e.__awaiter(this,void 0,void 0,function*(){return new Promise((h,y)=>{e.__awaiter(this,void 0,void 0,function*(){var g,m,b,w,E,C,R,M,_,A,I,P,v,S;const T=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.CHAT)||this.listen.includes(s.STREAM.CHAT_OPS)||this.listen.includes(s.STREAM.SPACE)||this.listen.includes(s.STREAM.SPACE_OPS),N=!this.listen||this.listen.length===0||this.listen.includes(s.STREAM.NOTIF)||this.listen.includes(s.STREAM.NOTIF_OPS)||this.listen.includes(s.STREAM.VIDEO);console.log("RestAPI::PushStream::connect - Initialization flags:",{shouldInitializeChatSocket:T,shouldInitializeNotifSocket:N});let D=d?this.chatSocketConnected:!1,O=d?this.notifSocketConnected:!1;const L=()=>{console.log("RestAPI::PushStream::connect - Checking conditions for STREAM.CONNECT event.",{shouldInitializeChatSocket:T,isChatSocketConnected:D,shouldInitializeNotifSocket:N,isNotifSocketConnected:O}),(T&&D||!T)&&(N&&O||!N)?(this.emit(s.STREAM.CONNECT),console.log("RestAPI::PushStream::connect - Emitted STREAM.CONNECT"),h()):console.log("RestAPI::PushStream:: not emitting")};setTimeout(()=>{this.notifSocketConnected||this.chatSocketConnected||y(new Error("Connection timeout"))},5e3);const k=W=>e.__awaiter(this,void 0,void 0,function*(){W==="chat"?(D=!1,this.chatSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Chat socket disconnected. Decrementing chatSocketCount.","Previous chatSocketCount:",this.chatSocketCount),this.chatSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New chatSocketCount:",this.chatSocketCount),O?this.pushNotificationSocket&&this.pushNotificationSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Notification Socket..."),this.pushNotificationSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for chat."))):W==="notif"&&(O=!1,this.notifSocketConnected=!1,console.log("RestAPI::PushStream::handleSocketDisconnection - Notification socket disconnected. Decrementing notifSocketCount.","Previous notifSocketCount:",this.notifSocketCount),this.notifSocketCount--,console.log("RestAPI::PushStream::handleSocketDisconnection - New notifSocketCount:",this.notifSocketCount),D?this.pushChatSocket&&this.pushChatSocket.connected&&(console.log("RestAPI::PushStream::handleSocketDisconnection - Disconnecting Chat Socket..."),this.pushChatSocket.disconnect()):(this.emit(s.STREAM.DISCONNECT),console.log("RestAPI::PushStream::handleSocketDisconnection - Emitted STREAM.DISCONNECT for notification.")))});T&&(this.pushChatSocket?this.pushChatSocket&&!this.chatSocketConnected?(console.log("RestAPI::PushStream::ChatSocket::Reconnect - Attempting to reconnect push chat socket..."),this.pushChatSocket.connect()):console.log("RestAPI::PushStream::ChatSocket::Status - Push chat socket already connected"):(console.log("RestAPI::PushStream::ChatSocket::Create - pushChatSocket does not exist, creating new socket connection..."),this.pushChatSocket=yield(0,r.createSocketConnection)({user:(0,o.walletToPCAIP10)(this.account),socketType:"chat",socketOptions:{autoConnect:(b=(m=(g=this.options)===null||g===void 0?void 0:g.connection)===null||m===void 0?void 0:m.auto)!==null&&b!==void 0?b:!0,reconnectionAttempts:(C=(E=(w=this.options)===null||w===void 0?void 0:w.connection)===null||E===void 0?void 0:E.retries)!==null&&C!==void 0?C:3},env:(R=this.options)===null||R===void 0?void 0:R.env}),this.pushChatSocket||y(new Error("RestAPI::PushStream::ChatSocket::Error - Push chat socket not connected")))),N&&(this.pushNotificationSocket?this.pushNotificationSocket&&!this.notifSocketConnected?(console.log("RestAPI::PushStream::NotifSocket::Reconnect - Attempting to reconnect push notification socket..."),this.pushNotificationSocket.connect()):console.log("RestAPI::PushStream::NotifSocket::Status - Push notification socket already connected"):(console.log("RestAPI::PushStream::NotifSocket::Create - pushNotificationSocket does not exist, creating new socket connection..."),this.pushNotificationSocket=yield(0,r.createSocketConnection)({user:(0,o.pCAIP10ToWallet)(this.account),env:(M=this.options)===null||M===void 0?void 0:M.env,socketOptions:{autoConnect:(I=(A=(_=this.options)===null||_===void 0?void 0:_.connection)===null||A===void 0?void 0:A.auto)!==null&&I!==void 0?I:!0,reconnectionAttempts:(S=(v=(P=this.options)===null||P===void 0?void 0:P.connection)===null||v===void 0?void 0:v.retries)!==null&&S!==void 0?S:3}}),this.pushNotificationSocket||y(new Error("RestAPI::PushStream::NotifSocket::Error - Push notification socket not connected"))));const q=W=>!this.listen||this.listen.length===0?!0:this.listen.includes(W);this.pushChatSocket&&(L(),this.pushChatSocket.off(s.EVENTS.CONNECT),this.pushChatSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){D=!0,this.chatSocketCount++,this.chatSocketConnected=!0,L(),console.log(`RestAPI::PushStream::EVENTS.CONNECT:: Chat Socket Connected (ID: ${this.pushChatSocket.id})`)})),this.pushChatSocket.off(s.EVENTS.DISCONNECT),this.pushChatSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::ChatSocket::Disconnect - Chat socket disconnected."),yield k("chat")})),this.pushChatSocket.off(s.EVENTS.CHAT_GROUPS),this.pushChatSocket.on(s.EVENTS.CHAT_GROUPS,W=>{try{const re=i.DataModifier.handleChatGroupEvent(W,this.raw);re.event=i.DataModifier.convertToProposedName(re.event),re.streamUid=this.uid,i.DataModifier.handleToField(re),this.shouldEmitChat(W.chatId)&&(W.eventType===s.GroupEventType.JoinGroup||W.eventType===s.GroupEventType.LeaveGroup||W.eventType===s.MessageEventType.Request||W.eventType===s.GroupEventType.Remove||W.eventType===s.GroupEventType.RoleChange?q(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,re):q(s.STREAM.CHAT_OPS)&&this.emit(s.STREAM.CHAT_OPS,re))}catch(re){console.error("Error handling CHAT_GROUPS event:",re,"Data:",W)}}),this.pushChatSocket.off(s.EVENTS.CHAT_RECEIVED_MESSAGE),this.pushChatSocket.on(s.EVENTS.CHAT_RECEIVED_MESSAGE,W=>e.__awaiter(this,void 0,void 0,function*(){try{(W.messageCategory=="Chat"||W.messageCategory=="Request")&&this.decryptedPgpPvtKey&&(W=yield this.chatInstance.decrypt([W]),W=W[0]);const re=i.DataModifier.handleChatEvent(W,this.raw);re.event=i.DataModifier.convertToProposedName(re.event),i.DataModifier.handleToField(re),this.shouldEmitChat(W.chatId)&&q(s.STREAM.CHAT)&&this.emit(s.STREAM.CHAT,re)}catch(re){console.error("Error handling CHAT_RECEIVED_MESSAGE event:",re,"Data:",W)}})),this.pushChatSocket.off("SPACES"),this.pushChatSocket.on("SPACES",W=>{try{const re=i.DataModifier.handleSpaceEvent(W,this.raw);re.event=i.DataModifier.convertToProposedNameForSpace(re.event),i.DataModifier.handleToField(re),this.shouldEmitSpace(W.spaceId)&&(W.eventType===s.SpaceEventType.Join||W.eventType===s.SpaceEventType.Leave||W.eventType===s.MessageEventType.Request||W.eventType===s.SpaceEventType.Remove||W.eventType===s.SpaceEventType.Start||W.eventType===s.SpaceEventType.Stop?q(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,re):q(s.STREAM.SPACE_OPS)&&this.emit(s.STREAM.SPACE_OPS,re))}catch(re){console.error("Error handling SPACES event:",re,"Data:",W)}}),this.pushChatSocket.off("SPACES_MESSAGES"),this.pushChatSocket.on("SPACES_MESSAGES",W=>{try{const re=i.DataModifier.handleSpaceEvent(W,this.raw);re.event=i.DataModifier.convertToProposedNameForSpace(re.event),i.DataModifier.handleToField(re),this.shouldEmitSpace(W.spaceId)&&q(s.STREAM.SPACE)&&this.emit(s.STREAM.SPACE,re)}catch(re){console.error("Error handling SPACES event:",re,"Data:",W)}})),this.pushNotificationSocket&&(L(),this.pushNotificationSocket.off(s.EVENTS.CONNECT),this.pushNotificationSocket.on(s.EVENTS.CONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log(`RestAPI::PushStream::NotifSocket::Connect - Notification Socket Connected (ID: ${this.pushNotificationSocket.id})`),O=!0,this.notifSocketCount++,this.notifSocketConnected=!0,L()})),this.pushNotificationSocket.off(s.EVENTS.DISCONNECT),this.pushNotificationSocket.on(s.EVENTS.DISCONNECT,()=>e.__awaiter(this,void 0,void 0,function*(){console.log("RestAPI::PushStream::NotifSocket::Disconnect - Notification socket disconnected."),yield k("notif")})),this.pushNotificationSocket.off(s.EVENTS.USER_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_FEEDS,W=>{var re;try{if(((re=W.payload.data.additionalMeta)===null||re===void 0?void 0:re.type)===`${c.ADDITIONAL_META_TYPE.PUSH_VIDEO}+1`&&q(s.STREAM.VIDEO)&&this.shouldEmitVideo(W.sender)){const ue=i.DataModifier.mapToVideoEvent(W,this.account===W.sender?s.MessageOrigin.Self:s.MessageOrigin.Other,this.raw);this.emit(s.STREAM.VIDEO,ue)}else{const ue=i.DataModifier.mapToNotificationEvent(W,s.NotificationEventType.INBOX,this.account===W.sender?"self":"other",this.raw);this.shouldEmitChannel(ue.from)&&q(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,ue)}}catch(ue){console.error(`RestAPI::PushStream::NotifSocket::UserFeeds::Error - Error handling event: ${ue}, Data: ${JSON.stringify(W)}`)}}),this.pushNotificationSocket.off(s.EVENTS.USER_SPAM_FEEDS),this.pushNotificationSocket.on(s.EVENTS.USER_SPAM_FEEDS,W=>{try{const re=i.DataModifier.mapToNotificationEvent(W,s.NotificationEventType.SPAM,this.account===W.sender?"self":"other",this.raw);re.origin=this.account===re.from?"self":"other",this.shouldEmitChannel(re.from)&&q(s.STREAM.NOTIF)&&this.emit(s.STREAM.NOTIF,re)}catch(re){console.error("Error handling USER_SPAM_FEEDS event:",re,"Data:",W)}})),this.disconnected=!1})})})}connected(){return console.log(`RestAPI::PushStream::connected::Notification Socket Connected: ${this.notifSocketConnected}`),console.log(`RestAPI::PushStream::connected::Chat Socket Connected: ${this.chatSocketConnected}`),this.notifSocketConnected||this.chatSocketConnected}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){this.pushChatSocket&&this.chatSocketConnected&&(this.pushChatSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push chat socket disconnected.")),this.pushNotificationSocket&&this.notifSocketConnected&&(this.pushNotificationSocket.disconnect(),console.log("RestAPI::PushStream::disconnect::Push notification socket disconnected."))})}info(){return{options:this.options,listen:this.listen}}shouldEmitChat(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.chats)||this.options.filter.chats.length===0||this.options.filter.chats.includes("*")?!0:this.options.filter.chats.includes(d)}shouldEmitSpace(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.spaces)||this.options.filter.spaces.length===0||this.options.filter.spaces.includes("*")?!0:this.options.filter.spaces.includes(d)}shouldEmitChannel(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.channels)||this.options.filter.channels.length===0||this.options.filter.channels.includes("*")?!0:this.options.filter.channels.includes(d)}shouldEmitVideo(d){var h;return!(!((h=this.options.filter)===null||h===void 0)&&h.video)||this.options.filter.video.length===0||this.options.filter.video.includes("*")?!0:this.options.filter.video.includes(d)}};return su.PushStream=u,su}var bu={},_u={},Qs={};const _M=El(QA);var W_;function Fl(){if(W_)return Qs;W_=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.PushNotificationBaseClass=Qs.FEED_MAP=void 0;const e=Ke,t=Je(),r=en(),n=Mt(),s=Nr(),i=_M,o=ya,a=go(),f=tt(),c=Tt(),l=_o(),u=ya,p="Account is required",d="*",h=125,y=1,g="-",m="+",b=3,w=2,E=1,C="1",R="1";Qs.FEED_MAP={INBOX:!1,SPAM:!0};class M{constructor(A,I,P,v){this.signer=A,this.env=I,this.guestMode=!!(P&&A),this.account=P,this.pgpPrivateKey=v,this.initializeCoreContract({signer:this.signer,env:this.env})}initializeCoreContract(A){return e.__awaiter(this,void 0,void 0,function*(){const{env:I=t.ENV.STAGING,signer:P=null}=A||{};let v;if(P)if(yield(0,n.getAccountAddress)({account:null,signer:P}),new f.Signer(P).isViemSigner(P)){const T=(0,o.createPublicClient)({chain:r.TOKEN_VIEM_NETWORK_MAP[I],transport:(0,o.http)()});v=(0,o.getContract)({abi:r.ABIS.CORE,address:r.CORE_CONFIG[I].EPNS_CORE_CONTRACT,client:{public:T}})}else v=new i.ethers.Contract(r.CORE_CONFIG[I].EPNS_CORE_CONTRACT,r.ABIS.CORE,P);this.coreContract=v})}checkUserAddressExists(A){if(!A&&!this.account&&!this.guestMode)throw new Error(p);return!0}checkSignerObjectExists(){if(!this.signer)throw new Error(l.PushAPI.ensureSignerMessage());return!0}getNotificationType(A,I){return A.length==1?A[0]==d?{recipient:I,type:s.NOTIFICATION_TYPE.BROADCAST}:{recipient:A[0],type:s.NOTIFICATION_TYPE.TARGETTED}:{recipient:A,type:s.NOTIFICATION_TYPE.SUBSET}}generateNotificationLowLevelPayload({signer:A,env:I,recipients:P,options:v,channel:S,channelInfo:T}){var N,D,O,L,B,k,q,W,re,ue,H,ae,V,U,te,ge,Pe,Te;S||(S=`${this.account}`);const z=this.getNotificationType(P,S),$=s.IDENTITY_TYPE.DIRECT_PAYLOAD;let F="";const Q=T&&T.channel_settings?JSON.parse(T.channel_settings):null,de=!!T;return!((N=v.payload)===null||N===void 0)&&N.category&&Q&&(Q[v.payload.category-1].type==w&&(F=v.payload.category+g+w+g+Q[v.payload.category-1].default),Q[v.payload.category-1].type==E&&(F=v.payload.category+g+E),Q[v.payload.category-1].type==b&&(F=v.payload.category+g+b+g+Q[v.payload.category-1].default.lower)),{signer:A,channel:S,type:z.type,identityType:$,notification:v.notification,payload:{title:(O=(D=v.payload)===null||D===void 0?void 0:D.title)!==null&&O!==void 0?O:v.notification.title,body:(B=(L=v.payload)===null||L===void 0?void 0:L.body)!==null&&B!==void 0?B:v.notification.body,cta:(q=(k=v.payload)===null||k===void 0?void 0:k.cta)!==null&&q!==void 0?q:"",img:(re=(W=v.payload)===null||W===void 0?void 0:W.embed)!==null&&re!==void 0?re:"",hidden:(ue=v.config)===null||ue===void 0?void 0:ue.hidden,etime:(H=v.config)===null||H===void 0?void 0:H.expiry,silent:(ae=v.config)===null||ae===void 0?void 0:ae.silent,additionalMeta:(V=v.payload)===null||V===void 0?void 0:V.meta,index:!((U=v.payload)===null||U===void 0)&&U.category?F:""},recipients:z.recipient,graph:(te=v.advanced)===null||te===void 0?void 0:te.graph,ipfsHash:(ge=v.advanced)===null||ge===void 0?void 0:ge.ipfs,env:I,chatId:(Pe=v.advanced)===null||Pe===void 0?void 0:Pe.chatid,pgpPrivateKey:(Te=v.advanced)===null||Te===void 0?void 0:Te.pgpPrivateKey,channelFound:de}}isEmpty(A){return A.trim().length==0}isValidLength(A,I=h,P=y){return A.length>=P&&A.length<=I}isValidUrl(A){return!!new RegExp("^((?:https|http):\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(A)}verifyEmptyChannelParameters(A){if(this.isEmpty(A.name))throw new Error("Channel name cannot be empty");if(this.isEmpty(A.description))throw new Error("Channel description cannot be empty");if(this.isEmpty(A.icon))throw new Error("Channel icon cannot be empty");if(this.isEmpty(A.url))throw new Error("Channel url cannot ne empty");return!0}validateParameterLength(A){if(this.isValidLength(A.name))if(this.isValidLength(A.description)){if(!this.isValidLength(A.url)||!this.isValidUrl(A.url))throw new Error(`Channel url either excees ${h} characters or is not a valid url`);return!0}else throw new Error(`Channel description should not exceed ${h} characters`);else throw new Error(`Channel name should not exceed ${h} characters`)}validateChannelParameters(A){return this.verifyEmptyChannelParameters(A)&&this.validateParameterLength(A)}createContractInstance(A,I,P){if(!this.signer)throw new Error("Signer is not provided");let v;const S=this.signer?new f.Signer(this.signer):null;if(S!=null&&S.isViemSigner(this.signer)){const T=(0,o.createPublicClient)({chain:P,transport:(0,o.http)()});v=(0,o.getContract)({abi:I,address:A,client:{public:T}})}else v=new i.ethers.Contract(A,I,this.signer);return v}fetchBalance(A,I){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let P;const v=new f.Signer(this.signer);try{return v.isViemSigner(this.signer)?P=BigInt(yield A.read.balanceOf({args:[I]})):P=BigInt(yield A.balanceOf(I)),P}catch(S){throw new Error(JSON.stringify(S))}})}fetchAllownace(A,I,P){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");const v=new f.Signer(this.signer);let S;try{return v.isViemSigner(this.signer)?S=BigInt(yield A.read.allowance({args:[I,P]})):S=BigInt(yield A.allowance(I,P)),S}catch(T){throw new Error(JSON.stringify(T))}})}fetchUpdateCounter(A,I){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");let P;const v=new f.Signer(this.signer);try{return v.isViemSigner(this.signer)?P=BigInt(yield A.read.channelUpdateCounter({args:[I]})):P=BigInt(yield A.channelUpdateCounter(I)),P+BigInt(1)}catch(S){throw new Error(JSON.stringify(S))}})}approveToken(A,I,P){var v,S;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");const D=yield A.write.approve({args:[I,P]})}else{if(!this.signer||!this.signer.provider)throw new Error("ethers provider/signer is not provided");const D=yield A.approve(I,P);yield(S=(v=this.signer)===null||v===void 0?void 0:v.provider)===null||S===void 0?void 0:S.waitForTransaction(D.hash)}return!0}catch(T){return console.error(T),!1}})}createChannel(A,I,P,v){var S,T;return e.__awaiter(this,void 0,void 0,function*(){let N;try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");N=yield A.write.createChannelWithPUSH({args:[I,(0,o.toHex)(new Uint8Array(P)),v,this.getTimeBound()]})}else{const L=yield A.createChannelWithPUSH(I,P,v,this.getTimeBound(),{gasLimit:1e6}),B=yield(T=(S=this.signer)===null||S===void 0?void 0:S.provider)===null||T===void 0?void 0:T.waitForTransaction(L.hash);if((B==null?void 0:B.status)==0)throw new Error("Something Went wrong while creating your channel");N=L.hash}return N}catch(D){throw new Error(D==null?void 0:D.message)}})}updateChannel(A,I,P,v){var S,T;return e.__awaiter(this,void 0,void 0,function*(){let N;try{if(!this.signer)throw new Error("Signer is not provided");if(new f.Signer(this.signer).isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");N=yield A.write.updateChannelMeta({args:[I,(0,o.toHex)(new Uint8Array(P)),v]})}else{const L=yield A.updateChannelMeta(I,P,v,{gasLimit:1e6}),B=yield(T=(S=this.signer)===null||S===void 0?void 0:S.provider)===null||T===void 0?void 0:T.waitForTransaction(L.hash);if((B==null?void 0:B.status)==0)throw new Error("Something Went wrong while updating your channel");N=L.hash}return N}catch(D){throw new Error(D==null?void 0:D.message)}})}verifyChannel(A,I){var P,v;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const S=new f.Signer(this.signer);let T;if(S.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");T=yield A.write.verify({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const D=yield A.verify(I);yield(v=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||v===void 0?void 0:v.waitForTransaction(D.hash),T=D.hash}return T}catch(S){throw new Error(S.message)}})}createChanelSettings(A,I,P,v,S){var T,N;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const D=new f.Signer(this.signer);let O;if(D.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");O=yield A.write.createChannelSettings({args:[I,P,v,S]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const B=yield A.createChannelSettings(I,P,v,S);yield(N=(T=this.signer)===null||T===void 0?void 0:T.provider)===null||N===void 0?void 0:N.waitForTransaction(B.hash),O=B.hash}return O}catch(D){throw new Error(D.message)}})}addDelegator(A,I){var P,v;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const S=new f.Signer(this.signer);let T;if(S.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");T=yield A.write.addDelegate({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const D=yield A.addDelegate(I);yield(v=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||v===void 0?void 0:v.waitForTransaction(D.hash),T=D.hash}return T}catch(S){throw new Error(S.message)}})}removeDelegator(A,I){var P,v;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const S=new f.Signer(this.signer);let T;if(S.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");T=yield A.write.removeDelegate({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const D=yield A.removeDelegate(I);yield(v=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||v===void 0?void 0:v.waitForTransaction(D.hash),T=D.hash}return T}catch(S){throw new Error(S.message)}})}getChainId(A){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is not provided");return new f.Signer(this.signer).getChainId()})}uploadToIPFSViaPushNode(A){return e.__awaiter(this,void 0,void 0,function*(){try{return(yield(0,c.axiosPost)(`${r.CORE_CONFIG[this.env].API_BASE_URL}/v1/ipfs/upload`,{data:A})).data.cid}catch{throw new Error("Something went wrong while uploading data to IPFS")}})}getTimeBound(A){return 0}getMinimalSetting(A){var I,P;let v="",S="";for(let T=0;T<A.length;T++){const N=A[T];if(N.type==E&&(v=v+m+E+g+N.default),N.type==w&&N.data){const D=N.data&&N.data.enabled!=null?Number(N.data.enabled).toString():C,O=(I=N.data.ticker)!==null&&I!==void 0?I:R;v=v+m+w+g+D+g+N.default+g+N.data.lower+g+N.data.upper+g+O}if(N.type==b&&N.default&&typeof N.default=="object"&&N.data){const D=N.data&&N.data.enabled!=null?Number(N.data.enabled).toString():C,O=(P=N.data.ticker)!==null&&P!==void 0?P:R;v=v+m+b+g+D+g+N.default.lower+g+N.default.upper+g+N.data.lower+g+N.data.upper+g+O}S=S+m+N.description}return{setting:v.replace(/^\+/,""),description:S.replace(/^\+/,"")}}getMinimalUserSetting(A){var I,P;if(!A)return null;let v="",S=0;for(let T=0;T<A.length;T++){const N=A[T],D=N.enabled?1:0;N.enabled&&S++,Object.keys(N).includes("value")?typeof N.value=="number"?v=v+w+g+D+g+N.value:v=v+b+g+D+g+((I=N.value)===null||I===void 0?void 0:I.lower)+g+((P=N.value)===null||P===void 0?void 0:P.upper):v=v+E+g+D,T!=A.length-1&&(v=v+m)}return S+m+v}getChannelOrAliasInfo(A){return e.__awaiter(this,void 0,void 0,function*(){try{const I=(0,f.validateCAIP)(A)?A:(0,f.getFallbackETHCAIPAddress)(this.env,this.account),{networkId:P}=(0,f.getCAIPDetails)(I);let v=I;if(P!=="1"&&P!=="11155111"){const T=yield this.getAliasInfo(A);v=(T==null?void 0:T.channel)||v}return(yield a.getChannel({channel:v,env:this.env}))||null}catch{return null}})}initiateAddAlias(A,I){var P,v;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const S=new f.Signer(this.signer);let T;if(S.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");T=yield A.write.verifyChannelAlias({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const D=yield A.verifyChannelAlias(I);yield(v=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||v===void 0?void 0:v.waitForTransaction(D.hash),T=D.hash}return T}catch(S){throw new Error(S.message)}})}verifyAlias(A,I){var P,v;return e.__awaiter(this,void 0,void 0,function*(){try{if(!this.signer)throw new Error("Signer is not provided");const S=new f.Signer(this.signer);let T;if(S.isViemSigner(this.signer)){if(!A.write)throw new Error("viem signer is not provided");T=yield A.write.verifyChannelAlias({args:[I]})}else{if(!this.signer.provider)throw new Error("ethers provider is not provided");const k=yield A.verifyChannelAlias(I);yield(v=(P=this.signer)===null||P===void 0?void 0:P.provider)===null||v===void 0?void 0:v.waitForTransaction(k.hash),T=k.hash}const N=yield S.getChainId(),D=yield S.getAddress(),O=`eip155:${N}:${D}`,L=yield this.getChannelOrAliasInfo(O);return{verifyAliasRes:T,channelInfo:L}}catch(S){throw new Error(S.message)}})}getAliasInfo(A){return e.__awaiter(this,void 0,void 0,function*(){const v=`${`${(0,f.getAPIBaseUrls)(this.env)}/v1/alias`}/${A}/channel`;try{return(yield(0,c.axiosGet)(v)).data}catch{return null}})}getAddressFromCaip(A){return A==null?void 0:A.split(":")[(A==null?void 0:A.split(":").length)-1]}isValidPCaip(A){const I=A.split(":");return I.length==2&&I[0]=="eip155"&&u.isAddress(I[1])}}return Qs.PushNotificationBaseClass=M,Qs}var Y_;function wM(){if(Y_)return _u;Y_=1,Object.defineProperty(_u,"__esModule",{value:!0}),_u.Alias=void 0;const e=Ke,t=en(),r=t,n=q9(),s=Fl();class i extends s.PushNotificationBaseClass{constructor(a,f,c){super(a,f,c),this.info=l=>e.__awaiter(this,void 0,void 0,function*(){try{return yield n.getAliasInfo(Object.assign(Object.assign({},l),{env:this.env}))}catch(u){throw new Error(`Push SDK Error: API : alias::info : ${u}`)}}),this.initiate=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK),g=yield this.initiateAddAlias(y,l);let m={tx:g};return u!=null&&u.raw&&(m=Object.assign(Object.assign({},m),{raw:{initiateVerificationProof:g}})),m}catch(p){throw new Error(`Push SDK Error: Contract : alias::add : ${p}`)}}),this.verify=(l,u)=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK),{verifyAliasRes:g,channelInfo:m}=yield this.verifyAlias(y,l);let b={tx:g};return u!=null&&u.raw&&(b=Object.assign(Object.assign({},b),{raw:{initiateVerificationProof:m.initiate_verification_proof,verifyVerificationProof:g}})),b}catch(p){throw new Error(`Push SDK Error: Contract : alias::verify : ${p}`)}})}}return _u.Alias=i,_u}var wu={},J_;function EM(){if(J_)return wu;J_=1,Object.defineProperty(wu,"__esModule",{value:!0}),wu.Delegate=void 0;const e=Ke,t=en(),r=t,n=go(),s=tt(),i=Fl();class o extends i.PushNotificationBaseClass{constructor(f,c,l){super(f,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{let p=u!=null&&u.channel?u.channel:this.account?(0,s.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(p),p=(0,s.validateCAIP)(p)?p:(0,s.getFallbackETHCAIPAddress)(this.env,p),this.checkUserAddressExists(p),yield n.getDelegates({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : delegate::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK);return{transactionHash:yield this.addDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::add : ${p}`)}}),this.remove=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists(),(0,s.validateCAIP)(u)&&(u=this.getAddressFromCaip(u));const d=`eip155:${yield this.getChainId(this.signer)}`;if(!t.default[this.env][d]||!r.VIEM_CONFIG[this.env][d])throw new Error("Unsupported Chainid");const h=t.default[this.env][d].EPNS_COMMUNICATOR_CONTRACT,y=this.createContractInstance(h,r.ABIS.COMM,r.VIEM_CONFIG[this.env][d].NETWORK);return{transactionHash:yield this.removeDelegator(y,u)}}catch(p){throw new Error(`Push SDK Error: Contract : delegate::remove : ${p}`)}})}}return wu.Delegate=o,wu}var Eu={},Z_;function AM(){if(Z_)return Eu;Z_=1,Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.Tags=void 0;const e=Ke,t=Je(),r=go(),n=Fl(),s=$l();class i extends n.PushNotificationBaseClass{constructor(a,f,c,l){super(f,c,l),this.get=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield r.getTags({channel:p,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : tags::get : ${p}`)}}),this.add=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info(),d=yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u});return{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::add : ${p}`)}}),this.update=u=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const p=yield this.channel.info();return yield this.channel.update({name:p.name,description:p.info,url:p.url,icon:p.icon,tags:u}),{tags:u}}catch(p){throw new Error(`Push SDK Error: Contract : tags::update : ${p}`)}}),this.remove=()=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const u=yield this.channel.info();return yield this.channel.update({name:u.name,description:u.info,url:u.url,icon:u.icon,tags:[]}),{status:"success"}}catch(u){throw new Error(`Push SDK Error: Contract : tags::remove : ${u}`)}}),this.search=(u,p)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:d=t.default.PAGINATION.INITIAL_PAGE,limit:h=t.default.PAGINATION.LIMIT}=p||{};return yield r.searchTags({query:u,page:d,limit:h,env:this.env})}catch(d){throw new Error(`Push SDK Error: API : channel::tags::search : ${d}`)}}),this.list=u=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:p=t.default.PAGINATION.INITIAL_PAGE,limit:d=t.default.PAGINATION.LIMIT,order:h=s.default.FILTER.CHANNEL_LIST.ORDER.DESCENDING,filter:y=s.default.FILTER.TAGS.PUSH}=u||{};return yield r.getAllTags({page:p,limit:d,order:h,filter:y,env:this.env})}catch(p){throw new Error(`Push SDK Error: API : channel::tags::list : ${p}`)}}),this.channel=a}}return Eu.Tags=i,Eu}var X_;function SM(){if(X_)return bu;X_=1,Object.defineProperty(bu,"__esModule",{value:!0}),bu.Channel=void 0;const e=Ke,t=Je(),r=ya,n=go(),s=en(),i=tt(),o=Ih(),a=Ta(),f=Ah(),c=wM(),l=EM(),u=AM(),p=Fl();class d extends p.PushNotificationBaseClass{constructor(y,g,m,b){super(y,g,m,b),this.info=(w,E)=>e.__awaiter(this,void 0,void 0,function*(){try{const{raw:C=!0}=E||{};return this.checkUserAddressExists(w),w=w??(0,i.getFallbackETHCAIPAddress)(this.env,this.account),yield n.getChannel({channel:w,env:this.env,raw:C})}catch(C){throw new Error(`Push SDK Error: API : channel::info : ${C}`)}}),this.search=(w,E)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C=t.default.PAGINATION.INITIAL_PAGE,limit:R=t.default.PAGINATION.LIMIT,filter:M,tag:_,user_subscribed:A,oldFormat:I=!0}=E||{};return yield n.search({query:w,page:C,limit:R,filter:M,tag:_,user_subscribed:A,env:this.env,oldFormat:I})}catch(C){throw new Error(`Push SDK Error: API : channel::search : ${C}`)}}),this.subscribers=w=>e.__awaiter(this,void 0,void 0,function*(){var E,C;try{let R=w!=null&&w.channel?w.channel:this.account?(0,i.getFallbackETHCAIPAddress)(this.env,this.account):null;return this.checkUserAddressExists(R),R=(0,i.validateCAIP)(R)?R:(0,i.getFallbackETHCAIPAddress)(this.env,R),w&&w.page?yield n.getSubscribers({channel:R,env:this.env,page:w.page,limit:(E=w.limit)!==null&&E!==void 0?E:10,setting:(C=w.setting)!==null&&C!==void 0?C:!1,category:w.category,raw:w.raw}):yield n._getSubscribers({channel:R,env:this.env})}catch(R){throw new Error(`Push SDK Error: API : channel::subscribers : ${R}`)}}),this.send=(w,E)=>e.__awaiter(this,void 0,void 0,function*(){var C,R,M;try{this.checkSignerObjectExists();const _=yield this.getChannelOrAliasInfo((C=E.channel)!==null&&C!==void 0?C:this.account);E.advanced=E.advanced||{},E.advanced.pgpPrivateKey=(R=E.advanced.pgpPrivateKey)!==null&&R!==void 0?R:this.pgpPrivateKey;const A=this.generateNotificationLowLevelPayload({signer:this.signer,env:this.env,recipients:w,options:E,channel:(M=E.channel)!==null&&M!==void 0?M:this.account,channelInfo:_});return yield o.sendNotification(A)}catch(_){throw new Error(`Push SDK Error: API : channel::send : ${_}`)}}),this.create=w=>e.__awaiter(this,void 0,void 0,function*(){const{name:E,description:C,url:R,icon:M,alias:_=null,progressHook:A}=w||{};let I=w.tags;try{let P;this.validateChannelParameters(w);const v=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),S=yield this.fetchBalance(v,this.account),T=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18);if(T>S)throw new Error("Insufficient PUSH balance");if(_){if(!(0,i.validateCAIP)(_))throw new Error("Invalid alias CAIP");const re=(0,i.getCAIPDetails)(_);P={[`${re==null?void 0:re.blockchain}:${re==null?void 0:re.networkId}`]:re==null?void 0:re.address}}if(I&&I.length>5&&(I=I.slice(0,5)),(I&&I.length>0?I.join(""):"").length>512)throw new Error("Tags length should not exceed 512 characters");A==null||A(a.default["PUSH-CREATE-01"]);const D={name:E,info:C,url:R,icon:M,aliasDetails:P??{},tags:I},O=yield this.uploadToIPFSViaPushNode(JSON.stringify(D));if(!((yield this.fetchAllownace(v,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=T)&&(A==null||A(a.default["PUSH-CREATE-02"]),!(yield this.approveToken(v,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,T))))throw new Error("Something went wrong while approving the token");const B=s.CHANNEL_TYPE.GENERAL,k="1+"+O,q=r.stringToBytes(k);A==null||A(a.default["PUSH-CREATE-03"]);const W=yield this.createChannel(this.coreContract,B,q,T);return A==null||A(a.default["PUSH-CREATE-04"]),{transactionHash:W}}catch(P){const v=a.default["PUSH-ERROR-02"];throw A==null||A(v("Create Channel",P)),new Error(`Push SDK Error: Contract : createChannelWithPUSH : ${P}`)}}),this.update=w=>e.__awaiter(this,void 0,void 0,function*(){const{name:E,description:C,url:R,icon:M,alias:_=null,progressHook:A}=w||{};let I=w.tags;try{let P;this.validateChannelParameters(w);const v=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),S=yield this.fetchBalance(v,this.account),T=yield this.fetchUpdateCounter(this.coreContract,this.account),D=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18)*T;if(D>S)throw new Error("Insufficient PUSH balance");if(_){if(!(0,i.validateCAIP)(_))throw new Error("Invalid alias CAIP");const ue=(0,i.getCAIPDetails)(_);P={[`${ue==null?void 0:ue.blockchain}:${ue==null?void 0:ue.networkId}`]:ue==null?void 0:ue.address}}I&&I.length>5&&(I=I.slice(0,5));const O=I&&I.length>0?I.join(""):"";A==null||A(a.default["PUSH-UPDATE-01"]);const L={name:E,info:C,url:R,icon:M,aliasDetails:P??{},tags:I},B=yield this.uploadToIPFSViaPushNode(JSON.stringify(L));if(!((yield this.fetchAllownace(v,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=D)&&(A==null||A(a.default["PUSH-UPDATE-02"]),!(yield this.approveToken(v,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,D))))throw new Error("Something went wrong while approving the token");const q="1+"+B,W=r.stringToBytes(q);A==null||A(a.default["PUSH-UPDATE-03"]);const re=yield this.updateChannel(this.coreContract,this.account,W,D);return A==null||A(a.default["PUSH-UPDATE-04"]),{transactionHash:re}}catch(P){const v=a.default["PUSH-ERROR-02"];throw A==null||A(v("Update Channel",P)),new Error(`Push SDK Error: Contract channel::update : ${P}`)}}),this.verify=w=>e.__awaiter(this,void 0,void 0,function*(){try{if(this.checkSignerObjectExists(),(0,i.validateCAIP)(w)&&(w=w.split(":")[2]),!r.isAddress(w))throw new Error("Invalid channel address");const E=yield this.info(this.account);if((E==null?void 0:E.verified_status)==0)throw new Error("Only verified channel can verify other channel");const C=yield this.verifyChannel(this.coreContract,w);if(!C)throw new Error("Something went wrong while verifying the channel");return{transactionHash:C}}catch(E){throw new Error(`Push SDK Error: Contract channel::verify : ${E}`)}}),this.setting=w=>e.__awaiter(this,void 0,void 0,function*(){try{this.checkSignerObjectExists();const E=yield this.createContractInstance(s.TOKEN[this.env],s.ABIS.TOKEN,s.TOKEN_VIEM_NETWORK_MAP[this.env]),C=yield this.fetchBalance(E,this.account),R=r.parseUnits(s.MIN_TOKEN_BALANCE[this.env].toString(),18),M=yield this.fetchUpdateCounter(this.coreContract,this.account),_=R*M;if(_>C)throw new Error("Insufficient PUSH balance");if(!((yield this.fetchAllownace(E,this.account,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT))>=_)&&!(yield this.approveToken(E,s.CORE_CONFIG[this.env].EPNS_CORE_CONTRACT,_)))throw new Error("Something went wrong while approving your token");const{setting:I,description:P}=this.getMinimalSetting(w);return{transactionHash:yield this.createChanelSettings(this.coreContract,w.length,I,P,R)}}catch(E){throw new Error(`Push SDK Error: Contract : channel::setting : ${E}`)}}),this.notifications=(w,E)=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:C,limit:R,filter:M=null,raw:_=!0}=E||{};return yield n.getChannelNotifications({channel:w,env:this.env,filter:M,raw:_,page:C,limit:R})}catch(C){throw new Error(`Push SDK Error: Contract : channel::notifications : ${C}`)}}),this.list=w=>e.__awaiter(this,void 0,void 0,function*(){try{const{page:E,limit:C,sort:R=f.ChannelListSortType.SUBSCRIBER,order:M=f.ChannelListOrderType.DESCENDING,filter:_,tag:A,user_subscribed:I}=w||{};return yield n.getChannels({env:this.env,page:E,limit:C,sort:R,order:M,filter:_,tag:A,user_subscribed:I})}catch(E){throw new Error(`Push SDK Error: Contract : channel::list : ${E}`)}}),this.delegate=new l.Delegate(y,g,m),this.alias=new c.Alias(y,g,m),this.tags=new u.Tags(this,y,g,m)}}return bu.Channel=d,bu}var Fp={},Q_;function PM(){return Q_||(Q_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Notification=e.FEED_MAP=void 0;const t=Ke,r=Je(),n=Ah(),s=In(),i=go(),o=tt(),a=Fl(),f="Channel is needed";e.FEED_MAP={INBOX:!1,SPAM:!0};class c extends a.PushNotificationBaseClass{constructor(u,p,d,h){super(u,p,d,h),this.list=(y=n.FeedType.INBOX,g)=>t.__awaiter(this,void 0,void 0,function*(){const{page:m=r.default.PAGINATION.INITIAL_PAGE,limit:b=r.default.PAGINATION.LIMIT,channels:w=[],raw:E=!1}=g||{};try{let C;g!=null&&g.account?this.isValidPCaip(g.account)?C=(0,o.pCAIP10ToWallet)(g.account):C=g.account:this.account&&(C=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(C);const R=this.getAddressFromCaip(C);if(w.length==0)return yield s.getFeeds({user:R,page:m,limit:b,spam:e.FEED_MAP[y],raw:E,env:this.env});{const M=w.map(I=>t.__awaiter(this,void 0,void 0,function*(){return yield s.getFeedsPerChannel({user:R,page:m,limit:b,spam:e.FEED_MAP[y],raw:E,env:this.env,channels:[I]})}));return(yield Promise.all(M)).flat()}}catch(C){throw new Error(`Push SDK Error: API : notifcaiton::list : ${C}`)}}),this.subscriptions=y=>t.__awaiter(this,void 0,void 0,function*(){try{const{page:g=r.default.PAGINATION.INITIAL_PAGE,limit:m=r.default.PAGINATION.LIMIT,channel:b=null,raw:w}=y||{};let E;return y!=null&&y.account?this.isValidPCaip(y.account)?E=(0,o.pCAIP10ToWallet)(y.account):E=y.account:this.account&&(E=(0,o.getFallbackETHCAIPAddress)(this.env,this.account)),this.checkUserAddressExists(E),yield s.getSubscriptions({user:E,env:this.env,channel:b,raw:w})}catch(g){throw new Error(`Push SDK Error: API : notifcaiton::subscriptions : ${g}`)}}),this.subscribe=(y,g)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:m,onError:b,settings:w}=g||{};if(this.checkSignerObjectExists(),this.checkUserAddressExists(),!y&&y!="")throw new Error(f);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const E=(0,o.getCAIPDetails)(y),C=(0,o.getCAIPWithChainId)(this.account,parseInt(E==null?void 0:E.networkId)),R=this.getMinimalUserSetting(w);return yield i.subscribeV2({signer:this.signer,channelAddress:y,userAddress:C,env:this.env,settings:R??"",onSuccess:m,onError:b,pgpPrivateKey:this.pgpPrivateKey})}catch(m){throw new Error(`Push SDK Error: API : notifcaiton::subscribe : ${m}`)}}),this.unsubscribe=(y,g)=>t.__awaiter(this,void 0,void 0,function*(){try{const{onSuccess:m,onError:b}=g||{};if(this.checkUserAddressExists(),this.checkSignerObjectExists(),!y&&y!="")return new Error(f);this.isValidPCaip(y)&&(y=(0,o.pCAIP10ToWallet)(y)),(0,o.validateCAIP)(y)||(y=(0,o.getFallbackETHCAIPAddress)(this.env,y));const w=(0,o.getCAIPDetails)(y),E=(0,o.getCAIPWithChainId)(this.account,parseInt(w==null?void 0:w.networkId));return yield i.unsubscribeV2({signer:this.signer,channelAddress:y,userAddress:E,env:this.env,onSuccess:m,onError:b,pgpPrivateKey:this.pgpPrivateKey})}catch(m){throw new Error(`Push SDK Error: API : notifcaiton::unsubscribe : ${m}`)}})}}e.Notification=c}(Fp)),Fp}var Au={},Su={},e4;function TM(){if(e4)return Su;e4=1,Object.defineProperty(Su,"__esModule",{value:!0}),Su.SpaceV2=void 0;const e=Ke,t=Nr();let r=class{constructor({spaceV1Instance:s,spaceInfo:i}){this.spaceV1Instance=s,this.spaceInfo=i}start(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.start()})}join(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.join()})}update(s){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.update(s)})}leave(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.leave()})}stop(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.stop()})}requestForMic(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.requestToBePromoted({role:t.SPACE_INVITE_ROLES.SPEAKER,promotorAddress:this.spaceInfo.spaceCreator})})}acceptMicRequest({address:s,signal:i}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionRequest({promoteeAddress:s,spaceId:this.spaceInfo.spaceId,role:t.SPACE_INVITE_ROLES.SPEAKER,signalData:i})})}rejectMicRequest({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionRequest({promoteeAddress:s})})}inviteToPromote({address:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.inviteToPromote({inviteeAddress:s,role:t.SPACE_INVITE_ROLES.SPEAKER})})}acceptPromotionInvite({signal:s}){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.acceptPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator,spaceId:this.spaceInfo.spaceId,signalData:s})})}rejectPromotionInvite(){return e.__awaiter(this,void 0,void 0,function*(){yield this.spaceV1Instance.rejectPromotionInvite({invitorAddress:this.spaceInfo.spaceCreator})})}config({audio:s}){typeof s=="boolean"&&this.spaceV1Instance.enableAudio({state:s})}};return Su.SpaceV2=r,Su}var t4;function IM(){if(t4)return Au;t4=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.Space=void 0;const e=Ke,t=Ll(),r=H2(),n=Xn(),s=_o(),i=sw(),o=aw(),a=Xn(),f=tt(),c=z2(),l=tt(),u=TM(),p=F2();class d{constructor(y,g,m,b,w){this.account=y,this.env=g,this.decryptedPgpPvtKey=m,this.signer=b,this.progressHook=w,this.participants={list:(E,C)=>e.__awaiter(this,void 0,void 0,function*(){const{page:R=1,limit:M=20}=C??{},_={chatId:E,page:R,limit:M,env:this.env};return{members:(yield n.getGroupMembers(_)).map(P=>({address:P.address,intent:P.intent,role:P.role.toUpperCase()==="ADMIN"?"SPEAKER":"LISTENER",userInfo:P.userInfo}))}}),count:E=>e.__awaiter(this,void 0,void 0,function*(){const C=yield n.getGroupMemberCount({chatId:E,env:this.env});return{participants:C.overallCount-C.pendingCount,pending:C.pendingCount}}),status:(E,C)=>e.__awaiter(this,void 0,void 0,function*(){const R=yield n.getGroupMemberStatus({chatId:E,did:C,env:this.env});return{pending:R.isPending,role:R.isAdmin?"SPEAKER":"LISTENER",participant:R.isMember}})},this.chatInstance=new c.Chat(this.account,this.env,{feature:[]},this.decryptedPgpPvtKey,this.signer)}create(y,g){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error("Signer is required to create a space.");const m={signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,spaceName:y,spaceDescription:g.description||null,listeners:g.participants.listeners,speakers:g.participants.speakers,spaceImage:g.image||null,isPublic:typeof g.private=="boolean"?!g.private:!0,rules:g.rules||{},config:{scheduleAt:g.schedule.start,scheduleEnd:g.schedule.end||null},env:this.env};return yield r.createV2(m)})}update(y,g){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());let m=null;try{if(m=yield n.getGroupInfo({chatId:y,env:this.env}),!m)throw new Error("Space not found")}catch{throw new Error("Space not found")}const b={chatId:y,groupName:g.name?g.name:m.groupName,groupDescription:g.description?g.description:m.groupDescription,groupImage:g.image?g.image:m.groupImage,rules:g.rules?g.rules:m.rules,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env},w={chatId:y,meta:g.meta?g.meta:m.meta,scheduleAt:g.scheduleAt?g.scheduleAt:m.scheduleAt,scheduleEnd:g.scheduleEnd?g.scheduleEnd:m.scheduleEnd,status:g.status?g.status:m.status,account:this.account,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env};yield(0,i.updateGroupProfile)(b);const E=yield(0,o.updateGroupConfig)(w);return(0,a.groupInfoDtoToSpaceInfoDto)(E)})}info(y){return e.__awaiter(this,void 0,void 0,function*(){const g=yield n.getGroupInfo({chatId:y,env:this.env});return(0,a.groupInfoDtoToSpaceInfoDto)(g)})}permissions(y){return e.__awaiter(this,void 0,void 0,function*(){const g={chatId:y,did:this.account,env:this.env};return yield n.getGroupAccess(g)})}add(y,g){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const{role:m,accounts:b}=g;if(!["SPEAKER","LISTENER"].includes(m))throw new Error("Invalid role provided.");if(!b||b.length===0)throw new Error("accounts array cannot be empty!");b.forEach(C=>{if(!(0,f.isValidPushCAIP)(C))throw new Error(`Invalid account address: ${C}`)});let E;return m==="SPEAKER"?E=yield n.addAdmins({chatId:y,admins:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):E=yield n.addMembers({chatId:y,members:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(E)})}remove(y,g){return e.__awaiter(this,void 0,void 0,function*(){const{accounts:m}=g;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!m||m.length===0)throw new Error("Accounts array cannot be empty!");m.forEach(E=>{if(!(0,f.isValidPushCAIP)(E))throw new Error(`Invalid account address: ${E}`)});const b=[],w=[];for(const E of m){const C=yield n.getGroupMemberStatus({chatId:y,did:E,env:this.env});C.isAdmin?b.push(E):C.isMember&&w.push(E)}return b.length>0&&(yield n.removeAdmins({chatId:y,admins:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),w.length>0&&(yield n.removeMembers({chatId:y,members:w,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}modify(y,g){return e.__awaiter(this,void 0,void 0,function*(){const{role:m,accounts:b}=g;if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());if(!["SPEAKER","LISTENER"].includes(m))throw new Error("Invalid role provided.");if(!b||b.length===0)throw new Error("accounts array cannot be empty!");b.forEach(R=>{if(!(0,f.isValidPushCAIP)(R))throw new Error(`Invalid account address: ${R}`)});let E=null;m==="SPEAKER"?E="ADMIN":E="MEMBER";const C=yield n.modifyRoles({chatId:y,newRole:E,members:b,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1});return(0,a.groupInfoDtoToSpaceInfoDto)(C)})}join(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const g=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});return g.isPending?yield n.approve({senderAddress:y,env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):g.isMember||(yield n.addMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1})),yield this.info(y)})}leave(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());const g=yield n.getGroupMemberStatus({chatId:y,did:this.account,env:this.env});let m;return g.isAdmin?m=yield n.removeAdmins({chatId:y,admins:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}):m=yield n.removeMembers({chatId:y,members:[this.account],env:this.env,account:this.account,signer:this.signer,pgpPrivateKey:this.decryptedPgpPvtKey,overrideSecretKeyGeneration:!1}),(0,a.groupInfoDtoToSpaceInfoDto)(m)})}search(y,g){return e.__awaiter(this,void 0,void 0,function*(){const{page:m=1,limit:b=20}=g??{};return(yield r.search({searchTerm:y,pageNumber:m,pageSize:b,env:this.env})).map(E=>n.spaceDtoToSpaceInfoDto(E))})}trending(y){return e.__awaiter(this,void 0,void 0,function*(){const{page:g=1,limit:m=20}=y??{};return yield r.trending({page:g,limit:m,env:this.env})})}list(y,g){return e.__awaiter(this,void 0,void 0,function*(){const b={account:(g==null?void 0:g.overrideAccount)||this.account,pgpPrivateKey:this.decryptedPgpPvtKey,page:g==null?void 0:g.page,limit:g==null?void 0:g.limit,env:this.env,toDecrypt:!!this.decryptedPgpPvtKey};switch(y){case t.SpaceListType.SPACES:return yield r.spaces(b);case t.SpaceListType.REQUESTS:return yield r.requests(b);default:throw new Error("Invalid Space List Type")}})}accept(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.accept(y)})}reject(y){return e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return this.chatInstance.reject(y)})}get chat(){return{send:(y,g)=>e.__awaiter(this,void 0,void 0,function*(){return this.chatInstance.send(y,g)}),decrypt:y=>e.__awaiter(this,void 0,void 0,function*(){if(!this.signer)throw new Error(s.PushAPI.ensureSignerMessage());return yield this.chatInstance.decrypt(y)}),latest:y=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.latest(y)}),history:(y,g)=>e.__awaiter(this,void 0,void 0,function*(){return yield this.chatInstance.history(y,g)})}}initialize(y){return e.__awaiter(this,void 0,void 0,function*(){const{onChange:g,spaceId:m}=y;if(!this.signer)throw new Error("Signer is required for push space");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Space functionality is not available.");const b=yield new l.Signer(this.signer).getChainId();if(!b)throw new Error("Chain Id not retrievable from signer");const w=new p.Space({signer:this.signer,chainId:b,pgpPrivateKey:this.decryptedPgpPvtKey,setSpaceData:g,address:this.account,env:this.env});yield w.initialize({spaceId:m});const E=yield this.info(m);return new u.SpaceV2({spaceV1Instance:w,spaceInfo:E})})}}return Au.Space=d,Au}var Pu={},Tu={},Iu={},r4;function CM(){if(r4)return Iu;r4=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.validatePeerInfo=void 0;const e=tt(),t=Nr(),r=n=>{const{signal:s,address:i,meta:o}=n;if(!s)throw new Error("Invalid signal data received");if(!(0,e.isValidPushCAIP)(i))throw new Error("Invalid address received");if(o.rules.access.type===t.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!o.rules.access.data.chatId)throw new Error("ChatId not found in meta.rules")};return Iu.validatePeerInfo=r,Iu}var n4;function RM(){if(n4)return Tu;n4=1,Object.defineProperty(Tu,"__esModule",{value:!0}),Tu.VideoV2=void 0;const e=Ke,t=ei(),r=Xn(),n=tt(),s=Nr(),i=dn(),o=CM();let a=class{constructor({videoV1Instance:c,account:l,decryptedPgpPvtKey:u,env:p,peerInfos:d}){this.videoInstance=c,this.account=l,this.decryptedPgpPvtKey=u,this.env=p,this.peerInfos=d}request(c,l){return e.__awaiter(this,void 0,void 0,function*(){const{rules:u}=l||{};for(const d of c)if(!(0,n.isValidPushCAIP)(d))throw new Error("Invalid recipient address found");if(c.length===0)throw new Error("Alteast one recipient address is required for a video call");if(c.length>1&&(u==null?void 0:u.access.type)===s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT&&!u.access.data.chatId)throw new Error("For multiple recipient addresses, chatId is required for a video call");let p="";if(!(u!=null&&u.access.data.chatId)){let d=1;const h=30;for(;!p;){const y=yield(0,r.chats)({account:this.account,toDecrypt:!0,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,page:d,limit:h});if(y.length===0)break;y.forEach(g=>{g.did===(0,n.walletToPCAIP10)(c[0])&&g.chatId&&(p=g.chatId)}),d++}if(!p)throw new Error(`ChatId not found between local user (${this.account}) and recipient (${c[0]}).`)}this.videoInstance.setData(d=>(0,t.produce)(d,h=>{var y;h.local.address=this.account,h.incoming=c.map(g=>({address:(0,n.pCAIP10ToWallet)(g),status:i.VideoCallStatus.INITIALIZED})),h.meta.chatId=(y=u==null?void 0:u.access.data.chatId)!==null&&y!==void 0?y:p})),yield this.videoInstance.request({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:c.map(d=>(0,n.pCAIP10ToWallet)(d)),rules:u??{access:{type:s.VIDEO_NOTIFICATION_ACCESS_TYPE.PUSH_CHAT,data:{chatId:p}}}})})}approve(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.acceptRequest({senderAddress:(0,n.pCAIP10ToWallet)(this.account),recipientAddress:(0,n.pCAIP10ToWallet)(c),signalData:l.signal,rules:l.meta.rules})})}deny(c){return e.__awaiter(this,void 0,void 0,function*(){if(!c){const u=Object.keys(this.peerInfos);if(u.length!==1)throw new Error("Either no request exists or more than one request found. Please pass an address.");c=u[0]}const l=this.peerInfos[(0,n.walletToPCAIP10)(c)];(0,o.validatePeerInfo)(l),yield this.videoInstance.disconnect({peerAddress:(0,n.pCAIP10ToWallet)(c)})})}disconnect(){return e.__awaiter(this,void 0,void 0,function*(){yield this.videoInstance.disconnect()})}config({video:c,audio:l}){typeof c=="boolean"&&this.videoInstance.enableVideo({state:c}),typeof l=="boolean"&&this.videoInstance.enableAudio({state:l})}};return Tu.VideoV2=a,Tu}var i4;function kM(){if(i4)return Pu;i4=1,Object.defineProperty(Pu,"__esModule",{value:!0}),Pu.Video=void 0;const e=Ke,t=$l(),r=dn(),n=tt(),s=iw(),i=RM(),o=ei(),a=rw();class f{constructor(l,u,p,d){this.account=l,this.env=u,this.decryptedPgpPvtKey=p,this.signer=d,this.peerInfos={}}initialize(l,u){return e.__awaiter(this,void 0,void 0,function*(){const{stream:p,config:d,media:h}=u;if(!this.signer)throw new Error("Signer is required for push video");if(!this.decryptedPgpPvtKey)throw new Error("PushSDK was initialized in readonly mode. Video functionality is not available.");const y=yield new n.Signer(this.signer).getChainId();if(!y)throw new Error("Chain Id not retrievable from signer");const g=new s.Video({signer:this.signer,chainId:y,pgpPrivateKey:this.decryptedPgpPvtKey,env:this.env,setData:l});return yield g.create(Object.assign(Object.assign(Object.assign({},h&&{stream:h}),(d==null?void 0:d.audio)&&{audio:d.audio}),(d==null?void 0:d.video)&&{video:d.video})),p.on(t.default.STREAM.VIDEO,m=>{const{address:b,signal:w,meta:{rules:E}}=m.peerInfo,C=E.access.data.chatId;m.event===t.default.VIDEO.EVENT.REQUEST&&(this.peerInfos[(0,n.walletToPCAIP10)(m.peerInfo.address)]=m.peerInfo,g.setData(R=>(0,o.produce)(R,M=>{M.local.address=this.account,M.incoming[0].address=b,M.incoming[0].status=r.VideoCallStatus.RECEIVED,M.meta.chatId=C,M.meta.initiator.address=b,M.meta.initiator.signal=w}))),C&&C===g.data.meta.chatId&&(m.event===t.default.VIDEO.EVENT.DENY&&(g.data.local.stream&&(0,a.endStream)(g.data.local.stream),g.setData(()=>s.initVideoCallData)),(m.event===t.default.VIDEO.EVENT.APPROVE||m.event===t.default.VIDEO.EVENT.RETRY_APPROVE)&&g.connect({peerAddress:b,signalData:w}),m.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&g.isInitiator()&&g.request({senderAddress:this.account,recipientAddress:b,rules:E,retry:!0}),m.event===t.default.VIDEO.EVENT.RETRY_REQUEST&&!g.isInitiator()&&g.acceptRequest({signalData:w,senderAddress:this.account,recipientAddress:b,rules:E,retry:!0}))}),new i.VideoV2({videoV1Instance:g,account:this.account,decryptedPgpPvtKey:this.decryptedPgpPvtKey,env:this.env,peerInfos:this.peerInfos})})}}return Pu.Video=f,Pu}var s4;function _o(){if(s4)return eu;s4=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.PushAPI=void 0;const e=Ke,t=Je(),r=In(),n=Xn(),s=Mt(),i=z2(),o=nM(),a=iM(),f=G2(),c=bM(),l=SM(),u=PM(),p=en(),d=IM(),h=kM(),y=tt(),g=x2(),m=$2();let b=class mw{constructor(E,C,R,M,_,A,I,P,v){this.signer=I,this.readMode=R,this.alpha=M,this.env=E,this.account=C,this.chainWiseAccount=(0,y.walletToPCAIP10)(C),this.decryptedPgpPvtKey=_,this.pgpPublicKey=A,this.progressHook=P,this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.uid=(0,m.v4)(),this.cache=g.cache,this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.space=new d.Space(this.account,this.env,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.user=new f.User(this.account,this.env),this.video=new h.Video(this.account,this.env,this.decryptedPgpPvtKey,this.signer),this.errors=v||[]}static initialize(...E){return e.__awaiter(this,void 0,void 0,function*(){try{let C,R,M;if(E.length===1&&typeof E[0]=="object")"account"in E[0]&&typeof E[0].account=="string"?R=E[0]:[C]=E;else if(E.length===2)[C,R]=E;else throw new Error("Invalid arguments provided to initialize method.");if(R&&"decryptedPGPPrivateKey"in R&&typeof R.decryptedPGPPrivateKey=="string"&&(M=R.decryptedPGPPrivateKey),!C&&!(R!=null&&R.account))throw new Error("Either 'signer' or 'account' must be provided.");let _=!C&&!M;const A={env:t.ENV.STAGING,version:t.default.ENC_TYPE_V3,autoUpgrade:!0,account:null},I=Object.assign(Object.assign(Object.assign({},A),R),{version:(R==null?void 0:R.version)||A.version,versionMeta:(R==null?void 0:R.versionMeta)||A.versionMeta,autoUpgrade:(R==null?void 0:R.autoUpgrade)!==void 0?R==null?void 0:R.autoUpgrade:A.autoUpgrade,alpha:R!=null&&R.alpha&&R.alpha.feature?R.alpha:p.ALPHA_FEATURE_CONFIG[t.PACKAGE_BUILD]}),P=[];let v;if(C?v=yield(0,s.getAccountAddress)((0,s.getWallet)({account:I.account,signer:C})):v=R==null?void 0:R.account,!v)throw new Error("Account could not be derived.");let S;const T=yield r.get({account:v,env:I.env});if(T&&T.publicKey&&(S=T.publicKey),!_)try{if(T&&T.encryptedPrivateKey)M||(M=yield n.decryptPGPKey({encryptedPGPPrivateKey:T.encryptedPrivateKey,signer:C,toUpgrade:I.autoUpgrade,additionalMeta:I.versionMeta,progressHook:I.progressHook,env:I.env}));else{const D=yield r.create({env:I.env,account:v,signer:C,version:I.version,additionalMeta:I.versionMeta,origin:I.origin,progressHook:I.progressHook});M=D.decryptedPrivateKey,S=D.publicKey}}catch(D){const O="Error decrypting PGP private key ...swiching to Guest mode "+(`
77
+ `+D);if(P.push({type:"ERROR",message:O}),console.error(O),(0,y.isValidNFTCAIP)(v)){const L="NFT Account Detected. If this NFT was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";P.push({type:"WARN",message:L}),console.warn(L)}else if((0,y.isValidSCWCAIP)(v)){const L="Smart Contract Wallet Account Detected. If this SCW was recently transferred to you, please ensure you have received the correct password from the previous owner. Alternatively, you can reinitialize for a fresh start. Please be aware that reinitialization will result in the loss of all previous account data.";P.push({type:"WARN",message:L}),console.warn(L)}_=!0}return new mw(I.env,v,_,I.alpha,M,S,C,I.progressHook,P)}catch(C){throw console.error("Error initializing PushAPI:",C),C}})}reinitialize(E){return e.__awaiter(this,void 0,void 0,function*(){const C=yield r.create({env:this.env,account:this.account,signer:this.signer,additionalMeta:E.versionMeta,progressHook:this.progressHook});this.decryptedPgpPvtKey=C.decryptedPrivateKey,this.pgpPublicKey=C.publicKey,this.readMode=!1,this.errors=[],this.uid=(0,m.v4)(),this.chat=new i.Chat(this.account,this.env,this.alpha,this.decryptedPgpPvtKey,this.signer,this.progressHook),this.profile=new o.Profile(this.account,this.env,this.cache,this.decryptedPgpPvtKey,this.progressHook),this.encryption=new a.Encryption(this.account,this.env,this.decryptedPgpPvtKey,this.pgpPublicKey,this.signer,this.progressHook),this.channel=new l.Channel(this.signer,this.env,this.account,this.decryptedPgpPvtKey),this.notification=new u.Notification(this.signer,this.env,this.account,this.decryptedPgpPvtKey)})}initStream(E,C){return e.__awaiter(this,void 0,void 0,function*(){if(this.stream)throw new Error("Stream is already initialized.");return this.stream=yield c.PushStream.initialize(this.account,E,this.env,this.decryptedPgpPvtKey,this.progressHook,this.signer,C),this.stream})}info(E){return e.__awaiter(this,void 0,void 0,function*(){const C=(E==null?void 0:E.overrideAccount)||this.account;return yield r.get({account:C,env:this.env})})}readmode(){return this.readMode}static ensureSignerMessage(){return"Operation not allowed in read-only mode. Signer is required."}};return eu.PushAPI=b,eu}var a4;function MM(){return a4||(a4=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.video=e.space=e.chat=e.payloads=e.utils=e.user=e.channels=e.alias=e.PushAPI=e.CONSTANTS=void 0;const t=Ke,r=q9();e.alias=r;const n=go();e.channels=n;const s=In();e.user=s;const i=B2();e.utils=i;const o=Ih();e.payloads=o;const a=Xn();e.chat=a;const f=H2();e.space=f;const c=V2();e.video=c;const l=$l();e.CONSTANTS=l.default,t.__exportStar(dn(),e),t.__exportStar(Ah(),e),t.__exportStar(Sh(),e),t.__exportStar(Ll(),e);var u=_o();Object.defineProperty(e,"PushAPI",{enumerable:!0,get:function(){return u.PushAPI}})}(Dh)),Dh}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Ke.__exportStar(MM(),e)})(Fy);const OM=iA(Fy),HM=pA({__proto__:null,default:OM},[Fy]);export{HM as i};